Skip to content

Ownership handover across a break

A break on the control plane link can move a runtime to a different node while the original is still connected to its kernel. Handover resolves that without either node negotiating with the other. This page is how, and why the displaced node is stopped rather than asked to stand down.

The handover

flowchart TB
  A["Node A holds the lease and the fence"]
  B["A's link to the control plane breaks"]
  C["A's lease lapses after 30 seconds"]
  D["Controller requeues the assignment"]
  E["Node B claims it<br/>a fresh fence is minted"]
  F["A's next call is refused on its fence"]
  A --> B --> C --> D --> E --> F

The handover

flowchart LR
  subgraph CP["CONTROL PLANE"]
    direction TB
    LED[("Ledger<br/>one active fence: B's")]
  end
  subgraph NA["NODE A, displaced"]
    direction TB
    XA["xratud<br/>holds fence A"]
  end
  subgraph NB["NODE B, new owner"]
    direction TB
    XB["xratud<br/>holds fence B"]
  end
  subgraph PR["PROJECT RUNTIME"]
    direction TB
    K["Kernel<br/>accepts fence B only"]
  end
  XB ==>|"claim, reports"| LED
  XB ==>|"runtime.*"| K
  XA -.->|"FENCE_TOKEN_MISMATCH"| LED
  XA -.->|"stale_fence"| K

Both records that matter, the ledger and the kernel, hold one fence, and it is B's. Node A's two edges end in refusals at both of them, independently, so it can neither report nor command.

Nothing tells node A that it lost the runtime. It finds out on its next call, which is the first moment the answer matters.

The fence is minted per claim

Every claim mints a fresh fence token and advances the assignment's lifecycle revision. Node B's claim produces a token node A does not have, so node A's fence is stale from the instant B claimed.

No coordination between A and B is required, and none is possible. The ledger records one active fence and everything else is measured against it.

Two refusals, at two boundaries

The displaced node is stopped at both links, independently:

Reporting to the control plane is refused with ASSIGNMENT_LEDGER_FENCE_TOKEN_MISMATCH, and a call to its kernel with ownership_rejected, classified stale_fence.

Either alone would leave a gap. Fencing only at the control plane would let a displaced node keep commanding a kernel; fencing only at the kernel would let it keep writing reports. Both are fenced, so a displaced node can neither act nor record.

The displaced node stops, and stays stopped

stale_fence is terminal. The node does not retry, and it does not reconnect. Reconnecting would re-establish a session the fence already invalidated, which is how two nodes end up both believing they own one runtime.

The kernel's held return channel is keyed by runtime instance and closed when ownership moves, so the old session does not outlive the handover on the kernel's side either.

Non-owner and stale fence are different events

non_owner     a node that never held this runtime
stale_fence   a node that held it and has been displaced

Both are refused identically. The distinction is for whoever reads the record afterwards: a stale_fence is evidence of a handover, and a non_owner is evidence of something addressing a runtime it was never given.

What the work does in the meantime

Node A's kernel keeps executing until A's commands stop mattering; node B reconciles the runtime toward the assignment it claimed. The assignment reaches a terminal state from B, because A's reports are refused.

A non-idempotent step can execute on both nodes in this window, which is why the execution admission gate refuses a retry budget on a non_idempotent_write block. See Admission gates.

What is guaranteed

One owner's writes are accepted at a time, at both links. The assignment reaches a terminal state. The record has one author, and the handover is visible in it.

See What a break never loses.