carlos / platform Public

Managed fleets 1b: plan rev 4 after Astra R3 (Paul: skip a fourth round, apply refusals, build subagent-driven)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev eb2fcfc720af98f18f6c35c32fcb7ecc60b42ef0 parent 3349921
3 files changed, +134 −17
  • docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md +29 −13
  • docs/superpowers/plans/CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R3.md +89 −0
  • docs/superpowers/specs/2026-10-28-managed-fleets-design.md +16 −4

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md b/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md
index c77575a4c..1d2a6d17d 100644
--- a/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md
+++ b/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md
@@ -1,4 +1,4 @@
-# Managed fleets 1b: each instance runs on one named box Implementation Plan (rev 3)
+# Managed fleets 1b: each instance runs on one named box Implementation Plan (rev 4)
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
@@ -8,21 +8,21 @@
**Tech Stack:** Go. `internal/provision`, `internal/registry`, `internal/edge`, `internal/console`, `internal/activator`, `internal/host`, `cmd/console`.
-**Spec:** `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 Phase 1, "1b addendum", rules 1-10 (approved by Paul 2026-10-30; rule 6 his option 1; rule 8 his "gate and alert"; rules 5 and 10 revised after plan review R1). Code: main 65fd8060 (1a merged). Review history: round 1 `CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R1.md` (7 P1, 4 P2), round 2 `CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R2.md` (2 P1, 5 P2; stopping rule 2 on the restore and drain families; Paul chose "one rule each, enforced in one place"), both in `docs/superpowers/plans/`; dispositions at the end. Round 3 is the last.
+**Spec:** `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 Phase 1, "1b addendum", rules 1-10 (approved by Paul 2026-10-30; rule 6 his option 1; rule 8 his "gate and alert"; rules 5 and 10 revised after plan review R1). Code: main 65fd8060 (1a merged). Review history: round 1 `CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R1.md` (7 P1, 4 P2), round 2 `CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R2.md` (2 P1, 5 P2; stopping rule 2 on the restore and drain families; Paul chose "one rule each, enforced in one place"), both in `docs/superpowers/plans/`; dispositions at the end. Round 3 (`...-R3.md`, 4 P1, 3 P2, 1 P3) was the last: Paul ruled to skip a fourth round, apply the refusals below, and build subagent-driven with Astra on Tasks 3, 4 and 6 and the whole branch.
## Global Constraints
-- Unlabelled records behave exactly as on main. Single-box fleets and fleets with sidecars are never labelled.
+- Unlabelled records behave exactly as on main. Single-box fleets, fleets with sidecars, and fleets holding any record the platform does not run (`Addr`/`Addrs` set, or a binary with hibernation off) are never labelled (`movable(rec)`, Task 2).
- **Activation gate** (`release.FleetBoxLabelFloor = "v0.33.0"`; the release that ships this must be v0.33.0 or later): the console labels a fleet only when (a) the fleet has two or more active boxes, (b) the fleet has no sidecar records, (c) every box in the deployment, platform and fleet, reports a version at or above the floor in its heartbeat (the same complete box listing `carlos system status` reads; an incomplete listing counts as not met), and (d) the console's own version is at or above it.
- **Alert:** once a fleet has labels, a box in it reporting a version below the floor pauses all relabelling for that fleet and raises an alert (an ERROR log line naming fleet, box and version, plus `LABELS PAUSED` in `carlos fleets ls`), until every box is back at or above the floor.
- Every label write is a conditional update: the record's region, current label and `CreatedAt` must equal what the decision read, rechecked inside every retry of the update.
- **The start rule** (one function, `startAllowed`, Task 4): a fleet instance starts only from a copy kept under its current assignment, a restored replica, or empty when its record has never moved (`FleetBoxMoved` false) and no set-aside copy of it exists on this box. Stale copies are set aside, never deleted; the set-aside copy is the persistent reason to refuse.
-- **The drain rule** (one function, `drainDone`, Task 6): a draining box may be detached only when its newest heartbeat was composed after `draining_since` and reports no routes for the fleet and no held leases.
+- **The drain rule** (one function, `drainDone`, Task 6): a draining box may be detached only when its newest heartbeat was composed after `draining_since` and reports no routes for the fleet, no held leases and no unresolved failed final replications. No other detach path for a box that holds or held labelled records.
- The lease stays the one-writer guarantee. Lease take and release are unchanged.
- Lost box: no fresh heartbeat for `lease.LeaseTTL + 5*time.Minute` (20 minutes).
-- **Request budget** (asserted by store-call counting tests in Tasks 2 and 6). The console keeps an in-process inventory cache per fleet: record and sidecar keys with their ETags from the LIST, and the decoded record; a record is re-read only when its ETag changed; any LIST error makes the inventory incomplete (no writes that pass). Per pass, per fleet with two or more active boxes: one heartbeat LIST plus one GET per box (memoised), one deployment-wide heartbeat listing for the gate (shared across fleets in the pass), and one instance LIST plus one sidecar LIST per placed app; record GETs only for changed ETags (zero when idle); zero PUTs when nothing is unlabelled, lost or draining. A create uses the same cache under the fleet lock. First labelling: one GET per record and per binding object, one PUT per record. A move or drain: one conditional update (a GET and a PUT) per moved record. Drain completion reads only the box's heartbeat.
+- **Request budget** (asserted by store-call counting tests in Tasks 2 and 6). The console keeps an in-process inventory cache per fleet: record and sidecar keys with their ETags from the LIST, and the decoded record; a record is re-read only when its ETag changed; any LIST error makes the inventory incomplete (no writes that pass). Per pass, per fleet with two or more active boxes: one heartbeat LIST plus one GET per box (memoised), one deployment-wide heartbeat listing for the gate (shared across fleets in the pass), and one instance LIST plus one sidecar LIST per placed app; record GETs only for changed ETags (zero when idle); lifetime validity is not cached: each pass re-reads each record's incarnation slot through the lifetime judge (one GET per record per pass when lifetimes are on; counted in the test), and an unreadable slot makes the inventory incomplete; zero PUTs when nothing is unlabelled, lost or draining. A create uses the same cache under the fleet lock. First labelling: the inventory reads above, one GET per binding object, then per labelled record one conditional update (a judged re-read and a PUT, plus one more of each per lost-race retry). A move or drain: the same per moved record. Drain completion reads only the box's heartbeat.
- Member-facing strings (drain and detach refusals, the sidecar refusal, the paused state) get a Luna copy pass before merge; log lines do not.
-- Local tests: touched packages with `-run`; activator and host e2e tests need a short temp root for Unix socket paths (memory "Gate tmp exec wrapper"): `R=$(mktemp -d /tmp/k.XXXX) && TMPDIR=$R go test ...; rm -r $R` (small, owned, removed); Go builds in a worktree with `GOFLAGS=-buildvcs=false`; CI runs the full suite. Darwin and windows must cross-compile.
+- Local tests: touched packages with `-run`; activator and host e2e tests need a short temp root for Unix socket paths (memory "Gate tmp exec wrapper"): `R=$(mktemp -d /tmp/k.XXXX) && TMPDIR=$R go test ...; rm -r $R` (small, owned, removed; a ruling: `/var/tmp` roots exceed the 107-byte socket path, as the gate recipe found, so this one exception to "no scratch in /tmp" stays, kept tiny and removed); Go builds in a worktree with `GOFLAGS=-buildvcs=false`; CI runs the full suite. Darwin and windows must cross-compile.
- Neutral names (`shop`, `example.com`, fleet `pi`, boxes `pi-1`, `pi-2`).
## Review Focus
@@ -61,13 +61,14 @@
- `func (s *Server) loadDeploymentBoxesComplete(ctx context.Context) (boxes []status.Box, complete bool, err error)`: every heartbeat prefix (platform regions, pools, every fleet) through `loadBoxes`, AND-ing each prefix's completeness flag; a skipped or unreadable heartbeat makes it incomplete. Not `systemBoxes`, which drops that flag (`apisystemupdate.go:270-287`).
- `type fleetInventory struct` (the cache in Global Constraints) with `func (s *Server) fleetInventoryFor(ctx context.Context, fleet string) (records []provision.Record, sidecars int, complete bool, err error)`: per placed app, the instance LIST (as `ListRecordsCompleteJudged` reads) and the sidecar LIST (as `ListSidecarRecordsStrict`, `sidecar.go:404`, reads), re-reading only changed ETags; an unreadable record or sidecar makes it incomplete.
- `func (s *Server) loadFleetView(ctx context.Context, fleet string) (fleetView, error)`: the fleet's heartbeats, the deployment listing for (c), and the inventory for `Load` and `HasSidecars`. Anything incomplete leaves `Active` false.
-- `func (v fleetView) labelActive() bool`: the Global Constraints gate.
+- `func (v fleetView) labelActive() bool`: the Global Constraints gate, including no record failing `movable`.
+- `func movable(rec provision.Record) bool`: true only for a record the activator runs and can stop and start elsewhere: no `Addr`, no `Addrs`, and either a rootfs runtime or hibernation not switched off.
- `func (v fleetView) chooseDestination(rootfs bool, exclude string) string`: among boxes that are fresh, not draining, at the label floor (and rootfs-ready at the rootfs floor for a rootfs record), the lowest load, ties by label; "" when none. Independent of whether other boxes are fresh.
- `func (s *Server) lockFleet(fleet string) (unlock func())`: one mutex per fleet, held from `loadFleetView` through the record create.
- Store `AppsPlacedOn(ctx context.Context, placement string) ([]AppRef, error)`.
- Copy: `msgSidecarNeedsSingleBoxFleet(fleet string) string`.
-- [ ] **Step 1: Write the failing tests.** `TestCreateOnASingleBoxFleetLeavesNoLabel`; `TestCreateLabelsTheLeastLoadedReadyBox`; `TestCreateSkipsStaleDrainingAndDetachedBoxes`; `TestGateNeedsEveryDeploymentBoxCurrent` (a platform box below the floor: no label); `TestGateClosedForAFleetWithSidecars`; `TestGateClosedOnAnIncompleteListing` (through `loadDeploymentBoxesComplete`: a skipped below-floor heartbeat and a capped listing both close the gate); `TestSidecarOnlyAppClosesTheGate`; `TestInventoryRereadsOnlyChangedRecords` (store-call counter: an unchanged second load does zero record GETs); `TestConcurrentCreatesSpreadAcrossBoxes`; `TestSidecarCreateRefusedOnAMultiBoxFleet` (and allowed on a single-box fleet); `TestRootfsAdmissionFollowsTheChosenBox`; `TestCreateOnALabelledFleetCostsOneInventory` (store-call counter: one LIST per placed app, zero record PUTs beyond the create). Existing `rootfs_test.go` and `TestAPIInstanceCreateInheritsFleetPlacement` still pass.
+- [ ] **Step 1: Write the failing tests.** `TestCreateOnASingleBoxFleetLeavesNoLabel`; `TestCreateLabelsTheLeastLoadedReadyBox`; `TestCreateSkipsStaleDrainingAndDetachedBoxes`; `TestGateNeedsEveryDeploymentBoxCurrent` (a platform box below the floor: no label); `TestGateClosedForAFleetWithSidecars`; `TestGateClosedForAnUnmanagedRecord` (an `Addr` record; a binary with hibernation off: no labels anywhere in the fleet); `TestGateClosedOnAnIncompleteListing` (through `loadDeploymentBoxesComplete`: a skipped below-floor heartbeat and a capped listing both close the gate); `TestSidecarOnlyAppClosesTheGate`; `TestInventoryRereadsOnlyChangedRecords` (store-call counter: an unchanged second load does zero record GETs); `TestConcurrentCreatesSpreadAcrossBoxes`; `TestSidecarCreateRefusedOnAMultiBoxFleet` (and allowed on a single-box fleet); `TestRootfsAdmissionFollowsTheChosenBox`; `TestCreateOnALabelledFleetCostsOneInventory` (store-call counter: one LIST per placed app, zero record PUTs beyond the create). Existing `rootfs_test.go` and `TestAPIInstanceCreateInheritsFleetPlacement` still pass.
- [ ] **Step 2: Run them to see them fail.** `go test ./internal/console/ -run 'FleetBox|LeastLoaded|SkipsStale|Gate|ConcurrentCreatesSpread|SidecarCreateRefused|RootfsAdmissionFollows|CostsOneInventory'` → FAIL.
- [ ] **Step 3: Implement.** Freshness and readiness reuse `status.BoxStale`, `boxRootfsReady`, `boxAtRootfsFloor` and the join at `rootfs.go:212-238`. The create door stamps the label only when `labelActive()`; a rootfs create on an active fleet with no rootfs-ready destination is refused with today's rootfs refusal.
- [ ] **Step 4: Run them to see them pass,** plus `-run 'Rootfs|FleetPlacement|Sidecar'` → PASS.
@@ -114,13 +115,13 @@
### Task 6: The relabel worker, two-step drain, pause and alert (rules 2, 4, 5, 8)
-**Files:** create `internal/console/fleetrelabel.go`; modify `internal/console/claim_workers.go`, `cmd/console/main.go`, `internal/console/testdata/claim-routes.txt`, `internal/console/fleets.go` (new drain door; detach doors :544, :1455), `internal/registry/fleets.go` (`draining` column on `fleet_boxes`; `FleetChannelAuth` still admits a draining active box), `fleets.go` at the repo root (the CLI: `carlos fleets drain`, `LABELS PAUSED` in `fleets ls`); tests `internal/console/fleetrelabel_test.go`, `cmd/console/claimworkers_started_test.go`, `internal/registry` fleet tests, `cli_test.go` patterns for the CLI; docs `docs/site/cli.md` (document `fleets drain`, drain refusal and completion, detach after a drain, `LABELS PAUSED`, and revise the existing detach-first advice at :2168 for a leaked key: detach still works at once for a box that holds nothing; otherwise rotate its token first, then drain).
+**Files:** create `internal/console/fleetrelabel.go`; modify `internal/console/claim_workers.go`, `cmd/console/main.go`, `internal/console/testdata/claim-routes.txt`, `internal/console/fleets.go` (new drain door; detach doors :544, :1455), `internal/registry/fleets.go` (`draining` column on `fleet_boxes`; `FleetChannelAuth` still admits a draining active box), `fleets.go` at the repo root (the CLI: `carlos fleets drain`, `LABELS PAUSED` in `fleets ls`); tests `internal/console/fleetrelabel_test.go`, `cmd/console/claimworkers_started_test.go`, `internal/registry` fleet tests, `cli_test.go` patterns for the CLI; docs `docs/site/cli.md` (document `fleets drain`, drain refusal and completion, detach after a drain, `LABELS PAUSED`, and revise the existing detach-first advice at :2168 for a leaked key: a box that holds nothing can be detached at once; otherwise drain first, which needs the box's current token, then detach and rotate. Rotating first would cut the box off before it can see the drain).
-**Interfaces (produces):** worker `FleetRelabel` every 5 minutes, started like `StartRunSweep`; `func (s *Server) fleetRelabelPass(ctx context.Context) error`; `func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView) (moved int, err error)`; `func (s *Server) drainBox(ctx context.Context, fleet, label string) (stuck []string, err error)`; `func drainDone(hb status.Box, drainingSince time.Time) bool` (the drain rule: `hb` composed after `drainingSince`, no routes for the fleet, `LeasesHeld == 0`), the only check both detach doors make for a draining box; a box that is lost (silent past `fleetBoxLostAfter`) may be detached without it once no record names it, since its access is moot; `status.Box.LeasesHeld int` (`json:"leases_held"`), filled by the box from the activator's held leases when it composes the heartbeat; `fleet_boxes.draining_since` (timestamp; null when not draining); `const fleetBoxLostAfter = lease.LeaseTTL + 5*time.Minute`; copy `msgDrainStrandsApps(fleet, label string, apps []string) string`, `msgDetachNotDrained(fleet, label string) string`.
+**Interfaces (produces):** worker `FleetRelabel` every 5 minutes, started like `StartRunSweep`; `func (s *Server) fleetRelabelPass(ctx context.Context) error`; `func (s *Server) relabelFleet(ctx context.Context, fleet string, v fleetView) (moved int, err error)`; `func (s *Server) drainBox(ctx context.Context, fleet, label string) (stuck []string, err error)`; `func drainDone(hb status.Box, drainingSince time.Time) bool` (the drain rule: `hb` composed after `drainingSince`, no routes for the fleet, `LeasesHeld == 0`, `ReplicationFailures == 0`), the only check both detach doors make for any box that holds or held labelled records, with no exception for a silent box; `status.Box.LeasesHeld int` (`json:"leases_held"`) and `status.Box.ReplicationFailures int` (`json:"replication_failures"`), filled by the box when it composes the heartbeat: held leases from the activator, and failed final replications from a durable record the activator writes under its data dir when a final sync fails (`activator.go:4877`, `lease.go:557`) and clears when a later replication of that host succeeds; the drain also refuses a record failing `movable`, naming the app; `fleet_boxes.draining_since` (timestamp; null when not draining); `const fleetBoxLostAfter = lease.LeaseTTL + 5*time.Minute`; copy `msgDrainStrandsApps(fleet, label string, apps []string) string`, `msgDetachNotDrained(fleet, label string) string`.
-Per fleet, per pass: if a labelled fleet has a box below the floor, log the alert and skip it (paused). Else if `labelActive()`: label each unlabelled record to the box its binding names (`fleets/<f>/bindings/<host>.json`) when that box is a valid destination, otherwise `chooseDestination`; move each record whose box is lost to `chooseDestination(rootfs, lost)`; move each record of a draining box likewise. All writes use `SetRecordFleetBox` with the expectation read in this pass; `ErrFleetBoxMoved` is skipped until the next pass. Truncated or skipped records make the pass write nothing for that fleet.
+Per fleet, per pass: if a labelled fleet has a box below the floor, log the alert and skip it (paused). Else if `labelActive()`: label each unlabelled record to the box its binding names (`fleets/<f>/bindings/<host>.json`) when that box is a valid destination; an existing record with no such binding stays unlabelled this pass (never `chooseDestination`: that would let a clean box boot it empty); records created after activation are labelled at create (Task 2); move each record whose box is lost to `chooseDestination(rootfs, lost)`; move each record of a draining box likewise. All writes use `SetRecordFleetBox` with the expectation read in this pass; `ErrFleetBoxMoved` is skipped until the next pass. Truncated or skipped records make the pass write nothing for that fleet.
-- [ ] **Step 1: Write the failing tests.** `TestFirstLabellingFollowsBindings` (three running records, bindings on `pi-1`, `pi-1`, `pi-2`: labelled the same; nothing moves); `TestRelabelPassLeavesAnUngatedFleetAlone`; `TestLostBoxMovesToTheSurvivor` (two-box fleet, `pi-1` silent 21 minutes: all its records to `pi-2`; 19 minutes: nothing); `TestRelabelLosesToAPlacementChange`; `TestBelowFloorBoxPausesAndAlerts`; `TestDrainMovesEverythingOrNothing` (one record with no destination: refused naming the app, nothing written); `TestDrainingBoxKeepsFleetAccess` (`FleetChannelAuth` still lists it); `TestDrainDoneNeedsAPostDrainHeartbeat` (an empty heartbeat composed before `draining_since`: not done); `TestDrainDoneNeedsNoLeases` (no routes but one lease held: not done); `TestBothDetachDoorsUseDrainDone` (API and page); `TestHeartbeatCountsHeldLeases` (in `internal/host` or `internal/status`: a box holding two leases reports 2, after release 0); `TestIdlePassCostsTheBudget` (store-call counter for an idle labelled fleet: per the Global Constraints); `TestEveryRegisteredClaimWorkerIsStarted` with `FleetRelabel`; CLI tests for `carlos fleets drain` and the `LABELS PAUSED` column.
+- [ ] **Step 1: Write the failing tests.** `TestFirstLabellingFollowsBindings` (three running records, bindings on `pi-1`, `pi-1`, `pi-2`: labelled the same; nothing moves); `TestRelabelPassLeavesAnUngatedFleetAlone`; `TestLostBoxMovesToTheSurvivor` (two-box fleet, `pi-1` silent 21 minutes: all its records to `pi-2`; 19 minutes: nothing); `TestRelabelLosesToAPlacementChange`; `TestBelowFloorBoxPausesAndAlerts`; `TestDrainMovesEverythingOrNothing` (one record with no destination: refused naming the app, nothing written); `TestDrainingBoxKeepsFleetAccess` (`FleetChannelAuth` still lists it); `TestDrainDoneNeedsAPostDrainHeartbeat` (an empty heartbeat composed before `draining_since`: not done); `TestDrainDoneNeedsNoLeases` (no routes but one lease held: not done); `TestDrainDoneNeedsNoFailedReplication` (fault injection: the final sync fails but the lease is released; the box reports 1; not done; a later successful replication clears it); `TestSilentBoxCannotBeDetached` (a box silent 21 minutes whose records moved: detach refused at both doors); `TestFirstLabellingSkipsAnUnboundRecord` (no binding: stays unlabelled; a clean box never gets it); `TestDrainRefusesAnUnmanagedRecord`; `TestBothDetachDoorsUseDrainDone` (API and page); `TestHeartbeatCountsHeldLeases` (in `internal/host` or `internal/status`: a box holding two leases reports 2, after release 0); `TestIdlePassCostsTheBudget` (store-call counter for an idle labelled fleet: per the Global Constraints); `TestEveryRegisteredClaimWorkerIsStarted` with `FleetRelabel`; CLI tests for `carlos fleets drain` and the `LABELS PAUSED` column.
- [ ] **Step 2: Run them to see them fail.** `go test ./internal/console/ ./internal/registry/ ./cmd/console/ . -run 'FirstLabelling|RelabelPass|LostBox|RelabelLoses|BelowFloor|Drain|Detach|IdlePass|ClaimWorker|FleetsDrain|LabelsPaused'` → FAIL.
- [ ] **Step 3: Implement.** Log one line per moved record (host, from, to, reason).
- [ ] **Step 4: Run them to see them pass.** Same command → PASS.
@@ -138,7 +139,7 @@ Per fleet, per pass: if a labelled fleet has a box below the floor, log the aler
### Task 8: Census, copy, review, merge
-- [ ] **Step 1:** `go test ./internal/provision/ -run TestPlan14RootReadCensus`; on failure, AGENTS.md "The census" (`make census-card`, CLAIMS, `make census-propose NAME=<branch>`); include the two new route columns and the `fleet_boxes.draining` column. The reviewer decides; record on #280.
+- [ ] **Step 1:** `go test ./internal/provision/ -run TestPlan14RootReadCensus`; on failure, AGENTS.md "The census" (`make census-card`, CLAIMS, `make census-propose NAME=<branch>`); include the three new route columns (`fleet_assigned`, `fleet_moved`, `fleet_label`) and the `fleet_boxes.draining` and `draining_since` columns, and the heartbeat fields `leases_held` and `replication_failures`. The reviewer decides; record on #280.
- [ ] **Step 2:** Luna copy pass on the drain, detach and sidecar refusals, the `LABELS PAUSED` state and the drain help text; apply verbatim.
- [ ] **Step 3:** Whole-branch Astra review from `docs/superpowers/reviews/REVIEW-BRIEF-TEMPLATE.md`, round 1 of 3, with this plan's Review Focus; name Tasks 3, 4 and 6 as production storage and removal.
- [ ] **Step 4:** CI green on the tip; merge with `amadan branch merge carlos/platform <branch> -squash` on Paul's go.
@@ -183,3 +184,18 @@ Stopping rule 2 triggered on two families (restore, drain completion). Paul chos
| 5 | P2 | Idle budget contradicts the readers | Accepted: the inventory cache re-reads only changed ETags; budget restated; cold and unchanged passes tested separately. |
| 6 | P2 | Fixture seam, expiry case, scratch path | Accepted: exported `RunFleetRelabelPass`; stopped-renewal expiry case; owned short temp roots (`mktemp -d /tmp/k.XXXX`, removed), since socket paths rule out the longer `$TMPDIR`. |
| 7 | P2 | CLI docs | Accepted: `docs/site/cli.md` in Task 6, including the revised leaked-key advice. |
+
+## Round 3 dispositions (`CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R3.md`)
+
+Paul: skip a fourth round, apply the refusals, build subagent-driven with Astra on Tasks 3, 4, 6 and the whole branch.
+
+| # | Sev | Finding | Disposition |
+|---|---|---|---|
+| 1 | P1 | First labelling can boot an existing instance empty | Accepted (refusal): existing records are labelled only to the box their binding names; unbound ones stay unlabelled (Task 6; spec rule 6). |
+| 2 | P1 | Lost-box detach exception | Accepted (refusal): exception removed; detach always needs `drainDone` (Task 6; spec rule 5). |
+| 3 | P1 | Zero leases does not prove final replication | Accepted: `ReplicationFailures` from a durable record of failed final syncs; `drainDone` requires zero; fault-injection test (Task 6). |
+| 4 | P1 | Unmanaged process shapes | Accepted (refusal): `movable(rec)`; fleets with any unmovable record are not labelled; drains refuse them (Tasks 2, 6; spec rule 11). |
+| 5 | P2 | Lifetime freshness and read counts | Accepted: lifetime slots re-read every pass, counted; mutation re-reads and retries counted (Global Constraints). |
+| 6 | P2 | Scratch under /tmp | Declined with reason: socket paths exceed 107 bytes under `/var/tmp` (gate recipe); kept to a tiny owned `/tmp/k.XXXX`, removed after each run. |
+| 7 | P2 | Rotate-then-drain advice | Accepted: drain first, then detach and rotate (Task 6 docs). |
+| P3 | P3 | Census checklist columns | Accepted: Task 8 lists every new column and heartbeat field. |
diff --git a/docs/superpowers/plans/CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R3.md b/docs/superpowers/plans/CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R3.md
new file mode 100644
index 000000000..a6798da8b
--- /dev/null
+++ b/docs/superpowers/plans/CODEX-FINDINGS-MANAGED-FLEETS-1B-PLAN-R3.md
@@ -0,0 +1,89 @@
+| Round-2 finding | Disposition |
+|---|---|
+| 1 — P1, persistent restore refusal | **Partly resolved; P1 remains.** Repeated wakes refuse correctly, but first labelling can still authorize an empty boot of an existing instance. Finding 1. |
+| 2 — P1, drain completion | **Partly resolved; P1 remains.** Post-drain timestamps and lease counts improve the check; the lost-box exception and failed final replication remain unsafe. Findings 2–3. |
+| 3 — P2, heartbeat-listing completeness | **Resolved.** The new reader preserves completeness, with tests through that reader. |
+| 4 — P2, sidecar inventory and worker reference | **Resolved.** Explicit sidecar enumeration and the corrected worker-stop reference address the finding. |
+| 5 — P2, request budget | **Partly resolved; P2 remains.** Record caching helps, but lifetime observations and mutation rereads remain unaccounted for. Finding 5. |
+| 6 — P2, fixture seam, expiry and scratch | **Partly resolved; P2 remains.** The exported seam and expiry scenario are specified; the scratch instructions still conflict with machine rules. Finding 6. |
+| 7 — P2, CLI documentation | **Partly resolved; P2 remains.** Documentation is included, but “rotate first, then drain” interrupts the access needed to drain. Finding 7. |
+
+Reviewed commit `334992149f538c8053da1b87bbbbf57a7e52f0e5`. No files changed, subagents spawned or tests run.
+
+1. **P1 — Tasks 1, 4 and 6: First labelling can boot an existing instance empty.**
+
+ **Evidence:** [Plan:43](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:43) leaves `FleetBoxMoved` false on every first label. [Plan:121](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:121) falls back to `chooseDestination` when the binding does not identify an eligible box. [Plan:94](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:94) permits an empty boot when `Moved` is false and that destination has no set-aside copy. Binding publication is asynchronous and failures only log: [fleetbind.go:306](internal/host/fleetbind.go:306).
+
+ **Failure scenario:** An existing unlabelled instance has data on `pi-1`, no usable binding and no successful replica. First labelling chooses clean `pi-2`. After the old lease expires, `pi-2` has neither a local copy nor quarantine, and `Moved` remains false. `startAllowed` permits an empty database. The new retry tests do not cover this first-label transition.
+
+ **Fix:** Refuse automatic first labelling of existing records when their serving box cannot be established; do not use the ordinary destination fallback to classify them as fresh. Test a previously used unlabelled instance, missing binding, absent replica and clean destination.
+
+ **Fault family:** Assignment changes must prevent stale serving without abandoning unrecovered data. Carries R2 finding 1.
+
+2. **P1 — Task 6: The lost-box exception bypasses the drain invariant.**
+
+ **Evidence:** [Plan:119](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:119) permits detach without `drainDone` after heartbeat silence and reassignment. Yet Task 7 explicitly models a partitioned source that keeps renewing its data-bucket lease. Detach removes its authentication entry at [fleets.go:636](internal/registry/fleets.go:636), and subsequent record reads fail authentication at [storedoor.go:123](internal/edge/storedoor.go:123).
+
+ **Failure scenario:** `pi-1` loses control-store connectivity but continues writing and renewing its lease. After 20 minutes, records move to `pi-2` and detach succeeds. Healing the partition no longer lets `pi-1` read those assignments: its credential has been revoked. It can keep renewing indefinitely, blocking `pi-2`. Heartbeat silence did not make its access moot.
+
+ **Fix:** Remove the heartbeat-only detach exception. Refuse detach until the source satisfies the centralized drain rule; reassignment may still proceed while the destination waits on the lease. Test both detach doors against the renewing partition.
+
+ **Fault family:** Drain completion must precede credential revocation. Carries R2 finding 2.
+
+3. **P1 — Tasks 6 and 9: Zero held leases does not establish successful final replication.**
+
+ **Evidence:** [Plan:119](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:119) checks timestamp, routes and leases only. Legacy replication releases its lease even when final synchronization fails: [lease.go:557](internal/lease/lease.go:557). The activator records the error and removes the entry anyway: [activator.go:4877](internal/activator/activator.go:4877). [Plan:152](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:152) follows successful drain with detach and termination.
+
+ **Failure scenario:** A draining instance stops with an unreplicated tail. Final upload fails, but lease deletion succeeds. Its next heartbeat reports no routes and no leases, so `drainDone` succeeds. The destination restores an older replica; terminating the source destroys the only remaining tail.
+
+ **Fix:** Keep `drainDone` as the single gate, but give it durable evidence of unresolved replication failures and refuse completion while any remain. Its present inputs cannot distinguish successful replication from this failure. Add fault injection where final synchronization fails but lease release succeeds.
+
+ **Fault family:** Drain completion must preserve the last recoverable writes. Continues R2 finding 2’s incomplete completion evidence.
+
+4. **P1 — Tasks 2, 3 and 6: Assignment accepts processes that `RetireExcept` cannot stop or move.**
+
+ **Evidence:** The chooser at [plan:65](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:65) distinguishes rootfs readiness but imposes no lifecycle eligibility requirement. [Plan:84](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:84) relies on `RetireExcept`. Existing records can describe non-hibernating binaries and externally managed upstreams; the edge explicitly proxies those outside activator management at [edge.go:1045](internal/edge/edge.go:1045). Claims-off retirement only deletes the registry row: [claimassembly.go:40](internal/provision/claimassembly.go:40).
+
+ **Failure scenario:** A record points to a binary service running only on `pi-1`, with hibernation disabled. Drain assigns it to `pi-2`. Removing `pi-1`’s route does not stop that service; minting `pi-2`’s route does not install or start it. Traffic moves to a missing backend while the source process remains alive and outside the proposed lease count.
+
+ **Fix:** Define assignment eligibility and refuse unsupported externally managed process shapes before labelling or draining. Add a non-hibernating, box-local service test proving refusal leaves its assignment unchanged.
+
+ **Fault family:** Assignment authority must cover the process lifecycle it claims to transfer.
+
+5. **P2 — Tasks 2 and 6: The cache contract omits lifetime freshness and understates reads.**
+
+ **Evidence:** [Plan:23](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:23) caches records by their ETags. The prescribed judged reader also reads each host’s incarnation slot, whose state can change independently: [lifetime_judge.go:77](internal/provision/lifetime_judge.go:77). Conditional updates reread through that judge at [provision.go:1099](internal/provision/provision.go:1099).
+
+ **Failure scenario:** Reusing a cached lifetime verdict after only checking the record ETag can retain a retired record or overlook an unreadable slot. Rejudging correctly incurs reads absent from the budget. Cold first labelling also performs an inventory read and a conditional-update reread, beyond the stated one record GET.
+
+ **Fix:** Cache record bytes separately from lifetime validity; specify fresh slot observations and failure handling. Count inventory, slot, binding and mutation reads separately, including retries. Test an unchanged record whose slot changes or becomes unreadable.
+
+ **Fault family:** Placement decisions require complete evidence with bounded, accurately counted store traffic. Carries R2 finding 5.
+
+6. **P2 — Tasks 4 and 7: Scratch remains on the prohibited RAM-backed filesystem.**
+
+ **Evidence:** [Plan:98](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:98) and [plan:136](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:136) explicitly create `/tmp/k.XXXX`. The supplied machine instructions prohibit scratch directly under `/tmp`.
+
+ **Failure scenario:** Following the recipe puts test databases and other temporary output on the shared RAM disk. Making the directory owned and removing it afterward does not resolve that conflict.
+
+ **Fix:** Use a short disk-backed root, such as an owned directory under `/var/tmp`, verify the resulting socket-path length, and clean it up.
+
+ **Fault family:** Test execution must respect shared-machine resource constraints. Carries R2 finding 6.
+
+7. **P2 — Task 6: “Rotate its token first, then drain” prevents record reads needed for drain.**
+
+ **Evidence:** That advice is prescribed at [plan:117](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:117). Rotation replaces the stored hash at [fleets.go:485](internal/registry/fleets.go:485). Each store request checks its token against the current hash: [tunnel.go:266](internal/edge/tunnel.go:266). Keeping an established tunnel alive does not preserve that store authorization.
+
+ **Failure scenario:** An operator follows the proposed instructions. The source still presents its old token, cannot read its relabelled records, and cannot complete a cooperative drain.
+
+ **Fix:** Document a sequence that preserves authenticated control access through drain. If rotation must precede it, specify how the replacement credential reaches the source and is verified through the supported API/CLI workflow.
+
+ **Fault family:** The documented operator workflow must complete the job. Carries R2 finding 7.
+
+**P3 — Task 8:** [Plan:141](docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md:141) still names “two new route columns” and only `fleet_boxes.draining`. Tasks 3, 5 and 6 actually add three route columns and both `draining` and `draining_since`. Correct this checklist so the reviewer receives the full schema scope; the census gate itself should expose the discrepancy. Fault family: complete review accounting.
+
+The P1s do **not** share one cause: they concern fresh-boot eligibility, drain evidence and unsupported process lifecycles. Refusing ambiguous first labelling, unacknowledged lost-box detach, drains with unresolved replication failures, and unsupported process shapes would remove the reported cases while retaining a narrower feature. Cutting automatic migration alone would leave the first-labelling failure.
+
+Round 3 is exhausted; a fourth review requires Paul’s approval under the stopping rules.
+
+**NOT READY**
\ No newline at end of file
diff --git a/docs/superpowers/specs/2026-10-28-managed-fleets-design.md b/docs/superpowers/specs/2026-10-28-managed-fleets-design.md
index d648eeff4..c0269f483 100644
--- a/docs/superpowers/specs/2026-10-28-managed-fleets-design.md
+++ b/docs/superpowers/specs/2026-10-28-managed-fleets-design.md
@@ -194,8 +194,12 @@ The rule (my calls, approved by Paul 2026-10-30):
the fleet and no held leases (leases are released only after the
instance is proven stopped and its final replication ran). Detaching
first would revoke the box's access before it had seen the relabel
- and released its leases. One check, in one place, in the console
- (Paul, 2026-10-30, after plan review R2 and stopping rule 2).
+ and released its leases. The heartbeat must also report no failed
+ final replications still on the box's disk, since a lease is released
+ even when the last upload failed. There is no exception for a silent
+ box: its records still move, but it stays attached until it shows it
+ is done. One check, in one place, in the console (Paul, 2026-10-30,
+ after plan review R2 and stopping rule 2; R3 refinements).
6. **No stale local copy (#470), by assignment time (Paul, 2026-10-30,
option 1).** The record carries the time it was assigned to its box,
beside the label. A box notes that time next to its local copy. When
@@ -205,8 +209,10 @@ The rule (my calls, approved by Paul 2026-10-30):
there is nothing to restore from, it refuses to start the instance
and says where the set-aside copy is, rather than booting empty. When
existing records are first labelled, each is labelled to the box
- already serving it, so nothing moves; that box's copy is set aside
- once and the same data restored.
+ its binding names, so nothing moves; that box's copy is set aside
+ once and the same data restored. An existing record whose serving box
+ is not established by a binding is not labelled; it keeps today's
+ behaviour until it wakes and binds (plan review R3).
**The start rule (Paul, 2026-10-30, after plan review R2 and stopping
rule 2), enforced in one place on the box:** an instance on a fleet
starts only from (a) a local copy kept under its current assignment,
@@ -239,6 +245,12 @@ The rule (my calls, approved by Paul 2026-10-30):
9. **The removal phase checks the label too (my call).** A row whose
record now names another box is removed, not kept on region alone
(`internal/provision/reconcile.go` scan and removal phase).
+11. **Only processes the platform runs can be labelled (after plan
+ review R3).** A record served from an address the platform does not
+ manage (`Addr`/`Addrs`), or a binary instance that never hibernates,
+ cannot be stopped on one box and started on another by relabelling.
+ A fleet holding any such record is not labelled, and a drain refuses
+ them, naming the apps.
10. **Sidecars stay on single-box fleets for now (my call, after plan
review R1).** Sidecar records are a separate type with their own
lifecycle. A fleet with sidecars is not labelled, and creating a