carlos / platform Public

fix: managed fleets 2b-2 final review wave

- C1: a launch request that cannot be built on the first dispatch after
  the launching commit (enrolment key changed) releases the quota; a
  recovery call keeps the hold.
- Managed refusal path: once the agent decides it runs on a managed box,
  groupReferenced and the live /etc group marker answer no, so automatic
  updates, the heartbeat and the fleet label survive group configuration
  while workloads stay refused.
- internal/release: NewStaticFilesStore classified as a fleet-bucket
  opener (CI fix).
- Boot script: install shares update's bounded retry (aptr), only install
  waits for the dpkg lock, and the seed request is overwritten before it
  is unlinked; golden regenerated, census re-proposed.
- Opt-in refuses a CARLOS_RELEASE_KEY/CARLOS_RELEASE_PUBKEY mismatch.
- bootstrap_failed show sentence covers any boot setup failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 34d988c80e4b2ab91e31ca78684316a247e2e32e parent 05538e5
19 files changed, +372 −55
  • cmd/console/main.go +12 −1
  • cmd/console/managedfleets_test.go +7 −0
  • docs/superpowers/notes/census-proposal-managed-fleets-2b2.md +4 −2
  • internal/console/managed2b2_test.go +52 −0
  • internal/console/managedview.go +1 −1
  • internal/console/managedworker.go +12 −0
  • internal/host/agent.go +1 −0
  • internal/host/boxreference.go +7 −0
  • internal/host/group_maintenance.go +10 −0
  • internal/host/managed2b2_maintenance_linux_test.go +114 −0
  • internal/host/managedstartup.go +12 −1
  • internal/host/systemleg.go +1 −1
  • internal/managedboot/aptretry_linux_test.go +56 −0
  • internal/managedboot/cloudinit_v1.sh.tmpl +24 −12
  • internal/managedboot/testdata/userdata-v1.golden +24 −12
  • internal/managedboot/userdata_test.go +23 −16
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv +10 −8
  • internal/release/openers_test.go +1 −0
