Recovery
A device errors, a move drops a plate, a driver stops answering. Orca Framework stops the labware thread that hit the fault and waits for a person, so you can answer it without losing the rest of the workflow. This page is written for that person: what a paused thread looks like, how to see why, what you can tell it to do, and what each of those answers does. The incident record behind it all is further down.
A paused thread waits for you
Two different things stop a thread, and they are lifted differently.
- An error pause. An action or a move raised under
FailurePolicy.PAUSE, which is the default. The thread stops where it is, the runtime files an incident, and the thread keeps its reservations, so other threads waiting on that device queue behind it. It waits until an operator sends a recovery decision.resumedoes not lift it. The policy that produced it is in Failure policies. - A manual pause. Somebody paused the thread or the execution for a maintenance window or an inspection.
resumelifts it, and no decision is needed. See Manual pause and resume.
Acknowledging the incident does not advance the thread either. Ack clears the alert. A recovery decision moves the thread.
Why it stopped
One read answers it for the whole run:
orca --json runtime status
The blockers list in the answer is everything stopping the run. GET /api/runtime/status returns the same.
Each entry names its kind, a headline, and the remedies that clear it, worst first. The recovery verbs on a remedy are read off the same table that refuses them, so a verb offered here can never be refused on the call.
A remedy is a list of steps to send in order. Each step gives the same call three ways:
| Field | What it holds |
|---|---|
cli | The orca command line to run. |
rest | The route, as METHOD /path, with <arg> where an argument goes in the path. |
args | The request body, exactly as the route takes it. query names the arguments that go in the query string instead. |
needs | Arguments Orca could not fill in, such as the plate in the way. The cli line has a <name> placeholder for each. Supply them before you send the step. |
A remedy with confirm: true changes the record or ends work, so read its explain first. An unacknowledged incident is not a blocker; a blocker carries its incident_id. See Runtime.
Per thread, read the snapshot:
orca execution detail <exec-id> # every error-paused thread in the execution
orca execution thread detail <exec-id> <tid> # the same for one thread
pause_site says where the thread stopped. honoured_decisions lists exactly the verbs that site will accept.
The incidents themselves:
orca incident list --unacknowledged
orca incident get <id>
The recovery decisions
Six verbs, in escalation order, cheapest first.
Two retries
An action is the author's Python function. A failure inside it comes from one of two places, and each has its own retry.
- A device command failed. The command can be sent again.
RETRYrepeats just that call. The function stays paused at itsawaitand carries on when the call succeeds. - The author's own code failed, for example a divide by zero or a missing key. A line of Python cannot be repeated on its own. Only the whole function can run again, so the retry is
RETRY_ACTION.
Most pause sites honour exactly one of the two. Two honour neither: UNHANDLED_ERROR, where the step that failed is unknown, and CO_LABWARE_LOST, where the action waits for labware that will never come. See What each pause site honours.
from orca.sdk.workflow import RecoveryDecision
| Decision | What happens |
|---|---|
RETRY | Repeat only the step that failed. Inside an action, that is the failed device operation: the same call with the same arguments, with the hardware reconciled first. The rest of the action body stays suspended at its await, and the calls it already completed stay done. At a move or any other step, it repeats that step. |
RETRY_ACTION | Re-run the whole action body from the top, re-resolving variables. Every device call the action already completed runs again. Used when the action's own code failed. |
CONTINUE | The operator says the situation is dealt with, so the run carries on. |
ABORT_ACTION | Discard the failing action as work that never happened; advance to the next action in the method. |
ABORT_METHOD | Abandon the rest of the current method; advance to the next method in the thread. |
ABORT_THREAD | Mark the thread aborted. Reservations release. The execution finishes at PARTIAL_COMPLETED if another thread completes, otherwise at ABORTED. |
orca execution thread recover <exec> <tid> <decision>
Where <decision> is retry, retry-action, continue, abort-action, abort-method or abort-thread. Daemon REST: POST /api/executions/{execution_id}/threads/{thread_id}/recover.
CONTINUE and ABORT_ACTION are not the same answer
Both advance to the next action. They say different things. ABORT_ACTION discards the action as work that never happened. CONTINUE records it as operator-confirmed rather than executed. Neither promises the work got done.
CONTINUE means the operator has dealt with it and the run may carry on: the call really did succeed, or they fixed the situation by hand.
At a failed move, CONTINUE means the operator carried the labware to the target themselves. It is refused there until the ledger says the labware IS at the target, because the run has to plan the next action from somewhere. The refusal names where the ledger currently has the labware and tells you the sequence: put it at the target, record that with orca labware edit-location, then CONTINUE. If it is somewhere else, record that instead and RETRY, and the move replans from wherever you said.
CONTINUE is refused entirely outside an errored action and a ledger-confirmed move. There is nothing to declare finished at a pause site where no action or move is bound.
What each pause site honours
A thread stops at one of several pause sites, and they do not accept the same verbs. RETRY inside an action repeats a suspended device call, so it needs one suspended. RETRY_ACTION re-runs an action body, so it needs an action whose own code failed. ABORT_ACTION discards a bound action, so it needs one bound.
The engine says which verbs it will take, and refuses the rest. ThreadSnapshot.honoured_decisions carries them, and the refusal happens before anything is delivered, so a wrong pick costs a message rather than the thread. Read the field and offer exactly those; do not send a decision to find out.
| Pause site | Where the thread stopped | Honours |
|---|---|---|
DEVICE_OP | A device command inside an action failed. The action is suspended at that call. | RETRY, CONTINUE, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
COMMAND_SAVE | A device command inside an action ran, and saving its answer to the record failed. RETRY saves the answer again and sends nothing to the device. RETRY_ACTION is refused, because it would send the command a second time. | RETRY, CONTINUE, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
ACTION_WAIT | A ctx.wait_for or ctx.manual_step inside an action ran out of time. RETRY waits again and re-runs nothing else. | RETRY, CONTINUE, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
ACTION_BODY | The action's own code raised, or one of the device failures listed below. | RETRY_ACTION, CONTINUE, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
MOVE | A transporter move raised. | RETRY, CONTINUE, ABORT_THREAD |
THREAD_STEP | The thread failed outside any action: its body raised, or its plate source was offline for the start dispense. | RETRY, ABORT_THREAD |
WAIT_EVENT_TIMEOUT | An orca.on thread step ran out of time. RETRY waits again. | RETRY, ABORT_THREAD |
CO_LABWARE_WAIT | An action's other labware did not arrive within coordination.co_labware_timeout. The action has not started. RETRY waits again with the whole timeout; the thread keeps the device meanwhile. | RETRY, ABORT_THREAD |
CO_LABWARE_LOST | A plate this action waits for was aborted, stopped or failed before it arrived. The message names that plate and the action. ABORT_ACTION skips the action; ABORT_THREAD ends this plate. RETRY is not offered: the action stays bound to the plate that will not come. | ABORT_ACTION, ABORT_THREAD |
UNHANDLED_ERROR | An error escaped the thread's own handling, so the step that failed is unknown. Look at where it stopped and take the labware over by hand. An error under failure_policy=ABORT still fails the thread instead. | ABORT_THREAD |
ACTION_RESOLUTION | Failed before any action was bound. | RETRY, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
MOVE_RESOLUTION | No route to plan, usually because the labware is recorded somewhere nothing serving this move can reach. | RETRY, ABORT_THREAD |
DEADLOCK | The reservation graph could not be resolved. | RETRY, ABORT_ACTION, ABORT_METHOD, ABORT_THREAD |
SPAWN_CAPACITY | An auto-spawn was refused before an action existed: a full REJECT slot, or a named partner labware that cannot serve, or a spawn that failed (AUTO_SPAWN_FAILED). Put it right, then RETRY. | RETRY, ABORT_THREAD |
At ACTION_BODY, RETRY is refused with "no command failed, so the step cannot be repeated; use RETRY_ACTION". Three failures raised by a device also land at ACTION_BODY, because they do not come back through the device call:
- external control and the other signals that override with a pause, such as a maintenance window or
HALT; - a recoverable command timeout that the operator aborted;
- a divergence between the hardware and the driver, reported by the reconcile that runs before a retry.
So after a divergence the retry is RETRY_ACTION.
Every other site except UNHANDLED_ERROR and CO_LABWARE_LOST honours RETRY, which repeats the step that stopped there. All of them refuse RETRY_ACTION.
A verb does not always do what its name suggests. At ACTION_RESOLUTION and DEADLOCK there is no bound action, so ABORT_ACTION and ABORT_METHOD cannot discard one: they end the thread. That is deliberate. The alternative was leaving the owner of a rendezvous and all its contributors parked at PAUSED forever. Every refusal message names what the site lacks, so an operator reading it can work out why.
At MOVE, the action-level aborts are refused rather than widened, because discarding an action there would leave the labware where the next action does not expect it.
Incidents
An incident is a structured record: what happened, where, what kind of thing it is, and what the suggested recovery is. The runtime records it. The operator acknowledges it. Some incidents pause threads. Some are informational.
from orca.sdk.runtime import (
SystemIncident, # the record
IncidentCategory, # what kind
IncidentSeverity, # how bad
RecoveryAction, # suggested response
)
| Field | What it holds |
|---|---|
id | UUID for the incident. ID-prefix lookups work in the CLI (4 characters is enough). |
timestamp | When it fired (seconds since epoch). |
category | See the taxonomy. |
severity | INFO / WARNING / ERROR / CRITICAL. |
execution_id | The execution that triggered it. None for system-level. |
thread_id | The thread that triggered it. None for execution-level. |
message | One-line human-readable summary. |
detail | Typed dataclass matching the category. |
recovery_action | Suggested response. Not enforced; the operator chooses. |
acknowledged | True once an operator has acked it. |
The detail field is a typed dataclass per category. A DECK_RECONCILE_CONFLICT incident carries DeckReconcileConflictDetail(device_name, labware_id, labware_name, position_id, reason, driver_site, blocking_labware_name, detail). No dict[str, Any], so a wire mis-shape is caught at type-check time.
Every recorded incident also fires an INCIDENT.<id>.<category> event, with the summary fields on it. A sink that wants to react to faults subscribes to the event stream rather than polling the store. See Events.
Severity levels
class IncidentSeverity(str, Enum):
INFO = "INFO" # informational; usually auto-resolved
WARNING = "WARNING" # operator attention recommended but not required
ERROR = "ERROR" # operator attention required
CRITICAL = "CRITICAL" # production-stopping; usually a deployment problem
The engine records only WARNING and ERROR today. INFO and CRITICAL are defined in the enum but no code path emits them.
Suggested recovery actions
class RecoveryAction(str, Enum):
THREAD_RECOVER_RETRY = "THREAD_RECOVER_RETRY" # fix the cause, repeat the failed step
THREAD_RECOVER_RETRY_ACTION = "THREAD_RECOVER_RETRY_ACTION" # fix the code or data, re-run the action
THREAD_RECOVER_ABORT = "THREAD_RECOVER_ABORT" # skip the action that triggered it
RESTART_EXECUTION = "RESTART_EXECUTION" # stop + remove + resubmit
RESUBMIT = "RESUBMIT" # nothing ran: fix the device, then submit again
RESUME_EXECUTION = "RESUME_EXECUTION" # resume to accept a partial fill
NONE = "NONE" # informational; no action possible
Not enforced. The operator picks what they actually do. recovery_action is the runtime's suggestion based on category; the CLI surfaces it via orca incident get <id>.
Incident categories
These are the categories the engine records today.
| Category | When it fires | Severity | Suggested recovery |
|---|---|---|---|
ACTION_FAILED | An action raised under the default PAUSE policy; the thread error-pauses. | ERROR | THREAD_RECOVER_RETRY if a device call failed. THREAD_RECOVER_RETRY_ACTION if the action's own code failed. |
MOVE_FAILED | A routing move raised under PAUSE; the thread error-pauses. The move-side mirror of ACTION_FAILED. | ERROR | THREAD_RECOVER_RETRY. RETRY repeats the move. A move is not an action body, so RETRY_ACTION is refused there. |
CO_LABWARE_TIMEOUT | An action's other labware did not arrive within coordination.co_labware_timeout; the thread pauses at CO_LABWARE_WAIT. The detail names the missing labware, the seconds waited and the device. | WARNING | THREAD_RECOVER_RETRY. RETRY waits again with the whole timeout. |
ACTION_CONTINUED | An operator answered CONTINUE at an errored action. The ACTION_FAILED record stays unacknowledged: continuing is not resolving. | WARNING | NONE. Nothing to recover, something to be aware of: state past that point is unverified. |
MOVE_CONTINUED | An operator finished a failed move by hand and answered CONTINUE. | WARNING | NONE. Says which arrival rests on a person's word rather than a completed place. |
THREAD_DIED | A thread stopped on an error that escaped every handler. The thread pauses at UNHANDLED_ERROR, where only ABORT_THREAD applies. Under failure_policy=ABORT the thread fails instead. | ERROR | NONE. No verb repairs the failed step. The incident names where the labware was left, because clearing it by hand is the only way it moves. |
UNRESOLVABLE_DEADLOCK | A reservation knot the engine could not break. Every thread in the execution is paused. | ERROR | THREAD_RECOVER_ABORT. See the special case. |
SYSTEM_STALL | Every live thread is internally blocked and none is in flight, stably. The execution is paused. | ERROR | RESTART_EXECUTION. See the special case. |
RECOVERABLE_TIMEOUT | A device command exceeded its advertised max_seconds with no answer. The threads pause while an operator decides. | WARNING | NONE; three dedicated decisions instead. See the special case. |
ORPHANED_BACKLOG | A receiver thread died still owing contributions. The engine quarantines the slot and pauses the affected threads. | ERROR | RESUME_EXECUTION: resume to accept the partial fill. Undelivered contributions are abandoned. |
DEVICE_INIT_FAILED | A device did not come up when a SIM or LIVE run was submitted, or its orca-client was not connected. The run was refused with devices_not_ready. | ERROR | RESUBMIT. Nothing ran: fix the device, then submit again. |
RECORD_NOT_SAVED | The database refused a save three times, and the run that needed it is paused. Also filed when a run ends before its events were confirmed saved; the run still ends. | ERROR | Fix the cause, then resume. |
AUTO_SPAWN_FAILED | A thread could not spawn the thread that brings its action's other labware. The thread pauses at SPAWN_CAPACITY. The detail names the labware asked for and the thread that asked. | ERROR | THREAD_RECOVER_RETRY: fix what stopped the spawn, then RETRY spawns again. |
DECK_RECONCILE_CONFLICT | The ledger and a liquid handler's driver disagree about one labware. | ERROR | NONE. Neither side is changed; the operator settles it. See Runtime state. |
LEDGER_CONTRADICTED | An ad-hoc operator command only makes sense if the record was wrong. The command is believed and folded. | WARNING | NONE. The fold is now wrong by an amount nothing can compute, so look at the labware and state its contents. |
UNRESOLVED_ANCHOR_INSERT | A Before / After insert was still pending when the lane closed. anchor_reached says whether the anchor came past and the insert still never ran, or the anchor never appeared at all. | WARNING | NONE. Informational: it makes an otherwise-silent drop queryable. |
Eight further categories are defined in IncidentCategory and carry persistence mappings, but nothing in the engine emits them today: VARIABLE_RESOLUTION, VARIABLE_VALIDATION, BARCODE_MISMATCH, RESERVATION_DEADLOCK, DEVICE_BUSY_EXHAUSTED, PLUGIN_HANDLER_EXCEPTION, EVENT_HANDLER_EXCEPTION, OTHER. Don't build a surface that assumes one of them will arrive.
CLI: orca incident list --category <category>. Daemon REST: GET /api/incidents?category=<category>.
The special cases
RECOVERABLE_TIMEOUT
Fires when an in-flight device command exceeds its advertised max_seconds without a response. Drivers that declare no timing get a default of 600 seconds. The engine owns the flow: the coordinator parks the dispatch on an event and pauses the threads while the operator deliberates.
Three operator decisions, surfaced via orca incident recoverable-timeout and the daemon routes POST /api/incidents/{id}/recoverable-timeout/{extend,abort,mark-complete}:
| Decision | When |
|---|---|
extend --additional-seconds <n> | The command is still progressing and likely to finish. Add to the budget. Repeatable. The execution stays paused. CRITICAL danger; a reason is optional. |
abort --operator <who> --reason <why> | The command is wedged. Cancel it; the thread error-pauses normally and the failure policy fires. CRITICAL danger; operator and reason are required. |
mark-complete --operator <who> --reason <why> | The command actually completed (you confirmed by inspection) but the driver never returned. Synthesizes success so downstream actions proceed, and clears the device fault, because someone looked. CRITICAL danger; operator and reason are required. |
All three acknowledge the incident and resume the threads the timeout paused.
If the driver's real answer arrives while the operator is deliberating, an extend picks it up immediately and uses it: nothing is lost. abort and mark-complete cancel the in-flight call and discard whatever it was about to return, because the operator's decision is authoritative. The gateway sends a cancel for the command id so a late orphan response cannot resolve a settled call. For a remote driver, the physical command keeps running until the wire-level cancel contract reaches orca-client.
@dataclass(frozen=True)
class RecoverableTimeoutContext:
device_id: str
command: str
command_id: str
elapsed_seconds: float
max_seconds: float
UNRESOLVABLE_DEADLOCK
The engine found a reservation knot (a set of threads none of which can proceed) that it could not break by rerouting or auto-aborting. It detects this with AND-OR knot detection, which catches knots spanning more than one simple cycle. Every thread in the affected execution is paused so the operator can investigate from a frozen state.
There is no "recover from deadlock" verb. Inspect what each thread was waiting on, then either stop the whole execution or surgically end one thread so the others can proceed. Threads paused at DEADLOCK honour ABORT_ACTION and ABORT_METHOD, both of which end the thread there.
SYSTEM_STALL
A co-labware wait is unbounded by default, because a partner may legitimately run a multi-hour action first. The structural stall detector is the backstop. Setting coordination.co_labware_timeout adds a limit: a wait that runs out records CO_LABWARE_TIMEOUT and pauses the thread at CO_LABWARE_WAIT.
It fires when every live thread is internally blocked in a co-labware wait or a reservation wait, with at least one thread waiting on co-labware, none in flight, and that exact shape holds across consecutive checks. A reservation-only wait never stalls on its own: reservation contention lasting minutes or hours is normal, and genuine reservation cycles belong to the deadlock detector. Reservation waits join the rule only while the whole system is quiescent, so a busy sibling execution can never mask a pure co-labware stall in another.
Operator waits (PAUSED, awaiting a manual place or remove, AWAITING_EVENT) are legitimate indefinite waits on the outside world and block a verdict by design.
SystemStallDetail(stalled_thread_ids, waits) names which threads are stuck and what each is waiting on. The execution is paused by the system, and orca run --wait on it stops waiting and reports the pause. Resuming clears the episode.
One residual false positive: a state blocked only on a system-held or manual operator hold can trip the detector even though the operator can release it without any thread acting. The cost is bounded: one incident and a pause, cleared by releasing the hold and resuming.
THREAD_DIED
Most faults pause the thread at a site that names the failed step. THREAD_DIED means the error escaped that handling, so the step that failed is unknown.
The thread pauses at UNHANDLED_ERROR, and the incident is filed beside the pause. Nothing can be repeated or carried past, so ABORT_THREAD is the only decision it honours. Answer it to end the thread. The other threads keep running meanwhile.
An error under failure_policy=ABORT does not pause. The thread fails, and the incident is filed.
Either way the labware sits where the crash left it. The incident names that position, because clearing it by hand is the only way it moves.
Manual pause and resume
Independent of incidents:
orca execution thread pause <execution_id> <thread_id>
orca execution thread resume <execution_id> <thread_id>
orca execution pause <execution_id>
orca execution resume <execution_id>
A pause holds between instrument commands; the command in progress finishes first. See orca execution pause/resume and orca execution thread pause.
| Mechanism | Use for |
|---|---|
| Manual pause | Planned holds: maintenance window, inspection, operator break. |
| Incident + recover | Unplanned failures: device errors, failed moves, timeouts. |
resume does NOT un-pause an error-paused thread. An error pause is lifted by a recovery decision; a manual pause is lifted by resume. resume_all_threads reports the difference in its counters: resumed, pause_cancelled, error_skipped, completed_skipped.
A stop ends an error-paused thread
An error-paused thread watches the recovery channel and nothing else, so asking it to stop used to reach nobody: only cancelling its task ended one, and every shutdown that asked politely first waited out its full drain timeout.
A cooperative stop now resolves that pause with ABORT_THREAD, which is the same unwind an operator would get. The action gives its device back and records the operations it is dropping, instead of abandoning both. A contributor following a peer's action is excluded: its own wait already races the stop, and feeding it a decision would consume the one its owner is waiting for.
resume_all_threads also refuses outright, returning all zeros, while the execution-level pause latch is set. That is what makes an operator's stop outrank a system pause: the recoverable-timeout coordinator resumes threads directly and cannot lift a latch a person set.
Acknowledging incidents
Incidents are immutable. Acknowledging replaces the record with a frozen copy carrying acknowledged=True. Ack does NOT advance the thread. A thread error-paused by an incident stays paused until you recover it with a decision; the ack just clears the alert.
orca incident ack <id>
orca incident ack-all --category RECOVERABLE_TIMEOUT
Pitfalls
- Acknowledge is not recover. Acking clears the alert but does NOT advance the error-paused thread.
- Do not send a decision to find out whether it applies. Read
honoured_decisionsoff the thread first. ABORT_ACTIONat a pause site with nothing bound ends the thread. AtACTION_RESOLUTIONandDEADLOCKit is not "skip one action".ABORT_ACTIONskips ONE action, not the whole method, where an action IS bound. If the failing action was structurally necessary, the next one may produce garbage.- Reservations stay held during PAUSE. Other threads waiting on the same device queue behind. To free it,
ABORT_THREADorreservation cancel. RETRYat a device call re-sends the SAME call with the SAME args. A variable changed while the thread is paused there is not picked up. It is read the next time an action resolves it.RETRY_ACTIONre-runs the whole action, so every device call it already completed runs again. Fine once the code or data that failed is put right; wrong if those calls must not happen twice. UseABORT_ACTIONand fix the workflow code instead.CONTINUEat a move is refused until the ledger agrees. Record the position first.UNRESOLVABLE_DEADLOCKfreezes every thread in the execution. Don't recover one and expect the others to follow; deal with the thread holding the contended reservation, then resume the rest.RecoveryActionis a suggestion, not an enforcement. Don't write tooling that assumes it will be followed.- Ten incident categories are defined but never emitted. Don't build a surface around one.
See also
- Failure policies: the per-action pause-or-abort decision that creates error-paused threads.
- Runtime state: deck conflicts, contradicted ledgers, and the unsettled worklist.
- CLI: recover: the operator surface for triage and recovery decisions.
- Runtime: the one list of blockers, and pausing an execution.
- Events:
INCIDENT.*andDEVICE.*events.