carlos / platform Public

docs: #1139 Task 10 accepted limit (round 4)

Round 4 of the Task 10 review (Codex) found one P1: nested-only does
not give the cleanup exclusive access. Nested instances also run as
User=carlos, separated only by mount namespaces. A flat app still awake
on a partly migrated box shares the uid and can reach the seed's
storage (the mixed-layout path), and the layout pass can move an
interrupted placement's database back into the shared flat directory
(the reversion path).

Paul accepted this as a known limit on 2026-11-20, with no further
code. Nested-only and PurgeProven stay.

The threat model written for round 3 claimed distinct uids, which was
wrong. It is rewritten, on rollbackFleetFileSeed and in design §3.6,
around namespace isolation and the host-specific fence, with the limit
stated: the cleanup proof trusts every process on the fleet's own
boxes, all of them the fleet owner's, not to move seed data aside
during cleanup. If one does, the hostname can be freed while the bytes
stay orphaned on that box. They are never restored and never visible
to another account.

Recorded in design §11 and the plan's review log. FS-26's new text is
approved (Paul, 2026-11-20).

Comments and docs only.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 0e0d0e4d06c8cb83007a69142b02932f4762de0e parent 9eba055
4 files changed, +99 −51
  • docs/superpowers/plans/2026-11-20-fleet-seeded-create.md +4 −4
  • docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md +55 −24
  • internal/activator/seedplace.go +4 −3
  • internal/provision/seedfleet.go +36 −20

CI failed — run details