diff --git a/cmd/console/main.go b/cmd/console/main.go
index 0d1e88cbb..45883a2d5 100644
--- a/cmd/console/main.go
+++ b/cmd/console/main.go
@@ -654,6 +654,9 @@ func serve() {
if cfg.ManagedCompute != nil && (cfg.TunnelHost == "" || len(cfg.Key) != ed25519.PrivateKeySize) {
log.Fatal("console: managed fleets are opted in, but the console has no fleet hub host or release signing key") // COPY
}
+ if cfg.ManagedCompute != nil && !cfg.ReleasePub.Equal(cfg.Key.Public()) {
+ log.Fatal("console: managed fleets are opted in, but CARLOS_RELEASE_KEY and CARLOS_RELEASE_PUBKEY are not one key pair") // COPY
+ }
cfg.HADataStores = buildHADataStores(context.Background(), cfg, rec, release.NewS3StoreIn)
srv, err := console.NewServer(cfg, st)
if err != nil {
@@ -1208,9 +1211,17 @@ func managedProvidersFromEnv(ctx context.Context, getenv func(string) string) (c
case release.IsScopedSeed(raw):
return nil, nil, "", errors.New("CARLOS_RELEASE_KEY holds a scoped key. managed boxes accept ready records signed only with the deployment's root key") // COPY
default:
- if _, err := release.ParseSigningKey(raw, "CARLOS_RELEASE_KEY"); err != nil {
+ key, err := release.ParseSigningKey(raw, "CARLOS_RELEASE_KEY")
+ if err != nil {
return nil, nil, "", err
}
+ // Boxes verify each ready record with the public key frozen from
+ // CARLOS_RELEASE_PUBKEY; a record signed with another key would
+ // never admit a box.
+ pub, err := release.ParsePublicKey(getenv("CARLOS_RELEASE_PUBKEY"), "CARLOS_RELEASE_PUBKEY")
+ if err != nil || !pub.Equal(key.Public()) {
+ return nil, nil, "", errors.New("CARLOS_RELEASE_KEY and CARLOS_RELEASE_PUBKEY are not one key pair. managed boxes verify ready records signed with CARLOS_RELEASE_KEY using CARLOS_RELEASE_PUBKEY") // COPY
+ }
}
// Both configurations are checked whole before either constructor runs.
ccfg := awsmanaged.ComputeConfig{Deployment: deployment, AccountID: account, Regions: regions}
diff --git a/cmd/console/managedfleets_test.go b/cmd/console/managedfleets_test.go
index 043b9f1e1..f7f53bb38 100644
--- a/cmd/console/managedfleets_test.go
+++ b/cmd/console/managedfleets_test.go
@@ -3,6 +3,7 @@ package main
import (
"bytes"
"context"
+ "crypto/ed25519"
"encoding/base64"
"path/filepath"
"strings"
@@ -38,6 +39,7 @@ func TestManagedProvidersFromEnv(t *testing.T) {
"CARLOS_MANAGED_FLEET_BOUNDARY": "arn:aws:iam::123456789012:policy/carlos-managed-fleet-boundary",
"CARLOS_TUNNEL_HOST": "tunnel.example.com",
"CARLOS_RELEASE_KEY": base64.StdEncoding.EncodeToString(bytes.Repeat([]byte{7}, 32)),
+ "CARLOS_RELEASE_PUBKEY": base64.StdEncoding.EncodeToString(ed25519.NewKeyFromSeed(bytes.Repeat([]byte{7}, 32)).Public().(ed25519.PublicKey)),
}
env := func(edit map[string]string) func(string) string {
m := map[string]string{}
@@ -108,6 +110,8 @@ func TestManagedProvidersFromEnv(t *testing.T) {
{"hub host with path", "CARLOS_TUNNEL_HOST", "tunnel.example.com/x"},
{"no release key", "CARLOS_RELEASE_KEY", ""},
{"malformed release key", "CARLOS_RELEASE_KEY", "set"},
+ {"no release public key", "CARLOS_RELEASE_PUBKEY", ""},
+ {"another release public key", "CARLOS_RELEASE_PUBKEY", base64.StdEncoding.EncodeToString(ed25519.NewKeyFromSeed(bytes.Repeat([]byte{8}, 32)).Public().(ed25519.PublicKey))},
{"scoped release key", "CARLOS_RELEASE_KEY", "scoped:" + base64.StdEncoding.EncodeToString(bytes.Repeat([]byte{7}, 32))},
{"punycode prefix", "CARLOS_MANAGED_FLEET_BUCKET_PREFIX", "xn--fleet-"},
{"sthree prefix", "CARLOS_MANAGED_FLEET_BUCKET_PREFIX", "sthree-fleet-"},
@@ -122,6 +126,9 @@ func TestManagedProvidersFromEnv(t *testing.T) {
if !strings.Contains(err.Error(), c.key) {
t.Fatalf("error does not name %s: %v", c.key, err)
}
+ if c.key == "CARLOS_RELEASE_PUBKEY" && !strings.Contains(err.Error(), "CARLOS_RELEASE_KEY ") {
+ t.Fatalf("a mismatched pair names only one variable: %v", err)
+ }
})
}
}
diff --git a/docs/superpowers/notes/census-proposal-managed-fleets-2b2.md b/docs/superpowers/notes/census-proposal-managed-fleets-2b2.md
index 981860e82..9ee97f3ca 100644
--- a/docs/superpowers/notes/census-proposal-managed-fleets-2b2.md
+++ b/docs/superpowers/notes/census-proposal-managed-fleets-2b2.md
@@ -10,9 +10,10 @@ Ruling `census-ruling-managed-fleets-2b2`. The independent reviewer approves or
| `internal/host/agent.go` `fastTick` | body | unchanged (1) | calls d.managedReady after the serial read on every tick (nil on BYO, returns at once once admitted); no read of its own added |
| `internal/host/agent.go` `makeStartRoute` | body | unchanged (4) | refuses with errManagedJoining while the armed managedJoin is joining, before any registry read; BYO unchanged |
| `internal/host/agent.go` `runAdoptUnderRootRelease` | body | unchanged (4) | builds managedRootGate("/") (root's RootAdmission: identity + root 0700 admission files, re-verified) and wraps the round-1 start/selected-restart/rollback callbacks, SyncUnits' UnitOps.Restart and named-unit recovery with it; BYO answers admitted, so nothing changes there |
-| `internal/host/agent.go` `runAgent` | body | unchanged (9) | takes RunAgent's one managed/BYO startup decision (decideAgentStartup, made before any fatal group preflight): a managed box gets its join (refused on an identity error or any group configuration: every admission predicate closed, edge/status/probes running, no Fatalf), never reads group configuration and never builds fixedAdmission; a BYO box reads and validates group configuration exactly as on main; binds the join as activator/exec/edge admission; ReconcileConfig.Joining on both provisioning loops; the worker boot pass runs once, at admission; Task 5: appends managedProbeOption(join) to the edge options when it is non-nil (a managed box with a valid root identity); BYO boxes unchanged; no read added |
+| `internal/host/agent.go` `runAgent` | body | unchanged (9) | takes RunAgent's one managed/BYO startup decision (decideAgentStartup, made before any fatal group preflight): a managed box gets its join (refused on an identity error or any group configuration: every admission predicate closed, edge/status/probes running, no Fatalf), never reads group configuration and never builds fixedAdmission; a BYO box reads and validates group configuration exactly as on main; binds the join as activator/exec/edge admission; ReconcileConfig.Joining on both provisioning loops; the worker boot pass runs once, at admission; Task 5: appends managedProbeOption(join) to the edge options when it is non-nil (a managed box with a valid root identity); BYO boxes unchanged; no read added; final wave: when runAgent makes the startup decision itself it also arms it (armedAgentStartup), as RunAgent does, so later group-configuration consumers follow it; no read added |
| `internal/host/agent.go` `statusTick` | body | unchanged (4) | after the label override, sets box.ManagedKey = managedKeyHeartbeat(): the code from root's /etc/carlos/managed-key-status.json read through managedboot.LoadKeyStatus (O_NOFOLLOW walk, every component root-owned and not g/o writable, regular nlink 1, 1 KiB cap, canonical known code only, else status_unreadable); a value copied into the bucket-private heartbeat, nothing root decides on; no other read added |
| `internal/host/bootstrap.go` `bootstrapWithGroup` | body | unchanged (3) | on the live root, or a staging root holding a valid managed identity, gates the unit set it is about to write (managedGateUnits: root-owned admission drop-ins for every non-maintenance unit and the declared named units via the trusted mb* walk, control drop-in, daemon-reload when live) before writing any unit file; any failure fails the bootstrap; BYO no-op |
+| `internal/host/group_maintenance.go` `groupMarkerPresent` | body | unchanged (1) | final wave: in an agent that decided managed at its entry (agentManaged, an in-memory flag), the live /etc (liveEtc, "/etc" in production, a test seam) marker answers absent without the lstat, so automatic updates stay armed on a refused managed box; any other etc root, and every BYO or non-agent caller, still lstats /etc/carlos/group.json exactly as before; no read added |
| `internal/host/namedrecovery.go` `type namedUnitRecovery` | body | unchanged (0) | adds the gate field (managedRootGate on the root pass); data only |
| `internal/host/systemapply.go` `systemApplier.installUnits` | body | unchanged (6) | before publishing the target build's staged units, gates them (every staged non-maintenance unit, a new template included, beside this binary's units and the declared named units) via managedGateEtc and daemon-reload; any failure fails the apply with no unit published; BYO no-op |
| `internal/host/systemunits.go` `ensureSystemUnitsWithGuard` | body | unchanged (5) | under the apply lock and before any write, reload, enable or start: on a managed box gates this binary's unit set and the declared named units (trusted mb* walk) with root-owned admission and control drop-ins via managedGateEtc, recording an owed control restart in root's /run before rewriting the control drop-in, then daemon-reload; any failure returns before any unit is published; after a successful reload pays an owed control restart (try-restart; the record is cleared only on success, so a failed reload or restart is retried next pass); BYO no-op |
@@ -40,6 +41,7 @@ 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)
- `internal/host/agent.go` `statusTick`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-regional-box-names;basis=after the label override, sets box.Name = status.DisplayName(box.Label, p.NameRegion) when NameRegion is set; a pure hash over the label; no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 7 (ruling 5a): sets p.AliasesRead false, then true only when the existing reg.ListAliases succeeds, so the heartbeat tells no alias rows from a failed read; the caller's value is never trusted; no read added
- `internal/host/bootstrap.go` `bootstrapWithGroup`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.
+- `internal/host/group_maintenance.go` `groupMarkerPresent`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Lstat /etc/carlos/group.json (or test etc root); anything except absence selects strict group maintenance validation. Root boot writes marker, flags cannot bypass it and unreadable/linked marker cannot authorize fixed behavior.
- `internal/host/namedrecovery.go` `type namedUnitRecovery`: authority, task E1. Basis: E13: signed recovery allows unknown history but preserves usable refusals, including retained originals; verified later promotion clears only D1. Health recording is independent of program recording; minting requires a census. Fixtures: TestPlan14RecoveryUnknownHistory, TestPlan14RecoveryKnownRefusal, TestPlan14RecoveryOriginalRefusalWithUnknownHistory, TestPlan14RootHistoryVerifiedRetryBeforeAttempt, TestPlan14ProgramFailureStillRecordsHealth, TestPlan14RootHistoryMintCensus.
- `internal/host/systemapply.go` `systemApplier.installUnits`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.
- `internal/host/systemunits.go` `ensureSystemUnitsWithGuard`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move unit-repair body here with existing lock/unit/host.env reads; under lock require operator repair permit on groups before writes and each systemctl effect, preserve root masks/drop-in and omit automatic update/recovery units. New indirect protected marker/permit reads, never agent receipt; fixed repair unchanged.
@@ -94,6 +96,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/managedboot/identity_linux.go:readRootOwned`: reads +file:Fstat, +file:Open, +file:Openat, +file:ReadAll; written legacy, accepted-legacy, frozen
- new `internal/managedboot/probe.go:NewProbeNonce`: reads +file:Read; written legacy, accepted-legacy, frozen
-Seal: `d467adec3d86ae220afe98269aa226e87adba1b83e31eda214ceea0f02720a98` → `7089262868ee0374b735584e5ce394688fcf7e6d067be938dc6373dc3d703b40`.
+Seal: `d467adec3d86ae220afe98269aa226e87adba1b83e31eda214ceea0f02720a98` → `27e1c6e748b2b2cbdd43e9db34e9ad54eb4f234cdac9f5cd7f295a81813b3dd5`.
Overlay: `internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/console/managed2b2_test.go b/internal/console/managed2b2_test.go
index 190555d46..f1ff95713 100644
--- a/internal/console/managed2b2_test.go
+++ b/internal/console/managed2b2_test.go
@@ -850,3 +850,55 @@ func TestManaged2B2KeepKeyInactive(t *testing.T) {
t.Fatalf("not cleared: %+v", out)
}
}
+
+// TestManaged2B2LaunchPreparationAfterCommit (final wave, Astra P1-1): the
+// launching commit is durable, then the enrolment key changes before the
+// first dispatch can build its request. Nothing was ever dispatched, so
+// the box ends terminated with its reason and the quota is released; no
+// cleanup polls for it. On a recovery call the same failure keeps the
+// conservative hold.
+func TestManaged2B2LaunchPreparationAfterCommit(t *testing.T) {
+ for _, first := range []bool{true, false} {
+ t.Run(fmt.Sprint("first=", first), func(t *testing.T) {
+ s, p, b, now := managedWorkerFixture(t)
+ b = workerAdvance(t, s, b, func(b *managedBox) {
+ b.State = "launching"
+ b.LaunchStartedAt = now
+ b.EnrolExpires = now.Add(30 * time.Minute)
+ b.Boot = managedExpectedBoot(s, "v0.34.0", managedTestSeed)
+ })
+ if _, err := s.managedLaunchRequest(b); err != nil {
+ t.Fatal("request did not validate at the commit:", err)
+ }
+ // The key changes between the commit and the dispatch.
+ if err := os.Remove(s.cfg.AlertSealKeyPath); err != nil {
+ t.Fatal(err)
+ }
+ unlock := s.lockFleet(b.Fleet)
+ err := s.launchManagedBox(context.Background(), b, now, first)
+ unlock()
+ if err != nil {
+ t.Fatal(err)
+ }
+ b = workerBox(t, s)
+ if p.Calls()["Launch"] != 0 {
+ t.Fatal("dispatched", p.Calls())
+ }
+ if !first {
+ if b.State != "failed" || managedHeld(t, s) != 1 {
+ t.Fatalf("recovery released quota: %+v", b)
+ }
+ return
+ }
+ if b.State != "terminated" || b.LastError != errManagedEnrolKeyChanged.Error() || managedHeld(t, s) != 0 {
+ t.Fatalf("first dispatch: %s %q held %d", b.State, b.LastError, managedHeld(t, s))
+ }
+ for i := 1; i <= 3; i++ {
+ workerStep(t, s, now.Add(time.Duration(i)*time.Hour))
+ }
+ if c := p.Calls(); c["Find"] != 0 || c["Launch"] != 0 || c["Terminate"] != 0 {
+ t.Fatal("terminated box polled", c)
+ }
+ })
+ }
+}
diff --git a/internal/console/managedview.go b/internal/console/managedview.go
index 6044fea83..858790abb 100644
--- a/internal/console/managedview.go
+++ b/internal/console/managedview.go
@@ -213,5 +213,5 @@ var managedBootText = map[string]string{
managedboot.CodeEnrolFailed: "the box could not enrol with the console", // COPY
managedboot.CodeStableVerified: "the box installed the current release but did not start joining", // COPY
managedboot.CodeJoining: "the box started joining its fleet but did not pass its readiness checks", // COPY
- managedboot.CodeBootstrapFailed: "the box could not verify or install its release", // COPY
+ managedboot.CodeBootstrapFailed: "the box's boot setup failed before it could join its fleet", // COPY
}
diff --git a/internal/console/managedworker.go b/internal/console/managedworker.go
index cde26f3f9..cab18bace 100644
--- a/internal/console/managedworker.go
+++ b/internal/console/managedworker.go
@@ -559,7 +559,19 @@ func (s *Server) findManagedBox(ctx context.Context, b managedBox) ([]compute.In
// token conflict, leaves quota held for identity-checked cleanup.
func (s *Server) launchManagedBox(ctx context.Context, b managedBox, now time.Time, firstDispatch bool) error {
spec, err := s.managedLaunchRequest(b)
+ if err != nil && firstDispatch {
+ // The request could not even be built (the enrolment key changed
+ // or became unreadable since the launching commit): nothing was
+ // dispatched and nothing came before, so, as for ErrLaunchNotSent,
+ // no instance can exist and the quota is released.
+ next := b
+ next.State = "terminated"
+ next.LastError = managedLaunchRefusal(err)
+ return s.saveManagedBox(ctx, b, next, now)
+ }
if err != nil {
+ // A recovery call: an earlier dispatch may have landed, so the box
+ // fails and quota stays held for identity-checked cleanup.
return s.failManagedBoxHeld(ctx, b, managedLaunchRefusal(err), now)
}
if s.cfg.ManagedCompute == nil {
diff --git a/internal/host/agent.go b/internal/host/agent.go
index f1aeac0f8..8408a7129 100644
--- a/internal/host/agent.go
+++ b/internal/host/agent.go
@@ -285,6 +285,7 @@ func runAgent(args []string, buildClaims ClaimFactory) {
log.Fatal(err)
}
startup = &s
+ armedAgentStartup.Store(startup)
}
join := startup.join
var groupBoot *hostenv.GroupConfig
diff --git a/internal/host/boxreference.go b/internal/host/boxreference.go
index 7dce6ce52..0c0516558 100644
--- a/internal/host/boxreference.go
+++ b/internal/host/boxreference.go
@@ -31,7 +31,14 @@ import (
// its status key exactly as before.
// groupReferenced reports whether this box takes its group reference.
+// Once this agent has decided it runs on a managed box (agentManaged),
+// the answer is no for every consumer: a managed box never takes a group
+// reference, so its status, metrics and update legs keep its fleet
+// identity while the refused join keeps workloads closed.
func groupReferenced(getenv func(string) string) bool {
+ if agentManaged() {
+ return false
+ }
return strings.TrimSpace(getenv(hostenv.BoxReference)) == hostenv.GroupReference
}
diff --git a/internal/host/group_maintenance.go b/internal/host/group_maintenance.go
index 15b5cfe21..5d903c776 100644
--- a/internal/host/group_maintenance.go
+++ b/internal/host/group_maintenance.go
@@ -61,9 +61,19 @@ func (a *systemApplier) maintenance() *groupMaintenance {
return a.groupMaintenance
}
+// liveEtc is the box's own /etc as the agent's legs name it; a test seam.
+var liveEtc = "/etc"
+
// Lstat first preserves fixed-box behavior in staging trees. Any present or
// unreadable marker requires the strict reader; a flag cannot turn it off.
+//
+// In an agent that decided it runs on a managed box, the live /etc's
+// marker is not group configuration it acts on (agentManaged): the entry
+// decision already refused workloads for it.
func groupMarkerPresent(etc string) bool {
+ if agentManaged() && filepath.Clean(etc) == liveEtc {
+ return false
+ }
_, err := os.Lstat(filepath.Join(etc, "carlos", "group.json"))
return !errors.Is(err, os.ErrNotExist)
}
diff --git a/internal/host/managed2b2_maintenance_linux_test.go b/internal/host/managed2b2_maintenance_linux_test.go
new file mode 100644
index 000000000..983f8e0b9
--- /dev/null
+++ b/internal/host/managed2b2_maintenance_linux_test.go
@@ -0,0 +1,114 @@
+//go:build linux
+
+package host
+
+import (
+ "context"
+ "encoding/json"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/carlosframework/platform/internal/activator"
+ "github.com/carlosframework/platform/internal/hostenv"
+ "github.com/carlosframework/platform/internal/registry"
+ "github.com/carlosframework/platform/internal/release"
+ "github.com/carlosframework/platform/internal/status"
+)
+
+// TestManagedRefusedKeepsMaintenance (final wave, Astra P2-1): a managed box
+// whose host.env also says CARLOS_BOX_REFERENCE=group takes the refused
+// path at the agent's one decision. Every later consumer follows that
+// decision: automatic updates stay armed, the heartbeat and metrics label
+// are the fleet label (no group identity resolution), and workloads stay
+// refused. The same environment on a BYO box keeps group behaviour.
+func TestManagedRefusedKeepsMaintenance(t *testing.T) {
+ f := newJoinFixture(t)
+ env := map[string]string{
+ hostenv.BoxReference: hostenv.GroupReference,
+ "CARLOS_FLEET": f.m.ID.Fleet,
+ "CARLOS_FLEET_BOX": f.m.ID.Label,
+ }
+ getenv := func(k string) string { return env[k] }
+ resolved := 0
+ prevIdentity := groupIdentity
+ groupIdentity = func() (string, string, error) { resolved++; return "", "", errNoGroupReference }
+ t.Cleanup(func() { groupIdentity = prevIdentity })
+ // The box's live /etc carries a group marker too.
+ etc := t.TempDir()
+ if err := os.MkdirAll(filepath.Join(etc, "carlos"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(etc, "carlos", "group.json"), []byte("{}"), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ prevEtc := liveEtc
+ liveEtc = etc
+ t.Cleanup(func() { liveEtc = prevEtc })
+ prevArmed := armedAgentStartup.Load()
+ t.Cleanup(func() { armedAgentStartup.Store(prevArmed) })
+
+ // BYO first: group reference consumers act as before.
+ armedAgentStartup.Store(&agentStartup{})
+ if newSystemLeg(nil, nil, getenv, t.TempDir(), t.TempDir()) != nil {
+ t.Fatal("BYO group box armed automatic updates")
+ }
+ if !groupReferenced(getenv) {
+ t.Fatal("BYO group reference ignored")
+ }
+ byoEnv := func(string) string { return "" }
+ if newSystemLeg(nil, nil, byoEnv, t.TempDir(), t.TempDir()) != nil || !groupMarkerPresent(liveEtc) {
+ t.Fatal("BYO group marker ignored")
+ }
+
+ // Managed: the entry decision refuses the join for the group setting.
+ startup, err := decideAgentStartup(f.m.Root, f.m.Path("etc/carlos/group.json"), getenv, f.door, f.logf)
+ if err != nil || startup.join == nil || !startup.join.refused {
+ t.Fatalf("decision: %+v %v", startup, err)
+ }
+ armedAgentStartup.Store(&startup)
+
+ // Updates stay on, for the reference and for the marker. Other etc
+ // roots (staging trees, the root apply) are unaffected.
+ if newSystemLeg(nil, nil, getenv, t.TempDir(), t.TempDir()) == nil || groupMarkerPresent(liveEtc) {
+ t.Fatal("automatic updates off on a managed box with group configuration")
+ }
+ staging := t.TempDir()
+ if err := os.MkdirAll(filepath.Join(staging, "carlos"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(staging, "carlos", "group.json"), []byte("{}"), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ if !groupMarkerPresent(staging) {
+ t.Fatal("another etc root's marker ignored")
+ }
+ // The heartbeat publishes under the fleet label, with no group identity
+ // resolution.
+ s := release.NewDirStore(t.TempDir())
+ reg := openTestRegistry(t)
+ if err := groupStatusTick(context.Background(), s, reg, status.Probes{MachineID: "m"}, false, f.m.ID.Label, getenv); err != nil {
+ t.Fatalf("heartbeat: %v", err)
+ }
+ if resolved != 0 {
+ t.Fatal("resolved a group identity on a managed box")
+ }
+ raw, _, err := s.Get(context.Background(), "status/boxes/"+f.m.ID.Label+".json")
+ if err != nil {
+ t.Fatalf("heartbeat not published under the fleet label: %v", err)
+ }
+ var beat status.Box
+ if json.Unmarshal(raw, &beat) != nil || beat.Label != f.m.ID.Label {
+ t.Fatalf("heartbeat label %q", beat.Label)
+ }
+ if got := metricsBoxLabel(getenv, "m"); got != f.m.ID.Label {
+ t.Fatalf("metrics label %q", got)
+ }
+ // Workloads stay refused.
+ svc, eb := &activator.Service{}, &activator.ExecBackend{}
+ startup.join.bind(svc, eb)
+ rt := registry.Route{Host: "shop.example.com", Kind: "instance"}
+ if !startup.join.Joining() || svc.TenantAdmitted() || eb.TenantStartAllowed(rt) {
+ t.Fatal("the refused path opened a workload predicate")
+ }
+}
diff --git a/internal/host/managedstartup.go b/internal/host/managedstartup.go
index 176f482c3..897ba2ed0 100644
--- a/internal/host/managedstartup.go
+++ b/internal/host/managedstartup.go
@@ -25,6 +25,16 @@ type agentStartup struct {
// armedAgentStartup carries RunAgent's decision into runAgent.
var armedAgentStartup atomic.Pointer[agentStartup]
+// agentManaged reports whether this agent process decided, at its entry,
+// that it runs on a managed box. Group-configuration consumers ask it so
+// the one decision governs them as well (groupReferenced,
+// groupMarkerPresent): on a managed box any group configuration is the
+// refused path's business alone. False outside the agent (no decision).
+func agentManaged() bool {
+ s := armedAgentStartup.Load()
+ return s != nil && s.join != nil
+}
+
// decideAgentStartup is that decision for the box at root, with the group
// marker at marker. An error is BYO group preflight's, which the caller
// treats as fatal exactly as before; a managed box never returns one.
@@ -55,7 +65,8 @@ func managedGroupConfiguration(getenv func(string) string, marker string) string
if _, err := os.Lstat(marker); !errors.Is(err, fs.ErrNotExist) {
found = append(found, "a group marker at "+marker)
}
- if groupReferenced(getenv) {
+ // The raw value, not groupReferenced: this is the decision itself.
+ if strings.TrimSpace(getenv(hostenv.BoxReference)) == hostenv.GroupReference {
found = append(found, hostenv.BoxReference+"="+hostenv.GroupReference)
}
if getenv("CARLOS_GROUP_ADMISSION") == "1" {
diff --git a/internal/host/systemleg.go b/internal/host/systemleg.go
index c3e08c435..307811426 100644
--- a/internal/host/systemleg.go
+++ b/internal/host/systemleg.go
@@ -78,7 +78,7 @@ type systemPending struct {
const systemObserveEvery = time.Hour
func newSystemLeg(store release.Store, pub ed25519.PublicKey, getenv func(string) string, dataDir, optDir string) *systemLeg {
- if groupReferenced(getenv) || groupMarkerPresent("/etc") {
+ if groupReferenced(getenv) || groupMarkerPresent(liveEtc) {
return nil
}
return systemLegForPreparation(store, pub, getenv, dataDir, optDir)
diff --git a/internal/managedboot/aptretry_linux_test.go b/internal/managedboot/aptretry_linux_test.go
new file mode 100644
index 000000000..6ce1d68f7
--- /dev/null
+++ b/internal/managedboot/aptretry_linux_test.go
@@ -0,0 +1,56 @@
+//go:build linux
+
+package managedboot
+
+import (
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "testing"
+)
+
+// TestManagedUserDataAptRetry runs the rendered script's aptr against a fake
+// apt-get: install (like update) recovers after failed tries, and after the
+// twelfth failure the script exits with apt's own status and runs nothing
+// after it.
+func TestManagedUserDataAptRetry(t *testing.T) {
+ script, err := RenderUserData(goldenInput())
+ if err != nil {
+ t.Fatal(err)
+ }
+ i := strings.Index(script, "aptr() {\n")
+ j := strings.Index(script[i:], "\n}\n")
+ if i < 0 || j < 0 {
+ t.Fatal("no aptr in the script")
+ }
+ aptr := script[i : i+j+3]
+ for _, c := range []struct {
+ fails, tries int
+ status string
+ }{{2, 3, "0"}, {11, 12, "0"}, {12, 12, "100"}} {
+ dir := t.TempDir()
+ count := filepath.Join(dir, "count")
+ fake := "#!/bin/sh\nn=$(cat " + count + " 2>/dev/null || echo 0)\nn=$((n+1))\necho $n > " + count + "\n[ $n -gt " + strconv.Itoa(c.fails) + " ] && exit 0\nexit 100\n"
+ if err := os.WriteFile(filepath.Join(dir, "apt-get"), []byte(fake), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ body := "set -eu\nsleep() { :; }\n" + aptr + "aptr -y -q -o DPkg::Lock::Timeout=120 install nftables\necho after\n"
+ cmd := exec.Command("/bin/sh", "-c", body)
+ cmd.Env = []string{"PATH=" + dir + ":/usr/bin:/bin"}
+ out, err := cmd.CombinedOutput()
+ status := "0"
+ if ee, ok := err.(*exec.ExitError); ok {
+ status = strconv.Itoa(ee.ExitCode())
+ } else if err != nil {
+ t.Fatal(err)
+ }
+ raw, _ := os.ReadFile(count)
+ tries, _ := strconv.Atoi(strings.TrimSpace(string(raw)))
+ ran := strings.Contains(string(out), "after")
+ if status != c.status || tries != c.tries || ran != (c.status == "0") {
+ t.Fatalf("%d failures: status %s, %d tries, ran after %v (%s)", c.fails, status, tries, ran, out)
+ }
+ }
+}
diff --git a/internal/managedboot/cloudinit_v1.sh.tmpl b/internal/managedboot/cloudinit_v1.sh.tmpl
index 739830443..0eb3d5a5f 100644
--- a/internal/managedboot/cloudinit_v1.sh.tmpl
+++ b/internal/managedboot/cloudinit_v1.sh.tmpl
@@ -73,17 +73,23 @@ C=$(sed -n 's/^VERSION_CODENAME=//p' "$R/etc/os-release")
case $C in ''|*[!a-z]*) fail 'no distribution codename' ;; esac
K='[signed-by=/usr/share/keyrings/debian-archive-keyring.gpg]'
printf 'deb %s https://deb.debian.org/debian %s main\ndeb %s https://deb.debian.org/debian %s-updates main\ndeb %s https://deb.debian.org/debian-security %s-security main\n' "$K" "$C" "$K" "$C" "$K" "$C" | put /var/lib/carlos-managed-boot/sources.list 600
-# The lists lock is not covered by DPkg::Lock::Timeout: retry update for about two minutes.
-n=1
-while :; do
- r=0
- apt-get -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null update || r=$?
- [ "$r" -eq 0 ] && break
- [ "$n" -lt 12 ] || exit "$r"
- n=$((n+1))
- sleep 10
-done
-apt-get -y -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null install nftables curl ca-certificates python3
+# aptr: apt-get, tried up to 12 times 10 s apart, failing with apt's own
+# status after the last try. At first boot apt-daily or unattended-upgrades
+# may hold the lists lock (update; DPkg::Lock::Timeout does not cover it)
+# or the dpkg lock (install waits up to 120 s for it on each try).
+aptr() {
+ n=1
+ while :; do
+ r=0
+ apt-get "$@" || r=$?
+ [ "$r" -eq 0 ] && return 0
+ [ "$n" -lt 12 ] || exit "$r"
+ n=$((n+1))
+ sleep 10
+ done
+}
+aptr -q -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null update
+aptr -y -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null install nftables curl ca-certificates python3
id -u carlos >/dev/null 2>&1 || useradd --system --user-group --no-create-home --shell /usr/sbin/nologin carlos
U=$(id -u carlos)
case $U in ''|*[!0-9]*) fail 'no service uid' ;; esac
@@ -185,7 +191,13 @@ os.rename(w + "/seed.part", w + "/seed")
d = os.open(w, os.O_RDONLY | os.O_DIRECTORY)
os.fsync(d)
os.close(d)' "$B"
-rm -f "$B/seed-request.json"
+# The token's request body is overwritten in place before it is unlinked.
+python3 -I -c 'import os, sys
+f = os.open(sys.argv[1], os.O_WRONLY | os.O_NOFOLLOW)
+os.write(f, bytes(os.fstat(f).st_size))
+os.fsync(f)
+os.close(f)
+os.unlink(sys.argv[1])' "$B/seed-request.json"
crumb seed_verified
put /etc/systemd/system/carlos-managed-boot.service 644 <<'UNIT'
diff --git a/internal/managedboot/testdata/userdata-v1.golden b/internal/managedboot/testdata/userdata-v1.golden
index 795c7d23f..191d3ec40 100644
--- a/internal/managedboot/testdata/userdata-v1.golden
+++ b/internal/managedboot/testdata/userdata-v1.golden
@@ -73,17 +73,23 @@ C=$(sed -n 's/^VERSION_CODENAME=//p' "$R/etc/os-release")
case $C in ''|*[!a-z]*) fail 'no distribution codename' ;; esac
K='[signed-by=/usr/share/keyrings/debian-archive-keyring.gpg]'
printf 'deb %s https://deb.debian.org/debian %s main\ndeb %s https://deb.debian.org/debian %s-updates main\ndeb %s https://deb.debian.org/debian-security %s-security main\n' "$K" "$C" "$K" "$C" "$K" "$C" | put /var/lib/carlos-managed-boot/sources.list 600
-# The lists lock is not covered by DPkg::Lock::Timeout: retry update for about two minutes.
-n=1
-while :; do
- r=0
- apt-get -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null update || r=$?
- [ "$r" -eq 0 ] && break
- [ "$n" -lt 12 ] || exit "$r"
- n=$((n+1))
- sleep 10
-done
-apt-get -y -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null install nftables curl ca-certificates python3
+# aptr: apt-get, tried up to 12 times 10 s apart, failing with apt's own
+# status after the last try. At first boot apt-daily or unattended-upgrades
+# may hold the lists lock (update; DPkg::Lock::Timeout does not cover it)
+# or the dpkg lock (install waits up to 120 s for it on each try).
+aptr() {
+ n=1
+ while :; do
+ r=0
+ apt-get "$@" || r=$?
+ [ "$r" -eq 0 ] && return 0
+ [ "$n" -lt 12 ] || exit "$r"
+ n=$((n+1))
+ sleep 10
+ done
+}
+aptr -q -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null update
+aptr -y -q -o DPkg::Lock::Timeout=120 -o Dir::Etc::SourceList="$B/sources.list" -o Dir::Etc::SourceParts=/dev/null install nftables curl ca-certificates python3
id -u carlos >/dev/null 2>&1 || useradd --system --user-group --no-create-home --shell /usr/sbin/nologin carlos
U=$(id -u carlos)
case $U in ''|*[!0-9]*) fail 'no service uid' ;; esac
@@ -185,7 +191,13 @@ os.rename(w + "/seed.part", w + "/seed")
d = os.open(w, os.O_RDONLY | os.O_DIRECTORY)
os.fsync(d)
os.close(d)' "$B"
-rm -f "$B/seed-request.json"
+# The token's request body is overwritten in place before it is unlinked.
+python3 -I -c 'import os, sys
+f = os.open(sys.argv[1], os.O_WRONLY | os.O_NOFOLLOW)
+os.write(f, bytes(os.fstat(f).st_size))
+os.fsync(f)
+os.close(f)
+os.unlink(sys.argv[1])' "$B/seed-request.json"
crumb seed_verified
put /etc/systemd/system/carlos-managed-boot.service 644 <<'UNIT'
diff --git a/internal/managedboot/userdata_test.go b/internal/managedboot/userdata_test.go
index 9d54ab20f..786d0de67 100644
--- a/internal/managedboot/userdata_test.go
+++ b/internal/managedboot/userdata_test.go
@@ -294,28 +294,35 @@ func TestManagedUserDataAptWaitsForDpkgLock(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- var seen int
+ // Both apt-get calls go through aptr, the one bounded retry (12 tries,
+ // 10 s apart, apt's own status after the last); only install carries
+ // DPkg::Lock::Timeout, the option that waits for the dpkg lock.
+ var update, install, direct int
for _, line := range strings.Split(got, "\n") {
- if !strings.Contains(line, "apt-get ") {
- continue
- }
- seen++
- if !strings.Contains(line, " -o DPkg::Lock::Timeout=120 ") {
- t.Fatalf("apt-get line has no dpkg lock timeout: %s", line)
+ switch {
+ case strings.HasPrefix(line, "aptr ") && strings.HasSuffix(line, " update"):
+ update++
+ if strings.Contains(line, "Lock::Timeout") {
+ t.Fatalf("update carries a dpkg lock timeout: %s", line)
+ }
+ case strings.HasPrefix(line, "aptr ") && strings.Contains(line, " install "):
+ install++
+ if !strings.Contains(line, " -o DPkg::Lock::Timeout=120 ") {
+ t.Fatalf("install has no dpkg lock timeout: %s", line)
+ }
+ case strings.Contains(line, "apt-get ") && strings.TrimSpace(line) != `apt-get "$@" || r=$?`:
+ direct++
}
}
- if seen != 2 {
- t.Fatalf("found %d apt-get lines, want 2", seen)
+ if update != 1 || install != 1 || direct != 0 {
+ t.Fatalf("apt calls: %d update, %d install, %d outside the retry", update, install, direct)
}
- // apt-get update also takes the lists lock, which the option does not
- // cover: it runs in a bounded retry (12 attempts, 10 s apart) that still
- // fails with apt's own status after the last one.
- for _, want := range []string{"n=1\nwhile :; do\n", `[ "$n" -lt 12 ] || exit "$r"`, "sleep 10\ndone\n"} {
+ for _, want := range []string{"aptr() {\n n=1\n while :; do\n", ` apt-get "$@" || r=$?`, ` [ "$n" -lt 12 ] || exit "$r"`, " sleep 10\n done\n}\n"} {
if strings.Count(got, want) != 1 {
- t.Fatalf("apt-get update retry: want exactly one %q", want)
+ t.Fatalf("apt retry: want exactly one %q", want)
}
}
- if i, j := strings.Index(got, "while :; do"), strings.Index(got, " update || r=$?"); i < 0 || j < i {
- t.Fatal("apt-get update is not inside the retry loop")
+ if i, j, k := strings.Index(got, "aptr() {"), strings.Index(got, "aptr -q "), strings.Index(got, "aptr -y "); i < 0 || j < i || k < j {
+ t.Fatal("aptr is not defined before update, or install runs before update")
}
}
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 13a93f24f..0affafcd9 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -131,4 +131,4 @@ plan14-root-reads-instance-restore-658-cli.tsv b970bb28c5a633d2572a1da549030e925
plan14-root-reads-instance-stop-execstop-528.tsv 75fb3eb24d0bf3a8405b929675d919ec88f15386d43e9ff687ce138a7ed968a4
plan14-root-reads-region-ha-shutting-down-retry.tsv 75fb3eb24d0bf3a8405b929675d919ec88f15386d43e9ff687ce138a7ed968a4
plan14-root-reads-managed-fleets-2b1.tsv d467adec3d86ae220afe98269aa226e87adba1b83e31eda214ceea0f02720a98
-plan14-root-reads-managed-fleets-2b2.tsv 7089262868ee0374b735584e5ce394688fcf7e6d067be938dc6373dc3d703b40
+plan14-root-reads-managed-fleets-2b2.tsv 27e1c6e748b2b2cbdd43e9db34e9ad54eb4f234cdac9f5cd7f295a81813b3dd5
diff --git a/internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv b/internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv
index 4ce8c1b35..f81ba4d7f 100644
--- a/internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv
+++ b/internal/provision/testdata/plan14-root-reads-managed-fleets-2b2.tsv
@@ -1,11 +1,12 @@
# Census overlay managed-fleets-2b2, written by census-propose (#369). census-ruling-managed-fleets-2b2, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-managed-fleets-2b2.md.
-# 19 body, 1 sites, 10 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
+# 20 body, 1 sites, 10 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 39 new dispositions: 0 reads re-frozen at their disposition with the claim, 39 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy ef2d486cee8f5b85306909f4ca554e8e9e89b74f0c5baa6336351d74588e2f0b internal/edge/demo_traffic.go Edge.serveDemoTraffic legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:128-334 reads the resolved Route and passes it to existing admission, metering, rate and activator helpers. Resident serving checks precede the inert moved hook (:143), retirement and durable request debit (:302); output debits use the writer below compression. Forwarders do not count or transform again. Existing expiry/control cancellations and five-second write bounds apply; no request-path console or bucket read.;rev3=census-ruling-managed-fleets-2b2;basis=adds tunnelclient.ManagedProbeHeader and X-Carlos-Probe-Channel to the header names it deletes from a demo request before forwarding; no read added, read sites unchanged registry:App@2685,registry:DemoExpiresAt@1420,whole:Route@1119,whole:Route@1423,whole:Route@1562,whole:Route@1649,whole:Route@1772,whole:Route@223,whole:Route@2296,whole:Route@2612,whole:Route@2677,whole:Route@2688,whole:Route@2774,whole:Route@2870,whole:Route@2944,whole:Route@2991,whole:Route@3049,whole:Route@3078,whole:Route@3297,whole:Route@3328,whole:Route@3360,whole:Route@3733,whole:Route@375,whole:Route@4397,whole:Route@4447,whole:Route@4499,whole:Route@454,whole:Route@4738,whole:Route@5503,whole:Route@6046,whole:Route@6470 b63349fa62442d4d0d935b0582c276c8fcf16ebddfd1cec5cc314f1da51297ba
@legacy 840903353a992e939dbeddb6a632d461110560b9474523f064993cbdf633122e internal/edge/edge.go Edge.ServeHTTP legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the edge inside the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with the import gate checked after the door's scope and a gated row left out of the response cache; serving only;rev3=census-ruling-edge-request-records;basis=one more call in the observer defer, observeRecords(up.route, ...), passing on the route the defer already holds; no new kind of read;rev3=census-ruling-design-edge-rate-limit-358;basis=calls rateAdmit twice, and an admitted request holds a slot on both paths: on the upgrade path before the activator or proxy (the handshake holds its slot through slotWriter, given back at the first final answer or at the reverse proxy's hijack on a 101, so an open WebSocket is not counted; released by a defer), and on the ordinary path after the response-cache check and before the activator and proxy (an admitted request holds a slot through slotWriter, released by a defer); a refusal is a 429 written there and returns; the upgrade path's comment now names slotWriter as its one wrapper; one comment on the door mark reworded; read sites unchanged (22: main's 21 plus edge-request-records' observeRecords pass of the route), offsets moved; no read added;rev3=census-ruling-plans-4c-box-throttle;basis=calls planThrottleAdmit before the response cache, and on an upgrade trackUpgrade then planUpgradeAdmit (plans 4c, Astra findings 1 and 2); the new reads live in those units (plans-4c-units decision). The same read sites here.;rev3=census-ruling-plans-4d-lapse;basis=calls planDisabledAdmit right after the import gate, passing the final upstream's route and the request host; a turned-off route gets the fixed disabled page before the meter, gate, cache and activator (plans 4d). The new read lives in that unit (plans-4d-units decision); one more whole-row pass here.;rev3=census-ruling-edge-protection-2;basis=runs the guard, a pure in-memory matcher on r.URL.Path and RawQuery (internal/edgeguard), once per request after the meter and observer defer and before the password gate, the upgrade branch, the cache and the activator, for a request that is not a door call, a backhauled door hop or a tunnel delivery; a matched block answers a 404 itself through guardDecide; the two new sites are one expression, up.route.Kind == "static" (a static route this box serves checks only the hard tier here and leaves the probe tier to serveTree), a read of the route row the edge already resolved; no new kind of read;rev3=census-ruling-edge-asset-cache-3;basis=the asset cache's three hooks (asset cache plan 3): the request's reserved asset headers are deleted at entry (the fill assertion kept only beside a verified hop); on the exact-remote and lookup-miss branches the far catch (serveAssetFar) is tried before backhaulTo and backhaul; after the observer defer and main's hard and probe checks, a verified hop with a valid fill assertion is answered by serveAssetFillForHop; after the upgrade branch and before gzip and the shared cache, the local catch (serveAssetLocal); the observer defer skips only the usage meter for an acknowledged home fill (out.unbilled); the new reads live in the new units of the edge-asset-cache-3-decisions overlay; the same route row and read sites (25); no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 5: straight after lookupUpstreamPath it calls regionalGate (regional.go), which for an entry built from a regional_domains row answers 503 to a hop or a deny entry before any arm that can leave the box (the exact-home backhaul, the far asset catch, the door dial, the miss backhaul), and lets a star match through only to the exact-home arm when ExactHome names another box for that distinct exact name; after the exact-home arm a regional deny entry the arm did not answer is refused (regionalRefuse, 503); refusals only, on the route map the edge already holds; read sites unchanged (25);rev3=census-ruling-static-headers;basis=the shared response cache is no longer looked up or filled for a static-kind route: one more read of the route row the edge already resolved (up.route.Kind == "static") in the cacheable expression; a refusal only, nothing new opened or followed;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2 (N-HA10): one call, frontForwardHA, right after the route lookup's !ok block and before the login POST; same reads;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 4: loginPost and cacheable treat a forward row as not this box's to answer (IsForward(), +whole:Route x2): no login form and no shared cache for a forward host. Serving only.;rev3=census-ruling-tunnel-websockets;basis=Deletes the Carlos-Upgrade marker header from incoming requests and puts the upgrade admission (host, path, the entry tenancy, all in hand) on a tunnel arm request. For a login POST on an ungated ArmTunnel row it reads the visitor request body (bounded by gate.MaxFormBody, 413 past it; a request body, not a file) and resolves next against the entry Reload built (Gate, Route); the bytes pass on only when loginPassesThrough holds (spec 7, Tasks 3, 5 and 6).;rev3=census-ruling-console-protection-tab;basis=one more call in the observer defer, observeGuardCount(up.route, out), beside the observeRecords call that files the guard Match: it passes on the route row the defer already holds (+whole:Route) and the request outcome to the usage meter, which counts the check in memory. Called whether or not the request was unbilled, as observeRecords is. Nothing is opened, read or followed; no new kind of read; no check, refusal or serving decision changes.;rev3=census-ruling-probe-burst-limit;basis=answers a probe-burst notice POST (serveBurstNotice) ahead of every route for a non-door caller; builds the guard state for up.route and stamps its account and app (RouteAccount, App) for the cool-down's this-app/other-app label; for a catalogue match on a non-static or tunnelled route, offers the burst rule (in-memory limiter, burstDecide: 429 or a watch verdict, never a block for a fleet or forward row); the observer defer calls noteBurst(up.route, ...); the added sites are the route value already in hand (+registry:App, +whole:Route x5); no new root read or write kind;rev3=census-ruling-edge-held-streams;basis=the edge in the agent (carlos-edge.service, user carlos): parses the request's query once (stripHoldMarker) to record the carlos_hold=1 mark in the request context; calls classifyHold on the upstream already resolved from the loaded map (the +whole:Route is that in-memory Route), including a second pass for a login POST; gives a marked request on a door-refused route the plain 404; adds the hold branch (planThrottleAdmit, rateAdmit, serveHeld) after the gate; and excludes marked requests from the shared cache. Reads only the request and the already-loaded upstream map; no registry or bucket read added.;rev3=census-ruling-region-ha-p3a;basis=Complete the P3a cut: an exact peer name with no dial target answers the approved admission 503 before local wildcard dispatch or asset serving. ExactHome and lookupHome stop fallback at a present non-dial entry; backhaulTo refuses an empty target before signing or dialing. Retain Task 3 local admission and fixed platform/unit exemptions. Two added whole Route uses feed the local in-memory admission predicate; existing Route values and store/path reads are unchanged.;rev3=census-ruling-stateless-coordinator-route;basis=P24/P25: POST only, exact /api/fleet/replicas/ prefix on the reserved tunnel host calls the existing local console proxy only for an unescaped, already-clean path; malformed forms remain on the hub. No new read sites relative to origin/main. Merge with main 3487d6f6 retains its region HA admission checks before routing and after login target lookup, its empty-home refusal, and their two existing whole:Route reads; these change this unit's digest relative to the previously approved branch tip 92b24a7d.;rev3=census-ruling-stateless-replicas-3;basis=Task 1a: pass the already-resolved Route to the reserved replica-probe handler after acceptHop and existing admissionRefuses, requiring tunnel context plus private marker and refusing door/backhaul ingress. Added whole Route use only; scrub marker before forwarding; HA calls remain unchanged.;rev3=census-ruling-region-ha-p3b;basis=Resolve local aliases/catch-alls with cached peer name ownership before serving. Add registry Account/App/ClaimStamp/Host/Incarnation/ServingSeq and six whole Route references for NameClaim; inputs are agent registry rows/edges publications used by unprivileged edge, not root permits. Closed owners retain names and return 503; aware remote owner cannot fall through on missing transport, while legacy hop/door behavior remains. Merge 45cebde4 retains authenticated replica probes after local admission and before ordinary name resolution; probe authentication still requires the tunnel context.;rev3=census-ruling-agent-start-demo-2;basis=edge.go:1901 enters the protected demo path before ordinary exits; :2012-2015 rechecks the selected marked Route after lookup. Added whole Route use routes demos through serving checks, counters and policy; no new registry query or file open in this unit.;rev3=census-ruling-demo-api-site-route;basis=Reserve the configured site API namespace after hop verification and control-header scrubbing, before ordinary static, cache, billing and tenant dispatch. Validate hop field shape and delegate only allowlisted operations to the dedicated console path with verified client attribution and console admission. The alias helper enables HTTP/1.1 full duplex so an early console refusal does not wait for upload EOF. Existing 56 read sites unchanged; no new registry, bucket or file read.;rev3=census-ruling-region-ha-g2-fixes;basis=Consult HA ingress after region admission and before miss/alias backhaul; no new direct read; routing-only metadata does not create an upstream.;rev3=census-ruling-region-ha-g2r-fixes;basis=W3/W4: backhaul and door calls pass the owner the door checked into backhaulTo; the §6.5 holder follow (once, GET/HEAD or an unswitched upgrade, no body) and one connect-failure fallback dial only boxes in the holder region's view (same Region/Placement/DataBucket, HomeEligible, fresh) for that owner. Holder name comes only from the TLS-verified signed hop answer; app-set X-Carlos-Holder stays stripped. Routing only; the receiving box still re-checks the lease. No new read site.;rev3=census-ruling-managed-fleets-2b2;basis=three additions, no read added: (1) first, on a box whose edge was given a managed probe responder (managed boxes only), the exact path /__carlos/managed-probe goes to serveManagedProbe, which answers 404 unless the request came over this box's own tunnel (tunnelclient.FromTunnel) as a POST carrying X-Carlos-Managed-Probe: 1; (2) on the reserved tunnel host, a POST to the exact path /__carlos/fleet-probe (RawPath empty) goes to serveFleetProbe, everything else keeps the hub's 404; (3) X-Carlos-Managed-Probe and X-Carlos-Probe-Channel are deleted from every inbound request beside the replica probe marker file:ReadAll@17548,registry:Account@9051,registry:App@23705,registry:App@9075,registry:ClaimStamp@9105,registry:Gate@16522,registry:Gate@28096,registry:Gate@28156,registry:Gate@28214,registry:Host@28199,registry:Host@9282,registry:ImportGate@35599,registry:Incarnation@9140,registry:Kind@22567,registry:Kind@26005,registry:Kind@35541,registry:Kind@35570,registry:ServingSeq@9174,whole:Route@16417,whole:Route@16528,whole:Route@19345,whole:Route@20129,whole:Route@20587,whole:Route@20779,whole:Route@22570,whole:Route@23631,whole:Route@23697,whole:Route@23708,whole:Route@23961,whole:Route@24056,whole:Route@24132,whole:Route@24176,whole:Route@24478,whole:Route@24508,whole:Route@26008,whole:Route@26293,whole:Route@28099,whole:Route@28159,whole:Route@28202,whole:Route@28217,whole:Route@29135,whole:Route@31198,whole:Route@35544,whole:Route@35573,whole:Route@35602,whole:Route@35634,whole:Route@37482,whole:Route@7125,whole:Route@7224,whole:Route@7319,whole:Route@9054,whole:Route@9078,whole:Route@9108,whole:Route@9143,whole:Route@9177,whole:Route@9285 896ee6eafc40bd12a9ca348cd90d8aad6264e2eafc8c5556dbdfc031ea3109cd
@legacy 4a886f19eb13990a95311329aa3a4cf8906513140156c201712163ec02638848 internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-managed-fleets-2b2;basis=calls d.managedReady after the serial read on every tick (nil on BYO, returns at once once admitted); no read of its own added registry:Host@5679 741db8b2f80543447fee068dc520bf8cee4c9da2a3b67dac640236ca46591701
@legacy d7079356852c9f7ddb9065bcfeca1de8e9b7da221d9974226a085fed756dee65 internal/host/agent.go statusTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-regional-box-names;basis=after the label override, sets box.Name = status.DisplayName(box.Label, p.NameRegion) when NameRegion is set; a pure hash over the label; no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 7 (ruling 5a): sets p.AliasesRead false, then true only when the existing reg.ListAliases succeeds, so the heartbeat tells no alias rows from a failed read; the caller's value is never trusted; no read added;rev3=census-ruling-managed-fleets-2b2;basis=after the label override, sets box.ManagedKey = managedKeyHeartbeat(): the code from root's /etc/carlos/managed-key-status.json read through managedboot.LoadKeyStatus (O_NOFOLLOW walk, every component root-owned and not g/o writable, regular nlink 1, 1 KiB cap, canonical known code only, else status_unreadable); a value copied into the bucket-private heartbeat, nothing root decides on; no other read added whole:Route@1029,whole:Route@1593,whole:RouteAlias@958,whole:RouteAlias@968 9ef5ba8b7a1425c3b2aa27c5eb81c87652607d55f224e6f50b31e1d2b84b952a
@legacy 4a126816b099b642d35432e5bd31c0f69b5ca8efd70296eee65f2c9e4a5d4d59 internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-managed-fleets-2b2;basis=on the live root, or a staging root holding a valid managed identity, gates the unit set it is about to write (managedGateUnits: root-owned admission drop-ins for every non-maintenance unit and the declared named units via the trusted mb* walk, control drop-in, daemon-reload when live) before writing any unit file; any failure fails the bootstrap; BYO no-op file:Command@12657,file:ReadFile@564,file:ReadFile@7711 710ca018c8f6f9e77067dc41389606c6d53312058f7710aab68ecfc991207ec7
+@legacy 868414c98538110becf7a12c6c2b64eed2329a91ca2f6be50c799c8503b25ced internal/host/group_maintenance.go groupMarkerPresent legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Lstat /etc/carlos/group.json (or test etc root); anything except absence selects strict group maintenance validation. Root boot writes marker, flags cannot bypass it and unreadable/linked marker cannot authorize fixed behavior.;rev3=census-ruling-managed-fleets-2b2;basis=final wave: in an agent that decided managed at its entry (agentManaged, an in-memory flag), the live /etc (liveEtc, "/etc" in production, a test seam) marker answers absent without the lstat, so automatic updates stay armed on a refused managed box; any other etc root, and every BYO or non-agent caller, still lstats /etc/carlos/group.json exactly as before; no read added file:Lstat@127 1b636aa8cbb009012555c6c574feb0c5c34fe733fded258a95c2fc58c2f1f0a7
@legacy 370e60a0e99076d73fcc9b34d0794a7cd29952a3b1b771d43e7f25b4392cc0ae internal/host/systemapply.go systemApplier.installUnits legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.;rev3=census-ruling-managed-fleets-2b2;basis=before publishing the target build's staged units, gates them (every staged non-maintenance unit, a new template included, beside this binary's units and the declared named units) via managedGateEtc and daemon-reload; any failure fails the apply with no unit published; BYO no-op file:ReadDir@1436,file:ReadFile@2746,file:ReadFile@5781,file:ReadFile@960,file:Stat@3404,file:Stat@4697 1a196cf7e0967ffc2a1f59f7cd9c7fc4da942da229981b681f6c7a5374f91141
@legacy 43bbb4eb04d46dce96a2b2d77038d90eb16069389061c9332f2aeb98a7815229 internal/host/systemunits.go ensureSystemUnitsWithGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move unit-repair body here with existing lock/unit/host.env reads; under lock require operator repair permit on groups before writes and each systemctl effect, preserve root masks/drop-in and omit automatic update/recovery units. New indirect protected marker/permit reads, never agent receipt; fixed repair unchanged.;rev3=census-ruling-managed-fleets-2b2;basis=under the apply lock and before any write, reload, enable or start: on a managed box gates this binary's unit set and the declared named units (trusted mb* walk) with root-owned admission and control drop-ins via managedGateEtc, recording an owed control restart in root's /run before rewriting the control drop-in, then daemon-reload; any failure returns before any unit is published; after a successful reload pays an owed control restart (try-restart; the record is cleared only on success, so a failed reload or restart is retried next pass); BYO no-op file:OpenFile@293,file:ReadFile@5939,file:ReadFile@6072,file:ReadFile@7530,file:Stat@5848 9832f8191e83edf8dfcdcea9d3b4978e511b211e756458da78e887bae47f5287
@legacy 8941dd8482aa24167f614d8a52e202e55756c1d9e5dc82fdfee6907b6f50a30f internal/host/unitops.go InstallNamedUnits legacy accepted-legacy accepted-legacy;rev3=census-ruling-named-unit-delivery-114;basis=new: the one carlos writer of /etc/carlos/named-units.json: validates the bytes with appconfig.ValidateDeclarations (the pass's decoder), takes the config-sync flock (<envDir>/.sync.lock, the lock SyncUnits holds for a whole pass), writes <dst>.tmp beside the file with O_CREATE|O_EXCL 0644, fsync, rename over dst, fsync of the directory (file:OpenFile of the temp and file:Open of the directory); root-owned because the verb runs as root;rev3=census-ruling-managed-fleets-2b2;basis=under the config-sync flock, before the declaration is replaced, gates the declared units (plus this binary's units and the live declaration's) through managedGateUnits and reloads; any failure (scope, trusted read, write, reload) installs nothing; BYO no-op file:Open@1186,file:OpenFile@692 38e9dac08a155df52bc324fa82a242c6bedd83575cedf2b7e4ee5aa1f99bb8a4
@@ -40,7 +41,7 @@
@legacy 1686e47fa8e2f0e8d3a783576a07149703221fada59147d0b6bd09e51e1a40e4 internal/host/managedkey.go registerFleetKey legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads the managed key door's HTTPS reply (4 KiB cap) from the frozen console origin; a 200 counts only when it names the box's fleet and the fingerprint of the key it sent; no file read file:ReadAll@859 21c44ffea28a26abe3cab22d52eb05f5de00a6e4ab4918cd2c2f854b21bae268
@legacy 3f7b469d7dfc94bf11264786277ee00ac67e2e3f401cdbef2e53d1e02d3ec4d4 internal/host/managedprobe.go managedProber.challenge legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new, agent as user carlos on a managed box: parses the delivered key pair from the credentials file bytes (managedboot.ParseCredentials, exact RenderCredentials form) and builds the bucket client with lease.NewStaticFilesStore, which signs with exactly that pair (no SDK default chain: no env keys or AWS_ACCESS_KEY/AWS_SECRET_KEY aliases, profile, shared file, web identity or IMDS) and makes one attempt per request; then one create-only PUT, one bounded read-back (release.Opener, len+1 cap) and one DELETE of _carlos/probes/<label>/<nonce> in the fleet's own bucket, the DELETE under context.WithoutCancel with its own 2 s budget; the Read is crypto/rand for the object body; returns only the access key ID it signed with and fixed codes file:Open@965,file:Read@643,file:ReadAll@1056 53a26637a4adf4b07a8f5aace39443f5b1abe83226b5ed1f498c9d4a327184d2
@legacy 6d35ad71a275fb451b684c23191d55b96f91f3fbe6c6d8e8394c582a893a057d internal/host/managedprobe.go managedProberFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new: builds the prober from the root-loaded join identity (nil on BYO or an invalid identity); its readCreds opens /etc/carlos/credentials (root:carlos 0640, written by root at the managed boot commit) as user carlos and reads at most 4 KiB; its open builds lease.NewStaticFilesStore from host.env's bucket and region and the parsed pair; nothing root decides on file:Open@621,file:ReadAll@726 582e009c599762a99af9214a012ca52351ec94827eb7d1f8556d9d7f5e233312
-@legacy de1f88cae013e14550e827dfc56763709a4764cff4f30dc399a4a19a5ff13faf internal/host/managedstartup.go managedGroupConfiguration legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=lstat of the group marker path (/etc/carlos/group.json) on a managed box, existence only, to refuse the join when any group configuration is present; nothing is read or parsed file:Lstat@117 7389e1f34ccdb07cdfdc852e4424cafb5ab76c7f8e5ed4578a91165f0822781e
+@legacy e967ab534c5cb9ec52aa56e73c10309316c4993c075dc988897d6bc9f2ef4f0b internal/host/managedstartup.go managedGroupConfiguration legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=lstat of the group marker path (/etc/carlos/group.json) on a managed box, existence only, to refuse the join when any group configuration is present; nothing is read or parsed; final wave: compares CARLOS_BOX_REFERENCE directly rather than through groupReferenced (which answers no once the agent has decided managed), same lstat, nothing read file:Lstat@117 0029d62d09bc345ac3437646f70bdf5146f38419277bfbc92a7ccbab4e7f5066
@legacy 546ee981858c17a0f97bfdbf0876af4ce6e2759676829c4b32a24c3eb9e30c73 internal/host/namedrecovery_pass.go namedUnitRecovery.refusedByGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=asks the root-pass gate (RootAdmission: root-owned identity and 0700 admission files) and logs the route's host on refusal; no other read registry:Host@189 5d7654da0ef597f013a35b8a9d1ac8e6949dd1c16c312ceaf153e70efb6bf5d2
@legacy 990d95df0a6c4c4b16db5e8ee97de3f6a83aefd86a1f3316d9139a537d890103 internal/instancectl/managedadmit.go Server.handleManagedAdmit legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads the relayed ready object body (4 KiB cap, PeerOK-guarded socket) and hands it to root's verified commit; a refusal on its merits answers 403, an I/O failure 500; nothing read is trusted before managedboot verifies it file:ReadAll@154 4674d8ada6ad219d2fecccf37666c2c862240f845db1000874b8082c1f692c18
@legacy 63ef8cb36801572b7fccbc5b7df89d0663fe42d01317f58faa8586c7dd8f8072 internal/managedboot/admission_linux.go createMarker legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_CREAT|O_EXCL|O_NOFOLLOW create of the admitted marker in the verified root 0700 dir (the commit point); an existing marker must pass openOwnedFile file:Openat@64 d9686d48ff25888045c3ad773a46b3069edf9f29b4856d2c19155a2d3bab3a4d
@@ -48,7 +49,7 @@
@legacy 539a276737045b83c1cce5f03a5c2ff6a13a8ed58dc3abdeb29acd9a8d7a877a internal/managedboot/admission_linux.go openOwnedFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_NOFOLLOW|O_NONBLOCK openat + fstat: regular, nlink 1, root:root, mode 0600 file:Fstat@246,file:Openat@90 12c06f48e2c9485db495425980fc708ea02405009d67f47e4bd79efdd3a4936f
@legacy babd6f849203f1f19f87019f74e89ebcb299619c7934acbc460fb7c12a443360 internal/managedboot/admission_linux.go readAdmission legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads admission.json (4 KiB cap) through openOwnedFile and re-verifies it with the identity's release key file:ReadAll@217 29b380055f916ed936dfb93f4c10038b63238ec9457acb1105f620ab5151ddb7
@legacy 4ac10098384575d8bae36abc76a24eb6d0cba251a3e7e9121299daf611f9ad98 internal/managedboot/admission_linux.go writeAdmission legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_EXCL|O_NOFOLLOW temp in the verified dir, fsync, renameat2 RENAME_NOREPLACE (link fallback), dir fsync; the read is crypto/rand for the temp suffix file:Openat@266,file:Read@137 630607347195c991bb1445bea77069f5638ba90af0b6212349def6f24ddf0bfd
-@legacy 0362119f2320e9cc1f47d366e28332f5c32ad9b201e8dcca179643c017dc0649 internal/managedboot/cloudinit_v1.sh.tmpl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=Task 1's frozen v1 cloud-init script; fix round 1 orders carlos-managed-boot.service After=cloud-init.service cloud-init-network.service so it runs after cloud-init rewrites the user data; rendered by the console only, never executed by the root binary; apt fix: both apt-get calls wait up to 120 s for the dpkg lock (-o DPkg::Lock::Timeout=120) and update retries up to 12 times, 10 s apart, on the lists lock, failing with apt's own status after the last; still no file content trusted, no new read file:external@0 9305989e09426ed3c29e6d79a9c451e208960772760f5356f5a3f04088644c12
+@legacy 955a7152fefa967a3fc1b3804abcb52242a55a8aa9781850ffa0cc315d5955bc internal/managedboot/cloudinit_v1.sh.tmpl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=Task 1's frozen v1 cloud-init script; fix round 1 orders carlos-managed-boot.service After=cloud-init.service cloud-init-network.service so it runs after cloud-init rewrites the user data; rendered by the console only, never executed by the root binary; apt fix: both apt-get calls run through one bounded retry (aptr: up to 12 tries, 10 s apart, failing with apt's own status after the last); install also waits up to 120 s for the dpkg lock on each try (-o DPkg::Lock::Timeout=120), update (lists lock only) carries no such option; the seed request body is overwritten in place (O_NOFOLLOW, fsync) before it is unlinked; still no file content trusted, no new read file:external@0 846ee6bb0b0ddeffd70cd7fe3bfaa8aaac8934f2662a4ce77eda658e856a7776
@legacy ba8b61b68d4becc173795a6579e2801c7332411d2ebb5cc7b85c9c49812e05ca internal/managedboot/identity_linux.go readRootOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=the O_NOFOLLOW openat walk moved out of loadIdentity unchanged (every component owned by the expected uid, not g/o writable; regular, nlink 1, size cap), parameterised by path and limit; callers: loadIdentity (/etc/carlos/managed-box.json, 4 KiB) and loadKeyStatus (/etc/carlos/managed-key-status.json, 1 KiB) file:Fstat@775,file:Open@130,file:Openat@532,file:ReadAll@1099 3f2a099882de9ffaac6189a3a844f3a3026cf02398ed7d6d247ae9461de29a09
@legacy 1b53db1357bf29604e17fc4337847d2e1c03bc4e606361aaf6a24c9e4bea7638 internal/managedboot/probe.go NewProbeNonce legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new: 32 bytes from crypto/rand, hex; no file read file:Read@76 9cda7dd058dd62cc5928b9c7c58f0d66a1ea59c4cd023e0fb50b63c3d0917b18
internal/edge/demo_traffic.go Edge.serveDemoTraffic legacy accepted-legacy accepted-legacy;rev3=census-ruling-agent-start-demo-2;basis=demo_traffic.go:128-334 reads the resolved Route and passes it to existing admission, metering, rate and activator helpers. Resident serving checks precede the inert moved hook (:143), retirement and durable request debit (:302); output debits use the writer below compression. Forwarders do not count or transform again. Existing expiry/control cancellations and five-second write bounds apply; no request-path console or bucket read.;rev3=census-ruling-managed-fleets-2b2;basis=adds tunnelclient.ManagedProbeHeader and X-Carlos-Probe-Channel to the header names it deletes from a demo request before forwarding; no read added, read sites unchanged registry:App@2685,registry:DemoExpiresAt@1420,whole:Route@1119,whole:Route@1423,whole:Route@1562,whole:Route@1649,whole:Route@1772,whole:Route@223,whole:Route@2296,whole:Route@2612,whole:Route@2677,whole:Route@2688,whole:Route@2774,whole:Route@2870,whole:Route@2944,whole:Route@2991,whole:Route@3049,whole:Route@3078,whole:Route@3297,whole:Route@3328,whole:Route@3360,whole:Route@3733,whole:Route@375,whole:Route@4397,whole:Route@4447,whole:Route@4499,whole:Route@454,whole:Route@4738,whole:Route@5503,whole:Route@6046,whole:Route@6470 b63349fa62442d4d0d935b0582c276c8fcf16ebddfd1cec5cc314f1da51297ba
@@ -57,9 +58,10 @@ internal/host/agent.go fastConvergeLoop authority B3 rev3=census-ruling-self-ser
internal/host/agent.go fastTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=PROPOSED-s3-change-index;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=observes the change index before any pass (observeIndex), runs the backstop's requested full pass and a scoped pass for moved app scopes (indexTick), and arms the canary pointer gate on the sweep (canaryPointerGate) only on a tick whose own index observation succeeded; read site unchanged, offset moved;rev3=census-ruling-stateless-replicas-1;basis=Call coordinator Tick on the existing tick before convergence; client renews held terms only at the pinned interval. Existing registry read unchanged. Final review I3: signal the owned renewal worker instead of waiting for its sequential console HTTP calls. Existing convergence and record read unchanged.;rev3=census-ruling-region-ha-p3a;basis=Run the optional desired-role reader on the existing tick after observing the armed change index; no new root path or timer, nil reader is unchanged.;rev3=census-ruling-stateless-replicas-2;basis=Slice 3b: signals the owned replica worker on the existing tick; coalesced asynchronous execution, no timer or bucket scan added. merge of origin/main 7920cccf: Retain main box-role reader pass on the existing tick alongside the replica worker signal; merge-only body change, unchanged read sites.;rev3=census-ruling-restart-new-box-gap;basis=calls the optional restartGain hook (restartGainSeed) once per existing tick before the serial read; no new root path, timer or read kind; nil hook is unchanged;rev3=census-ruling-agent-start-demo-3;basis=Refresh moved notices through the shared watch before normal convergence; no new per-box poll. Census read-site delta: unchanged (1).;rev3=census-ruling-managed-fleets-2b2;basis=calls d.managedReady after the serial read on every tick (nil on BYO, returns at once once admitted); no read of its own added registry:Host@5679 741db8b2f80543447fee068dc520bf8cee4c9da2a3b67dac640236ca46591701
internal/host/agent.go makeStartRoute authority B3,J1 root-route;kept=B3;scope=protected-decision-only;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3: comment only, the Hibernate check is left as is (unit-only path);rev3=census-ruling-managed-fleets-2b2;basis=refuses with errManagedJoining while the armed managedJoin is joining, before any registry read; BYO unchanged registry:Hibernate@451,registry:Unit@467,registry:Unit@520,whole:Route@438 e1dd0e265ebb368d080715ec1ad756fbc12ceffc5e2983b0c15590ea79cde06b
internal/host/agent.go runAdoptUnderRootRelease authority B3,E1,E2,E3 rev3=census-ruling-self-serve-moves-1;basis=root claim/adopt/update controller uid 0: builds root's lifetime judge once from the host-claim switch and hands it to both productionRestartRequestPass calls; read sites unchanged, offsets moved; the preceding B3,E1,E2,E3 classification retained;rev3=census-ruling-claims-cleanup-r1;basis=claims cleanup R1: the claims shutdown timeout is the host constant claimsShutdownLimit (120s) instead of hostbox.RequestLimit (120s); no read added or changed;rev3=census-ruling-named-unit-delivery-114;basis=config sync is appconfig.SyncUnits with productionUnitOps (drop-in root /etc/systemd/system, base dir /etc/carlos/units, the declaration file /etc/carlos/named-units.json, systemctl probe/reload/restart, the config flock); no proof binding and no bucket read for delivery (Paul's ruling on #114: a root-owned declaration decides); the comment at the restart callback rewritten; read sites unchanged;rev3=census-ruling-managed-fleets-2b2;basis=builds managedRootGate("/") (root's RootAdmission: identity + root 0700 admission files, re-verified) and wraps the round-1 start/selected-restart/rollback callbacks, SyncUnits' UnitOps.Restart and named-unit recovery with it; BYO answers admitted, so nothing changes there whole:Route@11535,whole:Route@18986,whole:Route@19022,whole:Route@8743 0f47e28aac84484c163a66330dfad60e222575834275e9ac963fcb5e001a6955
-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-managed-fleets-2b2;basis=takes RunAgent's one managed/BYO startup decision (decideAgentStartup, made before any fatal group preflight): a managed box gets its join (refused on an identity error or any group configuration: every admission predicate closed, edge/status/probes running, no Fatalf), never reads group configuration and never builds fixedAdmission; a BYO box reads and validates group configuration exactly as on main; binds the join as activator/exec/edge admission; ReconcileConfig.Joining on both provisioning loops; the worker boot pass runs once, at admission; Task 5: appends managedProbeOption(join) to the edge options when it is non-nil (a managed box with a valid root identity); BYO boxes unchanged; no read added file:Exec@20197,file:Open@2700,file:Statfs@52067,registry:App@13796,registry:Host@48103,whole:Route@13788,whole:Route@47261,whole:Route@48226,whole:Route@48288 091cafa8770c51b22ff0171c3fcd3297881fb7d2289b288f0123b92e001bf9f4
+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-managed-fleets-2b2;basis=takes RunAgent's one managed/BYO startup decision (decideAgentStartup, made before any fatal group preflight): a managed box gets its join (refused on an identity error or any group configuration: every admission predicate closed, edge/status/probes running, no Fatalf), never reads group configuration and never builds fixedAdmission; a BYO box reads and validates group configuration exactly as on main; binds the join as activator/exec/edge admission; ReconcileConfig.Joining on both provisioning loops; the worker boot pass runs once, at admission; Task 5: appends managedProbeOption(join) to the edge options when it is non-nil (a managed box with a valid root identity); BYO boxes unchanged; no read added; final wave: when runAgent makes the startup decision itself it also arms it (armedAgentStartup), as RunAgent does, so later group-configuration consumers follow it; no read added file:Exec@20232,file:Open@2735,file:Statfs@52102,registry:App@13831,registry:Host@48138,whole:Route@13823,whole:Route@47296,whole:Route@48261,whole:Route@48323 a82139c8778f45acf0cdfc67710c8b9b58343d1be8e10105150b796dabc431e8
internal/host/agent.go statusTick legacy accepted-legacy accepted-legacy;rev3=J1;basis=root-route;rev3=census-ruling-regional-box-names;basis=after the label override, sets box.Name = status.DisplayName(box.Label, p.NameRegion) when NameRegion is set; a pure hash over the label; no read added;rev3=census-ruling-regional-domains-447;basis=#447 Task 7 (ruling 5a): sets p.AliasesRead false, then true only when the existing reg.ListAliases succeeds, so the heartbeat tells no alias rows from a failed read; the caller's value is never trusted; no read added;rev3=census-ruling-managed-fleets-2b2;basis=after the label override, sets box.ManagedKey = managedKeyHeartbeat(): the code from root's /etc/carlos/managed-key-status.json read through managedboot.LoadKeyStatus (O_NOFOLLOW walk, every component root-owned and not g/o writable, regular nlink 1, 1 KiB cap, canonical known code only, else status_unreadable); a value copied into the bucket-private heartbeat, nothing root decides on; no other read added whole:Route@1029,whole:Route@1593,whole:RouteAlias@958,whole:RouteAlias@968 9ef5ba8b7a1425c3b2aa27c5eb81c87652607d55f224e6f50b31e1d2b84b952a
internal/host/bootstrap.go bootstrapWithGroup legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move bootstrapWith body here, retaining host.env, embedded unit reads and tmpfiles execution. Group live caller holds root mutation guard; skip automatic update/recovery units, preserve Restart=no/nftables drop-in and masks, and write separate root-owned /run/carlos-group-maintenance tmpfiles rule outside service ownership walk. No agent receipt read.;rev3=census-ruling-managed-fleets-2b2;basis=on the live root, or a staging root holding a valid managed identity, gates the unit set it is about to write (managedGateUnits: root-owned admission drop-ins for every non-maintenance unit and the declared named units via the trusted mb* walk, control drop-in, daemon-reload when live) before writing any unit file; any failure fails the bootstrap; BYO no-op file:Command@12657,file:ReadFile@564,file:ReadFile@7711 710ca018c8f6f9e77067dc41389606c6d53312058f7710aab68ecfc991207ec7
+internal/host/group_maintenance.go groupMarkerPresent legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Lstat /etc/carlos/group.json (or test etc root); anything except absence selects strict group maintenance validation. Root boot writes marker, flags cannot bypass it and unreadable/linked marker cannot authorize fixed behavior.;rev3=census-ruling-managed-fleets-2b2;basis=final wave: in an agent that decided managed at its entry (agentManaged, an in-memory flag), the live /etc (liveEtc, "/etc" in production, a test seam) marker answers absent without the lstat, so automatic updates stay armed on a refused managed box; any other etc root, and every BYO or non-agent caller, still lstats /etc/carlos/group.json exactly as before; no read added file:Lstat@127 1b636aa8cbb009012555c6c574feb0c5c34fe733fded258a95c2fc58c2f1f0a7
internal/host/namedrecovery.go type namedUnitRecovery authority E1 E13: signed recovery allows unknown history but preserves usable refusals, including retained originals; verified later promotion clears only D1. Health recording is independent of program recording; minting requires a census. Fixtures: TestPlan14RecoveryUnknownHistory, TestPlan14RecoveryKnownRefusal, TestPlan14RecoveryOriginalRefusalWithUnknownHistory, TestPlan14RootHistoryVerifiedRetryBeforeAttempt, TestPlan14ProgramFailureStillRecordsHealth, TestPlan14RootHistoryMintCensus.;rev3=census-ruling-managed-fleets-2b2;basis=adds the gate field (managedRootGate on the root pass); data only 2c34aaab93e409a88307749f5625b0075144b32b5b2b88e2857530a5ada4630e
internal/host/systemapply.go systemApplier.installUnits legacy accepted-legacy accepted-legacy;rev3=J4;basis=root-input;rev3=census-ruling-agent-start-demo-1;basis=Renders the staged build slice against live root host configuration; preserves it when settings cannot be parsed.;rev3=census-ruling-region-ha-p3b;basis=Require group apply/rollback permit, preserve root Restart=no/nftables drop-in and masks, and skip automatic update/recovery units. Existing staged unit and host.env reads remain; new indirect marker/permit reads are protected and agent receipts are excluded.;rev3=census-ruling-managed-fleets-2b2;basis=before publishing the target build's staged units, gates them (every staged non-maintenance unit, a new template included, beside this binary's units and the declared named units) via managedGateEtc and daemon-reload; any failure fails the apply with no unit published; BYO no-op file:ReadDir@1436,file:ReadFile@2746,file:ReadFile@5781,file:ReadFile@960,file:Stat@3404,file:Stat@4697 1a196cf7e0967ffc2a1f59f7cd9c7fc4da942da229981b681f6c7a5374f91141
internal/host/systemunits.go ensureSystemUnitsWithGuard legacy accepted-legacy accepted-legacy;rev3=census-ruling-region-ha-p3b;basis=Move unit-repair body here with existing lock/unit/host.env reads; under lock require operator repair permit on groups before writes and each systemctl effect, preserve root masks/drop-in and omit automatic update/recovery units. New indirect protected marker/permit reads, never agent receipt; fixed repair unchanged.;rev3=census-ruling-managed-fleets-2b2;basis=under the apply lock and before any write, reload, enable or start: on a managed box gates this binary's unit set and the declared named units (trusted mb* walk) with root-owned admission and control drop-ins via managedGateEtc, recording an owed control restart in root's /run before rewriting the control drop-in, then daemon-reload; any failure returns before any unit is published; after a successful reload pays an owed control restart (try-restart; the record is cleared only on success, so a failed reload or restart is retried next pass); BYO no-op file:OpenFile@293,file:ReadFile@5939,file:ReadFile@6072,file:ReadFile@7530,file:Stat@5848 9832f8191e83edf8dfcdcea9d3b4978e511b211e756458da78e887bae47f5287
@@ -98,7 +100,7 @@ internal/host/managedkey.go readFleetKeyObject legacy accepted-legacy accepted-l
internal/host/managedkey.go registerFleetKey legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads the managed key door's HTTPS reply (4 KiB cap) from the frozen console origin; a 200 counts only when it names the box's fleet and the fingerprint of the key it sent; no file read file:ReadAll@859 21c44ffea28a26abe3cab22d52eb05f5de00a6e4ab4918cd2c2f854b21bae268
internal/host/managedprobe.go managedProber.challenge legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new, agent as user carlos on a managed box: parses the delivered key pair from the credentials file bytes (managedboot.ParseCredentials, exact RenderCredentials form) and builds the bucket client with lease.NewStaticFilesStore, which signs with exactly that pair (no SDK default chain: no env keys or AWS_ACCESS_KEY/AWS_SECRET_KEY aliases, profile, shared file, web identity or IMDS) and makes one attempt per request; then one create-only PUT, one bounded read-back (release.Opener, len+1 cap) and one DELETE of _carlos/probes/<label>/<nonce> in the fleet's own bucket, the DELETE under context.WithoutCancel with its own 2 s budget; the Read is crypto/rand for the object body; returns only the access key ID it signed with and fixed codes file:Open@965,file:Read@643,file:ReadAll@1056 53a26637a4adf4b07a8f5aace39443f5b1abe83226b5ed1f498c9d4a327184d2
internal/host/managedprobe.go managedProberFor legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new: builds the prober from the root-loaded join identity (nil on BYO or an invalid identity); its readCreds opens /etc/carlos/credentials (root:carlos 0640, written by root at the managed boot commit) as user carlos and reads at most 4 KiB; its open builds lease.NewStaticFilesStore from host.env's bucket and region and the parsed pair; nothing root decides on file:Open@621,file:ReadAll@726 582e009c599762a99af9214a012ca52351ec94827eb7d1f8556d9d7f5e233312
-internal/host/managedstartup.go managedGroupConfiguration legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=lstat of the group marker path (/etc/carlos/group.json) on a managed box, existence only, to refuse the join when any group configuration is present; nothing is read or parsed file:Lstat@117 7389e1f34ccdb07cdfdc852e4424cafb5ab76c7f8e5ed4578a91165f0822781e
+internal/host/managedstartup.go managedGroupConfiguration legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=lstat of the group marker path (/etc/carlos/group.json) on a managed box, existence only, to refuse the join when any group configuration is present; nothing is read or parsed; final wave: compares CARLOS_BOX_REFERENCE directly rather than through groupReferenced (which answers no once the agent has decided managed), same lstat, nothing read file:Lstat@117 0029d62d09bc345ac3437646f70bdf5146f38419277bfbc92a7ccbab4e7f5066
internal/host/namedrecovery_pass.go namedUnitRecovery.refusedByGate legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=asks the root-pass gate (RootAdmission: root-owned identity and 0700 admission files) and logs the route's host on refusal; no other read registry:Host@189 5d7654da0ef597f013a35b8a9d1ac8e6949dd1c16c312ceaf153e70efb6bf5d2
internal/instancectl/managedadmit.go Server.handleManagedAdmit legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads the relayed ready object body (4 KiB cap, PeerOK-guarded socket) and hands it to root's verified commit; a refusal on its merits answers 403, an I/O failure 500; nothing read is trusted before managedboot verifies it file:ReadAll@154 4674d8ada6ad219d2fecccf37666c2c862240f845db1000874b8082c1f692c18
internal/managedboot/admission_linux.go createMarker legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_CREAT|O_EXCL|O_NOFOLLOW create of the admitted marker in the verified root 0700 dir (the commit point); an existing marker must pass openOwnedFile file:Openat@64 d9686d48ff25888045c3ad773a46b3069edf9f29b4856d2c19155a2d3bab3a4d
@@ -106,17 +108,17 @@ internal/managedboot/admission_linux.go openAdmissionDir legacy accepted-legacy
internal/managedboot/admission_linux.go openOwnedFile legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_NOFOLLOW|O_NONBLOCK openat + fstat: regular, nlink 1, root:root, mode 0600 file:Fstat@246,file:Openat@90 12c06f48e2c9485db495425980fc708ea02405009d67f47e4bd79efdd3a4936f
internal/managedboot/admission_linux.go readAdmission legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=reads admission.json (4 KiB cap) through openOwnedFile and re-verifies it with the identity's release key file:ReadAll@217 29b380055f916ed936dfb93f4c10038b63238ec9457acb1105f620ab5151ddb7
internal/managedboot/admission_linux.go writeAdmission legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=O_EXCL|O_NOFOLLOW temp in the verified dir, fsync, renameat2 RENAME_NOREPLACE (link fallback), dir fsync; the read is crypto/rand for the temp suffix file:Openat@266,file:Read@137 630607347195c991bb1445bea77069f5638ba90af0b6212349def6f24ddf0bfd
-internal/managedboot/cloudinit_v1.sh.tmpl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=Task 1's frozen v1 cloud-init script; fix round 1 orders carlos-managed-boot.service After=cloud-init.service cloud-init-network.service so it runs after cloud-init rewrites the user data; rendered by the console only, never executed by the root binary; apt fix: both apt-get calls wait up to 120 s for the dpkg lock (-o DPkg::Lock::Timeout=120) and update retries up to 12 times, 10 s apart, on the lists lock, failing with apt's own status after the last; still no file content trusted, no new read file:external@0 9305989e09426ed3c29e6d79a9c451e208960772760f5356f5a3f04088644c12
+internal/managedboot/cloudinit_v1.sh.tmpl external legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=Task 1's frozen v1 cloud-init script; fix round 1 orders carlos-managed-boot.service After=cloud-init.service cloud-init-network.service so it runs after cloud-init rewrites the user data; rendered by the console only, never executed by the root binary; apt fix: both apt-get calls run through one bounded retry (aptr: up to 12 tries, 10 s apart, failing with apt's own status after the last); install also waits up to 120 s for the dpkg lock on each try (-o DPkg::Lock::Timeout=120), update (lists lock only) carries no such option; the seed request body is overwritten in place (O_NOFOLLOW, fsync) before it is unlinked; still no file content trusted, no new read file:external@0 846ee6bb0b0ddeffd70cd7fe3bfaa8aaac8934f2662a4ce77eda658e856a7776
internal/managedboot/identity_linux.go readRootOwned legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=the O_NOFOLLOW openat walk moved out of loadIdentity unchanged (every component owned by the expected uid, not g/o writable; regular, nlink 1, size cap), parameterised by path and limit; callers: loadIdentity (/etc/carlos/managed-box.json, 4 KiB) and loadKeyStatus (/etc/carlos/managed-key-status.json, 1 KiB) file:Fstat@775,file:Open@130,file:Openat@532,file:ReadAll@1099 3f2a099882de9ffaac6189a3a844f3a3026cf02398ed7d6d247ae9461de29a09
internal/managedboot/probe.go NewProbeNonce legacy accepted-legacy accepted-legacy;rev3=census-ruling-managed-fleets-2b2;basis=new: 32 bytes from crypto/rand, hex; no file read file:Read@76 9cda7dd058dd62cc5928b9c7c58f0d66a1ea59c4cd023e0fb50b63c3d0917b18
internal/host/namedrecovery_pass.go namedUnitRecovery.passOption authority B3,E1 Production recovery wrapper preserves main exit status for per-host failures; only remaining named routes can probe the census for history selection. Ordinary routes make no census or binding-store reads. Fixtures: TestPlan14ERecoveryOrdinaryPass, TestPlan14Fix4AdoptPerHostFailureExitsZero, TestPlan14Fix5MainEquivalence.;rev3=census-ruling-managed-fleets-2b2;basis=asks refusedByGate before recover; on refusal recovers nothing; the whole:Route site is the route handed to refusedByGate for its log line, no new read registry:Host@333,registry:Host@557,registry:Unit@510,registry:Unit@527,whole:Route@273,whole:Route@470,whole:Route@502 3e50e426466ebfd148adea21d70fba68fa86cf5d9e4d226953f6fe4abe3a5ea5
@coverage . 82ccb7423ba3369c7006bf66105dda9953c70202a8048eb44657cecf82d8bbac
@coverage internal/appconfig 7238cd97ab717ace4651cd2fbf236b8c923e76d5bddfd5235d7ed0d11d1bf325
@coverage internal/edge eae9918f14a21f508008346a242692364b29b5aeb67bb6dd64f6496034f5623b
-@coverage internal/host 02ed999cc2400765c0820d2aa5152f13d8ef687d88f597798e5358438931eb2d
+@coverage internal/host 55eecfff1455a397fa48f7c317dfd1054735519e5037a214bee4e96ab6e70904
@coverage internal/instancectl a43bb997d24941b7153600d3a4b7a513324ee659454dce215cb400cb5e64a9f6
@coverage internal/lease cfb696e90018e7ede4f5c924c92c7dded39fafcb3124c7f8d3264fb0506aaf67
-@coverage internal/managedboot 1caa13bb677701c7e4f202c2bc70f9cee1a1074db23c369b0271bda62a04f9e8
+@coverage internal/managedboot a9388a699df900e2a174013e8ce136eb1e8019dd3eea5ed4eb11622a13c5f3fb
@coverage internal/provision 41c4e4c822dd31b7b09c867203add50386cff05a1f88786a44e655aeb295a456
@coverage internal/status 7a4d4c3475f74524fccd5db7fa928be845dc677b57accf96bf8e1b4ad47cf158
@coverage internal/tunnelclient a3ec06fbc6d1bf4475ea65cefa4322456c1c0fc91a6003bed0735050759e57c4
diff --git a/internal/release/openers_test.go b/internal/release/openers_test.go
index ce66b85c6..d51ac99e0 100644
--- a/internal/release/openers_test.go
+++ b/internal/release/openers_test.go
@@ -53,6 +53,7 @@ var otherBucketOpeners = map[string]openerEntry{
"internal/hostfence/writer.go:OpenRootFenceStore": {"fence writer: the fence bucket, written under its own scoped role", 1},
"internal/lease/execution_store.go:ExecutionStore": {"execution/build state: the hibernate and claim data bucket, keyed by host prefix", 1},
"internal/lease/endpoint.go:NewFilesStore": {"per-instance files store: the data/hibernate bucket, a host's published files under its hibernate prefix (files/0/), not the deployment bucket", 1},
+ "internal/lease/endpoint.go:NewStaticFilesStore": {"a managed box's own fleet bucket for the readiness probe's challenge object (_carlos/probes/), signed with the delivered key pair; not the deployment bucket", 1},
"internal/status/dryrun.go:DryRun": {"status dry run: a throwaway scratch directory, not a deployment", 1},
}