carlos / platform Public

fix(escrow): recheck write-once after an uncertain commit

Discard the publisher and cached bucket knowledge after failed commits. An applied PUT with a lost reply must be read and checked before any changed secret is staged again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev cb26724cc326b1cdbcdac22ea6f206aa71c833d9 parent cfe3122
7 files changed, +96 −13
  • docs/superpowers/notes/census-durability-3a-escrow-claims.md +1 −1
  • docs/superpowers/notes/census-proposal-durability-3a-escrow.md +1 −1
  • internal/activator/escrow.go +8 −6
  • internal/activator/escrow_branchfix_test.go +71 −0
  • internal/activator/escrow_known_guard_test.go +11 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv +3 −3

Intent

Human

<task-notification> <task-id>bwocfk3jb</task-id> <tool-use-id>toolu_01JfpwVYnY8hbiAc6jkxuBiz</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/aab63774-dfe6-44a4-9cd9-230e6f4c3d13/tasks/bwocfk3jb.output</output-file> <status>completed</status> <summary>Background command "Run the Astra census review" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>bsk1yh6o6</task-id> <tool-use-id>toolu_01KC1ZrDuYivZkaMCL5JWTeZ</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/aab63774-dfe6-44a4-9cd9-230e6f4c3d13/tasks/bsk1yh6o6.output</output-file> <status>completed</status> <summary>Background command "Run the whole-branch Astra review" completed (exit code 0)</summary> </task-notification>

