carlos / platform Public

rootfs plan 6: amendment 2026-10-30 (preflight) and its Astra brief

The preflight against main c24e7a04 found Plan 6 not buildable as written;
its rulings PF-1..PF-32 are accepted. This amends the plan before the
dependent tasks are built:

- New Task 7a, carlos run on rootfs rows (PF-1, PF-2, PF-32): the run half
  of the reverted Plan 3 Task 12 without --version. It fixes that task's
  Astra R1 P1 #1 (Call A1: root kills a rootfs one-shot unit at lease loss,
  graceful stop at residentLeaseShort whatever the entry's state, a second
  kill when an in-flight start returns, oneShotHeadroom before a start) and
  P1 #4 (CmdSpec.AfterSettled: the run dir goes only once the unit is
  proven gone). It builds RFS-3-C27 and lets rootfs records through the
  always-on arm of runClassRefusal.
- Task 9 (PF-3, PF-17, PF-18): tty holds killed at lease loss beside cmd
  holds, workers and generations; sessions not refused for a release; the
  four idle/stop checks cover both holds.
- Tasks 10, 11, 16 (PF-4): long connections hold no lifetimes unit; each
  record write runs in its own mutating unit (lifetimesStep); refused ends
  are finished by the sweep; cutover-drain tests with a session or relay
  open.
- PF-6..PF-32 folded into the tasks they change; stale file:line point at
  preflight section 1 rows (PF-5).
- Copy: RFS-6-C47 revised (keeps --egress-allow and --size) and RFS-6-C65
  new, both pending Paul's copy review. Until the review's commit adds
  RFS-6-C65 to rootfsCopyIDs, TestRootfsCopyDeckParses and
  TestRootfsCopyRecordIsComplete fail on this branch.

Review brief: docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rootfs-plan6-amendment.md
(round 1 of 3). No code changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 5d802f2e18c0107c04c0e7a149a2baeab47a2465 parent c24e7a0
3 files changed, +575 −63
  • docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md +499 −60
  • docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md +6 −3
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rootfs-plan6-amendment.md +70 −0

CI failed — run details

Intent

Human

Approved.

Human

