Skip to content

Assignment handling

What a node does with one assignment, from the moment a worker slot takes it from the local queue to the moment its lease is released. Every assignment goes through the same three stages: a processing context is prepared, the assignment is routed by its kind, and it is finalized whatever the outcome. These pages are those stages and the records each one writes.

For how assignments reach the queue, see Watch cursor and pull ingest; for the gates a run passes inside its route, see The worker reconcile pipeline.

One assignment through the node

flowchart TB
  Q[("Local queue")]
  subgraph PREP["PREPARE"]
    direction LR
    ID["Identity and fence<br/>from the envelope"]
    LC[("Local claim")]
    TC["Trace context bound"]
    DD{{"Dedupe<br/>already terminal?"}}
    ID --> LC --> TC --> DD
  end
  subgraph ROUTE["ROUTE BY KIND"]
    direction LR
    RK{{"Execution router"}}
    RH["One route handles it<br/>build, serve, bind, run, ..."]
    RK --> RH
  end
  subgraph REPORT["REPORT, throughout"]
    direction LR
    ST["ack, progress, complete<br/>with fence"]
    EV["Events and logs"]
  end
  FIN["Finalize<br/>stop runtime handle, release claim"]
  RD["Replay deduped<br/>event and log, no execution"]
  Q --> PREP
  DD -->|"new or unfinished"| ROUTE
  DD -.->|"terminal"| RD
  ROUTE --> REPORT
  ROUTE --> FIN

Preparation decides whether the assignment runs at all: an assignment whose execution record is already terminal is reported as a replay and goes no further. Everything that does run reaches exactly one route, reports through the same status and event path, and is finalized even when its route fails.

In this section