Plan: managed fleets 1b, each instance runs on one named box (#457, #470); Astra plan review brief R1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+289
−0
docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md+252 −0docs/superpowers/plans/CODEX-REVIEW-BRIEF-MANAGED-FLEETS-1B-PLAN.md+37 −0
CI passed — 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| new file mode 100644 |
| index 000000000..f5ed6c1a9 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md |
| @@ -0,0 +1,252 @@ |
| +# Managed fleets 1b: each instance runs on one named box Implementation Plan |
| + |
| +> **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. |
| + |
| +**Goal:** On a fleet with two or more boxes, each instance runs on exactly one box the console chose, traffic goes straight to it, a lost or detached box's instances move to the survivors, and no box ever boots a stale local copy (#470). |
| + |
| +**Architecture:** The console stamps the chosen box's label and an assignment time on the instance record. A fleet box mints only records labelled for it (or unlabelled ones, today's behaviour). The hub's forward row carries the label as `FleetBox` from the first write. A console worker labels existing records once a fleet is ready for it and relabels records off detached or silent boxes. A box notes the assignment time beside each local database and discards the copy when the record's assignment changed. |
| + |
| +**Tech Stack:** Go. `internal/provision` (record, reconcile, forward phase), `internal/registry` (route columns), `internal/console` (create doors, worker, detach door, rootfs admission), `internal/activator` (restore), `internal/host` (wiring). |
| + |
| +**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 is his option 1). Code map: main 65fd8060 (1a merged). 1a's spec: `docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md`. |
| + |
| +## Global Constraints |
| + |
| +- Unlabelled records behave exactly as on main: every box of the fleet mints them. Single-box fleets never get labels. |
| +- The console labels a fleet's records only when the fleet has two or more active boxes and every active box's heartbeat reports a version at or above `release.FleetBoxLabelFloor` (`"v0.33.0"`; the release that ships this must be v0.33.0 or later). Below that, nothing is labelled and nothing changes. |
| +- A label is always written with its assignment time, together; a relabel is conditional on the label it replaces. |
| +- The lease stays the one-writer guarantee. Nothing here takes or releases a lease differently. |
| +- Lost-box threshold: no fresh heartbeat for `lease.LeaseTTL + 5*time.Minute` (20 minutes today). |
| +- No new per-box bucket polling (memory "S3 requests cost money"). The console worker runs every 5 minutes and reads only fleets with two or more active boxes. |
| +- Member-facing strings (the detach refusal) go through a Luna copy pass before merge; diagnostics and log lines do not. |
| +- Local tests: touched packages with `-run`; activator tests with `TMPDIR=/tmp/k`; Go builds in a worktree with `GOFLAGS=-buildvcs=false`; CI runs the full suite. Darwin and windows must cross-compile. |
| +- Neutral names in code, tests and copy (`shop`, `example.com`, fleet `pi`, boxes `pi-1`, `pi-2`). |
| + |
| +## Review Focus |
| + |
| +1. **Two creates at once on the same fleet** both counting the same load and picking the same box. Expect: they serialise on the fleet and land on different boxes when loads tie. Test in Task 2. |
| +2. **A box comes back after its records were relabelled away** (it was partitioned, not dead). Expect: it drops those rows and never serves them; the new box waits out the lease if the old one still renews. Test in Tasks 3 and 7. |
| +3. **A, then B, then A** for one instance. Expect: A restores on its second turn and serves B's writes. Test in Tasks 4 and 7. |
| +4. **A mixed-version fleet** (one box below the floor). Expect: no labels are written, every record keeps today's behaviour. Test in Task 2 and Task 6. |
| +5. **Detaching the only ready box** while it runs instances. Expect: refused, naming the apps; nothing relabelled. Test in Task 6. |
| + |
| +--- |
| + |
| +### Task 1: The record carries a box and an assignment time |
| + |
| +**Files:** |
| +- Modify: `internal/provision/provision.go` (Record, `SetRecordRegion` at :1023) |
| +- Create: `internal/provision/fleetbox.go` |
| +- Test: `internal/provision/fleetbox_test.go`; census overlay beside `internal/provision/fleet_public_routes_census_test.go` |
| + |
| +**Interfaces:** |
| +- Produces: `Record.FleetBox string` (`json:"fleet_box,omitempty"`), `Record.FleetBoxAt string` (`json:"fleet_box_at,omitempty"`, RFC 3339 nanoseconds, UTC); `func SetRecordFleetBox(ctx context.Context, s release.Store, acct, app, host, wantLabel, label string, at time.Time) error` (writes both fields only if the record's current label equals `wantLabel`; `ErrFleetBoxMoved` otherwise); `var ErrFleetBoxMoved = errors.New(...)`. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestRecordFleetBoxRoundTrip`: a record with `FleetBox:"pi-2", FleetBoxAt:"2026-10-30T18:00:00Z"` survives `CreateRecord` then a read; a record without them marshals with neither key. |
| +`TestSetRecordFleetBoxIsConditional`: from label `""` to `pi-1` succeeds; a second call wanting `""` returns `ErrFleetBoxMoved` and leaves `pi-1`; wanting `pi-1` to `pi-2` succeeds and updates `FleetBoxAt`. |
| +`TestSetRecordRegionClearsTheBox`: `SetRecordRegion` to another region clears both fields; to the same region keeps them. |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `go test ./internal/provision/ -run 'TestRecordFleetBox|TestSetRecordFleetBox|TestSetRecordRegionClearsTheBox'` |
| +Expected: FAIL (unknown fields, undefined function). |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +Fields beside `Runtime` with a comment naming 1b rules 1 and 6. `SetRecordFleetBox` goes through the record's existing update path (the one `SetRecordRegion` uses), so `RecordSeq` advances. Every record writer decodes and re-marshals the whole record, so the fields survive writers built with this change; older console or platform-box binaries would drop them, which is why Task 2's floor gates labelling on every box being current. |
| + |
| +- [ ] **Step 4: Run them to see them pass, then the record-write census** |
| + |
| +Run: `go test ./internal/provision/ -run 'TestRecordFleetBox|TestSetRecordFleetBox|TestSetRecordRegion|TestPlan9B8RecordWriteCensus'` |
| +Expected: the three new tests PASS; the census FAILs naming `SetRecordFleetBox` and `SetRecordRegion`. Add an overlay inventory layered on `fleetPublicRoutesWriteCensusInventory` re-pinning them, then PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 2: The console picks the box at create (rules 1, 7, 8, 10) |
| + |
| +**Files:** |
| +- Create: `internal/console/fleetbox.go` |
| +- Modify: `internal/console/apiinstances.go` (before the record is created, ~:2264), the sidecar create door (`apisidecars.go`), `internal/console/rootfs.go:189-244`, `internal/release/layoutintent.go` (the floor), the store (an apps-on-fleet query) |
| +- Test: `internal/console/fleetbox_test.go`, `internal/console/rootfs_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: Task 1's fields. |
| +- Produces: `const release.FleetBoxLabelFloor = "v0.33.0"`; `func (s *Server) fleetLabelReady(ctx context.Context, fleet string) (boxes []fleetBoxView, ready bool, err error)` (two or more active boxes, every one fresh and at or above the floor); `type fleetBoxView struct { Label string; Fresh, RootfsReady, AtRootfsFloor bool }`; `func (s *Server) chooseFleetBox(ctx context.Context, fleet string, rootfs bool, exclude string) (label string, err error)` ("" = leave unlabelled); `func (s *Server) fleetBoxLoad(ctx context.Context, fleet string) (map[string]int, error)` (labelled records per box); `func (s *Server) lockFleet(fleet string) func()` (per-fleet mutex, held from the choice through the record create); store `AppsPlacedOn(ctx context.Context, placement string) ([]AppRef, error)`. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestCreateOnASingleBoxFleetLeavesNoLabel`, `TestCreateLabelsTheLeastLoadedReadyBox` (boxes `pi-1` with two labelled records, `pi-2` with none: the new record names `pi-2` with a non-zero `FleetBoxAt`; ties go to the lower label), `TestCreateSkipsStaleAndDetachedBoxes`, `TestMixedVersionFleetLeavesNoLabel` (one box below the floor: no label), `TestConcurrentCreatesSpreadAcrossBoxes` (two creates in parallel on a fleet of two empty boxes end on different boxes), `TestSidecarCreateLabelsToo`. Rootfs: `TestRootfsAdmissionFollowsTheChosenBox` (labelled: admitted when the chosen box is rootfs-ready even if another box is not; refused when the chosen box is not), and the existing `rootfs_test.go` cases still pass for an unlabelled fleet. Copy `TestAPIInstanceCreateInheritsFleetPlacement`'s setup. |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `go test ./internal/console/ -run 'FleetBox|LeastLoaded|MixedVersion|ConcurrentCreatesSpread|SidecarCreateLabels|RootfsAdmissionFollows'` |
| +Expected: FAIL (undefined). |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +Freshness and readiness reuse `status.BoxStale`, `boxRootfsReady` and `boxAtRootfsFloor` and the active-box join at `rootfs.go:212-238`. Load counts labelled records per box over `AppsPlacedOn` plus `provision.ListRecordsCompleteJudged`. A rootfs create chooses among rootfs-ready boxes at the rootfs floor. The admission check in `rootfsReadyRefusal` uses the chosen box when a label was chosen and keeps today's fleet-wide rule otherwise. |
| + |
| +- [ ] **Step 4: Run them to see them pass** |
| + |
| +Run: the Step 2 command plus `-run 'Rootfs|FleetPlacement'`. Expected: PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 3: A fleet box mints only its own records (rules 2, 9, 10) |
| + |
| +**Files:** |
| +- Modify: `internal/provision/reconcile.go` (`ReconcileConfig`, :1253, :2182, :2263), `internal/provision/seedreconcile.go:177`, `internal/provision/sidecar_reconcile.go`, `internal/registry` (Route `Assigned` column), `internal/host/agent.go:3504` (`provisionTickConfig`) |
| +- Test: `internal/provision/reconcile_test.go`, `reconcile_lifetime_test.go`, `internal/host/host_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: Task 1's fields. |
| +- Produces: `ReconcileConfig.FleetBox string` (this box's label, from `resolveFleetIdentity`); `func (cfg ReconcileConfig) ownsRecord(rec Record) bool` (true when the box is not on a fleet, the record has no label, or the label equals `cfg.FleetBox`); `registry.Route.Assigned string` (column `fleet_assigned`, migration), minted from `rec.FleetBoxAt` on the box's own row. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestFleetBoxMintsOnlyItsOwnRecords` (two records labelled `pi-1` and `pi-2` and one unlabelled: box `pi-1` mints the first and third), `TestRelabelledRowIsRemovedNotKept` (a minted row whose record now names `pi-2` is removed by the removal phase on `pi-1`, lifetimes on and off, copying `TestOutOfScopeValidRecordFollowsTodaysRemoval`), `TestSidecarFollowsItsLabel`, `TestMintedRowCarriesTheAssignment` (`Route.Assigned` equals the record's `FleetBoxAt`, and a changed `FleetBoxAt` rewrites the row), `TestProvisionTickConfigCarriesTheFleetBox` (beside `TestProvisionTickConfig`). |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `go test ./internal/provision/ ./internal/host/ -run 'FleetBoxMints|RelabelledRow|SidecarFollows|MintedRowCarries|ProvisionTickConfigCarries'` |
| +Expected: FAIL. |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +`ownsRecord` sits beside `inScope` and is checked wherever `inScope` admits a record or keeps a row on a fleet box (the scan, the row filter, the removal phase, seeds, sidecars). A row removed this way stops its instance through the existing `RetireExcept` path. |
| + |
| +- [ ] **Step 4: Run them to see them pass** |
| + |
| +Run: `go test ./internal/provision/ -run 'Reconcile|FleetBox|Sidecar|Seed'` and the host test. Expected: PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 4: No stale local copy (rule 6, #470) |
| + |
| +**Files:** |
| +- Modify: `internal/activator/backend_exec.go` (`restorePlain`, beside `reconcileSeedMarker` at :879) |
| +- Test: `internal/activator/activator_test.go` beside `TestExecBackendRestoreWarmCacheIsNotFresh` (:5774) |
| + |
| +**Interfaces:** |
| +- Consumes: `registry.Route.Assigned` (Task 3). |
| +- Produces: `func reconcileAssignmentMarker(rt registry.Route, dbPath string) error`; marker file `dbPath + ".assigned"` holding `rt.Assigned`. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestAssignmentChangePurgesTheWarmCopy` (a local db with marker `T1`, route `Assigned` `T2`: the db and its litestream sidecar state are removed before the warm-cache check, so `restorePlain` restores; the marker then reads `T2`), `TestSameAssignmentKeepsTheWarmCopy` (marker equals `Assigned`: warm cache kept, no restore), `TestUnassignedRouteIgnoresTheMarker` (`Assigned` empty: today's behaviour, marker untouched), `TestMissingMarkerWithAssignmentPurges` (a db with no marker under an assigned route counts as stale). |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'AssignmentChange|SameAssignment|UnassignedRoute|MissingMarker'` |
| +Expected: FAIL. |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +Mirror `reconcileSeedMarker`'s purge (the same files it removes). Write the marker only after a successful restore or when keeping a matching copy, so a failed restore leaves no marker and the next wake purges again. HA routes keep their own rules (`restoreHA`), unchanged. |
| + |
| +- [ ] **Step 4: Run them to see them pass** |
| + |
| +Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'Assignment|Marker|WarmCache|Seed'`. Expected: PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 5: The forward row knows the box from the start (rule 3) |
| + |
| +**Files:** |
| +- Modify: `internal/provision/forward.go` (`forwardRowFor` :25, `forwardCurrent` :43), `internal/registry/forward.go` (`putForwardSQL` :260-285, `PutForward` :297, `SetFleetBoxIf` :29), the forward shape table (`forwardShape`, :93) |
| +- Test: `internal/registry/forward_test.go`, `internal/registry/fleetbox_if_test.go`, `internal/provision/forward_test.go` |
| + |
| +**Interfaces:** |
| +- Produces: forward rows carry `FleetBox = rec.FleetBox`; registry column `fleet_label` (the record's label) on forward rows; `PutForward` writes `fleet_box` from a non-empty label; `SetFleetBoxIf` changes nothing on a row whose `fleet_label` is set. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestForwardRowCarriesTheLabel` (provision: a labelled record mints `FleetBox:"pi-2"`; a relabel to `pi-1` rewrites it; an unlabelled record leaves `FleetBox` to the bindings as today), `TestPutForwardWritesTheLabelAsFleetBox`, `TestBindingDoesNotOverrideALabel` (registry: `SetFleetBoxIf` on a labelled row returns false and leaves `fleet_box`), `TestBindingStillBindsUnlabelledRows` (today's behaviour). Update `TestForwardShapeClassesEveryField` for the new column. |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `go test ./internal/provision/ ./internal/registry/ -run 'ForwardRowCarries|PutForwardWritesTheLabel|BindingDoesNotOverride|BindingStillBinds|ForwardShape'` |
| +Expected: FAIL. |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +`forwardCurrent` compares `FleetBox` so a relabel rewrites the row and a quiet pass writes nothing. `fleetChannelFor`'s fallback (`internal/edge/edge.go:3223`) stays: it still serves unlabelled rows and a labelled box that is briefly disconnected answers 503 rather than reaching a box that does not hold the host. Add a test for that in `internal/edge` (`TestLabelledForwardDoesNotFallBack`): a labelled row whose box is disconnected answers 503 with `Retry-After`. |
| + |
| +- [ ] **Step 4: Run them to see them pass** |
| + |
| +Run: the Step 2 command plus `go test ./internal/edge/ -run 'LabelledForward|FleetRoute'`. Expected: PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 6: Label existing records, move a lost box's records, drain on detach (rules 2, 4, 5) |
| + |
| +**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` (`handleAPIFleetDetachBox` :544, `handleFleetDetachBoxPage` :1455) |
| +- Test: `internal/console/fleetrelabel_test.go`, `cmd/console/claimworkers_started_test.go` |
| + |
| +**Interfaces:** |
| +- Consumes: Tasks 1-2. |
| +- Produces: `func (s *Server) fleetRelabelPass(ctx context.Context) error`; worker name `FleetRelabel`, every 5 minutes, started like `StartRunSweep`; `func (s *Server) relabelOff(ctx context.Context, fleet, label string) (moved int, stuck []string, err error)`; `const fleetBoxLostAfter = lease.LeaseTTL + 5*time.Minute`; refusal copy `msgDetachStrandsApps(fleet, label string, apps []string) string`. |
| + |
| +- [ ] **Step 1: Write the failing tests** |
| + |
| +`TestRelabelPassLabelsAReadyFleet` (two current boxes, three unlabelled records: all labelled, spread 2-1), `TestRelabelPassLeavesAMixedFleetAlone`, `TestRelabelPassMovesALostBoxsRecords` (box `pi-1` silent for 21 minutes: its records go to `pi-2` with a newer `FleetBoxAt`; silent for 19: nothing moves), `TestRelabelLosesToAConcurrentRelabel` (`ErrFleetBoxMoved` is skipped, not retried in the same pass), `TestDetachRelabelsFirst` (detach `pi-1`: its records move to `pi-2`, then the box is detached), `TestDetachRefusesWhenNothingCanTakeThem` (only box ready: 409 with `msgDetachStrandsApps`, nothing relabelled, box still active), `TestEveryRegisteredClaimWorkerIsStarted` passes with `FleetRelabel`. |
| + |
| +- [ ] **Step 2: Run them to see them fail** |
| + |
| +Run: `go test ./internal/console/ ./cmd/console/ -run 'RelabelPass|RelabelLoses|DetachRelabels|DetachRefuses|ClaimWorker'` |
| +Expected: FAIL. |
| + |
| +- [ ] **Step 3: Implement** |
| + |
| +Each pass reads only fleets with two or more active boxes, under `lockFleet`. Relabelling uses `chooseFleetBox(..., exclude)` and `SetRecordFleetBox` wanting the old label. Log one line per moved record (host, from, to, reason). The detach doors call `relabelOff` before `SetFleetBoxStatus`. Run the refusal string through Luna with the plan's other copy before merge. |
| + |
| +- [ ] **Step 4: Run them to see them pass** |
| + |
| +Run: the Step 2 command. Expected: PASS. |
| + |
| +- [ ] **Step 5: Commit** |
| + |
| +### Task 7: A real two-box fleet test |
| + |
| +**Files:** |
| +- Create: `internal/host/fleettwobox_e2e_test.go` |
| +- Test helpers: build on `newE2EWorld` (`internal/host/movesoffline_e2e_test.go:215`: `leasetest.NewS3Server`, `CARLOS_S3_ENDPOINT`, real `ExecBackend` lease take and restore) |
| + |
| +**Interfaces:** |
| +- Consumes: everything above. |
| + |
| +- [ ] **Step 1: Write the test** |
| + |
| +`TestTwoBoxFleetEndToEnd_Real` with two box agents `pi-1`, `pi-2` on one fake S3, the console in process, a tiny native app writing a counter to its database: |
| +1. Two instances created: one lands on each box (labels, rows, forward rows). |
| +2. Each box mints only its own; each instance's lock owner names its box. |
| +3. Instance `a` on `pi-1`: write `1`. Stop `pi-1`'s agent and advance the console clock 21 minutes: the relabel pass moves `a` to `pi-2`; after the lease lapses `pi-2` restores and reads `1`; write `2`. |
| +4. Bring `pi-1` back: it drops `a`'s row and does not serve it. |
| +5. Relabel `a` back to `pi-1` (detach `pi-2`): `pi-1` purges its stale copy, restores and reads `2`, not `1`. |
| + |
| +- [ ] **Step 2: Run it** |
| + |
| +Run: `TMPDIR=/tmp/k go test ./internal/host/ -run TestTwoBoxFleetEndToEnd_Real -v` |
| +Expected: PASS. If it fails, fix the code, not the test (systematic debugging). |
| + |
| +- [ ] **Step 3: Commit** |
| + |
| +### Task 8: Census, review, merge |
| + |
| +- [ ] **Step 1:** `go test ./internal/provision/ -run TestPlan14RootReadCensus`; on failure follow AGENTS.md "The census" (`make census-card`, CLAIMS, `make census-propose NAME=<branch>`). The reviewer decides; record it on #280. |
| +- [ ] **Step 2:** Luna copy pass on `msgDetachStrandsApps` and any CLI 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. Tasks 3, 4 and 6 touch production storage and the removal path, so the brief names them. |
| +- [ ] **Step 4:** CI green on the tip; merge with `amadan branch merge carlos/platform <branch> -squash` on Paul's go. |
| + |
| +### Task 9: Prove it on dev |
| + |
| +Live action, needs Paul's go with the scoped plan: account dev (kass), eu-west-1, one extra t4g.small fleet box `box-2` added to r10r with `carlos fleets add-box` and bootstrapped like box-1, for about two hours, then detached and terminated. Cost: about $0.05. |
| + |
| +- [ ] **Step 1:** After the release carrying this (v0.33.0 or later) is on dev, add `box-2`; wait for both boxes current; within one relabel pass, `shop` and `railsdemo` carry labels, spread one per box. |
| +- [ ] **Step 2:** Create a throwaway app on r10r: it lands on the less loaded box; its public URL serves from that box (edge log on the hub names the box). |
| +- [ ] **Step 3:** Detach `box-2`: its instances move to `box-1` and serve within the lease window; then terminate `box-2`. |
| +- [ ] **Step 4:** Post results on #457 and close #470. |
diff --git a/docs/superpowers/plans/CODEX-REVIEW-BRIEF-MANAGED-FLEETS-1B-PLAN.md b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-MANAGED-FLEETS-1B-PLAN.md| new file mode 100644 |
| index 000000000..79c8458f7 |
| --- /dev/null |
| +++ b/docs/superpowers/plans/CODEX-REVIEW-BRIEF-MANAGED-FLEETS-1B-PLAN.md |
| @@ -0,0 +1,37 @@ |
| +# Review brief: managed fleets 1b plan, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `design-managed-fleets-457`, tip: the commit that adds this brief. |
| +Under review: `docs/superpowers/plans/2026-10-30-managed-fleets-1b-box-per-instance.md`. |
| +Authorities: the spec `docs/superpowers/specs/2026-10-28-managed-fleets-design.md` §4 "1b addendum" rules 1-10 (approved by Paul 2026-10-30); main at 65fd8060 (merged into this branch), including fleet public routes (1a). Check every file:line and signature the plan names against the code here. |
| + |
| +You are an independent reviewer. Read the plan, the spec section and the code it names. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's rulings: rules 1-7 and rule 6's mechanism (assignment time on the record, a marker beside the local copy; not the lock's last holder). Rules 8-10 are the author's calls; challenge them only with a failure scenario. |
| +- Region HA, claims and managed provisioning (phase 2) are out of scope. |
| + |
| +## What to check |
| + |
| +1. Does any path let two boxes run one instance's writer, or a box boot a stale copy, given the lease, the relabel, the forward row, and a box that was partitioned rather than dead? |
| +2. Mixed versions: older box, console or platform-box binaries that drop or ignore the new record fields, the new route columns, and the label floor's gate. Does the floor actually hold the invariant during a roll? |
| +3. Task 3's removal-phase change: can it remove a row that should stay (lifetimes on and off, seeds, sidecars), or keep one that should go? |
| +4. Task 4's purge: can it delete a database holding writes nothing else has (an unreplicated tail on the only copy)? Compare with `reconcileSeedMarker`. |
| +5. Task 5: the forward row, bindings and `fleetChannelFor` fallback together: any request routed to a box that does not hold the host, or a fight between `PutForward` and `SetFleetBoxIf`? |
| +6. Task 6: worker registration, the lost-box threshold against the lease, the conditional relabel, and the detach doors. |
| +7. Are the tasks' tests sufficient to catch the failures above, and is Task 7 buildable on `newE2EWorld`? |
| +8. Request budget and census implications the plan misses. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks the plan. |
| +- **P2**: wrong or missing. Fixed without reopening this review. |
| +- **P3**: clarity or polish. Follow-up list only. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3, each with the task, the problem, evidence (file:line, verified), the failure scenario, a concrete fix and its fault family (the invariant or trust boundary). End with exactly one verdict: **READY**, **READY AFTER FIXES** (no P1), or **NOT READY** (P1s listed). |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents. Do not run the full test suites. |