Skip to content

Closure reconciliation and upgrade

Closure reconciliation is how a project's closures reach its nodes. A project build submits the project's foundation selection, and the control plane runs three stages in order: foundation resolution, closure resolution, and materialization. Each stage is a fenced assignment that a data plane node pulls, performs, and answers with signed evidence. The control plane admits that evidence before it issues the next stage.

Upgrade is the same path run again. A changed input produces a new closure and new cells, and cells already running keep the closure they started with.

The stages

sequenceDiagram
  participant CP as Control plane
  participant DP as Data plane node
  participant K as Kernel
  CP->>DP: foundation resolution assignment
  DP->>CP: signed registry resolution evidence
  Note over CP: admits it, seals the foundation intent
  CP->>DP: closure resolution assignment, every input sealed
  DP->>CP: signed resolution evidence with the closure
  Note over CP: admits the closure, projects its artifact set
  CP->>DP: materialization assignment
  Note over DP: fetches, verifies and opens the artifact set
  DP->>CP: signed materialization evidence
  DP->>K: assignment handoff with the runtime closure reference
  Note over K: opens the artifacts again, builds the verified view
Stage Assignment kind The node produces The control plane decides
foundation_resolution xck.foundation_reference_resolution.v1 The foundation reference resolved to a digest, using the node's registry credentials The sealed foundation intent
closure_resolution xck.runtime_closure_resolution.v1 A deterministic solve and the resolved closure The admitted closure reference and its artifact set
materialization xck.runtime_closure_materialization.v1 The fetched, verified and opened artifacts, and their evidence Whether the evidence is admitted

After materialization, the node hands the kernel one runtime_closure reference inside the assignment handoff. It carries the admission, closure and materialization evidence digests, and the kernel verifies the closure itself. See Verified closure view.

Each stage's task carries a continuation: the resolver identity, the closure inputs and fence, and the handoff inputs, which are the sealed policy and trust snapshot digests, the minimum containment profile, the auth binding intent and the redaction paths. The continuation passes from stage to stage unchanged, so a node performing a later stage works from the same authority the first stage sealed.

Which nodes take the stages

A data plane advertises the xck_runtime_closure_reconciliation capability when it registers, together with an evidence signing identity. Stage assignments go to nodes advertising it, and the control plane verifies each stage's evidence signature against the identity the node registered.

Fences

Every stage carries a fence, fence_id and fence_epoch. The control plane admits a stage result only while that fence is still current:

reconciliation result was produced under a superseded fence

The kernel applies the same rule to the handoff. A handoff whose fence has moved names an authority the control plane has replaced, and the kernel refuses it. A slow node answering an old reconciliation has its result refused at both points.

Upgrade

A closure is immutable. Changing any of its constituents, whether the block, the foundation, runtime.xratu, the provider or a profile, produces a new closure digest. The table of which change re-runs which step is in Changing shared dependencies, and the table of which field each change reaches is in Resolved runtime closures.

The new closure is reconciled through the same three stages, and the cells that run it are new cells. The closure digest is part of the cell reuse key, so a new closure always selects a new cell. See Cell reuse keys.

Cells and handles already running stay pinned to their old closure until they are drained, revoked, or their epoch ends. The foundation under a live cell stays the foundation it started on.

On the node, releasing a closure releases its content store references. Garbage collection removes entries with no remaining reference, and keeps blobs another closure still uses. See Closure artifact sets and materialization.

When a stage is refused

Code Condition
RUNTIME_CLOSURE_RECONCILIATION_RESULT_INVALID The result arrived under a superseded fence, has no leased assignment behind it, or is missing a required field
RUNTIME_CLOSURE_EVIDENCE_SIGNATURE_INVALID The evidence signature does not verify against the node's registered signing identity
RUNTIME_CLOSURE_ASSIGNMENT_IDENTITY_CONFLICT An assignment id already bound to different work was reused
RUNTIME_CLOSURE_RECONCILIATION_STAGE_INVALID The completion names a stage outside the three
RUNTIME_CLOSURE_RECONCILIATION_REFUSED The node's pull request was malformed

A refused result creates no closure authority.