diff --git a/docs/superpowers/notes/census-durability-3a-escrow-claims.md b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
index 7f94619c8..fd79395d0 100644
--- a/docs/superpowers/notes/census-durability-3a-escrow-claims.md
+++ b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
@@ -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.
+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.
internal/activator/escrow.go:ExecBackend.restoreEscrowIfMissing durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise.
internal/activator/escrow.go:ExecBackend.sweepPublish durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert
internal/activator/escrow.go:Service.EscrowSweep durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one
diff --git a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
index 895737301..da72f8242 100644
--- a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
+++ b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
@@ -117,6 +117,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` → `86911a5db46c2d63c9240c2c1bd7ae64428af26c041db06447078339e6c62d15`.
+Seal: `67b54b219f990c3dcfe32c6ffb11a80a4ca3898aec060fe9f4450e21098af714` → `92b173640c857f6dcbd78c80c6c6004d65fcbfb6f6f5d707e2badb1a782d0dd3`.
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 94f392a95..4cd578ccc 100644
--- a/internal/activator/escrow.go
+++ b/internal/activator/escrow.go
@@ -229,7 +229,11 @@ func (k *escrowBook) install(st *escrowState, pub *hostfiles.Publisher, seal *ho
// drop forgets st's publisher and stamps; the host's next operation opens
// from the bucket.
func (k *escrowBook) drop(st *escrowState) {
- k.with(func() { st.pub, st.stamps, st.fromBucket = nil, nil, true })
+ k.with(func() {
+ st.pub, st.stamps, st.fromBucket = nil, nil, true
+ st.known = nil
+ st.prep = nil
+ })
}
func (k *escrowBook) sweepCap() int {
@@ -833,11 +837,9 @@ func (b *ExecBackend) publishEscrowLocked(ctx context.Context, rt registry.Route
return out, errEscrowNoLease
}
if _, err := pub.Commit(ctx); err != nil {
- if errors.Is(err, hostfiles.ErrSuperseded) {
- b.escrow.drop(st)
- }
- // The stamps are not kept: the next publish reads the files again
- // and its commit retries what this one staged.
+ // A failed PUT may already have landed. Never retry staged bytes
+ // against the old baseline: reopen the bucket and check divergence.
+ b.escrow.drop(st)
return out, err
}
after := pub.Baseline()
diff --git a/internal/activator/escrow_branchfix_test.go b/internal/activator/escrow_branchfix_test.go
new file mode 100644
index 000000000..154b4d45e
--- /dev/null
+++ b/internal/activator/escrow_branchfix_test.go
@@ -0,0 +1,71 @@
+package activator
+
+import (
+ "context"
+ "errors"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/hostfiles"
+ "github.com/carlosframework/platform/internal/release"
+)
+
+// The manifest PUT reaches storage, but its successful reply never reaches
+// the publisher. The next attempt must judge the bytes that actually landed.
+type escrowLostReply struct {
+ release.Store
+ manifest string
+ lose bool
+}
+
+func (s *escrowLostReply) Put(ctx context.Context, key string, body []byte, match string) (string, error) {
+ etag, err := s.Store.Put(ctx, key, body, match)
+ if err == nil && key == s.manifest && s.lose {
+ s.lose = false
+ return "", errors.New("applied PUT response lost")
+ }
+ return etag, err
+}
+
+func TestEscrowLostReplyRechecksWriteOnce(t *testing.T) {
+ for _, item := range []string{"instance.key", "report.token", hostfiles.SealedEnvItem} {
+ t.Run(item, func(t *testing.T) {
+ b, rt := escrowBackend(t, escrowHost)
+ writeEnv(t, b, rt, envA)
+ writeFiles(t, b, rt, map[string]string{})
+ trio := filepath.Join(b.pathsFor(rt).dataDir, rt.Host, item)
+ if item != hostfiles.SealedEnvItem {
+ if err := os.WriteFile(trio, []byte("first-value"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ }
+ store := &escrowLostReply{Store: b.FilesStore, manifest: hostfiles.ManifestKey(b.filesPrefix(rt.Host)), lose: true}
+ b.FilesStore = store
+ if _, err := b.publishEscrow(context.Background(), rt, nil); err == nil || !strings.Contains(err.Error(), "response lost") {
+ t.Fatalf("first PUT: %v", err)
+ }
+ if item == hostfiles.SealedEnvItem {
+ writeEnv(t, b, rt, "CARLOS_ADMIN_TOKEN=changed\nCARLOS_INSTANCE_KEY=changed\n")
+ } else if err := os.WriteFile(trio, []byte("changed"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ _, err := b.launchEnvForTest(rt)
+ if err == nil || !strings.Contains(err.Error(), "ALERT: ") || !exists(escrowConflictPath(b.DataDir, rt.Host)) {
+ t.Errorf("retry must refuse with alert and marker: %v", err)
+ }
+ want := "first-value"
+ if item == hostfiles.SealedEnvItem {
+ want = envA
+ }
+ sealedName := item
+ if item != hostfiles.SealedEnvItem {
+ sealedName += ".sealed"
+ }
+ if got := sealedItem(t, b, rt, sealedName); got != want {
+ t.Errorf("escrow = %q, want first value %q", got, want)
+ }
+ })
+ }
+}
diff --git a/internal/activator/escrow_known_guard_test.go b/internal/activator/escrow_known_guard_test.go
index 49fa237bb..dfd24c4dc 100644
--- a/internal/activator/escrow_known_guard_test.go
+++ b/internal/activator/escrow_known_guard_test.go
@@ -84,7 +84,13 @@ func knownViolations(files []*ast.File, callers []string) []string {
ast.Inspect(n, func(n ast.Node) bool {
switch x := n.(type) {
case *ast.AssignStmt:
- for _, l := range x.Lhs {
+ for i, l := range x.Lhs {
+ // Dropping uncertain state may forget knowledge, never supply it.
+ if owner == "escrowBook.drop" && len(x.Lhs) == len(x.Rhs) {
+ if id, ok := x.Rhs[i].(*ast.Ident); ok && id.Name == "nil" {
+ continue
+ }
+ }
if isKnown(l) && owner != knownWriter {
bad = append(bad, owner+": assigns "+knownField+" outside "+knownWriter)
}
@@ -202,6 +208,10 @@ type escrowState struct{ known *manifest }
type ExecBackend struct{}
+type escrowBook struct{}
+
+func (k *escrowBook) drop(st *escrowState) { st.known = nil }
+
func (b *ExecBackend) learnBucket(st *escrowState, m manifest) { st.known = &m }
func (b *ExecBackend) bucketManifest(st *escrowState) { b.learnBucket(st, manifest{}) }
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 9118f8fc5..baf203821 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 86911a5db46c2d63c9240c2c1bd7ae64428af26c041db06447078339e6c62d15
+plan14-root-reads-durability-3a-escrow.tsv 92b173640c857f6dcbd78c80c6c6004d65fcbfb6f6f5d707e2badb1a782d0dd3
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 ea55dcc77..355fb6cec 100644
--- a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
+++ b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
@@ -32,7 +32,7 @@
@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 80ebc4b3a30231d087c455e558c8098945174635b60b3feabd9942803ed9447d 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. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5151,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 4a9dc6fc95d3e03e9d26de54c0bb05ee264775e7b113f3e1b6394da86afb82ad
+@legacy 4a141c323197e6de57e0f1929adfefd0ae05f117bf6f71522d9a4030c2ce4165 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. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5119,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 fb5b6aa589c2302f5a0ef7387f1d710d75653fad44c14db4db8d6dcdc5bc0f5e
@legacy b053870b57f516eddc82775c8a662b701c49173c2171cad2ef2d27cb7cde688a internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
@legacy 7d7ae676fe3d33d027489b397a804eaa184295667ad039688aed3757f662ab9d internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
@legacy c89cfff20022faa5af3e07251a620b1b63e0b42f350483a6efec4162efdd1cca internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
@@ -99,7 +99,7 @@ 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. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5151,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 4a9dc6fc95d3e03e9d26de54c0bb05ee264775e7b113f3e1b6394da86afb82ad
+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. registry:Host@2078,registry:Host@2342,registry:Host@2979,registry:Host@4079,registry:Host@4109,registry:Host@5119,registry:Host@574,whole:Route@2269,whole:Route@3036,whole:Route@3155 fb5b6aa589c2302f5a0ef7387f1d710d75653fad44c14db4db8d6dcdc5bc0f5e
internal/activator/escrow.go ExecBackend.restoreEscrowIfMissing legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: checks each escrowed file with instancefs.OpenBeneathOrAbsent beneath the row's data directory; when one is absent, hostfiles.Open of the host's manifest, ReadSealed of each missing item, and writeIfAbsent (instancefs.WriteAtomic of a temp, then RenameBetweenNoReplace, so a present file is never replaced; EnsureDirBeneath for the files directory, 0700); on a box that is not ready it refuses unless the ledger shows the host escrowed and the env file is here; the agent as carlos (carlos-edge.service), no root caller Fix round 0 (controller readiness ruling): with no files store it does nothing (logged once); with no sealing key it restores nothing: a ledger here and an env file here go on, otherwise keylessEscrowed refuses when the bucket holds an escrow and goes on as before 3a when it holds none. Fix round 1: the conflict marker first, then the mode (P2-5): no files store, nothing; no key, the preparation's keyless read before any file check. With a key, each trio file is checked with OpenBeneathOrAbsent (a link or FIFO is not missing); the bucket is read (bucketManifest, the preparation's one GET) only for a missing env file, or a missing trio file the ledger says was escrowed, or with no ledger once per agent start (P2-6); the same writes. Fix round 2: the ledger is read through ledgerFor, and while it is untrusted (its write and the stale ledger's removal both failed) a missing trio file always reads the bucket; the same reads and writes. Fix round 3: the ledger no longer decides a restore: a missing trio file reads the bucket unless this process itself saw the bucket's manifest for the host (its read or its commit, escrowState.known) without the item; the same reads and writes otherwise. registry:Host@1027,registry:Host@1145,registry:Host@138,registry:Host@1853,registry:Host@2721,registry:Host@571,registry:Host@652,registry:Host@698,registry:Host@801,whole:Route@1654,whole:Route@1750,whole:Route@200,whole:Route@241,whole:Route@314,whole:Route@360,whole:Route@477 335cb066c95f026fba5e99df8f86252ee6a50b48f799d7b1042460c2ec188642
internal/activator/escrow.go ExecBackend.sweepPublish legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: publishEscrowAt, and on a supersession escrowReread and one more publish; a second one is the alert registry:Host@404,whole:Route@142,whole:Route@232,whole:Route@312 71bfee868a2ca8e3371cfc3c628b6ab5d8730ca48fcd099e7932049fe1e12a69
internal/activator/escrow.go Service.EscrowSweep legacy accepted-legacy accepted-legacy;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: new: the backend's EscrowSweep, nothing for a backend without one whole:Route@184 8ed0ea62a9807b7c43b3576d01f096bfe366c21bcc3be040831a3f1b80d1b123
@@ -143,7 +143,7 @@ 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 0e6b2ebd7d38fd1b015a34b3b88d291271a70cb48258b67ef544a05fc788114e
+@coverage internal/activator 095e01249c36501ed819dcbb162624ab9dd1495bc170467d1fedb9ef46fecec5
@coverage internal/host 3c8a9faa2e6abdc098bdb31624032e8b44da38e4e08b1e099c3bc969404e36aa
@coverage internal/hostfiles d79efb83d55025d18980240619281b671b8b928d72461aaefda686fbfa3ae68c
@coverage internal/layout f845fa728b0935279454d8b01023c5d6dae1c985061a41229cf0686e829f5c12