carlos / platform Public

Merge origin/main into durability-3a-escrow

Brings in 00bf5b8c (fleet set-aside EXDEV fix). The only conflict was
the root-read chain: main's fix-set-aside-exdev line is kept and this
branch's overlay stays last, re-proposed (runAgent claim names the
merge). Seal 03a92257.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev e6cb5af88b92c7d49a97002843587cc324447528 parent ff83deeparent 00bf5b8
12 files changed, +298 −12
  • docs/superpowers/notes/census-durability-3a-escrow-claims.md +1 −1
  • docs/superpowers/notes/census-proposal-durability-3a-escrow.md +3 −3
  • docs/superpowers/notes/census-proposal-fix-set-aside-exdev.md +23 −0
  • internal/activator/backend_exec.go +7 −0
  • internal/activator/startrule.go +33 −3
  • internal/activator/startrule_bind_linux_test.go +137 −0
  • internal/host/agent.go +3 −0
  • internal/host/claimproduction.go +2 −1
  • internal/host/rawinstancedir_wiring_test.go +76 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +2 −1
  • internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv +3 −3
  • internal/provision/testdata/plan14-root-reads-fix-set-aside-exdev.tsv +8 −0

CI failed — run details

Intent

Attributed to this commit: 27.6 g CO₂e (3,352,420 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 9a85f1198..d73a74002 100644
--- a/docs/superpowers/notes/census-durability-3a-escrow-claims.md
+++ b/docs/superpowers/notes/census-durability-3a-escrow-claims.md
@@ -4,7 +4,7 @@
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. 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/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. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged.
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. 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.
diff --git a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
index 364dbf32f..7e2314841 100644
--- a/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
+++ b/docs/superpowers/notes/census-proposal-durability-3a-escrow.md
@@ -10,7 +10,7 @@ Ruling `census-ruling-durability-3a-escrow`. The independent reviewer approves o
| `internal/activator/instancekey.go` `ExecBackend.BackfillInstanceKey` | body | unchanged (2) | durability 3a Task 4: comment only (the escrowed host's mint decision inside ensureInstanceKeyAt); the body is unchanged |
| `internal/activator/instancekey.go` `ExecBackend.ensureInstanceKeyAt` | body | unchanged (4) | durability 3a Task 4: asks mintGuardFor(ctx, rt) (was haMintGuard): an HA host's guard as before; an eligible host's escrowMintGuard, which on a ready box reads the bucket manifest and the sealed env item when a mint is next and refuses while the escrow holds the key, and on a box that is not ready refuses every mint; nil for any other host, which mints as before. The replica and fenced/conflict refusals are unchanged; only adds refusals Fix round 1: asks mintGuardWith(ctx, rt, !create): a launch's ensure shares its preparation's escrow read, the backfill's reads the bucket afresh; only refuses. |
| `internal/activator/instancekey.go` `ensureInstanceKey` | body | unchanged (1) | durability 3a Task 4: the guard is asked with InstanceKeyVar, at the same point (the locked read found no key and the bucket allowed a mint); create-only, fail-closed and defer-on-unknown unchanged; the same one site; only adds a refusal |
-| `internal/host/agent.go` `runAgent` | body | unchanged (6) | 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/host/agent.go` `runAgent` | body | unchanged (6) | 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. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged. |
| `internal/host/claimfilesseed_stage.go` `filesSeedOperation.stage` | body | unchanged (2) | Durability 3a Task 5 (parked path, host claims with origins only): hostfiles.RefuseSecretsAt over the root it opened, before hostfiles.Seed: any path the classifier does not call App refuses the seed before its first write, with pubclass.ErrSecretPath. No read added; the walk is the descriptor walk Seed itself makes. Task 7 fix round 1: bind the descriptor returned through work.With once as dir; stat, RefuseSecretsAt and Seed use that same descriptor. No path, read, authority, refusal or production behavior changes; the account/host identity and descriptor lifetime are unchanged. 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/host/movesfiles.go` `movesFiles.Establish` | body | unchanged (0) | Durability 3a Task 5 (parked path, host claims only): a present env file (claimEnvPresent: nested via instancefs.OpenBeneathOrAbsent, flat via Lstat; the bytes are never read) refuses with pubclass.ErrSecretPath before any bucket write; the env bytes are no longer read (readClaimEnvFile deleted); with no env file the establishment proceeds and stages StagePlatformDelete(EnvItem), so a raw env item a baseline holds is dropped, never carried into the new generation; openPrepared no longer takes the env and establishedOver no longer GETs an env object. Only refuses more, and reads less. |
| `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. |
@@ -51,7 +51,7 @@ Recorded dispositions, which each change must still satisfy:
- `internal/activator/instancekey.go` `ExecBackend.BackfillInstanceKey`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: back to main's body bar a comment: it calls ensureInstanceKeyAt as before, and an HA host's mint decision now lives inside that producer (haMintGuard, final fix F2); the agent's backfill skips HA hosts before this (instancekeys.go); the one +whole:Route of the first proposal is gone; no read added
- `internal/activator/instancekey.go` `ExecBackend.ensureInstanceKeyAt`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: after the unchanged replica and fenced/conflict checks, asks haMintGuard(ctx, rt) (+whole:Route) and hands the guard to ensureInstanceKey; a classification error fails with InstanceKeyFailed; a non-HA host gets a nil guard and mints exactly as before; only adds a refusal
- `internal/activator/instancekey.go` `ensureInstanceKey`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more parameter, guard (nil for every caller but ensureInstanceKeyAt on an HA host), asked once the locked read finds no key and the bucket allows a mint, before anything is minted; its refusal returns InstanceKeyFailed with nothing written. Create-only, fail-closed and defer-on-unknown are unchanged; the one site unchanged, no read added; only adds a refusal
-- `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6)
+- `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites
- `internal/host/claimfilesseed_stage.go` `filesSeedOperation.stage`: authority, task C,J4. Basis: rev3=PROPOSED-seed; fresh private provider, real admitted tuple and origins; guarded safe source descriptor and wake snapshot; create conflicts compare bounded bytes at exact current version before commit
- `internal/host/movesfiles.go` `movesFiles.Establish`: authority, task C,J4. Basis: rev3=PROPOSED-p3;run=12;basis=agent files preparation; retains seed admitted-writer and ordinary origin proof with one C8 commit; H3 is inventory bookkeeping, C owns the enabled effect
- `internal/hostfiles/restore.go` `Restore`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=merge-ruling-2;basis=Restore delegates to shared descriptor-root implementation; generic payload restoration remains legacy.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: passes nil for restore's new baseline argument; the one site unchanged, nothing else changed
@@ -122,6 +122,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` → `0812141114655728c5f7e4204ebe6f41fbf320e256dd68881b534ffe614353df`.
+Seal: `f9d3016cc6803338f9db19311f3f598e20c37c8a19e111a3dabf4741dabe1b19` → `03a92257beb9b8aac421559e247d191bd69f28a0b26243397a1344a90d59fc2a`.
Overlay: `internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/notes/census-proposal-fix-set-aside-exdev.md b/docs/superpowers/notes/census-proposal-fix-set-aside-exdev.md
new file mode 100644
index 000000000..11a6bbd33
--- /dev/null
+++ b/docs/superpowers/notes/census-proposal-fix-set-aside-exdev.md
@@ -0,0 +1,23 @@
+# Census approval: fix-set-aside-exdev
+
+Ruling `census-ruling-fix-set-aside-exdev`. The independent reviewer approves or rejects every change below, 1 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/host/agent.go` `runAgent` | body | unchanged (6) | set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites |
+
+Envelopes re-pinned: `internal/activator`, `internal/host`.
+
+Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner.
+
+Recorded dispositions, which each change must still satisfy:
+
+- `internal/host/agent.go` `runAgent`: authority, task B,C,D,F. Basis: rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6)
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/activator/startrule.go:ExecBackend.setAsideSource`: reads +file:Lstat ×2; written legacy, accepted-legacy, frozen
+
+Seal: `67b54b219f990c3dcfe32c6ffb11a80a4ca3898aec060fe9f4450e21098af714` → `f9d3016cc6803338f9db19311f3f598e20c37c8a19e111a3dabf4741dabe1b19`.
+
+Overlay: `internal/provision/testdata/plan14-root-reads-fix-set-aside-exdev.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/backend_exec.go b/internal/activator/backend_exec.go
index babefdc68..b05965ba8 100644
--- a/internal/activator/backend_exec.go
+++ b/internal/activator/backend_exec.go
@@ -94,6 +94,13 @@ type ExecBackend struct {
// DataDir holds each instance's DB and env files (<host>.db, <host>.env,
// <host>-sidecar.env) — /data in production.
DataDir string
+ // RawInstanceDir, when set, names a host's raw instance directory
+ // (layout.RawInstanceDir, which this package cannot import), the one
+ // that /data/instances/<id> is a bind mount of on the nested layout.
+ // The start rule's set-aside moves a copy out through it, because a
+ // rename through the bind answers EXDEV (setAsideSource). Nil keeps
+ // every move on the instance directory itself.
+ RawInstanceDir func(dataDir, host string) string
// Materialize, when non-nil, stages a binary and points the host's live
// symlink at it via an external mechanism instead of the backend doing
// filesystem work itself — Eleven needed this because its router ran
diff --git a/internal/activator/startrule.go b/internal/activator/startrule.go
index 3090e793f..3f746ead5 100644
--- a/internal/activator/startrule.go
+++ b/internal/activator/startrule.go
@@ -15,7 +15,9 @@ package activator
//
// A local copy under any other assignment, or under none, is SET ASIDE,
// NEVER DELETED: moved whole into <DataDir>/.superseded/<host>/<unix
-// nanos>/ (built as <unix nanos>.partial and renamed when complete). A
+// nanos>/ (built as <unix nanos>.partial and renamed when complete; on the
+// nested layout the move goes through the raw instance directory, see
+// setAsideSource). A
// set-aside copy, complete or partial, stays on disk as the standing
// reason to refuse an empty start, so a second wake and an agent restart
// refuse again. Nothing in this package deletes from .superseded: that is
@@ -217,6 +219,33 @@ func (b *ExecBackend) reconcileAssignment(rt registry.Route, dbPath string) erro
return nil
}
+// setAsideSource is the directory the set-aside moves a local copy out
+// of. On the nested layout the instance directory is reached through a
+// nosymfollow bind mount of the raw instance directory, and rename(2)
+// refuses to cross mount points even within one filesystem (EXDEV), so a
+// move from it into <DataDir>/.superseded can never succeed (found on a
+// dev fleet box, v0.33.0: every wake of an unmarked copy was refused).
+// When b.RawInstanceDir names a raw directory that is the same directory
+// as dir, the copy moves out through it, which shares .superseded's
+// mount. Anything else (the flat layout, no raw directory, a test's plain
+// directory) moves from dir as before. The renames open both paths with
+// no symlink resolution, as before.
+func (b *ExecBackend) setAsideSource(host, dir string) string {
+ if b.RawInstanceDir == nil {
+ return dir
+ }
+ raw := b.RawInstanceDir(b.DataDir, host)
+ if raw == "" || raw == dir {
+ return dir
+ }
+ viaBind, errB := os.Lstat(dir)
+ viaRaw, errR := os.Lstat(raw)
+ if errB != nil || errR != nil || !viaBind.IsDir() || !viaRaw.IsDir() || !os.SameFile(viaBind, viaRaw) {
+ return dir
+ }
+ return raw
+}
+
// supersede moves names from dir into a new set-aside entry for host and
// returns the entry's final path. On a failure part way, what has moved
// stays in the .partial directory, whose path the error names.
@@ -239,6 +268,7 @@ func (b *ExecBackend) supersede(host, dir string, names []string) (string, error
}
root := filepath.Dir(hostDir)
dataRoot := filepath.Dir(root)
+ src := b.setAsideSource(host, dir)
if _, err := instancefs.EnsureDirBeneath(dataRoot, supersededDirName, 0o700); err != nil {
return "", err
}
@@ -271,10 +301,10 @@ func (b *ExecBackend) supersede(host, dir string, names []string) (string, error
return partial, fmt.Errorf("sync %s: %w", hostDir, err)
}
for _, n := range names {
- if err := setAsideRename(dir, n, partial, n); err != nil {
+ if err := setAsideRename(src, n, partial, n); err != nil {
return partial, fmt.Errorf("interrupted with part of it at %s: %w", partial, err)
}
- for _, d := range []string{dir, partial} {
+ for _, d := range []string{src, partial} {
if err := durableSync(d); err != nil {
return partial, fmt.Errorf("interrupted with part of it at %s: sync %s: %w", partial, d, err)
}
diff --git a/internal/activator/startrule_bind_linux_test.go b/internal/activator/startrule_bind_linux_test.go
new file mode 100644
index 000000000..587ae4900
--- /dev/null
+++ b/internal/activator/startrule_bind_linux_test.go
@@ -0,0 +1,137 @@
+//go:build linux
+
+package activator
+
+import (
+ "context"
+ "errors"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "syscall"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// bindChildEnv marks the re-executed test binary that runs inside its own
+// user and mount namespace, where it may bind-mount without privilege.
+const bindChildEnv = "CARLOS_TEST_SETASIDE_BIND_CHILD"
+
+// bindSkipPrefix is what the child prints when this kernel will not let
+// it build the bind mount, so the parent skips rather than fails.
+const bindSkipPrefix = "SKIP-BIND: "
+
+// TestSetAsideCrossesTheNestedBindMount sets aside an unmarked copy on the
+// nested layout as a box has it: <DataDir>/instances is a bind mount of
+// <DataDir>/.instances, so rename(2) from an instance directory into
+// <DataDir>/.superseded fails with EXDEV. v0.33.0 moved through the bind
+// and refused every wake of shop and railsdemo on a dev fleet box. The
+// test runs the real Restore in a user and mount namespace holding that
+// bind, checks first that a plain rename across it does fail with EXDEV,
+// and then that the copy is set aside whole and a replica restored.
+func TestSetAsideCrossesTheNestedBindMount(t *testing.T) {
+ if os.Getenv(bindChildEnv) == "1" {
+ setAsideUnderBind(t)
+ return
+ }
+ self, err := os.Executable()
+ if err != nil {
+ t.Fatal(err)
+ }
+ // The child dies with the parent's deadline, so a hang in it can never
+ // outlive the test run on a CI worker.
+ ctx := context.Background()
+ if dl, ok := t.Deadline(); ok {
+ var cancel context.CancelFunc
+ ctx, cancel = context.WithDeadline(ctx, dl)
+ defer cancel()
+ }
+ cmd := exec.CommandContext(ctx, self, "-test.run=^TestSetAsideCrossesTheNestedBindMount$", "-test.count=1", "-test.v")
+ cmd.Env = append(os.Environ(), bindChildEnv+"=1")
+ cmd.SysProcAttr = &syscall.SysProcAttr{
+ Cloneflags: syscall.CLONE_NEWUSER | syscall.CLONE_NEWNS,
+ UidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getuid(), Size: 1}},
+ GidMappings: []syscall.SysProcIDMap{{ContainerID: 0, HostID: os.Getgid(), Size: 1}},
+ Pdeathsig: syscall.SIGKILL,
+ }
+ out, err := cmd.CombinedOutput()
+ if i := strings.Index(string(out), bindSkipPrefix); i >= 0 {
+ t.Skipf("no bind mount in an unprivileged namespace here: %s", strings.TrimSpace(string(out[i+len(bindSkipPrefix):])))
+ }
+ if err != nil {
+ var ee *exec.ExitError
+ if !errors.As(err, &ee) {
+ t.Skipf("no unprivileged user and mount namespace here: %v", err)
+ }
+ t.Fatalf("set-aside under the bind failed: %v\n%s", err, out)
+ }
+ if !strings.Contains(string(out), "--- PASS: TestSetAsideCrossesTheNestedBindMount") {
+ t.Fatalf("the child did not run the test:\n%s", out)
+ }
+}
+
+// setAsideUnderBind is the child's half: it builds the box's bind, then
+// drives Restore on a labelled row whose copy has no marker.
+func setAsideUnderBind(t *testing.T) {
+ skip := func(format string, args ...any) {
+ t.Logf(bindSkipPrefix+format, args...)
+ t.SkipNow()
+ }
+ // A mount made here must not propagate anywhere.
+ if err := syscall.Mount("", "/", "", syscall.MS_REC|syscall.MS_PRIVATE, ""); err != nil {
+ skip("make / private: %v", err)
+ }
+ b := testExecBackend(t)
+ // What the agent wires in production (layout.RawInstanceDir).
+ b.RawInstanceDir = func(dataDir, host string) string {
+ return filepath.Join(dataDir, ".instances", provision.InstanceID(host))
+ }
+ raw := filepath.Join(b.DataDir, ".instances")
+ bind := filepath.Join(b.DataDir, "instances")
+ for _, d := range []string{raw, bind} {
+ if err := os.Mkdir(d, 0o700); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := syscall.Mount(raw, bind, "", syscall.MS_BIND, ""); err != nil {
+ skip("bind %s on %s: %v", raw, bind, err)
+ }
+ t.Cleanup(func() { _ = syscall.Unmount(bind, syscall.MNT_DETACH) })
+
+ instDir := provision.InstanceDir(b.DataDir, ruleHost)
+ if err := os.Mkdir(instDir, 0o700); err != nil {
+ t.Fatal(err)
+ }
+ // The condition the box had: a rename out through the bind is EXDEV.
+ probe := filepath.Join(instDir, "probe")
+ if err := os.WriteFile(probe, nil, 0o600); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.Rename(probe, filepath.Join(b.DataDir, "probe")); !errors.Is(err, syscall.EXDEV) {
+ t.Fatalf("rename across the bind = %v; want EXDEV, or this test reproduces nothing", err)
+ }
+ if err := os.Remove(probe); err != nil {
+ t.Fatal(err)
+ }
+
+ rt := registry.Route{Host: ruleHost, Kind: "instance", Hibernate: true,
+ Socket: "/tmp/nope.sock", DBPath: filepath.Join(instDir, ruleHost+".db"),
+ Assigned: assignA}
+ want := localCopy(t, rt.DBPath, "")
+ restores := replicaCalls(t, true)
+
+ fresh, err := b.Restore(context.Background(), rt)
+ if err != nil || fresh {
+ t.Fatalf("fresh %v err %v; want the copy set aside and a replica restored", fresh, err)
+ }
+ if *restores != 1 {
+ t.Fatalf("restores = %d; want 1", *restores)
+ }
+ assertSetAside(t, b, rt.Host, want)
+ if got, ok := markerAt(t, rt.DBPath); !ok || got != assignA {
+ t.Fatalf("marker = %q (present %v); want %q after the restore", got, ok, assignA)
+ }
+}
diff --git a/internal/host/agent.go b/internal/host/agent.go
index 31319e5af..ff53dc0fb 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -440,6 +440,9 @@ func runAgent(args []string, buildClaims ClaimFactory) {
Cache: cache,
Materialize: materializeHook(reg, dd),
Cgroups: cgm,
+ // The start rule's set-aside moves a copy out through the raw
+ // directory: a rename through the nested bind answers EXDEV.
+ RawInstanceDir: layout.RawInstanceDir,
// The memory tier for each spawned child's cgroup, read off the
// staged manifest of the route's live version (memory-pressure
// spec §2.3): 512M, or 1G for a family that declares children.
diff --git a/internal/host/claimproduction.go b/internal/host/claimproduction.go
index 1569d66b7..03a0ab129 100644
--- a/internal/host/claimproduction.go
+++ b/internal/host/claimproduction.go
@@ -25,6 +25,7 @@ import (
"github.com/carlosframework/platform/internal/hostguard"
"github.com/carlosframework/platform/internal/hostops"
"github.com/carlosframework/platform/internal/hostwrite"
+ "github.com/carlosframework/platform/internal/layout"
"github.com/carlosframework/platform/internal/lease"
"github.com/carlosframework/platform/internal/moves"
"github.com/carlosframework/platform/internal/park"
@@ -245,7 +246,7 @@ func (ProductionClaimOwnerProvider) OpenClaimOwners(ctx context.Context, store r
// could mint before the configuration was delivered; the agent's backend
// is wired from the same pair.
func claimExecBackend(r ClaimRuntimeResources, keys instanceKeyReaders) *activator.ExecBackend {
- eb := &activator.ExecBackend{DataDir: r.DataDir, OptDir: r.OptDir, Cgroups: r.Manager}
+ eb := &activator.ExecBackend{DataDir: r.DataDir, OptDir: r.OptDir, Cgroups: r.Manager, RawInstanceDir: layout.RawInstanceDir}
keys.wire(eb)
return eb
}
diff --git a/internal/host/rawinstancedir_wiring_test.go b/internal/host/rawinstancedir_wiring_test.go
new file mode 100644
index 000000000..3305df288
--- /dev/null
+++ b/internal/host/rawinstancedir_wiring_test.go
@@ -0,0 +1,76 @@
+package host
+
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+// Every activator.ExecBackend this package builds to wake instances must
+// carry RawInstanceDir, or the start rule's set-aside renames through the
+// nested bind mount and every wake of an unmarked fleet copy is refused
+// with EXDEV (v0.33.0 on a dev fleet box). rawDirExempt lists the
+// literals that never wake anything, with the reason.
+var rawDirExempt = map[string]string{
+ "movesheldenv.go": "renders a held instance's env into a temporary directory; never restores or starts",
+}
+
+func TestExecBackendsCarryTheRawInstanceDir(t *testing.T) {
+ files, err := filepath.Glob("*.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ found := 0
+ for _, path := range files {
+ if strings.HasSuffix(path, "_test.go") {
+ continue
+ }
+ src, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ f, err := parser.ParseFile(token.NewFileSet(), path, src, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ ast.Inspect(f, func(n ast.Node) bool {
+ lit, ok := n.(*ast.CompositeLit)
+ if !ok {
+ return true
+ }
+ sel, ok := lit.Type.(*ast.SelectorExpr)
+ if !ok || sel.Sel.Name != "ExecBackend" {
+ return true
+ }
+ if x, ok := sel.X.(*ast.Ident); !ok || x.Name != "activator" {
+ return true
+ }
+ found++
+ if _, ok := rawDirExempt[path]; ok {
+ return true
+ }
+ for _, el := range lit.Elts {
+ kv, ok := el.(*ast.KeyValueExpr)
+ if !ok {
+ continue
+ }
+ if k, ok := kv.Key.(*ast.Ident); ok && k.Name == "RawInstanceDir" {
+ if v, ok := kv.Value.(*ast.SelectorExpr); ok && v.Sel.Name == "RawInstanceDir" {
+ if x, ok := v.X.(*ast.Ident); ok && x.Name == "layout" {
+ return true
+ }
+ }
+ }
+ }
+ t.Errorf("%s: an activator.ExecBackend without RawInstanceDir: layout.RawInstanceDir", path)
+ return true
+ })
+ }
+ if found < 2 {
+ t.Fatalf("found %d ExecBackend literals; the scan is looking in the wrong place", found)
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 534468928..017438a68 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -52,4 +52,5 @@ 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 0812141114655728c5f7e4204ebe6f41fbf320e256dd68881b534ffe614353df
+plan14-root-reads-fix-set-aside-exdev.tsv f9d3016cc6803338f9db19311f3f598e20c37c8a19e111a3dabf4741dabe1b19
+plan14-root-reads-durability-3a-escrow.tsv 03a92257beb9b8aac421559e247d191bd69f28a0b26243397a1344a90d59fc2a
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 524b35f18..f914eae25 100644
--- a/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
+++ b/internal/provision/testdata/plan14-root-reads-durability-3a-escrow.tsv
@@ -74,7 +74,7 @@ internal/activator/hasecrets.go Service.fillScheduledToken legacy accepted-legac
internal/activator/instancekey.go ExecBackend.BackfillInstanceKey legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: back to main's body bar a comment: it calls ensureInstanceKeyAt as before, and an HA host's mint decision now lives inside that producer (haMintGuard, final fix F2); the agent's backfill skips HA hosts before this (instancekeys.go); the one +whole:Route of the first proposal is gone; no read added;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: comment only (the escrowed host's mint decision inside ensureInstanceKeyAt); the body is unchanged whole:Route@385,whole:Route@400 b65f3ce46f53cc9cc6679f490ff31684bc96c5d8d86c337c3c151cb11a480a4b
internal/activator/instancekey.go ExecBackend.ensureInstanceKeyAt legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: after the unchanged replica and fenced/conflict checks, asks haMintGuard(ctx, rt) (+whole:Route) and hands the guard to ensureInstanceKey; a classification error fails with InstanceKeyFailed; a non-HA host gets a nil guard and mints exactly as before; only adds a refusal;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: asks mintGuardFor(ctx, rt) (was haMintGuard): an HA host's guard as before; an eligible host's escrowMintGuard, which on a ready box reads the bucket manifest and the sealed env item when a mint is next and refuses while the escrow holds the key, and on a box that is not ready refuses every mint; nil for any other host, which mints as before. The replica and fenced/conflict refusals are unchanged; only adds refusals Fix round 1: asks mintGuardWith(ctx, rt, !create): a launch's ensure shares its preparation's escrow read, the backfill's reads the bucket afresh; only refuses. registry:Host@598,registry:Replica@159,whole:Route@491,whole:Route@667 5605bd1a4441859415f51b50c38e959987b2524fa8ccbec7364949e7097e9770
internal/activator/instancekey.go ensureInstanceKey legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more parameter, guard (nil for every caller but ensureInstanceKeyAt on an HA host), asked once the locked read finds no key and the bucket allows a mint, before anything is minted; its refusal returns InstanceKeyFailed with nothing written. Create-only, fail-closed and defer-on-unknown are unchanged; the one site unchanged, no read added; only adds a refusal;rev3=census-ruling-durability-3a-escrow;basis=durability 3a Task 4: the guard is asked with InstanceKeyVar, at the same point (the locked read found no key and the bucket allowed a mint); create-only, fail-closed and defer-on-unknown unchanged; the same one site; only adds a refusal file:Stat@4816 2d53f8246ac317c066d4b804cdc251aaf60abbd4423c6b780f0cbee227203fc8
-internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-durability-3a-escrow;basis=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. file:Exec@17444,file:Open@1150,file:Statfs@44013,registry:App@11199,whole:Route@11191,whole:Route@28232 9077bf263076fbdb95be61279b53fb22bb70bf720022d2dab2ca196caa8d10d1
+internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites;rev3=census-ruling-durability-3a-escrow;basis=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. Merge of origin/main 00bf5b8c (fleet set-aside EXDEV fix): main's change to this body is kept as main has it, under its own census ruling; this branch's change is unchanged. file:Exec@17617,file:Open@1150,file:Statfs@44186,registry:App@11372,whole:Route@11364,whole:Route@28405 01e503e0a6d3f1e692d0d617bf5ac7b5d5dc42768711526db22eb4144de87138
internal/host/claimfilesseed_stage.go filesSeedOperation.stage authority C,J4 rev3=PROPOSED-seed; fresh private provider, real admitted tuple and origins; guarded safe source descriptor and wake snapshot; create conflicts compare bounded bytes at exact current version before commit;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5 (parked path, host claims with origins only): hostfiles.RefuseSecretsAt over the root it opened, before hostfiles.Seed: any path the classifier does not call App refuses the seed before its first write, with pubclass.ErrSecretPath. No read added; the walk is the descriptor walk Seed itself makes. Task 7 fix round 1: bind the descriptor returned through work.With once as dir; stat, RefuseSecretsAt and Seed use that same descriptor. No path, read, authority, refusal or production behavior changes; the account/host identity and descriptor lifetime are unchanged. 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. file:Stat@1540,file:Stat@761 15d5daee2a7bcdf768f30ed909d6e89b20b7d62466824a3232f9219a242b3cec
internal/host/movesfiles.go movesFiles.Establish authority C,J4 rev3=PROPOSED-p3;run=12;basis=agent files preparation; retains seed admitted-writer and ordinary origin proof with one C8 commit; H3 is inventory bookkeeping, C owns the enabled effect;rev3=census-ruling-durability-3a-escrow;basis=Durability 3a Task 5 (parked path, host claims only): a present env file (claimEnvPresent: nested via instancefs.OpenBeneathOrAbsent, flat via Lstat; the bytes are never read) refuses with pubclass.ErrSecretPath before any bucket write; the env bytes are no longer read (readClaimEnvFile deleted); with no env file the establishment proceeds and stages StagePlatformDelete(EnvItem), so a raw env item a baseline holds is dropped, never carried into the new generation; openPrepared no longer takes the env and establishedOver no longer GETs an env object. Only refuses more, and reads less. 19460e82a02513d76113a48b00cfa4e25ca1921a2d71898fb90fc8b85a93caac
internal/hostfiles/restore.go Restore legacy accepted-legacy accepted-legacy;rev3=merge-ruling-2;basis=Restore delegates to shared descriptor-root implementation; generic payload restoration remains legacy.;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: passes nil for restore's new baseline argument; the one site unchanged, nothing else changed;rev3=census-ruling-durability-3a-escrow;basis=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. file:OpenRoot@219 28385093d26c704b98e5f199ec9fa045302c989188abe38d41b3439f6a151a7e
@@ -152,8 +152,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 00b08377f1580ec647ba4d95b69768946a41362836c98423012ff29281b8280d
-@coverage internal/host 7db0a0a884919bfaef1aa0c4f82ec0103fcb2a56962f8ed084e60469f8c5dd37
+@coverage internal/activator 5a5c4b6f4b5a1c73d323454470146c97e13d4a13f99db7ba4c9a4158e7c56530
+@coverage internal/host 48a4314bf1bf31b6136ce36c34aab23fc4ce401b706bdf699001ec5b03438506
@coverage internal/hostfiles 2cd8c98a974bb0936ef4a3023d4b68369709dabc15c8c37dc25f0a893f7fd267
@coverage internal/layout f845fa728b0935279454d8b01023c5d6dae1c985061a41229cf0686e829f5c12
@coverage internal/layout/pubclass 6515ba31b1848139c9da066a6c65b5583c39a92cb77621773d0d11d9cde24e24
diff --git a/internal/provision/testdata/plan14-root-reads-fix-set-aside-exdev.tsv b/internal/provision/testdata/plan14-root-reads-fix-set-aside-exdev.tsv
new file mode 100644
index 000000000..0c4b0c828
--- /dev/null
+++ b/internal/provision/testdata/plan14-root-reads-fix-set-aside-exdev.tsv
@@ -0,0 +1,8 @@
+# Census overlay fix-set-aside-exdev, written by census-propose (#369). census-ruling-fix-set-aside-exdev, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-fix-set-aside-exdev.md.
+# 1 body, 0 sites, 2 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 1 new dispositions: 0 reads re-frozen at their disposition with the claim, 1 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+@legacy 1d4ec6ca60a9a0d2f69c88f09eabc213cfc38315ea2871fd29ef82551f013c19 internal/activator/startrule.go ExecBackend.setAsideSource legacy accepted-legacy accepted-legacy;rev3=census-ruling-fix-set-aside-exdev;basis=new: picks the directory supersede renames from. With b.RawInstanceDir set, Lstats the instance directory (from the route DBPath, as reconcileAssignment already reads it) and the raw path layout.RawInstanceDir names for the host (agent-owned /data/.instances/<id>, 0700 carlos; the id comes from the host name, not tenant input); only when both are directories and os.SameFile returns the raw path, otherwise the instance directory as before. Lstat follows no final symlink; the renames still open both directories with openat2 RESOLVE_NO_SYMLINKS. Adds two root reads (file:Lstat) of paths a tenant cannot name file:Lstat@216,file:Lstat@247 45ee09c91b7f682d49b38f430c7ae194363c547f2a1314e9a735fa41f37a3d8f
+internal/host/agent.go runAgent authority B,C,D,F rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): builds the box's lifetime judge once (newBoxJudge, nil with host claims on) and hands it to the seed placement, the moves and runs workers and every loop it starts; read sites unchanged, offsets moved; B,C,D,F authority retained; self-serve moves 1 Task 8: derives the box's lifetimes switch from the judge once (lifetimes := boxJudge != nil) and hands it to the edges file loop; read sites unchanged, offsets moved;rev3=census-ruling-plans-4d-lapse;basis=arms two more plans hooks from the same snapshot: e.SetPlanDisabledFor(planDisabledFor) beside SetPlanGovernedFor, and svc.SetDisabledFor(planDisabledRoute) beside SetMaxRunFor (plans 4d); the reads live in those units (plans-4d-units decision); read sites unchanged, offsets moved;rev3=census-ruling-rootfs-apps-2;basis=main's body as of the merge of origin/main 9b81d97b (with main's plan rate ceiling, edge request records, regional box names, self-serve moves plan 1, plans 4d-1 lapse and its other later changes under main's own census rulings) plus the rootfs placement wiring in the activator start: an agentRootfs built from eb.NestedOK, CARLOS_DEPLOYMENT_SINGLE_TENANT, CARLOS_POOLS, the claim flag, swapArming's answer, the control client's /ready/rootfs and, on a fleet box whose identity resolved, fleetOwnerCheck over the deploy store main already opens for the fleet label (fleetStore), then arm and armedRootfs.Store; this body reads nothing new itself; the closures it wires read later, at a rootfs wake and each status tick: GET /ready/rootfs over the control socket, NestedOK's checks, and release.FleetOwnerKey for the judged row's own account and this box's fleet from the deploy store;rev3=census-ruling-instance-egress-sizes-328-329;basis=#328 plan 2 Tasks 7 and 11, #329 plan 3 Task 7 and plan 1 Task 7's policy cache: the control client is built once and handed to eb.Control, to the status tick (egressStatus) and to a new egressNudgeLoop goroutine; armSizeSource(svc, "/sys/fs/cgroup") after the activator Service; armPolicyCache() after armChangeIndex; statusLoop takes egressStatus. The reads are those units' own (decision rows); this body reads nothing new: the same five sites, offsets moved, in the agent; B,C,D,F authority retained.;rev3=census-ruling-remote-instance-metrics;basis=builds the metrics loop's owners closure (metricsOwners over the agent's registry, the activator and cgm.Leftover) when an activator exists and hands it to metricsLoop; reads nothing new itself;rev3=census-ruling-edge-asset-cache-3;basis=adds file:Statfs. runAgent keeps its authority (B,C,D,F). The new site is assetcache.Statfs, an exported assetcache.FS interface value (var Statfs FS = statfsFS{}), not a function value and not a call in runAgent: the ready hook passes it to armEdgeAssetCache as the store's filesystem, and armEdgeAssetCache calls its Space method on the configured data directory (dataDir(): $CARLOS_DATA_DIR, else /data), which calls unix.Statfs there (statfsFS.Space, accepted legacy at census-ruling-edge-asset-cache-2). No request-supplied pathname reaches it.;rev3=census-ruling-remote-metrics-nested;basis=main's body (merged origin/main acfa4f80, under main's own census rulings) plus: snapshots the nested layout (snapshotNestedUnits over /sys/fs/cgroup/carlos.slice/carlos-instances.slice) once at start, before the activator, and hands the metrics loop a unitSources struct (stamped units, routeHostNames, that root and the snapshot); reads nothing new itself;rev3=census-ruling-region-ha-p1a;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): wires region HA P1a into the activator: cfg.Record = haRecordFacts(openDeployStore, boxJudge) (the box's lifetime judge this body already builds with newBoxJudge, nil with host claims on; CI fix) and cfg.Self = lease.CurrentSelf; eb.Lifetimes (the process's lifetime index), eb.Registry, eb.StartupSwept (seedSweptAtStart.Load), eb.FilesStore from newProductionFilesStore (now lease.NewFilesStore, rootaws-loaded, a log line on failure) and lease.SetObligationDir(<data>/.ha-owed) (logged on failure; HA acquires then refuse); this body reads nothing new itself, the same five sites; the reads are those units' own (haRecordFacts and lease's SetObligationDir are new rows on this card); merge of origin/main d7ae1d76: main's own later changes to this body are kept as main has them, under main's rulings (census-ruling-remote-instance-metrics: the metricsOwners closure for metricsLoop; census-ruling-edge-asset-cache-3: the +file:Statfs site, assetcache.Statfs handed to the asset ready hook); this branch's change is the same as above;rev3=census-ruling-region-ha-p1b1;basis=region HA P1b-1: builds one termfence.Confirmer (Self from lease.CurrentSelf at each call, EC2 DescribeInstances method only, client from rootaws.LoadDefaultConfig with retries off, built lazily on first use) and sets eb.OwnerTerminated; this body reads nothing new itself, the same six sites;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 7: the startup Sweep literal hands its answer to startupSwept, which logs as before and, only on a clean sweep, marks rootfs admission swept (MarkRootfsSwept); same Sweep call, no read added;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (controller ruling after branch review R1, and Paul's R2 ruling): sets svc.Fleet = fleetWakeFor(os.Getenv, identity, identErr, fleetStore) from the identity it already resolves once and the deployment store the fleet loops already opened, and logs an ERROR naming the identity error when the box is on a fleet with an invalid identity. fleetWakeFor reads CARLOS_REGION and CARLOS_FLEET from the same environment. Read sites unchanged (6). Agent, not root; a platform box is unchanged.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: one call more beside armRunsPass, armInteractivePass(svc, reg, rolloutSink, boxJudge), in the same activator Configure hook, handing it the same box judge; fix round 1 (Astra P2, shutdown): after svc.Shutdown(ctx), shutdownInteractive(ctx) ends and joins every interactive session under the same shutdown budget; the worker's own reads are its units' (interactive.go); this body reads nothing new, the same six sites; merge of origin/main 6f1f6ca6: main's svc.Fleet = fleetWakeFor(...) and its invalid-identity ERROR line are kept as main has them (census-ruling-managed-fleets-1b); this branch's change is the same as above; read sites unchanged (6);rev3=census-ruling-fix-set-aside-exdev;basis=set-aside EXDEV fix: one field more on the agent ExecBackend literal, RawInstanceDir: layout.RawInstanceDir (a pure path join: <dataDir>/.instances/<InstanceID(host)>), so the start rule set-aside moves a copy out through the raw directory instead of through the nosymfollow bind; this body reads nothing new, the same six sites file:Exec@17216,file:Open@1150,file:Statfs@43749,registry:App@11372,whole:Route@11364,whole:Route@28004 764fa9bb232c1da7a130c86a09ff89172ef5e9f79dcf5e590ffda3d58bd88dcb
+internal/activator/startrule.go ExecBackend.setAsideSource legacy accepted-legacy accepted-legacy;rev3=census-ruling-fix-set-aside-exdev;basis=new: picks the directory supersede renames from. With b.RawInstanceDir set, Lstats the instance directory (from the route DBPath, as reconcileAssignment already reads it) and the raw path layout.RawInstanceDir names for the host (agent-owned /data/.instances/<id>, 0700 carlos; the id comes from the host name, not tenant input); only when both are directories and os.SameFile returns the raw path, otherwise the instance directory as before. Lstat follows no final symlink; the renames still open both directories with openat2 RESOLVE_NO_SYMLINKS. Adds two root reads (file:Lstat) of paths a tenant cannot name file:Lstat@216,file:Lstat@247 45ee09c91b7f682d49b38f430c7ae194363c547f2a1314e9a735fa41f37a3d8f
+@coverage internal/activator b442a017a8026920c5a033b12e027410abb3eefb3e5af3d1b2ca5248949b6120
+@coverage internal/host 18d2b979d7ee74abc2a2e03fa027e93c9cb8c4d13a5fac1c0c1d99223885f076