diff --git a/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md b/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md
index e7d943bb3..41bc439f0 100644
--- a/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md
+++ b/docs/superpowers/plans/2026-11-20-fleet-seeded-create.md
@@ -22,7 +22,7 @@ Plan round 2 (`CODEX-FINDINGS-fleet-seeded-create-plan-R2.md`): NOT READY, 2 P1,
Plan round 3 (`CODEX-FINDINGS-fleet-seeded-create-plan-R3.md`): NOT READY, 1 P1 and 1 P2, both fixed here. R3-1: `seedFleetReady` refuses a claim-enabled console first (Task 16, `TestFileSeedFleetClaimConsoleRefuses`); the reviewer named this a refuse-up-front case matching the plan's declared scope. R3-2 (P2): `seedsFloorFields` takes the box identity and moves context (Task 11, two tests). A fourth round needs Paul's go.
-Task 10's own review (Codex, three rounds; design §11): round 1 fixed a transient check failure reported as terminal and a path-based cleanup scan; round 2 put purge and proof in one function that holds its directories (`instancefs.PurgeProven`); round 3 found two more in the same family, all needing a same-uid writer during cleanup. Paul chose (2026-11-20) to **refuse flat boxes for fleet file seeds** (Decision D13). This revision changes Review Focus 4, Task 9's flat test, Task 10 rule 1 and its tests, Task 16's readiness rule and FS-26. A short round 4 confirms it.
+Task 10's own review (Codex, three rounds; design §11): round 1 fixed a transient check failure reported as terminal and a path-based cleanup scan; round 2 put purge and proof in one function that holds its directories (`instancefs.PurgeProven`); round 3 found two more in the same family, all needing a same-uid writer during cleanup. Paul chose (2026-11-20) to **refuse flat boxes for fleet file seeds** (Decision D13). This revision changes Review Focus 4, Task 9's flat test, Task 10 rule 1 and its tests, Task 16's readiness rule and FS-26. Round 4 (on that change): NOT READY, one P1: nested-only does not give the cleanup exclusive access, because nested instances also run as `User=carlos`, separated only by mount namespaces. It named the mixed-layout path (a flat app still awake on a partly migrated box, `internal/layout/pass.go:390`) and the reversion path (the layout pass moving an interrupted placement's database back into the shared flat directory, `plan.go:186`, `pass.go:397`). **Paul accepted this as a known limit (2026-11-20), with no further code.** Nested-only and `PurgeProven` stay, and the threat model is rewritten to say what is trusted (design §3.6 and §11, the comment on `rollbackFleetFileSeed`). FS-26's new text is approved.
Earlier: no plan review before round 1. The design's round history carries into every brief written from this plan (stopping rule 1). Three design rounds: R1 (6 findings), R2 (abandonment family, cut (a)), R3 (R3-1 exhaustive listing, R3-2 staging, R3-3 sweep). The plan review starts at round 1 and has the usual three-round budget.
@@ -489,7 +489,7 @@ func rollbackFleetFileSeed(ctx context.Context, reg *registry.Registry, cfg Reco
The rules, each a numbered test below:
1. **Layout** (design §3.5 item 0, Decision D13). Nested only. `seedAction` (`seedreconcile.go:151`) and `seededRestore` (`seedplace.go:160`) refuse a flat box for a fleet file seed exactly as for every other seed: no row is minted (the pass logs "this box does not mint nested") and a wake fails with the existing sentence "… this box does not run instances nested." Neither is reported to the door, so the seed stays `ready`. A fleet box also mints a file seed only when it has the fleet hooks. Claim control still refuses, and `LayoutForeign` still refuses.
- **Threat model** (design §3.6, and the comment on `rollbackFleetFileSeed`): the cleanup proof assumes no other writer to the nested instance directory during cleanup. The instance is stopped under the fence, its directory is owned by its own uid, and root and the box agent are trusted for this invariant.
+ **Threat model and accepted limit** (design §3.6, and the comment on `rollbackFleetFileSeed`; Paul, 2026-11-20, after review round 4): instances share one uid, nested ones too, and are separated by mount namespaces; the fence stops one host. So the cleanup proof trusts every process on the fleet's own boxes, all of them the fleet owner's, not to move seed data aside during cleanup. If one does, the hostname can be freed while the bytes stay orphaned on that box: never restored, never visible to another account.
2. **Reading.** `fetchSeed` calls `b.Seeds.Open(ctx, rt.Account, rt.App, host, id)`.
3. **Staging (R3-2).** For an unplaced fleet file seed (the kind is `file`, the state is not `placed`, and the box is on a customer fleet), `seededRestore` first lists `MovesPrefix(host)` through `b.Mirror`. If anything is there, it reports `copy-exists` through `OnSeedFailed` and fails the wake with FS-40. A listing error fails the wake and reports nothing (Decision D7). This runs before step 1's replica question.
4. **Admission (R2-2).** When `hasOwnReplica` is true for such a seed, `ReadSeedMarker(dbPath)` must name `src.ID`. If it does not, or it cannot be read, report `copy-exists`, fail the wake, and restore nothing. If it does, `restoreOwn` runs through `restorePlain` with staging promotion off.
@@ -843,7 +843,7 @@ House rules applied: no em dashes; curly apostrophes; placeholders in their orde
| FS-23 | the platform on %s in fleet %s is below the seeds floor. Update it, then try again. | %s in fleet %s are below the seeds floor. Update the platform on those boxes, then try again. | approved (Paul, 2026-11-20) |
| FS-24 | claim control is on for %s in fleet %s. Seeded instances are not supported there yet. | %s in fleet %s run with claim control on. Seeded instances are not supported there yet. | approved (Paul, 2026-11-20) |
| FS-25 | This deployment’s seeds floor does not allow seed files yet. An operator publishes it again with carlos system seeds-floor publish. | This deployment’s seeds floor predates seed files. An operator publishes it again with carlos system seeds-floor publish. | approved (Paul, 2026-11-20) (capital T, as SD-N3) |
-| FS-26 | %s in fleet %s keeps all its instances in one shared directory. A seed file needs a box that keeps each instance in its own. | the layout of %s in fleet %s is neither nested nor flat. Seed files need one of those. | **pending (Paul)**: redrafted for Decision D13 (nested only). The earlier text was approved 2026-11-20 and is now wrong. Shown for any box whose layout is not nested |
+| FS-26 | %s in fleet %s keeps all its instances in one shared directory. A seed file needs a box that keeps each instance in its own. | the layout of %s in fleet %s is neither nested nor flat. Seed files need one of those. | approved (Paul, 2026-11-20) (redrafted for Decision D13, nested only; shown for any box whose layout is not nested) |
| FS-27 | the seed file on the box did not match the upload | the file on the box did not match its upload, so it was not used | approved (Paul, 2026-11-20) (Seed.Reason) |
| FS-28 | the seed file on the box failed its integrity check | the file is not a database that passes an integrity check, so it was not used | approved (Paul, 2026-11-20) (Seed.Reason) |
| FS-29 | a copy of data already exists for this hostname | same | approved (Paul, 2026-11-20) (Seed.Reason; design §3.6's words) |
@@ -894,7 +894,7 @@ House rules applied: no em dashes; curly apostrophes; placeholders in their orde
- **The bucket is not named.** The console knows the bucket the fleet was created against (`registry.Fleet.Bucket`, `internal/registry/fleets.go:41`, from `carlos fleets create --bucket`). But the box writes to its own `CARLOS_HIBERNATE_BUCKET` (`internal/host/agent.go:885`, `seedDataOpener(cfg.Bucket, …)`), and nothing checks the two match. The sentence says "the fleet’s storage", which is true either way.
- Reporting the prefix itself through the heartbeat was the alternative. It would be box-supplied text a member reads, which D4 rules out.
-- **D13. Fleet file seeds need a nested box** (Paul, 2026-11-20, after Task 10 review round 3; it replaces design ruling 3 as first accepted). Three review rounds found cleanup-identity failures that all need a same-uid writer during cleanup, which a flat box has by design. On a nested box the instance directory belongs to the instance's own uid and that instance is stopped under the fence. So the box never mints or places a fleet file seed flat, and the console refuses a fleet with a box that is not nested (Task 16, FS-26). The per-instance temp names (Task 9), `instancefs.PurgeProven` and the both-locations proof (D5) stay: harmless, and they guard a layout change. Eleven's fleet `eleven` must run nested before slice 4.
+- **D13. Fleet file seeds need a nested box** (Paul, 2026-11-20, after Task 10 review round 3; it replaces design ruling 3 as first accepted). Three review rounds found cleanup-identity failures that all need a same-uid writer during cleanup, which a flat box has by design. A nested instance is confined to its own directory by its mount namespace and is stopped under the fence, which narrows the exposure without removing it; what is left is the limit Paul accepted after round 4 (design §3.6). So the box never mints or places a fleet file seed flat, and the console refuses a fleet with a box that is not nested (Task 16, FS-26). The per-instance temp names (Task 9), `instancefs.PurgeProven` and the both-locations proof (D5) stay: harmless, and they guard a layout change. Eleven's fleet `eleven` must run nested before slice 4.
## Design gaps found while planning
diff --git a/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md b/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
index 6218a6c4d..2d63b5af3 100644
--- a/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
+++ b/docs/superpowers/specs/2026-11-20-fleet-seeded-create-design.md
@@ -50,7 +50,9 @@ MB at most) on a machine the platform never ran.
not hold for the cleanup proof of §3.6: on a flat box every app writes
to one shared data directory as one uid, so another of the fleet
owner's apps can replace what a cleanup is working on, and the proof
- cannot be made (§11). Boxes with claim control armed are still refused,
+ cannot be made (§11). Nested-only narrows that exposure; it does not
+ remove it, and what is left is an accepted limit (§3.6, "What the proof
+ assumes"). Boxes with claim control armed are still refused,
as in §3.4.
4. **A fleet box records seed progress through the console.** The store
door refuses a fleet box's writes to `apps/<sqid>/<app>/instances/*`
@@ -239,22 +241,39 @@ the proof can be made. It is enforced in one place, the box's rollback of
an aborted file seed, and the door's `rolledback` operation is the only
way it is reported.
-**What the proof assumes (threat model; Paul, 2026-11-20, after Task 10
-review round 3).** The local half of the proof assumes that nothing else
-writes to the instance's nested directory while the cleanup runs:
-
-- a fleet file seed is placed only on a nested row (§2 ruling 3), and a
- nested instance directory is owned by that instance's own uid, so no
- other app on the box can write in it or replace it;
-- that instance is stopped under the fence for the whole cleanup;
-- root and the box agent are trusted for this invariant. They are the
- ones proving it.
-
-A flat data directory breaks the first point, which is why flat boxes are
-refused. The rollback still purges and proves both local locations, and
-its purge holds its directories open and checks their identity
-(`instancefs.PurgeProven`). Those are defence in depth and guard a layout
-change; the invariant does not rest on them.
+**What the proof assumes (threat model), and its accepted limit (Paul,
+2026-11-20, after Task 10 review round 4).** What separates a seed's data
+from the rest of the box is not a uid. Every instance on a box runs as the
+same user, nested ones too (`carlos-instance@.service`, `User=carlos`). A
+nested instance is kept to its own directory by its unit's mount namespace,
+and the rollback's fence is for one host: it stops that host and nothing
+else. So during the cleanup other processes of that uid can be running on
+the box and able to reach the seed's storage:
+
+- a flat app still awake on a box that is partly migrated
+ (`internal/layout/pass.go:390` defers moving an awake host), which runs
+ in no such namespace;
+- the layout pass itself, which with a flat intent moves a host's files, an
+ interrupted placement's database included, back into the shared flat
+ directory (`internal/layout/plan.go:186`, `pass.go:397`).
+
+Nested-only placement (§2 ruling 3) and the descriptor-holding purge
+(`instancefs.PurgeProven`) narrow this. They do not close it. The limit:
+
+- The cleanup proof trusts every process on the fleet's own boxes not to
+ move seed data aside while the cleanup runs.
+- On a customer fleet all such processes are the fleet owner's own: their
+ apps, on their boxes. Root and the box agent are trusted, and are the
+ ones making the proof.
+- If one does, the hostname can be freed while the abandoned bytes stay
+ orphaned on that box. They are never restored: a later placement purges
+ only its own names and reads only its own snapshot, and the replica side
+ still requires the marker. They are never visible to another account.
+
+The rollback still purges and proves both local locations, and its purge
+holds its directories open and checks their identity. Those are defence in
+depth and guard a layout change. The invariant of this section is as
+strong as the trust above, and no stronger.
**Abandonment.** A seed is `aborted` by `SeedFail`, by the console's
deadline sweep (a `file` seed in `reserving` past `seedFileReserveTTL`,
@@ -456,24 +475,36 @@ review (stopping rule 3), and its brief names R3-1 and R3-2.
## 11. Task 10 review dispositions
Task 10 (placement and rollback on a fleet box) had its own review, by
-Codex, as §10 required. Three rounds, each NOT READY.
+Codex, as §10 required. Four rounds, each NOT READY; the fourth ended in
+an accepted limit.
| Round | Finding | Disposition |
|---|---|---|
| 1 | P1 a transient integrity-check failure aborts a valid seed | Fixed: `not-a-database` is reported only for a verdict on the contents (`lease.CheckSaysDamaged`); a check that could not run is retried |
| 1 | P1 the cleanup proof follows symlinked directory components | Fixed: the scan opens with no symlink followed, from descriptors |
| 2 | P1 the cleanup does not keep directory identity across list, remove and proof | Stopping rule 2 (same family twice). Paul chose "state the invariant, enforce it in one place, guard test": one function owns each location and holds its directories (`instancefs.PurgeProven`) |
-| 3 | P1 a failed purge forgets the original storage, so the next pass proves an empty replacement | Not fixed in code. See below |
-| 3 | P1 recursive removal stats a child and then opens it separately, so a swapped child is removed in place of the original | Not fixed in code. See below |
+| 3 | P1 a failed purge forgets the original storage, so the next pass proves an empty replacement | Not fixed in code: covered by the limit accepted in round 4, below |
+| 3 | P1 recursive removal stats a child and then opens it separately, so a swapped child is removed in place of the original | Not fixed in code: covered by the limit accepted in round 4, below |
Round 3's two findings and round 2's share one cause: a writer with the
same uid as the data, active during the cleanup. On a flat box that
writer exists by design, since every app shares one data directory and
one uid. **Paul chose (2026-11-20) to refuse flat boxes** for fleet file
-seeds (§2 ruling 3, §3.5 item 0) instead of chasing each interleaving. On
-a nested box the instance directory belongs to the instance's own uid and
-that instance is stopped under the fence, so the writer does not exist
-(§3.6, "What the proof assumes"). A short fourth round confirms this.
+seeds (§2 ruling 3, §3.5 item 0) instead of chasing each interleaving.
+
+**Round 4** (on the nested-only change): NOT READY, one P1. Nested-only
+does not establish exclusive access, and the threat model written for
+round 3 was wrong to claim distinct uids. Nested instances also run as
+`User=carlos`, separated only by mount namespaces. Two paths were named:
+the **mixed-layout** path, where a flat app still awake on a partly
+migrated box (`internal/layout/pass.go:390`) shares the uid and can reach
+the seed's storage; and the **reversion** path, where the layout pass moves
+an interrupted placement's database back into the shared flat directory
+(`internal/layout/plan.go:186`, `pass.go:397`).
+
+| Round | Finding | Disposition |
+|---|---|---|
+| 4 | P1 nested-only does not give the cleanup exclusive access (mixed layout, reversion) | **Accepted as a known limit (Paul, 2026-11-20). No further code.** Nested-only and `PurgeProven` stay. The threat model is rewritten around namespace isolation and the host-specific fence, with the limit stated: §3.6, "What the proof assumes" |
The work rounds 1 and 2 added stays: the per-instance temp names, the
descriptor-holding purge and the both-locations proof.
diff --git a/internal/activator/seedplace.go b/internal/activator/seedplace.go
index 433b6c5a2..acdae5158 100644
--- a/internal/activator/seedplace.go
+++ b/internal/activator/seedplace.go
@@ -184,9 +184,10 @@ func (b *ExecBackend) seededRestore(ctx context.Context, rt registry.Route, src
paths := b.pathsFor(rt)
// Nested only, for every seed on every box, a customer fleet's
// included (design §2 ruling 3 as changed after Task 10's review round
- // 3): in a flat directory any other app of the same uid can replace
- // what a cleanup is working on, and the fleet rollback's proof assumes
- // no such writer (provision.rollbackFleetFileSeed).
+ // 3): in a flat directory every other app on the box can replace what
+ // a cleanup is working on. A nested instance is confined by its mount
+ // namespace, which narrows that; what is left is the limit written on
+ // provision.rollbackFleetFileSeed.
if paths.layout != LayoutNested {
return fail(seedRefusedFlat(host))
}
diff --git a/internal/provision/seedfleet.go b/internal/provision/seedfleet.go
index 16c748e32..e165980fb 100644
--- a/internal/provision/seedfleet.go
+++ b/internal/provision/seedfleet.go
@@ -163,28 +163,44 @@ func fleetSeedPurgeProven(dataDir, dbPath string, nested bool) error {
// a head or root-layout files, and misses a generation left behind
// once its head is gone (R3-1).
//
-// The threat model (Paul, 2026-11-20, after review round 3). The local
-// half of the proof assumes that nothing else writes to the instance's
-// nested directory while the cleanup runs. That holds because:
+// The threat model, and the limit Paul accepted on 2026-11-20 after Task
+// 10's review round 4.
//
-// - a fleet file seed is minted and placed only on a nested row
-// (seedMintRefusal, the activator's seededRestore), and a nested
-// instance directory is owned by that instance's own uid, so no other
-// app on the box can write in it or replace it;
-// - that instance is stopped under the fence for the whole of the
-// cleanup, so its own uid runs nothing;
-// - root and the box agent are trusted for this invariant. They are the
-// ones proving it.
+// What separates a seed's data from the rest of the box is not a uid. Every
+// instance on a box runs as the same user, nested ones too
+// (carlos-instance@.service, User=carlos). A nested instance is kept to its
+// own directory by its unit's mount namespace, and this rollback's fence is
+// for one host: it stops this host and nothing else. So during the cleanup
+// other processes of that uid may be running on the box and able to reach
+// the seed's storage:
//
-// A flat data directory breaks the first point: every app on the box
-// writes there as one uid, and one of them could move the data aside
-// during the purge, or swap a child directory between the purge's stat of
-// it and its open, and so have an untouched copy counted as gone. No
-// amount of care in the purge closes that, which is why flat boxes take no
-// file seed. The flat location is still purged and proved here, and
-// PurgeProven still holds its descriptors and checks identity: both are
-// defence in depth, and they guard a box whose layout changed, but neither
-// is what the invariant rests on.
+// - a flat app that is still awake on a box that is partly migrated
+// (internal/layout/pass.go defers moving an awake host), which runs in
+// no such namespace;
+// - the layout pass itself, which with a flat intent moves a host's
+// files, an interrupted placement's database included, back into the
+// shared flat directory (internal/layout/plan.go).
+//
+// Nested-only placement (seedMintRefusal, the activator's seededRestore)
+// and the descriptor-holding purge (instancefs.PurgeProven) narrow this.
+// They do not close it. The accepted limit:
+//
+// - The cleanup proof trusts every process on the fleet's own boxes not
+// to move seed data aside while the cleanup runs.
+// - On a customer fleet all such processes are the fleet owner's own:
+// their apps, on their boxes. Root and the box agent are trusted, and
+// are the ones making the proof.
+// - If one does move the data aside, the hostname can be freed while the
+// abandoned bytes stay orphaned on that box. They are never restored: a
+// later placement purges only its own names and reads only its own
+// snapshot, and a replica is restored only with the marker that names
+// the seed. They are never visible to another account: they are on the
+// owner's box, under the owner's own data directory.
+//
+// So the flat location is still purged and proved here, and PurgeProven
+// still holds its descriptors and checks identity. Both are defence in
+// depth and guard a box whose layout changed; the invariant is as strong as
+// the trust above, and no stronger.
//
// Anything else is "not proven": a hook missing, a fence that does not
// proceed, a row that appeared, a purge or a stat that fails, a listing