carlos / platform Public

fix(escrow): share write-once checks with every HA sealed publish

Route non-HA and HA sealed staging through one escrow divergence gate before uploads. Refuse key changes and changed minted values with the existing alert and conflict marker, including already-acknowledged launches. Distinguish envelope-open failures from transient GET errors so storage recovery can retry ordinary env edits.

Pin clean-release key-A to key-B restart refusal and the launch, periodic, snapshot and Final paths. Preserve the Publisher.Commit 9B8 layer; regenerate the root-read census proposal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev de8a9e4108370ae933fde9eb270ae4edc4336aaa parent 8167332
11 files changed, +269 −69
  • docs/superpowers/notes/census-durability-3a-escrow-claims.md +7 −4
  • docs/superpowers/notes/census-proposal-durability-3a-escrow.md +6 −5
  • internal/activator/escrow.go +35 −23
  • internal/activator/escrow_test.go +4 −4
  • internal/activator/haescrow_branchfix_test.go +169 −0
  • internal/activator/hafiles.go +17 −10
  • internal/activator/hasecrets.go +6 −9
  • internal/activator/hasecrets_test.go +1 −1
  • internal/hostfiles/sealed.go +10 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv +13 −11

Intent

Attributed to this commit: 11.1 g CO₂e (1,374,805 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 03a60f6fe..fd868bc7d 100644
--- a/docs/superpowers/notes/census-durability-3a-escrow-claims.md
+++ b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
@@ -3,14 +3,14 @@
# Appended task by task; census-propose is re-run with the whole file.
internal/layout/inventory.go:Inventory durability 3a Task 1: new. One os.ReadDir of the host's inventory root, provision.InstanceDir(dataDir, host) nested or dataDir flat, after refusing a host that fails controlname.ValidHostShape and a layout that is neither flat nor nested; reads only the listing's names and types (DirEntry.IsDir), opens and follows nothing; flat ownership is the extras scan's own (hostEntries over knownHosts); each top-level name is classified by pubclass.Of, a pure function of the name. A missing directory is an empty inventory. No caller in this task; later tasks call it from the publisher.
internal/layout/plan.go:NestedPlatformNames durability 3a Task 1: now a one-line wrapper for pubclass.NestedPlatformNames, which builds the same set (byte-identical, checked before and after) from pubclass.FileBases and the same instancectl/instancekey names, without nestedFiles or rawInstanceDir; it never read anything, and reads nothing now
-internal/hostfiles/sealed.go:ReadSealed durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator.
+internal/hostfiles/sealed.go:ReadSealed durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator. Branch fix R2 P1-3: wrap the existing appconfig.Open error as SealedOpenError, preserving error text and cause, so a decryption refusal leaves a conflict marker while a transient storage GET failure does not. Same fetch and envelope verification; no new read.
internal/host/agent.go:runAgent durability 3a Task 3: one more assignment beside eb.FilesStore: eb.EscrowKey = haEscrowKey(os.Getenv("CARLOS_SECRETS_KEY")), the agent's own environment parsed by appconfig.ParsePrivateKey as the moves pass parses it (unset or unparseable: a log line and nil, and HA publication refuses on the box). No path is opened or read, no read site added; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 4: one more goroutine beside configSyncLoop: go escrowLoop(agentCtx, reg, svc), the escrow sweep every 30 s over the same registry and Service. This body reads nothing new itself; the same six sites, offsets moved; B,C,D,F authority retained. Durability 3a Task 5: one more call beside eb.EscrowKey: wireRawSecretPages(eb, PageOperator, metricsBoxLabel(os.Getenv, readMachineID())), which sets eb.OnRawSecret to page an operator (alerting.Page through PageOperator, LevelIncident) on its own goroutine with a 20 s timeout; metricsBoxLabel and readMachineID are the reads this body already makes for the moves refusal log; no new read site; the same six sites, offsets moved; B,C,D,F authority retained. Merge of origin/main 90c4d3aa: main's own later changes to this body are kept as main has them, under main's rulings; this branch's change is the same as above.
internal/activator/hafiles.go:ExecBackend.sealerFor durability 3a Task 3: new. Builds the host's hostfiles.ItemSealer from the backend's EscrowKey (the box's own CARLOS_SECRETS_KEY, set once by runAgent) and the binding {release.RouteAccount(rt), rt.App} for rt.Host (NewItemSealer validates the account, app and host shape); nil key is an error. Pure in memory: opens, reads and writes nothing.
-internal/activator/hafiles.go:ExecBackend.newHostFiles durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local.
+internal/activator/hafiles.go:ExecBackend.newHostFiles durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. Branch fix R2 P1-3: capture the route, paths and sealer in the HA publisher callback to the shared stageEscrowReads gate. No I/O added here. All HA passes read the same three bounded no-link local paths before invoking the callback; it refuses divergence or unreadable-key replacement before any StageSealed.
internal/activator/hafiles.go:ExecBackend.openHostFiles durability 3a Task 3: asks sealerFor before hostfiles.Open, so a box without an escrow key refuses before it reads the manifest; newHostFiles's error is returned. The same manifest GET otherwise; the new +whole:Route site is sealerFor's argument. Opens nothing new. Durability 3a Task 5: after hostfiles.Open, noteRawBaseline(rt.Host, pub), the detector over the manifest just read (hostfiles.RawAfterSealed on the decoded baseline). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument.
internal/activator/hafiles.go:ExecBackend.stageKeptFiles durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. The same baseline read; nothing new opened or read. Durability 3a Task 5: after the marker's gen matched, noteRawBaseline(rt.Host, pub) on the kept baseline. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument.
internal/activator/hafiles.go:ExecBackend.stageWakeFiles durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. No read, as before. Durability 3a Task 5: after OpenBaseline, noteRawBaseline(rt.Host, pub) on the baseline the restore holds. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument.
-internal/activator/hasecrets.go:ExecBackend.haSecretsReady durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened.
+internal/activator/hasecrets.go:ExecBackend.haSecretsReady durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. Branch fix R2 P1-3: every launch invokes PublishPlatformNow and the shared escrow gate even when the captured env is already acknowledged. A divergent trio or persisted conflict marker cannot bypass the gate. Unchanged publication remains request-free. Same local paths and manifest prefix; no new authority.
internal/activator/hawake.go:ExecBackend.restoreFilesClean durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged.
internal/hostfiles/restore.go:Restore durability 3a Task 3 fix round 1: passes nil for restore's new shadowed argument, so it fetches, writes and removes exactly what it did; the same reads. restore gains that argument (a caller's Shadowed func over the manifest it has already read and validated): a live entry it names, after the overlap rule, is skipped before any fetch and reported in RestoreStats.Shadowed. It only leaves things out; nothing new is opened, read or followed. RestoreRootBaselineShadowed is new, RestoreRootBaseline is it with nil. Durability 3a Task 5 fix round 1: restore() takes one more argument, checked (nil from Restore, RestoreRoot and RestoreRootBaselineShadowed), called with the manifest after checkManifest and before anything is removed, fetched or written (RestoreRootBaselineObserved passes the caller's); Restore passes nil, so its reads, opens and writes are exactly as before.
internal/activator/admintoken.go:ensureAdminToken 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
@@ -48,7 +48,7 @@ internal/activator/escrow.go:ExecBackend.haKnown durability 3a Task 4: new: the
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. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads. Durability 3a Task 5: after an open from the bucket and learnBucket, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument.
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). 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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals.
+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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. Branch fix R2 P1-3: delegate the existing baseline, divergence and StageSealed operations to stageEscrowReads, shared with HA. Same bucket objects and reads; lease gating, uncertain-commit state drop, and typed CAS-recovery refusal retained.
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. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals.
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
@@ -78,3 +78,6 @@ internal/host/claimfilesseed_stage.go:filesSeedOperation.stage Durability 3a Tas
# Removed by B2: internal/activator/escrow.go:escrowManifestFor Branch fix R1 P1-3: new pure selection using Route.Incarnation and Manifest.EscrowForIncarnation; a higher stamped lifetime wraps errEscrowUnreadable, a lower non-zero stamp omits sealed escrow and the cutover marker from the view. Reads only the supplied values, no file or store access.
# Task B2, Paul 2026-11-01: cut hostname-lifetime binding.
+
+# Task B2 R2 P1-3: one shared escrow gate before every sealed publication.
+internal/activator/escrow.go:ExecBackend.stageEscrowReads Branch fix R2 P1-3: shared HA and non-HA write-once funnel. Checks the existing conflict marker, decodes the committed baseline, reports raw secrets, calls escrowDivergence on all candidates before any StageSealed. Trio changes refuse before any env GET. Changed platform-minted env variables refuse; an envelope that cannot open under the key/binding refuses with the existing alert and best-effort durable marker; transient GET errors refuse without a marker. Same host manifest prefix, sealed env object and local conflict path. No new authority or root read target.
diff --git a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
index c797e4433..dde809d5f 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, 45 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, 46 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -16,14 +16,14 @@ Ruling `census-ruling-durability-3a-escrow`. The independent reviewer approves o
| `internal/host/relocationflush.go` `ReleaseFlushFiles.Flush` | body | unchanged (1) | Durability 3a Task 5 (parked path, host claims only): the env file's presence is decided first with instancefs.OpenBeneathOrAbsent (the bytes are never read, replacing readInstanceFile of the env): present refuses with pubclass.ErrSecretPath before the manifest is read; hostfiles.RefuseSecretsAt over the root it opened, after the tenant seam and before hostfiles.Seed; absent still stages the env item's delete. Only refuses more, and reads less. Branch fix R1 P1-2: Seed also receives FilesDirSkip for classification during the upload walk; the release flush composes its optional skip as an additional exclusion. The preflight remains; no read target or authority added. |
| `internal/hostfiles/restore.go` `Restore` | body | unchanged (1) | durability 3a Task 3 fix round 1: passes nil for restore's new shadowed argument, so it fetches, writes and removes exactly what it did; the same reads. restore gains that argument (a caller's Shadowed func over the manifest it has already read and validated): a live entry it names, after the overlap rule, is skipped before any fetch and reported in RestoreStats.Shadowed. It only leaves things out; nothing new is opened, read or followed. RestoreRootBaselineShadowed is new, RestoreRootBaseline is it with nil. Durability 3a Task 5 fix round 1: restore() takes one more argument, checked (nil from Restore, RestoreRoot and RestoreRootBaselineShadowed), called with the manifest after checkManifest and before anything is removed, fetched or written (RestoreRootBaselineObserved passes the caller's); Restore passes nil, so its reads, opens and writes are exactly as before. |
| `internal/activator/backend_exec.go` `ExecBackend.Acquire` | sites | +registry:Host | durability 3a Task 4 fix round 1: after a successful acquire, records the instance lease it hands out (escrow.noteLease, memory only), so the escrow can ask whether this box holds the host's lease; the same acquire, no read added; the agent as carlos (carlos-edge.service), no root caller |
-| `internal/activator/hafiles.go` `ExecBackend.newHostFiles` | sites | +whole:Route | durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. |
+| `internal/activator/hafiles.go` `ExecBackend.newHostFiles` | sites | +whole:Route ×3 | durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. Branch fix R2 P1-3: capture the route, paths and sealer in the HA publisher callback to the shared stageEscrowReads gate. No I/O added here. All HA passes read the same three bounded no-link local paths before invoking the callback; it refuses divergence or unreadable-key replacement before any StageSealed. |
| `internal/activator/hafiles.go` `ExecBackend.openHostFiles` | sites | +registry:Host, +whole:Route | durability 3a Task 3: asks sealerFor before hostfiles.Open, so a box without an escrow key refuses before it reads the manifest; newHostFiles's error is returned. The same manifest GET otherwise; the new +whole:Route site is sealerFor's argument. Opens nothing new. Durability 3a Task 5: after hostfiles.Open, noteRawBaseline(rt.Host, pub), the detector over the manifest just read (hostfiles.RawAfterSealed on the decoded baseline). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. |
| `internal/activator/hafiles.go` `ExecBackend.stageKeptFiles` | sites | +registry:Host ×2 | durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. The same baseline read; nothing new opened or read. Durability 3a Task 5: after the marker's gen matched, noteRawBaseline(rt.Host, pub) on the kept baseline. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. |
| `internal/activator/hafiles.go` `ExecBackend.stageWakeFiles` | sites | +registry:Host ×2 | durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. No read, as before. Durability 3a Task 5: after OpenBaseline, noteRawBaseline(rt.Host, pub) on the baseline the restore holds. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. |
| `internal/activator/hasecrets.go` `ExecBackend.captureLaunchEnv` | sites | -file:ReadFile | durability 3a Task 4: the flat arm's os.ReadFile (-file:ReadFile) is gone: both layouts read the own env file and the rendered config env with instancefs.ReadBeneathLimit beneath the row's data directory (openat2, no symlink, regular files only, 1 MiB), so an escrowed flat row's capture never follows a link at <host>.env; an absent own file is an error, an absent config is not; the agent as carlos (carlos-edge.service), no root caller; only narrows a read |
| `internal/activator/hasecrets.go` `ExecBackend.ensureAdminTokenFor` | sites | +registry:Host, +whole:Route ×3 | durability 3a Task 4: classifies the host once (haHostNow), and for a host that is not HA and is eligible for escrow first calls restoreEscrowIfMissing (a new unit on this card), then ensureAdminToken with mintGuardAs's guard; an HA host's path is as before; any other host's guard is nil as before; +whole:Route x3 (the row handed on); the agent as carlos (carlos-edge.service), no root caller Fix round 1: begins the launch's preparation (beginPrep) before the restore, and passes fresh false to the guard. |
| `internal/activator/hasecrets.go` `ExecBackend.haMintGuard` | sites | -whole:Route | durability 3a Task 4: now only the HA arm of mintGuardFor: the same once-per-guard haManifestFound read and the same ErrInstanceKeyDeferred refusal, the name ignored; the HA classification moved to mintGuardFor (-whole:Route); only refuses |
-| `internal/activator/hasecrets.go` `ExecBackend.haSecretsReady` | sites | +whole:Route | durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. |
+| `internal/activator/hasecrets.go` `ExecBackend.haSecretsReady` | sites | +whole:Route | durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. Branch fix R2 P1-3: every launch invokes PublishPlatformNow and the shared escrow gate even when the captured env is already acknowledged. A divergent trio or persisted conflict marker cannot bypass the gate. Unchanged publication remains request-free. Same local paths and manifest prefix; no new authority. |
| `internal/activator/hasecrets.go` `ExecBackend.launchEnvLayer` | sites | +whole:Route ×2 | durability 3a Task 4: for a host that is not HA and is eligible for escrow, escrowedLaunchEnv (a new unit on this card) instead of instanceEnvLayer; the HA and other paths unchanged; +whole:Route x2; the agent as carlos (carlos-edge.service), no root caller |
| `internal/activator/hawake.go` `ExecBackend.restoreFilesClean` | sites | +whole:Route | durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged. |
| `internal/activator/paths.go` `ExecBackend.pathsFor` | sites | -registry:DBPath, -registry:Host ×7, +whole:Route | durability 3a Task 4: split in two: pathsFor classifies (Classify, unchanged) and hands the answer to pathsAt (new on this card), which holds the same body; the same paths for every row; the reads moved to pathsAt whole |
@@ -93,8 +93,9 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/activator/escrow.go:ExecBackend.openEscrowLocked`: reads +file:Open, +registry:Host ×3, +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 ×7, +whole:Route ×3; 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 ×9, +whole:Route ×7; written legacy, accepted-legacy, frozen
+- new `internal/activator/escrow.go:ExecBackend.stageEscrowReads`: reads +registry:Host ×2, +whole:Route ×3; 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
@@ -117,6 +118,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- quiet `internal/layout/plan.go:NestedPlatformNames`: reads nothing now; retired while it reads nothing (or its row keeps no sites)
- reads `internal/host/movesfiles.go:buildPrepared`: +file:Open, -file:ReadFile, +file:Stat; keeps legacy, task accepted-legacy
-Seal: `67b54b219f990c3dcfe32c6ffb11a80a4ca3898aec060fe9f4450e21098af714` → `4b99560101dcc7f464823034b1893dc76e31202d9a9863e9f38b0883dcc9c86a`.
+Seal: `67b54b219f990c3dcfe32c6ffb11a80a4ca3898aec060fe9f4450e21098af714` → `697737b989cfc1d9b082f534265f01c533d446c1fe345782bc696219e0d71156`.
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 a1319e2bc..2ec5dcb1a 100644
--- a/internal/activator/escrow.go
+++ b/internal/activator/escrow.go
@@ -792,30 +792,8 @@ 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, 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, fmt.Errorf("%w: %w", errEscrowUnreadable, err)
- }
- // The held baseline, before DropRawSecrets below removes what the
- // detector looks for.
- b.noteRawSecrets(rt.Host, m)
- if diverged, err := b.escrowDivergence(ctx, rt, m, reads, seal); err != nil {
+ if err := b.stageEscrowReads(ctx, rt, p, pub, seal, reads); err != nil {
return out, err
- } else if len(diverged) > 0 {
- return out, b.escrowConflictFound(rt, p, diverged)
- }
- for _, r := range reads {
- if !r.stage {
- continue
- }
- if err := pub.StageSealed(ctx, r.rel, r.plain, seal); err != nil {
- return out, err
- }
}
// Any raw secret an older box published under this prefix goes in the
// same commit (manifest only, no object deleted).
@@ -867,6 +845,40 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
return out, errors.Join(refused...)
}
+// stageEscrowReads is the shared write-once gate for HA and non-HA
+// publication. Check every candidate against the committed baseline before
+// any StageSealed call can upload bytes. An envelope that cannot open here
+// leaves a conflict marker; a transient storage read failure only refuses.
+func (b *ExecBackend) stageEscrowReads(ctx context.Context, rt registry.Route, p instancePaths, pub *hostfiles.Publisher, seal *hostfiles.ItemSealer, reads []escrowRead) error {
+ if err := b.escrowConflict(rt.Host); err != nil {
+ return err
+ }
+ m, err := baselineManifest(pub.Baseline())
+ if err != nil {
+ return fmt.Errorf("%w: %w", errEscrowUnreadable, err)
+ }
+ b.noteRawSecrets(rt.Host, m)
+ diverged, err := b.escrowDivergence(ctx, rt, m, reads, seal)
+ if err != nil {
+ var unopened *hostfiles.SealedOpenError
+ if errors.As(err, &unopened) {
+ return errors.Join(err, b.escrowConflictFound(rt, p, []string{hostfiles.SealedEnvItem}))
+ }
+ return err
+ }
+ if len(diverged) > 0 {
+ return b.escrowConflictFound(rt, p, diverged)
+ }
+ for _, r := range reads {
+ if r.stage {
+ if err := pub.StageSealed(ctx, r.rel, r.plain, seal); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
+
// 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
diff --git a/internal/activator/escrow_test.go b/internal/activator/escrow_test.go
index 5cda88f56..1b2bec2bd 100644
--- a/internal/activator/escrow_test.go
+++ b/internal/activator/escrow_test.go
@@ -1168,10 +1168,10 @@ func TestABoxThatChangesKeyFailsClosed(t *testing.T) {
if missingEnv {
wantErr = ErrEscrowNotReady
}
- if tc.trio {
- // The trio digest is keyed: B differs from A's digest even
- // for the same plaintext. The sweep leaves a conflict marker,
- // and the wake refuses on that marker before restore or mint.
+ if tc.trio || !missingEnv {
+ // A keyed trio digest mismatch or an env envelope that
+ // cannot open under B leaves a persistent marker. The
+ // wake refuses on that marker before restore or mint.
marker := escrowConflictPath(nb.DataDir, rt.Host)
if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !strings.Contains(err.Error(), marker) || !exists(marker) {
t.Errorf("wake with trio after key change = %v; marker present %v", err, exists(marker))
diff --git a/internal/activator/haescrow_branchfix_test.go b/internal/activator/haescrow_branchfix_test.go
new file mode 100644
index 000000000..4bf3c8a57
--- /dev/null
+++ b/internal/activator/haescrow_branchfix_test.go
@@ -0,0 +1,169 @@
+package activator
+
+import (
+ "bytes"
+ "context"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/hostfiles"
+)
+
+func TestHAKeptWakeChangedKeyRefusesEscrow(t *testing.T) {
+ for _, trio := range []bool{false, true} {
+ name := "env-only"
+ if trio {
+ name = "full-trio"
+ }
+ t.Run(name, func(t *testing.T) {
+ ctx := context.Background()
+ s := haService(t, escrowHost)
+ e, err := s.wakeForTest(ctx)
+ if err != nil {
+ t.Fatal(err)
+ }
+ wantEnv := envFileBytes(t, s.b, s.rt)
+ if trio {
+ writeFiles(t, s.b, s.rt, map[string]string{"instance.key": "ik-a", "report.token": "rt-a"})
+ }
+ s.stopForTest(e)
+ view := s.lockView(t)
+ if !s.stoppedFor(e) || view.Lock.Release == nil || !view.Lock.Release.Clean {
+ t.Fatal("setup did not make a clean key-A release")
+ }
+ sealA := sealerOf(t, s.b, s.rt)
+ before := prefixObjects(t, s.b, s.rt)
+ next := s.restart(t)
+ next.b.EscrowKey = testEscrowKey(t)
+ sealB := sealerOf(t, next.b, next.rt)
+ counted := &escrowCountingStore{Store: next.b.FilesStore}
+ next.b.FilesStore = counted
+ starts, restores := spawns(next.b), restoreCalls(next.b)
+ _, err = next.wakeForTest(ctx)
+ if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !exists(escrowConflictPath(next.b.DataDir, next.rt.Host)) {
+ t.Errorf("kept wake with key B must refuse with alert and marker: %v", err)
+ }
+ if spawns(next.b) != starts || restoreCalls(next.b) != restores {
+ t.Error("refused kept wake started an app or restored instead of keeping")
+ }
+ if counted.puts.Load() != 0 {
+ t.Errorf("refused kept wake made %d files PUTs", counted.puts.Load())
+ }
+ after := prefixObjects(t, next.b, next.rt)
+ if len(before) != len(after) {
+ t.Error("refused kept wake changed the object set")
+ }
+ for key, body := range before {
+ if !bytes.Equal(body, after[key]) {
+ t.Errorf("refused kept wake changed %s", key)
+ }
+ }
+ m := loadManifest(t, next.b, next.rt)
+ items := map[string]string{hostfiles.SealedEnvItem: wantEnv}
+ if trio {
+ items["instance.key.sealed"], items["report.token.sealed"] = "ik-a", "rt-a"
+ }
+ for item, want := range items {
+ plain, err := hostfiles.ReadSealed(ctx, next.b.FilesStore, next.b.filesPrefix(next.rt.Host), m, item, nil, sealA)
+ if err != nil || string(plain) != want {
+ t.Errorf("key A no longer opens %s: %v", item, err)
+ }
+ if _, err := hostfiles.ReadSealed(ctx, next.b.FilesStore, next.b.filesPrefix(next.rt.Host), m, item, nil, sealB); err == nil {
+ t.Errorf("key B opens %s", item)
+ }
+ }
+ // Restoring key A does not bypass the operator's conflict marker,
+ // including the already-acknowledged env fast path.
+ next.b.EscrowKey = s.b.EscrowKey
+ if err := next.b.launchForTest(next.rt); err == nil || !strings.Contains(err.Error(), "ALERT: ") {
+ t.Fatalf("restoring key A bypassed the conflict marker: %v", err)
+ }
+ })
+ }
+}
+
+func TestHAPublicationRefusesChangedMintedValues(t *testing.T) {
+ for _, pass := range []string{"platform", "snapshot", "final", "launch"} {
+ for _, name := range []string{"CARLOS_ADMIN_TOKEN", InstanceKeyVar, "instance.key", "report.token"} {
+ t.Run(pass+"/"+name, func(t *testing.T) {
+ ctx := context.Background()
+ b, rt := haLaunchBackend(t, escrowHost)
+ counted := &escrowCountingStore{Store: b.FilesStore}
+ b.FilesStore = counted
+ writeEnv(t, b, rt, envA)
+ writeFiles(t, b, rt, map[string]string{"instance.key": "ik-a", "report.token": "rt-a"})
+ f, err := b.openHostFiles(ctx, rt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := f.PublishPlatformNow(ctx); err != nil {
+ t.Fatal(err)
+ }
+ b.haWakes.setFiles(rt.Host, f)
+ if name == "instance.key" || name == "report.token" {
+ writeFiles(t, b, rt, map[string]string{name: "changed"})
+ } else {
+ old := "tok-a"
+ if name == InstanceKeyVar {
+ old = "key-a"
+ }
+ writeEnv(t, b, rt, strings.Replace(envA, old, "changed", 1))
+ }
+ puts := counted.puts.Load()
+ switch pass {
+ case "platform":
+ err = f.PublishPlatformNow(ctx)
+ case "snapshot":
+ err = f.publishSnapshot(ctx)
+ case "final":
+ _, _, err = f.Final(ctx)
+ case "launch":
+ err = b.launchForTest(rt)
+ }
+ if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !exists(escrowConflictPath(b.DataDir, rt.Host)) {
+ t.Errorf("changed minted value must refuse with alert and marker: %v", err)
+ }
+ if counted.puts.Load() != puts {
+ t.Error("divergent pass made PUTs")
+ }
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != envA {
+ t.Errorf("divergent pass replaced env: %q", got)
+ }
+ for item, want := range map[string]string{"instance.key.sealed": "ik-a", "report.token.sealed": "rt-a"} {
+ if got := sealedItem(t, b, rt, item); got != want {
+ t.Errorf("divergent pass replaced %s: %q", item, got)
+ }
+ }
+ })
+ }
+ }
+}
+
+// A failed object GET refuses without creating a persistent key conflict.
+// An ordinary env edit succeeds once storage recovers.
+func TestHAEscrowReadFailureCanRetryOrdinaryEnvEdit(t *testing.T) {
+ ctx := context.Background()
+ b, rt := haLaunchBackend(t, escrowHost)
+ store := &objectGetsFail{Store: b.FilesStore}
+ b.FilesStore = store
+ writeEnv(t, b, rt, envA)
+ f, err := b.openHostFiles(ctx, rt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := f.PublishPlatformNow(ctx); err != nil {
+ t.Fatal(err)
+ }
+ writeEnv(t, b, rt, envB)
+ store.failing.Store(true)
+ if err := f.PublishPlatformNow(ctx); err == nil || exists(escrowConflictPath(b.DataDir, rt.Host)) {
+ t.Fatalf("object GET failure must refuse without a marker: %v", err)
+ }
+ store.failing.Store(false)
+ if err := f.PublishPlatformNow(ctx); err != nil {
+ t.Fatalf("retry ordinary env edit: %v", err)
+ }
+ if got := sealedItem(t, b, rt, hostfiles.SealedEnvItem); got != envB {
+ t.Fatalf("ordinary env edit did not publish: %q", got)
+ }
+}
diff --git a/internal/activator/hafiles.go b/internal/activator/hafiles.go
index 874c16777..c03d63ca5 100644
--- a/internal/activator/hafiles.go
+++ b/internal/activator/hafiles.go
@@ -158,8 +158,9 @@ type hostFiles struct {
// seal seals and opens the host's secrets (sealerFor); skip is the
// classifier's verdict on the files directory: only what is App
// publishes as bytes.
- seal *hostfiles.ItemSealer
- skip func(rel string, isDir bool) bool
+ seal *hostfiles.ItemSealer
+ stageEscrow func(context.Context, *hostfiles.Publisher, []escrowRead) error
+ skip func(rel string, isDir bool) bool
// noteHeld is the detector's look at the manifest the publisher holds,
// made before every pass stages anything (stageItemsLocked). Nil: none.
noteHeld func(*hostfiles.Publisher)
@@ -195,6 +196,9 @@ func (b *ExecBackend) newHostFiles(rt registry.Route, pub *hostfiles.Publisher)
host := rt.Host
return &hostFiles{pub: pub, paths: b.pathsFor(rt), host: host, reg: b.Registry,
seal: seal, skip: pubclass.FilesDirSkip(pubclass.Nested, host),
+ stageEscrow: func(ctx context.Context, pub *hostfiles.Publisher, reads []escrowRead) error {
+ return b.stageEscrowReads(ctx, rt, b.pathsFor(rt), pub, seal, reads)
+ },
noteHeld: func(p *hostfiles.Publisher) { b.noteRawBaseline(host, p) },
platformEvery: haPlatformEvery, snapshotEvery: haSnapshotEvery}, nil
}
@@ -525,18 +529,21 @@ func (f *hostFiles) stageItemsLocked(ctx context.Context) error {
if f.noteHeld != nil {
f.noteHeld(f.pub)
}
+ var reads []escrowRead
for _, r := range pubclass.SealedRels(pubclass.Nested, f.host) {
rel := filepath.FromSlash(r.Rel())
plain, absent, err := instancefs.ReadBeneathLimitOrAbsent(f.paths.dataDir, rel, haEnvReadLimit)
- switch {
- case err != nil && !errors.Is(err, os.ErrNotExist):
+ if err != nil && !errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("read %s: %w", r.Rel(), err)
- case absent || err != nil:
- if err := f.pub.StagePlatformDelete(r.Item()); err != nil {
- return err
- }
- default:
- if err := f.pub.StageSealed(ctx, r, plain, f.seal); err != nil {
+ }
+ reads = append(reads, escrowRead{rel: r, plain: plain, stage: !absent && err == nil})
+ }
+ if err := f.stageEscrow(ctx, f.pub, reads); err != nil {
+ return err
+ }
+ for _, r := range reads {
+ if !r.stage {
+ if err := f.pub.StagePlatformDelete(r.rel.Item()); err != nil {
return err
}
}
diff --git a/internal/activator/hasecrets.go b/internal/activator/hasecrets.go
index 50ee43d84..9424cf724 100644
--- a/internal/activator/hasecrets.go
+++ b/internal/activator/hasecrets.go
@@ -275,20 +275,17 @@ func (b *ExecBackend) haSecretsReady(ctx context.Context, rt registry.Route, env
}
own = true
}
+ // Validate all local secrets even when the env already matches: a
+ // divergent trio or a persistent conflict marker must still refuse.
+ if err := f.PublishPlatformNow(ctx); err != nil {
+ return fmt.Errorf("publish the host's secrets: %w", err)
+ }
ok, err := f.envAcknowledged(env)
if err != nil {
return err
}
if !ok {
- if err := f.PublishPlatformNow(ctx); err != nil {
- return fmt.Errorf("publish the host's secrets: %w", err)
- }
- if ok, err = f.envAcknowledged(env); err != nil {
- return err
- }
- if !ok {
- return errors.New("publish the host's secrets: the env file changed while it was published")
- }
+ return errors.New("publish the host's secrets: the env file changed while it was published")
}
if own {
// The wake's entry continues from the manifest this read or
diff --git a/internal/activator/hasecrets_test.go b/internal/activator/hasecrets_test.go
index ae10e4e29..c06c65808 100644
--- a/internal/activator/hasecrets_test.go
+++ b/internal/activator/hasecrets_test.go
@@ -260,7 +260,7 @@ func TestHALaunchUsesTheEntryPublisher(t *testing.T) {
t.Fatalf("asked %d; published %q", asked, platformEnv(t, b, rt))
}
// The entry's publisher is still the manifest's writer: it commits on.
- writeEnv(t, b, rt, "CARLOS_ADMIN_TOKEN=t2\n"+InstanceKeyVar+"=k2\n")
+ writeEnv(t, b, rt, envFileBytes(t, b, rt)+"SHOP_MODE=b\n")
if err := entry.PublishPlatformNow(ctx); err != nil {
t.Fatalf("the entry's publisher was superseded: %v", err)
}
diff --git a/internal/hostfiles/sealed.go b/internal/hostfiles/sealed.go
index de38aaa6c..d69cf5e5f 100644
--- a/internal/hostfiles/sealed.go
+++ b/internal/hostfiles/sealed.go
@@ -160,6 +160,15 @@ func (p *Publisher) StageSealed(ctx context.Context, r pubclass.SealedRel, plain
return nil
}
+// SealedOpenError distinguishes a verified object's envelope that cannot
+// open under the supplied key and binding from a failed storage read.
+// Callers may persist a key conflict without making transient GET errors
+// require operator intervention.
+type SealedOpenError struct{ Err error }
+
+func (e *SealedOpenError) Error() string { return e.Err.Error() }
+func (e *SealedOpenError) Unwrap() error { return e.Err }
+
// ReadSealed returns a sealed item's plaintext: the object fetched and
// verified as ReadPlatform does, opened as a v2 envelope under s's key and
// binding, and its digest checked against the entry's PlainMAC, which
@@ -194,7 +203,7 @@ func ReadSealed(ctx context.Context, st release.Store, prefix string, m Manifest
}
plain, err := appconfig.Open(s.priv, s.binding, string(body))
if err != nil {
- return nil, fmt.Errorf("hostfiles: sealed item %q: %w", item, err)
+ return nil, &SealedOpenError{Err: fmt.Errorf("hostfiles: sealed item %q: %w", item, err)}
}
if !hmac.Equal([]byte(s.MAC(item, plain)), []byte(e.PlainMAC)) {
return nil, fmt.Errorf("hostfiles: sealed item %q: its digest is not this host's and item's", item)
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index b61b56093..28275f2b0 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -52,4 +52,4 @@ plan14-root-reads-managed-fleets-1b.tsv 7570ca617863882780c1c5a7d04430b578a297ee
plan14-root-reads-sponsor-existing-accounts.tsv 7570ca617863882780c1c5a7d04430b578a297ee4d72ca25acc1cdc5288ca283
plan14-root-reads-rootfs-apps-6.tsv c86929d08b9b2038fa103d1c7311ab2958e7100e92dc550d36daeb364affd029
plan14-root-reads-devbox-macos.tsv 67b54b219f990c3dcfe32c6ffb11a80a4ca3898aec060fe9f4450e21098af714
-plan14-root-reads-durability-3a-escrow.tsv 4b99560101dcc7f464823034b1893dc76e31202d9a9863e9f38b0883dcc9c86a
+plan14-root-reads-durability-3a-escrow.tsv 697737b989cfc1d9b082f534265f01c533d446c1fe345782bc696219e0d71156
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 5797027a1..d98b6292b 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.
# 11 body, 12 sites, 5 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 4 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.
-# 45 new dispositions: 1 reads re-frozen at their disposition with the claim, 43 new units frozen accepted-legacy, 1 quiet units retired while they read nothing, 0 other.
+# 46 new dispositions: 1 reads re-frozen at their disposition with the claim, 44 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
@@ -32,8 +32,9 @@
@legacy ea89afa7fe34b39ecf49c55c51f3fea23ba6fd785e1c71880d8d072237ee777e 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. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads. Durability 3a Task 5: after an open from the bucket and learnBucket, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. file:Open@737,registry:Host@1040,registry:Host@528,registry:Host@584,whole:Route@415 a1e68a862a55c28dc76702f4558b480c1c5cb3c598f535470fde1f92c90be179
@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 c254e592f86122d29fa7b9947b3f4f4dfca757971bb6fd443215354101e30e72 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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5266,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 b83bbe65c4cbbb9f92ec6a2928fe1b6fb16f9f54606717677466f1b1a6a59d67
+@legacy 24182e210cb1e45dc6e61f1c8bce9329a7a9f5d523098987c3cd09b1e47ac3c6 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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. Branch fix R2 P1-3: delegate the existing baseline, divergence and StageSealed operations to stageEscrowReads, shared with HA. Same bucket objects and reads; lease gating, uncertain-commit state drop, and typed CAS-recovery refusal retained. registry:Host@2078,registry:Host@2342,registry:Host@3307,registry:Host@3337,registry:Host@4494,registry:Host@574,whole:Route@2269,whole:Route@2497 01b4a5ff2f2dccc3f28d998a5e478e309e3eb9762f007a0fbee34501f2743d89
@legacy 74bd4eb3be0768428751ab09e7fdcbcd46d84aa16e619a9f591d35dc57e4a824 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. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. 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 b7f721d0925fe5332a1809aa3e44df9e52c90e5eaccf83193acb1c14ec09b99c internal/activator/escrow.go ExecBackend.stageEscrowReads legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=Branch fix R2 P1-3: shared HA and non-HA write-once funnel. Checks the existing conflict marker, decodes the committed baseline, reports raw secrets, calls escrowDivergence on all candidates before any StageSealed. Trio changes refuse before any env GET. Changed platform-minted env variables refuse; an envelope that cannot open under the key/binding refuses with the existing alert and best-effort durable marker; transient GET errors refuse without a marker. Same host manifest prefix, sealed env object and local conflict path. No new authority or root read target. registry:Host@206,registry:Host@383,whole:Route@437,whole:Route@598,whole:Route@716 f00a182229cbe7f895f91822d1a3b637589a0764d55b5c498feeec9e488a4018
@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
@@ -51,18 +52,18 @@
@legacy 957ad5d3377cd8a74a394858b4836b46d318fbaa7b3a3ac2c102c9b010f75ac4 internal/host/escrow_loop.go escrowLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: every activator.EscrowEvery (30 s) lists the registry and runs svc.EscrowSweep over the rows; logs failures and deferrals; returns with no registry or no Service; the agent as carlos (carlos-edge.service), no root caller whole:Route@426 498f5efdf374f9c35ca954f845507ce3c8db25e9b766f873c3acf23ec2f7cb05
@legacy 29ed64c9e5683c30cebe4a93f46e8c9617e31875b17e64be9ef8fb95db497e06 internal/host/movesfiles.go claimEnvPresent legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5: new: whether the claim env file exists, without reading it: nested, instancefs.OpenBeneathOrAbsent beneath the instance directory (no link at any component; the descriptor closed at once); flat, os.Lstat of <data>/<host>.env (a link there counts as present, so it refuses). An undecidable answer is an error. Only feeds a refusal. file:Lstat@81 99e674efa8d1bf26a59304024912fcd5b5caf2e5d80274e8def7dbb75d9362b5
@legacy 57d643b797aeddcfb4e30175e92072cd6d1cad46c442bf44ecb0f821d74ecafd internal/host/schedule_wiring.go scheduleHostEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: scheduleHostHA renamed: reads the host's row (reg.Get) and asks svc.SecretsEscrowed (HA, or eligible for escrow) with a 10 s timeout; false with no registry or no row; for such a host scheduleToken only reads the existing env token ("" when none) and never mints (EnsureAdminToken skipped); the agent as carlos (carlos-edge.service), no root caller whole:Route@254,whole:Route@413 1a608f98d348d9183088ff4f04742c30467a116f0071358ce479e1dff5e20eeb
-@legacy 51297417f7d25f895c3793014740994855e599bf8731cf3295ea836820ae4f13 internal/hostfiles/sealed.go ReadSealed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator. file:Open@898 7c2b887b6e0b45472fd8d1a63a2b78eb565c4e93c89cb329eeeaef429ab0b010
+@legacy 3fe9f2fb4317a769c1064de405465cd5ad07f19a94d44dbd835b5e2b3bff164b internal/hostfiles/sealed.go ReadSealed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator. Branch fix R2 P1-3: wrap the existing appconfig.Open error as SealedOpenError, preserving error text and cause, so a decryption refusal leaves a conflict marker while a transient storage GET failure does not. Same fetch and envelope verification; no new read. file:Open@898 14437206baa72c952a8be716aa035b723f408384eaf6db56af16b554587e6a6d
@legacy 7520abf7fe01442d3fcca5cc9c46cd22346ae2ad193162ed8df7ba9371914028 internal/layout/inventory.go Inventory legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 1: new. One os.ReadDir of the host's inventory root, provision.InstanceDir(dataDir, host) nested or dataDir flat, after refusing a host that fails controlname.ValidHostShape and a layout that is neither flat nor nested; reads only the listing's names and types (DirEntry.IsDir), opens and follows nothing; flat ownership is the extras scan's own (hostEntries over knownHosts); each top-level name is classified by pubclass.Of, a pure function of the name. A missing directory is an empty inventory. No caller in this task; later tasks call it from the publisher. file:ReadDir@449 9662e465abb7f9c60e908952740384479009c9987c8a6ae65d98fb19cb3d4d7e
@legacy 8ccceaa7c2efcec2085fe2f577bdf1d39c723af9d5fca9abf79425fec256740a internal/host/movesfiles.go buildPrepared legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;census-ruling-moves-overcap-cut-236;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5 (parked path, CARLOS_MOVES_PHASE1 only): wantEnv refuses with pubclass.ErrSecretPath before anything is read or written; the env presence check for !wantEnv is os.Stat instead of os.ReadFile (the secret is no longer read into memory); hostfiles.RefuseSecretsAt over root.Open(".") (+file:Open, a descriptor of the os.Root it already opened, never a pathname) before NewPrepared; the walk checks pubclass.Of(...) == App before each Stage; the env file is never staged. Only refuses more, and reads less. file:Lstat@1275,file:Open@2772,file:OpenRoot@2377,file:Stat@1468,file:WalkDir@3263 75cf376b93c2f69f4c8d1997a0158795c7bcd6967a7742a18ca79822b8e27a2a
@legacy 3548edf2cc46b90278c03f0a5dedc4ed353279e08b2e5ef1a81cca61a94b3639 internal/activator/backend_exec.go ExecBackend.Acquire legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: after the unchanged AdmitConfig gate, the lease acquire moves into acquireClassified (hawake.go, a new unit): a legacy route or a non-HA host takes the same lease.Acquire as before and maps a held lease to errLeaseHeld as before (leaseError); an HA host goes through the containment admission and lease.AcquireHA. A successful acquire marks the host acquiredHere for the process (same-box recovery). The config gate is not weakened; the same three sites, no read added;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: after a successful acquire, records the instance lease it hands out (escrow.noteLease, memory only), so the escrow can ask whether this box holds the host's lease; the same acquire, no read added; the agent as carlos (carlos-edge.service), no root caller registry:Host@1001,registry:Host@807,whole:Route@382,whole:Route@764 ff41146bbb0f1c3fac6a0f34f41540d7dbb036234f490841dca0e23d23b1c99c
-@legacy fa23b1e76a6eac98914d65da29e02ca30265027943d4ad08658745393511c800 internal/activator/hafiles.go ExecBackend.newHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: builds a hostFiles publisher for rt (its instance paths from pathsFor(rt), rt.Host, the backend's registry, the 1 s platform and 15 min snapshot cadences); +registry:Host, +whole:Route; no I/O;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. registry:Host@179,whole:Route@128,whole:Route@234 66557a3afeb86cc98763321b922bc589e1a49f8cf6e940c81144c1a1c7852dc5
+@legacy 3b54fecb51d60e732cf8139dbe747b61fbc0b03ab05f65dca7b4b3530c3baf9c internal/activator/hafiles.go ExecBackend.newHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: builds a hostFiles publisher for rt (its instance paths from pathsFor(rt), rt.Host, the backend's registry, the 1 s platform and 15 min snapshot cadences); +registry:Host, +whole:Route; no I/O;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. Branch fix R2 P1-3: capture the route, paths and sealer in the HA publisher callback to the shared stageEscrowReads gate. No I/O added here. All HA passes read the same three bounded no-link local paths before invoking the callback; it refuses divergence or unreadable-key replacement before any StageSealed. registry:Host@179,whole:Route@128,whole:Route@234,whole:Route@463,whole:Route@478 32e71752391c434c6126276d9368be7d7eb87caa471ea23540c11e567954a6d2
@legacy e2036c8cf0cd989e03b82e70861b06539e0af17589a17c81b550efcd36e139e2 internal/activator/hafiles.go ExecBackend.openHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the entry's files publisher: refuses without a FilesStore or outside the nested layout, takes the one this wake's restore staged, else hostfiles.Open on <hibernate prefix>/files/0/ (one GET of the manifest from the hibernate bucket, the scanner's +file:Open); +registry:Host x2, +whole:Route x2; the manifest is written by the agents of the boxes that hold the host, through the same files store;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before hostfiles.Open, so a box without an escrow key refuses before it reads the manifest; newHostFiles's error is returned. The same manifest GET otherwise; the new +whole:Route site is sealerFor's argument. Opens nothing new. Durability 3a Task 5: after hostfiles.Open, noteRawBaseline(rt.Host, pub), the detector over the manifest just read (hostfiles.RawAfterSealed on the decoded baseline). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. file:Open@521,registry:Host@342,registry:Host@569,registry:Host@636,whole:Route@198,whole:Route@469,whole:Route@673 34091031ddf1a2b90edfd3453ec197fa3ca6a5290b6b7d15d5a44b1028fc8c7a
@legacy 70433b4bfbbaecf83245275d6fda33b6fd5f379e250823dc0e1bae6645fffc17 internal/activator/hafiles.go ExecBackend.stageKeptFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: on a kept wake, reads the manifest baseline the release kept beside its local record (<db>.release.files.json via readFilesBaseline, capped at 32 MiB, O_NOFOLLOW, regular files only) and stages a publisher on it only when its revision (Gen, which carries the body's SHA-256) equals the files_gen in the lock's release marker; the file is on ground the tenant can write, and anything that does not match stages nothing, so the entry re-reads the manifest from the store; it never decides the keep; +registry:Host x4, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. The same baseline read; nothing new opened or read. Durability 3a Task 5: after the marker's gen matched, noteRawBaseline(rt.Host, pub) on the kept baseline. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. registry:Host@254,registry:Host@344,registry:Host@508,registry:Host@553,registry:Host@660,registry:Host@706,whole:Route@151,whole:Route@593 72b7b10bea4dc499e251ae498dd1ad56a4b966bed80f24106c86d6aab75ad3ec
@legacy 23afec3ab558a47f83f80edd7007d473e10940e1a3ac81b045500c03cb315ffd internal/activator/hafiles.go ExecBackend.stageWakeFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: opens a publisher on a manifest baseline the HA restore already holds (hostfiles.OpenBaseline, no read) and keeps it for the wake's entry; without a FilesStore it stages nothing; +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. No read, as before. Durability 3a Task 5: after OpenBaseline, noteRawBaseline(rt.Host, pub) on the baseline the restore holds. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. registry:Host@185,registry:Host@300,registry:Host@345,registry:Host@452,registry:Host@498,whole:Route@385 688df7afd563bc0828cec0cb5c2cd57405c4ce0e3a017c23df16af901cf54913
@legacy a6b323044a9dccb625ae9031b92980454070a102ef5ebd4ac2efc953dec64ea6 internal/activator/hasecrets.go ExecBackend.captureLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: reads an HA launch's own env file and its rendered config env once, the way instanceEnvParts does: on the nested layout through instancefs.ReadBeneathLimit (1 MiB, no link followed), otherwise os.ReadFile (the +file:ReadFile site; an HA host is nested by its acquire's containment admission, so this arm is the flat layout's, where the files are in the agent's own data directory); an absent own file is an error, an absent config is not; parses env and key layer from those bytes; +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: the flat arm's os.ReadFile (-file:ReadFile) is gone: both layouts read the own env file and the rendered config env with instancefs.ReadBeneathLimit beneath the row's data directory (openat2, no symlink, regular files only, 1 MiB), so an escrowed flat row's capture never follows a link at <host>.env; an absent own file is an error, an absent config is not; the agent as carlos (carlos-edge.service), no root caller; only narrows a read whole:Route@98 223e1b2f98aea8bb39f65573bcff0e6d05bb8cd2f55cd43670ca8ba6f1d33299
@legacy 5ca337f30874aae92def93eca1e09c58a4dbc8a85e671df0b4e08fdd14dafd43 internal/activator/hasecrets.go ExecBackend.ensureAdminTokenFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: the launch paths' admin-token producer: haMintGuard(ctx, rt), then ensureAdminToken on <dataDir>/<host>.env, beneath on the nested layout and by path otherwise, with that guard; +registry:Host, +whole:Route; a non-HA host's guard is nil and the producer is the one it used before;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: classifies the host once (haHostNow), and for a host that is not HA and is eligible for escrow first calls restoreEscrowIfMissing (a new unit on this card), then ensureAdminToken with mintGuardAs's guard; an HA host's path is as before; any other host's guard is nil as before; +whole:Route x3 (the row handed on); the agent as carlos (carlos-edge.service), no root caller Fix round 1: begins the launch's preparation (beginPrep) before the restore, and passes fresh false to the guard. registry:Host@257,registry:Host@386,whole:Route@136,whole:Route@237,whole:Route@308,whole:Route@447 581b4132ee9f3bbb900b5c467c02596502b0232575a8beacd198419469eb4e3c
@legacy c39b6a8c39e51f6c93ab4c36c0b3c33765a0f41cd9770e03217c0c3d3b019c63 internal/activator/hasecrets.go ExecBackend.haMintGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos, replacing haMintGate: nil for a host that is not HA; for an HA host a guard that, asked only from a producer's missing-secret branch, reads once whether the host's files manifest exists (haManifestFound) and refuses with ErrInstanceKeyDeferred while it does (or on a read error); it never reads the env; +whole:Route x2; only refuses;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: now only the HA arm of mintGuardFor: the same once-per-guard haManifestFound read and the same ErrInstanceKeyDeferred refusal, the name ignored; the HA classification moved to mintGuardFor (-whole:Route); only refuses whole:Route@220 7218a4d3a064c04bca0bdccec25c2934974b926a5af657a156cd0ca8498b586d
-@legacy 192df384d784a7d1ac579802fd8ad96206ff78ee8164d09ab6e8093b968602ba internal/activator/hasecrets.go ExecBackend.haSecretsReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: before an HA host's launch, checks that env, the bytes the launch captured (captureLaunchEnv; a new parameter, final fix F2), has the SHA-256 of the committed manifest's env item (envAcknowledged, which now reads no file); else publishes the platform items (env, trio, wake state) through the wake's, the entry's or its own publisher (hostfiles.Open, the +file:Open site: one manifest GET) and checks again, so an env replaced after the capture is committed as other bytes and fails the launch; it no longer classifies the host itself (launchEnvLayer has); every error fails the launch; +file:Open, +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. file:Open@390,registry:Host@1187,registry:Host@120,registry:Host@438,whole:Route@294,whole:Route@559 4f4584786d3f90a54aa3ddc1c39ffed8a62fcfd593127f534bea787c3d9b7829
+@legacy e70505295cbdfc289022949d329711e9aabe7f7c76bb789dc116d85903140334 internal/activator/hasecrets.go ExecBackend.haSecretsReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: before an HA host's launch, checks that env, the bytes the launch captured (captureLaunchEnv; a new parameter, final fix F2), has the SHA-256 of the committed manifest's env item (envAcknowledged, which now reads no file); else publishes the platform items (env, trio, wake state) through the wake's, the entry's or its own publisher (hostfiles.Open, the +file:Open site: one manifest GET) and checks again, so an env replaced after the capture is committed as other bytes and fails the launch; it no longer classifies the host itself (launchEnvLayer has); every error fails the launch; +file:Open, +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. Branch fix R2 P1-3: every launch invokes PublishPlatformNow and the shared escrow gate even when the captured env is already acknowledged. A divergent trio or persisted conflict marker cannot bypass the gate. Unchanged publication remains request-free. Same local paths and manifest prefix; no new authority. file:Open@390,registry:Host@120,registry:Host@1236,registry:Host@438,whole:Route@294,whole:Route@559 af5c028a288dd480380c4cf658098373f938337517d7db33aeb8b2d08e489487
@legacy 82fe6cb6c8b941f11795972ab352bc2c63c42602f18f73b275869339964498a1 internal/activator/hasecrets.go ExecBackend.launchEnvLayer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: a launch's env and key layer: classifies the host (haHostNow; an error fails the launch), instanceEnvLayer unchanged for a non-HA host; for an HA host captureLaunchEnv once, haSecretsReady over those bytes, a test seam (haLaunchHooks.afterPublish, nil in production), and returns the env parsed from the captured bytes, never a later read; +registry:Host x3 (the error messages), +whole:Route x4;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: for a host that is not HA and is eligible for escrow, escrowedLaunchEnv (a new unit on this card) instead of instanceEnvLayer; the HA and other paths unchanged; +whole:Route x2; the agent as carlos (carlos-edge.service), no root caller registry:Host@245,registry:Host@499,registry:Host@644,whole:Route@154,whole:Route@294,whole:Route@335,whole:Route@371,whole:Route@408,whole:Route@549 35a5150b24c33e81e5d536bb072c62ab55fd583187d83293e644d3599496a99a
@legacy 9cc3221e205a34573a2e5737aeae9d6b5cde5f9f240eb165e905827716d2835f internal/activator/hawake.go ExecBackend.restoreFilesClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: restores the HA host's published files into a fresh <host>.restore directory beneath the instance data dir (instancefs, no link followed), renames it into place without replacing anything, writes the manifest's env item as <host>.env (instancefs.WriteAtomic, 0600) and imports the manifest's wake state into the registry (hostfiles.ImportWake, then the class for restoredReplication); the source is the host's files manifest in the hibernate bucket, written by the agents of the boxes that held the host; every failure fails the wake; +registry:Host, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged. registry:Host@97,whole:Route@1086,whole:Route@1586,whole:Route@200 ca4b8c70486f72a3bd7ede5d16c8f9fd22eee13f11d005597223a4f5ab20b405
@legacy 4e3b06c62e684994c4777083689b9313642be6bc47c477151e37d93198dbc3f6 internal/activator/paths.go ExecBackend.pathsFor legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: split in two: pathsFor classifies (Classify, unchanged) and hands the answer to pathsAt (new on this card), which holds the same body; the same paths for every row; the reads moved to pathsAt whole whole:Route@129,whole:Route@89 5801150c35fef058ce1f8e7c9f334a7a89e3441fe0f63fb451f4804282e90535
@@ -99,8 +100,9 @@ internal/activator/escrow.go ExecBackend.keylessEscrowed legacy accepted-legacy
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. Fix round 4: only an open from the bucket feeds what this process knows (learnBucket); an open from the ledger feeds nothing; a failed open or an unparseable manifest wraps errEscrowUnreadable; the same reads. Durability 3a Task 5: after an open from the bucket and learnBucket, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. file:Open@737,registry:Host@1040,registry:Host@528,registry:Host@584,whole:Route@415 a1e68a862a55c28dc76702f4558b480c1c5cb3c598f535470fde1f92c90be179
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). 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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5266,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 b83bbe65c4cbbb9f92ec6a2928fe1b6fb16f9f54606717677466f1b1a6a59d67
+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). Fix round 4: only a commit that wrote (the baseline's ETag moved) feeds what this process knows (learnBucket) and writes the ledger; a no-op commit on a ledger-opened publisher feeds nothing; the same reads and writes. Durability 3a Task 5: on the held baseline before staging and DropRawSecrets, noteRawSecrets(rt.Host, m). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. Branch fix R1 P1-1: every failed manifest commit drops the publisher, stamps, preparation read and bucket knowledge; the next operation opens the bucket and repeats divergence checks before staging. No new root input or read site. Branch fix R1 P1-4: a CommitRecoveryReadError from the existing CAS-recovery GET wraps errEscrowUnreadable, so the launch refuses rather than using the later-launch write-failure fallback. No new read. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. Branch fix R2 P1-3: delegate the existing baseline, divergence and StageSealed operations to stageEscrowReads, shared with HA. Same bucket objects and reads; lease gating, uncertain-commit state drop, and typed CAS-recovery refusal retained. registry:Host@2078,registry:Host@2342,registry:Host@3307,registry:Host@3337,registry:Host@4494,registry:Host@574,whole:Route@2269,whole:Route@2497 01b4a5ff2f2dccc3f28d998a5e478e309e3eb9762f007a0fbee34501f2743d89
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. Branch fix R1 P1-3: select sealed escrow against Route.Incarnation before decrypting, restoring, minting or checking divergence: lower non-zero escrow is retired in the selected view, higher refuses, equal and zero-stamped retain behavior. Publication stamps the current lifetime atomically, drops prior-lifetime cached stamps, and never treats retired escrow as a committed successor. Same storage paths; historical objects retained. Branch fix R2: remove incarnation selection and stamping per Paul's ruling; restore pre-030ce7f9 hostname-scoped escrow behavior. No read added. Same-key hostname reuse can inherit predecessor secrets; a changed key refuses. Keep the uncertain-commit and CAS-recovery read-failure refusals. 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.stageEscrowReads legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=Branch fix R2 P1-3: shared HA and non-HA write-once funnel. Checks the existing conflict marker, decodes the committed baseline, reports raw secrets, calls escrowDivergence on all candidates before any StageSealed. Trio changes refuse before any env GET. Changed platform-minted env variables refuse; an envelope that cannot open under the key/binding refuses with the existing alert and best-effort durable marker; transient GET errors refuse without a marker. Same host manifest prefix, sealed env object and local conflict path. No new authority or root read target. registry:Host@206,registry:Host@383,whole:Route@437,whole:Route@598,whole:Route@716 f00a182229cbe7f895f91822d1a3b637589a0764d55b5c498feeec9e488a4018
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
@@ -118,18 +120,18 @@ internal/activator/paths.go ExecBackend.pathsAt legacy accepted-legacy accepted-
internal/host/escrow_loop.go escrowLoop legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: every activator.EscrowEvery (30 s) lists the registry and runs svc.EscrowSweep over the rows; logs failures and deferrals; returns with no registry or no Service; the agent as carlos (carlos-edge.service), no root caller whole:Route@426 498f5efdf374f9c35ca954f845507ce3c8db25e9b766f873c3acf23ec2f7cb05
internal/host/movesfiles.go claimEnvPresent legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5: new: whether the claim env file exists, without reading it: nested, instancefs.OpenBeneathOrAbsent beneath the instance directory (no link at any component; the descriptor closed at once); flat, os.Lstat of <data>/<host>.env (a link there counts as present, so it refuses). An undecidable answer is an error. Only feeds a refusal. file:Lstat@81 99e674efa8d1bf26a59304024912fcd5b5caf2e5d80274e8def7dbb75d9362b5
internal/host/schedule_wiring.go scheduleHostEscrowed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: scheduleHostHA renamed: reads the host's row (reg.Get) and asks svc.SecretsEscrowed (HA, or eligible for escrow) with a 10 s timeout; false with no registry or no row; for such a host scheduleToken only reads the existing env token ("" when none) and never mints (EnsureAdminToken skipped); the agent as carlos (carlos-edge.service), no root caller whole:Route@254,whole:Route@413 1a608f98d348d9183088ff4f04742c30467a116f0071358ce479e1dff5e20eeb
-internal/hostfiles/sealed.go ReadSealed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator. file:Open@898 7c2b887b6e0b45472fd8d1a63a2b78eb565c4e93c89cb329eeeaef429ab0b010
+internal/hostfiles/sealed.go ReadSealed legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 2: new. Reads one sealed platform item of a files manifest the caller already loaded: the object at exactly the key the entry names, through the existing fetch (checkEntry: origin admitted, key shape, sha256 and size verified), only for an entry marked sealed "v2". The "Open" the scanner sees is appconfig.Open, an in-memory AES-GCM decryption of the fetched bytes, not a file open: no filesystem path is opened, read or followed. It refuses a v1 envelope (appconfig.EnvelopeBound), and after opening under the caller-supplied key and (account, app) binding it checks the HMAC digest over account, app, host and item against the entry. Writes nothing. No production caller in this task; Tasks 3 and 4 call it from the activator. Branch fix R2 P1-3: wrap the existing appconfig.Open error as SealedOpenError, preserving error text and cause, so a decryption refusal leaves a conflict marker while a transient storage GET failure does not. Same fetch and envelope verification; no new read. file:Open@898 14437206baa72c952a8be716aa035b723f408384eaf6db56af16b554587e6a6d
internal/layout/inventory.go Inventory legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 1: new. One os.ReadDir of the host's inventory root, provision.InstanceDir(dataDir, host) nested or dataDir flat, after refusing a host that fails controlname.ValidHostShape and a layout that is neither flat nor nested; reads only the listing's names and types (DirEntry.IsDir), opens and follows nothing; flat ownership is the extras scan's own (hostEntries over knownHosts); each top-level name is classified by pubclass.Of, a pure function of the name. A missing directory is an empty inventory. No caller in this task; later tasks call it from the publisher. file:ReadDir@449 9662e465abb7f9c60e908952740384479009c9987c8a6ae65d98fb19cb3d4d7e
internal/host/movesfiles.go buildPrepared legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;census-ruling-moves-overcap-cut-236;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5 (parked path, CARLOS_MOVES_PHASE1 only): wantEnv refuses with pubclass.ErrSecretPath before anything is read or written; the env presence check for !wantEnv is os.Stat instead of os.ReadFile (the secret is no longer read into memory); hostfiles.RefuseSecretsAt over root.Open(".") (+file:Open, a descriptor of the os.Root it already opened, never a pathname) before NewPrepared; the walk checks pubclass.Of(...) == App before each Stage; the env file is never staged. Only refuses more, and reads less. file:Lstat@1275,file:Open@2772,file:OpenRoot@2377,file:Stat@1468,file:WalkDir@3263 75cf376b93c2f69f4c8d1997a0158795c7bcd6967a7742a18ca79822b8e27a2a
internal/activator/backend_exec.go ExecBackend.Acquire legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: after the unchanged AdmitConfig gate, the lease acquire moves into acquireClassified (hawake.go, a new unit): a legacy route or a non-HA host takes the same lease.Acquire as before and maps a held lease to errLeaseHeld as before (leaseError); an HA host goes through the containment admission and lease.AcquireHA. A successful acquire marks the host acquiredHere for the process (same-box recovery). The config gate is not weakened; the same three sites, no read added;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4 fix round 1: after a successful acquire, records the instance lease it hands out (escrow.noteLease, memory only), so the escrow can ask whether this box holds the host's lease; the same acquire, no read added; the agent as carlos (carlos-edge.service), no root caller registry:Host@1001,registry:Host@807,whole:Route@382,whole:Route@764 ff41146bbb0f1c3fac6a0f34f41540d7dbb036234f490841dca0e23d23b1c99c
-internal/activator/hafiles.go ExecBackend.newHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: builds a hostFiles publisher for rt (its instance paths from pathsFor(rt), rt.Host, the backend's registry, the 1 s platform and 15 min snapshot cadences); +registry:Host, +whole:Route; no I/O;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. registry:Host@179,whole:Route@128,whole:Route@234 66557a3afeb86cc98763321b922bc589e1a49f8cf6e940c81144c1a1c7852dc5
+internal/activator/hafiles.go ExecBackend.newHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: builds a hostFiles publisher for rt (its instance paths from pathsFor(rt), rt.Host, the backend's registry, the 1 s platform and 15 min snapshot cadences); +registry:Host, +whole:Route; no I/O;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: now also sets the publisher's sealer (sealerFor(rt); its error is returned and nothing is built) and its skip, pubclass.FilesDirSkip(Nested, rt.Host), a pure function of the name, so every tree pass publishes only App paths and never the trio raw. Still no I/O; the new +registry:Host and +whole:Route sites are the sealer's and the classifier's arguments. Durability 3a Task 5: also sets the publisher's noteHeld, a closure calling noteRawBaseline(host, pub) (the detector over the manifest the publisher holds, decoded from its own committed bytes); no I/O; the -registry:Host site is rt.Host read once into a local. Branch fix R2 P1-3: capture the route, paths and sealer in the HA publisher callback to the shared stageEscrowReads gate. No I/O added here. All HA passes read the same three bounded no-link local paths before invoking the callback; it refuses divergence or unreadable-key replacement before any StageSealed. registry:Host@179,whole:Route@128,whole:Route@234,whole:Route@463,whole:Route@478 32e71752391c434c6126276d9368be7d7eb87caa471ea23540c11e567954a6d2
internal/activator/hafiles.go ExecBackend.openHostFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: the entry's files publisher: refuses without a FilesStore or outside the nested layout, takes the one this wake's restore staged, else hostfiles.Open on <hibernate prefix>/files/0/ (one GET of the manifest from the hibernate bucket, the scanner's +file:Open); +registry:Host x2, +whole:Route x2; the manifest is written by the agents of the boxes that hold the host, through the same files store;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before hostfiles.Open, so a box without an escrow key refuses before it reads the manifest; newHostFiles's error is returned. The same manifest GET otherwise; the new +whole:Route site is sealerFor's argument. Opens nothing new. Durability 3a Task 5: after hostfiles.Open, noteRawBaseline(rt.Host, pub), the detector over the manifest just read (hostfiles.RawAfterSealed on the decoded baseline). Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. file:Open@521,registry:Host@342,registry:Host@569,registry:Host@636,whole:Route@198,whole:Route@469,whole:Route@673 34091031ddf1a2b90edfd3453ec197fa3ca6a5290b6b7d15d5a44b1028fc8c7a
internal/activator/hafiles.go ExecBackend.stageKeptFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: on a kept wake, reads the manifest baseline the release kept beside its local record (<db>.release.files.json via readFilesBaseline, capped at 32 MiB, O_NOFOLLOW, regular files only) and stages a publisher on it only when its revision (Gen, which carries the body's SHA-256) equals the files_gen in the lock's release marker; the file is on ground the tenant can write, and anything that does not match stages nothing, so the entry re-reads the manifest from the store; it never decides the keep; +registry:Host x4, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. The same baseline read; nothing new opened or read. Durability 3a Task 5: after the marker's gen matched, noteRawBaseline(rt.Host, pub) on the kept baseline. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. registry:Host@254,registry:Host@344,registry:Host@508,registry:Host@553,registry:Host@660,registry:Host@706,whole:Route@151,whole:Route@593 72b7b10bea4dc499e251ae498dd1ad56a4b966bed80f24106c86d6aab75ad3ec
internal/activator/hafiles.go ExecBackend.stageWakeFiles legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: opens a publisher on a manifest baseline the HA restore already holds (hostfiles.OpenBaseline, no read) and keeps it for the wake's entry; without a FilesStore it stages nothing; +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: newHostFiles now answers an error (no escrow key), which is logged and stages nothing, as an OpenBaseline failure already did. No read, as before. Durability 3a Task 5: after OpenBaseline, noteRawBaseline(rt.Host, pub) on the baseline the restore holds. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. The +registry:Host site is that call's argument. registry:Host@185,registry:Host@300,registry:Host@345,registry:Host@452,registry:Host@498,whole:Route@385 688df7afd563bc0828cec0cb5c2cd57405c4ce0e3a017c23df16af901cf54913
internal/activator/hasecrets.go ExecBackend.captureLaunchEnv legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: reads an HA launch's own env file and its rendered config env once, the way instanceEnvParts does: on the nested layout through instancefs.ReadBeneathLimit (1 MiB, no link followed), otherwise os.ReadFile (the +file:ReadFile site; an HA host is nested by its acquire's containment admission, so this arm is the flat layout's, where the files are in the agent's own data directory); an absent own file is an error, an absent config is not; parses env and key layer from those bytes; +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: the flat arm's os.ReadFile (-file:ReadFile) is gone: both layouts read the own env file and the rendered config env with instancefs.ReadBeneathLimit beneath the row's data directory (openat2, no symlink, regular files only, 1 MiB), so an escrowed flat row's capture never follows a link at <host>.env; an absent own file is an error, an absent config is not; the agent as carlos (carlos-edge.service), no root caller; only narrows a read whole:Route@98 223e1b2f98aea8bb39f65573bcff0e6d05bb8cd2f55cd43670ca8ba6f1d33299
internal/activator/hasecrets.go ExecBackend.ensureAdminTokenFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: the launch paths' admin-token producer: haMintGuard(ctx, rt), then ensureAdminToken on <dataDir>/<host>.env, beneath on the nested layout and by path otherwise, with that guard; +registry:Host, +whole:Route; a non-HA host's guard is nil and the producer is the one it used before;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: classifies the host once (haHostNow), and for a host that is not HA and is eligible for escrow first calls restoreEscrowIfMissing (a new unit on this card), then ensureAdminToken with mintGuardAs's guard; an HA host's path is as before; any other host's guard is nil as before; +whole:Route x3 (the row handed on); the agent as carlos (carlos-edge.service), no root caller Fix round 1: begins the launch's preparation (beginPrep) before the restore, and passes fresh false to the guard. registry:Host@257,registry:Host@386,whole:Route@136,whole:Route@237,whole:Route@308,whole:Route@447 581b4132ee9f3bbb900b5c467c02596502b0232575a8beacd198419469eb4e3c
internal/activator/hasecrets.go ExecBackend.haMintGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos, replacing haMintGate: nil for a host that is not HA; for an HA host a guard that, asked only from a producer's missing-secret branch, reads once whether the host's files manifest exists (haManifestFound) and refuses with ErrInstanceKeyDeferred while it does (or on a read error); it never reads the env; +whole:Route x2; only refuses;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: now only the HA arm of mintGuardFor: the same once-per-guard haManifestFound read and the same ErrInstanceKeyDeferred refusal, the name ignored; the HA classification moved to mintGuardFor (-whole:Route); only refuses whole:Route@220 7218a4d3a064c04bca0bdccec25c2934974b926a5af657a156cd0ca8498b586d
-internal/activator/hasecrets.go ExecBackend.haSecretsReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: before an HA host's launch, checks that env, the bytes the launch captured (captureLaunchEnv; a new parameter, final fix F2), has the SHA-256 of the committed manifest's env item (envAcknowledged, which now reads no file); else publishes the platform items (env, trio, wake state) through the wake's, the entry's or its own publisher (hostfiles.Open, the +file:Open site: one manifest GET) and checks again, so an env replaced after the capture is committed as other bytes and fails the launch; it no longer classifies the host itself (launchEnvLayer has); every error fails the launch; +file:Open, +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. file:Open@390,registry:Host@1187,registry:Host@120,registry:Host@438,whole:Route@294,whole:Route@559 4f4584786d3f90a54aa3ddc1c39ffed8a62fcfd593127f534bea787c3d9b7829
+internal/activator/hasecrets.go ExecBackend.haSecretsReady legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: before an HA host's launch, checks that env, the bytes the launch captured (captureLaunchEnv; a new parameter, final fix F2), has the SHA-256 of the committed manifest's env item (envAcknowledged, which now reads no file); else publishes the platform items (env, trio, wake state) through the wake's, the entry's or its own publisher (hostfiles.Open, the +file:Open site: one manifest GET) and checks again, so an env replaced after the capture is committed as other bytes and fails the launch; it no longer classifies the host itself (launchEnvLayer has); every error fails the launch; +file:Open, +registry:Host x3, +whole:Route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3: asks sealerFor before its own hostfiles.Open (a box without an escrow key fails the launch before any read), and newHostFiles's error fails the launch. envAcknowledged now compares the sealed env item's keyed digest (hostfiles.SealedAcknowledged, no read) instead of the raw env item's SHA-256. The publish it triggers stages the trio sealed: <host>.env, <host>/instance.key and <host>/report.token are each read with instancefs.ReadBeneathLimitOrAbsent beneath the instance directory (openat2, no symlink, regular files only, 1 MiB cap), the same reader the env already used, then sealed in memory; nothing else is opened. Branch fix R2 P1-3: every launch invokes PublishPlatformNow and the shared escrow gate even when the captured env is already acknowledged. A divergent trio or persisted conflict marker cannot bypass the gate. Unchanged publication remains request-free. Same local paths and manifest prefix; no new authority. file:Open@390,registry:Host@120,registry:Host@1236,registry:Host@438,whole:Route@294,whole:Route@559 af5c028a288dd480380c4cf658098373f938337517d7db33aeb8b2d08e489487
internal/activator/hasecrets.go ExecBackend.launchEnvLayer legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new (final fix F2), the agent as carlos: a launch's env and key layer: classifies the host (haHostNow; an error fails the launch), instanceEnvLayer unchanged for a non-HA host; for an HA host captureLaunchEnv once, haSecretsReady over those bytes, a test seam (haLaunchHooks.afterPublish, nil in production), and returns the env parsed from the captured bytes, never a later read; +registry:Host x3 (the error messages), +whole:Route x4;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: for a host that is not HA and is eligible for escrow, escrowedLaunchEnv (a new unit on this card) instead of instanceEnvLayer; the HA and other paths unchanged; +whole:Route x2; the agent as carlos (carlos-edge.service), no root caller registry:Host@245,registry:Host@499,registry:Host@644,whole:Route@154,whole:Route@294,whole:Route@335,whole:Route@371,whole:Route@408,whole:Route@549 35a5150b24c33e81e5d536bb072c62ab55fd583187d83293e644d3599496a99a
internal/activator/hawake.go ExecBackend.restoreFilesClean legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p1a;basis=new: restores the HA host's published files into a fresh <host>.restore directory beneath the instance data dir (instancefs, no link followed), renames it into place without replacing anything, writes the manifest's env item as <host>.env (instancefs.WriteAtomic, 0600) and imports the manifest's wake state into the registry (hostfiles.ImportWake, then the class for restoredReplication); the source is the host's files manifest in the hibernate bucket, written by the agents of the boxes that held the host; every failure fails the wake; +registry:Host, +whole:Route x2;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 3 (fix round 1: sealed precedence before any fetch): the restore into <host>.restore is now RestoreRootBaselineShadowed with sealedShadow(host), a pure function of the manifest already read and validated: a live raw instance.key or report.token entry whose sealed item the manifest holds is neither fetched nor written (so a missing or corrupt raw object cannot fail the wake, and a sealed item that does not open fails it with no raw fallback); every other entry is restored as before, and the baseline the wake's publisher continues from is the manifest as read. Then each sealed trio item the manifest holds (instance.key.sealed, report.token.sealed) is fetched and opened with hostfiles.ReadSealed (key, sha256, v2 envelope, binding and MAC checked) and written with instancefs.WriteAtomic (openat2 directory, no symlink, O_EXCL temp, rename, 0600) into the restore directory this function created, then that directory is synced; then the same no-replace rename. The env file comes from the sealed env item through ReadSealed when present, else from the raw env item as before, written as before. The source is still the host's files manifest in the hibernate bucket; the destinations are the same restore directory and env file; no new path is opened, followed or named from input; the sealer (sealerFor) is built only when a sealed item is present. Durability 3a Task 5: after RestoreRootBaselineShadowed, noteRawSecrets(host, rm) on the manifest just restored from. Reads only manifests this process already holds (no request, no file opened); calls the detector, which logs and calls ExecBackend.OnRawSecret; nothing else changes. Read sites unchanged. Durability 3a Task 5 fix round 1: the restore is RestoreRootBaselineObserved (the same read and restore as RestoreRootBaselineShadowed) with a checked callback, noteRawSecrets(host, m), run once the manifest is read and validated and before any entry is removed, fetched or written, so a restore that then fails still shows the detector the manifest; the later noteRawSecrets call is gone. No request, open or write added; read sites unchanged. registry:Host@97,whole:Route@1086,whole:Route@1586,whole:Route@200 ca4b8c70486f72a3bd7ede5d16c8f9fd22eee13f11d005597223a4f5ab20b405
internal/activator/paths.go ExecBackend.pathsFor legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: split in two: pathsFor classifies (Classify, unchanged) and hands the answer to pathsAt (new on this card), which holds the same body; the same paths for every row; the reads moved to pathsAt whole whole:Route@129,whole:Route@89 5801150c35fef058ce1f8e7c9f334a7a89e3441fe0f63fb451f4804282e90535
@@ -143,8 +145,8 @@ internal/activator/paths.go ExecBackend.pathsFor legacy accepted-legacy accepted
@removed internal/host/movesfiles.go readClaimEnvFile H3 census-ruling-durability-3a-escrow;absent;basis=deleted: declaration and sites absent from the tree
@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 ee7151ccf105be64f7865bb723d20a1a60b454d6275a81f70c95cb3b86d9c8ff
+@coverage internal/activator 7a939c42f169fff3fdb3b3d98665d3d20d8ed935f5d19bc203e59c39a20c2e8a
@coverage internal/host 941b090a234199926a9f64c927657034c3b5fb17dea1f5a18716cfe2294f55b1
-@coverage internal/hostfiles 166a3267759ae3d1e417aa90d50f64b73c79dca0f37cb55e069bfd54282a782f
+@coverage internal/hostfiles cbcc79ea1d27809889e4f6676b0b154ac61f842b9bb6d2ecfa6aeaf975f05b5f
@coverage internal/layout f845fa728b0935279454d8b01023c5d6dae1c985061a41229cf0686e829f5c12
@coverage internal/layout/pubclass 6515ba31b1848139c9da066a6c65b5583c39a92cb77621773d0d11d9cde24e24