Skip to content

Reconciliation and pull-based execution

A node runs one cycle repeatedly, and every cycle has the same five phases in the same order. This page is the phase order, the calls each phase makes, and what a stall in each phase looks like. For why work is pulled rather than pushed, see Reconciliation and pull-based execution in Concepts.

The cycle

flowchart TB
  P["Preparation<br/>registration, lease recovery,<br/>capacity, observability capture"]
  H["Heartbeat<br/>project and emit node state"]
  I["Intake<br/>pull or watch, admit into the local queue"]
  W["Worker execution<br/>bounded slots, one assignment each"]
  C["Completion<br/>flush channels, drain, project the cycle result"]
  P --> H --> I --> W --> C
  C -.->|"next cycle"| P

Phases are sequenced rather than concurrent, and each takes the previous phase's output as input. A cycle that cannot prepare does not heartbeat, and a cycle that cannot heartbeat does not take in work, so a node degrades from the front rather than running partially.

Phase What it does A stall here means
Preparation Resolves registration state, reconciles the process's lease state once, captures capacity and observability state The node has no valid registration or cannot re-establish its identity
Heartbeat Projects node state and reports it The control-plane endpoint is unreachable or the runtime identity is stale
Intake Pulls or watches for assignments and admits them into a bounded local queue Nothing is scheduled to this node, or the queue is already full
Worker execution Runs the bounded worker portion, one assignment per slot Slots are occupied by long-running work
Completion Flushes telemetry channels within a budget, drains, and projects the cycle summary The outbox is backed up against the bucket or the ingest endpoint

What each phase touches

flowchart LR
  subgraph CP["CONTROL PLANE"]
    direction TB
    REG["Registration and heartbeat"]
    LED[("Assignment ledger")]
    ING["Report and telemetry ingest"]
  end
  subgraph N["XRATUD"]
    direction TB
    LS[("Lease state")]
    Q[("Local queue<br/>bounded")]
    W["Worker slots<br/>one assignment each"]
    OB[("Outbox")]
    Q --> W
    W --> OB
  end
  K["Kernels"]
  B[("Your bucket")]
  LS -->|"preparation"| REG
  N -->|"heartbeat"| REG
  LED -->|"intake, pulled"| Q
  W -->|"runtime.* commands"| K
  OB -->|"completion"| ING
  OB -->|"completion, bodies"| B

Every edge into the control plane starts in the node box, including intake, which the node pulls. Read a stall from the table above against this diagram: the phase names the edge, and the edge names the two things that could have stopped it.

The calls a node makes

Every call is node-initiated, so a node needs outbound reachability and no inbound exposure.

Call Purpose
dataplane.registrations.register Establish the node's registration
dataplane.registrations.heartbeat Report node state and liveness
dataplane.registrations.pull Request assignments scoped to this node
dataplane.registrations.watch Wait for a revision newer than the one held
Acknowledge, progress, complete Report per-assignment lifecycle
Event, log and telemetry batches Report metadata and object references
Build reports Return produced digests
Resolution evidence Return metadata-only DP and gateway evidence for an exact assignment-derived secret grant

Intake has two shapes. A pull is a request that returns what is ready; a watch waits on the node's assignment stream and returns when the revision advances:

since_revision                the revision the node already holds
max_events, max_assignments   how much a single return may carry
wait_timeout_seconds          how long the node is willing to wait

Both carry the versions the two sides must agree on, and a mismatch fails closed rather than downgrading:

transport_protocol_version      dataplane.v1
assignment_schema_version       assignment.v1
trust_contract_version          bootstrap.trust.xratu/v1
credential_issuer_version       system.runtime_identity_issuer.contract.v1

Proof of possession on the node's calls

A node's request carries a proof-of-possession header set alongside its credential, covering the method, the path, a digest of the body, a timestamp and a nonce, signed by the node:

x-runtime-pop-method        x-runtime-pop-path
x-runtime-pop-body-digest   x-runtime-pop-timestamp
x-runtime-pop-nonce         x-runtime-pop-signature

The signature is over the request that was actually made, so a captured credential is not enough to issue a different one.

Convergence toward a desired state

An assignment describes a desired state. The node compares it against what it currently runs and closes the difference, so a redelivered assignment converges to the same result rather than repeating work. Acknowledgement carries what the node observed rather than only that it received something:

run_id, node_id, attempt, assignment_key
fence_token           the fence the node held while acting
observed_generation   the assignment generation it converged toward
trust_verification    the digest and provenance result

A control plane comparing observed_generation against the current generation knows whether a node has caught up, without asking it.

When the control plane is unreachable

Transport failures are classified per operation, and each operation backs off on its own budget rather than the node stopping altogether. Reports spool to the process's local outbox: segmented files with checkpoint state, bounded by a local budget and compacted after acknowledgement. The spool carries reports through the outage for as long as the process runs; the evidence behind them stays in each kernel's continuity store until the node acknowledges it.

A node that was unreachable resumes by pulling. Nothing was held for it elsewhere, so recovery is the same path as normal operation.

Leases and the handover

One node holds a runtime at a time, under a lease with a fence epoch that rises on handover. A displaced owner's calls to the kernel are answered stale_fence and are terminal: it stops rather than retrying, and does not reconnect, so the new owner proceeds alone. See The three-plane contract for the full refusal set.