Skip to content

Recovering the control plane link

Recovery is the ordinary path, not a special one. The node keeps calling on its backoff, and when a call succeeds it returns to active, reconciles its position, and resumes. This page is that sequence and the contract that makes redelivery safe.

The sequence

flowchart TB
  A["A call succeeds"]
  B["Transport marked recovered<br/>outage duration measured"]
  C["Position reconciled<br/>resume, or resync by snapshot and delta"]
  D["Spooled reports delivered"]
  E["Watch intake resumes"]
  A --> B --> C --> D --> E

What recovery touches

flowchart LR
  subgraph XD["XRATUD"]
    direction TB
    TS[("Transport state<br/>degraded to active")]
    WC[("Watch cursor")]
    OB[("Outbox spool")]
  end
  subgraph CP["CONTROL PLANE"]
    direction TB
    REG["Registration"]
    RC["Recovery contract<br/>snapshot and delta"]
    ING["Report ingest<br/>fence, idempotency"]
  end
  TS -->|"first successful call"| REG
  WC -->|"resume, or resync"| RC
  OB -->|"spooled reports"| ING

Recovery is three edges from three records on the node, each to the part of the control plane that can reconcile it. The order above says which edge is taken first.

Returning to active

The first successful call clears the degraded state and records the recovery:

mode                        active
reason                      healthy
consecutive_failures        0
last_retry_backoff_seconds  0
retry_at_epoch              0
last_success_epoch          now
last_transition             degraded_cp_unreachable_to_active

The outage length is computed from degraded_since_epoch at that moment, so how long the link was down is a measured value the node reports rather than something inferred from log timestamps.

Three ways position is restored

Resume. The usual case. The node's watch revision is still valid, and it continues from where it was. Nothing was skipped, because a failed watch never advanced the revision.

Re-register. Where the failure was the node's registration being unknown, the node clears its registration and registers again before resuming. Its durable identity is unchanged, so it returns as the same node.

Resync. Where the node's position cannot be reconciled, the control plane issues a snapshot of what the node currently owns plus the revision to continue from:

snapshot_revision       the position the snapshot represents
delta_start_revision    snapshot_revision + 1
items                   the assignments active for this registration

Resync is triggered by CURSOR_GAP_DETECTED or CURSOR_CORRUPTED. History is not replayed; what comes back is live work. See Recovery contracts.

What the node learns on return

Recovery is also when the node finds out what it lost. Assignments whose leases lapsed have been requeued and may now belong elsewhere; the node's reports on them are refused on the fence or the lease, and it stops rather than retrying.

A terminal refusal is an answer, so it consumes no retry budget and triggers no reconnect attempt. The node drops the work and lets the new owner proceed.

Redelivery is safe by contract

A recovered node delivers what it spooled, and some of it may already have arrived. Three mechanisms make that harmless:

Mechanism Makes safe
The assignment's idempotency_key Re-applying the same unit of work
Envelope identifiers on failover records Recognising a telemetry record as a duplicate
Reports carrying fence_token and observed_generation Distinguishing a current report from a stale one

An assignment is a desired state rather than a command, so a redelivered one converges to the same result instead of repeating work. That property is what allows the whole recovery path to prefer redelivery over careful exactly-once bookkeeping.

What recovery does not do

Recovery restores the link and the node's view. It does not extend a lapsed lease, re-mint a fence, or reopen a terminal assignment. Work that moved on has moved on, and the node learns that through a refusal rather than a negotiation.

See Assignments and leases during a break for what was lost, and What a break never loses for what was not.