carlos / platform Public

durability 3a: minted env variables write-once; no ledger absence across restarts; lease loss refuses the launch

Task 4 fix round 3 (Astra re-review R2, controller rulings).

- P1-1. The variables the activator itself mints into <host>.env
  (CARLOS_ADMIN_TOKEN and CARLOS_INSTANCE_KEY, the only two) are
  write-once against the escrow, as the trio is: when the env changed,
  the sealed env is read (one GET) and a minted variable whose local
  value is not the escrowed one refuses with an alert and the marker
  (best effort). The supersession re-read checks this before the
  preparation runs again. Every other env line stays editable.
- Stale ledger. The ledger no longer decides a restore. A missing trio
  file reads the bucket unless this process itself saw the bucket's
  manifest for the host (its own read or commit) without the item, so
  the first such decision after a start costs one GET; the checked flag
  is gone.
- A commit-time lease loss refuses the launch with an error saying the
  lease was lost, never the later-launch fallback.

envB in the tests is now an edit of envA's editable lines. New witnesses:
the env-secret competing mint (restored beside the instance.key one), a
stale minted env variable with the marker write failing and a restart,
the stale ledger with the removal failing then a restart and with the
removal working in one process, and the lease lost before the commit
through the launch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev a20088f96d5a98e009f78823c17834d603456c00 parent c5c6474
6 files changed, +301 −97
  • docs/superpowers/notes/census-durability-3a-escrow-claims.md +8 −6
  • docs/superpowers/notes/census-proposal-durability-3a-escrow.md +8 −6
  • internal/activator/escrow.go +126 −53
  • internal/activator/escrow_test.go +140 −17
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv +18 −14

Intent

Human

