Status ack runtime¶
Every status report a node owes the control plane is staged on disk before it is sent, and stays there until the control plane acknowledges it. The status ack runtime keeps that record: one entry per report, keyed so a report is staged once, ordered per assignment, and compacted only after acknowledgement. This page is the key, the ordering, the retention rule, and the backlog signal a node raises when acknowledgements fall behind.
The status outbox¶
flowchart LR
subgraph XD["XRATUD"]
direction TB
ST{{"Stage<br/>dedupe key, sequence"}}
subgraph SP["OUTBOX SPOOL"]
direction TB
REC[("status_ack_state.json<br/>one record per report")]
end
SEND["Send"]
CMP{{"Compact<br/>acked and below the watermark,<br/>or older than the TTL"}}
ST --> REC
REC --> SEND
CMP --> REC
end
CP["Control plane<br/>ack, progress, complete"]
SEND -->|"report"| CP
CP -->|"acknowledged"| REC
A report enters the spool once, leaves the node as many times as delivery
takes, and is removed only after the control plane's acknowledgement is
recorded against it. The outbox carries reports through a control-plane outage,
including a control-plane restart, for as long as xratud runs. It belongs to
one process, and a new xratud process starts with an empty one.
What is staged¶
Five kinds of status envelope pass through the outbox:
The dedupe key¶
Each staged report is keyed:
The sequence is taken from the report where it carries one and otherwise
assigned as one past the highest sequence staged for that assignment and
attempt. Staging a key that is already present is refused with
STATUS_OUTBOX_DEDUPE_REJECTED, so a report produced twice by a retried step
is staged once.
The key carries the attempt, so a retried assignment's reports are distinct from the attempt before it, and each attempt's reports are ordered on their own.
Ordering¶
Reports for one assignment are delivered in their sequence order. A global enqueue sequence is recorded on every entry as well, and it orders the outbox for observability only, so the delivery guarantee is per assignment.
Retention¶
A report is retained until the control plane acknowledges it. Acknowledgement records an ack watermark on the entry, taken from its global enqueue sequence. Compaction then removes an acknowledged entry when its watermark is at or below the compaction watermark, or when it has been acknowledged for longer than the retention TTL, 86400 seconds by default. Compaction considers acknowledged entries only.
The backlog signal¶
Every stage, acknowledgement and compaction reports the count of entries still
waiting for acknowledgement. When that count exceeds 5000, the answer carries
backlog_degraded and STATUS_OUTBOX_BACKLOG_DEGRADED.
A backlog means reports are being produced faster than the control plane is acknowledging them, which is the state a node is in while its control-plane link is degraded. See What continues while the control plane link is down.
The reasons¶
| Reason | Condition |
|---|---|
STATUS_OUTBOX_DEDUPE_REJECTED |
A report with this key is already staged |
STATUS_OUTBOX_ACK_MISSING |
An acknowledgement names a key the outbox does not hold |
STATUS_OUTBOX_BACKLOG_DEGRADED |
More than 5000 entries are waiting for acknowledgement |
STATUS_OUTBOX_REPLAY_REQUIRED |
The state file is unreadable or could not be written |
STATUS_OUTBOX_REPLAY_REQUIRED means the node's record of what was acknowledged
is unusable, and the remedy is redelivery. Every report carries its fence token
and observed generation, which is the contract that makes redelivery safe. See
Recovering the control plane link.
How the file is written¶
status_ack_state.json, contract system.status_ack_runtime.state.v1, sits in
the process's outbox spool. Each change is written to a temporary file, flushed
and renamed over the original, so the record the process reads back mid-life is
always a complete one.