Idempotency and replay-safe reprocessing¶
Every position in the system is resumed from behind or at the truth, so a node is handed work it has already done. The execution dedupe record absorbs it: one record per assignment, attempt and idempotency key, holding the outcome, so a repeat returns the recorded result and runs nothing.
This page covers the record, the decision it produces, and the one assignment class it refuses outright.
The dedupe points across the whole assignment pipeline are on Idempotency and dedupe contracts.
The record¶
{
"contract_version": "xratud.assignment_execution_idempotency.v1",
"assignment_id": "asg-71c4...",
"attempt": 1,
"idempotency_key": "bld-5e2f...",
"run_id": "run-3f09...",
"node_id": "dp-9c2a...",
"assignment_kind": "build.capsule.v1",
"status": "succeeded",
"result": { "artifact_digest": "sha256:4b71..." },
"error": {},
"first_seen_at": 1771459200.0,
"last_seen_at": 1771459244.0,
"replay_count": 2
}
The records sit in the same state file as the local leases, under a key built from three parts:
The attempt is part of the key, so a retried attempt at the same assignment is a different record with its own outcome. The idempotency key is part of it as well, so two different units of work inside one attempt stay distinct.
The decision before execution¶
flowchart TB
IN["Assignment admitted for execution"]
LK{{"Record for this<br/>assignment, attempt and key?"}}
NEW["Write a record at started"]
ST{{"Recorded status"}}
DUP["Raise replay_count,<br/>refresh last_seen_at"]
RUN["Execute"]
REUSE["Return the recorded result"]
IN --> LK
LK -->|"no"| NEW --> RUN
LK -->|"yes"| ST
ST -->|"succeeded or failed"| DUP --> REUSE
ST -->|"started"| RUN
A record in started means a previous attempt was interrupted before it reached
a terminal status, so the work runs again. A record in a terminal status means
the work finished, so Return the recorded result is the answer and nothing
executes.
| Recorded status | execute |
duplicate |
Effect |
|---|---|---|---|
| No record | true |
false |
A record is written at started and the work runs |
started |
true |
false |
The work runs again, and the record's last seen time is refreshed |
succeeded |
false |
true |
The recorded result is returned and the replay count rises |
failed |
false |
true |
The recorded error is returned and the replay count rises |
The replay count is the node's own measure of how often it has been handed work it had already completed.
Completion normalises the status¶
A completion writes the terminal record. The status it is given is mapped to one of two values:
The first seen time and the replay count are preserved from the existing record, so completing an assignment keeps the history of when it was first admitted and how often it was re-presented.
Run assignments are refused¶
Both the begin and the complete operations require an assignment kind, and four kinds are refused:
The refusal reads assignment kinds cannot carry kernel-local application
execution. Application execution is a kernel-native surface the kernel owns and
dispatches, and the node's operator lane carries non-execution operations only.
The node refuses such an assignment at the begin operation, before any record
is written.
See
The application run boundary.
The records belong to the process¶
The dedupe records belong to the running process, and a starting process begins with none. An assignment that completed and whose terminal status never reached the control plane is dispatched again, and with the record gone the work is carried out a second time.
The cost depends on the work. A build resolves to the same content-addressed artifact and the publication is recognised at the registry; a deployment reconciles to a state that already matches. See Rebuilding node state after restart.
Related¶
- Resume direction for the rule these records make safe.
- Lease dedupe and finalize for the record's state after an assignment ends.
- Assignment delivery and replay for the control plane's own duplicate handling.