v0.6.0
GitHub
  1. Docs
  2. Decision record
  3. ADR-0023
Rendered from innerwall v0.6.0ADR-0023

Workload retirement: one way, refused at every door, kept in the record

Status
Accepted
Amended
2026-10-20

Context

Nothing about a workload ends. Enrollment creates one, its labels and mode change, its agent goes quiet or comes back, and its registry row stays as it was last written, forever. Three consequences follow, and they are one gap seen from three sides.

  • Its addresses stay live policy. The renderer resolves every selector against the registry's current addresses (ADR-0018). A workload whose host is gone keeps its last-reported addresses, so they keep rendering into the admit sets of every workload whose rules name its labels. Address reassignment inside a label scope is routine wherever addresses are leased or instances replaced, and the next holder of such an address inherits the admission (issue #178).
  • Its identity cannot be refused. Renewal and every agent call are authorized by two checks: a verified credential within its validity, and a workload the registry holds (ADR-0004: the certificate authenticates, the registry authorizes). A party holding a copy of a workload's key and certificate can therefore renew before each expiry, indefinitely, through the normal path. Short lifetimes bound a copied credential only while nobody renews it, and revoking the provisioning token stops new enrollments and nothing else. ADR-0004 named a control-plane deny-list of workload identities for this and left it unbuilt (issue #180).
  • Its last silence is never recorded. The control plane writes an agent_silent evidence gap when a report ends a silence (ADR-0019 as amended). A workload decommissioned mid-silence sends no such report, so the interval in which its evidence stopped is stored nowhere (issue #126).

Each is the control plane lacking one fact: that the operator has declared a workload gone. Recording that fact once, and having every part of the system act on it, closes all three.

Decision

  1. One operation, retire, and it is one way. Retiring a workload stamps retired_at on its registry row. That is the whole of the state; there is no separate list, flag, or table. The operation is one domain function in the fleet package, called by innerwall workload retire <id> on the command line and by POST /api/v1/workloads/{id}/retire on the operator surface (ADR-0021), each a thin caller holding no logic of its own. It refuses an unknown workload as not found, and a workload already retired as a conflict naming the instant it was retired; otherwise it returns the retirement instant. The stamp, the render that decision 4 requires, and the gap that decision 5 closes are written in one transaction under the render lock, so no reader sees a retired workload whose addresses still render or whose silence is still open. The retirement is logged with the workload, the instant, and the acting operator. There is no un-retire. A retired identity is never trusted again, because retiring it is the operator's statement that whoever holds its key is no longer the workload it named.

  2. The row stays, and the identity resolves forever. Flow windows, totals, and gaps name a workload by its identity (ADR-0019), and history that names an identity the registry cannot resolve is history nobody can read. The registry row is therefore kept, never deleted: the workload is read by its identity as before, carries its retirement instant on that read, and its flows, totals, and gaps remain readable by its identity and by the label-scope reads that match its stored labels. Its attributes are frozen as they stood: a label edit, an enforcement-mode change, or a directed reconnect naming a retired workload is refused as a conflict naming the retirement instant. Recovery is re-enrollment. Enrollment always assigns a fresh identity and looks up no earlier workload by hostname or any other attribute, so enrolling the same host again yields a new workload with no history, and the retired one stays as it was. This record promises nothing beyond that behavior: the control plane does not detect one identity presented by two hosts, and duplicate-identity detection remains the unbuilt control ADR-0004 names. Retirement does not revoke the provisioning token that enrolled the workload; a token is a scope for future enrollments, revoked on its own (ADR-0016).

  3. A retired identity is refused at every door. This is the control-plane deny-list ADR-0004 named, in this form: the registry is where authorization lives, so a denied identity is a registry fact, read at each point where the registry already authorizes.

    • Every agent-service call. The agent listener's interceptor, which already derives the identity and applies the validity rule per method (ADR-0016 decision 5), also refuses an identity whose workload is retired. That covers opening a sync stream, every ReportFlows call, and renewal.
    • Renewal. The enrollment domain's renewal also refuses a retired workload, beside its existing refusal of an unregistered one. The interceptor and the domain each hold the rule, so neither can be bypassed by a call path that reaches only the other, and a late renewal within the grace is refused like any other (ADR-0016 as amended).
    • The live stream. The retire write ends the workload's live sync stream immediately. The gateway gains one general lever for this: end workload w's live stream with an Unauthenticated status. Only retirement calls it here, and it is built as a lever on the gateway session rather than for retirement alone, because ending a stream whose credential has lapsed is the same act (issue #105). A stream held by the replica that made the write ends directly. A stream held by another replica is ended through the existing directive channel keyed by workload (ADR-0018 decision 4), which is best-effort by design. Its reconciliation is the step a replica already runs when its notification listener reconnects: that step checks each live stream's workload for retirement and ends the retired ones.
    • The bound. A live stream reads its credential once, when it opens, and its authorization ends at that credential's expiry (ADR-0016 as amended), which can be most of a lifetime away: far too long for a retirement to wait. The bound is therefore taken from the stream itself. The registry writes a stream makes from what its agent sends (heartbeats, inventory reports, version acknowledgements) are conditioned on the workload not being retired, and a write that finds it retired ends that stream with the same refusal. The agent sends a heartbeat at the interval the control plane configures (30 seconds by default), so a stream whose directive was lost lasts at most one heartbeat interval after retirement. This is not polling (ADR-0002): it rides messages the agent already sends. The directive and the reconnect re-sync are the fast path; the heartbeat is the bound. A stream that lingers within that interval receives no further policy, because a retired workload is not rendered (decision 4). Once the stream has ended, the refusals at renewal and stream open keep it ended.

    Refusals are opaque to the agent and precise to the operator. Every refusal of a retired identity, at any door, reaches the agent as Unauthenticated with one fixed message that names no reason. Whoever presents a retired identity's credential is either the host the operator decommissioned, which needs no reason because it is gone, or a party holding a copy of its key, which should not learn that it was detected and cut off. The control plane logs each refusal with the workload and its retirement instant, and the operator surface reports the workload's state precisely. This differs deliberately from the agent-facing reasons ADR-0016 gives for credential validity and for provisioning tokens. Those reasons are for the party who holds the credential or minted the token and must act on the answer. A retired identity has no such party: nothing it could do in response is wanted, and recovery is re-enrollment, an operator act on the host.

  4. Retirement is a render trigger. A retired workload is no longer an input to policy. The render that retirement triggers is the same full re-render, diffed per workload, as every other trigger (ADR-0018 decisions 1 and 2). A retired workload matches no selector: its addresses leave every peer set, and each workload whose rendered output changes advances one version and is pushed the delta; a workload whose diff is empty keeps its version. The retired workload itself is no longer rendered, and its last persisted policy and version stay as the record of what it last held. Every other resolution that acts on the present treats it the same way. A mode change or a selector preview does not resolve to it. Flow ingest does not resolve a source address to it (ADR-0019 decision 2), because its addresses are no longer its own and may already belong to whatever replaced it. Reads of history are unaffected.

  5. Retiring a workload whose agent is silent closes the silence as a stored gap. The interval in which a retired workload's evidence stopped is written as the agent_silent gap a report would have written had the agent returned at the retirement instant, by ADR-0019's derivation unchanged: when the silence since the last report's receipt exceeds the telemetry-liveness allowance and no heartbeat shows one agent process running through it, one gap from that receipt to the retirement instant. A workload that never reported, or whose agent was demonstrably running and quiet, gets none. The write goes through the flow store's interface in the retirement transaction. Afterwards no report can arrive (decision 3), so the gap is never derived twice. No schema is needed beyond the existing gap kind.

  6. The fleet reads retired as a state of its own. Retired is a lifecycle state, distinct from every sync state and from offline in particular: offline is something to fix, and retired is something the operator decided. A retired workload never ranks in the fleet's attention ordering and is counted in no bucket of it. The operator surface reports it on the workload read, filters the fleet by it, and counts it on its own. The surface's description in api/openapi.yaml carries the full operation and state, checked against the mounted routes like every other path.

Consequences

  • The deny-list ADR-0004 left unbuilt exists, and it is not a second authorization store. A retired identity is refused wherever the registry already authorizes, by one column in one row, so there is no list to drift from the registry.
  • A copied key whose workload is retired is useless from the next call it makes. A live stream on the replica that retired it ends at once; one held elsewhere ends at the directive, or at the listener's re-sync, and in any case by the stream's next heartbeat.
  • Retirement is one way. Undoing a mistaken retirement means re-enrolling the host with a provisioning token, which yields a new identity with no history. The cost is deliberate: an identity that came back after being declared untrusted would make the declaration mean nothing.
  • The renderer's input is the active fleet, and the registry's output for history is the whole fleet. Two readers of one table, one filtered on retired_at: every resolution that acts on the present filters it, and every read of the past does not.
  • A decommissioned workload's last silence is part of the estate's history rather than lost with it, so a later look at that range sees the gap.
  • The gateway gains a stream-termination lever that is general by construction. The later change that ends a stream at its credential's expiry (issue #105) reuses its mechanism rather than adding a second way for a stream to end. (Amended 2026-10-20; see Amendments.)
  • Retirement adds a registry read to every agent call's authorization. Every one of those calls already reads or writes the same row, so the read adds no new dependency.
  • Nothing in the agent or the wire contract changes. The agent already treats a refused call as a reason to back off and retry, and keeps enforcing its persisted policy throughout (ADR-0011). A retired host keeps enforcing what it last held until someone removes it, as fail-static requires.

Amendments

Amendment2026-10-20

(issue #105): streams are bounded by their credential. Decision 3's bound said a live stream's life was bounded by no credential's lifetime, because the stream read its credential once, at open. That was true when it was written and no longer is: ADR-0016 as amended ends a stream's authorization at the expiry of the credential it opened on, after a directed reconnect a fixed lead before it. The sentence is corrected in place to point there; the bound retirement relies on, a stream's next registry write, stands unchanged, because a credential's expiry can be most of a lifetime away. The expiry end shares this decision's mechanism: the session is ended with the status its agent receives, and its cleanup runs as for any other end. It addresses the stream that opened on the expiring credential rather than whichever stream the workload holds now, so it can never end a newer stream opened on a renewed credential, and its message differs on purpose: expiry names its reason and instant, while a retired identity keeps its one fixed opaque refusal (decision 3). The corresponding consequence is corrected in place. The core decision stands.