<task-notification> <task-id>a3ce1b31a8618f132</task-id> <tool-use-id>toolu_013eaHhBG5TMAJpxPX1bRnqz</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/a3ce1b31a8618f132.output</output-file> <status>completed</status> <summary>Agent "Implement Task 4: escrow for activator hosts" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE. Fix round 2 is in commit c5c64740, on top of 3134699a, not pushed. What changed, against your rulings: - **P1-1:** an escrowed instance.key or report.token is now write-once. A local copy that differs from the escrow (a fresh mint, a stale file, after a restart or not) refuses the launch with an alert, and the box tries to write the conflict marker. The refusal holds even if the marker write fails, because every later wake finds the same difference. The in-memory record of what this box minted is gone, and env files stay editable. - **P1-2:** the lease is checked again under the operation lock, just before the manifest commit. If it was lost, nothing is committed and the staged changes are dropped. The early check stays as a cheap skip. Between that check and the commit itself, a box that has just lost its lease can at worst change the env, since the trio can't change. - **Stale ledger:** if the ledger write fails after a commit, the old ledger is removed, so the next restore reads the bucket. If the removal fails too, this process stops trusting the ledger for that host, and a missing trio file always reads the bucket. Tests: - New witnesses: a failed marker write followed by a restart (refused); a stale, differing key after a restart with no marker (refused); the lease lost between opening the baseline and committing (nothing committed, the new holder's manifest untouched); and Astra's stale-ledger case with the ledger removal working and failing. - The competing-mint test now runs on instance.key. - All four new witnesses failed before the fix. - The covering tests pass under `-race` with no races. - The full activator and host packages pass; #460 happened to pass this run. - The census and cross-builds pass, with 0 unclaimed units. Decision for you: I briefly also made CARLOS_ADMIN_TOKEN and CARLOS_INSTANCE_KEY inside the env write-once. I took that out, since it contradicts "env files stay editable". So a writer that slips past both the lease and the CAS could still replace an escrowed CARLOS_INSTANCE_KEY. If you want that closed too, it is a small change, costing one GET of the sealed env only when the env changed. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/durability-3a/.superpowers/sdd/2026-10-30-durability-step3-escrow-fence-restore/task-4-report.md</result> <usage><subagent_tokens>692252</subagent_tokens><tool_uses>16</tool_uses><duration_ms>935400</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>b0m3x52zp</task-id> <tool-use-id>toolu_019dSesNy1fNRxe2joi5PHDE</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/953e7524-2e06-4308-b9ce-fd1b38579971/tasks/b0m3x52zp.output</output-file> <status>completed</status> <summary>Background command "Wait for the round-2 re-review" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 23.9 g CO₂e (3,029,981 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on durability-3a-escrow, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/notes/census-durability-3a-escrow-claims.md b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
index 3394645fc..06543e655 100644
--- a/docs/superpowers/notes/census-durability-3a-escrow-claims.md
+++ b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
@@ -42,14 +42,14 @@ internal/activator/escrow.go:ExecBackend.escrowEligible durability 3a Task 4: ne
internal/activator/escrow.go:ExecBackend.escrowEligibleAt durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields
internal/activator/escrow.go:ExecBackend.escrowMintGuard durability 3a Task 4: new: on a box that is not ready refuses every mint (ErrEscrowNotReady); otherwise, once and only when a producer would mint, bucketEscrowEnv, and refuses (ErrInstanceKeyDeferred) when the escrowed env holds the variable; a mint it allows is noted in memory; only refuses Fix round 0 (controller readiness ruling): with no files store it is nil, and the producer mints as before 3a; with a files store and no sealing key it reads the bucket manifest at the mint (keylessEscrowed, fresh) and refuses (ErrEscrowNotReady) when the bucket holds any sealed item or the cutover marker for the host, and otherwise lets the mint go ahead (logged once); only refuses. Fix round 1: with a key it refuses while the conflict marker exists or while this box does not hold the host's lease (ErrInstanceKeyDeferred); its bucket read is bucketManifest, the preparation's shared read unless fresh (the backfill); without a key its keyless read is the same, with no cache across launches (P1-3); only refuses. Fix round 2: no longer notes the mints it allows in memory; only refuses.
internal/activator/escrow.go:ExecBackend.escrowReady durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing
-internal/activator/escrow.go:ExecBackend.escrowReread durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check.
-internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read.
+internal/activator/escrow.go:ExecBackend.escrowReread durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses.
+internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback.
internal/activator/escrow.go:ExecBackend.haKnown durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing
-internal/activator/escrow.go:ExecBackend.openEscrowLocked durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads.
+internal/activator/escrow.go:ExecBackend.openEscrowLocked durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads.
internal/activator/escrow.go:ExecBackend.publishEscrow durability 3a Task 4: new: publishEscrowAt on pathsFor
internal/activator/escrow.go:ExecBackend.publishEscrowAt durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read.
-internal/activator/escrow.go:ExecBackend.publishEscrowLocked durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory).
-internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes.
+internal/activator/escrow.go:ExecBackend.publishEscrowLocked durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown).
+internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise.
internal/activator/escrow.go:ExecBackend.sweepPublish durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert
internal/activator/escrow.go:Service.EscrowSweep durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one
internal/activator/escrow.go:Service.SecretsEscrowed durability 3a Task 4: new: the backend's SecretsEscrowed, else IsHA
@@ -64,4 +64,6 @@ internal/activator/backend_exec.go:ExecBackend.Acquire durability 3a Task 4 fix
internal/activator/escrow.go:ExecBackend.bucketManifest durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller
internal/activator/escrow.go:ExecBackend.escrowConflict durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat.
internal/activator/hasecrets.go:ExecBackend.mintGuardWith durability 3a Task 4 fix round 1: new: classifies the host (haHostNow; an error refuses) and returns mintGuardAs with fresh; only refuses
-internal/activator/escrow.go:ExecBackend.escrowConflictFound durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller
+internal/activator/escrow.go:ExecBackend.escrowConflictFound durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write.
+internal/activator/escrow.go:ExecBackend.envDivergence durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller
+internal/activator/escrow.go:ExecBackend.escrowDivergence durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller
diff --git a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
index c78f37c03..00b4f2f51 100644
--- a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
+++ b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
@@ -1,6 +1,6 @@
# Census approval: durability-3a-escrow
-Ruling `census-ruling-durability-3a-escrow`. The independent reviewer approves or rejects every change below, 41 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-durability-3a-escrow`. The independent reviewer approves or rejects every change below, 43 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -67,9 +67,11 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/activator/escrow.go:ExecBackend.EscrowSweep`: reads +registry:Host ×12, +whole:Route ×17; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.SecretsEscrowed`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.bucketManifest`: reads +file:Open, +registry:Host ×4, +whole:Route; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.envDivergence`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowChanged`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowConflict`: reads +file:Lstat; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowConflictFound`: reads +registry:Host ×4; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.escrowDivergence`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowEligible`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowEligibleAt`: reads +registry:App, +registry:HA, +registry:HoldOp, +registry:Host, +registry:Replica, +registry:Status, +registry:Unit, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowEnvOf`: reads +registry:Host, +whole:Route; written legacy, accepted-legacy, frozen
@@ -77,15 +79,15 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/activator/escrow.go:ExecBackend.escrowModeOf`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowOff`: reads +registry:Host ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.escrowReady`: reads +whole:Route; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.escrowReread`: reads +file:Open, +registry:Host ×3, +whole:Route; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv`: reads +registry:Host ×19, +whole:Route ×14; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.escrowReread`: reads +file:Open, +registry:Host ×4, +whole:Route ×3; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.escrowedLaunchEnv`: reads +registry:Host ×20, +whole:Route ×14; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.haKnown`: reads +registry:HA, +registry:Host ×2, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.keylessEscrowed`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.openEscrowLocked`: reads +file:Open, +registry:Host ×2, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.publishEscrow`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.publishEscrowAt`: reads +registry:Host ×7, +whole:Route ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.publishEscrowLocked`: reads +registry:Host ×6, +whole:Route ×2; written legacy, accepted-legacy, frozen
-- new `internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing`: reads +registry:Host ×10, +whole:Route ×7; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.publishEscrowLocked`: reads +registry:Host ×6, +whole:Route ×3; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing`: reads +registry:Host ×9, +whole:Route ×7; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:ExecBackend.sweepPublish`: reads +registry:Host, +whole:Route ×3; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:Service.EscrowSweep`: reads +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/escrow.go:Service.SecretsEscrowed`: reads +whole:Route ×2; written legacy, accepted-legacy, frozen
@@ -106,6 +108,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/layout/inventory.go:Inventory`: reads +file:ReadDir; written legacy, accepted-legacy, frozen
- quiet `internal/layout/plan.go:NestedPlatformNames`: reads nothing now; retired while it reads nothing (or its row keeps no sites)
-Seal: `eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8` → `303f60594ae584c6bb29263c485ef3de60d76a4bd60166134b8ad3bcd3ba6139`.
+Seal: `eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8` → `627375c2b812a7a486dc049160a51fa093388d97ada6a85ae9c9b4ce2e7d4a1f`.
Overlay: `internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/escrow.go b/internal/activator/escrow.go
index 70ae5a9fe..48d7d5eea 100644
--- a/internal/activator/escrow.go
+++ b/internal/activator/escrow.go
@@ -45,19 +45,20 @@ import (
// acquired (Acquire records it). A box that does not serve the host
// never replaces its escrow with its own local bytes.
// - The ledger (<data>/.escrow/<host>.json, the last committed manifest)
-// is a publication baseline, never recovery or mint evidence, except
-// that a trio file absent here is looked for in the bucket only when
-// the ledger says it was escrowed (or, with no ledger, on the host's
-// first restore since the agent started): a file that never existed
-// costs no request (P2-6). A missing env file, and a mint, always read
-// the bucket; one launch's preparation shares that one read
-// (escrowPrep).
-// - An escrowed instance.key or report.token is write-once: a local copy
-// that differs from the escrow (a fresh mint, a stale file, after a
-// restart or not) stops the launch with an alert, every time it is
-// found, and a conflict marker (<data>/.escrow/<host>.conflict), when
-// it can be written, refuses every later launch until an operator
-// removes it. The env stays editable.
+// is a publication baseline, never recovery or mint evidence. A trio
+// file absent here is looked for in the bucket unless this process has
+// itself seen the bucket's manifest for the host without it (the first
+// such decision after a start reads once; P2-6). A missing env file,
+// and a mint, always read the bucket; one launch's preparation shares
+// that one read (escrowPrep).
+// - An escrowed instance.key or report.token, and each escrowed variable
+// the activator mints into the env (CARLOS_ADMIN_TOKEN,
+// CARLOS_INSTANCE_KEY), is write-once: a local copy that differs from
+// the escrow (a fresh mint, a stale file, after a restart or not) stops
+// the launch with an alert, every time it is found, and a conflict
+// marker (<data>/.escrow/<host>.conflict), when it can be written,
+// refuses every later launch until an operator removes it. Every other
+// env line stays editable.
// - A launch reads the env once (captureLaunchEnv), publishes and
// acknowledges exactly those bytes, and launches with the env parsed
// from them.
@@ -157,8 +158,12 @@ type escrowState struct {
// fromBucket: the next open reads the bucket, never the ledger (the
// ledger could not be written after a commit).
fromBucket bool
- // checked: this process has read the host's manifest from the bucket.
- checked bool
+ // known is the host's manifest as this process last saw it in the
+ // bucket: its own read, or its own commit. Nil until then. Only it, never
+ // the ledger, decides that an escrowed trio file absent here need not be
+ // looked for: ledger absence is never trusted across a process boundary
+ // (fix round 3).
+ known *hostfiles.Manifest
// prep is the preparation in progress, nil between launches.
prep *escrowPrep
// offLogged: this process has said once that escrow is off for the
@@ -264,12 +269,13 @@ func (b *ExecBackend) prepRead(host string) (m hostfiles.Manifest, found, ok boo
return m, found, ok
}
-// notePrepRead keeps m as the preparation's read, and marks the host
-// checked.
+// notePrepRead keeps m as the preparation's read, and as what this process
+// knows the bucket holds.
func (b *ExecBackend) notePrepRead(host string, m hostfiles.Manifest, found bool) {
st := b.escrow.state(host)
b.escrow.with(func() {
- st.checked = true
+ known := m
+ st.known = &known
if st.prep != nil {
st.prep.read, st.prep.m, st.prep.found = true, m, found
}
@@ -613,12 +619,22 @@ func (b *ExecBackend) openEscrowLocked(ctx context.Context, rt registry.Route, s
if pub, err = hostfiles.Open(ctx, b.FilesStore, prefix); err != nil {
return nil, nil, fmt.Errorf("read the escrow: %w", err)
}
- b.escrow.with(func() { st.checked = true })
+ b.noteKnown(st, pub.Baseline())
}
b.escrow.install(st, pub, seal)
return pub, seal, nil
}
+// noteKnown keeps base, a manifest this process read from the bucket or
+// committed itself, as what it knows the bucket holds.
+func (b *ExecBackend) noteKnown(st *escrowState, base hostfiles.Baseline) {
+ m, err := baselineManifest(base)
+ if err != nil {
+ return
+ }
+ b.escrow.with(func() { st.known = &m })
+}
+
// escrowPublish is one publish's outcome: the manifest the publisher holds
// after it (committed, or as it was), whether this publish committed
// anything, and whether the host has a committed escrow.
@@ -748,15 +764,18 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
}
before := pub.Baseline()
out := escrowPublish{base: before, seal: seal, exists: escrowedIn(before)}
- // Write-once: an escrowed trio item is never replaced with other bytes
- // (fix round 2, P1-1). The
+ // Write-once: an escrowed trio item, or an escrowed variable the
+ // activator minted into the env, is never replaced with other bytes
+ // (fix rounds 2 and 3, P1-1). The
// divergence is the evidence, so it is found again on every launch
// whether or not the marker could be written.
m, err := baselineManifest(before)
if err != nil {
return out, err
}
- if diverged := b.escrowDivergence(m, reads, seal); len(diverged) > 0 {
+ if diverged, err := b.escrowDivergence(ctx, rt, m, reads, seal); err != nil {
+ return out, err
+ } else if len(diverged) > 0 {
return out, b.escrowConflictFound(rt, p, diverged)
}
for _, r := range reads {
@@ -798,28 +817,65 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
out.base, out.exists = after, escrowedIn(after)
out.committed = before.ETag != after.ETag || before.Found != after.Found
keep()
+ b.noteKnown(st, after)
if out.committed {
b.keepLedger(rt.Host, st, after)
}
return out, errors.Join(refused...)
}
-// escrowDivergence names the trio items this publish would replace in
-// the escrow m holds with other bytes: an escrowed instance.key or
-// report.token is write-once (fix round 2, P1-1), and its keyed digest
-// decides with no request. The env stays editable, and is not checked.
-func (b *ExecBackend) escrowDivergence(m hostfiles.Manifest, reads []escrowRead, seal *hostfiles.ItemSealer) []string {
+// escrowMintedVars are the variables the activator itself mints into a
+// host's <host>.env (ensureAdminToken, ensureInstanceKey): once escrowed,
+// write-once like the trio (fix round 3). Every other env line stays
+// editable.
+var escrowMintedVars = []string{"CARLOS_ADMIN_TOKEN", InstanceKeyVar}
+
+// escrowDivergence names what this publish would replace in the escrow m
+// holds with other bytes. An escrowed instance.key or report.token is
+// write-once (fix round 2), decided by its keyed digest with no request.
+// So is each escrowed minted variable of the env (escrowMintedVars): when
+// the env itself changed (its digest differs) the sealed env is read (one
+// GET) and a minted variable whose local value is not the escrowed one,
+// missing included, diverges.
+func (b *ExecBackend) escrowDivergence(ctx context.Context, rt registry.Route, m hostfiles.Manifest, reads []escrowRead, seal *hostfiles.ItemSealer) ([]string, error) {
var diverged []string
for _, r := range reads {
+ if !r.stage {
+ continue
+ }
item := r.rel.Item()
- if !r.stage || item == hostfiles.SealedEnvItem {
+ e, ok := m.Platform[item]
+ if !ok || e.Sealed == "" || e.PlainMAC == seal.MAC(item, r.plain) {
continue
}
- if e, ok := m.Platform[item]; ok && e.Sealed != "" && e.PlainMAC != seal.MAC(item, r.plain) {
+ if item != hostfiles.SealedEnvItem {
diverged = append(diverged, r.rel.Rel())
+ continue
}
+ d, err := b.envDivergence(ctx, rt, m, r.plain)
+ if err != nil {
+ return nil, err
+ }
+ diverged = append(diverged, d...)
}
- return diverged
+ return diverged, nil
+}
+
+// envDivergence names each escrowed minted variable of m's sealed env that
+// local, an env file's bytes, does not carry with the same value.
+func (b *ExecBackend) envDivergence(ctx context.Context, rt registry.Route, m hostfiles.Manifest, local []byte) ([]string, error) {
+ escrowed, found, err := b.escrowEnvOf(ctx, rt, m)
+ if err != nil || !found {
+ return nil, err
+ }
+ theirs, ours := parseEnvBytes(escrowed), parseEnvBytes(local)
+ var diverged []string
+ for _, name := range escrowMintedVars {
+ if v := theirs[name]; v != "" && ours[name] != v {
+ diverged = append(diverged, name)
+ }
+ }
+ return diverged, nil
}
// escrowConflictFound is the refusal for a divergence: an alert, and the
@@ -831,8 +887,8 @@ func (b *ExecBackend) escrowConflictFound(rt registry.Route, p instancePaths, di
if err := b.writeEscrowConflict(rt.Host, diverged); err != nil {
log.Printf("activator: %s: escrow: the conflict marker %s was not written: %v (the launch stays refused while the divergence lasts)", rt.Host, path, err)
}
- err := fmt.Errorf("ALERT: %s: escrow: %s differs from the copy the host's escrow in the bucket holds, and an escrowed instance.key or report.token is never replaced; the bucket's copy came first, so this launch stops and the local file is left for an operator; every launch of the host on this box is refused until the operator settles it against the escrow and removes %s",
- rt.Host, strings.Join(diverged, " and "), path)
+ err := fmt.Errorf("ALERT: %s: escrow: %s differs from what the host's escrow in the bucket holds, and an escrowed instance.key, report.token or platform-minted env variable is never replaced; the bucket's copy came first, so this launch stops and the local files (%s and the files directory) are left for an operator; every launch of the host on this box is refused until the operator settles them against the escrow and removes %s",
+ rt.Host, strings.Join(diverged, " and "), p.envFile, path)
log.Print(err)
return err
}
@@ -863,9 +919,11 @@ func (b *ExecBackend) keepLedger(host string, st *escrowState, after hostfiles.B
// escrow for the host (unless the host has a ledger here and its env file
// is here), and otherwise lets the launch go on as before 3a. With a key,
// a missing env file always reads the bucket; a missing trio file reads it
-// only when the ledger says it was escrowed, or with no ledger on the
-// host's first restore since the agent started, so a file that never
-// existed costs no request (P2-6). The read is the preparation's, which the
+// unless this process has itself seen the bucket's manifest for the host
+// (its own read or its own commit) and that manifest holds no such item:
+// the ledger's word is never taken (fix round 3), so the first such
+// decision after a start costs one GET, and a file that never existed
+// costs none after it (P2-6). The read is the preparation's, which the
// producers' mint decisions then share. A trio file that cannot be checked
// (a link, a FIFO) is not missing: there is nothing to restore into it.
func (b *ExecBackend) restoreEscrowIfMissing(ctx context.Context, rt registry.Route, p instancePaths) error {
@@ -900,18 +958,9 @@ func (b *ExecBackend) restoreEscrowIfMissing(ctx context.Context, rt registry.Ro
if !ok {
return fmt.Errorf("escrow: not restored: the row's layout is %s", p.layout)
}
- var lm hostfiles.Manifest
- ledger, haveLedger := b.ledgerFor(rt.Host)
- if haveLedger {
- if m, err := baselineManifest(ledger); err == nil {
- lm = m
- } else {
- haveLedger = false
- }
- }
st := b.escrow.state(rt.Host)
- var checked, untrusted bool
- b.escrow.with(func() { checked, untrusted = st.checked, st.ledgerUntrusted })
+ var known *hostfiles.Manifest
+ b.escrow.with(func() { known = st.known })
rels := pubclass.SealedRels(lay, rt.Host)
missing := map[string]bool{}
need := false
@@ -926,14 +975,12 @@ func (b *ExecBackend) restoreEscrowIfMissing(ctx context.Context, rt registry.Ro
}
missing[r.Item()] = true
switch {
- case r.Item() == hostfiles.SealedEnvItem, untrusted:
+ case r.Item() == hostfiles.SealedEnvItem, known == nil:
need = true
- case haveLedger:
- if _, ok := lm.Platform[r.Item()]; ok {
+ default:
+ if _, ok := known.Platform[r.Item()]; ok {
need = true
}
- case !checked:
- need = true
}
}
if !need {
@@ -1094,8 +1141,9 @@ func errEscrowWriter(host string) error {
// escrowReread is a superseded publish's second look: the bucket's
// manifest read again and made the host's publisher (stamps dropped, so
-// every file is read again). The next publish holds the local files to
-// what it holds now (escrowDivergence).
+// every file is read again), and the env's minted variables held to it
+// (envDivergence) before the caller retries; the retry's publish holds
+// the trio to it too (escrowDivergence).
func (b *ExecBackend) escrowReread(ctx context.Context, rt registry.Route, p instancePaths) error {
st := b.escrow.state(rt.Host)
st.op.Lock()
@@ -1109,9 +1157,30 @@ func (b *ExecBackend) escrowReread(ctx context.Context, rt registry.Route, p ins
return fmt.Errorf("escrow: read the bucket again: %w", err)
}
b.escrow.install(st, pub, seal)
+ b.noteKnown(st, pub.Baseline())
if escrowHooks.afterReread != nil {
escrowHooks.afterReread(rt.Host)
}
+ // Before the preparation runs again: a minted variable the bucket now
+ // escrows with another value is a conflict (fix round 3).
+ m, err := baselineManifest(pub.Baseline())
+ if err != nil {
+ return err
+ }
+ local, absent, err := instancefs.ReadBeneathLimitOrAbsent(p.dataDir, rt.Host+".env", haEnvReadLimit)
+ if err != nil {
+ return fmt.Errorf("escrow: read the env file: %w", err)
+ }
+ if absent {
+ return nil
+ }
+ diverged, err := b.envDivergence(ctx, rt, m, local)
+ if err != nil {
+ return err
+ }
+ if len(diverged) > 0 {
+ return b.escrowConflictFound(rt, p, diverged)
+ }
return nil
}
@@ -1186,6 +1255,10 @@ func (b *ExecBackend) escrowedLaunchEnv(ctx context.Context, rt registry.Route)
continue
case err != nil && strings.HasPrefix(err.Error(), "ALERT: "):
return nil, instancekey.LayerNone, err
+ case errors.Is(err, errEscrowNoLease):
+ // The lease was lost on the way to the commit, and nothing was
+ // committed: this box no longer serves the host.
+ return nil, instancekey.LayerNone, fmt.Errorf("secrets for %s: the host's lease was lost before its escrow was committed, so it is not launched here: %w", rt.Host, err)
case err != nil && !r.exists:
return nil, instancekey.LayerNone, fmt.Errorf("secrets for %s: escrow the host's secrets before its first launch: %w", rt.Host, err)
case err != nil:
diff --git a/internal/activator/escrow_test.go b/internal/activator/escrow_test.go
index 17b7f8a92..6d8ff954e 100644
--- a/internal/activator/escrow_test.go
+++ b/internal/activator/escrow_test.go
@@ -216,7 +216,9 @@ func (s *switchingPuts) Put(ctx context.Context, key string, body []byte, ifMatc
const (
envA = "CARLOS_ADMIN_TOKEN=tok-a\nCARLOS_INSTANCE_KEY=key-a\n"
- envB = "CARLOS_ADMIN_TOKEN=tok-b\nCARLOS_INSTANCE_KEY=key-b\n"
+ // envB is A edited: the same minted secrets (write-once against the
+ // escrow, fix round 3) and an editable line of its own.
+ envB = envA + "SHOP_MODE=b\n"
)
// The escrow publishes the env and the trio sealed, in both layouts, and
@@ -559,8 +561,8 @@ func TestCrashBetweenCommitAndLedgerRestoresTheBucketVersion(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- if got := envFileBytes(t, nb, rt); got != envB || env["CARLOS_ADMIN_TOKEN"] != "tok-b" {
- t.Fatalf("restored %q (launch token %q), want B", got, env["CARLOS_ADMIN_TOKEN"])
+ if got := envFileBytes(t, nb, rt); got != envB || env["SHOP_MODE"] != "b" {
+ t.Fatalf("restored %q (launch SHOP_MODE %q), want B", got, env["SHOP_MODE"])
}
}
@@ -579,11 +581,11 @@ func TestStaleLedgerNeverAuthorizesAMint(t *testing.T) {
// The new agent's ledger is A's, which holds no key.
nb := restartEscrow(t, b)
holdLease(t, nb, rt)
- writeEnv(t, nb, rt, "CARLOS_ADMIN_TOKEN=tok-b\n")
+ writeEnv(t, nb, rt, "CARLOS_ADMIN_TOKEN=tok-a\n")
if _, err := nb.ensureInstanceKeyFor(ctx, rt, nb.pathsFor(rt)); !errors.Is(err, ErrInstanceKeyDeferred) {
t.Fatalf("ensure: %v", err)
}
- if got := envFileBytes(t, nb, rt); got != "CARLOS_ADMIN_TOKEN=tok-b\n" {
+ if got := envFileBytes(t, nb, rt); got != "CARLOS_ADMIN_TOKEN=tok-a\n" {
t.Fatalf("env %q: something was minted", got)
}
}
@@ -1052,18 +1054,18 @@ func TestSweepNeverStarvesLaterHosts(t *testing.T) {
}
b.escrow.capOverride = 4
for _, rt := range rows[4:] {
- writeEnv(t, b, rt, "CHANGED=once\n")
+ writeEnv(t, b, rt, "CARLOS_ADMIN_TOKEN=t"+rt.Host+"\nCHANGED=once\n")
}
for sweep := 0; sweep < 2; sweep++ {
for i, rt := range rows[:4] {
- writeEnv(t, b, rt, fmt.Sprintf("CHANGED=%d-%d\n", sweep, i))
+ writeEnv(t, b, rt, fmt.Sprintf("CARLOS_ADMIN_TOKEN=t%s\nCHANGED=%d-%d\n", rt.Host, sweep, i))
}
if rep := b.EscrowSweep(ctx, rows); rep.Published != 4 || rep.Deferred != 4 {
t.Fatalf("sweep %d: %+v", sweep, rep)
}
}
for _, rt := range rows[4:] {
- if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != "CHANGED=once\n" {
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != "CARLOS_ADMIN_TOKEN=t"+rt.Host+"\nCHANGED=once\n" {
t.Fatalf("%s starved: escrow %q", rt.Host, got)
}
}
@@ -1232,21 +1234,25 @@ func TestLeaseLostBeforeCommitCommitsNothing(t *testing.T) {
}
}
-// New Important (round 2): ledger A lacks instance.key; a later commit
-// escrows the key and its ledger write fails; after a restart with the env
-// intact and the key missing, the key is restored from the bucket. With
-// the ledger's removal failing too, this process reads the bucket for the
-// host instead of trusting it.
+// Stale ledger (rounds 2 and 3): ledger A lacks instance.key; a later
+// commit escrows the key and its ledger write fails. The key, then missing
+// with the env intact, is restored: after a restart when the stale ledger
+// could not be removed (its absence of the key is never trusted across a
+// process boundary), and in the same process when it was removed.
func TestStaleLedgerNeverSuppressesARestore(t *testing.T) {
- for _, removal := range []string{"removed", "removal fails"} {
- t.Run(removal, func(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ removal bool
+ restart bool
+ }{{"removal fails, then a restart", false, true}, {"removed, same process", true, false}} {
+ t.Run(tc.name, func(t *testing.T) {
b, rt := escrowBackend(t, escrowHost)
writeEnv(t, b, rt, envA)
mustPublish(t, b, rt)
writeFiles(t, b, rt, map[string]string{"instance.key": "ik-1"})
oldW, oldR := writeEscrowLedger, removeEscrowLedger
writeEscrowLedger = func(string, string, hostfiles.Baseline) error { return errors.New("disk full") }
- if removal == "removal fails" {
+ if !tc.removal {
removeEscrowLedger = func(string, string) error { return errors.New("read-only") }
}
mustPublish(t, b, rt)
@@ -1254,8 +1260,11 @@ func TestStaleLedgerNeverSuppressesARestore(t *testing.T) {
if got := sealedItem(t, b, rt, "instance.key.sealed"); got != "ik-1" {
t.Fatalf("fixture: escrowed key %q", got)
}
+ if _, ok := readEscrowLedger(b.DataDir, rt.Host); ok == tc.removal {
+ t.Fatalf("fixture: a ledger on disk %v, want %v", ok, !tc.removal)
+ }
nb := b
- if removal == "removed" {
+ if tc.restart {
nb = restartEscrow(t, b)
holdLease(t, nb, rt)
}
@@ -1271,3 +1280,117 @@ func TestStaleLedgerNeverSuppressesARestore(t *testing.T) {
})
}
}
+
+// Commit-time lease loss, through the launch (escrowedLaunchEnv): the
+// launch is refused with an error saying the lease was lost, never the
+// later-launch fallback, and nothing is committed.
+func TestLeaseLostBeforeCommitRefusesTheLaunch(t *testing.T) {
+ ctx := context.Background()
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ mustPublish(t, b, rt)
+ ob, ort := otherBox(t, b, rt)
+ escrowHooks.beforeCommit = func(host string) {
+ escrowHooks.beforeCommit = nil
+ var l *execLease
+ b.escrow.with(func() { l = b.escrow.leases[host] })
+ _ = l.Release(ctx)
+ holdLease(t, ob, ort)
+ }
+ t.Cleanup(func() { escrowHooks.beforeCommit = nil })
+ writeEnv(t, b, rt, envA+"FOO=1\n")
+ before := loadManifest(t, b, rt)
+ _, err := b.launchEnvForTest(rt)
+ if !errors.Is(err, errEscrowNoLease) || !strings.Contains(err.Error(), "lease was lost") {
+ t.Fatalf("the launch that lost its lease: %v", err)
+ }
+ if got := loadManifest(t, b, rt); got.Seq != before.Seq {
+ t.Fatalf("committed: seq %d, want %d", got.Seq, before.Seq)
+ }
+}
+
+// P1-1 (round 3), the env's minted secrets: the guard read no key,
+// another writer escrowed key B in the env, and this box minted key A.
+// The bucket re-read finds the conflict before the preparation runs
+// again: refused with an alert and a marker; a second wake and a launch
+// after a restart are refused, the escrow keeps B, until an operator
+// settles the env and removes the marker.
+func TestCompetingEnvMintStaysRefusedAcrossWakesAndRestarts(t *testing.T) {
+ ctx := context.Background()
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, "CARLOS_ADMIN_TOKEN=tok-a\n")
+ mustPublish(t, b, rt)
+ competing := "CARLOS_ADMIN_TOKEN=tok-a\n" + InstanceKeyVar + "=key-b\n"
+ escrowHooks.afterCapture = func(host string) {
+ escrowHooks.afterCapture = nil
+ if err := foreignCommit(ctx, b, rt, competing); err != nil {
+ t.Error(err)
+ }
+ }
+ t.Cleanup(func() { escrowHooks.afterCapture = nil })
+ _, err := b.launchEnvForTest(rt)
+ marker := escrowConflictPath(b.DataDir, rt.Host)
+ if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !strings.Contains(err.Error(), InstanceKeyVar) || !exists(marker) {
+ t.Fatalf("the first launch: %v (marker %v)", err, exists(marker))
+ }
+ minted := envValues(t, b, rt, InstanceKeyVar)[0]
+ if minted == "" || minted == "key-b" {
+ t.Fatalf("local key %q, want this box's own mint left for the operator", minted)
+ }
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != competing {
+ t.Fatalf("escrow %q, want the bucket's B kept", got)
+ }
+ if _, err := b.launchEnvForTest(rt); err == nil || !strings.Contains(err.Error(), marker) {
+ t.Fatalf("the second launch: %v", err)
+ }
+ nb := restartEscrow(t, b)
+ holdLease(t, nb, rt)
+ if _, err := nb.launchEnvForTest(rt); err == nil || !strings.Contains(err.Error(), marker) {
+ t.Fatalf("the launch after a restart: %v", err)
+ }
+ if got := sealedItem(t, nb, rt, hostfiles.SealedEnvItem); got != competing {
+ t.Fatalf("escrow %q, want B", got)
+ }
+ writeEnv(t, nb, rt, competing)
+ if err := os.Remove(marker); err != nil {
+ t.Fatal(err)
+ }
+ env, err := nb.launchEnvForTest(rt)
+ if err != nil || env[InstanceKeyVar] != "key-b" {
+ t.Fatalf("after the operator: %v, key %q", err, env[InstanceKeyVar])
+ }
+}
+
+// A stale minted variable in the local env, with the marker write
+// failing: refused, and refused again after a restart (no memory, no
+// marker), and the escrowed env is kept. Other env lines stay editable.
+func TestDivergentEnvMintRefusedWithoutAMarker(t *testing.T) {
+ ctx := context.Background()
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ mustPublish(t, b, rt)
+ writeFailingMarker(t)
+ writeEnv(t, b, rt, "CARLOS_ADMIN_TOKEN=tok-a\n"+InstanceKeyVar+"=key-stale\n")
+ if _, err := b.launchEnvForTest(rt); err == nil || !strings.Contains(err.Error(), "ALERT: ") {
+ t.Fatalf("the launch with a stale key: %v", err)
+ }
+ nb := restartEscrow(t, b)
+ holdLease(t, nb, rt)
+ if _, err := nb.launchEnvForTest(rt); err == nil || !strings.Contains(err.Error(), "ALERT: ") {
+ t.Fatalf("the launch after a restart: %v", err)
+ }
+ if rep := nb.EscrowSweep(ctx, []registry.Route{rt}); rep.Published != 0 || len(rep.Failing) != 1 {
+ t.Fatalf("the sweep: %+v", rep)
+ }
+ if got := sealedItem(t, nb, rt, hostfiles.SealedEnvItem); got != envA {
+ t.Fatalf("escrowed env %q, want A", got)
+ }
+ // An editable line changes freely.
+ writeEnv(t, nb, rt, envA+"SHOP_MODE=c\n")
+ if _, err := nb.launchEnvForTest(rt); err != nil {
+ t.Fatalf("an edited env: %v", err)
+ }
+ if got := sealedItem(t, nb, rt, hostfiles.SealedEnvItem); got != envA+"SHOP_MODE=c\n" {
+ t.Fatalf("escrowed env %q", got)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 1d7c44aa4..e740d81e9 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -45,4 +45,4 @@ plan14-root-reads-fleet-public-routes.tsv bca6ef741a96b72767b1747789cd01b3111d61
plan14-root-reads-fleet-routes-followups.tsv 1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7
plan14-root-reads-tunnel-websockets.tsv 949bc734a293366e6b2700244af5110dd6e84b5432023e991c09e806afd62483
plan14-root-reads-console-protection-tab.tsv eaeb153ab7a7a849edc9c6e92f2ac5c709c6e39044a647971cf1fa5ebcb660c8
-plan14-root-reads-durability-3a-escrow.tsv 303f60594ae584c6bb29263c485ef3de60d76a4bd60166134b8ad3bcd3ba6139
+plan14-root-reads-durability-3a-escrow.tsv 627375c2b812a7a486dc049160a51fa093388d97ada6a85ae9c9b4ce2e7d4a1f
diff --git a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
index 6278dfa0c..598738b74 100644
--- a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
+++ b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
@@ -1,7 +1,7 @@
# Census overlay durability-3a-escrow, written by census-propose (#369). census-ruling-durability-3a-escrow, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-durability-3a-escrow.md.
# 8 body, 12 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 3 removed: each unit's declaration, or each envelope's directory, is absent from the scanned tree, so its row goes, a frozen declaration is retired as absent, and an envelope is retired.
-# 41 new dispositions: 0 reads re-frozen at their disposition with the claim, 40 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
+# 43 new dispositions: 0 reads re-frozen at their disposition with the claim, 42 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
@legacy 88938980d11f4be9932058259d7d471b340ac51300691427ac51de62999b0f83 internal/activator/admintoken.go ensureAdminToken legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos (EnsureAdminToken, EnsureAdminTokenBeneath and ensureAdminTokenFor; the agent's scheduler token through EnsureAdminToken; no root caller found): one more parameter, guard (a mintGuard, nil for every caller but an HA host's ensureAdminTokenFor), asked once this locked read has found no token and before anything is minted; its refusal is returned with nothing written. The read, mode check, shape check and mint are unchanged; the same four sites, no read added; only adds a refusal;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: the guard is now asked with the variable it would mint, guard("CARLOS_ADMIN_TOKEN"), still only once this locked read found no token and before anything is minted; its refusal is returned with nothing written. The read, mode check, shape check and mint are unchanged; the same four sites; only adds a refusal file:Lstat@1864,file:OpenFile@4464,file:Read@4101,file:ReadFile@433 cf06e83cc0e322792272d3a10b6b2478cac66973acfd2ac3faf8497a2b6eb61b
@legacy 3b34d3f4313e6a6e9b96b37e3eee744d3574f6d523bd329f750f1cd245a0e22b internal/activator/claim_snapshot.go ExecBackend.EnsureClaimAdminToken legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, inside the claim's authorize callback: the missing-token mint is now ensureAdminTokenFor(ctx, rt, paths) instead of ensureAdminTokenAt(paths, rt.Host+".env") (deleted); both pick the beneath (instancefs) producer on the nested layout and the path one otherwise, on the same file; the new one also asks an HA host's mint decision (haMintGuard) at the moment it would mint. The separate haMintGate call of the first proposal is gone (final fix F2). Sites: -registry:Host (the rt.Host+".env" argument) and +whole:Route (rt to ensureAdminTokenFor); only adds a refusal for an HA host;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: a comment names mintGuardFor instead of haMintGuard; the body is unchanged registry:Host@2644,registry:Replica@1285,whole:Route@1363,whole:Route@2016,whole:Route@212,whole:Route@2307,whole:Route@2571,whole:Route@285,whole:Route@347 4a5935d18fe04a5f73170a32bdcb46f9996eacca5602ba108b408e2f4254fa79
@legacy 27c808de21de2d81ab651428b0e177ba93a21a86a5d5d47f7901fbd768e773a6 internal/activator/hasecrets.go Service.fillScheduledToken legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: sets the tick's Authorization header from haScheduledToken for an HA host; any other host's request is untouched; +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: asks escrowedScheduledToken (was haScheduledToken), so an escrowed host (HA, or eligible for escrow) gets its tick's Authorization header from the env file its wake restored or minted; any other host's request is untouched; the same one site whole:Route@215 8d7bdf5e155a74ca9f667c4ebc21a4a7df571740d0f81ef5e77bc86bffd9cbe0
@@ -12,9 +12,11 @@
@legacy 64a0a282f5729c49a65c572b8af2c81c58ae0edff176220c0ddf892be8b27204 internal/activator/escrow.go ExecBackend.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the agent as carlos (carlos-edge.service), no root caller, from escrowLoop: classifies each row against the rows handed in (Classify), keeps eligible rows known not HA from memory (haKnown, no read), and in host order from a round-robin cursor stats each escrowed file (stampAt) and publishes the changed ones, 8 at a time, at most 256 a sweep (sweepPublish); a box without a files store or key does nothing; opens nothing outside the rows' own data directories; writes only the hibernate bucket's files/0 prefix and the ledger Fix round 1: a host whose instance lease this box does not hold (holdsLease) is skipped, and one with a conflict marker counts as failing and is not published; the report is tallied through one lock (P1-4). registry:Host@1079,registry:Host@1098,registry:Host@1249,registry:Host@1782,registry:Host@2128,registry:Host@2385,registry:Host@2459,registry:Host@536,registry:Host@761,registry:Host@795,registry:Host@833,registry:Host@923,whole:Route@1001,whole:Route@1088,whole:Route@1107,whole:Route@1258,whole:Route@1576,whole:Route@1784,whole:Route@2014,whole:Route@2130,whole:Route@2387,whole:Route@2461,whole:Route@356,whole:Route@519,whole:Route@587,whole:Route@653,whole:Route@706,whole:Route@980,whole:Route@984 c3067eb671bdbba75100a0398840a1c293fb55b777e155703169d3ae2e71ccd2
@legacy 90f2d51840159dd44037a8eb60115e037f27c635d74652028b368bda6fcd35b8 internal/activator/escrow.go ExecBackend.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: haHostNow or escrowEligible; reads only what the HA classification already reads whole:Route@123,whole:Route@198 c22d35df72f67d7222efd0b0f09d51c42275ad4a10d637598fdc8b822f6333bd
@legacy c7e39531f926452a19521b0399f157fa65ea04f015d2c185cee19cb585f07bab internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller file:Open@408,registry:Host@170,registry:Host@241,registry:Host@370,registry:Host@954,whole:Route@329 a993cc65cd23b5568160c431ee28184109ad4375e9099a31cde921dd0e3fa379
+@legacy e09ff3985fbdf89d3d133238891b9b20a32ed82155e249c81218579816b4fd5a internal/activator/escrow.go ExecBackend.envDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller whole:Route@176 b57510f2dc862d4c5b2e0e594d77bae6bb84bdee12b77c742e152468bed406c0
@legacy 97fc560e1b1b84ecc13660f4bc1d364e45dfffac3607637f02db89ad52eef2b1 internal/activator/escrow.go ExecBackend.escrowChanged legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: compares each escrowed file's stamp (stampAt, beneath the row's data directory) with the last kept one; reads no bytes Fix round 1 (P1-4): the stamps are copied under the escrow mutex, entry by entry, before they are compared; the same opens, no read added. registry:Host@122,registry:Host@444 12b8759b8473bb17eca3ad8b9912ba23f522dca54f2fe1c309b619fd72a3a879
@legacy 573f35211cf44372a958e8c843433a88bcaedbf5df7e0e007ba3ce427f3eb5cf internal/activator/escrow.go ExecBackend.escrowConflict legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat. file:Lstat@117 c3b7c49a46a5c2c9159ced89438b91dc935fd8fb7d05b71293b31082019917b8
-@legacy ebb5d5cfbce42e0f1d9bb6996bfde66ce966daff74e08ac9aec6f51f32d9d739 internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@756 907cc8d8310162c5367e385b40e1e1181249fb8c9dd1713b3f7d3fb1cf41bc47
+@legacy 6afc54fc8c764b2bc4cc78a200ef13ea4f3a5bf540abe1b0e4a81dd524ba53b2 internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write. registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@815 4ba873a1921b08b719df7439460635663bd9197d7326e55411ac7648e55387b0
+@legacy 75fc854a11bddecec1e2694b3c3dde3e6756e2a819d3b10f088a11d0c48d19d5 internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller whole:Route@520 4b3979ccd01db815060a64f784cf0f4f8a2799220d1ae538a8eb36213578c0a1
@legacy 254a354a40269aaae37fee1c09f3fa5a46763943c83ba128748dc51e3f1a46fe internal/activator/escrow.go ExecBackend.escrowEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowEligibleAt on pathsFor's classification whole:Route@105,whole:Route@90 038966cd4221f6cbafe0eb80bdbf7ec69b54d36a34c0ea22a53746d2acac63fe
@legacy ea8e33b8cda7a3bf9671cfec5fbb8f90ad01be56378d7558af9520f6c25519c8 internal/activator/escrow.go ExecBackend.escrowEligibleAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields registry:App@295,registry:HA@163,registry:HoldOp@186,registry:Host@265,registry:Replica@172,registry:Status@221,registry:Unit@126,whole:Route@119 5df0c11ddde0ec351b062b87863396108d2fe48b7b4e390ca69daf377e0cac58
@legacy a7d3afeb8f7275c5636a65cace92ecf2e4a2d4f2fa5f3fa2278494f27ec2d2bb internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady registry:Host@389,whole:Route@230 dd6e1f3a3e8299303a3f9c2f89d2ec2f952dbdcb45264ac39484abc925b2e415
@@ -22,15 +24,15 @@
@legacy 4936d243b2f0dfe0070b2ed97ea46ff79d868bedc54deefec132baadba1410ee internal/activator/escrow.go ExecBackend.escrowModeOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0 (controller readiness ruling): new: escrowNoStore when FilesStore is nil, escrowNoKey when escrowReady fails, else escrowOn; reads nothing whole:Route@147 6bfaddec7936f24f6756c8c68547d6a7fa54dd0523db9024e2f71924a2e7ecee
@legacy 2483746d1c63202a3c641199ea442261483853bea1b112ec3f2afc4772011d26 internal/activator/escrow.go ExecBackend.escrowOff legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0: new: one log line per host per process saying escrow is off and why; reads nothing registry:Host@309,registry:Host@87 6f3a552d5af240733241ea7befefa194706a70770e8bdc4f3c444ac48cf8f8c3
@legacy 73fa77e711e182b4777ae6346795af7d5a36c4f1c231714ff2415806bffeafff internal/activator/escrow.go ExecBackend.escrowReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing whole:Route@165 fb7390d8f2ce1653619c3b365a3f804e5e1a0bb6f77210972a83453ebda42316
-@legacy 7dae741d2155619f9818b21e8869d2e520e6944edc29356632228ee4240f7a28 internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@520,whole:Route@193 9489f90533e27fa5f5b07bf4d020af586982554094b52ce10ce5d7ed17c6341a
-@legacy e8606977b49dc6afb61672760923f9a1d30245d2c43adbdaf3a3ee6f77f20c30 internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2506,registry:Host@2627,registry:Host@2801,registry:Host@3017,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 ef92b19f81ddce0d887b5fe94a6cfbac7f1a1196f55aa851875723cd2c5d15fb
+@legacy e4a1412c2d6cdafc02b37db74f74bab2b9f17c5d61d4291b955cad79519b7ce2 internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@553,registry:Host@844,whole:Route@1022,whole:Route@1124,whole:Route@193 38d3251f07d0b938c52eca3311b890af7e34b7fac62fac8a99904b20ee4f7f30
+@legacy eaccb20d9481b5280d36080ab17bafec188f42218aee6f23cb9c3f4066114552 internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@2839,registry:Host@2960,registry:Host@3134,registry:Host@3350,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 e89777bda97cc3c2b2aa6a2ae9c61d01833fc41805180dd06777911570d585de
@legacy aa6c1694a6bfba03769ad089b3715610848596875e636952cf981c59a1761de3 internal/activator/escrow.go ExecBackend.haKnown legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing registry:HA@185,registry:Host@274,registry:Host@95,whole:Route@151 4ecae90469fb6eda421464ca4509db7ddf4e5180180377867d3804b95bfd0c23
@legacy 69525c0419368661b947b49ab6f3af889f98804e603f9e5fdf1fd71aa534e030 internal/activator/escrow.go ExecBackend.keylessEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 0-1: new, on a box with a files store and no sealing key: whether the bucket holds an escrow for the host (any sealed item or the cutover marker), from bucketManifest: the read of the launch preparation in progress, or one hostfiles.Load (one GET); nothing is cached across launches (fix round 1, P1-3); a failed read is an error and the caller refuses; the agent as carlos (carlos-edge.service), no root caller whole:Route@146 5a14a5881e81f9b401a1f8321659e75cc6165a5477db6cacc89b6c7f9e5bee08
-@legacy 27f7faabcf195bb06977092fc016771f6142250e82275595e567c1bc379f7bc5 internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 363fb2c216bb47936cdeec099ba8c0ca64da23daeadd300a56427467d747e969
+@legacy 03adcc3ddc576e39f355b774273543874e745e96269145e98fac6d8772ba0220 internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 a407fe03838dc525b8e587bb8137b90b131c1e4dd8e9382f5325260293f50220
@legacy c7f95f454a974537377434c9993beebc3b0761e814ae369a8e1e29a5c3fc5474 internal/activator/escrow.go ExecBackend.publishEscrow legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt on pathsFor whole:Route@149,whole:Route@164 e61757f12a116ef8bf819dcad7136f810c51dfa9f7104ceb7f810efece48cc29
@legacy f6e622ed3b9e219a616ce6bf2f951b3e50c7897bd6e8a7f59ddb335fcbf8e3db internal/activator/escrow.go ExecBackend.publishEscrowAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read. registry:Host@223,registry:Host@269,registry:Host@340,registry:Host@376,registry:Host@435,registry:Host@556,registry:Host@653,whole:Route@157,whole:Route@733 5e2b655605216fcaa50ddfd0511ca4ce913a8716582932a13debf22c4876f117
-@legacy 647fb1daba1053f375afcd81658e42f32e38f4b9fc2bbbf3af241b982620db9c internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). registry:Host@2078,registry:Host@2342,registry:Host@3787,registry:Host@3817,registry:Host@4329,registry:Host@574,whole:Route@2269,whole:Route@2863 bda6bd959efd0806cd0bd38ee0415ac0d28901c009d9e9ad7c92a7ffc91fe214
-@legacy 82b2ec18d808601cbfdf46d4d48b89f5a34b10026f62cae866dd327aa3b8462b internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. registry:Host@1067,registry:Host@1219,registry:Host@1370,registry:Host@138,registry:Host@2112,registry:Host@2980,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1913,whole:Route@200,whole:Route@2009,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 d559d3af9307a0391fd0e9353c1de1b083034a325493bcc3a214d22228ba4f9d
+@legacy 0bae26d2175d5d2555ea748c9dc069b8ecdd277c2571ff64bf33a8a7295da0d5 internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). registry:Host@2078,registry:Host@2342,registry:Host@3914,registry:Host@3944,registry:Host@4480,registry:Host@574,whole:Route@2269,whole:Route@2871,whole:Route@2990 d7e1bab9bb4a873a19ff5d5a235042269f675b9e7b12d49aa5c3a82e2936b200
+@legacy b053870b57f516eddc82775c8a662b701c49173c2171cad2ef2d27cb7cde688a internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
@legacy 7d7ae676fe3d33d027489b397a804eaa184295667ad039688aed3757f662ab9d internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
@legacy c89cfff20022faa5af3e07251a620b1b63e0b42f350483a6efec4162efdd1cca internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
@legacy 5e6fbfb1fc889f9d7742e9275cfaac39888a93c8d33ed329ee92088fcc52167f internal/activator/escrow.go Service.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's SecretsEscrowed, else IsHA whole:Route@184,whole:Route@215 87261115297104155806136d4d0001c4cd3e150e5ffe91612bb5014fb7780881
@@ -72,9 +74,11 @@ internal/hostfiles/restore.go Restore legacy accepted-legacy accepted-legacy;rev
internal/activator/escrow.go ExecBackend.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the agent as carlos (carlos-edge.service), no root caller, from escrowLoop: classifies each row against the rows handed in (Classify), keeps eligible rows known not HA from memory (haKnown, no read), and in host order from a round-robin cursor stats each escrowed file (stampAt) and publishes the changed ones, 8 at a time, at most 256 a sweep (sweepPublish); a box without a files store or key does nothing; opens nothing outside the rows' own data directories; writes only the hibernate bucket's files/0 prefix and the ledger Fix round 1: a host whose instance lease this box does not hold (holdsLease) is skipped, and one with a conflict marker counts as failing and is not published; the report is tallied through one lock (P1-4). registry:Host@1079,registry:Host@1098,registry:Host@1249,registry:Host@1782,registry:Host@2128,registry:Host@2385,registry:Host@2459,registry:Host@536,registry:Host@761,registry:Host@795,registry:Host@833,registry:Host@923,whole:Route@1001,whole:Route@1088,whole:Route@1107,whole:Route@1258,whole:Route@1576,whole:Route@1784,whole:Route@2014,whole:Route@2130,whole:Route@2387,whole:Route@2461,whole:Route@356,whole:Route@519,whole:Route@587,whole:Route@653,whole:Route@706,whole:Route@980,whole:Route@984 c3067eb671bdbba75100a0398840a1c293fb55b777e155703169d3ae2e71ccd2
internal/activator/escrow.go ExecBackend.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: haHostNow or escrowEligible; reads only what the HA classification already reads whole:Route@123,whole:Route@198 c22d35df72f67d7222efd0b0f09d51c42275ad4a10d637598fdc8b822f6333bd
internal/activator/escrow.go ExecBackend.bucketManifest legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: the host's files manifest in the hibernate bucket, the launch preparation's read when there is one (unless fresh), else one GET: hostfiles.Open with a sealing key (the publisher installed for the launch's publish), hostfiles.Load without; kept as the preparation's read; the agent as carlos (carlos-edge.service), no root caller file:Open@408,registry:Host@170,registry:Host@241,registry:Host@370,registry:Host@954,whole:Route@329 a993cc65cd23b5568160c431ee28184109ad4375e9099a31cde921dd0e3fa379
+internal/activator/escrow.go ExecBackend.envDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 3: new: opens the manifest's sealed env (escrowEnvOf, ReadSealed: one GET) and names each variable the activator mints into the env (CARLOS_ADMIN_TOKEN, CARLOS_INSTANCE_KEY) whose escrowed value the local bytes do not carry; reads nothing local itself; only refuses (through its callers); the agent as carlos (carlos-edge.service), no root caller whole:Route@176 b57510f2dc862d4c5b2e0e594d77bae6bb84bdee12b77c742e152468bed406c0
internal/activator/escrow.go ExecBackend.escrowChanged legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: compares each escrowed file's stamp (stampAt, beneath the row's data directory) with the last kept one; reads no bytes Fix round 1 (P1-4): the stamps are copied under the escrow mutex, entry by entry, before they are compared; the same opens, no read added. registry:Host@122,registry:Host@444 12b8759b8473bb17eca3ad8b9912ba23f522dca54f2fe1c309b619fd72a3a879
internal/activator/escrow.go ExecBackend.escrowConflict legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: new: os.Lstat of <data>/.escrow/<host>.conflict, the agent's own directory; present, every launch, mint and publish of the host is refused with an alert naming the file for an operator to remove; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 2: the alert text names the divergence generally (local secrets differ from the escrow); the same Lstat. file:Lstat@117 c3b7c49a46a5c2c9159ced89438b91dc935fd8fb7d05b71293b31082019917b8
-internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@756 907cc8d8310162c5367e385b40e1e1181249fb8c9dd1713b3f7d3fb1cf41bc47
+internal/activator/escrow.go ExecBackend.escrowConflictFound legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 2: new: the refusal for a divergent trio item: tries to write the host's conflict marker (writeEscrowMarker: EnsureDirBeneath <data>/.escrow 0700, a 0600 temp, rename, fsync), logs if it cannot, and returns the alert; the refusal holds either way, since every later publish finds the same divergence; only refuses; the agent as carlos (carlos-edge.service), no root caller Fix round 3: the alert names the env file too, since a platform-minted env variable can diverge; the same marker write. registry:Host@144,registry:Host@186,registry:Host@355,registry:Host@815 4ba873a1921b08b719df7439460635663bd9197d7326e55411ac7648e55387b0
+internal/activator/escrow.go ExecBackend.escrowDivergence legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 2-3: new: the write-once check over a publish's staged reads: an escrowed instance.key or report.token whose keyed digest differs (no request), and, when the env's digest differs, envDivergence; only refuses (through its caller); the agent as carlos (carlos-edge.service), no root caller whole:Route@520 4b3979ccd01db815060a64f784cf0f4f8a2799220d1ae538a8eb36213578c0a1
internal/activator/escrow.go ExecBackend.escrowEligible legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowEligibleAt on pathsFor's classification whole:Route@105,whole:Route@90 038966cd4221f6cbafe0eb80bdbf7ec69b54d36a34c0ea22a53746d2acac63fe
internal/activator/escrow.go ExecBackend.escrowEligibleAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: a pure predicate over the row and a classification: ActivatorManaged, not unit, sidecar, HA, replica, held, a valid host shape and app, flat or nested, on a box with a hibernate bucket; reads only row fields registry:App@295,registry:HA@163,registry:HoldOp@186,registry:Host@265,registry:Replica@172,registry:Status@221,registry:Unit@126,whole:Route@119 5df0c11ddde0ec351b062b87863396108d2fe48b7b4e390ca69daf377e0cac58
internal/activator/escrow.go ExecBackend.escrowEnvOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the sealed env item opened with hostfiles.ReadSealed under this box's key and the row's binding (sha256, v2 envelope, binding and MAC checked); found false when the manifest holds none; a failure wraps ErrEscrowNotReady registry:Host@389,whole:Route@230 dd6e1f3a3e8299303a3f9c2f89d2ec2f952dbdcb45264ac39484abc925b2e415
@@ -82,15 +86,15 @@ internal/activator/escrow.go ExecBackend.escrowMintGuard legacy accepted-legacy
internal/activator/escrow.go ExecBackend.escrowModeOf legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0 (controller readiness ruling): new: escrowNoStore when FilesStore is nil, escrowNoKey when escrowReady fails, else escrowOn; reads nothing whole:Route@147 6bfaddec7936f24f6756c8c68547d6a7fa54dd0523db9024e2f71924a2e7ecee
internal/activator/escrow.go ExecBackend.escrowOff legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 0: new: one log line per host per process saying escrow is off and why; reads nothing registry:Host@309,registry:Host@87 6f3a552d5af240733241ea7befefa194706a70770e8bdc4f3c444ac48cf8f8c3
internal/activator/escrow.go ExecBackend.escrowReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: FilesStore and EscrowKey set and sealerFor succeeds; reads nothing whole:Route@165 fb7390d8f2ce1653619c3b365a3f804e5e1a0bb6f77210972a83453ebda42316
-internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@520,whole:Route@193 9489f90533e27fa5f5b07bf4d020af586982554094b52ce10ce5d7ed17c6341a
-internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2506,registry:Host@2627,registry:Host@2801,registry:Host@3017,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 ef92b19f81ddce0d887b5fe94a6cfbac7f1a1196f55aa851875723cd2c5d15fb
+internal/activator/escrow.go ExecBackend.escrowReread legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, after a superseded publish: hostfiles.Open of the host's files manifest, and, when this box noted a mint, the sealed env (escrowEnvOf) and the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory, to refuse publishing over an escrowed secret of another value; the agent as carlos (carlos-edge.service), no root caller; only refuses Fix round 1: the conflict check is mintedConflict (on this card), which also persists the conflict marker. Fix round 2: only re-reads and installs the publisher; the conflict check is the next publish's write-once check. Fix round 3: after the re-read, reads the local env file with instancefs.ReadBeneathLimitOrAbsent (1 MiB, no link followed) beneath the row's data directory and refuses (escrowConflictFound) when a minted variable the bucket now escrows differs (envDivergence), before the caller retries; only refuses. file:Open@284,registry:Host@122,registry:Host@332,registry:Host@553,registry:Host@844,whole:Route@1022,whole:Route@1124,whole:Route@193 38d3251f07d0b938c52eca3311b890af7e34b7fac62fac8a99904b20ee4f7f30
+internal/activator/escrow.go ExecBackend.escrowedLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new, the launch path for an eligible host: captureLaunchEnv once, publishEscrowAt over those bytes, SealedAcknowledged on the commit, and the env parsed from the captured bytes; on a supersession escrowReread and the launch preparation again (ensureAdminTokenFor, ensureInstanceKeyFor) once; a not-ready box launches only a host its ledger shows escrowed; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): before the capture, the box's mode: no files store, instanceEnvLayer exactly as before 3a (logged once); no sealing key, a host whose ledger shows it escrowed launches on instanceEnvLayer (logged), otherwise keylessEscrowed (the answer this launch's restore read, within haSecretsBudget, else one GET) refuses when the bucket holds an escrow and launches on instanceEnvLayer when it holds none; nothing is published in either. Fix round 1: ends the launch's preparation; refuses while the conflict marker exists, and with a key while this box does not hold the host's lease; an ALERT from the publish fails the launch; the keyless decision uses the preparation's read. Fix round 3: a publish that answers errEscrowNoLease (the lease lost before the commit) refuses the launch with an error saying so, never the later-launch fallback. registry:Host@1039,registry:Host@1100,registry:Host@1182,registry:Host@1337,registry:Host@1422,registry:Host@145,registry:Host@1590,registry:Host@1792,registry:Host@2054,registry:Host@2215,registry:Host@238,registry:Host@2671,registry:Host@2839,registry:Host@2960,registry:Host@3134,registry:Host@3350,registry:Host@635,registry:Host@764,registry:Host@809,registry:Host@912,whole:Route@1244,whole:Route@1470,whole:Route@1699,whole:Route@1957,whole:Route@205,whole:Route@2117,whole:Route@331,whole:Route@374,whole:Route@419,whole:Route@469,whole:Route@516,whole:Route@691,whole:Route@735,whole:Route@959 e89777bda97cc3c2b2aa6a2ae9c61d01833fc41805180dd06777911570d585de
internal/activator/escrow.go ExecBackend.haKnown legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the HA classification from memory only (haWakes, haLegacyRoute, the row's mark, the lifetime index); reads nothing registry:HA@185,registry:Host@274,registry:Host@95,whole:Route@151 4ecae90469fb6eda421464ca4509db7ddf4e5180180377867d3804b95bfd0c23
internal/activator/escrow.go ExecBackend.keylessEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix rounds 0-1: new, on a box with a files store and no sealing key: whether the bucket holds an escrow for the host (any sealed item or the cutover marker), from bucketManifest: the read of the launch preparation in progress, or one hostfiles.Load (one GET); nothing is cached across launches (fix round 1, P1-3); a failed read is an error and the caller refuses; the agent as carlos (carlos-edge.service), no root caller whole:Route@146 5a14a5881e81f9b401a1f8321659e75cc6165a5477db6cacc89b6c7f9e5bee08
-internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 363fb2c216bb47936cdeec099ba8c0ca64da23daeadd300a56427467d747e969
+internal/activator/escrow.go ExecBackend.openEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the host's publisher, from its ledger (readEscrowLedger: readCappedFile, O_NOFOLLOW, 32 MiB, under <data>/.escrow, the agent's own directory) with no request, else hostfiles.Open (one GET); the agent as carlos (carlos-edge.service), no root caller Fix round 1: marks the host checked when it reads the bucket; the same reads. Fix round 2: the ledger is read through ledgerFor (none while this process marks it untrusted); the same reads. Fix round 3: a bucket read is kept as what this process knows the bucket holds (noteKnown), replacing the checked flag; the same reads. file:Open@737,registry:Host@528,registry:Host@584,whole:Route@415 a407fe03838dc525b8e587bb8137b90b131c1e4dd8e9382f5325260293f50220
internal/activator/escrow.go ExecBackend.publishEscrow legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt on pathsFor whole:Route@149,whole:Route@164 e61757f12a116ef8bf819dcad7136f810c51dfa9f7104ceb7f810efece48cc29
internal/activator/escrow.go ExecBackend.publishEscrowAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: escrowReady and the layout checked, then publishEscrowLocked under the host's lock Fix round 1: refuses while the conflict marker exists or while this box does not hold the host's lease (P1-2), before anything is read. registry:Host@223,registry:Host@269,registry:Host@340,registry:Host@376,registry:Host@435,registry:Host@556,registry:Host@653,whole:Route@157,whole:Route@733 5e2b655605216fcaa50ddfd0511ca4ce913a8716582932a13debf22c4876f117
-internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). registry:Host@2078,registry:Host@2342,registry:Host@3787,registry:Host@3817,registry:Host@4329,registry:Host@574,whole:Route@2269,whole:Route@2863 bda6bd959efd0806cd0bd38ee0415ac0d28901c009d9e9ad7c92a7ffc91fe214
-internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. registry:Host@1067,registry:Host@1219,registry:Host@1370,registry:Host@138,registry:Host@2112,registry:Host@2980,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1913,whole:Route@200,whole:Route@2009,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 d559d3af9307a0391fd0e9353c1de1b083034a325493bcc3a214d22228ba4f9d
+internal/activator/escrow.go ExecBackend.publishEscrowLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: reads <host>.env (unless the launch's capture is handed in), <host>/instance.key and <host>/report.token with readStamped beneath the row's data directory, seals what changed (StageSealed), DropRawSecrets of the constant raw names, commits, and writes the ledger (writeEscrowLedger: EnsureDirBeneath .escrow 0700, a 0600 temp, rename, fsync); an absent file stages nothing; a refused file publishes nothing for it; the agent as carlos (carlos-edge.service), no root caller Fix round 1: before staging, mintedConflict on the baseline it would replace, so a secret this box minted is never published over another escrowed value (P1-1). Fix round 2 (P1-1, P1-2, stale ledger): before staging, the write-once check (escrowDivergence, keyed digests only, no request): a staged instance.key or report.token whose escrowed item has another digest refuses the publish (escrowConflictFound); then, under the operation lock just before the commit, the lease again (holdsLease): lost, nothing is committed and the staged state is dropped; after a commit the ledger through keepLedger (written, else the stale one removed with RemoveBeneath under <data>/.escrow, else marked untrusted in memory). Fix round 3: escrowDivergence also holds the env's minted variables write-once (one GET of the sealed env, only when the env changed); the committed manifest is kept as what this process knows (noteKnown). registry:Host@2078,registry:Host@2342,registry:Host@3914,registry:Host@3944,registry:Host@4480,registry:Host@574,whole:Route@2269,whole:Route@2871,whole:Route@2990 d7e1bab9bb4a873a19ff5d5a235042269f675b9e7b12d49aa5c3a82e2936b200
+internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
internal/activator/escrow.go Service.SecretsEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's SecretsEscrowed, else IsHA whole:Route@184,whole:Route@215 87261115297104155806136d4d0001c4cd3e150e5ffe91612bb5014fb7780881
@@ -129,7 +133,7 @@ internal/activator/paths.go ExecBackend.pathsFor legacy accepted-legacy accepted
@removed internal/activator/hasecrets.go SplitBackend.haScheduledToken H3 census-ruling-durability-3a-escrow;absent;basis=durability 3a Task 4: renamed to SplitBackend.escrowedScheduledToken (on this card)
@remove internal/host/schedule_wiring.go scheduleHostHA
@removed internal/host/schedule_wiring.go scheduleHostHA H3 census-ruling-durability-3a-escrow;absent;basis=durability 3a Task 4: renamed to scheduleHostEscrowed (on this card), asking SecretsEscrowed instead of IsHA
-@coverage internal/activator c3d6b4fa629fc9ce04c1247bf0c00e068375eae523e90cd61841b1e39705e52e
+@coverage internal/activator 3b745c7c395b03f6a18d4957438a694c9fb08ea9820ab962311f96ddb7eecc3f
@coverage internal/host c12e11dd2fbfb5936e5256007db85a88f96cb12f3d1c74c551ff7ec5f52f9355
@coverage internal/hostfiles a0b0deb2779b183ee3f3578d1112ac5f723d930e40690a55eaaaa2644a24a9ad
@coverage internal/layout f845fa728b0935279454d8b01023c5d6dae1c985061a41229cf0686e829f5c12