Skip to content

The control-plane client

Every call a node makes to the control plane goes through one client, built once at startup. It fixes the versions and identity every call carries, signs every request, validates what comes back, and sorts every failure into one of five kinds before anything retries. This page is that sorting and the retry rule behind it, which together decide whether a failed call is waited out, repaired, or raised.

The client

flowchart LR
  subgraph XD["XRATUD"]
    direction TB
    subgraph CLI["CONTROL-PLANE CLIENT, one per process"]
      direction TB
      FIX[("Fixed at construction<br/>endpoint, label, four versions,<br/>dataplane and process identity")]
      SIG{{"Signs each request<br/>bearer and proof headers"}}
      VAL{{"Validates each answer<br/>handshake, assignment contract"}}
      CLS{{"Classifies each failure"}}
    end
    RT["Retry loop<br/>per operation"]
    TS[("Transport state")]
    RT --> CLI
    CLS --> RT
    RT --> TS
  end
  subgraph CP["CONTROL PLANE"]
    direction TB
    REG["Registrations<br/>register, heartbeat, pull, watch"]
    REP["Assignment reports<br/>ack, progress, complete"]
    TEL["Events and logs<br/>batch, failover"]
    OTH["Build and model reports,<br/>resolution evidence,<br/>mux profile, model traffic"]
  end
  SIG --> REG
  SIG --> REP
  SIG --> TEL
  SIG --> OTH

Every outbound edge starts at the signer, so every call carries the credential the client holds and a proof bound to that request, and every failure comes back through the classifier, so the retry loop acts on a kind rather than on a status code. The transport state is written by the retry loop alone.

What is fixed at construction

The client is built with the control-plane endpoint, the node label, the runtime credential, the node's dataplane_uuid and dataplane_instance_uuid, and the four contract versions:

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

A missing endpoint, node label, schema version, trust contract version or issuer version refuses construction, so a node with an incomplete configuration fails at start rather than on its first call. The registration identifier is added to the client when registration succeeds and cleared when the control plane reports it lost.

Five kinds of failure

The control plane answers Kind The node does
500, 502, 503, 504, or no connection Transient Marks the transport degraded, backs off, retries
429 Backpressure Same as transient, waiting at least the Retry-After it was given
404 from heartbeat, pull or watch naming a lost registration Registration lost Clears the registration, registers again, retries the call
409 with a handshake reason Compatibility Carries the reason code; a watch is suppressed, other calls raise
Any other error, or an answer that fails validation Client error Raises; a watch instead returns empty with its revision unchanged

A lost registration is recognised by its reason, DATAPLANE_AGENT_NOT_FOUND or RUNTIME_IDENTITY_BINDING_REGISTRATION_NOT_FOUND, or by a message naming a missing registration. A raised error leaves the cycle, and the run loop treats it as non-transient. See The run loop.

The retry rule

A transient or backpressure failure is retried up to three times per call. The wait before each retry is:

wait = min(30, max(retry_after, 0.25 x 2^(attempt - 1))) x jitter
jitter in [0.75, 1.25], derived from dataplane_uuid, dataplane_instance_uuid,
operation and attempt

The result is kept between 0.1 and 30 seconds. retry_after comes from the Retry-After header or a retry_after_seconds field in the answer, and is at least one second.

Jitter is derived rather than random. Two nodes retrying the same operation wait different amounts, so a control plane coming back is not met by every node at once, and one node's wait for a given attempt is the same every time it happens, so a backoff seen in a log can be reproduced.

The first failure moves the transport to degraded_cp_unreachable and the first success moves it back to active. See Detecting a control plane link break for the transport state record.

What the client validates on the way out

Reports carry their fence. An assignment report is built with run_id, node_id, attempt, fence_token and an observed_generation of at least 1, and a progress or completion report also carries policy_snapshot_digest and a decision stage, pre for progress and post for completion. A report missing any of these is refused before it is sent.

Telemetry is metadata only. Events and logs are checked against the metadata-only rule before they are sent, and every record in one batch must resolve to one workspace_uuid. See The metadata-only ingest rule.

What the client validates on the way in

Registration, pull and watch answers carry the control plane's handshake fields, and the client checks them before returning anything. Every assignment in a pull or watch answer is parsed against the assignment contract, and one that fails is refused with its position:

watch assignment[2] failed contract validation: <reason>

See Protocol handshake and compatibility gating.