carlos / platform Public

Keep new resident tenants off implicit flat execution paths

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 636d5f3af3dd688f5b70bebcfa0a29c111ea9e9e parent 91798f1
12 files changed, +312 −35
  • docs/superpowers/notes/census-proposal-security-review-mitigations.md +22 −3
  • docs/superpowers/reviews/REVIEW-BRIEF-security-review-mitigations.md +10 −0
  • internal/activator/backend_exec.go +37 −0
  • internal/activator/resident_layout_test.go +79 −0
  • internal/host/agent.go +3 −0
  • internal/host/agent_layout_test.go +59 −11
  • internal/host/layoutleg.go +41 −13
  • internal/host/rootfs_advice_test.go +6 −4
  • internal/provision/reconcile.go +6 −2
  • internal/provision/replicas_test.go +33 −0
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv +15 −1

CI failed — run details

diff --git a/docs/superpowers/notes/census-proposal-security-review-mitigations.md b/docs/superpowers/notes/census-proposal-security-review-mitigations.md
index 5c44966b4..63b57d07b 100644
--- a/docs/superpowers/notes/census-proposal-security-review-mitigations.md
+++ b/docs/superpowers/notes/census-proposal-security-review-mitigations.md
@@ -1,11 +1,30 @@
# Census approval: security-review-mitigations
-Ruling `census-ruling-security-review-mitigations`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-security-review-mitigations`. The independent reviewer approves or rejects every change below, 2 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
-Envelopes re-pinned: `.`.
+| unit | change | read sites | what changed |
+|---|---|---|---|
+| `internal/host/agent.go` `runAgent` | body | unchanged (9) | Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained. |
+| `internal/host/layoutleg.go` `mintLayoutIntentWith` | body | unchanged (1) | Mint nested on nested-default, activator-armed, floor-capable boxes while isolation readiness is pending; wake still gates on readiness. Explicit flat and incapable-box compatibility unchanged; same intent/env/registry sources. |
+| `internal/activator/backend_exec.go` `ExecBackend.Start` | sites | +whole:Route | Pass the existing route to the new resident-layout refusal before flat exec. Adds whole Route read; only restricts never-served stateless resident launches when flat was not chosen. |
+| `internal/activator/backend_exec.go` `ExecBackend.startGenFrom` | sites | +whole:Route | Apply the same new-resident refusal before flat/foreign generation exec; adds whole Route read, retains all runtime/layout/root/gVisor refusals. |
+
+Envelopes re-pinned: `.`, `internal/activator`, `internal/host`, `internal/provision`.
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.
-Seal: `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129` → `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129`.
+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);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.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.
+- `internal/host/layoutleg.go` `mintLayoutIntentWith`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route
+- `internal/activator/backend_exec.go` `ExecBackend.Start`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=a rootfs row (Runtime) goes through rootfsGates and startRootfsFromLive, never the layout switch; a binary row's path is unchanged; the new kind is registry:Runtime, one site; no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: haSpawnGate(rt) first (+whole:Route), refusing an HA-acquired host whose row is no longer contained; otherwise unchanged; only adds a refusal;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1 and Task 7: ctx to the rootfs gates; startRootfsFromLive now returns the staged identity (the version is passed on); a row with a runtime other than rootfs-v1 is refused before the binary path (refuseUnknownRuntime); adds a refusal only;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=passes an empty build to startChildAt's new build argument (the live link, whose build is not pinned); read sites unchanged (14); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: keep main page-cache build argument (empty for the unpinned live link) and branch sandbox gate before dispatch. No new read source.
+- `internal/activator/backend_exec.go` `ExecBackend.startGenFrom`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-zddr4;basis=Census ruling zddr4: changed legacy row; the generation socket path is chosen through genLayout on the same row's Host, an over-long flat host is logged and keeps its canonical socket as a foreign row does, and the leftover canonical link is cleared for any spawn on the canonical socket. Boundary: agent-side, running as carlos; generation socket directories under the agent's own /run/carlos tree; no root decision; no registry, /data, release or claim read beyond what the unit read before.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=keeps the staged identity's Version (id.Version, from the same StagedIdentity it already resolved) as flatBuild and passes it to startChildAt; read sites unchanged (16); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main staged identity Version as flatBuild passed to startChildAt. Keep branch sandbox refusal and gVisor generation-zero selection before preparation. No new read source.
+
+New dispositions, which census-propose wrote and the reviewer checks against the unit's reads and the diff:
+
+- new `internal/activator/backend_exec.go:ExecBackend.residentLayoutRefusal`: reads +registry:GoodVersion, +registry:ServingVersion, +whole:Route; written legacy, accepted-legacy, frozen
+- reads `internal/provision/reconcile.go:RouteFor`: +registry:Stateless; keeps authority, task C,E3
+
+Seal: `250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129` → `954066fff9490cce33ee8eca238bddbdd0bdc781526b3075f1787770429ff15f`.
Overlay: `internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/docs/superpowers/reviews/REVIEW-BRIEF-security-review-mitigations.md b/docs/superpowers/reviews/REVIEW-BRIEF-security-review-mitigations.md
index 5b1f83e1a..026e4cd90 100644
--- a/docs/superpowers/reviews/REVIEW-BRIEF-security-review-mitigations.md
+++ b/docs/superpowers/reviews/REVIEW-BRIEF-security-review-mitigations.md
@@ -15,3 +15,13 @@ Review:
P1: unsafe/broken, with failure scenario and verified file:line. P2: wrong/missing, fix without restarting review. P3: polish, follow-up only. Name invariant/trust boundary (fault family) per finding. Do not inflate severity to keep review open.
Return ranked findings with concrete fix and checked evidence, then exactly READY (no P1/P2), READY AFTER FIXES (no P1), or NOT READY (P1). This is code review, not deployment approval. Do not edit, spawn agents, access production, or run full tests. At most 35 read/search operations.
+
+## Final implementation and census check (round 3 of 3 total)
+
+History is not reset: round 1 was the coordinated GLM/Mistral system audit (no P1); round 2 comprised the bounded Opus implementation check of dependencies/console headers (READY, four P3s) and the targeted layout-policy check (P1: new binary residents start flat despite nested intent; P2: readiness implicitly downgrades new mints). This is the first layout fix. Check the new root/security behavior and complete census, without reopening the original broad audit or the already approved dependency/header scope. No fourth round without Paul. If the new layout fix produces another P1 in the same isolation fault family, stop further fixes and give the three choices in AGENTS.md.
+
+Additional changes: replica assignments projected Stateless are minted nested on nested deployments; floor-capable activator-armed nested-default boxes mint nested while readiness is pending and the existing wake gate still refuses; a never-served stateless binary resident at flat/foreign paths refuses launch unless flat was explicitly chosen. Existing served/good-version residents, hibernating rows, explicit flat choices and external routes retain their prior behavior. No gVisor rollout change. The new refusal reuses ErrFenced without new user copy.
+
+Inspect all production call paths (Start, generation/staged start, resident migration), source of ServingVersion/GoodVersion exemptions, and timing/source of FlatLayoutChosen. Validate that ordinary member-created copies cannot use an unguarded route or a premature served marker, and that explicit flat and trusted legacy remain operable. Review the full named census proposal in docs/superpowers/notes/census-proposal-security-review-mitigations.md, overlay and chain; give an explicit verdict for every changed/new unit and all four envelopes, including the helpers covered by envelopes.
+
+P3 follow-up list from round 2 (not reopened): PDF interim-response filtering can lose default headers; add route-specific header-precedence coverage; strengthen decoder-error/spool-cleanup assertions; expand ServeHTTP's doc comment. The malformed decoder tests were watched fail on old compress and pass on the update. Parent validation of the full changed set uses short disk TMPDIR to avoid fixture socket-length limits. A pre-existing rootfs-worker temp cleanup race is tracked separately; do not misreport a failed run as green.
diff --git a/internal/activator/backend_exec.go b/internal/activator/backend_exec.go
index f6de02f2f..2224b3861 100644
--- a/internal/activator/backend_exec.go
+++ b/internal/activator/backend_exec.go
@@ -252,6 +252,13 @@ type ExecBackend struct {
// gate (every unit test and any box that predates the check). Wired in
// production by Task 6.
NestedOK func() error
+ // FlatLayoutChosen reports whether this box chose the flat layout on
+ // purpose (a recorded flat intent, or CARLOS_LAYOUT_DEFAULT=flat): the
+ // one case a new always-on binary row at the flat paths may start as
+ // an exec child (residentLayoutRefusal). Nil, and every box that never
+ // said flat, refuses that start; the layout pass moves the row nested
+ // and it starts there. Wired by internal/host from the box's intent.
+ FlatLayoutChosen func() bool
// RootfsOK reports whether the control service's rootfs probe passed
// on this boot (GET /ready/rootfs). RootfsPlacement is
// host.RootfsPlacementAllowed with the box's facts: every rule a
@@ -2155,9 +2162,36 @@ func (b *ExecBackend) Start(ctx context.Context, rt registry.Route) (Proc, strin
case LayoutFenced, LayoutConflict:
return nil, "", fmt.Errorf("%s: refusing to wake: %s", rt.Host, p.reason)
}
+ if err := b.residentLayoutRefusal(rt, p.layout); err != nil {
+ return nil, "", err
+ }
return b.startChildAt(ctx, rt, rt.Socket, 0, "", "", cgroup.Limit{})
}
+// residentLayoutRefusal refuses the flat exec child for a binary resident
+// (statelessResident: stateless, not hibernating, no runtime) that has
+// never served (no serving or good build), at the flat or foreign paths,
+// on a box that did not choose flat (FlatLayoutChosen). Such a row is a
+// new tenant whose stateless mark arrived after its mint (SeedStateless at
+// staging, or a replica assignment), so its paths were minted as an
+// unflagged socket route's; started flat it would run with the agent's
+// uid beside its nested siblings. Refused, it is asleep, so the layout pass
+// moves it nested without an awake grace and it starts as a unit. A
+// resident that has served (every row that ran before this rule, and its
+// restarts) is not touched. It uses the existing maintenance-fence refusal.
+func (b *ExecBackend) residentLayoutRefusal(rt registry.Route, l Layout) error {
+ if !statelessResident(rt) || rt.ServingVersion != "" || rt.GoodVersion != "" {
+ return nil
+ }
+ if l != LayoutFlat && l != LayoutForeign {
+ return nil
+ }
+ if b.FlatLayoutChosen != nil && b.FlatLayoutChosen() {
+ return nil
+ }
+ return ErrFenced
+}
+
// StartGen is Start for generation n (zero-downtime spec §7.1). perGen false
// is Start exactly: the canonical socket, the canonical control socket, the
// same argv. perGen true binds the generation's own socket: GenSocketPath
@@ -2277,6 +2311,9 @@ func (b *ExecBackend) startGenFrom(ctx context.Context, rt registry.Route, n uin
case LayoutFenced, LayoutConflict:
return nil, Gen{}, fmt.Errorf("%s: refusing to wake: %s", rt.Host, p.reason)
default:
+ if err := b.residentLayoutRefusal(rt, p.layout); err != nil {
+ return nil, Gen{}, err
+ }
if sock == rt.Socket {
// A link left at the canonical path by an agent that ran with
// generations on would make the app's bind fail. That holds for
diff --git a/internal/activator/resident_layout_test.go b/internal/activator/resident_layout_test.go
new file mode 100644
index 000000000..bb2e4e05f
--- /dev/null
+++ b/internal/activator/resident_layout_test.go
@@ -0,0 +1,79 @@
+package activator
+
+import (
+ "context"
+ "errors"
+ "path/filepath"
+ "testing"
+ "time"
+
+ "github.com/carlosframework/platform/internal/provision"
+ "github.com/carlosframework/platform/internal/registry"
+)
+
+// A new binary resident (stateless, not hibernating, never served) whose
+// row is at the flat paths is not started as an exec child on a box that
+// did not choose flat: Start and StartGen refuse it as fenced, and no
+// child runs. The same row starts once the box has chosen flat, once it
+// has served (a legacy resident's restart), or when it hibernates (not a
+// resident at all): those reach the stateless secrets gate instead. The row is the production projection
+// (provision.RouteFor on a non-hibernating record, marked stateless as
+// staging marks it), not a hand-shaped route.
+func TestExecBackendRefusesANewFlatBinaryResident(t *testing.T) {
+ b := testExecBackend(t)
+ b.RunDirOverride = shortRunDir(t)
+ host := "shop.example.com"
+ off := false
+ rec := provision.Record{Account: "bab", App: "shop", Host: host, Channel: "canary/test", Hibernate: &off, CreatedAt: time.Unix(1, 0)}
+ // Minted on a box whose intent is not nested: the flat paths, as an
+ // unflagged socket route's, with the socket under the test's run dir.
+ rt := provision.RouteFor(rec, b.DataDir, "", false, nil)
+ rt.Socket = filepath.Join(b.RunDirOverride, host+".sock")
+ rt.Stateless = true // SeedStateless at staging
+ if !statelessResident(rt) || rt.ServingVersion != "" {
+ t.Fatalf("fixture is not a never-served binary resident: %+v", rt)
+ }
+ if l, why := b.Layout(rt); l != LayoutFlat {
+ t.Fatalf("fixture classifies %q (%s), want flat", l, why)
+ }
+ stageRecordingLiveFullEnv(t, b, host, "v1")
+ refused := func(name string, rt registry.Route) {
+ t.Helper()
+ if _, _, err := b.Start(context.Background(), rt); !errors.Is(err, ErrFenced) {
+ t.Fatalf("%s: Start = %v, want the fenced refusal", name, err)
+ }
+ if _, _, err := b.StartGen(context.Background(), rt, 1, false); !errors.Is(err, ErrFenced) {
+ t.Fatalf("%s: StartGen = %v, want the fenced refusal", name, err)
+ }
+ }
+ // Past the layout refusal, a stateless row meets the next gate, its
+ // shared secrets (errStatelessSecretsWaiting): proof the layout did
+ // not refuse it. The fixture delivers no config, so no child runs.
+ started := func(name string, rt registry.Route) {
+ t.Helper()
+ if _, _, err := b.Start(context.Background(), rt); errors.Is(err, ErrFenced) || !errors.Is(err, errStatelessSecretsWaiting) {
+ t.Fatalf("%s: Start = %v, want to pass the layout refusal", name, err)
+ }
+ if _, _, err := b.StartGen(context.Background(), rt, 1, false); errors.Is(err, ErrFenced) || !errors.Is(err, errStatelessSecretsWaiting) {
+ t.Fatalf("%s: StartGen = %v, want to pass the layout refusal", name, err)
+ }
+ }
+ refused("no FlatLayoutChosen wired", rt)
+ b.FlatLayoutChosen = func() bool { return false }
+ refused("box has not chosen flat", rt)
+ foreign := rt
+ foreign.Socket = tmpSock(t)
+ if l, _ := b.Layout(foreign); l != LayoutForeign {
+ t.Fatalf("foreign fixture classifies %q", l)
+ }
+ refused("foreign paths", foreign)
+
+ served := rt
+ served.ServingVersion = "v1"
+ started("a resident that has served", served)
+ sleeper := rt
+ sleeper.Hibernate = true
+ started("a hibernating row", sleeper)
+ b.FlatLayoutChosen = func() bool { return true }
+ started("the box chose flat", rt)
+}
diff --git a/internal/host/agent.go b/internal/host/agent.go
index ad62edf2b..60fca0784 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -630,6 +630,9 @@ func runAgent(args []string, buildClaims ClaimFactory) {
log.Printf("agent: %v (nested wakes and the layout pass refuse until the unit is fixed)", err)
}
eb.NestedOK = nestedGate(selfCheck, instancefs.MountNoSymfollow, eb.Control.Ready)
+ // A new always-on binary row at the flat paths starts as an exec
+ // child only on a box that chose flat (ExecBackend.FlatLayoutChosen).
+ eb.FlatLayoutChosen = flatLayoutChosen
// CARLOS_SWAP=overlap turns on generations (plan 1), and with them
// plan 3's Swap, before the Service exists, which reads the switch
// once in New. Plan 2's per-generation containment goes on with
diff --git a/internal/host/agent_layout_test.go b/internal/host/agent_layout_test.go
index b354e7861..fb3800c00 100644
--- a/internal/host/agent_layout_test.go
+++ b/internal/host/agent_layout_test.go
@@ -985,9 +985,12 @@ func TestLayoutLegUsesTheDefaultWhenNoIntentIsRecorded(t *testing.T) {
}
// Startup recovery and the reconciler's mint read the same default: with
-// no intent and a ready box both answer nested; with no intent and a box
-// that is not ready both answer none; CARLOS_LAYOUT_DEFAULT=flat answers
-// none on a ready box.
+// no intent and a ready box both answer nested; with no intent and an
+// armed box whose gate is not ready startup answers unreadable and the
+// mint answers nested (the wake gate waits, the tenant is never flat);
+// a box that cannot wake nested (no activator, below the floor) mints
+// flat unless a managed nested sibling proves the box has moved;
+// CARLOS_LAYOUT_DEFAULT=flat answers none on a ready box.
func TestStartupAndMintReadTheDefault(t *testing.T) {
resetLayoutGlobals(t)
t.Setenv(layoutDefaultEnv, "")
@@ -1011,16 +1014,29 @@ func TestStartupAndMintReadTheDefault(t *testing.T) {
if got := startupLayoutIntent(ctx, s, nil, "kass-1"); got != layout.IntentUnreadable {
t.Fatalf("startup, gate ready = %q, want unreadable: startup does not trust the gate", got)
}
- // The mint asks the gate; not ready is flat...
+ // The mint asks the gate; an armed box whose gate is not ready (or
+ // has not answered yet) still mints nested: the gate guards the wake,
+ // and a flat mint would be the implicit downgrade the default forbids.
armDefaultGate(t, errors.New("not yet run"))
+ if mode, err := mintLayoutIntent(ctx, s); err != nil || mode != release.LayoutModeNested {
+ t.Fatalf("mint, armed and not ready = %q %v, want nested", mode, err)
+ }
+ // A box that can never wake nested mints flat: no activator armed, or a
+ // release below the floor...
+ t.Setenv("CARLOS_DATA_DIR", "/data")
+ layoutDefaultGate.Store(nil)
+ if mode, err := mintLayoutIntent(ctx, s); err != nil || mode != "" {
+ t.Fatalf("mint, no activator = %q %v, want none", mode, err)
+ }
+ armDefaultGate(t, errors.New("not yet run"))
+ layoutBuild = func() string { return "v0.24.2" }
if mode, err := mintLayoutIntent(ctx, s); err != nil || mode != "" {
- t.Fatalf("mint, not ready = %q %v, want none", mode, err)
+ t.Fatalf("mint, below the floor = %q %v, want none", mode, err)
}
// ...unless the box already holds an activator-managed nested row,
- // which is proof it has moved: a fresh row beside it is minted nested
- // before the gate's first answer. A nested row that is not managed,
- // or flat rows, are not that proof.
- t.Setenv("CARLOS_DATA_DIR", "/data")
+ // which is proof it has moved: a fresh row beside it is minted nested.
+ // A nested row that is not managed, or flat rows, are not that proof.
+ layoutDefaultGate.Store(nil)
nestedManaged := registry.Route{Host: "a.example.com", Kind: "instance", Hibernate: true, DBPath: provision.NestedDBPath("/data", "a.example.com"), Socket: provision.NestedSocket("a.example.com")}
nestedUnflagged := registry.Route{Host: "u.example.com", Kind: "instance", DBPath: provision.NestedDBPath("/data", "u.example.com"), Socket: provision.NestedSocket("u.example.com")}
flat := registry.Route{Host: "f.example.com", Kind: "instance", Hibernate: true, DBPath: provision.DefaultDBPath("/data", "f.example.com"), Socket: provision.DefaultSocket("f.example.com")}
@@ -1028,14 +1044,20 @@ func TestStartupAndMintReadTheDefault(t *testing.T) {
return func() ([]registry.Route, error) { return rs, nil }
}
if mode, err := mintLayoutIntentWith(ctx, s, rows(flat, nestedUnflagged)); err != nil || mode != "" {
- t.Fatalf("mint, not ready, no managed nested row = %q %v, want none", mode, err)
+ t.Fatalf("mint, no activator, no managed nested row = %q %v, want none", mode, err)
}
if mode, err := mintLayoutIntentWith(ctx, s, rows(flat, nestedManaged)); err != nil || mode != release.LayoutModeNested {
- t.Fatalf("mint, not ready, a managed nested row = %q %v, want nested", mode, err)
+ t.Fatalf("mint, no activator, a managed nested row = %q %v, want nested", mode, err)
}
if _, err := mintLayoutIntentWith(ctx, s, func() ([]registry.Route, error) { return nil, errors.New("registry locked") }); err == nil {
t.Fatal("a registry that cannot be listed must defer the mint, not guess")
}
+ // An armed box short of ready never asks the registry: nested outright.
+ layoutBuild = func() string { return "v0.25.0" }
+ armDefaultGate(t, errors.New("not yet run"))
+ if mode, err := mintLayoutIntentWith(ctx, s, func() ([]registry.Route, error) { return nil, errors.New("registry locked") }); err != nil || mode != release.LayoutModeNested {
+ t.Fatalf("mint, armed and not ready, registry locked = %q %v, want nested without a listing", mode, err)
+ }
armDefaultGate(t, nil)
if mode, err := mintLayoutIntent(ctx, s); err != nil || mode != release.LayoutModeNested {
t.Fatalf("mint, ready = %q %v, want nested", mode, err)
@@ -1127,3 +1149,29 @@ func TestLayoutLegRetriesWhileTheDefaultIsBlocked(t *testing.T) {
t.Fatal("a typo waits on nothing")
}
}
+
+// flatLayoutChosen, the activator's FlatLayoutChosen: true only for a
+// recorded flat intent, or no recorded intent (none, the same value as
+// nothing read yet) under CARLOS_LAYOUT_DEFAULT=flat. A nested-default box that is not ready
+// (none), nested, unreadable and an invalid default all answer false.
+func TestFlatLayoutChosen(t *testing.T) {
+ resetLayoutGlobals(t)
+ for _, tc := range []struct {
+ seen, env string
+ want bool
+ }{
+ {release.LayoutModeNone, "", false},
+ {release.LayoutModeNone, "flat", true},
+ {release.LayoutModeNone, "nestd", false},
+ {release.LayoutModeFlat, "", true},
+ {release.LayoutModeFlat, "nested", true},
+ {release.LayoutModeNested, "flat", false},
+ {string(layout.IntentUnreadable), "flat", false},
+ } {
+ t.Setenv(layoutDefaultEnv, tc.env)
+ noteLayoutIntent(tc.seen)
+ if got := flatLayoutChosen(); got != tc.want {
+ t.Errorf("seen %q env %q: flatLayoutChosen = %v, want %v", tc.seen, tc.env, got, tc.want)
+ }
+ }
+}
diff --git a/internal/host/layoutleg.go b/internal/host/layoutleg.go
index 190eb2383..497c93be7 100644
--- a/internal/host/layoutleg.go
+++ b/internal/host/layoutleg.go
@@ -824,13 +824,18 @@ func mintLayoutIntent(ctx context.Context, store release.Store) (string, error)
// mintLayoutIntentWith is mintLayoutIntent with the box's own rows in hand
// (nil: no registry to ask). With no intent recorded and the deployment's
-// default nested, the default's gate is asked; and when the gate has not
-// yet answered (the first reconcile after an agent restart runs before the
-// control service's first probe) a box whose registry already holds an
-// activator-managed row at the nested paths counts as nested for mints
-// all the same: the box has evidently moved, and a flat row minted beside
-// nested siblings is the exposure the default exists to end. The gate
-// still guards every wake, so a nested row minted this way waits for it.
+// default nested, the default's gate is asked. A box that could wake
+// nested (an activator armed, at or above the floor) whose gate has not
+// answered yet, or answers not ready, still mints nested: the first
+// reconcile after an agent restart runs before the control service's
+// first probe, and a box short of a mount is fixed, not downgraded. A new
+// tenant minted flat there would run with the agent's uid beside its
+// nested siblings, the exposure the default exists to end; minted nested
+// it waits, with the gate's reason in status, until the box is ready or
+// an operator records flat. The gate still guards every wake. A box that
+// can never wake nested (no activator, below the floor) mints flat, as
+// under CARLOS_LAYOUT_DEFAULT=flat, unless its registry already holds an
+// activator-managed row at the nested paths: the box has evidently moved.
func mintLayoutIntentWith(ctx context.Context, store release.Store, routes func() ([]registry.Route, error)) (string, error) {
in, found, err := release.LoadLayoutIntent(ctx, store, BoxLabel())
switch {
@@ -841,14 +846,19 @@ func mintLayoutIntentWith(ctx context.Context, store release.Store, routes func(
if mode == release.LayoutModeNested {
return mode, nil
}
- if def, invalid := layoutDefault(os.Getenv); def == release.LayoutModeNested && invalid == "" && routes != nil {
- rows, err := routes()
- if err != nil {
- return "", fmt.Errorf("layout default: list routes: %w", err)
- }
- if nestedRowsPresent(rows) {
+ if def, invalid := layoutDefault(os.Getenv); def == release.LayoutModeNested && invalid == "" {
+ if layoutDefaultGate.Load() != nil && !release.BelowFloor(layoutBuild(), release.LayoutFloor) {
return release.LayoutModeNested, nil
}
+ if routes != nil {
+ rows, err := routes()
+ if err != nil {
+ return "", fmt.Errorf("layout default: list routes: %w", err)
+ }
+ if nestedRowsPresent(rows) {
+ return release.LayoutModeNested, nil
+ }
+ }
}
return release.LayoutModeNone, nil
case !release.ValidLayoutMode(in.Mode):
@@ -856,3 +866,21 @@ func mintLayoutIntentWith(ctx context.Context, store release.Store, routes func(
}
return in.Mode, nil
}
+
+// flatLayoutChosen reports whether this box runs flat on purpose: the
+// intent last converged or read at startup is a recorded flat, or no
+// recorded intent has been seen (none, which is also "" before the leg's
+// first read) and CARLOS_LAYOUT_DEFAULT=flat. Nested, none on a
+// nested-default deployment (a box that is not ready yet), an invalid
+// default and unreadable all answer false: a box that has not said flat
+// does not start a new resident flat (activator.ExecBackend.FlatLayoutChosen).
+func flatLayoutChosen() bool {
+ switch lastLayoutIntent() {
+ case release.LayoutModeFlat:
+ return true
+ case release.LayoutModeNone:
+ def, invalid := layoutDefault(os.Getenv)
+ return def == release.LayoutModeFlat && invalid == ""
+ }
+ return false
+}
diff --git a/internal/host/rootfs_advice_test.go b/internal/host/rootfs_advice_test.go
index cb2c810dc..c0dacb7ba 100644
--- a/internal/host/rootfs_advice_test.go
+++ b/internal/host/rootfs_advice_test.go
@@ -2,7 +2,6 @@ package host
import (
"context"
- "errors"
"log"
"os"
"path/filepath"
@@ -376,7 +375,7 @@ func TestLayoutLegIsQuietAboutKeptRootfsRows(t *testing.T) {
}
// TestMintEvidenceIgnoresRootfsRows (task 5 fix round 1): with no intent,
-// the nested default and its gate not yet passed, a binary row is minted
+// the nested default and no activator armed, a binary row is minted
// flat unless a binary managed row already sits at the nested paths. A
// resident or an unknown runtime there is no such proof: rootfs rows are
// nested by construction. Not parallel: it sets env and the layout globals.
@@ -387,7 +386,10 @@ func TestMintEvidenceIgnoresRootfsRows(t *testing.T) {
t.Cleanup(func() { layoutBuild = prev })
layoutBuild = func() string { return "v0.25.0" }
t.Setenv("CARLOS_DATA_DIR", "/data")
- armDefaultGate(t, errors.New("not yet run"))
+ // No activator armed: the one case the mint still asks the registry
+ // for a nested sibling (an armed box mints nested whatever the gate
+ // says, TestStartupAndMintReadTheDefault).
+ layoutDefaultGate.Store(nil)
ctx := context.Background()
s := release.NewDirStore(t.TempDir())
nested := func(host, runtime string, hib bool) registry.Route {
@@ -405,7 +407,7 @@ func TestMintEvidenceIgnoresRootfsRows(t *testing.T) {
} {
rows := func() ([]registry.Route, error) { return []registry.Route{c.rt}, nil }
if mode, err := mintLayoutIntentWith(ctx, s, rows); err != nil || mode != c.want {
- t.Errorf("mint, gate not ready, only %s as evidence = %q, %v; want %q", name, mode, err, c.want)
+ t.Errorf("mint, no activator, only %s as evidence = %q, %v; want %q", name, mode, err, c.want)
}
}
}
diff --git a/internal/provision/reconcile.go b/internal/provision/reconcile.go
index af510bd4b..f290446da 100644
--- a/internal/provision/reconcile.go
+++ b/internal/provision/reconcile.go
@@ -628,8 +628,12 @@ func RouteFor(rec Record, dataDir, seed string, nested bool, policy *UpdatePolic
// flat in every release (design §8.2 step 1). A born-HA row is
// nested whatever nested says (#446): it wakes only nested (region
// HA P1a), and a fresh box mints before its first nested-default
- // decision, so a flat mint could never wake on it.
- if (nested || rec.HA || rec.Demo != nil) && rt.Hibernate {
+ // decision, so a flat mint could never wake on it. A row the
+ // replica assignment projects stateless (projectReplicaAssignment,
+ // above) is a platform-managed resident the tick starts, not an
+ // external process: it is nested on the same terms as a
+ // hibernating row.
+ if (nested || rec.HA || rec.Demo != nil) && (rt.Hibernate || rt.Stateless) {
rt.Socket = NestedSocket(rec.Host)
rt.DBPath = NestedDBPath(dataDir, rec.Host)
}
diff --git a/internal/provision/replicas_test.go b/internal/provision/replicas_test.go
index 44afda718..23dcd62fc 100644
--- a/internal/provision/replicas_test.go
+++ b/internal/provision/replicas_test.go
@@ -2,6 +2,7 @@ package provision
import (
"bytes"
+ "context"
"database/sql"
"encoding/json"
"fmt"
@@ -445,3 +446,35 @@ func TestReplicaAssignmentAdmissionFromRecord(t *testing.T) {
})
}
}
+
+// A record whose replica assignment projects it stateless is a resident the
+// activator's tick starts, so on a nested box it is minted at the nested
+// paths exactly as a hibernating row is; on a flat box it stays flat.
+func TestReplicaResidentMintsNestedUnderANestedIntent(t *testing.T) {
+ for _, mode := range []string{release.LayoutModeNested, release.LayoutModeFlat} {
+ t.Run(mode, func(t *testing.T) {
+ s, rec, cfg := replicaReconcileFixture(t)
+ cfg.FleetBox = "a"
+ cfg.Layout = func(context.Context, release.Store) (string, error) { return mode, nil }
+ reg := regWith(t)
+ defer reg.Close()
+ if err := Reconcile(ctx, s, reg, cfg); err != nil {
+ t.Fatal(err)
+ }
+ got := *mustGet(t, reg, rec.Host)
+ if !got.Stateless || got.Hibernate {
+ t.Fatalf("minted row stateless %v hibernate %v, want a stateless resident", got.Stateless, got.Hibernate)
+ }
+ wantDB, wantSock := DefaultDBPath(cfg.DataDir, rec.Host), DefaultSocket(rec.Host)
+ if mode == release.LayoutModeNested {
+ wantDB, wantSock = NestedDBPath(cfg.DataDir, rec.Host), NestedSocket(rec.Host)
+ }
+ if got.DBPath != wantDB || got.Socket != wantSock {
+ t.Fatalf("%s box minted the resident at db %q socket %q, want %q, %q", mode, got.DBPath, got.Socket, wantDB, wantSock)
+ }
+ if NestedPaths(cfg.DataDir, got) != (mode == release.LayoutModeNested) {
+ t.Fatalf("NestedPaths = %v under %s", NestedPaths(cfg.DataDir, got), mode)
+ }
+ })
+ }
+}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 866d449f2..b97a05002 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -140,4 +140,4 @@ plan14-root-reads-gvisor-update-dirs.tsv 1f1b2fdb569b7be42e75e10d1943d7e51270829
plan14-root-reads-region-ha-held-build.tsv beb085e4c6cdb3d430d12a8dc3c93f25cc3faf1aa7d62be37698ff9c9c82ecce
plan14-root-reads-fixedbox-health-alarms.tsv 0f7153571df8c1b4b50c31f57efcfdf60c71a12c80fd935fb3ea202fa0201dd5
plan14-root-reads-fixed-host-ignore-user-data.tsv 250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129
-plan14-root-reads-security-review-mitigations.tsv 250e3ba91e1bc5fcd6be5cc2bafce4c7d6645d2d2f0c080913b99f01b1d19129
+plan14-root-reads-security-review-mitigations.tsv 954066fff9490cce33ee8eca238bddbdd0bdc781526b3075f1787770429ff15f
diff --git a/internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv b/internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv
index 460a04a59..6f2bcb458 100644
--- a/internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv
+++ b/internal/provision/testdata/plan14-root-reads-security-review-mitigations.tsv
@@ -1,3 +1,17 @@
# Census overlay security-review-mitigations, written by census-propose (#369). census-ruling-security-review-mitigations, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-security-review-mitigations.md.
-# 0 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 2 body, 2 sites, 4 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 2 new dispositions: 1 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 271a69c18bec930e0a4a7b7b4f9fe5778e3fd8843809a47bc93b06538937e1ad internal/host/layoutleg.go mintLayoutIntentWith legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-security-review-mitigations;basis=Mint nested on nested-default, activator-armed, floor-capable boxes while isolation readiness is pending; wake still gates on readiness. Explicit flat and incapable-box compatibility unchanged; same intent/env/registry sources. whole:Route@762 e07b678da489350b4cecbfd4c22e6fcc64c42697b3e0e0c25c54c90fba4d5a8b
+@legacy 7c7a1646ff33daeffda0936279ce612215af0e51ffe288336e6596b4f1cb9a6c internal/activator/backend_exec.go ExecBackend.residentLayoutRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-security-review-mitigations;basis=New agent-side refusal reads existing Route GoodVersion and ServingVersion and the route's stateless/resident shape; callback reads cached operator choice. No filesystem/store read, no new root action; served legacy residents and explicit flat remain supported. registry:GoodVersion@138,registry:ServingVersion@111,whole:Route@104 19df4cc383c98d67822d92d69ced57514c7d19473ae364afa473f879da829d7c
+@legacy 220d3324bb614ca9260e6a913ede37e94ed7132424af9fc2d3f7f92d48f45b24 internal/activator/backend_exec.go ExecBackend.Start legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=a rootfs row (Runtime) goes through rootfsGates and startRootfsFromLive, never the layout switch; a binary row's path is unchanged; the new kind is registry:Runtime, one site; no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: haSpawnGate(rt) first (+whole:Route), refusing an HA-acquired host whose row is no longer contained; otherwise unchanged; only adds a refusal;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1 and Task 7: ctx to the rootfs gates; startRootfsFromLive now returns the staged identity (the version is passed on); a row with a runtime other than rootfs-v1 is refused before the binary path (refuseUnknownRuntime); adds a refusal only;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=passes an empty build to startChildAt's new build argument (the live link, whose build is not pinned); read sites unchanged (14); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: keep main page-cache build argument (empty for the unpinned live link) and branch sandbox gate before dispatch. No new read source.;rev3=census-ruling-security-review-mitigations;basis=Pass the existing route to the new resident-layout refusal before flat exec. Adds whole Route read; only restricts never-served stateless resident launches when flat was not chosen. registry:Host@870,registry:Runtime@360,registry:Socket@1012,registry:Socket@527,registry:Socket@742,whole:Route@1008,whole:Route@119,whole:Route@209,whole:Route@245,whole:Route@313,whole:Route@432,whole:Route@523,whole:Route@607,whole:Route@667,whole:Route@738,whole:Route@927 4f9b02b7e63a04bfdf0e1db8987053dd9398cb4c1217076c63b47b2a952e9bc0
+@legacy 39ecb2ea1f85ead128cf41151266aa9e6a9b5d14c86f307ae6fe80a6fdf97348 internal/activator/backend_exec.go ExecBackend.startGenFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr4;basis=Census ruling zddr4: changed legacy row; the generation socket path is chosen through genLayout on the same row's Host, an over-long flat host is logged and keeps its canonical socket as a foreign row does, and the leftover canonical link is cleared for any spawn on the canonical socket. Boundary: agent-side, running as carlos; generation socket directories under the agent's own /run/carlos tree; no root decision; no registry, /data, release or claim read beyond what the unit read before.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=keeps the staged identity's Version (id.Version, from the same StagedIdentity it already resolved) as flatBuild and passes it to startChildAt; read sites unchanged (16); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main staged identity Version as flatBuild passed to startChildAt. Keep branch sandbox refusal and gVisor generation-zero selection before preparation. No new read source.;rev3=census-ruling-security-review-mitigations;basis=Apply the same new-resident refusal before flat/foreign generation exec; adds whole Route read, retains all runtime/layout/root/gVisor refusals. registry:Host@1046,registry:Host@1445,registry:Host@2164,registry:Host@2326,registry:Host@741,registry:Host@797,registry:Socket@1581,registry:Socket@2070,registry:Socket@2200,registry:Socket@689,registry:Stateless@2499,whole:Route@1321,whole:Route@1510,whole:Route@193,whole:Route@2388,whole:Route@400,whole:Route@436,whole:Route@676 8b96bd0461bda0267cb57f9b2a068db10aa8b6bcbb0705c4ce7cd4185de13752
+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.;rev3=census-ruling-probe-burst-limit;basis=two more sink wirings beside setAnalyticsSink: setProtectionSink(e.SetProtectionRecordOnly) and setAssetOwnersSource(e.AssetOwners), function values the telemetry pass calls; this body reads nothing new, the same six sites; authority B,C,D,F retained; no new root read or write kind;rev3=census-ruling-region-ha-p1b3a;basis=Arm HA placement exactly once on the existing Service before activatorStart and edges publication, wiring AwakeApps and the PageOperator callback; existing six read sites unchanged, no new root authority.;rev3=census-ruling-stateless-replicas-1;basis=Final review I3: start the concrete coordinator's renewal worker with agent setup; existing closeReplicaCoordinator shutdown cancels and joins it before release. No new read sites or credentials. Merge origin/main c59715e7: retain main's armHAPlacement(svc, PageOperator) wiring beside the existing activator setup; stateless coordinator and shutdown wiring remain. Same read sites; no new root read or credential.;rev3=census-ruling-edge-held-streams;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): in the edge-ready callback, calls act.SetHeldWakeHook(e.HeldWake) when act is non-nil (installing the non-blocking wake callback) and stores e.HeldStreamsForStatus in heldStreamsSource. Wiring of in-memory callbacks only; no read added.;rev3=census-ruling-region-ha-p1b3b-t;basis=Wire Service.SetDutyView to the live edge DutySnapshot in the ready callback. No new read; no new loop or cloud operation. B2 wires the registry as the persistent DutyStore before service startup; no new cloud or filesystem path. B3b: arm one journal-backed termination consumer before service startup using agentCtx and the shared confirmer; expose edge tick and join at edge shutdown. No new direct read sites.;rev3=census-ruling-agent-start-demo-1;basis=Passes the existing registry, data store and hibernation prefix into the demo worker, and the existing instance-control client into the demo before-exec hook. No alternate data store or polling loop. Merge resolution against origin/main 9bd45488 retains main's HA departure controller, lifecycle and duty wiring alongside the demo data store and worker; no read site added by the resolution.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: install closed fixed admission before every launch source, bind activator/backend and edge, wire the real termination Started lifecycle and role reader after the change index; close before cancellation/child shutdown. No new external reads or cloud authority. Fix R1: move bind/lifecycle/edge-option wiring into wireAgentAdmission and worker listing into runWorkerBootPassAfterAdmission. Worker boot waits for admission before listing then uses unchanged bounded wakes and per-host serialization; whole Route read moves to the helper. No new storage, cloud, or root execution authority. Preserve merged main's agent wiring and census basis; the branch removes one whole Route use by moving worker iteration to the helper, with no added read kind.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: arms a fleet-only worker using the existing registry, activator, backend and authenticated console transport. Owned worker stops and joins at shutdown. No new bucket reader. merge of origin/main 9b8b2c50: retain HA duty/departure lifecycle, wake-slot and existing agent wiring alongside the replica placement worker; no new read introduced by resolution. merge of origin/main 6be08467: Retain main demo configuration, admission, build and expiry wiring alongside the replica worker; merge-only body change, no additional read. merge of origin/main 7920cccf: Retain main box-role/group admission wiring and boot publication beside the owned replica worker and shutdown; main moves the boot registry List into runWorkerBootPassAfterAdmission, removing its inline whole Route site. No new read introduced by conflict resolution.;rev3=census-ruling-stateless-replicas-3;basis=Task 1 fix round 1 M3: retain the private snapshot source and cancel/join ownership, but use the replica-health-specific retry loop. It logs its first failure only and retains the existing exponential backoff capped at 30 seconds; unsupported builds return nil. Existing five direct read sites unchanged; no new credentials, bucket reader or app lifecycle action. Fix round 1 Q20: publish Edge.ReplicaSnapshots as a separate in-memory status source, leaving the tenant-visible Upstreams source unchanged. No new external reader or authority.;rev3=census-ruling-region-ha-p3b;basis=Load root-written group marker/configuration, configure signed boot binding and agent receipt completer, wire cancellable admission into departure work and expose cached GroupReaderSnapshot. New indirect boot reads use protected root files; agent-owned receipt controls duplicate initial completion only, never root restart permission. Same five direct sites. Merge 45cebde4 retains the replica health socket lifecycle and setReplicaSource beside GroupReaderSnapshot; no extra read beyond main.;rev3=census-ruling-agent-start-demo-2;basis=agent.go:309-329 opens demo-traffic.db beside the operator-configured registry when a demo domain exists, closes it at shutdown and wires drain-before-purge; :1010-1019 shares the worker and write gate; :1164-1177 installs the fleet identity and closed-until-worker serving callback. One added whole Route pass; the new indirect filesystem/SQL reads are claimed in openDemoTraffic and worker/store units. No request chooses the database pathname.;rev3=census-ruling-region-ha-p1b3b-s;basis=Wire the service duty view to authoritative cached sidecar manifest placement in LifetimeIndex and the edge sidecar projection; missing policy denies duty. Existing instance duty wiring remains.;rev3=census-ruling-region-ha-g2-t3;basis=T3a: wire eb.Page = PageOperator beside OwnerTerminated before departures arm, so suspect-holder pages work if departure setup fails; no new read; existing nine sites and authority unchanged; pages through the existing sink. T3b: publish the same backend through an atomic pointer for the metrics observer, and clear it on return; no new external read or authority.;rev3=census-ruling-agent-start-demo-3;basis=Wire the claim activator and root snapshot client into the demo worker; pass moved readiness to status reporting. Census read-site delta: unchanged (9).;rev3=census-ruling-region-ha-g2-fixes;basis=Wire local pool evidence, live withdrawal activator, startup ingress scan and alias publication, and edge lookup; no new direct sites; new indirect record/claim reads use existing store/judge paths described in ingress helpers.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3: starts the existing record-view backstop loop with a departure-inventory listener (non-blocking, coalesced signal) even without an armed RecordView; it requests the existing full pass (backstopFullDue) there. Same nine read sites; no new read or authority.;rev3=census-ruling-region-ha-graceful-terminate-t2;basis=Derive one signal-time deadline with a 90-second budget; cap departure stop and startup/seed/service shutdown joins by it. No read added.;rev3=census-ruling-static-sweep-periodic;basis=in the edge-ready callback, publishes e.LargestStaticTree in staticTreeSource for the disk alert line (diskAlertFrac in the metrics loop); in-memory wiring only, no read added; read sites unchanged (9);rev3=census-ruling-edge-page-cache-1;basis=wires the exec backend's CurrentInputs into the edge cache (wireCurrentInputs) and, in the ready hook after armEdgeAssetCache (whose returned store it now keeps), calls armEdgePageCache, which does nothing unless CARLOS_PAGE_CACHE=1; read sites unchanged (9); no read added;rev3=census-ruling-gvisor-demos;basis=Capture sandbox resolution and refusal once; log errors once; gate route admission and BeforeExec before process launch. No new root read. Task 5: pass the once-captured sandbox effective mode/config error into ExecBackend, UnitBackend and the immutable Client expectation. Same startup environment/registry reads; swapArming declines gVisor before placement. Task 8: arm read-only status projection with the existing Client.SandboxStatus callback. Agent status now queries the existing root /ready endpoint; no new root authority or guest-file input. Merge2 e8a1ddde: retain main wireCurrentInputs and armEdgePageCache through the existing asset-store ready hook alongside branch once-captured sandbox mode, wake gates and root status wiring. No new direct read; main page-cache helpers retain their own census overlays.;rev3=census-ruling-region-ha-held-build;basis=wires the drain state: svc.SetDrainingSource(boxDrain.IsDraining), svc.SetPeerDrainView(e.PeerDraining), e.SetPeerDrainedHook(svc.DropHoldersNaming); in-memory only; no read added; region HA held-requests Task 5: on group members, starts the drain driver over the activator, the edge and boxDrain, and serves its root-only drain socket; no read added beyond the socket's own Branch review r1: the drain state follows the root start fence on group members (the fence reader is the existing fenceLocation.read, a root-owned fixed path); e.SetPeerUndrainedHook(svc.AllowHoldersNaming) beside the drained hook (memory only); the drain socket serves only the agent's own user. No read added.;rev3=census-ruling-security-review-mitigations;basis=Wire the cached operator flat-layout choice into the exec backend's new-resident refusal; no read source added, existing authority retained. file:Exec@20408,file:Open@2191,file:Statfs@52583,registry:App@13287,registry:Host@48605,whole:Route@13279,whole:Route@47011,whole:Route@48728,whole:Route@48790 bd72b307c6393eb4251ede6a4ff52c6d5116f318f55257ab80a8b8370ee2ba35
+internal/host/layoutleg.go mintLayoutIntentWith legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-security-review-mitigations;basis=Mint nested on nested-default, activator-armed, floor-capable boxes while isolation readiness is pending; wake still gates on readiness. Explicit flat and incapable-box compatibility unchanged; same intent/env/registry sources. whole:Route@762 e07b678da489350b4cecbfd4c22e6fcc64c42697b3e0e0c25c54c90fba4d5a8b
+internal/activator/backend_exec.go ExecBackend.residentLayoutRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-security-review-mitigations;basis=New agent-side refusal reads existing Route GoodVersion and ServingVersion and the route's stateless/resident shape; callback reads cached operator choice. No filesystem/store read, no new root action; served legacy residents and explicit flat remain supported. registry:GoodVersion@138,registry:ServingVersion@111,whole:Route@104 19df4cc383c98d67822d92d69ced57514c7d19473ae364afa473f879da829d7c
+internal/provision/reconcile.go RouteFor authority C,E3 rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos); also root, in the claim root's landing registration (ClaimRootHTTP.rootLandingRoute) and the relocation install (relocationRecord): census-ruling-seeded-instances's body with two more fields from the record: the row's lifetime pair (rec.Incarnation, rec.MoveSeq), so a row minted outside a move takes the record's lifetime and its last move's sequence (0, 0 for a fieldless record with no move history); every caller gets it, the root ones included: the root callers (ClaimRootHTTP.rootLandingRoute, relocationRecord) now mint (0, move_seq) on a claims-on record, a non-zero sequence once that record has had an offline move (move_seq advances on claims-on offline moves too), which moves Fingerprint and SnapshotFingerprint once for that row; main's C,E3 authority retained; self-serve moves 1 Task 7 (fix round 1: root callers named);rev3=census-ruling-region-ha-p1a;basis=the agent's reconcile passes, and also root's callers (rootupdates.go, rootinventory_install.go and relocationinstall.go on HEAD): one more field copied from the record, HA: rec.HA, so a row minted from a record stamped HA carries the sticky born-HA mark; the record is the console-written instance record each caller already read; root's own code reads nothing of Route.HA, and Fingerprint does not include it (SnapshotFingerprint does, for a set mark); the same nine sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 2: the row is minted with the record's Runtime (the console-written instance record, guarded by WriteRecord's runtimeFixed); a rootfs row always gets the nested socket and db path under dataDir and no seed or seed source; the paths are computed from the host, not read from the record;rev3=census-ruling-fresh-box-446;basis=#446: a born-HA record mints the nested paths whatever nested says, as a rootfs row already does; same reads;rev3=census-ruling-managed-fleets-1b;basis=managed fleets 1b (Task 2, rule 6): the route also carries Assigned = rec.FleetBoxAt and Moved = rec.FleetBoxMoved, copied from the record it is handed. Read sites unchanged (13). In the agent; in root's claim landing registration (ClaimRootHTTP.rootLandingRoute, shelved claims code) the canonical route gains these two copied fields, which no root check compares (the comparison at rootinventory.go and ValidateAgentInventory read neither). No new input to root.;rev3=census-ruling-agent-start-demo-1;basis=Reads the record descriptor, carries it onto the route, and gives demos nested paths; no new external read.;rev3=census-ruling-stateless-replicas-2;basis=Projects count, canonical boxes, revision, CreatedAt-derived lifetime and stateless hint from the supplied record. No store read; hint does not authorize a database bypass. merge of origin/main 6be08467: Retain main demo nested paths and descriptor stamping beside replica projection; merge-only composition.;rev3=census-ruling-agent-start-demo-3;basis=Translate bound source claim state into operation-owned hold/status and fresh seed state into the destination import gate. Census read-site delta: +registry:HoldOp, +registry:ImportGate, +registry:Seed, +registry:Status.;rev3=census-ruling-edge-page-cache-1;basis=sets the route's new PagesOff from the record (!rec.PagesOn(): true only when the record's optional pages field is present and false); a field of the record it already reads, no new read; also in root's claim landing and relocation install, where the row only carries the column; read sites unchanged (19); no read added;rev3=census-ruling-security-review-mitigations;basis=Read Stateless projected from a validated replica assignment so managed resident copies get nested paths when nested is selected. Canonical path functions only, explicit/external route paths unchanged; authority C,E3 retained. registry:Addr@3259,registry:Addrs@3268,registry:DBPath@1967,registry:DBPath@2755,registry:DBPath@3177,registry:Health@3278,registry:Hibernate@2682,registry:HoldOp@1846,registry:ImportGate@1730,registry:Seed@1771,registry:Seed@3223,registry:SeedSource@3232,registry:Socket@1929,registry:Socket@2717,registry:Socket@3140,registry:Stateless@2698,registry:Status@1835,whole:Route@1666,whole:Route@1692,whole:Route@3316 dec7088b197b904e113d1eefd27a046ff4cd2c920e33126146ef9cbeacad28ef
+internal/activator/backend_exec.go ExecBackend.Start legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-rootfs-apps-2;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=a rootfs row (Runtime) goes through rootfsGates and startRootfsFromLive, never the layout switch; a binary row's path is unchanged; the new kind is registry:Runtime, one site; no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: haSpawnGate(rt) first (+whole:Route), refusing an HA-acquired host whose row is no longer contained; otherwise unchanged; only adds a refusal;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 N1 and Task 7: ctx to the rootfs gates; startRootfsFromLive now returns the staged identity (the version is passed on); a row with a runtime other than rootfs-v1 is refused before the binary path (refuseUnknownRuntime); adds a refusal only;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=passes an empty build to startChildAt's new build argument (the live link, whose build is not pinned); read sites unchanged (14); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: keep main page-cache build argument (empty for the unpinned live link) and branch sandbox gate before dispatch. No new read source.;rev3=census-ruling-security-review-mitigations;basis=Pass the existing route to the new resident-layout refusal before flat exec. Adds whole Route read; only restricts never-served stateless resident launches when flat was not chosen. registry:Host@870,registry:Runtime@360,registry:Socket@1012,registry:Socket@527,registry:Socket@742,whole:Route@1008,whole:Route@119,whole:Route@209,whole:Route@245,whole:Route@313,whole:Route@432,whole:Route@523,whole:Route@607,whole:Route@667,whole:Route@738,whole:Route@927 4f9b02b7e63a04bfdf0e1db8987053dd9398cb4c1217076c63b47b2a952e9bc0
+internal/activator/backend_exec.go ExecBackend.startGenFrom legacy accepted-legacy accepted-legacy;rev3=census-ruling-zddr4;basis=Census ruling zddr4: changed legacy row; the generation socket path is chosen through genLayout on the same row's Host, an over-long flat host is logged and keeps its canonical socket as a foreign row does, and the leftover canonical link is cleared for any spawn on the canonical socket. Boundary: agent-side, running as carlos; generation socket directories under the agent's own /run/carlos tree; no root decision; no registry, /data, release or claim read beyond what the unit read before.;rev3=census-ruling-stateless-replicas-1;basis=Task 3a: Use the verified generation/launch mode to remove CARLOS_DB after environment merges and omit the binary --db argument where applicable. Existing runtime, layout, secrets and exec gates remain; route reads are mode projection only.;rev3=census-ruling-region-ha-p3a;basis=P3a Task 3: add/recheck the local start prohibition on generation, worker, sidecar, command or root-control launch, including retained leases; preserve existing lease/ownership checks and fixed-unit exemptions. Whole Route passes to the in-memory predicate; no new filesystem/store read.;rev3=census-ruling-edge-page-cache-1;basis=keeps the staged identity's Version (id.Version, from the same StagedIdentity it already resolved) as flatBuild and passes it to startChildAt; read sites unchanged (16); no read added;rev3=census-ruling-gvisor-demos;basis=Task 5: gate launch using startup-captured mode and existing route/role/layout before preparation or execution; migrate structured root start identity and reject mismatches. Unsupported gVisor paths refuse; native behavior and existing root authority checks retained. No new root read source. Merge2 e8a1ddde: retain main staged identity Version as flatBuild passed to startChildAt. Keep branch sandbox refusal and gVisor generation-zero selection before preparation. No new read source.;rev3=census-ruling-security-review-mitigations;basis=Apply the same new-resident refusal before flat/foreign generation exec; adds whole Route read, retains all runtime/layout/root/gVisor refusals. registry:Host@1046,registry:Host@1445,registry:Host@2164,registry:Host@2326,registry:Host@741,registry:Host@797,registry:Socket@1581,registry:Socket@2070,registry:Socket@2200,registry:Socket@689,registry:Stateless@2499,whole:Route@1321,whole:Route@1510,whole:Route@193,whole:Route@2388,whole:Route@400,whole:Route@436,whole:Route@676 8b96bd0461bda0267cb57f9b2a068db10aa8b6bcbb0705c4ce7cd4185de13752
@coverage . 90d67141517a28ef8c3b0460712e5d9e176a4a990c3cecb324324a030cb8c9a6
+@coverage internal/activator aa8bf86aa20a379e860ae0d6108567cdd16388764f19a9e9e2489f64e118b35f
+@coverage internal/host fe9701b64f3f99a1d875e1db22ec275734c810442fec4172dd20b36628f56352
+@coverage internal/provision a18e60c5f5e1369c16ffeb3ca53169110ff12c0cf11125d4698bd7f0ebb020b3