<task-notification> <task-id>ae788846b0095491a</task-id> <tool-use-id>toolu_015NN9KtSdfq1fP62bsu888Y</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/ae788846b0095491a.output</output-file> <status>completed</status> <summary>Agent "Draft #471 WebSocket tunnel spec" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>The implementation plan and the Astra plan-review brief are committed and pushed. The branch tip on amadan is **937bdd79**, and `ls-remote` shows the same commit. - **a3ca3873**: the plan, `docs/superpowers/plans/2026-10-30-tunnel-websockets.md`, rev 1. The review brief names this commit. - **937bdd79**: `docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-plan.md`, round 1 of 3. - **4c4bc976**: before writing the plan I merged main `c24e7a04` (the fleet-routes follow-ups) into the branch, so the plan's line numbers match main. The spec's evidence stays on `65fd8060`; the plan header notes the few lines that moved in `edge.go`. **Tasks:** - **Task 0:** copy deck TWS-C01..C03 and its gate; rows stay `pending` until you send Paul's text. - **Task 1:** box half in `tunnelclient`: the shim inside `Mark`, the capability header, and the 250 / 1 MiB / 160 MiB limits, with the SETTINGS and connection window checked separately. - **Task 2:** hub half, `RoundTripUpgrade` and `UpgradeConn`. - **Task 3:** the hub's registry, reservation, tenancy, capability and header scrub, with upgrades still refused (a test pins the 502). - **Task 4:** the reload mutex and the sweep: hooks, the deterministic two-Reload test, and the guard test. - **Task 5:** this is the task that turns on the hub's marker. Upgrades get the existing 502 through Task 4 and a real 101 from here on. It also adds the 503/502 answers and the cause text, and migrates the three 1a policy tests. - **Task 6:** the production-wired witness: real hub on TLS, real tunnel loop, real box edge with its gate, and an Action Cable-shaped WebSocket app. - **Task 7:** maximum load at production values (scaled under `-short`), hub restart, and the two-Reload test with real sockets. - **Task 8:** the Action Cable channel in `examples/rails-shop`. It uses an inline script because the sample has no importmap, and adds no new visible words. - **Task 9:** census, whole-branch review, merge. - **Task 10:** live on dev: 101 with the welcome frame and pings, the revocation, plain HTTP unchanged, no flagship. **What I couldn't plan without a decision:** - **D-1, the live revocation (blocks Task 10 step 4 only).** No `carlos` command changes a fleet's owner. Doing it through the dev hub's registry would be an operator write on a deployment and would break "operate via API and CLI". The options: - **(a), recommended:** create a throwaway copy of the sample, `cable`, on r10r, open its `/cable`, then `carlos apps delete` it. That uses the CLI only. It costs a second rootfs app on box-1 for a few minutes, so check box-1's free memory first (read-only). - **(b):** a scoped registry write on the dev hub, which needs Paul's approval. - **(c):** skip a live revocation and rely on the in-process witness, which already covers the owner change. - **D-2:** the approved text for TWS-C01..C03. Task 5 can't write those strings until then. **Rulings I made inside the plan:** - **P-1:** the old-box log line uses the edge's existing `logThrottled`, which logs the first occurrence and then every 300th. The spec said "once per channel per hour", so Task 5 also amends spec §4.9's wording. - **P-2:** the test-scaled limits are passed in as data rather than mutable globals. - **P-3:** `TunnelHub.conn` becomes `channel`, and Task 3 migrates both of its callers. **Lessons from fleet public routes, built in:** - **Callers:** each task lists the callers of every function it changes, tests included. For example, the `Mark` callers in `reqrecords_test.go`, `guard_test.go` and `mark_test.go`, and every `Reload` caller. - **Refusal fixtures:** every refusal test has a positive control in the same fixture. - **Interleavings:** decided by a `TryLock` and an ordered event log, never sleeps. - **One shared decision:** tenancy comes only from `Reload`'s arm, and the upgrade check is `isUpgradeRequest` everywhere. - **Read-back:** owner changes and token changes are read back through `FleetOwners`, `ListFleetBoxes` and `Get` before use. - **No production seams added for tests:** the `ModifyResponse` and `ErrNotSupported` cases are built from the production proxy and writers. The plan's self-review found and fixed two things: the guard test said the lock was `Reload`'s first statement, which clashed with the `enter` hook, and two harness details that wouldn't have worked. Per-task Astra review is set for Tasks 3, 4 and 5.</result> <usage><subagent_tokens>446537</subagent_tokens><tool_uses>27</tool_uses><duration_ms>473210</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bzf0s5vnq</task-id> <tool-use-id>toolu_019D2hHBBjFxiFPySuszas85</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/bzf0s5vnq.output</output-file> <status>completed</status> <summary>Background command "Run Astra plan review round 1 on #471" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 26.4 g CO₂e (3,407,766 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on rootfs-apps-6-interactive, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md
index 9891d7813..cf84e67a6 100644
--- a/docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md
+++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md
@@ -6,7 +6,7 @@
**Architecture:** The CLI opens a WebSocket to the console. The console admits the session on the instance record, then writes a grant signed with the release key into the bucket. The box that owns the instance sees the record, verifies the grant, and dials out to the console's box door. The console joins the two connections. On the box, the agent allocates a pseudo-terminal and starts a new one-shot unit, `carlos-instance-tty@` or its rootfs twin, through the control service. The unit's trampoline receives the terminal's far end over its stdin socket and runs the command on it as the controlling terminal. The terminal is never opened by path inside any namespace: every instance template hides `/dev/pts`.
-**Tech Stack:** Go 1.26; `golang.org/x/net/websocket`, which is in the already-required `golang.org/x/net v0.56.0` (`go.mod:28`), so `go.mod` does not change; `golang.org/x/sys/unix` for the terminal ioctls and termios; systemd 257 units; the existing instance-control service.
+**Tech Stack:** Go 1.26; `golang.org/x/net/websocket`, which is in the already-required `golang.org/x/net` (v0.60.0 at c24e7a04, `go.mod:28`; PF-26), so `go.mod` does not change; `golang.org/x/sys/unix` for the terminal ioctls and termios; systemd 257 units; the existing instance-control service.
**Spec:** `docs/superpowers/specs/2026-10-24-rootfs-apps-design.md` rev 5, §5.10 and correctness rule C9; §5.11 and C10 for the JIT opt-in's reach into sessions. The run design (`docs/superpowers/specs/2026-10-08-carlos-run-design.md` rev 4) is the base this extends. Read both. The series map and shared contract are in `docs/superpowers/plans/2026-10-24-rootfs-apps-0-index.md`.
@@ -35,6 +35,42 @@ Findings from `CODEX-FINDINGS-ROOTFS-PLANS-R2.md` that touch this plan, checked
String IDs added or changed: none.
+## Amendment 2026-10-30 (preflight)
+
+The preflight of 2026-10-30 (`.superpowers/sdd/2026-10-24-rootfs-apps-6-interactive/preflight.md`, read against main c24e7a04) found this plan not buildable as written. Its rulings PF-1 to PF-32 are accepted as written (the SDD ledger, `progress.md`). This section says what changed. Each changed task carries its changes under a line that starts **Amended 2026-10-30**.
+
+**File and line references (PF-5).** The plan's file:line references were taken on main of 2026-10-24, and most have moved. A reference written "see preflight §1 row N" points at that row, which gives today's location. A reference this amendment did not re-check is left in the step text; where it and the row differ, the row wins.
+
+**Order.** Tasks 2, 3, 5, 6 and 7 build now, because none of them depends on this amendment. Task 4 waits for the copy review of RFS-6-C47. Task 7a comes after Task 7 and after this amendment's review: it uses Task 5's `instancectl.OneShot` and Task 6's role-aware `stopRootfs`. Tasks 8 to 16 come after Task 7a. Task 13 also waits for the copy review of RFS-6-C65.
+
+**What changed.** One line each; the task holds the detail.
+
+1. **New Task 7a, `carlos run` on rootfs rows** (PF-1, PF-2, PF-32). It brings back the run half of the reverted Plan 3 Task 12 (56cc06aa and 6c6f8607, reverted at bba9a52d) without `--version`. It fixes that task's Astra R1 P1 #1 (a rootfs command outlives the lease) and P1 #4 (the run directory is deleted before the termination proof), builds RFS-3-C27, and lets rootfs records through `runClassRefusal`'s always-on arm. P1 #2, P1 #3 and P2 #5 of that review were about `--version` and go with it: `--version` stays deferred (#431), and RFS-3-C17 to C22 and C26 stay unbuilt.
+2. **Task 9** (PF-3, PF-17, PF-18). At a rootfs instance's lease loss the tty hold is killed and proven gone beside the cmd hold (Task 7a), the workers and the generations, within the lease margin. A session is not refused for a release process. The four idle and stop checks and the stop's cancel cover both holds.
+3. **Tasks 10, 11 and 16** (PF-4). A long connection (a session's CLI leg, its box leg, a run relay) holds no lifetimes unit. Each record write takes its own mutating admission through `Server.lifetimesStep` (Task 10). A write refused while the gate drains ends the session with RFS-6-C37 at admission, or is finished by the sweep at the end. Each task tests a cutover that drains and activates while a long session or relay stays open.
+4. **Rulings folded into tasks:** PF-6 (Tasks 6 and 8), PF-7 (Tasks 5, 6 and 8), PF-8 (Tasks 5 and 15), PF-9 (Tasks 5 and 7), PF-10 and PF-21 (Task 4), PF-11 (Task 13), PF-12 (every task that builds a row), PF-13 (Task 16), PF-14 (Tasks 3, 6, 7a and 16), PF-15 (Tasks 12 and 16), PF-16 (Tasks 11 and 16), PF-17 and PF-18 (Task 9), PF-19 (Tasks 3, 12 and 16), PF-20 (Task 10), PF-22 (Task 10), PF-23 (Tasks 10, 11 and 16), PF-24 (Global Constraints, Tasks 4, 10 and 11), PF-26 (Tech Stack), PF-27 (Tasks 5 and 6), PF-30 (Task 16), PF-32 (Tasks 7a and 8). PF-29 needs no change.
+5. **Copy** (PF-10, PF-11). RFS-6-C47 is revised and RFS-6-C65 is new. Both are `pending` in the deck and the string table until Paul's copy review.
+
+**Call A1: root kills a rootfs one-shot unit at lease loss.** This goes beyond the letter of PF-3, so the review should check it. PF-3 has cmd and tty holds stopped and proven at lease loss beside the workers, in the shape Plan 3 accepted for workers (no kill: root refuses one for a worker). For runs and sessions that shape alone does not close Task 12 R1 P1 #1, the failure this amendment was asked to fix. A stop is SIGTERM, then SIGKILL after `TimeoutStopSec=20` (`internal/host/units/carlos-instance-rootfs-cmd@.service:36`). After the loss, another box may acquire the lease once the safety margin has passed. Root's `/stop` refuses `kill=1` for anything but a generation (see preflight §1 row 6; the rule is in `parseRequest`, `internal/instancectl/server.go`), and Astra's fix for P1 #1 named that root-side change. So Task 7a makes it:
+- root accepts `kill=1` on a rootfs stop of a one-shot role (`instancectl.OneShot`: cmd, and tty once Task 5 names it), and kills with the generations' `killGen` (`internal/instancectl/gen.go:459`);
+- the agent kills cmd holds (Task 7a) and tty holds (Task 9) at the loss, beside `killResidentGens` and `stopRootfsWorkersAtLoss`;
+- at `residentLeaseShort` the agent stops them gracefully (30 s before the safety deadline, `residentDrainBudget`; a 20 s stop fits);
+- a start in flight at the loss is killed at once and again when its start returns;
+- a rootfs one-shot starts only while the lease is safe for at least `oneShotStartLead()` more, the worker rule (`workerStartLead`, `internal/activator/rootfsworkers.go:122-150`).
+
+Workers keep Plan 3's shape. Cost if wrong: one more root verb under the census (Task 7a's proposal on #280). Without it, a command that ignores SIGTERM keeps writing for up to 20 s after the loss (C7).
+
+**Mixed versions.** A console with Task 7a admits a rootfs run. A box below Task 7a's release still refuses it at `StartCmd` (`errRootfsBinaryLaunch`, see preflight §1 row 1), and its runs worker reports that as a failed start (`runs.InterruptedStartFailed`, exit 125). Nothing runs from the wrong image. For sessions, a box from before Task 12 never dials, and the session expires with RFS-6-C18 (Review Focus 4).
+
+**Known limit (PF-15).** On a born-HA host (region HA, dev only), only the box whose activator holds the host awake acts on a session or a fleet run. On a sleeping HA host a session expires with RFS-6-C18.
+
+**Cross-plan changes.**
+- The index's Plan 3 row still lists "`carlos run` for rootfs (off fleet boxes) and `--version`". Rootfs runs are now Plan 6 Task 7a, and `--version` is deferred (#431). The index line changes when this plan merges.
+- `plan3_groups_test.go`: Task 7a moves RFS-3-C27 from `plan3CopyRuns` to `plan3CopyA`, the group `carlos run` belonged to before the cut. Task 16 takes RFS-3-C28 out of `plan3CopyRuns` when it strikes the row.
+- The zero-downtime deck's record `zdd.apps-set.nothing` (`docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json:53`) holds today's `appsSetNothing`. Task 4 changes it to RFS-6-C47's approved text in the same commit, or `TestZeroDowntimeCopyIsApplied` goes red.
+
+String IDs added or changed: RFS-6-C47 (revised, pending) and RFS-6-C65 (new, pending). Task 7a builds RFS-3-C27 (approved). Task 16 strikes RFS-3-C28 (PF-13).
+
---
## Contract deviations
@@ -72,15 +108,17 @@ String IDs added or changed: none.
- R6: the platform never inspects an image. `carlos console` resolves only the manifest's declared `console` process (`release.ProcessConsole`, Plan 1).
- No new Go module. Use `golang.org/x/net/websocket` and `golang.org/x/sys/unix`, both already required.
- Linux-only syscalls (pty ioctls, `SCM_RIGHTS`, `TIOCSCTTY`) go behind `//go:build linux` with a `!linux` stub. The CLI's terminal code builds on darwin, linux and windows. Windows refuses with RFS-6-C07.
-- Copy: every user-facing string is in the table at the end, IDs `RFS-6-C01` to `RFS-6-C64`. The series deck gates them (Plan 1 Task 1). Style: no em dashes, lower case after a full stop inside a sentence (the run deck's voice), neutral names only (`shop`, `example.com`).
+- Copy: every user-facing string is in the table at the end, IDs `RFS-6-C01` to `RFS-6-C65` (C65 added and C47 revised 2026-10-30, both pending until Paul's copy review). The series deck gates them (Plan 1 Task 1). Style: no em dashes, lower case after a full stop inside a sentence (the run deck's voice), neutral names only (`shop`, `example.com`).
- Census, per the index's repo rules:
- new routes join `internal/console/testdata/claim-routes.txt` with claim fixtures;
- new person-only doors join `closedDoors` (`internal/console/svcroutes_test.go:85`);
- the setting door joins `policyDoors` (`:81`);
- - changes to root-run code (the control service) re-pin `TestPlan14RootReadCensus` through the census overlay recipe, with a proposal on amadan #280 for Paul's ruling.
+ - changes to root-run code (the control service) re-pin `TestPlan14RootReadCensus` through the census overlay recipe. **Amended 2026-10-30 (PF-14):** follow the 2026-10-26 rule: `make census-card`, CLAIMS, `make census-propose`; Astra approves on #280; Paul is never asked. The branch keeps one overlay, `plan14-root-reads-rootfs-apps-6.tsv`, on the chain, extended by each task that moves the census (3, 6, 7a, 16).
No console SQL table is added. The `sessions` table name is taken, by web logins.
-- Test names: `shop`, hosts under `example.com`. A claim or console fixture that seeds a tenant-named app is given a `shop` app of its own (a `shopManifest()` helper: `titoManifest()` with the name changed, as Plan 4 adds one; reuse Plan 4's if it has merged), never the tenant's name.
+- Test names: `shop`, hosts under `example.com`. A claim or console fixture that seeds a tenant-named app is given a `shop` app of its own (a `shopManifest()` helper: `titoManifest()` with the name changed, as Plan 4 adds one; reuse Plan 4's if it has merged), never the tenant's name. **Amended 2026-10-30 (PF-24):** Plan 4's helper is on main as `shopManifest(app, domain)` (`internal/console/remoteinstances_test.go:57`); reuse it. Claim-census fixtures follow their harness and use the `bab` paths it uses, as the steps below write them. Behavioural tests use accounts `bah` and `baj` (`domains.Sqid(7)`, `Sqid(8)`), never `bab` or `k3x`.
+- **Lifetimes (amended 2026-10-30, PF-4).** Every console request is a lifetimes unit (`serveAdmitted`, see preflight §1 row 10), and a GET is admitted as a read. A long connection holds no unit. The CLI door ends its request's unit at the upgrade. The box doors are in `lifetimesExempt`, because they read no record. Each record write a session or a relay makes (grant, record transition, audit, serial bump) runs in its own mutating unit through `Server.lifetimesStep` (Task 10), held only for that step's store calls.
+- **Region HA (amended 2026-10-30, PF-15).** On a born-HA route (`registry.Route.HA`), the box acts on a session or a fleet run only when its activator holds the host awake (`activator.Service.HoldsAwake`, Task 12). Otherwise it ignores the record before reading anything.
- Tests: locally, only the touched package with `-run`, and leave `GOCACHE` at its default. New `internal/host` tests call `t.Parallel()` unless they set env, cwd, umask, log output or package vars.
- Refusals and launches are tested through real wiring: a real `console.Server` on `httptest`, a real activator with the existing fake control channel, and, in Task 15, real units on the root runner.
@@ -110,7 +148,8 @@ String IDs added or changed: none.
| `internal/host/units/carlos-instance-tty@.service`, `carlos-instance-rootfs-tty@.service` (new) | the session units |
| `internal/host/units/*.service` (instance templates, probe) | `TemporaryFileSystem=/dev/pts:ro` in the namespace block |
| `internal/instancectl/names.go`, `cmd.go`, `server.go`, `stagedexe.go`, `client.go` | `RoleTTY`, `POST /tty`, `GET /tty/{host}`, stop, reset and sweep coverage |
-| `internal/instanceexec/tty_linux.go`, `tty_other.go` (new), `exec.go`, `probe.go` | the trampoline's tty role; the `pts-private` probe check |
+| `internal/instanceexec/tty_linux.go`, `tty_other.go` (new), `exec.go`, `exit.go`, `probe.go`, `probe_rootfs_linux.go`, `probe_rootfs_other.go` | the trampoline's tty role (both programs, PF-9); the `pts-private` probe check and its production wiring (PF-8) |
+| `internal/activator/cmdunit.go`, `backend_rootfs.go`, `cmd.go`, `rootfs_service.go`, `unitproc.go`; `internal/instancectl/server.go`, `rootfs.go`; `internal/console/apiruns.go`; `internal/host/runexec.go`; `docs/site/cli.md` | Task 7a (amended 2026-10-30): `carlos run` on rootfs rows, the one-shot kill at lease loss, the run directory kept until the termination proof |
| `internal/activator/pty_linux.go`, `pty_other.go` (new), `cmdunit.go`, `cmd.go`, `activator.go`, `prepare.go` | pty allocation and handoff; the tty start; the entry's `tty` hold |
| `internal/layout/plan.go` | `launch.tty.json` is a platform name |
| `internal/host/interactive.go` (new), `agent.go`, `changeindex.go` | the box's session worker and its wiring |
@@ -145,10 +184,14 @@ Expected: each prints at least one line. If any prints nothing, stop: Plans 1 to
Read `runClassRefusal` (`internal/console/apiruns.go:55-70` at 64a002c8) as Plan 3 left it. Expected: it returns `""` for a `Runtime == "rootfs-v1"` record that does not sleep on a platform box (Plan 3 Task 12), and still refuses every fleet-placed record (`:66-68`, Plan 3 D4: kept until this plan's Task 16, ruling R7). If the always-on refusal (`:61`) still applies to rootfs records, stop and raise it. Sessions do not use the fleet arm: Task 10 splits `runClassRefusal` into `instanceClassRefusal` (every arm but the fleet one, which sessions use) and the fleet arm on top (which runs keep until Task 16).
+**Amended 2026-10-30 (PF-1, PF-2).** This check has been run, and it fails: Plan 3 Task 12 was reverted (bba9a52d), so the always-on arm refuses every rootfs record (see preflight §1 rows 1 and 10). It is not a stop any more. Task 7a builds the missing half. This step now only confirms that nothing else changed since the preflight: `git grep -n 'does not sleep, so the platform' internal/console/apiruns.go` prints one line. After Task 7a lands, the arm reads `!rec.HibernateOrDefault() && rec.Runtime != provision.RuntimeRootfsV1`.
+
- [ ] **Step 3: Check the copy rows**
Confirm that rows RFS-6-C01 to RFS-6-C64 (the table at the end of this plan) are in the deck and marked approved. If they are missing, add them as pending, exactly as written here, and stop until Paul has reviewed them. (Note: the deck was approved by delegation on 2026-10-24 (Paul asked for a Luna copy pass instead of a string-by-string review; see the deck header), so the gate's approval step is satisfied; the step applies only to rows added after that date.) Every later task adds the ids it writes to the series gate's built list (Plan 1 Task 1's test) in the same commit.
+**Amended 2026-10-30 (PF-10, PF-11, PF-12).** RFS-6-C01 to C64 were approved on 2026-10-24, but two rows are owed. RFS-6-C47 is revised, to keep `--egress-allow` and `--size` (today's `appsSetNothing` is IP1-57). RFS-6-C65 is new: `-it` with `--idempotency-key`. Both are `pending` in the deck and in the string table below until Paul's copy review. Task 4 waits for C47 and Task 13 for C65. The gate's inventory (`rootfsCopyIDs`, `approved_rootfs_copy_test.go`) gains "RFS-6-C65" in the commit that applies the review: the deck and the inventory must name the same rows (`TestRootfsCopyDeckParses`, `TestRootfsCopyRecordIsComplete`). No RFS-6 row's file cell names a real path. So each task that builds a row rewrites that row's file cell to the path it wrote, with the old cell as a note in parentheses, as Plans 2 to 4 did. The text never changes, so no review is needed.
+
---
### Task 2: `internal/interactive`, the shared vocabulary
@@ -301,10 +344,12 @@ git commit -m "interactive: ids, limits, frames and the signed grant (rootfs pla
**Files:**
- Create: `internal/provision/interactive.go`
-- Modify: `internal/provision/provision.go:70-76` (the field beside `ActiveRun`)
-- Modify: `internal/provision/reconcile.go:129-135` (the field) and `:1177-1179` (the call)
+- Modify: `internal/provision/provision.go` (the field beside `ActiveRun`; see preflight §1 row 3)
+- Modify: `internal/provision/reconcile.go` (the field beside `RunSeen`, and the call beside `RunSeen`'s; see preflight §1 row 3)
- Test: `internal/provision/interactive_test.go`
+**Amended 2026-10-30 (PF-14, PF-19).** `SetRecordInteractive` wraps `updateRecord` exactly as `SetRecordRun` does (see preflight §1 row 3), so record reads and writes go through the lifetime judge when the caller's context carries `provision.WithLifetimes`. It never writes the record by another path. Add a test, `TestSetRecordInteractiveIsJudged`, in the shape of `TestUpdateRecordRefusesAStaleRecordUnderAJudge` (`internal/provision/lifetime_judge_test.go:323`): under `WithLifetimes(ctx, NewLifetimeJudge())`, with a host incarnation slot that no longer vouches for the record, `SetRecordInteractive(..., InteractiveAdmit(...))` returns the same error that test expects, and the record's bytes are unchanged. The census goes through the 2026-10-26 recipe (Global Constraints), not a proposal for Paul.
+
**Interfaces:**
- Consumes: `updateRecord` (the transition helper `SetRecordRun` wraps, `internal/provision/run.go:80-83`); `ErrRunMoving`, `ErrRunImport` (`run.go:52-62`).
- Produces:
@@ -358,7 +403,7 @@ The hook call goes in the same loop as `RunSeen` (`reconcile.go:1177`), guarded
- [ ] **Step 4: Run them and see them pass, then the record's census**
-Run the Step 2 command, then `go test ./internal/provision/ -run 'TestPlan14RootReadCensus|TestOrdinaryWriters' -count=1`. Expected: PASS. If the root-read census moved, follow the census overlay recipe and post the proposal on #280 before going on.
+Run the Step 2 command, then `go test ./internal/provision/ -run 'TestPlan14RootReadCensus|TestOrdinaryWriters|TestSetRecordInteractiveIsJudged' -count=1`. Expected: PASS. If the root-read census moved, follow the census overlay recipe (amended 2026-10-30, PF-14: `plan14-root-reads-rootfs-apps-6.tsv`, `make census-propose`, Astra approves on #280) before going on.
- [ ] **Step 5: Commit**
@@ -372,11 +417,20 @@ git commit -m "provision: the interactive session marker and reconcile's hook (r
### Task 4: The per-app setting (`carlos apps set --interactive on|off`)
**Files:**
-- Create: `internal/appconfig/interactive.go`; Modify: `internal/appconfig/appconfig.go:87-88` (the field beside `Swap`)
-- Create: `internal/console/apiinteractivesetting.go`; Modify: `internal/console/authcli.go:914` (register beside `/swap`)
-- Modify: `apps_swap.go:20-47` (usage, strings), `:94-170` (flag, request, `appsSetRun`)
-- Modify: `internal/console/svcroutes_test.go:81` (`policyDoors`) and `:85-235` (`closedDoors`); `internal/console/testdata/claim-routes.txt`; `internal/console/claim_invariant_fixtures_test.go` (a door fixture beside `:1898`)
-- Test: `internal/appconfig/interactive_test.go`, `internal/console/apiinteractivesetting_test.go`, `apps_swap_test.go`
+- Create: `internal/appconfig/interactive.go`; Modify: `internal/appconfig/appconfig.go` (the field beside `Swap`; see preflight §1 row 4)
+- Create: `internal/console/apiinteractivesetting.go`; Modify: `internal/console/authcli.go` (register beside `/swap`; see preflight §1 row 4)
+- Modify: `apps_swap.go` (usage, strings, flag, request), `apps_updates.go` (`appsSetRun`; see preflight §1 row 4)
+- Modify: `internal/console/svcroutes_test.go` (`policyDoors`, `closedDoors`); `internal/console/testdata/claim-routes.txt`; `internal/console/claim_invariant_fixtures_test.go` (a door fixture beside the swap fixture; see preflight §1 row 4)
+- Modify: `docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json` (the `zdd.apps-set.nothing` record takes RFS-6-C47's approved text)
+- Test: `internal/appconfig/interactive_test.go`, `internal/console/apiinteractivesetting_test.go`, `apps_swap_test.go`, `apps_updates_test.go`
+
+**Amended 2026-10-30 (PF-10, PF-21, PF-24, PF-12).**
+- Do not start this task until RFS-6-C47 is `approved`. C47 is revised to keep `--egress-allow` and `--size`, which `apps set` gained with instance policy (#328/#329); the string table below has the draft.
+- `appsSetRun` is now `appsSetRun(ctx, sess, acct, app, swap *swapPolicyReq, policy updatePolicyReq, change *policyChange)` (`apps_updates.go`). Append `interactive *bool` after `change`, and extend its nothing-given check: `swap == nil && policy == nil && change == nil && interactive == nil`. `runAppsSet`'s own check (`apps_swap.go`, before `resolveMode`) gets the same clause.
+- Count `appsSetNothing` at the base commit before the edit (the copy-review scope trap). At c24e7a04 there is one definition (`apps_swap.go:41`) and three uses (`apps_swap.go:100`, `:169`, `apps_updates.go:94`). Two tests compare by the name (`apps_swap_test.go:54`, `apps_updates_test.go:247`), and one record holds the text: `zdd.apps-set.nothing` in the zero-downtime deck, checked by `TestZeroDowntimeCopyIsApplied`. Change the definition and the record in one commit. The tests follow by name.
+- `policyDoors` already holds `/{app}/policy`. Add `/{app}/interactive` beside it.
+- The claim fixture uses the harness's `bab` path, as Step 4 writes it (PF-24). The behavioural tests in Step 1 use accounts `bah` and `baj` and the app `shop`.
+- Rewrite the deck's file cells of RFS-6-C38 to C47 to the paths written (PF-12).
**Interfaces:**
- Consumes: `release.WithAppMutation`, `getForWriteAt`, `touchLogged` (`internal/appconfig/swap.go:58-115`); `apiAccountApp`, `allowWrite`, `readJSONStrictLimit`, `configStoreError`, `audit`, `bumpSerial` (as `handleAPISwapPut` uses them, `internal/console/apiswap.go:32-85`); `RoleOwner`.
@@ -390,7 +444,7 @@ func SetInteractive(ctx context.Context, s release.Store, acct, app string, on b
// body {"interactive": true|false} (strict reader, 8 KiB); answer {"interactive": bool}
// turning it on needs acct.Role == RoleOwner (403 RFS-6-C38); any member may turn it off
// CLI: (s *apiSession) setInteractive(ctx, a apiAcct, app string, on bool) (bool, error)
-// appsSetRun(ctx, sess, acct, app, swapReq, policy, interactive *bool)
+// appsSetRun(ctx, sess, acct, app, swap *swapPolicyReq, policy updatePolicyReq, change *policyChange, interactive *bool) // amended 2026-10-30 (PF-21)
```
- [ ] **Step 1: Write the failing tests**
@@ -407,6 +461,7 @@ func TestInteractiveSettingRefusesServiceCredentials(t *testing.T) // 403 closed
func TestInteractiveSettingRefusesAMissingField(t *testing.T) // {} -> 400 RFS-6-C39
// CLI
func TestAppsSetInteractive(t *testing.T) // "on" and "off" build the request; "yes" -> RFS-6-C43; nothing given -> RFS-6-C47; output RFS-6-C44 / C45
+func TestAppsSetInteractiveAloneIsSomethingToSet(t *testing.T) // amended 2026-10-30 (PF-21): appsSetRun(ctx, sess, acct, "shop", nil, nil, nil, &on) reaches the interactive door and not RFS-6-C47; all four nil -> exactly RFS-6-C47
```
- [ ] **Step 2: Run them and see them fail**
@@ -416,7 +471,7 @@ Expected: FAIL.
- [ ] **Step 3: Implement**
-`SetInteractive` copies `claimRawSetSwapPolicy`'s CAS read-modify-write, inside `release.WithAppMutation(…, "appconfig.SetInteractive", …)`. The CLI flag is `--interactive`, a string `on|off`, given alongside `--swap`. Replace `appsSetNothing` with RFS-6-C47 (one definition, `apps_swap.go:39`, used at `:98`, `:161` and `apps_updates.go:93`). Count the occurrences at the base commit before the edit.
+`SetInteractive` copies `claimRawSetSwapPolicy`'s CAS read-modify-write, inside `release.WithAppMutation(…, "appconfig.SetInteractive", …)`. The CLI flag is `--interactive`, a string `on|off`, given alongside `--swap`. Replace `appsSetNothing`'s text with RFS-6-C47's approved text (one definition, three uses, and the zero-downtime record: see the amendment above). Count the occurrences at the base commit before the edit.
- [ ] **Step 4: Census, then run everything**
@@ -425,12 +480,12 @@ Expected: FAIL.
- Add `route PUT /api/cli/apps/{account}/{app}/interactive` to `claim-routes.txt`.
- Add a door fixture: `claimAPI(http.MethodPut, "/api/cli/apps/bab/shop/interactive", `{"interactive":true}`)`, the swap fixture's shape.
-Run: the Step 2 commands, then `go test ./internal/console/ -run 'TestEveryCLIDoorNamesItsRoles|TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant' -count=1`. Expected: PASS.
+Run: the Step 2 commands, then `go test ./internal/console/ -run 'TestEveryCLIDoorNamesItsRoles|TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant' -count=1` and `go test . -run 'TestAppsSet|TestZeroDowntimeCopyIsApplied|TestRootfsCopy|TestRootfsBuilt' -count=1`. Expected: PASS.
- [ ] **Step 5: Commit** (add RFS-6-C38 to C47 to the built list)
```bash
-git add internal/appconfig internal/console apps_swap.go apps_swap_test.go
+git add internal/appconfig internal/console apps_swap.go apps_swap_test.go apps_updates.go apps_updates_test.go approved_rootfs_copy_test.go docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json
git commit -m "interactive: the per-app setting and carlos apps set --interactive (rootfs plan 6)"
```
@@ -446,9 +501,13 @@ git commit -m "interactive: the per-app setting and carlos apps set --interactiv
- Modify: `internal/host/units_rootfs_test.go` (Plan 2's `rootfsTemplates` gains `carlos-instance-rootfs-tty@.service`; its per-unit table gains the tty lines; the `added` entry for `/dev/pts:ro` in `TestRootfsNamespaceRestatesTheBinaryBlock` is dropped, since the binary block now has it)
- Modify: `internal/layout/plan.go:208` (the role list)
- Test: `internal/host/units_isolation_test.go:231-317, 421-479`, `internal/host/host_test.go:45`, `internal/host/units_hardening_test.go:45,113`, `internal/instancectl/names_test.go`, `internal/instanceexec/probe_test.go`
+- Every line number in this list is as of 2026-10-24: see preflight §1 row 5 for today's.
-**Interfaces:**
-- Consumes: Plan 2's `carlos-instance-rootfs-cmd@.service`, its rootfs block, `RootfsUnitName`, `IsRootfsUnit`, `RootfsExeDir`, `ptsPrivate`.
+**Amended 2026-10-30 (PF-7, PF-8, PF-9, PF-27).**
+- **Role (PF-27).** `ParseRole` now accepts five literals, `RoleWorker` among them. `RoleTTY` makes six. Worker rules stay as they are.
+- **Names (PF-7).** `RootfsUnitName`, `IsRootfsUnit` and `ParseUnitName` know run, cmd and worker today. Each learns `RoleTTY` (`UnitPrefixRootfsTTY`), and `RootfsExeDir(root, key, RoleTTY)` is `<root>/<key>/rootfs/tty`. `TestRoleTTYNames` asserts each of them for the rootfs prefix too: `RootfsUnitName(RoleTTY, "bill-2.example.com") == "carlos-instance-rootfs-tty@bill\x2d2.example.com.service"`, and `ParseUnitName` of that answers `(RoleTTY, …)` with `IsRootfsUnit` true.
+- **Rootfs tty template (PF-9).** Its `ExecStopPost=` is `/opt/carlos/carlos instance-exit --rootfs tty %I`, as the rootfs cmd template's is `instance-exit --rootfs cmd %I`. The swap table's rootfs row and `TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines` use that line. Task 7 teaches both programs `tty`.
+- **The probe (PF-8).** `productionProbeEnv` (`internal/instanceexec/probe.go`, see preflight §1 row 5) sets neither `devPts` nor `openPtmx`. Only `productionRootfsProbeEnv` does (`probe_rootfs_linux.go`, with the `!linux` stub `probe_rootfs_other.go`). Without that wiring, the binary probe's new `pts-private` line always fails, and every box loses `NestedOK` at roll. So this task wires both into the binary probe's production env: a linux setter beside the rootfs one, and the existing `!linux` stub. Add a test, `TestBinaryProbeEnvWiresPts` (linux): `productionProbeEnv()` has a non-nil `devPts` and `openPtmx`, and `ptsPrivate` over it answers through them (a fixture with an empty directory and an `openPtmx` that fails reads ok). Task 15's checklist rolls dev first and watches `nested` readiness.
- Produces:
```go
const RoleTTY Role = "tty" // ParseRole accepts it
@@ -472,7 +531,7 @@ The tty template is `carlos-instance-cmd@.service` with exactly these swaps, and
| `StandardError=file:/run/carlos/logs/%I.cmd-err.sock` | `StandardError=journal` |
| `BindReadOnlyPaths=/run/carlos-control/exe/%I/cmd-app:/opt/carlos/app /run/carlos-control/exe/%I/cmd-live:/opt/carlos/live` | the same with `tty-app` and `tty-live` |
-PID 1 connects `StandardInput=file:` to the agent's socket as root, outside the namespace, on the nosymfollow logs mount, as for the cmd streams. The journal lines carry only the trampoline's own diagnostics, because the tenant's stdio is the pty. The rootfs tty template is Plan 2's `carlos-instance-rootfs-cmd@.service` with the same `Description=`, `ExecStart=` (`instance-exec --rootfs tty %I`), `ExecStopPost=` (`instance-exit tty %I`) and stdio swaps, and with every `rootfs/cmd/` path under `/run/carlos-control/exe/%I/` (its `RootImage=` and its two `BindReadOnlyPaths=` sources) as `rootfs/tty/`. It binds no `tty-app`/`tty-live` (the image is the app), and its namespace block is Plan 2's rootfs block, byte for byte.
+PID 1 connects `StandardInput=file:` to the agent's socket as root, outside the namespace, on the nosymfollow logs mount, as for the cmd streams. The journal lines carry only the trampoline's own diagnostics, because the tenant's stdio is the pty. The rootfs tty template is Plan 2's `carlos-instance-rootfs-cmd@.service` with the same `Description=`, `ExecStart=` (`instance-exec --rootfs tty %I`), `ExecStopPost=` (`instance-exit --rootfs tty %I`, amended 2026-10-30, PF-9) and stdio swaps, and with every `rootfs/cmd/` path under `/run/carlos-control/exe/%I/` (its `RootImage=` and its two `BindReadOnlyPaths=` sources) as `rootfs/tty/`. It binds no `tty-app`/`tty-live` (the image is the app), and its namespace block is Plan 2's rootfs block, byte for byte.
- [ ] **Step 1: Write the failing tests**
@@ -490,12 +549,12 @@ Also add both tty templates to the embedded-unit list in `host_test.go:45` and t
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/host/ -run 'TestTTYTemplate|TestRootfsTTYTemplate|TestInstanceTemplatesShareOneNamespace|TestEmbeddedUnits|TestUnitsHardening' -count=1; go test ./internal/instancectl/ -run TestRoleTTYNames -count=1; go test ./internal/instanceexec/ -run TestProbePtsPrivate -count=1`
+Run: `go test ./internal/host/ -run 'TestTTYTemplate|TestRootfsTTYTemplate|TestInstanceTemplatesShareOneNamespace|TestEmbeddedUnits|TestUnitsHardening' -count=1; go test ./internal/instancectl/ -run TestRoleTTYNames -count=1; go test ./internal/instanceexec/ -run 'TestProbePtsPrivate|TestBinaryProbeEnvWiresPts' -count=1`
Expected: FAIL.
- [ ] **Step 3: Write the names, the two templates, the block line and the probe check**
-The binary probe's check is `detail, ok := ptsPrivate(e); pass("pts-private", detail, ok)`: Plan 2 wrote `ptsPrivate` and the production `devPts`/`openPtmx` wiring (and the `!linux` stub) for the rootfs probe, so this task adds one call, not a second implementation.
+The binary probe's check is `detail, ok := ptsPrivate(e); pass("pts-private", detail, ok)`: Plan 2 wrote `ptsPrivate` and the production `devPts`/`openPtmx` wiring (and the `!linux` stub) for the rootfs probe, so this task adds one call, not a second implementation. (Amended 2026-10-30, PF-8: Plan 2's wiring covers only the rootfs probe's env. This task also sets the two fields in the binary probe's production env, as above.)
- [ ] **Step 4: Run them and see them pass**
@@ -517,7 +576,25 @@ git commit -m "units: the tty templates; /dev/pts hidden in every instance names
- Modify: `internal/instancectl/stagedexe.go:132-150` (`ensureCmdExeAt`, `removeCmdExe` take the role's sources)
- Modify: `internal/instancectl/server.go:323-331` (routes), `:661`, `:695`, `:702` (role sets and the one-shot exe clean), `:726` (sweep patterns), `:788` (sweep exe clean)
- Modify: `internal/instancectl/client.go:197-232`
-- Test: `internal/instancectl/cmd_test.go`, `server_test.go`
+- Modify: `internal/instancectl/rootfs.go` (`startRootfsCmd`, `rootfsUnitOf`, `stopRootfs`, `resolveRootfsLaunch` take the role; see preflight §1 row 6)
+- Test: `internal/instancectl/cmd_test.go`, `server_test.go`, `rootfs_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 6 for today's.
+
+**Amended 2026-10-30 (PF-6, PF-7, PF-14, PF-27).**
+- **Five client verbs (PF-6).** `instancectl.Client` gains a fifth, so the activator's optional `TTYControl` (Task 8) is met by the real client:
+ ```go
+ func (c *Client) TTYStatusRootfs(ctx context.Context, host, invocation string) (CmdStatus, error) // GET /tty/{host}?runtime=rootfs, as CmdStatusRootfs is for /cmd
+ ```
+ Test `TestTTYStatusRootfsPollsTheRootfsTTYUnit`: the status long-poll reads `carlos-instance-rootfs-tty@…` and never `carlos-instance-tty@` or either cmd unit.
+- **Role-aware throughout (PF-7).**
+ - `handleCmdStatus`, which refuses every role but cmd today, takes the role from its route.
+ - `cmdLocks` is keyed by (role, host), so a session's start never waits behind a run's lock on the same host.
+ - The rootfs branch's `startRootfsCmd` takes the role (unit, preflight role, exe dir), and its JIT drop-in, reload and effective-property check stay shared (R11).
+ - `rootfsUnitOf` and `stopRootfs` learn `RoleTTY`. `stopRootfs`'s cmd-only cleanup becomes `OneShot(role)` (`cleanOneShotExe(ctx, role, host, true)`).
+ - `resolveRootfsLaunch` gives `RoleTTY` the `RoleCmd` rule (a declared process other than `web`, or an argv), in place of today's "role tty has no rootfs unit".
+ - Tests: `TestTTYAndCmdLocksAreSeparate` (a cmd start held mid-flight does not block `POST /tty` for the same host; two `POST /tty` for one host serialize); `TestRootfsTTYStopNamesTheTTYUnit` (`POST /stop?role=tty&runtime=rootfs` stops `carlos-instance-rootfs-tty@…`, removes `rootfs/tty/`, and leaves `rootfs/cmd/` alone).
+- **Role sets (PF-27).** `/stop` and `/reset` take `RoleTTY` beside `RoleWorker`. Worker rules are not touched.
+- **Census (PF-14).** The control service is root code. Re-pin through the 2026-10-26 recipe on the branch's one overlay (Global Constraints). Astra approves on #280. Do not wait for Paul.
**Interfaces:**
- Consumes: Task 5's names; Plan 2's rootfs branch in `handleCmd` (`cmd.go:38`): the `runtime=rootfs` request with `image`, `version`, `digest` and `process` or the argv body (D3), `validateStagedImage`, `resolveRootfsLaunch`, `ensureRootfsExe`, `removeRootfsExe`.
@@ -550,7 +627,7 @@ func TestRootfsTTYNonJITSessionAfterAJITOneReloads(t *testing.T) // Astra R2 fin
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/instancectl/ -run 'TestTTY|TestRootfsRowStartsTheRootfsTTYUnit|TestSweepCoversTTYUnits|TestRootfsTTYStartFollowsTheReleasesJIT|TestRootfsTTYNonJITSessionAfterAJITOneReloads' -count=1`
+Run: `go test ./internal/instancectl/ -run 'TestTTY|TestRootfsRowStartsTheRootfsTTYUnit|TestRootfsTTYStopNamesTheTTYUnit|TestSweepCoversTTYUnits|TestRootfsTTYStartFollowsTheReleasesJIT|TestRootfsTTYNonJITSessionAfterAJITOneReloads' -count=1`
Expected: FAIL.
- [ ] **Step 3: Parametrize the handlers by role, register the routes, add the client methods**
@@ -559,7 +636,7 @@ Replace every `== RoleCmd` that means "a one-shot" with `OneShot(role)`.
- [ ] **Step 4: Run the package's tests and the root-read census**
-Run: `go test ./internal/instancectl/ -run 'TTY|Cmd|Sweep|Stop|Reset|Names' -count=1`, then `go test ./internal/provision/ -run TestPlan14RootReadCensus -count=1`. Expected: PASS. The control service is root code, so if the census moves, re-pin it with the overlay recipe and post the proposal on #280. Wait for Paul's ruling before merging.
+Run: `go test ./internal/instancectl/ -run 'TTY|Cmd|Sweep|Stop|Reset|Names' -count=1`, then `go test ./internal/provision/ -run TestPlan14RootReadCensus -count=1`. Expected: PASS. The control service is root code, so if the census moves, re-pin it with the overlay recipe (amended 2026-10-30, PF-14: `make census-card`, CLAIMS, `make census-propose`; Astra approves on #280; Paul is not asked).
- [ ] **Step 5: Commit**
@@ -576,7 +653,11 @@ git commit -m "instance-control: POST /tty and GET /tty/{host} (rootfs plan 6)"
- Create: `internal/instanceexec/tty_linux.go`, `internal/instanceexec/tty_other.go`
- Modify: `internal/instanceexec/exec.go:41-67` (usage and dispatch: `tty` reads `launch.tty.json` and launches through `ttyLaunch`)
- Modify: `internal/instanceexec/init_linux.go:64-105` (`runInitChecked` takes the tenant's stdio and whether to give it a controlling terminal)
-- Test: `internal/instanceexec/tty_linux_test.go`
+- Modify: `internal/instanceexec/exit.go` (`parseExitArgs` and its role refusals learn `tty`; see preflight §1 row 7)
+- Test: `internal/instanceexec/tty_linux_test.go`, `internal/instanceexec/exit_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 7 for today's.
+
+**Amended 2026-10-30 (PF-9).** Both programs learn `tty`. `instance-exec`'s `parseExecArgs`, `launchTarget` and `recordTarget` accept `tty` and `--rootfs tty` (`launch.tty.json`). `instance-exit`, which every tty unit's `ExecStopPost=` runs, accepts `tty %I` and `--rootfs tty %I` exactly as it accepts `cmd`. Test `TestExitAcceptsTheTTYRole`: `parseExitArgs([]string{"tty", "x"})` and `([]string{"--rootfs", "tty", "x"})` parse to role tty, and an unknown role is still refused with today's usage text. The usage strings are internal-subcommand diagnostics, not copy.
**Interfaces:**
- Consumes: `instancectl.RoleTTY`, `instancectl.TTYHello`; `execLaunch`'s validation (`exec.go:80-122`) and Plan 2's `execRootfsLaunch`, unchanged for the tty role: `--rootfs tty %I` runs `execRootfsLaunch(dataDir(), instancectl.RootfsLaunchPath, RoleTTY, inst, ttyLaunch)`, and `launchTarget` learns `RoleTTY` (`launch.tty.json`).
@@ -604,7 +685,7 @@ func TestTTYTenantOwnsTheTerminal(t *testing.T) // runTTYInit in a child process
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/instanceexec/ -run 'TestReceivePTY|TestTTYTenant' -count=1`
+Run: `go test ./internal/instanceexec/ -run 'TestReceivePTY|TestTTYTenant|TestExitAcceptsTheTTYRole' -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement**
@@ -624,16 +705,226 @@ git commit -m "instance-exec: the tty role takes its terminal over stdin (rootfs
---
+### Task 7a: `carlos run` on rootfs rows (amended 2026-10-30; PF-1, PF-2, PF-32, Call A1)
+
+This task brings back the run half of Plan 3 Task 12, which Paul cut on 2026-10-26: commits 56cc06aa and 6c6f8607, reverted at bba9a52d. It leaves out `--version` and fixes two P1s from that task's Astra round 1. Read for the shape: `git show 6c6f8607 56cc06aa`; the review, `task-12-r1-astra.md`; and the implementer's report, `task-12-report.md` (both in Plan 3's SDD directory, `.superpowers/sdd/2026-10-24-rootfs-apps-3-lifecycle/` on the `rootfs-apps-3` worktree).
+
+- **P1 #1, a rootfs command outlives the lease (C7).** The command is killed at the loss, through a root-side one-shot kill (Call A1, in the amendment). It is stopped at `residentLeaseShort` whatever the entry's state, and a start in flight is killed again when it returns.
+- **P1 #4, the run directory is deleted before the termination proof (INV-2).** The directory becomes the activator's to remove, through `CmdSpec.AfterSettled`, once the unit is proven gone. That includes a start that may have begun.
+- Take nothing of `--version`: no `CmdSpec.Build`, `ErrCmdVersion`, `cmdBuildIdentity`, `cmdHold.build`, `runs.Meta.Version`, `runs.Request.Version`, `RefusedVersion`, `runVersionChecked`, `MetaDigest` change, `--version` flag or `runCopySuperseded`. P1 #2, P1 #3 and P2 #5 were about it, and go with it.
+
+This task depends on Task 5 (`instancectl.OneShot`) and Task 6 (`stopRootfs` and the one-shot cleanup by role). Tasks 8, 10, 15 and 16 build on it.
+
+**Files:**
+- Modify: `internal/activator/cmdunit.go` (`StartCmd` takes the rootfs arm before every binary step; `CmdSpec.AfterSettled`; see preflight §1 row 8)
+- Modify: `internal/activator/backend_rootfs.go` (`startRootfsCmd` takes a `rootfsCmdLaunch`; `StartRelease` passes its process; see preflight §1 row 8)
+- Modify: `internal/activator/cmd.go` (`RunCmd`: the lease headroom for a rootfs row and `AfterSettled` on every path; `cmdHold` gains `afterSettled`; `stopOneShotsAtLeaseLocked`; see preflight §1 row 9)
+- Modify: `internal/activator/rootfs_service.go` (`residentLeaseShort`, `residentLeaseLost`; see preflight §1 row 9)
+- Modify: `internal/activator/unitproc.go` (`KillOneShot` beside `stopRole`), `internal/activator/backend_unit.go` (`SplitBackend.KillOneShot`)
+- Modify: `internal/instancectl/server.go` (`parseRequest`'s kill rule), `internal/instancectl/rootfs.go` (`stopRootfs` with `kill` for a one-shot role), `internal/instancectl/client.go` (`StopRootfs` types an unproven one-shot kill as `ErrGenUnproven`)
+- Modify: `internal/console/apiruns.go` (`runClassRefusal`'s always-on arm; see preflight §1 row 10)
+- Modify: `internal/host/runexec.go` (`execute` hands the run directory to `AfterSettled`; `cleanUp`; see preflight §1 row 16)
+- Modify: `docs/site/cli.md` (`### carlos run`: RFS-3-C27 as its own paragraph after "A hibernating instance is woken first…"), `approved_rootfs_copy_test.go` (`rootfsCopyBuilt` gains RFS-3-C27), `plan3_groups_test.go` (RFS-3-C27 moves from `plan3CopyRuns` to `plan3CopyA`), `docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md` (RFS-3-C27's file cell gains the note "built by Plan 6 Task 7a")
+- Create: `internal/activator/rootfs_cmd_test.go`, `internal/activator/rootfs_cmd_lease_test.go`, `internal/console/apiruns_rootfs_test.go`
+- Test: `internal/activator/rootfs_invariants_test.go` (INV-1, INV-4 and INV-5 run rows), `internal/activator/rootfs_test.go` (`TestRootfsRowsNeverTakeABinaryLaunch`'s cmd row), `internal/activator/cmd_test.go`, `internal/instancectl/rootfs_test.go`, `internal/host/runexec_linux_test.go`
+
+**Interfaces:**
+- Consumes (Plan 3, on main): `startRootfsCmd` and `stagedImageOf` (`internal/activator/backend_rootfs.go`), `rootfsCmdVars` (`rootfsenv.go:20`), `rootfsLaunchEnv`, `rootfsGates`, `refuseRootfs` and `errRootfsRefused` (`rootfs.go`), `errPartialStagedIdentity` (`identity.go:99`), `rootfsCtlHarness` (`rootfs_ctl_harness_test.go:70`), `watchOf` (`rootfsrelease.go:50`), `workerProofBound`, `workerHeadroom`'s shape (`rootfsworkers.go:115-150`), `residentDrainBudget`, `killResidentGens`, `stopRootfsWorkersAtLoss`, `genKiller` (`opset.go:168`); `killGen` (`internal/instancectl/gen.go:459`). From Task 5: `instancectl.OneShot`. From Task 6: the role-aware `stopRootfs` and `cleanOneShotExe`.
+- Produces:
+```go
+// internal/activator
+type rootfsCmdLaunch struct {
+ Process string // a declared process: release.ProcessRelease (Group R), release.ProcessConsole (Task 8); "" for an argv
+ Argv []string // an operator's command: carlos run (here), run -it (Task 8); nil for a process. Exactly one of the two is set.
+}
+func (b *ExecBackend) startRootfsCmd(ctx context.Context, rt registry.Route, id release.StagedIdentity, l rootfsCmdLaunch, env map[string]string, stdout, stderr io.Writer) (CmdUnit, error)
+// the launch file (schema 2, never an argv) names l.Process, or "cmd" for an argv;
+// root gets stagedImageOf(id, l.Process, l.Argv) through CmdRootfs at b.tier(rt).MemoryMax (PF-32: there is no rootfsTier).
+// StartRelease passes rootfsCmdLaunch{Process: release.ProcessRelease}: its requests and launch file are byte-identical to today's.
+
+// CmdSpec gains (callers set it):
+AfterSettled func()
+// Called exactly once, never with a.mu held, when no unit of this run can be running:
+// before RunCmd returns on every path that starts no unit (each refusal, an abandon, a start that returned no unit),
+// otherwise from the settle that first proves the unit gone (its own Stop, settleCmds, interruptCmdsLocked's stop,
+// the sweep's retry, the lease-loss stop). Never called while the proof is missing: an agent that exits first
+// leaves the directory to the next agent's boot pass, which runs after the startup sweep.
+
+type oneShotKiller interface {
+ KillOneShot(ctx context.Context, rt registry.Route, role instancectl.Role) error
+}
+// ExecBackend.KillOneShot: a rootfs row only: StopRootfs(ctx, rt.Host, role, 0, "", true), then
+// waitRoleCgroupEmpty(ctx, rt, role); a binary row returns errOneShotKillBinary (binary rows hold no resident lease).
+// SplitBackend.KillOneShot forwards by pick(rt), as KillGen does.
+var errOneShotKillBinary = errors.New("activator: a binary row's command has no lease kill")
+func oneShotStartLead() time.Duration // instancectl.DeadlineControl + workerProofBound: the worker rule (workerStartLead)
+var errOneShotNoHeadroom = errors.New("activator: the instance's lease is too close to its safety deadline to start a command")
+func (a *Service) oneShotHeadroom(rep Rep) error // workerHeadroom with oneShotStartLead; nil without a lease signal
+func (a *Service) stopOneShotsAtLeaseLocked(e *actEntry, rt registry.Route, kill bool) []func()
+// one func per hold of e that may be running (cmdHoldsLocked here; Task 9 widens it to both roles), run off a.mu:
+// kill false (residentLeaseShort): h.stop(ctx, StopLeaseLost) bounded by cmdStopBound;
+// kill true (residentLeaseLostLocked): KillOneShot(rt, role) at once, again once h.started closes with a unit,
+// then h.stop(ctx, StopLeaseLost) to settle streams and record the reason. A failed kill or settle is logged;
+// the entry's stop path still keeps the lease's release until the hold is proven (settleCmds).
+
+// internal/instancectl
+// parseRequest: kill=1 is accepted for a generation stop (today) and for a runtime=rootfs stop of a role with OneShot(role);
+// anything else is still "kill=1 belongs to a generation stop only" (a 400 diagnostic, not copy).
+// stopRootfs: with req.kill on a one-shot role, killGen(ctx, host, unit) (SIGKILL, stop, cgroup proven empty),
+// then the role's exe cleanup; an unproven kill answers statusGenUnproven with the files kept.
+// Client.StopRootfs types statusGenUnproven as ErrGenUnproven when kill is set, as for a generation or a worker.
+
+// internal/console
+// runClassRefusal's always-on arm: case !rec.HibernateOrDefault() && rec.Runtime != provision.RuntimeRootfsV1
+// (the fleet arm is unchanged: a rootfs record on a fleet is still refused, until Task 16).
+```
+
+Rules:
+- **`StartCmd` on a rootfs row.** The layout check (`ErrCmdNotNested`) and `checkCmdRunDir` stay first and shared. A rootfs row then leaves the binary path before `nestedGate`:
+ - `spec.serving` is required. `RunCmd` sets it from the serving generation, whose rootfs `Gen` carries `Build`, `StagedPath` and `Digest`. Without one, the run is refused with `refuseRootfs(errNoCmdExe)`, and a partial one with `refuseRootfs(errPartialStagedIdentity)`. Nothing is laid out.
+ - `spec.genEnv` is required (`errNoGenEnv`), and `replicaKeyGate` is asked as for a binary run.
+ - Then `startRootfsCmd(ctx, rt, id, rootfsCmdLaunch{Argv: spec.Args}, b.rootfsCmdVars(rt, spec.genEnv, b.pathsFor(rt).dbPath, spec.RunID, spec.RunDir), spec.Stdout, spec.Stderr)`, where `id` is `spec.serving` as a `release.StagedIdentity`. The argv is `spec.Args` exactly as given, with no live-link prefix. The image's PATH finds its first word.
+ - Root's `ErrStagedImage` and `ErrStartRefused` come back marked `refuseRootfs` with no unit. Any other error after the POST hands back the runtime-aware `cmdUnit` with the error.
+ - A binary row's path, launch file and requests are byte-identical to today's (`TestBinaryStartCmdLaunchGolden`).
+ - No egress step: #328 checks in root's rootfs start.
+- **`RunCmd`.**
+ - Right after its last check under `a.mu` (the one after `recordBuild`), and before `StartCmd`, a rootfs row's run asks `oneShotHeadroom(e.rep)` off `a.mu`. Less than `oneShotStartLead()` left refuses with `&CmdStoppedError{Reason: StopLeaseLost}` through `abandon`, and nothing starts.
+ - The `releaseOps` refusal stays: a run and a release share the cmd unit.
+ - `AfterSettled` is honoured on every path, as its comment says. Its once-guard lives on the hold. A refusal before the hold exists (`ErrCmdClaim`, `ErrCmdNotInstance`, `ErrCmdNotNested`, `*CmdWakeError`, `ErrCmdBusy`, the first `*CmdStoppedError`) calls it before returning.
+- **Lease** (Call A1).
+ - `residentLeaseShort` calls `stopOneShotsAtLeaseLocked(e, e.route, false)` for an entry that is the host's, awake or already stopping, and runs the funcs off `a.mu`. Today it returns early for an entry that is not awake. That early return now skips only `beginStopLocked`.
+ - `residentLeaseLostLocked(e, err) ([]uint64, []func())` returns the kill funcs beside the generation numbers, whatever the entry's state. `residentLeaseLost` runs them in the same `WaitGroup` as `stopRootfsWorkersAtLoss`, beside `killResidentGens`.
+- **Console** (PF-2): the always-on arm passes a rootfs record, for runs here and for sessions through Task 10's `instanceClassRefusal`. A rootfs record placed on a fleet still gets the fleet sentence.
+- **Box** (P1 #4):
+ - `execute` sets `spec.AfterSettled` to remove the run's directory (`runs.RemoveRunDir`; an error is logged).
+ - `cleanUp` takes `removeDir bool`. It is true only on paths that never called `RunCmd`, which are the incarnation refusal before launch. Every path after `RunCmd` leaves the directory to `AfterSettled`.
+ - The boot pass's removal (`runs.go`, after the startup sweep has proven a previous agent's cmd units gone) is unchanged.
+- **Copy:** RFS-3-C27 goes in `docs/site/cli.md` as approved: "For a rootfs app the command after -- runs inside the instance's image and is found on the image's PATH." RFS-3-C28 is not written (PF-13).
+- **Census** (PF-14): the instancectl change is root code. Re-pin on the branch's overlay through the 2026-10-26 recipe, and Astra approves on #280.
+
+- [ ] **Step 1: Write the failing tests**
+
+```go
+// internal/activator/rootfs_cmd_test.go (rootfsCtlHarness; TMPDIR=/tmp/k, the harness binds a unix socket)
+func TestRootfsRunRunsArgsInTheImage(t *testing.T) // the POST /cmd carries runtime=rootfs, the serving image's path, version and digest,
+// memory_max == b.tier(rt).MemoryMax, and the body {"argv": spec.Args} exactly (no "/opt/carlos/live/" prefix); launch.cmd.json is
+// schema 2 with Process "cmd" and no Argv; its env has CARLOS_SOCKET == rt.Socket, CARLOS_DB == the row's dbPath, CARLOS_RUN_ID and
+// CARLOS_RUN_DIR, and no CARLOS_CONTROL_SOCKET or CARLOS_PURGE; no request names "carlos-instance-cmd@"
+func TestRootfsRunNeedsTheServingImage(t *testing.T) // spec.serving nil: errors.Is(err, errRootfsRefused) and errNoCmdExe; a partial identity:
+// errPartialStagedIdentity; in both, no /cmd request, no launch file, no listener socket left
+func TestRootfsRunRefusedByRootIsARefusal(t *testing.T) // the harness answers /cmd 503 then 403: errRootfsRefused, unit nil, both listeners closed
+func TestRootfsRunPollsAndStopsTheRootfsUnit(t *testing.T) // linux/arm64 only (root starts rootfs images only there; skip elsewhere,
+// saying why), through Service.RunCmd on an awake resident: Poll answers CmdRunning then CmdDone; Stop sends "stop carlos-instance-rootfs-cmd@…"
+// and is unproven while that unit's cgroup is populated; a Bounce keeps the stop pending with lease and replica held until it empties
+func TestStartReleaseIsUnchanged(t *testing.T) // StartRelease's /cmd query, body (none) and launch.cmd.json (Process "release") are
+// byte-identical to a golden captured from main before the refactor
+// internal/activator/cmd_test.go
+func TestRunCmdAfterSettledRunsOnceOnEveryPath(t *testing.T) // table, a counting AfterSettled on each:
+// ErrCmdClaim, ErrCmdBusy, a Prepare error, ctx cancelled before start -> called once, before RunCmd returns;
+// StartCmd returns (nil, err) -> once before return; StartCmd returns (unit, err) with a unit whose first StopAndSettle fails ->
+// 0 at return, then 1 after retryCmdSettlesLocked's settle succeeds; a started run whose Stop fails -> 0 after Stop,
+// 1 after the instance's stop (settleCmds) proves it; a started run whose Stop succeeds -> 1, and a second Stop leaves it at 1
+// internal/activator/rootfs_cmd_lease_test.go (rootfs_resident_lease_test.go's rig: residentDrainBudget shortened, a fake backend
+// recording KillGen, worker stops and KillOneShot in order)
+func TestResidentLeaseLossKillsAnAttachedRun(t *testing.T) // awake resident, run attached, web drain stalled: the loss asks
+// KillOneShot(rt, RoleCmd) at once, beside KillGen and the worker stops, before the entry's stop settles anything;
+// Interrupted() == (StopLeaseLost, the loss time); the lease is released only after the run's hold is proven
+func TestResidentLeaseLossKillsTheRunOfAnAlreadyStoppingEntry(t *testing.T) // P1 #1's scenario: the entry is stopping (idle stop,
+// drain stalled) when the lease runs short and then is lost: residentLeaseShort stops the run anyway, and the loss kills it
+func TestResidentLeaseLossKillsARunWhoseStartIsInFlight(t *testing.T) // StartCmd blocked: the loss asks KillOneShot once at once;
+// StartCmd then returns a unit: KillOneShot is asked again, the hold settles, AfterSettled runs once
+func TestResidentLeaseShortStopsTheRunBeforeTheDrain(t *testing.T) // hanging renewal: the run's StopAndSettle starts at residentLeaseShort,
+// not after the stalled web drain, and is proven before the safety deadline
+func TestRootfsRunRefusedWithoutLeaseHeadroom(t *testing.T) // SafeUntil now+oneShotStartLead()-1ms at the last check:
+// *CmdStoppedError{StopLeaseLost}; StartCmd never called; AfterSettled once
+func TestBinaryRunsNeverAskTheLeaseKill(t *testing.T) // a binary always-on row's run: no KillOneShot asked on any path
+// internal/activator/rootfs_invariants_test.go and rootfs_test.go
+// INV-1 rootfsProofHandles: a "rootfs run cmdUnit (StartCmd)" row through productionBackend, no binary unit present;
+// INV-4 rootfsRefusals: "a rootfs run with no image (errNoCmdExe, marked)";
+// INV-5 rootfsLaunchRows: "run", the launch.cmd.json StartCmd writes under t.Setenv("PATH", "/agent/bin") (no agent PATH in it);
+// TestRootfsRowsNeverTakeABinaryLaunch's cmd row: the rootfs arm's errNoCmdExe and nothing asked of root, no longer errRootfsBinaryLaunch
+// internal/instancectl/rootfs_test.go
+func TestRootfsOneShotStopKills(t *testing.T) // POST /stop?host=h&role=cmd&runtime=rootfs&kill=1: systemctl gets
+// "kill --signal=SIGKILL carlos-instance-rootfs-cmd@h.service" then "stop carlos-instance-rootfs-cmd@h.service", the cgroup is waited empty,
+// rootfs/cmd/ is removed, 204; a cgroup that stays populated -> statusGenUnproven and rootfs/cmd/ kept; the same with role=tty once Task 5 names it
+func TestKillStaysOffTheOtherStops(t *testing.T) // kill=1 refused (400) for role=worker runtime=rootfs, for role=cmd without runtime=rootfs,
+// for role=run with no gen; still accepted for role=run gen=3 (the generation kill, unchanged)
+func TestStopRootfsTypesAnUnprovenOneShotKill(t *testing.T) // client: StopRootfs(ctx, h, RoleCmd, 0, "", true) against a statusGenUnproven answer (500) -> errors.Is(err, ErrGenUnproven)
+// internal/console/apiruns_rootfs_test.go
+func TestRunDoorAdmitsRootfsResident(t *testing.T) // rootfs record, Hibernate false, platform region "uk", account bah, app shop: 202;
+// an always-on binary record: 409 with today's "does not sleep" sentence
+func TestRunDoorStillRefusesARootfsFleetInstance(t *testing.T) // rootfs record on "fleet/home": 409, today's fleet sentence (until Task 16)
+// internal/host/runexec_linux_test.go (fakeLauncher honours AfterSettled: it calls it as the activator would)
+func TestRunDirKeptUntilTheUnitIsProvenGone(t *testing.T) // a run with one staged input file; the handle's Stop fails and the fake holds
+// AfterSettled: after execute returns, result.json is written and the run dir and its input still exist; calling the held AfterSettled removes the dir
+func TestRunDirKeptAfterAStartThatMayHaveBegun(t *testing.T) // RunCmd returns (nil, errors.New("start cmd unit: timeout")) without calling
+// AfterSettled: result Interrupted InterruptedStartFailed, the dir still exists; AfterSettled then removes it
+func TestRunDirRemovedWhenNothingStarted(t *testing.T) // RunCmd answers ErrCmdClaim and calls AfterSettled before returning: the dir is gone
+// when execute returns; an incarnation refusal before RunCmd: the dir is gone (cleanUp removeDir true)
+```
+
+- [ ] **Step 2: Run them and see them fail**
+
+Run (each with `dangerouslyDisableSandbox`, `nice -n 19`):
+```bash
+TMPDIR=/tmp/k go test ./internal/activator/ -run 'TestRootfsRun|TestStartReleaseIsUnchanged|TestRunCmdAfterSettledRunsOnceOnEveryPath|TestResidentLeaseLossKills|TestResidentLeaseShortStopsTheRun|TestBinaryRunsNeverAskTheLeaseKill|TestRootfsRowsNeverTakeABinaryLaunch|TestEveryRootfsProofNamesTheRootfsUnit|TestRootfsRefusalsAreNotBuildFailures|TestRootfsLaunchFilesCarryOnlyComposedEnv' -count=1
+TMPDIR=/tmp/g go test ./internal/instancectl/ -run 'TestRootfsOneShotStopKills|TestKillStaysOffTheOtherStops|TestStopRootfsTypesAnUnprovenOneShotKill' -count=1
+go test ./internal/console/ -run 'TestRunDoorAdmitsRootfsResident|TestRunDoorStillRefusesARootfsFleetInstance' -count=1
+go test ./internal/host/ -run 'TestRunDir' -count=1
+```
+Expected: FAIL. `TestStartReleaseIsUnchanged` passes before the refactor and must keep passing, so capture its golden first.
+
+- [ ] **Step 3: Implement**
+
+Generalize `startRootfsCmd` first and run `TestStartReleaseIsUnchanged` and the Group R tests (`go test ./internal/activator/ -run 'Release' -count=1`): PASS. Then add the rootfs arm, `AfterSettled`, the headroom, the lease stops and kills, the root kill and the console arm. Write RFS-3-C27 and move it in `plan3_groups_test.go`.
+
+- [ ] **Step 4: Run them and see them pass; then the guards, the census and the copy gate**
+
+Run the Step 2 commands. Then:
+```bash
+TMPDIR=/tmp/k go test ./internal/activator/ -run 'Cmd|RunCmd|TestBinaryStartCmdLaunchGolden|TestEntriesEnterThroughPutEntryLocked|TestResidentLease|TestRootfsAdmissionWaitsForTheStartupProof' -count=1
+go test ./internal/host/ -run 'TestRun|TestRuns' -count=1
+go test ./internal/provision/ -run TestPlan14RootReadCensus -count=1
+GOFLAGS=-buildvcs=false go test . -run 'TestRootfsCopy|TestRootfsBuilt|TestPlan3CopyGroups|TestPlan3MachineryInventory|TestRun' -count=1
+go test ./internal/docsite/ -count=1
+GOOS=darwin go build ./... && GOOS=windows go build ./... && GOOS=linux GOARCH=arm64 go build ./...
+```
+Expected: PASS and no build output. Every existing `TestRunCmd*` and `TestResidentLease*` passes unchanged. If the root-read census moved, re-pin it (PF-14) before committing.
+
+- [ ] **Step 5: Commit**
+
+```bash
+git add internal/activator internal/instancectl internal/console/apiruns.go internal/console/apiruns_rootfs_test.go internal/host/runexec.go internal/host/runexec_linux_test.go internal/provision/testdata docs/site/cli.md approved_rootfs_copy_test.go plan3_groups_test.go docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
+git commit -m "carlos run: rootfs rows run in their image; a one-shot is killed at lease loss; the run dir waits for the proof (rootfs plan 6 task 7a)"
+```
+
+---
+
### Task 8: The agent's pty, its handoff, and the tty start
**Files:**
- Create: `internal/activator/pty_linux.go`, `internal/activator/pty_other.go`
- Modify: `internal/activator/cmdunit.go:37-73` (`CmdSpec.TTY`), `:94-105` (`CmdUnit.Terminal`), `:172-243` (`StartCmd` dispatches on `spec.TTY`)
- Modify: `internal/activator/prepare.go:87`, `:147`, `:158` (`RoleCmd` becomes `instancectl.OneShot(role)`)
+- Modify: `internal/activator/control.go` (the optional `TTYControl`), `internal/activator/backend_rootfs.go` (Task 7a's `startRootfsCmd` takes the role)
- Test: `internal/activator/pty_linux_test.go`, `internal/activator/cmdunit_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 8 for today's.
-**Interfaces:**
-- Consumes: Task 6's `Client.TTY`, `TTYExe`, `TTYStatus`; `edge.SecureUnixListen` (`internal/edge/purge_listen_linux.go:32`); `b.logSocketNamed` (`prepare.go:238`); `b.cmdVars` (`cmdunit.go:124`).
+**Amended 2026-10-30 (PF-6, PF-7, PF-32, PF-1).**
+- **`TTYControl` (PF-6).** `Control` is not extended, so no control fake has to change. The five verbs are an optional interface, asserted where they are used, as `cmdExeStarter` is (`cmdunit.go`). A control that lacks it gives `ErrNoTTY`, and nothing is listened on or started:
+ ```go
+ type TTYControl interface {
+ TTY(ctx context.Context, host string, memoryMax int64) (string, error)
+ TTYExe(ctx context.Context, host string, memoryMax int64, x instancectl.StagedExe) (string, error)
+ TTYStatus(ctx context.Context, host, invocation string) (instancectl.CmdStatus, error)
+ TTYRootfs(ctx context.Context, host string, memoryMax int64, img instancectl.StagedImage) (string, error)
+ TTYStatusRootfs(ctx context.Context, host, invocation string) (instancectl.CmdStatus, error)
+ }
+ var _ TTYControl = (*instancectl.Client)(nil)
+ ```
+- **Consumes, amended.** Task 6's five client verbs (through `TTYControl`), and Task 7a's rootfs `StartCmd` arm, `startRootfsCmd` and `rootfsCmdLaunch`.
+- **Role-aware unit (PF-7).** `cmdUnit` gains `role instancectl.Role`. `Poll` reads `CmdStatus`/`CmdStatusRootfs` for `RoleCmd` and `TTYStatus`/`TTYStatusRootfs` for `RoleTTY`. `StopAndSettle` stops and proves `u.role` (`stopRole(sctx, u.rt, u.role, 0)`, `waitRoleCgroupEmpty(wctx, u.rt, u.role)`), never a hard-coded `RoleCmd` (see preflight §1 row 8). Test `TestTTYUnitPollsAndStopsItsOwnRole`: a tty unit's Poll and StopAndSettle never name a cmd unit, on either runtime.
+- **The rootfs tty start (PF-1, PF-32).** It is Task 7a's `startRootfsCmd` with the role as a parameter. The pty handoff's stdin socket takes the place of the two stream listeners, and the launch file is `launch.tty.json` (schema 2, `Process` `"console"` or `"cmd"`). It is called with `rootfsCmdLaunch{Process: release.ProcessConsole}` for `carlos console` and `rootfsCmdLaunch{Argv: args}` for `run -it`, at `b.tier(rt)`: there is no `rootfsTier`. The environment is `rootfsLaunchEnv(rootfsVars(ttyVars(...), rt.Socket, dbPath))`, following `ReleaseEnv`'s steps for the rest (see preflight §1 row 8). Task 7a's `spec.serving` and `spec.genEnv` for a rootfs row serve both roles.
- Produces:
```go
type TTYSpec struct {
@@ -659,7 +950,7 @@ func (h *ttyHandoff) Handed() bool // whether the fd went to a root peer
func (h *ttyHandoff) Close() error
var ttyPeerOK = func(c *net.UnixConn) error // SO_PEERCRED uid must be 0: PID 1's exec child connects StandardInput= before it drops to User=carlos
```
-For a session, `ttyVars` is `cmdVars` without `CARLOS_RUN_ID` and `CARLOS_RUN_DIR`, plus `TERM=<spec.TTY.Term>` and `CARLOS_SESSION_ID=<spec.RunID>`. The handoff accepts connections until a root peer arrives. Any other peer is closed without a byte or an fd. The root peer gets one `sendmsg` of `TTYHello` with `UnixRights(slave)`, then the agent closes its slave. The tty start writes `launch.tty.json` with argv `[liveLink(host), args...]` for a binary row, and calls `Control.TTY`, or `TTYExe` when `spec.serving` is set. For a rootfs row it writes Plan 2's schema 2 launch (`writeRootfsLaunchFor(p, RoleTTY, 0, host, process, env)`, `Process` `"console"` for `carlos console` and `"cmd"` for `run -it -- <args>`, never an argv) and calls `TTYRootfs` with `StagedImage{Path, Version, Digest}` of the serving image plus `Process: release.ProcessConsole` or `Argv: args` (D3), at Plan 2's `rootfsTier`. A tty unit whose invocation is done without `Handed()` reports as `runs.InterruptedStartFailed`.
+For a session, `ttyVars` is `cmdVars` without `CARLOS_RUN_ID` and `CARLOS_RUN_DIR`, plus `TERM=<spec.TTY.Term>` and `CARLOS_SESSION_ID=<spec.RunID>`. The handoff accepts connections until a root peer arrives. Any other peer is closed without a byte or an fd. The root peer gets one `sendmsg` of `TTYHello` with `UnixRights(slave)`, then the agent closes its slave. The tty start writes `launch.tty.json` with argv `[liveLink(host), args...]` for a binary row, and calls `Control.TTY`, or `TTYExe` when `spec.serving` is set. For a rootfs row it writes Plan 2's schema 2 launch (`writeRootfsLaunchFor(p, RoleTTY, 0, host, process, env)`, `Process` `"console"` for `carlos console` and `"cmd"` for `run -it -- <args>`, never an argv) and calls `TTYRootfs` with `StagedImage{Path, Version, Digest}` of the serving image plus `Process: release.ProcessConsole` or `Argv: args` (D3), at `b.tier(rt).MemoryMax` (amended 2026-10-30, PF-32: Plan 2 has no `rootfsTier`). A tty unit whose invocation is done without `Handed()` reports as `runs.InterruptedStartFailed`.
- [ ] **Step 1: Write the failing tests**
@@ -671,6 +962,8 @@ func TestStartCmdTTYStartsTheTTYRole(t *testing.T) // fake Control: TTY called (
func TestStartCmdTTYRefusesAFlatRow(t *testing.T) // ErrCmdNotNested; nothing listened or started
func TestStartCmdTTYOnARootfsRow(t *testing.T) // fake Control: TTYRootfs called with the serving image and Process "console" (or Argv for run -it); launch.tty.json is schema 2 with no argv; TTY and TTYExe never called
func TestTTYUnitStopAndSettleClosesTheMaster(t *testing.T)
+func TestTTYUnitPollsAndStopsItsOwnRole(t *testing.T) // amended 2026-10-30 (PF-7): binary and rootfs: Poll calls TTYStatus / TTYStatusRootfs, StopAndSettle stops role tty and waits on the tty unit's cgroup; no call names a cmd unit
+func TestStartCmdTTYWithoutTTYControlIsErrNoTTY(t *testing.T) // amended 2026-10-30 (PF-6): a Control that does not implement TTYControl: ErrNoTTY, no socket listened, no launch file
```
- [ ] **Step 2: Run them and see them fail**
@@ -707,10 +1000,22 @@ git commit -m "activator: the session's pty and its handoff to the tty unit (roo
- `:318-327`: `cmdStartInFlightLocked` covers both;
- `:400-406`: `retryCmdSettlesLocked` covers both;
- `:449-505`: `RunCmd` picks the slot by `spec.TTY`.
-- Test: `internal/activator/cmd_test.go`
+- Modify: `internal/activator/rootfs_service.go` and `cmd.go` (Task 7a's `stopOneShotsAtLeaseLocked` covers the tty hold), `internal/activator/rootfsrelease.go` (the release's busy check counts cmd holds only), `internal/activator/swap.go`, `generations_file.go` (the other users of the cmd hold)
+- Test: `internal/activator/cmd_test.go`, `internal/activator/rootfs_cmd_lease_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 9 for today's. The idle and stop checks on `e.cmd == nil` are four sites now, not one, plus the cancel in `beginStopLocked`.
+
+**Amended 2026-10-30 (PF-3, PF-17, PF-18, Call A1).**
+- **Lease loss (PF-3).** A rootfs instance's tty hold is stopped and proven at its lease events exactly as Task 7a stops its cmd hold. `stopOneShotsAtLeaseLocked` covers every hold that may be running, of either role (`holdsLocked(e)`, which `cmdHoldsLocked` becomes):
+ - at `residentLeaseShort` it stops the hold gracefully, whether the entry is awake or already stopping;
+ - at the loss it kills the unit with `KillOneShot(rt, RoleTTY)`, at once and again when a start in flight returns, beside the cmd hold, `killResidentGens` and `stopRootfsWorkersAtLoss`, within the lease margin;
+ - a rootfs session starts only with `oneShotHeadroom` left.
+
+ The session learns the reason (`Interrupted() == StopLeaseLost`), and the box ends it as interrupted (Task 12).
+- **Releases (PF-17).** `RunCmd` refuses a run while a release process runs, because they share the cmd unit (`a.releaseOps`). It does not refuse a session for one: the tty unit is its own. `rootfsrelease.go` asks `holdBusyLocked(e, instancectl.RoleCmd)` where it asks `cmdBusyLocked(e)` today, so a 6 h session never holds a deploy's release, and RFS-6-C30 ("still closing the last session") is never reported for a release.
+- **Idle and stop checks (PF-18).** Each of the four `e.cmd == nil` checks (see preflight §1 row 9) becomes "no hold of either role" (`e.cmd == nil && e.tty == nil`). `beginStopLocked` cancels both holds' prepares. A session holds the idle timer, so an instance is never hibernated or plan-disabled mid-session.
**Interfaces:**
-- Consumes: Task 8's `CmdSpec.TTY`, `CmdUnit.Terminal`.
+- Consumes: Task 8's `CmdSpec.TTY`, `CmdUnit.Terminal`; Task 7a's `stopOneShotsAtLeaseLocked`, `KillOneShot`, `oneShotHeadroom`, `CmdSpec.AfterSettled` (a session passes nil).
- Produces:
```go
var ErrTTYBusy = errors.New("activator: a session is already attached to this instance")
@@ -729,11 +1034,26 @@ func TestASessionAndARunCoexist(t *testing.T) // RunCmd(run) then RunCmd(tty) bo
func TestASessionIsInterruptedWhenItsGenerationRetires(t *testing.T) // swap retires gen -> Interrupted() == StopRelease
func TestRunCmdSessionRefusesWithClaimControlArmed(t *testing.T) // ErrCmdClaim
func TestRunCmdSessionWakesAHibernatedInstanceFirst(t *testing.T)
+// amended 2026-10-30 (PF-3, PF-17, PF-18), in rootfs_cmd_lease_test.go on Task 7a's rig:
+func TestResidentLeaseLossKillsTheSessionBesideTheRun(t *testing.T) // a resident with a run and a session attached, web drain stalled:
+// the loss asks KillOneShot(rt, RoleCmd) and KillOneShot(rt, RoleTTY), both at once, beside KillGen and the worker stops, before the
+// entry's stop settles anything; both Interrupted() == StopLeaseLost; the lease is released only after both holds are proven
+func TestResidentLeaseLossKillsTheSessionOfAnAlreadyStoppingEntry(t *testing.T) // the entry is already stopping with its drain stalled:
+// residentLeaseShort stops the session, and the loss kills it
+func TestResidentLeaseLossKillsASessionWhoseStartIsInFlight(t *testing.T) // the tty StartCmd blocked: KillOneShot(rt, RoleTTY) once at once,
+// and again when the start returns a unit; the hold is then proven
+func TestRootfsSessionRefusedWithoutLeaseHeadroom(t *testing.T) // SafeUntil inside oneShotStartLead(): *CmdStoppedError{StopLeaseLost}, no tty start
+// in cmd_test.go:
+func TestASessionIsNotRefusedForARelease(t *testing.T) // a releaseOps entry for the host: RunCmd(run) -> ErrCmdBusy, RunCmd(tty) admitted;
+// with a session attached, the release's busy check (rootfsrelease.go) reads not busy
+func TestASessionHoldsEveryIdleAndStopCheck(t *testing.T) // with only e.tty set, each of the four sites leaves the entry as it is: the idle sleep,
+// the plans awake ceiling, the plan-disabled stop of a route, and the no-restart of a worker a lapse turned off; beginStopLocked
+// cancels the session's prepare as it does a run's
```
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/activator/ -run 'TestEveryStopPathSettlesTheSession|TestRunCmdHoldsTheIdleTimerForASession|TestASession|TestRunCmdSession' -count=1`
+Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'TestEveryStopPathSettlesTheSession|TestRunCmdHoldsTheIdleTimerForASession|TestASession|TestRunCmdSession|TestResidentLeaseLossKillsTheSession|TestResidentLeaseLossKillsASession|TestRootfsSessionRefusedWithoutLeaseHeadroom' -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement the second slot**
@@ -742,7 +1062,7 @@ Keep one `cmdLeft` list for unsettled holds of either role. `holdBusyLocked(e, r
- [ ] **Step 4: Run the package's run and session tests**
-Run: `go test ./internal/activator/ -run 'Cmd|Session|Run' -count=1`. Expected: PASS, including every existing `TestRunCmd*`.
+Run: `TMPDIR=/tmp/k go test ./internal/activator/ -run 'Cmd|Session|Run|TestResidentLease|Release' -count=1`. Expected: PASS, including every existing `TestRunCmd*`, Task 7a's lease tests and Group R's release tests.
- [ ] **Step 5: Commit**
@@ -759,10 +1079,41 @@ git commit -m "activator: a session is held and settled like a run, beside it (r
- Create: `internal/console/apiinteractive.go`, `internal/console/interactivehub.go`
- Modify: `internal/console/server.go` (`Server.bootID string` minted in `NewServer` from 16 random bytes; `Server.interactive *interactiveHub`); `internal/console/authcli.go:736-740` (register the route beside the run routes)
- Modify: `internal/console/svcroutes_test.go` (`closedDoors`), `testdata/claim-routes.txt`, `claim_invariant_test.go:101` (`claimUnsupported` gains RFS-6-C35 with its reason), `claim_invariant_fixtures_test.go` (a refused fixture beside `:1488`)
-- Test: `internal/console/apiinteractive_test.go`
+- Modify: `internal/console/lifetimes_cutover.go` (`lifetimesStep`, `endRequestUnit`), `internal/console/server.go` (`consolePerfSkip`)
+- Test: `internal/console/apiinteractive_test.go`, `internal/console/apiinteractive_lifetimes_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 10 for today's.
+
+**Amended 2026-10-30 (PF-2, PF-4, PF-20, PF-22, PF-23, PF-24, PF-12).**
+- **Rootfs records (PF-2).** `instanceClassRefusal` is factored from `runClassRefusal` as Task 7a left it: its always-on arm already passes `rec.Runtime == provision.RuntimeRootfsV1`, so sessions get that pass. `TestInteractiveAdmitsARootfsResident`: a rootfs record that does not sleep, on a platform region, is admitted (Status `waiting`).
+- **Incarnation (PF-20).** The incarnation comes from `provision.Incarnation`, as the run door's does, not `hostclaim.Incarnation`.
+- **`release.Channel` (see preflight §1 row 10)** takes the release public key now: `release.Channel(ctx, s, pub, acct, app, channel)`.
+- **Lifetimes (PF-4).** The request is admitted as a read by `serveAdmitted`, so the refusals before the upgrade read the record judged, as any GET does. The rest of the session holds no unit:
+ - At the upgrade, the handler ends its request's unit (`endRequestUnit(r.Context())`). A session open for 6 hours therefore never holds a cutover's drain.
+ - Steps 3 to 6 (reserve, grant `Put`, the record CAS, `activate`, the serial bump and the `interactive-start` row) run as one write step: `s.lifetimesStep(ctx, true, …)`, bounded by `interactive.OpenWait` as before. If the gate refuses the step (the gate is draining), the session ends: End refused, `Detail` RFS-6-C37. The reservation is released, and nothing is written.
+ - Every end (the marker clear, the grant delete and the `interactive-end` row) is its own write step. If the gate refuses it while draining, the hub keeps the id in `endPending` with its End, and the sweep finishes it (Task 11). The CLI still gets its End at once.
+- **Request budget (PF-22).** Per session:
+ - On the console: 1 record GET before the upgrade; 2 record CAS (admit, clear), each a GET and a conditional PUT, or 3 when a sweep clears the marker instead; 1 grant PUT and 1 grant DELETE; for `carlos console`, 1 channel pointer GET and 1 manifest GET; 1 serial bump (the existing change-index write). Audit rows are console SQL, not bucket requests.
+ - On the owning box: 1 grant GET. The marker reaches it on the reconcile pass and change index it already runs, so nothing new is polled.
+ - On every other box: no request, since each ignores the marker before reading anything (Task 12).
+ - A box's dial is one WebSocket to the console, kept open for the session.
+- **Perf ring (PF-23).** `consolePerfSkip` skips `GET` on a path that starts `/api/cli/apps/` and ends `/interactive` with an `/instances/` segment, so the setting door's `PUT …/{app}/interactive` is still measured. It also skips the box doors' prefixes (`interactive.AttachPathPrefix`, and Task 16's `interactive.RunAttachPathPrefix`).
+- **Fixtures (PF-24).** The claim fixture keeps the harness's `bab` path, as Step 4 writes it. The behavioural tests use accounts `bah` and `baj`, the app `shop`, and `shopManifest(app, domain)`.
+- **File cells (PF-12).** Rewrite the deck's file cells of RFS-6-C27 and C32 to C37 to the paths written.
**Interfaces:**
-- Consumes: Tasks 2 to 4; `runClassRefusal` (split here, D4), `runMovingMsg`, `runImportMsg`, `runTooManyMsg` and the not-an-instance sentence (`internal/console/apiruns.go:28-70, 178`); `s.cli.instances.allow`; `hostclaim.Incarnation`; `release.Channel`, `release.GetManifest` (`internal/release/release.go:1238, 710`); `s.auditActivity`; `s.bumpSerial`.
+- Consumes: Tasks 2 to 4; `runClassRefusal` (split here, D4), `runMovingMsg`, `runImportMsg`, `runTooManyMsg` and the not-an-instance sentence (`internal/console/apiruns.go:28-70, 178`); `s.cli.instances.allow`; `provision.Incarnation` (amended, PF-20); `release.Channel`, `release.GetManifest` (`internal/release/release.go:1238, 710`; see preflight §1 row 10); `s.auditActivity`; `s.bumpSerial`; `s.lifetimesAdmit`, `s.recordCtx`, `unitFrom`, `lifetimesExempt` (`internal/console/lifetimes_cutover.go`).
+- Produces (amended 2026-10-30, PF-4):
+```go
+// lifetimesStep runs one record step of a long connection as its own unit: admitted with mutating, run under
+// s.recordCtx(ctx, u), ended when f returns. A refused admission returns an error wrapping errLifetimesRefused
+// (with the gate's sentence) and does not call f. On a console the gate does not govern, f runs as today.
+func (s *Server) lifetimesStep(ctx context.Context, mutating bool, f func(context.Context) error) error
+var errLifetimesRefused = errors.New("console: the lifetimes gate refused this step")
+// endRequestUnit ends the unit serveAdmitted admitted for this request (once-only, nil-safe): a long connection
+// holds no unit past its upgrade.
+func endRequestUnit(ctx context.Context)
+// interactiveHub gains: endPending map[string]interactive.End // ended sessions whose end step the gate refused; the sweep finishes them
+```
- Produces:
```go
// GET /api/cli/apps/{account}/{app}/instances/{host}/interactive, cliRoute with svcrole.Set{}, a WebSocket (interactive.NewServer)
@@ -828,11 +1179,23 @@ func TestAFailedAdmissionReleasesItsReservation(t *testing.T) // a Move set on t
func TestCancelledBeforePickup(t *testing.T) // CLI closes while waiting -> marker cleared, audit end "cancelled"
func TestTheSessionOutlivesTheServersReadTimeout(t *testing.T) // NewHTTPServer with ReadTimeout 200ms: a session idle 500ms still receives frames
func TestInteractiveOnAHostClaimConsole(t *testing.T) // 409 RFS-6-C35 before any read
+func TestInteractiveAdmitsARootfsResident(t *testing.T) // amended (PF-2): rootfs record, Hibernate false, region "uk": Status waiting
+// amended 2026-10-30 (PF-4), apiinteractive_lifetimes_test.go, on newLifetimesFx and its cutover door (lifetimes_cutover_test.go):
+func TestAWaitingSessionHoldsNoLifetimesUnit(t *testing.T) // gate before; a session admitted and waiting (its CLI socket open, the
+// 6-hour shape: nothing ends it during the test); the cutover is asked: the gate drains (drainedCh closes) within 1 s and activates
+// (status on) while the session is still waiting and still answers keepalives; a write the session makes afterwards (its end) is judged
+func TestAdmissionRefusedWhileDrainingEndsWithC37(t *testing.T) // the gate draining (a legacy unit held open by the test keeps it there):
+// the pre-upgrade checks pass (a read is admitted), the Open frame arrives, the write step is refused: End refused, Detail RFS-6-C37;
+// no grant object, record bytes unchanged, no audit row, no serial bump, the hub holds no entry for the id
+func TestASessionsEndStepIsItsOwnUnit(t *testing.T) // a session admitted before the cutover ends (CLI closes) after it activated: the clear,
+// the grant delete and the audit row run in one unit admitted on (the record write is judged); none runs under the request's ended unit
+func TestPerfRingSkipsTheSessionDoor(t *testing.T) // amended (PF-23): consolePerfSkip is true for GET …/instances/shop.example.com/interactive and
+// /api/box/interactive/<id>, false for PUT /api/cli/apps/bah/shop/interactive
```
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/console/ -run 'TestInteractive|TestConsoleProcess|TestPickupWindow|TestAdmissionReplaces|TestAdmissionHolds|TestAFailedAdmission|TestTwoSessions|TestCancelledBeforePickup|TestTheSessionOutlives' -count=1`
+Run: `go test ./internal/console/ -run 'TestInteractive|TestConsoleProcess|TestPickupWindow|TestAdmissionReplaces|TestAdmissionHolds|TestAFailedAdmission|TestTwoSessions|TestCancelledBeforePickup|TestTheSessionOutlives|TestAWaitingSessionHoldsNoLifetimesUnit|TestAdmissionRefusedWhileDraining|TestASessionsEndStep|TestPerfRingSkipsTheSessionDoor' -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement the door and the hub's CLI half**
@@ -844,7 +1207,7 @@ Expected: FAIL.
- Add a refused fixture: `claimRefusedAPI(http.MethodGet, "/api/cli/apps/bab/shop/instances/shop.example.com/interactive", "")`, status 409, msg `claimInteractiveUnsupportedMsg`.
- Add `claimUnsupported[claimInteractiveUnsupportedMsg] = "a session launches a tty unit the claim's isolated root protocol has no reservation for (#250); every session route refuses before it reads anything"`.
-Run: the Step 2 command, then `go test ./internal/console/ -run 'TestEveryCLIDoorNamesItsRoles|TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant' -count=1`. Expected: PASS.
+Run: the Step 2 command, then `go test ./internal/console/ -run 'TestEveryCLIDoorNamesItsRoles|TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant|TestDrainingRefusesEveryClaimsOffMutation|TestActivationWaitsForAdmittedWork|TestDetachedContinuationsOwnTheirUnit|TestAPIRun' -count=1`. Expected: PASS.
- [ ] **Step 5: Commit** (built list: RFS-6-C27, C32 to C37)
@@ -862,15 +1225,27 @@ git commit -m "console: the interactive session door, admission and audit (rootf
- Modify: `internal/console/server.go` (register `GET /api/box/interactive/{id}` with `registerRoute`)
- Modify: `internal/console/runsweep.go:73` (an interactive phase in `runSweepPass`; housekeeping deletes orphan grants)
- Modify: `testdata/claim-routes.txt`, `claim_invariant_fixtures_test.go` (refused fixture)
-- Test: `internal/console/apiinteractivebox_test.go`, `internal/console/runsweep_test.go`
+- Modify: `internal/console/lifetimes_cutover.go` (`lifetimesExempt` names the box door), `internal/console/view.go` (`consoleRegistry` gains `FleetOwners`)
+- Test: `internal/console/apiinteractivebox_test.go`, `internal/console/runsweep_test.go`, `internal/console/apiinteractive_lifetimes_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 11 for today's (`runSweepPass`, `findFleetBox`, `mintFleetToken`, `consoleRegistry`, `openRegistry`, `registerRoute`, `Registry.FleetOwners`). There are no `/api/box/` routes on main yet, so this is a new namespace.
+
+**Amended 2026-10-30 (PF-4, PF-16, PF-23).**
+- **Lifetimes (PF-4).**
+ - `lifetimesExempt` takes the path prefix `interactive.AttachPathPrefix`, and its comment says why: the box door reads and writes no instance record. It checks the hub, the token and the registry. The fleet it checks against is the one Task 10 stored on the `hubSession` at admission. So the box leg, open as long as the session, holds no unit.
+ - The splice's end is Task 10's end step, in its own unit.
+ - The sweep's interactive phase runs inside `runSweepPass`, which runs under `lifetimesIteration` (a mutating unit per pass; see preflight §1 row 11). It finishes `endPending` ids: it clears the marker, deletes the grant, and writes the `interactive-end` row with the recorded End's reason, not `lost`, once only. Then it drops the id. If a new session has replaced the marker meanwhile, `InteractiveClear(id)` answers `ErrInteractiveConflict` and the sweep leaves the new marker alone. It still deletes the old grant and writes the old session's end row. An `endPending` id is never live (`live` answers false), so a new admission may replace its marker.
+- **Fleet owner (PF-16).** `fleetIdentityOK` also requires that the fleet belongs to the session's account: `owners, err := reg.FleetOwners(); err == nil && owners[wantFleet] == wantAccount`, the hub's rule from fleet public routes (65fd8060). An error reading the owners is a refusal. `TokenHash` is the sha256 hex of the token string (`mintFleetToken`); compare it with `subtle.ConstantTimeCompare`.
+- **Perf ring (PF-23).** Task 10's `consolePerfSkip` already skips `interactive.AttachPathPrefix`.
**Interfaces:**
-- Consumes: Task 10's hub; `findFleetBox` (`internal/console/fleets.go:104`) and `openRegistry`; `registry.FleetPlacement`.
+- Consumes: Task 10's hub, `lifetimesStep` and `endPending`; `findFleetBox` and `openRegistry`; `registry.FleetPlacement`; `Registry.FleetOwners` (`internal/registry/fleets.go`, see preflight §1 row 11).
- Produces:
```go
func (s *Server) handleBoxInteractive(w http.ResponseWriter, r *http.Request)
type boxConn struct{ ws *websocket.Conn; box string }
-func fleetIdentityOK(reg consoleRegistry, name, token, wantFleet string) bool // name "<fleet>/<label>", fleet == wantFleet, box active, sha256(token) equals TokenHash (constant time)
+func fleetIdentityOK(reg consoleRegistry, name, token, wantFleet, wantAccount string) bool // amended (PF-16): name "<fleet>/<label>", fleet == wantFleet,
+// FleetOwners()[wantFleet] == wantAccount, box active, sha256 hex of token equals TokenHash (constant time)
+// consoleRegistry gains: FleetOwners() (map[string]string, error)
func (h *interactiveHub) splice(ctx context.Context, sess *hubSession, box *boxConn) interactive.End
func (s *Server) interactiveSweep(ctx context.Context, recs []provision.Record, now time.Time)
```
@@ -910,18 +1285,27 @@ func TestBoxGoneEndsTheCLIAsLost(t *testing.T)
func TestSilentLegIsLost(t *testing.T) // keepalive bounds shortened through hub fields
func TestSweepClearsMarkersOfOtherBoots(t *testing.T) // marker Console "old" -> cleared, grant deleted, one audit row "lost"; a marker held in the hub is left alone
func TestSweepDeletesOrphanGrants(t *testing.T)
+// amended 2026-10-30:
+func TestBoxDoorRefusesAFleetOfAnotherAccount(t *testing.T) // PF-16: a session of account bah on a record placed on fleet/home, where the fleets
+// table says home belongs to baj; the box presents home's valid credential: 404, the CLI still waits; FleetOwners failing: 404
+func TestCutoverDrainsWhileASplicedSessionRuns(t *testing.T) // PF-4: CLI and box attached, data flowing both ways; the cutover is asked: the gate
+// drains within 1 s and activates while bytes still cross the splice; the box door's request was never counted (lifetimesExempt)
+func TestAnEndRefusedWhileDrainingIsFinishedByTheSweep(t *testing.T) // PF-4: the gate draining (a legacy unit held by the test); the box sends
+// End exited 0: the CLI gets it at once; the marker and the grant stay; the hub has the id in endPending; the test releases the legacy
+// unit, the gate activates, one sweep pass clears the marker, deletes the grant and writes one interactive-end row with reason "exited"
+// (not "lost"); a second pass writes nothing
```
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/console/ -run 'TestBoxDoor|TestSplice|TestCLIGone|TestBoxGone|TestSilentLeg|TestSweepClearsMarkers|TestSweepDeletesOrphanGrants' -count=1`
+Run: `go test ./internal/console/ -run 'TestBoxDoor|TestSplice|TestCLIGone|TestBoxGone|TestSilentLeg|TestSweepClearsMarkers|TestSweepDeletesOrphanGrants|TestCutoverDrainsWhileASplicedSessionRuns|TestAnEndRefusedWhileDraining' -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement the door, the splice and the sweep phase**
- [ ] **Step 4: Census, then run**
-Add `route GET /api/box/interactive/{id}` to `claim-routes.txt`, and a refused fixture: `claimRefusedAPI(http.MethodGet, "/api/box/interactive/tty_aaaaaaaaaaaaaaaaaaaaaaaaaa", "")`, 409, `claimInteractiveUnsupportedMsg`. Run the Step 2 command, then `go test ./internal/console/ -run 'TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant|TestRunSweep' -count=1`. Expected: PASS.
+Add `route GET /api/box/interactive/{id}` to `claim-routes.txt`, and a refused fixture: `claimRefusedAPI(http.MethodGet, "/api/box/interactive/tty_aaaaaaaaaaaaaaaaaaaaaaaaaa", "")`, 409, `claimInteractiveUnsupportedMsg`. Run the Step 2 command, then `go test ./internal/console/ -run 'TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant|TestRunSweep|TestDrainingRefusesEveryClaimsOffMutation|TestActivationWaitsForAdmittedWork|TestFleet' -count=1`. Expected: PASS.
- [ ] **Step 5: Commit**
@@ -936,8 +1320,20 @@ git commit -m "console: the box door and the splice; the sweep clears dead sessi
**Files:**
- Create: `internal/host/interactive.go`
-- Modify: `internal/host/agent.go:613` (arm beside `armRunsPass`), `:1646` (`withInteractiveHook` beside `withRunsHook`), `:3613` and `internal/host/changeindex.go:296` (`runInteractivePass` beside `runRunsPass`)
-- Test: `internal/host/interactive_test.go`, `internal/host/interactive_e2e_linux_test.go`
+- Modify: `internal/host/agent.go` (arm beside `armRunsPass`, `withInteractiveHook` beside `withRunsHook`, `runInteractivePass` beside `runRunsPass`) and `internal/host/changeindex.go` (`runInteractivePass` beside `runRunsPass`); see preflight §1 row 12 for today's lines
+- Modify: `internal/activator/activator.go` (`Service.HoldsAwake`, beside `Owns`)
+- Test: `internal/host/interactive_test.go`, `internal/host/interactive_e2e_linux_test.go`, `internal/activator/cmd_test.go`
+
+**Amended 2026-10-30 (PF-15, PF-19, PF-12).**
+- **Region HA (PF-15).** Every region peer of a born-HA host adopts its record, so `owned` is true on each of them, and several boxes would dial one session. The first to reach the door may be a box whose `RunCmd` wake the HA acquire refuses. So `consider`'s first check is "owned, and for an HA route (`rt.HA`) this box holds the host awake". A box that does not hold it ignores the record before it reads the grant: no request, no dial, no log line. If no box holds a sleeping HA host awake, its session expires with RFS-6-C18. That is a known limit, dev only (the amendment above).
+ ```go
+ // activator: whether host's entry is this box's, awake, and holds its lease (ownedLocked(e, false) == nil).
+ func (a *Service) HoldsAwake(host string) bool
+ // the worker gains: holds func(host string) bool // svc.HoldsAwake; consulted only for rt.HA
+ ```
+- **Judged reads (PF-19).** The worker takes the box judge (`newBoxJudge`). Each pass, and each session's own reads, run under `provision.WithLifetimes(ctx, judge)`. Every record read goes through `judgedRecord`, as the runs worker's do. `armInteractivePass(svc, reg, events, judge)` takes it; a nil judge is a claims-on box.
+- **Wiring** moved (see preflight §1 row 12). `runRefusedWords` is at `runevents.go:70`. `release.ParsePublicKey` is at `internal/release/release.go:717` and is used as `agent.go` uses it for `CARLOS_RELEASE_PUBKEY`.
+- **File cells (PF-12).** Rewrite the deck's file cells of RFS-6-C48 to C57 to the paths written.
**Interfaces:**
- Consumes: Task 2 (frames, grant); Task 3 (`InteractiveSeen`); Task 4 (`appconfig.GetInteractive`); Task 9 (`RunCmd` with `TTY`, `CmdHandle.Terminal`); `runLauncher`, `owned` (`internal/host/runs.go:22-27, 132-140`); `openDeployStore`; `release.ParsePublicKey(getenv("CARLOS_RELEASE_PUBKEY"), …)`; `runRefusedWords` (`internal/host/runevents.go:65`).
@@ -960,14 +1356,14 @@ type interactiveWorker struct {
func newInteractiveWorker(...) *interactiveWorker
func (w *interactiveWorker) note(rec provision.Record) // InteractiveSeen: remember, never block
func (w *interactiveWorker) pass(ctx context.Context)
-func armInteractivePass(svc *activator.Service, reg *registry.Registry, events activator.EventSink)
+func armInteractivePass(svc *activator.Service, reg *registry.Registry, events activator.EventSink, judge *provision.LifetimeJudge) // amended (PF-19)
func withInteractiveHook(cfg provision.ReconcileConfig) provision.ReconcileConfig
func runInteractivePass(ctx context.Context)
func sessionStartedLine(id, by string) string // RFS-6-C48
func sessionEndedLine(id string, e interactive.End) string // RFS-6-C49 to C57
```
For each noted record, `consider` checks, in this order:
-1. The row is owned (`runsWorker.owned`'s rule), else ignore.
+1. The row is owned (`runsWorker.owned`'s rule) and, for an HA route, `holds(rec.Host)` (amended, PF-15), else ignore.
2. The marker's id is not seen yet.
3. Read the grant at `GrantKey` and verify it under `pub`. A forged or unreadable grant is logged once and ignored, and the box never dials.
4. Account, app and host match the record, and `now` is before `PickupBy`, else ignore.
@@ -1003,6 +1399,10 @@ func TestInteractiveWorkerIgnoresAForgedGrant(t *testing.T) // grant signed by a
func TestInteractiveWorkerRefusesWhenTheAppDisallows(t *testing.T) // C9, box half: allowed false -> End{Refused: "off"} on the connection; launcher.RunCmd never called
func TestInteractiveWorkerMapsLaunchRefusals(t *testing.T) // ErrCmdClaim -> claim, ErrCmdNotNested -> flat, *CmdWakeError -> wake + Detail, ErrTTYBusy -> busy
func TestInteractiveWorkerOnlyActsOnOwnedRows(t *testing.T)
+func TestInteractiveWorkerOnAnHARouteOnlyWhenItHoldsTheHost(t *testing.T) // amended (PF-15): rt.HA true and holds false: no grant read (a counting store), no dial;
+// holds true: dials; rt.HA false: holds never consulted
+func TestInteractiveWorkerReadsRecordsJudged(t *testing.T) // amended (PF-19): with a judge and a host incarnation slot that no longer vouches for the record: no grant read, no dial
+func TestHoldsAwake(t *testing.T) // activator, cmd_test.go: an awake owned entry -> true; asleep, stopping, a lost lease, no entry -> false
func TestInteractiveWorkerPresentsTheFleetCredential(t *testing.T) // fleet ok -> Authorization "Bearer tok" and Carlos-Tunnel-Name "f/box-a" on the dial
func TestInteractiveWorkerEndsAnIdleSession(t *testing.T) // idle 50ms -> Hangup then End idle
func TestInteractiveWorkerHangsUpThenStops(t *testing.T) // console End hangup -> Hangup(); unit not done within grace -> Stop() called
@@ -1016,7 +1416,7 @@ func TestInteractiveSessionEndToEnd(t *testing.T) // linux, interactive_e2e_linu
- [ ] **Step 2: Run them and see them fail**
-Run: `go test ./internal/host/ -run 'TestInteractiveWorker|TestInteractiveSessionEndToEnd' -count=1`
+Run: `go test ./internal/host/ -run 'TestInteractiveWorker|TestInteractiveSessionEndToEnd' -count=1` and `TMPDIR=/tmp/k go test ./internal/activator/ -run TestHoldsAwake -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement the worker and wire it**
@@ -1030,7 +1430,7 @@ Run the Step 2 command and `go test ./internal/host/ -run 'TestRuns|TestReconcil
- [ ] **Step 5: Commit** (built list: RFS-6-C48 to C57)
```bash
-git add internal/host
+git add internal/host internal/activator approved_rootfs_copy_test.go docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
git commit -m "agent: the box's interactive session worker (rootfs plan 6)"
```
@@ -1043,6 +1443,12 @@ git commit -m "agent: the box's interactive session worker (rootfs plan 6)"
- Modify: `run.go:28-32` (usage gains RFS-6-C01), `:41-88` (`runOpts.interactive`; flags `it` and `interactive`; RFS-6-C03 to C05), `:757-790` (`runRun` hands `-it` to `runSession`)
- Modify: `main.go:90` (`case "console": runConsole(args)`)
- Test: `interactive_cli_test.go`, `run_test.go`
+- Every line number above is as of 2026-10-24: see preflight §1 row 13 for today's (`parseRunArgs`, `runRun`, the `case "run"` dispatch; no `console` verb exists yet).
+
+**Amended 2026-10-30 (PF-11, PF-12).**
+- `carlos run` has gained `--idempotency-key` (5c7b0fa6). A session is never replayed, so `parseRunArgs` refuses `-it` (or `--interactive`) together with `--idempotency-key`, using RFS-6-C65's approved text. The check sits beside C03 to C05, before any dial, and exits 2 with the usage text after it, as the other parse refusals do.
+- Do not write RFS-6-C65 until the copy review has approved it. The same commit adds "RFS-6-C65" to `rootfsCopyIDs` (if the review's commit did not) and to `rootfsCopyBuilt`.
+- Rewrite the deck's file cells of RFS-6-C01 to C31 and C65 to the paths written (PF-12).
**Interfaces:**
- Consumes: Task 2's `Dial`, frames, `WebSocketURL`; `resolveMode`, `resolvedAccount`, `resolvedApp`, `apiPath`, `printUsing`, `sess.c.base`, `sess.c.token` (`auth.go:391-395`).
@@ -1091,7 +1497,8 @@ Exit codes from `sessionExit`:
- [ ] **Step 1: Write the failing tests** (a fake `terminal` and an `httptest` WebSocket server playing the console)
```go
-func TestParseRunArgsInteractive(t *testing.T) // "-it" and "--interactive" set it; with --file -> RFS-6-C03; --timeout given -> C04; --follow -> C05; no "--" command -> usage
+func TestParseRunArgsInteractive(t *testing.T) // "-it" and "--interactive" set it; with --file -> RFS-6-C03; --timeout given -> C04; --follow -> C05; no "--" command -> usage;
+// amended (PF-11): with --idempotency-key k1 -> exactly RFS-6-C65, and without -it the same key still parses as today
func TestRunConsoleTakesNoCommand(t *testing.T) // RFS-6-C11
func TestSessionRefusesWithoutATerminal(t *testing.T) // RFS-6-C06, exit 2, no dial
func TestSessionSendsOpenAndBridges(t *testing.T) // Open has argv, TERM from env ("" -> xterm-256color), size from the terminal; stdin bytes arrive as KindData; KindData lands on stdout
@@ -1114,10 +1521,10 @@ On unix, raw mode clears `ICANON|ECHO|ISIG|IEXTEN|IXON|ICRNL|OPOST` and sets `VM
Run the Step 2 command, then `GOOS=windows go build . && GOOS=darwin go build .`. Expected: PASS, then no output.
-- [ ] **Step 5: Commit** (built list: RFS-6-C01 to C31)
+- [ ] **Step 5: Commit** (built list: RFS-6-C01 to C31, and C65 once approved)
```bash
-git add interactive_cli.go interactive_cli_test.go interactive_term_*.go run.go run_test.go main.go
+git add interactive_cli.go interactive_cli_test.go interactive_term_*.go run.go run_test.go main.go approved_rootfs_copy_test.go docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
git commit -m "cli: carlos run -it and carlos console (rootfs plan 6)"
```
@@ -1126,7 +1533,9 @@ git commit -m "cli: carlos run -it and carlos console (rootfs plan 6)"
### Task 14: Docs
**Files:**
-- Modify: `docs/site/cli.md` (`### carlos run` gains RFS-6-C58 and C61; a new `### carlos console` section, RFS-6-C59; `carlos apps set` gains RFS-6-C60)
+- Modify: `docs/site/cli.md` (`### carlos run` gains RFS-6-C58 and C61; a new `### carlos console` section, RFS-6-C59; `carlos apps set` gains RFS-6-C60); see preflight §1 row 14 for today's headings
+
+**Amended 2026-10-30 (PF-12, PF-13).** Task 7a has already put RFS-3-C27 in `### carlos run`, as its own paragraph after the one on hibernating instances. C58 goes after C27's paragraph, and C61 after the section's exit-code paragraph. No RFS-3-C28 sentence exists, so there is nothing to work around. Rewrite the deck's file cells of RFS-6-C58 to C61 to `docs/site/cli.md`, with the old cells as notes.
**Interfaces:**
- Consumes: the approved rows.
@@ -1152,7 +1561,7 @@ Run: `go test ./internal/docsite/ -count=1` and the series copy gate (Plan 1 Tas
- [ ] **Step 4: Commit** (built list: RFS-6-C58 to C61)
```bash
-git add docs/site/cli.md
+git add docs/site/cli.md approved_rootfs_copy_test.go docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
git commit -m "docs: interactive sessions (rootfs plan 6)"
```
@@ -1163,6 +1572,8 @@ git commit -m "docs: interactive sessions (rootfs plan 6)"
**Files:**
- Create: `internal/host/interactive_rootrunner_linux_test.go` (`//go:build linux && rootrunner`, the pattern of `internal/host/dbreads_rootrunner_linux_test.go:1-60`)
+**Amended 2026-10-30 (PF-1, PF-8).** The witness's rootfs half (a session on a rootfs instance, and the dev-box check against one) needs Task 7a's rootfs start. Add one witness: `TestRootfsRunIsInsideTheInstance`, which runs `carlos run` through the real rootfs cmd unit on an arm64 runner. Its report's `/proc/self/cgroup` ends in `carlos-instances-<host>.slice/carlos-instance-rootfs-cmd@<host>.service`, and its `/` is the image's (C5). The roll goes dev first, because Task 5 adds `pts-private` to the binary probe, which gates `NestedOK` on every box. After the dev roll, check that each dev box still passes the nested gate (the control service's `/ready` with the probe report, which `NestedOK` and `NestedReady` read) before any flagship box takes the release.
+
**Interfaces:**
- Consumes: everything above; the root runner (role `carlos-root-runner`, `root-runner.py`).
- Produces: the witness; nothing for later tasks.
@@ -1186,11 +1597,12 @@ func TestInteractiveSessionRefusedWhenTheAppDisallows(t *testing.T)
- [ ] **Step 2: Run it on the root runner**
-Run on the runner: `go test -tags rootrunner ./internal/host/ -run 'TestInteractiveSession' -count=1 -v`
+Run on the runner: `go test -tags rootrunner ./internal/host/ -run 'TestInteractiveSession|TestRootfsRunIsInsideTheInstance' -count=1 -v`
Expected: PASS, with the report lines in the log. If an assertion fails, fix the template or code in its task; do not edit the witness.
- [ ] **Step 3: The dev-box checklist** (after merge and roll, dev first)
+0. (Amended 2026-10-30, PF-8.) Roll dev first. Before anything else, check that every dev box still reports `nested` readiness with the new `pts-private` probe line. If a box lost it, stop the roll: the probe's production wiring (Task 5) is wrong on that box.
1. `carlos apps set <app> --interactive on` as an owner. Then `carlos run -it` against a nested binary instance, and against a rootfs instance on a dev fleet box (the R10 box only with Paul's approval of this use: R10 covers Plans 2 and 4's checks).
2. In the session, run `cat /proc/self/cgroup` and `ls /data/instances /dev/pts`. Expected: the instance's own slice, its own directory, an empty `/dev/pts`.
3. Resize the window and see the REPL redraw. Press Ctrl-C in `sleep 100` and get the prompt back. Press Ctrl-D in `rails console` and see the CLI exit 0.
@@ -1224,6 +1636,24 @@ A fleet box cannot make a run's bucket writes (the pickup CAS on the record, the
- Create: `internal/console/apirunsbox.go`, `internal/console/apirunsbox_test.go`; Modify: `internal/console/apiruns.go` (admission writes the grant for a fleet-placed record; `runClassRefusal` loses its fleet arm), `internal/console/interactivehub.go` (run relays beside sessions), `internal/console/runsweep.go` (expire unattached relays), `server.go` (register `GET /api/box/runs/{id}`), `testdata/claim-routes.txt`, `claim_invariant_fixtures_test.go`
- Modify: `internal/host/runexec.go`, `internal/host/runs.go` (the runs worker's writes go through a `runSink`; a fleet box uses the relay sink); Create: `internal/host/runrelay.go`, `internal/host/runrelay_test.go`
- Modify: `docs/site/cli.md` (strike RFS-3-C28's sentence, write RFS-6-C62), the series deck (strike RFS-3-C28, add RFS-6-C62 to C64), `approved_rootfs_copy_test.go`
+- Modify (amended 2026-10-30): `plan3_groups_test.go` (RFS-3-C28 leaves `plan3CopyRuns`), `internal/console/lifetimes_cutover.go` (`lifetimesExempt` names `interactive.RunAttachPathPrefix`)
+- Every line number in this task is as of 2026-10-24: see preflight §1 row 16 for today's (`recordIncarnation`, `runFinishOurs`, `execute`, `launchable`, `finish`, `cleanUp`, `pickup`, `pickedAnyway`, `RunPick`, `RunFinish`, the store door's ACLs).
+
+**Amended 2026-10-30 (PF-1, PF-4, PF-13, PF-15, PF-16, PF-19, PF-23, PF-30).**
+- **Rootfs runs (PF-1).** Task 7a has made a rootfs run work on a platform box. This task's fleet path carries the same `RunCmd`, so a rootfs instance on a fleet box runs `carlos run` too, which is what RFS-6-C62 claims. Add `TestFleetRunsWorkerRelaysARootfsRun`: the real runsWorker over `relayRunSink`, with a rootfs route and the fake launcher, completes a run, and the console-written `result.json` has its exit. The run directory stays the activator's to remove (`AfterSettled`, Task 7a) on both sinks.
+- **Lifetimes (PF-4).**
+ - `/api/box/runs/{id}` is in `lifetimesExempt`, so the relay connection, open as long as the run, holds no unit.
+ - Each record step of `relayRun` is its own `s.lifetimesStep(ctx, true, …)`: the pickup CAS with its read-back, the finish CAS, and rule 5's lost-run finish.
+ - Chunk `Put`s and `result.json` are `runs/` objects, not record work, so they take no unit and go on while the gate drains.
+ - A pickup refused while draining answers `RunPicked{State: RunStateNotPicked}`. The box forgets the run, as rule 4 says, and the next pass dials again while the run is still queued inside its pickup window.
+ - A finish refused while draining is retried, each attempt in a fresh step with `untilLanded`'s backoff, until it lands or the console's run sweep (a `lifetimesIteration`) ends the run.
+ - The run admission's grant `Put` is part of the create request's own mutating unit, as `request.json` is today.
+- **Fleet owner (PF-16).** The run door uses Task 11's `fleetIdentityOK(reg, name, token, fleet, rec.Account)`, the owner check included.
+- **Region HA (PF-15) and judged reads (PF-19).** `sinkFor` and the relay act on an HA route only when `HoldsAwake(rec.Host)`, as Task 12 does. Every record read in the relay sink (the read-back after `RunPicked`) goes through `judgedRecord` under the box judge.
+- **Boot (PF-30).** `RunHello.Boot` is `newBootID()`, the agent process's id. Comment it "agent boot". It is never the kernel boot id that #451 writes into the legacy lease owner.
+- **RFS-3-C28 (PF-13).** It was never built: no `cli.md` sentence, not in `rootfsCopyBuilt`. Step 5 marks it `struck` in the deck, adds it to `rootfsCopyStruck`, and takes it out of `plan3CopyRuns`, or `TestPlan3CopyGroups` reports a group naming a row that is not live. It removes no sentence. RFS-6-C62 is written as its own paragraph after Task 7a's RFS-3-C27.
+- **Perf ring (PF-23).** `consolePerfSkip` skips `interactive.RunAttachPathPrefix` (Task 10's clause).
+- **Census (PF-14).** `PROPOSED-rootfs-apps-6` rows go through `make census-propose`, and Astra approves on #280.
**Interfaces:**
- Consumes: Task 2's `Grant`, `SignGrant`, `VerifyGrant`, `MintToken`, `TokenMatches`, `DialFrame`, `SendFrame`/`Receive` at `RunMaxFrame`; Task 11's `fleetIdentityOK` and box-door shape; Task 12's dial (`fleet()` credential, `X-Carlos-Box`); `runs.RequestKey`, `ChunkKey`, `ResultKey`, `runs.Result`, `runs.PickupWindow`; the existing run admission (`apiruns.go`) and the box's `runsWorker` (`internal/host/runexec.go:127-470`).
@@ -1302,27 +1732,34 @@ func TestRelayLostAfterPickupEndsTheRunAsLost(t *testing.T) // the fake box drop
func TestFleetRunsWorkerWritesNothingToTheBucket(t *testing.T) // a fleet runsWorker with a store failing every Put/Delete: the run completes through the relay; the CLI's poll reads the console-written output
func TestPlatformRunsWorkerIsUnchanged(t *testing.T) // a platform box: bucketRunSink; no dial is attempted
func TestForgedRunGrantExpiresTheRun(t *testing.T) // a grant signed by another key: no dial; the console's sweep expires the run at PickupWindow with today's result
+// amended 2026-10-30:
+func TestFleetRunsWorkerRelaysARootfsRun(t *testing.T) // PF-1: as above, on a rootfs route
+func TestRunRelayHoldsNoUnitAcrossACutover(t *testing.T) // PF-4: a relay open and streaming chunks; the cutover is asked: the gate drains within 1 s and activates
+// while chunks still land; a pickup asked while draining (a legacy unit held by the test) answers not-picked and the record is unchanged;
+// after activation the box's next dial is picked; a finish refused while draining lands after activation, once, judged
+func TestBoxRunDoorRefusesAFleetOfAnotherAccount(t *testing.T) // PF-16: as Task 11's, at /api/box/runs/{id}
+func TestRelaySinkOnAnHARouteOnlyWhenItHoldsTheHost(t *testing.T) // PF-15: rt.HA and not held: no grant read, no dial
```
- [ ] **Step 2: Run them to make sure they fail**
-Run: `go test ./internal/interactive/ -run 'TestRunGrant|TestRunFrames' -count=1`, `go test ./internal/console/ -run 'TestRunDoorAdmitsAFleetInstance|TestBoxRunDoor|TestRelay|TestRunPickupUsesTheBoxBoot|TestRunHelloIsChecked|TestForgedRunGrant' -count=1`, `go test ./internal/host/ -run 'TestFleetRunsWorker|TestPlatformRunsWorker|TestRelayWorkerStartsNothing' -count=1`
+Run: `go test ./internal/interactive/ -run 'TestRunGrant|TestRunFrames' -count=1`, `go test ./internal/console/ -run 'TestRunDoorAdmitsAFleetInstance|TestBoxRunDoor|TestRelay|TestRunPickupUsesTheBoxBoot|TestRunHelloIsChecked|TestForgedRunGrant|TestRunRelayHoldsNoUnitAcrossACutover' -count=1`, `go test ./internal/host/ -run 'TestFleetRunsWorker|TestPlatformRunsWorker|TestRelayWorkerStartsNothing|TestRelaySinkOnAnHARoute' -count=1`
Expected: FAIL.
- [ ] **Step 3: Implement** as above. Move today's runs-worker writes behind `bucketRunSink` first, with no behaviour change, and run `go test ./internal/host/ -run 'TestRuns|TestRunResult' -count=1` (PASS) before adding the relay.
- [ ] **Step 4: Census, then run**
-Add `route GET /api/box/runs/{id}` to `claim-routes.txt` and a refused fixture (409, `claimInteractiveUnsupportedMsg`). The runs worker change is agent code; the console's record and `runs/` writes are new Put sites: add them to the record-write census as Plan 1 Task 3 Step 4 does, `PROPOSED-rootfs-apps-6`, and the proposal on #280. Run the Step 2 commands and `go test ./internal/console/ -run 'TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant|TestAPIRuns|TestRunSweep' -count=1`. Expected: PASS.
+Add `route GET /api/box/runs/{id}` to `claim-routes.txt` and a refused fixture (409, `claimInteractiveUnsupportedMsg`). The runs worker change is agent code; the console's record and `runs/` writes are new Put sites: add them to the record-write census as Plan 1 Task 3 Step 4 does, `PROPOSED-rootfs-apps-6`, and the proposal on #280. Run the Step 2 commands and `go test ./internal/console/ -run 'TestClaimConsoleRouteCensus|TestClaimConsoleMutationInvariant|TestAPIRun|TestRunSweep' -count=1`. Expected: PASS.
-- [ ] **Step 5: Docs and copy.** In `docs/site/cli.md`'s `carlos run` section, remove RFS-3-C28's sentence and write RFS-6-C62 in its place; mark RFS-3-C28 `struck` in the deck (it stays in `rootfsCopyIDs`, joins `rootfsCopyStruck`) and remove it from `rootfsCopyBuilt` (the gate's struck-row rule, Plan 1 Task 1), and add RFS-6-C62 to C64. Run `go test ./internal/docsite/ -count=1` and the series copy gate. Expected: PASS.
+- [ ] **Step 5: Docs and copy.** In `docs/site/cli.md`'s `carlos run` section, remove RFS-3-C28's sentence and write RFS-6-C62 in its place; mark RFS-3-C28 `struck` in the deck (it stays in `rootfsCopyIDs`, joins `rootfsCopyStruck`) and remove it from `rootfsCopyBuilt` (the gate's struck-row rule, Plan 1 Task 1), and add RFS-6-C62 to C64. (Amended 2026-10-30, PF-13: there is no C28 sentence and C28 is not in `rootfsCopyBuilt`. Strike the row, add it to `rootfsCopyStruck`, take it out of `plan3CopyRuns`, and write C62 as its own paragraph after RFS-3-C27's. Rewrite the file cells of C62 to C64 to the paths written, PF-12.) Run `go test ./internal/docsite/ -count=1` and `GOFLAGS=-buildvcs=false go test . -run 'TestRootfsCopy|TestRootfsBuilt|TestPlan3CopyGroups' -count=1`. Expected: PASS.
- [ ] **Step 6: The dev-box check** (ask Paul first: ruling R10 approved the dev fleet box for Plans 2 and 4's checks only, so using it, or any box, here needs his approval of that scope): `carlos run --app shop --instance <host> -- /rails/bin/rails runner 'puts ActiveRecord::Base.connection.tables.sort.join(" ")'` on the fleet instance prints the tables, `carlos logs` shows the run, and the box made no `runs/` write (the store door's refusal log is empty for it).
- [ ] **Step 7: Commit**
```bash
-git add internal/interactive internal/console internal/host docs/site/cli.md docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md approved_rootfs_copy_test.go internal/provision
+git add internal/interactive internal/console internal/host docs/site/cli.md docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md approved_rootfs_copy_test.go plan3_groups_test.go internal/provision
git commit -m "carlos run: reach fleet boxes over the box-dials-the-console door (rootfs plan 6, ruling R7)"
```
@@ -1338,6 +1775,7 @@ git commit -m "carlos run: reach fleet boxes over the box-dials-the-console door
- No resume after a dropped connection in v1. The Windows CLI refuses `-it`.
- `carlos console` resolves `console` from the manifest of the version the instance's channel serves, on the console. For a binary app (no `processes`) it refuses with RFS-6-C33.
- A non-interactive `carlos run` on a fleet box is carried over the same door (Task 16, ruling R7): the box dials per run, and the console makes the record and `runs/` writes the store door would refuse the box.
+- (Amended 2026-10-30.) `carlos run` reaches rootfs rows (Task 7a), without `--version`. At a rootfs instance's lease loss, root kills its run and session units outright, beside the generations and the workers (Call A1). A run's directory goes only once its unit is proven gone. Long connections hold no lifetimes unit, and each record write takes its own.
---
@@ -1393,7 +1831,7 @@ Every string is human text the plan introduces. Existing approved strings it reu
| RFS-6-C44 | `apps_swap.go` | `%s: interactive sessions are on. any member can open a terminal on its instances with carlos run -it` |
| RFS-6-C45 | `apps_swap.go` | `%s: interactive sessions are off` |
| RFS-6-C46 | `apps_swap.go` | `apps set: the change did not stick (the console stored interactive %s). run it again` |
-| RFS-6-C47 | `apps_swap.go:39`, replaces `appsSetNothing` | `apps set: nothing to set. Pass --swap, --swap-concurrency, --interactive or one of the update settings` |
+| RFS-6-C47 | `apps_swap.go` `appsSetNothing`, replaces IP1-57 (revised 2026-10-30, PF-10; pending Paul's copy review) | `apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive` |
| RFS-6-C48 | `carlos logs` | `interactive session %s opened by %s` |
| RFS-6-C49 | `carlos logs` | `interactive session %s ended with exit %d after %s` |
| RFS-6-C50 | `carlos logs` | `interactive session %s ended after %s: %s` |
@@ -1411,3 +1849,4 @@ Every string is human text the plan introduces. Existing approved strings it reu
| RFS-6-C62 | `cli.md`, `### carlos run`, replaces RFS-3-C28 | `On a customer fleet, the instance's box reaches the console for the run itself, so carlos run works there as it does on any other box.` |
| RFS-6-C63 | `carlos logs` (box, a run grant that did not verify) | `run %s was not started on this box: its grant could not be verified` |
| RFS-6-C64 | `carlos logs` (box, the relay dropped mid-run) | `run %s lost its connection to the console, so it was stopped` |
+| RFS-6-C65 | `run.go` `parseRunArgs`, `-it` with `--idempotency-key` (new 2026-10-30, PF-11; pending Paul's copy review) | `-it takes no --idempotency-key. a session is never repeated by a retry` |
diff --git a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
index d0509ce81..02f8c90c4 100644
--- a/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
+++ b/docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md
@@ -10,6 +10,8 @@ status. Ids are canonical: `RFS-<plan>-C01` to `C99`, then `C100` onward
Approved 2026-10-24 by delegation: Paul asked for a Luna copy pass instead of a string-by-string review (LUNA-COPY-REVIEW-ROOTFS.md); RFS-4-C127 was edited by Claude.
+Pending since 2026-10-30 (the Plan 6 preflight): RFS-6-C47, revised to keep `--egress-allow` and `--size`, and RFS-6-C65, new. Both wait for Paul's copy review. The gate's inventory (`rootfsCopyIDs`) gains RFS-6-C65 in the commit that applies that review.
+
The rules:
- A row is `pending` until Paul approves it in the copy review. His edits are
@@ -515,7 +517,7 @@ From the plan: Every string is human text the plan introduces. Existing approved
| RFS-6-C44 | apps_swap.go | %s: interactive sessions are on. any member can open a terminal on its instances with carlos run -it | approved |
| RFS-6-C45 | apps_swap.go | %s: interactive sessions are off | approved |
| RFS-6-C46 | apps_swap.go | apps set: the change did not stick (the console stored interactive %s). run it again | approved |
-| RFS-6-C47 | `apps_swap.go:39`, replaces `appsSetNothing` | apps set: nothing to set. Pass --swap, --swap-concurrency, --interactive or one of the update settings | approved |
+| RFS-6-C47 | apps_swap.go (appsSetNothing, replacing today's IP1-57 `apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow or --size`, also the zero-downtime record zdd.apps-set.nothing; revised 2026-10-30 by the Plan 6 preflight, PF-10, to keep --egress-allow and --size; the first draft read `apps set: nothing to set. Pass --swap, --swap-concurrency, --interactive or one of the update settings`) | apps set: nothing to set. Pass --swap, --swap-concurrency, --egress-allow, --size or --interactive | pending |
| RFS-6-C48 | carlos logs | interactive session %s opened by %s | approved |
| RFS-6-C49 | carlos logs | interactive session %s ended with exit %d after %s | approved |
| RFS-6-C50 | carlos logs | interactive session %s ended after %s: %s | approved |
@@ -533,6 +535,7 @@ From the plan: Every string is human text the plan introduces. Existing approved
| RFS-6-C62 | `cli.md`, `### carlos run`, replaces RFS-3-C28 | On a customer fleet, the instance's box reaches the console for the run itself, so carlos run works there as it does on any other box. | approved |
| RFS-6-C63 | `carlos logs` (box, a run grant that did not verify) | run %s was not started on this box: its grant could not be verified | approved |
| RFS-6-C64 | `carlos logs` (box, the relay dropped mid-run) | run %s lost its connection to the console, so it was stopped | approved |
+| RFS-6-C65 | run.go (parseRunArgs: `carlos run -it` or `--interactive` given with `--idempotency-key`; printed to stderr before the usage text, exit 2; added 2026-10-30 by the Plan 6 preflight, PF-11) | -it takes no --idempotency-key. a session is never repeated by a retry | pending |
## Conflicts
@@ -565,5 +568,5 @@ strike them (Astra R2 finding 5).
- Plan 3: 33 live, 2 struck, 35 rows
- Plan 4: 138 live, 0 struck, 138 rows
- Plan 5: 44 live, 0 struck, 44 rows
-- Plan 6: 64 live, 0 struck, 64 rows
-- Total: 376 live, 2 struck, 378 rows
+- Plan 6: 65 live, 0 struck, 65 rows (RFS-6-C47 revised and RFS-6-C65 added on 2026-10-30, both pending)
+- Total: 377 live, 2 struck, 379 rows
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rootfs-plan6-amendment.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rootfs-plan6-amendment.md
new file mode 100644
index 000000000..539869db3
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-rootfs-plan6-amendment.md
@@ -0,0 +1,70 @@
+# Review brief: rootfs apps Plan 6 (interactive sessions), the preflight amendment of 2026-10-30, round 1 of 3
+
+Repo carlos/platform, branch `rootfs-apps-6-interactive`, at the commit named in your prompt (this brief's commit, on main c24e7a04).
+Under review: in `docs/superpowers/plans/2026-10-24-rootfs-apps-6-interactive.md`, the section "## Amendment 2026-10-30 (preflight)", the new "### Task 7a", every block or line marked "Amended 2026-10-30" (or "amended 2026-10-30") in Global Constraints, the file table and Tasks 1, 3 to 16, and the string table rows RFS-6-C47 and RFS-6-C65. Also the two rows in `docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md` (RFS-6-C47, now `pending`, and RFS-6-C65, new and `pending`) and the deck's header and counts. `git diff c24e7a04 -- docs/superpowers/plans/` shows exactly what changed. The rest of the plan was accepted in Astra R1 and R2 (2026-10-24). Read it only for context.
+
+Authorities:
+- `docs/superpowers/specs/2026-10-24-rootfs-apps-design.md` rev 5 (§5.5, §5.6, §5.10 and C9, §5.11 and C10, C5, C7), and the run design `docs/superpowers/specs/2026-10-08-carlos-run-design.md` rev 4.
+- The series index, `docs/superpowers/plans/2026-10-24-rootfs-apps-0-index.md`.
+- main's code at c24e7a04 (this branch has no code changes).
+- The preflight table, `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/rootfs-apps-6/.superpowers/sdd/2026-10-24-rootfs-apps-6-interactive/preflight.md`. It is git-excluded, so read it at that path. It is the accepted record of what changed on main since the plan was written, with its rulings PF-1 to PF-32.
+- The reverted Plan 3 Task 12, which Task 7a brings back in part: `git show 6c6f8607 56cc06aa` (reverted at bba9a52d). Its review and report are at `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/rootfs-apps-3/.superpowers/sdd/2026-10-24-rootfs-apps-3-lifecycle/task-12-r1-astra.md` and `task-12-report.md`.
+
+Do not review against unmerged branches. If this amendment needs one, say so as a P1 and stop.
+
+You are an independent reviewer. Read the amendment and the changed tasks, then the code they name, and check every claim against that code at c24e7a04.
+
+## Fixed: do not re-argue
+
+- The preflight's rulings PF-1 to PF-32, accepted as written (SDD ledger, 2026-10-30). Report only a mechanism in the amendment that fails to honour one, or a task that leaves one out.
+- `--version` stays deferred (#431). RFS-3-C17 to C22 and C26 stay unbuilt. The P1s of Plan 3 Task 12 R1 that were about `--version` (#2, #3) and its P2 #5 are out of scope.
+- Paul's earlier rulings recorded in the plan and the index: R7 (fleet runs over the box door, Task 16), R10, R11.
+- The census rule of 2026-10-26: the reviewer approves census classes on #280, and Paul is never asked.
+- The text of RFS-6-C47 and C65 goes to Paul's copy review. Do not review wording. Do check that each row's context is right, that the rows are complete, and that the gate's bookkeeping holds.
+
+## What to check
+
+1. **Task 7a against Plan 3 Task 12 R1 P1 #1 (C7).** Does Call A1 close the failure that review describes: an attached rootfs command outliving the lease, an entry already stopping, a start in flight? Call A1 adds a root kill for the rootfs one-shot roles at loss, a graceful stop at `residentLeaseShort` whatever the entry's state, a second kill when an in-flight start returns, and `oneShotHeadroom` before the start. Check it against `internal/activator/rootfs_service.go` (`watchResidentLease`, `residentLeaseShort`, `residentLeaseLost`, `residentLeaseLostLocked`, `killResidentGens`), `internal/activator/rootfsworkers.go` (`stopRootfsWorkersAtLoss`, `workerHeadroom`, `workerStartLead`), `internal/activator/cmd.go` (`cmdHold.stop`, `cmdHoldsLocked`, `RunCmd`), `internal/instancectl/server.go` (`parseRequest`'s kill rule), `internal/instancectl/rootfs.go` (`stopRootfs`) and `internal/instancectl/gen.go` (`killGen`). Call A1 goes beyond PF-3's letter, which took the worker shape with no kill. Say whether it is needed and whether it is safe (root code, census). Is there a window where a cmd or tty unit runs past the lease's safety deadline? If so, give it with the timings (`residentDrainBudget`, `DeadlineControl`, `roleEmptyBound`, `TimeoutStopSec=20`).
+2. **Task 7a against P1 #4 (INV-2).** Does `CmdSpec.AfterSettled` keep `CARLOS_RUN_DIR` until the unit is proven gone on every `RunCmd` path in `internal/activator/cmd.go`: each refusal, `abandon`, a start that returned no unit, a start that may have begun (unit with error), a failed own Stop, `settleCmds`, `interruptCmdsLocked`, the sweep's retry, the lease stop and Shutdown? Is it called exactly once, never under `a.mu`? Does the box (`internal/host/runexec.go`, `execute`, `finish`, `cleanUp`) still delete the directory on paths that never called `RunCmd`, and leave it on every other path?
+3. **Task 7a's start path.** `StartCmd`'s rootfs arm reuses Plan 3's `startRootfsCmd`, which `StartRelease` uses today, generalized by `rootfsCmdLaunch`. Check: the release's bytes are unchanged; the run's launch file is schema 2 with process `cmd` and no argv; the argv reaches root as `StagedImage.Argv` and root accepts it for `RoleCmd` (`resolveRootfsLaunch`); the env is composed only (`rootfsLaunchEnv(rootfsCmdVars(...))`, INV-5); `spec.serving` and `spec.genEnv` are set for a rootfs generation (`RunCmd`; `Gen.StagedPath` for a rootfs generation, `internal/activator/rootfs.go`); `runExecGate` in `startRootfsCmd` is harmless for a run. Do the invariant tables Task 7a names exist and still hold? And `plan3_groups_test.go`: is moving RFS-3-C27 into `plan3CopyA` correct, and does `TestPlan3CopyGroups` pass with it?
+4. **Task 9 (PF-3, PF-17, PF-18).** Is the tty hold reached by every lease path the cmd hold is? Are all four `e.cmd == nil` sites in `internal/activator/activator.go` and the cancel in `beginStopLocked` covered? Is the release's busy check (`internal/activator/rootfsrelease.go`) narrowed correctly?
+5. **Tasks 10, 11 and 16 (PF-4) against `internal/console/lifetimes_cutover.go`.** Check `serveAdmitted`, `admit`, `done`, `lifetimesExempt`, `lifetimesIteration` and `recordCtx`:
+ - Does ending the request's unit at the upgrade leave the gate's count right in every state (before, draining, on)?
+ - Is exempting the box doors safe? They must read and write no instance record outside their own steps.
+ - Does each record write run in its own mutating unit, with no unit held across a long connection?
+ - Is a refused end finished correctly by the sweep (`endPending`), including when a new session has replaced the marker?
+ - Does a relay's pickup or finish refused while draining recover without losing the run?
+ - Do the named tests drive a real drain and activation (`newLifetimesFx`, the cutover door)?
+6. **The other folded rulings.** Each line marked amended should match its PF row and today's code. In particular:
+ - PF-6: `TTYControl` and the fifth client verb.
+ - PF-7: every role-blind site the preflight lists is named.
+ - PF-8: the binary probe's production wiring.
+ - PF-9: `instance-exit --rootfs tty`.
+ - PF-15: `HoldsAwake`, and where the check sits.
+ - PF-16: `fleetIdentityOK` and `consoleRegistry.FleetOwners`.
+ - PF-21: the `appsSetRun` signature and both nothing-given checks.
+ - PF-22: is the request budget complete and right?
+ - PF-23: the perf skip must not skip the setting door.
+ - PF-13: striking C28 also needs `plan3CopyRuns` edited.
+7. **Copy bookkeeping.** RFS-6-C47 has a second consumer, the zero-downtime record `zdd.apps-set.nothing` (`docs/superpowers/plans/2026-10-07-zero-downtime-deploys-6-copy.json`, `approved_copy_zdd_test.go`). Does Task 4 handle it? The deck now has RFS-6-C65 while `rootfsCopyIDs` does not. The amendment says the review's commit adds it. Is that stated clearly enough, and in the right task? Today `TestRootfsCopyDeckParses` and `TestRootfsCopyRecordIsComplete` fail on this branch for that one id, and that is known.
+8. **Buildability.** Every test name has assertions, every command runs the tests it names (check the `-run` patterns match the names), and every new or changed signature is exact. Is the ordering of tasks right: 7a after 5 and 6, and 8 to 16 after 7a? Does any amended task consume something no task produces?
+
+## Severity
+
+- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge.
+- **P2**: wrong or missing. Fixed without reopening this review. (The census, and review of any newly changed security, root, termination or production-storage behaviour, still check the fix; see AGENTS.md, "Stopping rules".)
+- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round.
+
+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 gives the section or task, the problem, the evidence (file:line, verified), the failure scenario, a concrete fix and the invariant or trust boundary it breaks (that is its fault family). End with exactly one verdict:
+
+- **READY**: no P1 and no P2.
+- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round.
+- **NOT READY**: one or more P1s, listed.
+
+In round 3, a NOT READY also says whether the P1s share one cause, and whether refusing the case up front or cutting the feature would remove them.
+
+Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites.