carlos / platform Public

agent: a failed launch waits for the settle proof; lifetime 0 matches 0 (rootfs plan 6 task 12 fix round 2)

serve waits for AfterSettled before it ends, logs or classifies a RunCmd
error, since the start may have reached the control service; only the
worker's shutdown gives up on the proof. sessionIncarnationLocked refuses
a session only when the entry's lifetime differs from the authorized one,
so a record and row with no lifetime fields can open sessions. Census
overlay rootfs-apps-6 re-proposed (seal 2fdc6168).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev a3e1028df54ebf88ea373c62f3c7f8f54584563b parent ecb0f08
8 files changed, +218 −28
  • docs/superpowers/notes/census-proposal-rootfs-apps-6.md +2 −2
  • internal/activator/cmd.go +7 −5
  • internal/activator/cmd_test.go +25 −8
  • internal/activator/cmdunit.go +3 −2
  • internal/host/interactive.go +27 −0
  • internal/host/interactive_test.go +145 −2
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv +8 −8

Intent

Human

<task-notification> <task-id>a7b28f09dea878b2c</task-id> <tool-use-id>toolu_01GcxA3QKn6AT3SYEreManEA</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/a7b28f09dea878b2c.output</output-file> <status>completed</status> <summary>Agent "Apply approved Plan 6 copy gaps" 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>All four strings are in, in one commit: **ecb0f086** on rootfs-apps-6-interactive (parent 3ec25d37). Not pushed, and the worktree is clean. **Tests:** all pass. That covers the copy gates (`go test . -run 'Copy|Rootfs|Moves|AppsSet|APISession'`), the touched packages' targeted tests (`-count=1`), the root-read census test, and the darwin/arm64, windows/amd64 and linux/arm64 builds. The three new tests (C67, C68, C69) failed for the expected reason before the fix and pass after it. **Where each string went:** - **C66:** the first line of `appsSetUsage` in `apps_swap.go`. Both gates that pinned the old line now hold the new one: `zdd.apps-set.usage` in the zero-downtime record and `GAP-2` in the instance-policy record. Each entry gained `"superseded_by": "RFS-6-C66"` and a note quoting the old line. The deck marks C66 as "a fragment", because it is only part of the usage literal and the gate can't match it any other way. - **C67:** `setInteractive` prints it only when the 404 carries no JSON error, the same rule the swap door uses for its old-console message. A 404 that brings the console's own words still shows those words. - **C68:** the import abort now answers 409 with C68 when a session is open. Before, that case fell through to a 502 ("could not update the import…"). - **C69:** `sessionEndWords` now has a case for `interactive.EndReplaced`. - **Deck, approvals list and gate:** the four rows went into the deck with their file cells and "approved", plus a note that Paul approved them on 2026-10-31. I also updated the deck's Plan 6 and total row counts. All four ids are in `rootfsCopyIDs` and `rootfsCopyBuilt`, and in `copy-approved.json`. **Census:** `make census-card` showed that the envelopes for the root package and `internal/host` had changed. I re-proposed the rootfs-apps-6 overlay with all 60 earlier claims copied over unchanged. Only those two envelope lines changed, the seal stayed at 87f29ffd, and the approval card didn't change. I didn't ask for an approval. **Things I couldn't place:** - `copy-approved.json` is updated on disk but isn't in the commit, because `.git/info/exclude` excludes all of `.superpowers/`. - I didn't mark the old GAP-2 row in `LUNA-COPY-RESULT-INSTANCE-POLICY.md` or the plan notes as superseded. They are historical records that no gate reads, and the C47 change left them alone the same way. The `packed-refs.lock` warning git printed during the commit comes from an empty, read-only file dated Oct 30; the branch ref updated normally. My scratch directory is deleted.</result> <usage><subagent_tokens>149581</subagent_tokens><tool_uses>58</tool_uses><duration_ms>663548</duration_ms></usage> </task-notification>

Human

Yes, go ahead.

Human

<cross-session-message from="uds:/run/user/1001/cc-socks/1370079.sock" from-name="platform-54" from-mode="bypass"> From platform-54: heads-up, Paul has OK'd it. In about 20-30 minutes the 1b drill will stop the DEV console for about 1-3 minutes, to invalidate the hostname history, add box-2 to r10r and re-activate the history (the same offline window box-1 needed). Dev boxes keep serving, so shop and railsdemo stay up; only console API/CLI calls fail during the window. Reply "hold until <time>" if that collides with your Plan 6 dev-box check. Otherwise I'll go ahead, and I'll tell you when the console is back. </cross-session-message>

Attributed to this commit: 15.9 g CO₂e (2,083,746 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/notes/census-proposal-rootfs-apps-6.md b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
index 68288ff7c..491ca6918 100644
--- a/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
+++ b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
@@ -9,7 +9,7 @@ Ruling `census-ruling-rootfs-apps-6`. The independent reviewer approves or rejec
| `internal/activator/activator.go` `Service.sweepOnce` | body | unchanged (39) | rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged |
| `internal/activator/activator.go` `type Service` | body | unchanged (0) | rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing |
| `internal/activator/backend_rootfs.go` `ExecBackend.StartRelease` | body | unchanged (2) | rootfs Plan 6 Task 7a: passes rootfsCmdLaunch{Process: release.ProcessRelease} to startRootfsCmd in place of the bare process name; its /cmd request and launch.cmd.json are byte-identical to before (TestStartReleaseIsUnchanged, goldens written from 3fd3c3a4); no read added; Plan 6 Task 8: passes instancectl.RoleCmd and oneShotSinks{Stdout, Stderr} (the same two release writers) to startRootfsCmd, which now takes the role; its /cmd request and launch.cmd.json stay byte-identical (TestStartReleaseIsUnchanged); no read added |
-| `internal/activator/cmdunit.go` `type CmdSpec` | body | unchanged (1) | rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing |
+| `internal/activator/cmdunit.go` `type CmdSpec` | body | unchanged (1) | rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing; Task 12 fix round 2: comment only: the Incarnation field's comment now says 0 (a record and row with no lifetime fields) is a value like any other, matching sessionIncarnationLocked's revised rule |
| `internal/activator/prepare.go` `ExecBackend.prepareKeyedAt` | body | unchanged (13) | rootfs Plan 6 Task 8: the cmd role three exceptions (no env read, the replica gate left to StartCmd, no app-log listener) now cover every one-shot role, instancectl.OneShot(role): cmd and tty; before, the tty role fell to the sidecar env-file read and an app-log listener on its handoff socket path; no read added, one removed for tty |
| `internal/activator/rootfs_service.go` `Service.residentLeaseLost` | body | unchanged (2) | rootfs Plan 6 Task 7a (Call A1): residentLeaseLostLocked also returns one kill func per one-shot unit that may run; each runs off a.mu in the same WaitGroup as stopRootfsWorkersAtLoss and killResidentGens, which still run only for a resident (gens non-nil); the kills go to root's existing /stop through KillOneShot; no read added |
| `internal/activator/rootfsrelease.go` `Service.releaseAdmitLocked` | body | unchanged (3) | rootfs Plan 6 Task 9 (PF-17): the busy check is holdBusyLocked(e, RoleCmd) where it was cmdBusyLocked(e): only established cmd-unit holds and cmd-unit lease stops refuse a release command, never a started session, whose tty unit is its own; cmdStartInFlightLocked now also counts a session's start in flight (merge ruling M2), so a release is refused during either role's start window, short and bounded, as swap admission is (fix round 2 ruling: a refusal at admission is not executed and takes the ordinary retry); no read added, read sites unchanged |
@@ -112,6 +112,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/interactive/interactive.go:type Open`: reads +file:Open; written legacy, accepted-legacy, frozen
- reads `internal/activator/cmdunit.go:cmdUnit.StopAndSettle`: +registry:Host, +whole:Route; keeps legacy, task accepted-legacy
-Seal: `1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7` → `87f29ffd175e44b45b2de6a8f9623b9384dd36be3ef8a057bbcfd723c9118b5e`.
+Seal: `1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7` → `2fdc6168d50c8230f8973511c3b44d2056b4a3b027a86ac4326978241193207c`.
Overlay: `internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/internal/activator/cmd.go b/internal/activator/cmd.go
index a3aaf27ce..114c0af25 100644
--- a/internal/activator/cmd.go
+++ b/internal/activator/cmd.go
@@ -42,15 +42,17 @@ var ErrCmdBusy = errors.New("activator: a run is already attached to this instan
var ErrTTYBusy = errors.New("activator: a session is already attached to this instance")
// ErrCmdIncarnation: a session's authorization names another lifetime of
-// the instance than the awake entry's row, or none (CmdSpec.Incarnation).
-// Nothing starts.
+// the instance than the awake entry's row (CmdSpec.Incarnation). Nothing
+// starts.
var ErrCmdIncarnation = errors.New("activator: the session was authorized for another lifetime of the instance")
// sessionIncarnationLocked reports whether spec, a session, is refused
-// against e for its lifetime: unknown, or not the entry's row's. A run is
-// never refused here. The caller holds a.mu.
+// against e for its lifetime: one that differs from the entry's row's. 0
+// is a value, not "unknown": a record and a row with no lifetime fields
+// (RouteFor keeps (0, 0)) match, and 0 against 1 does not (Task 12 fix
+// round 2 ruling). A run is never refused here. The caller holds a.mu.
func sessionIncarnationLocked(e *actEntry, spec CmdSpec) bool {
- return spec.TTY != nil && (spec.Incarnation == 0 || e.route.Incarnation != spec.Incarnation)
+ return spec.TTY != nil && e.route.Incarnation != spec.Incarnation
}
// ErrCmdNotInstance: runs are for instances; the route is a worker or
diff --git a/internal/activator/cmd_test.go b/internal/activator/cmd_test.go
index 38bea1395..4ed922ed5 100644
--- a/internal/activator/cmd_test.go
+++ b/internal/activator/cmd_test.go
@@ -1459,9 +1459,10 @@ func TestHoldsAwake(t *testing.T) {
}
// A session launches only against the lifetime it was authorized for (Task
-// 12 fix round 1, P1): an awake entry of another lifetime of the host, an
-// unknown lifetime, or an entry whose row moves before the start, is
-// ErrCmdIncarnation, and no unit starts. A run is not checked.
+// 12 fix round 1, P1): an awake entry of another lifetime of the host, or
+// an entry whose row moves before the start, is ErrCmdIncarnation, and no
+// unit starts. Lifetime 0 is a value (fix round 2 ruling): 0 matches 0,
+// and 0 against 1, either way round, is refused. A run is not checked.
func TestRunCmdBindsASessionToItsIncarnation(t *testing.T) {
session := func(inc uint64) CmdSpec { s := sessionSpec("tty_a"); s.Incarnation = inc; return s }
old, successor := testRoute("c.example.com"), testRoute("c.example.com")
@@ -1493,14 +1494,30 @@ func TestRunCmdBindsASessionToItsIncarnation(t *testing.T) {
}
h.Release()
})
- t.Run("unknown", func(t *testing.T) {
- // A row and a session with no lifetime: unknown is refused, even
- // though the two agree.
+ t.Run("no lifetime matches no lifetime", func(t *testing.T) {
+ // A record and a row with no lifetime fields (RouteFor keeps
+ // (0, 0)): the session starts.
a, cb, _ := testCmdActivator(t, Config{})
legacy := testRoute("c.example.com")
legacy.Incarnation = 0
- if _, err := a.RunCmd(context.Background(), legacy, session(0)); !errors.Is(err, ErrCmdIncarnation) || cb.ttyStarts != 0 {
- t.Fatalf("err = %v, %d starts; want ErrCmdIncarnation and none", err, cb.ttyStarts)
+ h, err := a.RunCmd(context.Background(), legacy, session(0))
+ if err != nil || cb.ttyStarts != 1 {
+ t.Fatalf("err = %v, %d starts; want the session started", err, cb.ttyStarts)
+ }
+ h.Release()
+ })
+ t.Run("no lifetime against lifetime 1", func(t *testing.T) {
+ for _, c := range []struct{ row, authorized uint64 }{{0, 1}, {1, 0}} {
+ a, cb, _ := testCmdActivator(t, Config{})
+ rt := testRoute("c.example.com")
+ rt.Incarnation = c.row
+ prepared := 0
+ spec := session(c.authorized)
+ spec.Prepare = func(context.Context) error { prepared++; return nil }
+ if _, err := a.RunCmd(context.Background(), rt, spec); !errors.Is(err, ErrCmdIncarnation) || cb.ttyStarts != 0 || prepared != 0 {
+ t.Fatalf("row %d, authorized %d: err = %v, %d starts, Prepare ran %d times; want ErrCmdIncarnation at admission",
+ c.row, c.authorized, err, cb.ttyStarts, prepared)
+ }
}
})
t.Run("the row moves before the start", func(t *testing.T) {
diff --git a/internal/activator/cmdunit.go b/internal/activator/cmdunit.go
index cae3410c9..c88a60ee8 100644
--- a/internal/activator/cmdunit.go
+++ b/internal/activator/cmdunit.go
@@ -61,8 +61,9 @@ type CmdSpec struct {
// rootfs apps Plan 6 Task 12 fix round 1). RunCmd refuses a session
// with ErrCmdIncarnation, under a.mu at admission and again at its last
// check, unless the awake entry's row has exactly this lifetime; 0, a
- // lifetime unknown, is refused. A run does not set it and is not
- // checked: its pass reads the record again under the hold (Prepare).
+ // record and row with no lifetime fields, is a value like any other
+ // (fix round 2). A run does not set it and is not checked: its pass
+ // reads the record again under the hold (Prepare).
Incarnation uint64
// RunDir is CARLOS_RUN_DIR: <instance dir>/.carlos-run/<RunID>, made and
// filled by the caller.
diff --git a/internal/host/interactive.go b/internal/host/interactive.go
index 8ddc80b92..ce362a495 100644
--- a/internal/host/interactive.go
+++ b/internal/host/interactive.go
@@ -687,6 +687,16 @@ func (s *sessionRun) serve(open interactive.Open) (interactive.End, bool) {
ended := lctx.Err() != nil
lcancel()
if err != nil {
+ // RunCmd can fail after its start reached the control service, so
+ // a unit may be running: the End and its verdict wait for the
+ // proof that it is gone (AfterSettled, which RunCmd calls before it
+ // returns when nothing started). Only the worker's shutdown gives
+ // up on it; the activator's own shutdown settles the unit (fix
+ // round 2, P2).
+ if !s.awaitSettled() {
+ log.Printf("agent: interactive: %s %s: start: %v; the unit was not proven gone before the agent stopped", s.rec.Host, s.g.ID, err)
+ return interactive.End{Reason: interactive.EndInterrupted, Detail: activator.StopShutdown}, false
+ }
if ended {
return s.peerGone(), false
}
@@ -704,6 +714,23 @@ func (s *sessionRun) serve(open interactive.Open) (interactive.End, bool) {
return end, true
}
+// awaitSettled waits for the activator's proof that the session's unit is
+// gone (s.settled). It answers false, the proof still pending, only when
+// the worker shuts down first.
+func (s *sessionRun) awaitSettled() bool {
+ select {
+ case <-s.settled:
+ return true
+ case <-s.w.life.Done():
+ select {
+ case <-s.settled:
+ return true
+ default:
+ return false
+ }
+ }
+}
+
// bridge relays between the connection and the session's terminal until
// the session ends, then stops the unit and releases it.
func (s *sessionRun) bridge(handle activator.CmdHandle) interactive.End {
diff --git a/internal/host/interactive_test.go b/internal/host/interactive_test.go
index 814fd4424..d99186e7f 100644
--- a/internal/host/interactive_test.go
+++ b/internal/host/interactive_test.go
@@ -344,19 +344,32 @@ type ixLaunch struct {
handle *ixHandle
// block, when set, holds RunCmd until ctx ends.
block bool
+ // settleLater, when set, models a start that failed after reaching the
+ // control service: RunCmd returns err at once and AfterSettled runs
+ // only once settleLater closes. Otherwise a failed RunCmd calls
+ // AfterSettled before it returns, as the activator does when nothing
+ // started.
+ settleLater chan struct{}
}
func (l *ixLaunch) RunCmd(ctx context.Context, rt registry.Route, spec activator.CmdSpec) (activator.CmdHandle, error) {
l.mu.Lock()
l.specs = append(l.specs, spec)
l.routes = append(l.routes, rt)
- err, h, block := l.err, l.handle, l.block
+ err, h, block, later := l.err, l.handle, l.block, l.settleLater
l.mu.Unlock()
if block {
<-ctx.Done()
- return nil, ctx.Err()
+ err = ctx.Err()
}
if err != nil {
+ if spec.AfterSettled != nil {
+ if later != nil {
+ go func() { <-later; spec.AfterSettled() }()
+ } else {
+ spec.AfterSettled()
+ }
+ }
return nil, err
}
h.mu.Lock()
@@ -1816,6 +1829,37 @@ func TestInteractiveWorkerBindsTheLaunchToTheAuthorizedIncarnation(t *testing.T)
wd.door.wantEnd(t)
wd.wait()
})
+ // Lifetime 0 is a value (fix round 2 ruling): a record and a row with
+ // no lifetime fields match, and the launch names 0; a record of 0 on a
+ // row of lifetime 1 does not.
+ t.Run("a record and a row with no lifetime", func(t *testing.T) {
+ wd := newIxWorld(t) // ixRecord and ixRoute carry no lifetime
+ wd.session()
+ wd.door.wantStatus(t, interactive.StateStarting)
+ wd.door.wantStatus(t, interactive.StateStarted)
+ if calls := wd.launch.calls(); len(calls) != 1 || calls[0].Incarnation != 0 || wd.launch.routes[0].Incarnation != 0 {
+ t.Fatalf("launch %+v on %+v, want lifetime 0", calls, wd.launch.routes)
+ }
+ wd.launch.handle.finish(instancectl.CmdStatus{State: instancectl.CmdDone, Code: "exited", Status: "0"})
+ wd.launch.handle.term.(*ixTerm).outW.Close()
+ wd.door.wantEnd(t)
+ wd.wait()
+ })
+ t.Run("a record with no lifetime on a row of lifetime 1", func(t *testing.T) {
+ wd := newIxWorld(t)
+ rt := ixRoute(ixHost)
+ rt.Incarnation = 1
+ wd.w.routes = ixRoutes(rt)
+ wd.session()
+ wd.door.wantStatus(t, interactive.StateStarting)
+ if e := wd.door.wantEnd(t); e.Reason != interactive.EndInterrupted || e.Detail != runs.InterruptedStartFailed {
+ t.Fatalf("end %+v, want a start failure", e)
+ }
+ wd.wait()
+ if n := len(wd.launch.calls()); n != 0 {
+ t.Fatalf("%d launches against another lifetime", n)
+ }
+ })
}
// The End, the start-failure verdict and Release wait for the activator's
@@ -1865,6 +1909,105 @@ func TestInteractiveWorkerEndWaitsForTheSettlement(t *testing.T) {
}
}
+// A launch that fails after its start reached the control service may have
+// left a unit running: nothing is ended, logged or classified before the
+// activator's proof that the unit is gone, however late (fix round 2, P2).
+// Only the worker's shutdown gives up on the proof.
+func TestInteractiveWorkerLaunchErrorWaitsForTheSettlement(t *testing.T) {
+ launchFails := func(t *testing.T) (*ixWorld, provision.Record, chan struct{}) {
+ t.Helper()
+ wd := newIxWorld(t)
+ later := make(chan struct{})
+ wd.launch.err = errors.New("control: start: context deadline exceeded")
+ wd.launch.settleLater = later
+ rec, _ := wd.session()
+ wd.door.wantStatus(t, interactive.StateStarting)
+ waitFor(t, "the launch", func() bool { return len(wd.launch.calls()) == 1 })
+ return wd, rec, later
+ }
+ t.Run("the proof comes later", func(t *testing.T) {
+ logs := ixCaptureLog(t)
+ wd, rec, later := launchFails(t)
+ time.Sleep(200 * time.Millisecond)
+ for drained := false; !drained; {
+ select {
+ case f := <-wd.door.frames:
+ if f.kind != interactive.KindAlive {
+ t.Fatalf("frame %q %s before the proof", f.kind, f.payload)
+ }
+ default:
+ drained = true
+ }
+ }
+ wd.w.mu.Lock()
+ active := len(wd.w.active)
+ wd.w.mu.Unlock()
+ if got := wd.eventMsgs(); len(got) != 0 || active != 1 || strings.Contains(logs(), "start: control") {
+ t.Fatalf("before the proof: events %q, %d active, log %q", got, active, logs())
+ }
+ close(later)
+ if e := wd.door.wantEnd(t); e.Reason != interactive.EndInterrupted || e.Detail != runs.InterruptedStartFailed {
+ t.Fatalf("end %+v, want a start failure", e)
+ }
+ wd.wait()
+ if got := wd.eventMsgs(); len(got) != 1 || got[0] != "interactive session "+rec.Interactive.ID+" did not start: "+runs.InterruptedStartFailed {
+ t.Fatalf("events %q", got)
+ }
+ })
+ t.Run("the console hangs up during the start", func(t *testing.T) {
+ wd := newIxWorld(t)
+ later := make(chan struct{})
+ wd.launch.block = true
+ wd.launch.settleLater = later
+ wd.door.script = func(ws *websocket.Conn) {
+ go func() {
+ waitFor(t, "the launch", func() bool { return len(wd.launch.calls()) == 1 })
+ raw, _ := json.Marshal(interactive.End{Reason: interactive.EndHangup, Ended: time.Now().UTC()})
+ _ = interactive.Send(ws, interactive.KindEnd, raw)
+ }()
+ wd.door.collect(ws)
+ }
+ wd.session()
+ wd.door.wantStatus(t, interactive.StateStarting)
+ waitFor(t, "the launch", func() bool { return len(wd.launch.calls()) == 1 })
+ time.Sleep(200 * time.Millisecond)
+ for drained := false; !drained; {
+ select {
+ case f := <-wd.door.frames:
+ if f.kind != interactive.KindAlive {
+ t.Fatalf("frame %q %s before the proof", f.kind, f.payload)
+ }
+ default:
+ drained = true
+ }
+ }
+ if got := wd.eventMsgs(); len(got) != 0 {
+ t.Fatalf("before the proof: events %q", got)
+ }
+ close(later)
+ if e := wd.door.wantEnd(t); e.Reason != interactive.EndHangup {
+ t.Fatalf("end %+v, want hangup", e)
+ }
+ wd.wait()
+ })
+ t.Run("the worker shuts down first", func(t *testing.T) {
+ wd, _, later := launchFails(t)
+ defer close(later)
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
+ defer cancel()
+ wd.w.shutdown(ctx)
+ if e := wd.door.wantEnd(t); e.Reason != interactive.EndInterrupted || e.Detail != activator.StopShutdown {
+ t.Fatalf("end %+v, want interrupted by the shutdown", e)
+ }
+ wd.w.mu.Lock()
+ active := len(wd.w.active)
+ wd.w.mu.Unlock()
+ if active != 0 {
+ t.Fatalf("%d sessions still active after the shutdown", active)
+ }
+ })
+}
+
// The worker's shutdown ends and joins every session, whatever its stage,
// and starts none after it (fix round 1, P2).
func TestInteractiveWorkerShutdownJoinsEverySession(t *testing.T) {
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index a0312b29e..1dd1c2464 100644
--- a/internal/provision/testdata/plan14-root-reads-chain.tsv
+++ b/internal/provision/testdata/plan14-root-reads-chain.tsv
@@ -43,4 +43,4 @@ plan14-root-reads-region-ha-dead-holder-backoff.tsv 8f6a1865b0abcea9d4fb68232cc2
plan14-root-reads-managed-fleets-1c-451.tsv af326671321edda76c7e6217a47892605a9e3b886fa880ad6d049c2f28f63873
plan14-root-reads-fleet-public-routes.tsv bca6ef741a96b72767b1747789cd01b3111d61b68548cbe368258c31f3d53a2e
plan14-root-reads-fleet-routes-followups.tsv 1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7
-plan14-root-reads-rootfs-apps-6.tsv 87f29ffd175e44b45b2de6a8f9623b9384dd36be3ef8a057bbcfd723c9118b5e
+plan14-root-reads-rootfs-apps-6.tsv 2fdc6168d50c8230f8973511c3b44d2056b4a3b027a86ac4326978241193207c
diff --git a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
index 6b72ce79c..211600ab3 100644
--- a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
+++ b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
@@ -6,7 +6,7 @@
@legacy 1f6bcc9cf0f66285a303c9d14a8ac511b721f7941c0fe45c18eeaf5ec7c42662 internal/activator/activator.go Service.installProcLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: the one place a process, its generation and the lease replica are installed on an entry; a resident is put under its lease watch (watchResidentLeaseLocked) at that moment; reads only the entry's route;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a (Call A1, Astra R1 P1-1): the lease watch is installed for every rootfs row (e.route.Rootfs()), not only a resident, so a hibernating rootfs row's run or session is reached at the lease's loss; the same one read of the entry's route; installs nothing else whole:Route@144 cacc399eb6e09be70d3a2ad1774800fb6a252590cebd62dd0e9f369e97275f81
@legacy 2401ee86a2ee7e9138b032f65973c8049d9452d18d2e0c04d21edeea4dcca3d6 internal/activator/activator.go Service.sweepOnce legacy accepted-legacy accepted-legacy;rev3=PROPOSED-seed;basis=census-ruling-FS-R6; registry remains legacy; PROPOSED-plans-2-box-limits: the sweep also narrows an entry's idle window to its account's plan idle through the SetIdleFor hook (never lengthens it; always-on workers and held probe entries are untouched; the hibernate, inflight and held-for-tick guards are unchanged).;rev3=census-ruling-plans-4c-box-throttle;basis=after the worker max_run branch, stops a non-worker entry past the plans continuous-awake ceiling (maxRunFor, passed the row), busy or not, never mid-command (plans 4c). One more whole-row read: the row handed to the hook, as idleFor already is. This bypasses the inflight and held-for-tick protections the idle stop keeps, on purpose: escalated by Astra and ACCEPTED by Paul (census owner), 2026-10-25.;rev3=census-ruling-plans-4d-lapse;basis=stops a live entry the turned-off hook names (never mid-command, never a move's active probe), stands down an exited worker it names instead of restarting it (Astra finding 4), and skips such rows in the due loop and the always-on arm so they are not woken (plans 4d). Four more whole-row reads: the row handed to the hook (a.disabled), as idleFor and maxRunFor already are. Only stops or skips.;rev3=census-ruling-remote-instance-metrics;basis=its two entries-map insertions go through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more call at the top, a.retryOwedMarkers() (harelease.go), which starts at most one background lease.RetryPending pass over owed region HA release markers, off a.mu; the due query, idle, max-run and lapse logic are unchanged; the same 38 sites, no read added; merge of origin/main d7ae1d76: main's change is kept as main has it (census-ruling-remote-instance-metrics: its two entries-map insertions go through putEntryLocked); this branch's change is the same as above; read sites the same 38, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a resident (Route.Resident) is never stopped for idleness or by the continuous-awake ceiling; the due-wake check is left on Hibernate (comment); stops less, not more;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: an entry whose host has a release record open (the in-memory a.releaseOps[e.host]) is not stopped by its plan's turn-off, by idleness or by the continuous-awake ceiling until the record goes; one more sweep pass, reapReleaseOpsLocked, retries an unproven release's stop (through finishPendingStops); the same 39 read sites, no read added; stops less, not more;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged registry:Hibernate@10801,registry:Hibernate@14559,registry:Hibernate@23817,registry:Hibernate@5676,registry:Hibernate@7875,registry:Host@23886,registry:Host@23944,registry:Host@24411,registry:Host@24504,registry:Host@25239,registry:Host@25328,registry:Host@26392,registry:Host@26679,registry:Host@26735,registry:NextDue@25194,registry:Status@23833,whole:Route@10803,whole:Route@11662,whole:Route@14561,whole:Route@16494,whole:Route@18204,whole:Route@18394,whole:Route@18687,whole:Route@18859,whole:Route@19006,whole:Route@23217,whole:Route@23993,whole:Route@24908,whole:Route@25248,whole:Route@25255,whole:Route@26207,whole:Route@26508,whole:Route@26712,whole:Route@5487,whole:Route@5678,whole:Route@7708,whole:Route@7877,whole:Route@8070,whole:Route@8533 ddf9a21dc0ae724138b1b0963155d8f555f2ce6982f7e61b9dc05f2bdd80bbe6
@legacy 2a089187c24f754778cd73dad684598279a5a54535915e261158751a750ebe9d internal/activator/backend_rootfs.go ExecBackend.StartRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1: new; startRootfsCmd naming release.ProcessRelease, both streams through one capped line writer (releaseOutput, runs.MaxOutputBytes) into the caller's writer; no read of its own;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: passes rootfsCmdLaunch{Process: release.ProcessRelease} to startRootfsCmd in place of the bare process name; its /cmd request and launch.cmd.json are byte-identical to before (TestStartReleaseIsUnchanged, goldens written from 3fd3c3a4); no read added; Plan 6 Task 8: passes instancectl.RoleCmd and oneShotSinks{Stdout, Stderr} (the same two release writers) to startRootfsCmd, which now takes the role; its /cmd request and launch.cmd.json stay byte-identical (TestStartReleaseIsUnchanged); no read added registry:Host@182,whole:Route@247 980b99f9faa5e8c182f89a821118175a750de42ebbe1947884e29e4901611d95
-@legacy d20e3fff7ffc3885ab6f68a92e9b535620955717e2f5c77ce1ede028deb2ccaa internal/activator/cmdunit.go type CmdSpec legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): declaration only; Prepare is a callback field, not a prepared statement;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing file:Prepare@1822 5fef13425a1ab96487b3de980e66761e920f6e0342470f1f18920e3f944143a3
+@legacy 2548078a5753d454c5ac26ec2fca049b7227e54c2f8a159f7a6261fa0a69de12 internal/activator/cmdunit.go type CmdSpec legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): declaration only; Prepare is a callback field, not a prepared statement;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing; Task 12 fix round 2: comment only: the Incarnation field's comment now says 0 (a record and row with no lifetime fields) is a value like any other, matching sessionIncarnationLocked's revised rule file:Prepare@1877 7a0a0f1d1331559efc47babb27b278e54ec99c48d274ab1744be55247efef5e1
@legacy 81be2be248ab3838d49b6a9502dfcbc905bc97da48487aba00fe094d53077c83 internal/activator/prepare.go ExecBackend.prepareKeyedAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling zddr4, with no further change from this branch beyond carrying main's new early return into the six-value signature. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): body of the frozen prepareAt, which is now its wrapper; it also returns the instance key's layer and reads no env for the cmd role; same reads, same nested launch paths;rev3=census-ruling-wake-latency-2;basis=takes an optional timer and marks its steps with time.Now() (dirs, admin token, instance key, env, control socket, key gate, logs); no read added or moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, run and seed roles only, under a 30 s context (haSecretsBudget): the token producer is ensureAdminTokenFor(hctx, rt, p) (on this nested path the same beneath producer, EnsureAdminTokenBeneath's, plus the HA mint decision inside it); ensureInstanceKeyFor now gets hctx instead of context.Background(), so the key's bucket read is bounded by 30 s as well as configReadTimeout; the env is launchEnvLayer(hctx, rt) (instanceEnvLayer for a non-HA host; for an HA host one capture, published and acknowledged); a test seam (haLaunchHooks.afterGate, nil in production) is called before the producers. The separate haMintGate and haSecretsReady calls are gone (final fix F2). Sites against main: -registry:Host (the rt.Host+".env" argument EnsureAdminTokenBeneath took) and +whole:Route (rt to launchEnvLayer); the cmd role and a non-HA host are unchanged;rev3=census-ruling-rootfs-fleet-followups;basis=names the process for the role log listener: release.ProcessWeb when rt.Rootfs() and the role is run, else none, passed to logEmitter; reads rt.Runtime through Rootfs(); no file, path or env read added or moved;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8: the cmd role three exceptions (no env read, the replica gate left to StartCmd, no app-log listener) now cover every one-shot role, instancectl.OneShot(role): cmd and tty; before, the tty role fell to the sidecar env-file read and an app-log listener on its handoff socket path; no read added, one removed for tty file:ReadDir@2965,registry:Host@1783,registry:Host@1995,registry:Host@5886,registry:Host@6084,registry:Host@612,whole:Route@1674,whole:Route@1885,whole:Route@2116,whole:Route@320,whole:Route@4678,whole:Route@5227,whole:Route@5920 0fce84024e1c33a8f8db76231106e7b962627f294dd6429038b479d25274a5b2
@legacy 2d9c727dee13d2655dcd898f0f5aecaa20902fa217ea6cf20a3ecce21e657388 internal/activator/rootfs_service.go Service.residentLeaseLost legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8 (C7): a resident's lost lease marks it and then kills its generations off a.mu (killResidentGens);rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.10: a resident's lost lease stops its workers (stopRootfsWorkersAtLoss, proven gone) in parallel with killResidentGens; rt is taken under the lock and passed to killResidentGens in place of e.route (the same route); site +whole:Route (that local rt); no file read;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a (Call A1): residentLeaseLostLocked also returns one kill func per one-shot unit that may run; each runs off a.mu in the same WaitGroup as stopRootfsWorkersAtLoss and killResidentGens, which still run only for a resident (gens non-nil); the kills go to root's existing /stop through KillOneShot; no read added whole:Route@137,whole:Route@394 64ce2f74e65941ea2a731518c773cb9b27456f2db298c69ed4e02de375b1777f
@legacy a55981c78ecf7e6cc533e2ca1f8732773fc68d8382a17bc34d7c7fc81297aadb internal/activator/rootfsrelease.go Service.releaseAdmitLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1 [pf R1.10]: new; the owner's half of a release's admission under a.mu: refuses while a run holds the cmd unit, and for an awake owner mirrors Swap's exclusions (worker or non-instance kind, a layout other than flat or nested through the existing swapLayout, members, a raised parent, a resize, a cmd start in flight); in-memory only; refusals only;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-17): the busy check is holdBusyLocked(e, RoleCmd) where it was cmdBusyLocked(e): only established cmd-unit holds and cmd-unit lease stops refuse a release command, never a started session, whose tty unit is its own; cmdStartInFlightLocked now also counts a session's start in flight (merge ruling M2), so a release is refused during either role's start window, short and bounded, as swap admission is (fix round 2 ruling: a refusal at admission is not executed and takes the ordinary retry); no read added, read sites unchanged registry:Kind@309,whole:Route@311,whole:Route@390 d1f6ba85b88b217e9d82caa7f033f20f61429bc319f48099e60e3aea37234916
@@ -31,7 +31,7 @@
@legacy d6543d9dad5ac1da40d0cbaaa7cfefb37f8c0b473c902957dc27420a61371899 internal/activator/cmd.go Service.killOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: the backend's KillOneShot (oneShotKiller) for one run, bounded by DeadlineControl plus roleEmptyBound, logged either way; the registry:Host sites are log lines registry:Host@240,registry:Host@549,registry:Host@680,whole:Route@398 3eb9bb7269c2a5fc8d4c798d884d92f7fa32eddbde588a3c9ad2d741211b869b
@legacy acd4a733f1d39bf9444302ee997852e46f6cdd946f2d68b1baa7c9b02400ea6b internal/activator/cmd.go Service.stopOneShotAtLease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: one run hold's lease stop, off a.mu: with kill, killOneShot at once and again once a start that was in flight returns a unit; then the hold's own stop (StopLeaseLost) bounded by cmdStopBound; the registry:Host sites are log lines registry:Host@714,registry:Host@961,whole:Route@309,whole:Route@529 46c39957f77353866dc7d8adbababfde54bd8634f5669fd61c3011a54f5e7c9a
@legacy df3f3b61ff8b8728750f677f5f67b0b499f761681593619c55713a7603ae1d82 internal/activator/cmd.go Service.stopOneShotsAtLeaseLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: one stopOneShotAtLease func per run hold that may be running (cmdHoldsLocked), none for a binary row (rt.Rootfs()); in memory only; fix round 1 (Astra P1): each func is counted on the entry it was captured for (e.leaseStops, under a.mu) from capture until it returns, so its kill, which names the unit by host and role only, never reaches another command: while counted the entry is not released (finishStop keeps the stop pending, the lease held) and takes no new run or release command (cmdBusyLocked); no read added Task 9 (PF-3): covers every run and session hold that may be running (holdsLocked: e.cmd, e.tty and the released holds of either role); each func is counted under its hold's role (addLeaseStop(h.role)) and stops and kills that role's unit only (stopOneShotAtLease(rt, h, h.role, kill)), so a session's lease kill names the tty unit and a run's the cmd unit, never the other's; while a role's count is up no new command of that role starts (holdBusyLocked); no read added whole:Route@358 3be2f4759579fea82f4afe35babbd400ab33a18a87340706f2b3f525a067d21d
-@legacy 6188930a4fe995d9f5c3f8756e5488df29a414c55c94353e478fec72104ca1bb internal/activator/cmd.go sessionIncarnationLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12 fix round 1, new: RunCmd's session lifetime check, in memory under a.mu: a session (spec.TTY) whose spec.Incarnation is 0 or differs from the entry's row lifetime (e.route.Incarnation) is refused; a run never is; reads only those two fields, nothing from disk or a path registry:Incarnation@117,whole:Route@119 6694885322e347b0ece1510427ef6e22c040dc08243380763d223d9e1cdca53d
+@legacy 12e7a29471bb3383c83c4e02be7cf84beccb434be202f2cd53bc44ade13bbd25 internal/activator/cmd.go sessionIncarnationLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12 fix round 1, new: RunCmd's session lifetime check, in memory under a.mu: a session (spec.TTY) whose spec.Incarnation differs from the entry's row lifetime (e.route.Incarnation) is refused; a run never is; reads only those two fields, nothing from disk or a path; fix round 2 (revised ruling: lifetime 0 is a value, not unknown): only a mismatch refuses, so 0 matches 0 (a record and row with no lifetime fields, as RouteFor keeps (0, 0)) and 0 against 1 is refused either way round; the positive-lifetime successor checks at admission and before the start are unchanged; refuses less than before only for 0 == 0, reads nothing new registry:Incarnation@91,whole:Route@93 1af7b9c7f5f9d095f57a281cc405aea1635639990d385de2562329310b201760
@legacy abb459549436cbe93fde533f5b1ab964758f1f94b1ea165bf95201e6df775026 internal/activator/cmdunit.go ExecBackend.ttyVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: a session environment: cmdVars over the generation launch environment without CARLOS_RUN_ID and CARLOS_RUN_DIR, with TERM and CARLOS_SESSION_ID set over the file; map composition only, the route host through cmdVars whole:Route@156 127be6d996c0492af254a0a6b6fa9f292c8b5e8b0656ac02319aa61f77186a00
@legacy 6ac5faaf8631164738d53b1d4af6ebd609543f8d454457edb4eb5d3b33564858 internal/activator/pty_linux.go openPTY legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: the agent (user carlos, never root) opens the fixed path /dev/ptmx O_RDWR|O_NOCTTY|O_CLOEXEC, unlocks it (TIOCSPTLCK), takes the slave from the master with TIOCGPTPEER (never opening /dev/pts/N by path, so no path a tenant can name is opened), sets TIOCEXCL on the slave and the window size on the master; the slave goes only to a SO_PEERCRED uid 0 peer of the agent owner-only handoff socket (ttyPeerOK), the tty unit stdin file:Open@143,file:Syscall@517 42d48a34ebb89715fd152471c827408c0439009525d37c5dd7c68a9ca035a1d6
@legacy 0842489ea1caf0137eec6eb816259e02fb7638e90aaac2453713a4180629cbcf internal/activator/pty_linux.go ptyTerminal.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: reads the session pty master the agent itself opened (openPTY), as the agent (user carlos); the bytes go to the session caller only file:Read@22,file:Read@60 55a2d9ae0563470e24cd622805eb71c6463b6b001d69ae495500d789b68ea23d
@@ -42,7 +42,7 @@
@legacy c6851e192e7ecbbcaf506a5a5a7aff21b89bc3d340affe2eaacf62e54a7f315d internal/host/interactive.go interactiveWorker.owned legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: runsWorker.owned's rule for the session worker: the agent's registry row for the record's host, provisioned for the record's account and app and activator-managed; in-memory reads of the row, agent only, nothing reaches root registry:Account@162,registry:App@191,registry:Provisioned@144,whole:Route@130,whole:Route@241,whole:Route@292 6efa21c1510d9f42538d47c49c2111895d3d5cc0226da21161786103a21aa79e
@legacy 3b3f7e7259fee7faca8397e93a379f29cc03f7040b919fd5b5e755d606d75cb6 internal/host/interactive.go sessionRun.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: relays a started session between the console's box door and the session's pty master the agent itself holds (CmdHandle.Terminal, the activator's ptyTerminal): file:Read is a read of that master, at most 32 KiB per frame; writes keystrokes and resizes to it; fix round 1 (Astra P2): a hangup closes the master alone (the handoff listener stays for the unit's ExecStopPost until the activator's settle), each Stop gets its own budget from the moment it is asked, and the End, the start-failure verdict and Release wait for the activator's proof (a nil Stop or AfterSettled), asking the stop again each bound, giving up only at the agent's shutdown; agent only, nothing reaches root file:Read@391 61b9e4165f4c005f84c241dc1323c43b033d9d7934e9a24f6b431447dd2e9d7b
@legacy 53addbe851402e8591dff617a24917802ad766b8af69d909a886a1022c10ec4e internal/host/interactive.go sessionRun.receiveOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: reads the console's first frame on the box door's WebSocket within OpenWait and decodes interactive.Open, normalized and checked (Open.Check); fix round 1: a replacement or the agent's shutdown ends the wait at once (the read deadline set to the past); the file:Open sites are the type name interactive.Open and its methods, not a file open; agent only, nothing reaches root file:Open@353,file:Open@36,file:Open@424,file:Open@502,file:Open@581,file:Open@672 eb126ee8e50fecef51b41830852c6702ab237e69075c82f25759001a3b222721
-@legacy e1c96b8b8ab126da5c0a054d9c85abfc0b8cb9d589f0da576689c0b1155598fa internal/host/interactive.go sessionRun.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: refuses over the connection (incarnation from the grant against the record, the app's setting from config.json of the default bundle via appconfig.GetInteractive under the session's context with the lifetime judge, an uncommitted import), then RunCmd with spec.TTY {Term, Cols, Rows}, Process and Args exactly as the checked Open names them; fix round 1 (Astra P1): the row is read again from the agent's registry and must still be the record's lifetime (+registry:Incarnation), and spec.Incarnation names that lifetime so the activator refuses an entry of any other; root's tty start validates the process or argv itself (Tasks 6 to 8, unchanged); the file:Open site is the interactive.Open parameter type; adds no root input file:Open@32,registry:Incarnation@1553,whole:Route@2194 1823a1cfa00784827e17a95ce36a8991a1d0702c20db6f17d155031266f1b551
+@legacy 3896a2b18aa1f13c32130b7bf2064292ed671fab3ecd3fa45eee6d3cfe549de7 internal/host/interactive.go sessionRun.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: refuses over the connection (incarnation from the grant against the record, the app's setting from config.json of the default bundle via appconfig.GetInteractive under the session's context with the lifetime judge, an uncommitted import), then RunCmd with spec.TTY {Term, Cols, Rows}, Process and Args exactly as the checked Open names them; fix round 1 (Astra P1): the row is read again from the agent's registry and must still be the record's lifetime (+registry:Incarnation), and spec.Incarnation names that lifetime so the activator refuses an entry of any other; root's tty start validates the process or argv itself (Tasks 6 to 8, unchanged); the file:Open site is the interactive.Open parameter type; adds no root input; fix round 2 (Astra re-review P2): when RunCmd returns an error, serve waits for the activator's settle proof (AfterSettled, s.settled, via sessionRun.awaitSettled) before it ends the session, logs or classifies the start failure, since RunCmd can fail after a unit may have started; only the worker's shutdown gives up on the proof (End interrupted, the box's agent stopped); with no record lifetime the launch names 0 and the row must also be 0; no read added, read sites unchanged file:Open@32,registry:Incarnation@1553,whole:Route@2194 a25a9eaa74c69bcdf07782dada0d51bf4f15b78723b38d9d8cf046d20a7254af
@legacy 14cec7be2873b15f373f40e319f5c6c61d441f521121499f2a04b331bd3453f3 internal/host/units/carlos-instance-rootfs-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the rootfs tty template, carlos-instance-rootfs-cmd@.service outside named lines held by TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit --rootfs tty %I, StandardInput=file:/run/carlos/logs/%I.tty.sock with StandardOutput/StandardError=journal, and RootImage plus the two BindReadOnlyPaths sources under /run/carlos-control/exe/%I/rootfs/tty/ (root-only exe layout) instead of rootfs/cmd/. The rootfs namespace block byte for byte (TestRootfsTemplatesShareOneNamespace), runs as carlos, binds only the instance own and root paths (TestRootfsTemplatesBindOnlyTheInstancesOwnAndRoots). Task 6: POST /tty runtime=rootfs (startRootfsCmd with RoleTTY) starts it through Plan 2's rootfs one-shot path (preflight, validateStagedImage, ensureRootfsExe under rootfs/tty/, jit drop-in and owed reload, post-start MemoryDenyWriteExecute check); its files go only through removeRootfsUnitFiles (stopRootfs and cleanCmdExe with RoleTTY, the sweep) file:external@0 d57f6d6fbe553e5ba5a5762ab2bd72586835ce1db748b67044edd1bf90af6953
@legacy b18625dfcfcaa6d4e0ae128e2b77ad7fb53d0a4206458b43ef4125d248e6ef58 internal/host/units/carlos-instance-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the binary tty template, carlos-instance-cmd@.service outside six named lines held by TestTTYTemplateEqualsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit tty %I (the same root binary as every template), StandardInput=file:/run/carlos/logs/%I.tty.sock replacing the cmd StandardOutput socket (PID 1 opens it as root on the nosymfollow logs mount, as the cmd streams), StandardOutput=journal, StandardError=journal, and BindReadOnlyPaths sources tty-app/tty-live under /run/carlos-control/exe/%I (root-only exe layout, as cmd-app/cmd-live). Same namespace block byte for byte, runs as carlos. Task 6: POST /tty (handleOneShot(RoleTTY), claimAwareLegacy) starts it, after the role lock, the loaded-state refusal and refuseStagedExe; the tty-app/tty-live sources are laid out by ensureCmdExeAt(RoleTTY) and removed by removeCmdExe(RoleTTY) at /stop role=tty and /sweep file:external@0 060295d0956afad52db77dba1988c508cf4289f9b5a18242a206a315145b8e0d
@legacy 9491fe16a762f2bfb2e6b288428f67b157b813d01c226917ec4c3366ebffb305 internal/instancectl/cmd.go Server.oneShotStatus legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: handleCmdStatus's body moved whole and made role-aware (it serves GET /cmd/{host} and GET /tty/{host} through handleOneShotStatus(role), both claimAwareLegacy): the same three file:Query sites (the URL query read for the invocation, for parseQuery and for the role check); the role check now refuses any role field but the route's own (role=tty on /cmd and role=cmd on /tty are 400, before any show); the unit shown is UnitName(role, host) or RootfsUnitName(role, host) for runtime=rootfs, a name root builds from a validated host and a route constant; read-only systemctl show, starts and stops nothing; no file read added file:Query@1090,file:Query@384,file:Query@759 9ea847d9a1e6b0e0929f27b27a9ade5c783c0de1ba0d997523c939be8293e701
@@ -64,7 +64,7 @@ internal/activator/activator.go Service.installProcLocked legacy accepted-legacy
internal/activator/activator.go Service.sweepOnce legacy accepted-legacy accepted-legacy;rev3=PROPOSED-seed;basis=census-ruling-FS-R6; registry remains legacy; PROPOSED-plans-2-box-limits: the sweep also narrows an entry's idle window to its account's plan idle through the SetIdleFor hook (never lengthens it; always-on workers and held probe entries are untouched; the hibernate, inflight and held-for-tick guards are unchanged).;rev3=census-ruling-plans-4c-box-throttle;basis=after the worker max_run branch, stops a non-worker entry past the plans continuous-awake ceiling (maxRunFor, passed the row), busy or not, never mid-command (plans 4c). One more whole-row read: the row handed to the hook, as idleFor already is. This bypasses the inflight and held-for-tick protections the idle stop keeps, on purpose: escalated by Astra and ACCEPTED by Paul (census owner), 2026-10-25.;rev3=census-ruling-plans-4d-lapse;basis=stops a live entry the turned-off hook names (never mid-command, never a move's active probe), stands down an exited worker it names instead of restarting it (Astra finding 4), and skips such rows in the due loop and the always-on arm so they are not woken (plans 4d). Four more whole-row reads: the row handed to the hook (a.disabled), as idleFor and maxRunFor already are. Only stops or skips.;rev3=census-ruling-remote-instance-metrics;basis=its two entries-map insertions go through putEntryLocked (which also notes the route's tenant in memory for the metrics sampler); no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more call at the top, a.retryOwedMarkers() (harelease.go), which starts at most one background lease.RetryPending pass over owed region HA release markers, off a.mu; the due query, idle, max-run and lapse logic are unchanged; the same 38 sites, no read added; merge of origin/main d7ae1d76: main's change is kept as main has it (census-ruling-remote-instance-metrics: its two entries-map insertions go through putEntryLocked); this branch's change is the same as above; read sites the same 38, offsets moved;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a resident (Route.Resident) is never stopped for idleness or by the continuous-awake ceiling; the due-wake check is left on Hibernate (comment); stops less, not more;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: an entry whose host has a release record open (the in-memory a.releaseOps[e.host]) is not stopped by its plan's turn-off, by idleness or by the continuous-awake ceiling until the record goes; one more sweep pass, reapReleaseOpsLocked, retries an unproven release's stop (through finishPendingStops); the same 39 read sites, no read added; stops less, not more;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-18): the four checks that left an entry with a run attached alone (e.cmd == nil) now read holdsAttachedLocked(e), a run or a session attached, so a session holds the idle sleep, the plans awake ceiling, the plans turned-off stop and the turned-off worker's stand-down as a run does; in-memory under a.mu; only keeps an entry awake longer; no read added, read sites unchanged registry:Hibernate@10801,registry:Hibernate@14559,registry:Hibernate@23817,registry:Hibernate@5676,registry:Hibernate@7875,registry:Host@23886,registry:Host@23944,registry:Host@24411,registry:Host@24504,registry:Host@25239,registry:Host@25328,registry:Host@26392,registry:Host@26679,registry:Host@26735,registry:NextDue@25194,registry:Status@23833,whole:Route@10803,whole:Route@11662,whole:Route@14561,whole:Route@16494,whole:Route@18204,whole:Route@18394,whole:Route@18687,whole:Route@18859,whole:Route@19006,whole:Route@23217,whole:Route@23993,whole:Route@24908,whole:Route@25248,whole:Route@25255,whole:Route@26207,whole:Route@26508,whole:Route@26712,whole:Route@5487,whole:Route@5678,whole:Route@7708,whole:Route@7877,whole:Route@8070,whole:Route@8533 ddf9a21dc0ae724138b1b0963155d8f555f2ce6982f7e61b9dc05f2bdd80bbe6
internal/activator/activator.go type Service authority B,C,D,F,J4 rev3=PROPOSED-seed; existing activator lifecycle and due-wake state plus owned seed exclusion and incarnation-keyed diagnostics; normal refusal and preparation ordering remain authoritative; PROPOSED-plans-2-box-limits adds the idleFor hook field, which only narrows idle windows;rev3=census-ruling-plans-4c-box-throttle;basis=gains the maxRunFor hook field beside idleFor (plans 4c). No read added.;rev3=census-ruling-plans-4d-lapse;basis=gains the disabledFor hook field beside maxRunFor (plans 4d). No read added.;rev3=census-ruling-remote-instance-metrics;basis=gains tenancySeq, hostTenants and hostMixed, in-memory fields for Tenancies; no read added;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: one more field, markers (markerRetry: an atomic running flag and the last log time) for retryOwedMarkers; no read added; merge of origin/main d7ae1d76: main's fields are kept as main has them (census-ruling-remote-instance-metrics: tenancySeq, hostTenants, hostMixed); this branch's change is the same as above;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: new fields for rootfs admission (rootfsArmed, rootfsSwept), the per-host gate ask and refusal memo, and residency state (lister, backoff, start ceiling, cursor, test seam); no read;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: one new field, releaseOps (host to the in-memory release record, under a.mu); no read;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W: one new field, leaseNow (a clock seam for a worker start's headroom against the lease deadline, nil is the real clock); no read;rev3=census-ruling-region-ha-p1b2;basis=region HA P1b-2: gains the holder cache and its single-flight state; no read;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1: one field, drainBudget (time.Duration), which New copies from residentDrainBudget and a rootfs entry's lease watch reads in its place, so a test's change of the package var never races a watch goroutine; declaration only, reads nothing c8b46a426344dcd145128985398b1540c760a7001b86f7ce0e93d465d0d026f3
internal/activator/backend_rootfs.go ExecBackend.StartRelease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1: new; startRootfsCmd naming release.ProcessRelease, both streams through one capped line writer (releaseOutput, runs.MaxOutputBytes) into the caller's writer; no read of its own;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: passes rootfsCmdLaunch{Process: release.ProcessRelease} to startRootfsCmd in place of the bare process name; its /cmd request and launch.cmd.json are byte-identical to before (TestStartReleaseIsUnchanged, goldens written from 3fd3c3a4); no read added; Plan 6 Task 8: passes instancectl.RoleCmd and oneShotSinks{Stdout, Stderr} (the same two release writers) to startRootfsCmd, which now takes the role; its /cmd request and launch.cmd.json stay byte-identical (TestStartReleaseIsUnchanged); no read added registry:Host@182,whole:Route@247 980b99f9faa5e8c182f89a821118175a750de42ebbe1947884e29e4901611d95
-internal/activator/cmdunit.go type CmdSpec legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): declaration only; Prepare is a callback field, not a prepared statement;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing file:Prepare@1822 5fef13425a1ab96487b3de980e66761e920f6e0342470f1f18920e3f944143a3
+internal/activator/cmdunit.go type CmdSpec legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): declaration only; Prepare is a callback field, not a prepared statement;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: declaration only: gains AfterSettled, a callback field the caller sets (the box's run pass removes the run's directory in it), called once when no unit of the run can be running; reads nothing; fix round 2: comment only: AfterSettled is called once, after the proof, never while a lock is held, in the settle's goroutine without the stop waiting for it, and must not call Stop or Shutdown; Plan 6 Task 8: declaration only: gains Process (a declared process name, "" or console; StartCmd refuses it except for a session on a rootfs row) and TTY (*TTYSpec: Term, Cols, Rows; set, the command is a session in the tty unit), fields the box sets; reads nothing Task 12 fix round 1: declaration only: gains Incarnation (uint64), the session's authorized lifetime, which the box sets from the instance record and RunCmd compares with the entry's row; reads nothing; Task 12 fix round 2: comment only: the Incarnation field's comment now says 0 (a record and row with no lifetime fields) is a value like any other, matching sessionIncarnationLocked's revised rule file:Prepare@1877 7a0a0f1d1331559efc47babb27b278e54ec99c48d274ab1744be55247efef5e1
internal/activator/prepare.go ExecBackend.prepareKeyedAt legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=Re-digested at the pre-land merge: the body includes main's own change under census ruling zddr4, with no further change from this branch beyond carrying main's new early return into the six-value signature. the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): body of the frozen prepareAt, which is now its wrapper; it also returns the instance key's layer and reads no env for the cmd role; same reads, same nested launch paths;rev3=census-ruling-wake-latency-2;basis=takes an optional timer and marks its steps with time.Now() (dirs, admin token, instance key, env, control socket, key gate, logs); no read added or moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, run and seed roles only, under a 30 s context (haSecretsBudget): the token producer is ensureAdminTokenFor(hctx, rt, p) (on this nested path the same beneath producer, EnsureAdminTokenBeneath's, plus the HA mint decision inside it); ensureInstanceKeyFor now gets hctx instead of context.Background(), so the key's bucket read is bounded by 30 s as well as configReadTimeout; the env is launchEnvLayer(hctx, rt) (instanceEnvLayer for a non-HA host; for an HA host one capture, published and acknowledged); a test seam (haLaunchHooks.afterGate, nil in production) is called before the producers. The separate haMintGate and haSecretsReady calls are gone (final fix F2). Sites against main: -registry:Host (the rt.Host+".env" argument EnsureAdminTokenBeneath took) and +whole:Route (rt to launchEnvLayer); the cmd role and a non-HA host are unchanged;rev3=census-ruling-rootfs-fleet-followups;basis=names the process for the role log listener: release.ProcessWeb when rt.Rootfs() and the role is run, else none, passed to logEmitter; reads rt.Runtime through Rootfs(); no file, path or env read added or moved;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8: the cmd role three exceptions (no env read, the replica gate left to StartCmd, no app-log listener) now cover every one-shot role, instancectl.OneShot(role): cmd and tty; before, the tty role fell to the sidecar env-file read and an app-log listener on its handoff socket path; no read added, one removed for tty file:ReadDir@2965,registry:Host@1783,registry:Host@1995,registry:Host@5886,registry:Host@6084,registry:Host@612,whole:Route@1674,whole:Route@1885,whole:Route@2116,whole:Route@320,whole:Route@4678,whole:Route@5227,whole:Route@5920 0fce84024e1c33a8f8db76231106e7b962627f294dd6429038b479d25274a5b2
internal/activator/rootfs_service.go Service.residentLeaseLost legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8 (C7): a resident's lost lease marks it and then kills its generations off a.mu (killResidentGens);rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.10: a resident's lost lease stops its workers (stopRootfsWorkersAtLoss, proven gone) in parallel with killResidentGens; rt is taken under the lock and passed to killResidentGens in place of e.route (the same route); site +whole:Route (that local rt); no file read;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a (Call A1): residentLeaseLostLocked also returns one kill func per one-shot unit that may run; each runs off a.mu in the same WaitGroup as stopRootfsWorkersAtLoss and killResidentGens, which still run only for a resident (gens non-nil); the kills go to root's existing /stop through KillOneShot; no read added whole:Route@137,whole:Route@394 64ce2f74e65941ea2a731518c773cb9b27456f2db298c69ed4e02de375b1777f
internal/activator/rootfsrelease.go Service.releaseAdmitLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R, R1 [pf R1.10]: new; the owner's half of a release's admission under a.mu: refuses while a run holds the cmd unit, and for an awake owner mirrors Swap's exclusions (worker or non-instance kind, a layout other than flat or nested through the existing swapLayout, members, a raised parent, a resize, a cmd start in flight); in-memory only; refusals only;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (PF-17): the busy check is holdBusyLocked(e, RoleCmd) where it was cmdBusyLocked(e): only established cmd-unit holds and cmd-unit lease stops refuse a release command, never a started session, whose tty unit is its own; cmdStartInFlightLocked now also counts a session's start in flight (merge ruling M2), so a release is refused during either role's start window, short and bounded, as swap admission is (fix round 2 ruling: a refusal at admission is not executed and takes the ordinary retry); no read added, read sites unchanged registry:Kind@309,whole:Route@311,whole:Route@390 d1f6ba85b88b217e9d82caa7f033f20f61429bc319f48099e60e3aea37234916
@@ -90,7 +90,7 @@ internal/activator/backend_unit.go SplitBackend.KillOneShot legacy accepted-lega
internal/activator/cmd.go Service.killOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: the backend's KillOneShot (oneShotKiller) for one run, bounded by DeadlineControl plus roleEmptyBound, logged either way; the registry:Host sites are log lines registry:Host@240,registry:Host@549,registry:Host@680,whole:Route@398 3eb9bb7269c2a5fc8d4c798d884d92f7fa32eddbde588a3c9ad2d741211b869b
internal/activator/cmd.go Service.stopOneShotAtLease legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: one run hold's lease stop, off a.mu: with kill, killOneShot at once and again once a start that was in flight returns a unit; then the hold's own stop (StopLeaseLost) bounded by cmdStopBound; the registry:Host sites are log lines registry:Host@714,registry:Host@961,whole:Route@309,whole:Route@529 46c39957f77353866dc7d8adbababfde54bd8634f5669fd61c3011a54f5e7c9a
internal/activator/cmd.go Service.stopOneShotsAtLeaseLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: one stopOneShotAtLease func per run hold that may be running (cmdHoldsLocked), none for a binary row (rt.Rootfs()); in memory only; fix round 1 (Astra P1): each func is counted on the entry it was captured for (e.leaseStops, under a.mu) from capture until it returns, so its kill, which names the unit by host and role only, never reaches another command: while counted the entry is not released (finishStop keeps the stop pending, the lease held) and takes no new run or release command (cmdBusyLocked); no read added Task 9 (PF-3): covers every run and session hold that may be running (holdsLocked: e.cmd, e.tty and the released holds of either role); each func is counted under its hold's role (addLeaseStop(h.role)) and stops and kills that role's unit only (stopOneShotAtLease(rt, h, h.role, kill)), so a session's lease kill names the tty unit and a run's the cmd unit, never the other's; while a role's count is up no new command of that role starts (holdBusyLocked); no read added whole:Route@358 3be2f4759579fea82f4afe35babbd400ab33a18a87340706f2b3f525a067d21d
-internal/activator/cmd.go sessionIncarnationLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12 fix round 1, new: RunCmd's session lifetime check, in memory under a.mu: a session (spec.TTY) whose spec.Incarnation is 0 or differs from the entry's row lifetime (e.route.Incarnation) is refused; a run never is; reads only those two fields, nothing from disk or a path registry:Incarnation@117,whole:Route@119 6694885322e347b0ece1510427ef6e22c040dc08243380763d223d9e1cdca53d
+internal/activator/cmd.go sessionIncarnationLocked legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12 fix round 1, new: RunCmd's session lifetime check, in memory under a.mu: a session (spec.TTY) whose spec.Incarnation differs from the entry's row lifetime (e.route.Incarnation) is refused; a run never is; reads only those two fields, nothing from disk or a path; fix round 2 (revised ruling: lifetime 0 is a value, not unknown): only a mismatch refuses, so 0 matches 0 (a record and row with no lifetime fields, as RouteFor keeps (0, 0)) and 0 against 1 is refused either way round; the positive-lifetime successor checks at admission and before the start are unchanged; refuses less than before only for 0 == 0, reads nothing new registry:Incarnation@91,whole:Route@93 1af7b9c7f5f9d095f57a281cc405aea1635639990d385de2562329310b201760
internal/activator/cmdunit.go ExecBackend.ttyVars legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: a session environment: cmdVars over the generation launch environment without CARLOS_RUN_ID and CARLOS_RUN_DIR, with TERM and CARLOS_SESSION_ID set over the file; map composition only, the route host through cmdVars whole:Route@156 127be6d996c0492af254a0a6b6fa9f292c8b5e8b0656ac02319aa61f77186a00
internal/activator/pty_linux.go openPTY legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: the agent (user carlos, never root) opens the fixed path /dev/ptmx O_RDWR|O_NOCTTY|O_CLOEXEC, unlocks it (TIOCSPTLCK), takes the slave from the master with TIOCGPTPEER (never opening /dev/pts/N by path, so no path a tenant can name is opened), sets TIOCEXCL on the slave and the window size on the master; the slave goes only to a SO_PEERCRED uid 0 peer of the agent owner-only handoff socket (ttyPeerOK), the tty unit stdin file:Open@143,file:Syscall@517 42d48a34ebb89715fd152471c827408c0439009525d37c5dd7c68a9ca035a1d6
internal/activator/pty_linux.go ptyTerminal.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 8, new: reads the session pty master the agent itself opened (openPTY), as the agent (user carlos); the bytes go to the session caller only file:Read@22,file:Read@60 55a2d9ae0563470e24cd622805eb71c6463b6b001d69ae495500d789b68ea23d
@@ -101,7 +101,7 @@ internal/host/interactive.go interactiveWorker.consider legacy accepted-legacy a
internal/host/interactive.go interactiveWorker.owned legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: runsWorker.owned's rule for the session worker: the agent's registry row for the record's host, provisioned for the record's account and app and activator-managed; in-memory reads of the row, agent only, nothing reaches root registry:Account@162,registry:App@191,registry:Provisioned@144,whole:Route@130,whole:Route@241,whole:Route@292 6efa21c1510d9f42538d47c49c2111895d3d5cc0226da21161786103a21aa79e
internal/host/interactive.go sessionRun.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: relays a started session between the console's box door and the session's pty master the agent itself holds (CmdHandle.Terminal, the activator's ptyTerminal): file:Read is a read of that master, at most 32 KiB per frame; writes keystrokes and resizes to it; fix round 1 (Astra P2): a hangup closes the master alone (the handoff listener stays for the unit's ExecStopPost until the activator's settle), each Stop gets its own budget from the moment it is asked, and the End, the start-failure verdict and Release wait for the activator's proof (a nil Stop or AfterSettled), asking the stop again each bound, giving up only at the agent's shutdown; agent only, nothing reaches root file:Read@391 61b9e4165f4c005f84c241dc1323c43b033d9d7934e9a24f6b431447dd2e9d7b
internal/host/interactive.go sessionRun.receiveOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: reads the console's first frame on the box door's WebSocket within OpenWait and decodes interactive.Open, normalized and checked (Open.Check); fix round 1: a replacement or the agent's shutdown ends the wait at once (the read deadline set to the past); the file:Open sites are the type name interactive.Open and its methods, not a file open; agent only, nothing reaches root file:Open@353,file:Open@36,file:Open@424,file:Open@502,file:Open@581,file:Open@672 eb126ee8e50fecef51b41830852c6702ab237e69075c82f25759001a3b222721
-internal/host/interactive.go sessionRun.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: refuses over the connection (incarnation from the grant against the record, the app's setting from config.json of the default bundle via appconfig.GetInteractive under the session's context with the lifetime judge, an uncommitted import), then RunCmd with spec.TTY {Term, Cols, Rows}, Process and Args exactly as the checked Open names them; fix round 1 (Astra P1): the row is read again from the agent's registry and must still be the record's lifetime (+registry:Incarnation), and spec.Incarnation names that lifetime so the activator refuses an entry of any other; root's tty start validates the process or argv itself (Tasks 6 to 8, unchanged); the file:Open site is the interactive.Open parameter type; adds no root input file:Open@32,registry:Incarnation@1553,whole:Route@2194 1823a1cfa00784827e17a95ce36a8991a1d0702c20db6f17d155031266f1b551
+internal/host/interactive.go sessionRun.serve legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12, new: refuses over the connection (incarnation from the grant against the record, the app's setting from config.json of the default bundle via appconfig.GetInteractive under the session's context with the lifetime judge, an uncommitted import), then RunCmd with spec.TTY {Term, Cols, Rows}, Process and Args exactly as the checked Open names them; fix round 1 (Astra P1): the row is read again from the agent's registry and must still be the record's lifetime (+registry:Incarnation), and spec.Incarnation names that lifetime so the activator refuses an entry of any other; root's tty start validates the process or argv itself (Tasks 6 to 8, unchanged); the file:Open site is the interactive.Open parameter type; adds no root input; fix round 2 (Astra re-review P2): when RunCmd returns an error, serve waits for the activator's settle proof (AfterSettled, s.settled, via sessionRun.awaitSettled) before it ends the session, logs or classifies the start failure, since RunCmd can fail after a unit may have started; only the worker's shutdown gives up on the proof (End interrupted, the box's agent stopped); with no record lifetime the launch names 0 and the row must also be 0; no read added, read sites unchanged file:Open@32,registry:Incarnation@1553,whole:Route@2194 a25a9eaa74c69bcdf07782dada0d51bf4f15b78723b38d9d8cf046d20a7254af
internal/host/units/carlos-instance-rootfs-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the rootfs tty template, carlos-instance-rootfs-cmd@.service outside named lines held by TestRootfsTTYTemplateEqualsRootfsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit --rootfs tty %I, StandardInput=file:/run/carlos/logs/%I.tty.sock with StandardOutput/StandardError=journal, and RootImage plus the two BindReadOnlyPaths sources under /run/carlos-control/exe/%I/rootfs/tty/ (root-only exe layout) instead of rootfs/cmd/. The rootfs namespace block byte for byte (TestRootfsTemplatesShareOneNamespace), runs as carlos, binds only the instance own and root paths (TestRootfsTemplatesBindOnlyTheInstancesOwnAndRoots). Task 6: POST /tty runtime=rootfs (startRootfsCmd with RoleTTY) starts it through Plan 2's rootfs one-shot path (preflight, validateStagedImage, ensureRootfsExe under rootfs/tty/, jit drop-in and owed reload, post-start MemoryDenyWriteExecute check); its files go only through removeRootfsUnitFiles (stopRootfs and cleanCmdExe with RoleTTY, the sweep) file:external@0 d57f6d6fbe553e5ba5a5762ab2bd72586835ce1db748b67044edd1bf90af6953
internal/host/units/carlos-instance-tty@.service external legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 5, new: the binary tty template, carlos-instance-cmd@.service outside six named lines held by TestTTYTemplateEqualsCmdOutsideTheNamedLines: Description (tty), ExecStart/ExecStopPost instance-exec/instance-exit tty %I (the same root binary as every template), StandardInput=file:/run/carlos/logs/%I.tty.sock replacing the cmd StandardOutput socket (PID 1 opens it as root on the nosymfollow logs mount, as the cmd streams), StandardOutput=journal, StandardError=journal, and BindReadOnlyPaths sources tty-app/tty-live under /run/carlos-control/exe/%I (root-only exe layout, as cmd-app/cmd-live). Same namespace block byte for byte, runs as carlos. Task 6: POST /tty (handleOneShot(RoleTTY), claimAwareLegacy) starts it, after the role lock, the loaded-state refusal and refuseStagedExe; the tty-app/tty-live sources are laid out by ensureCmdExeAt(RoleTTY) and removed by removeCmdExe(RoleTTY) at /stop role=tty and /sweep file:external@0 060295d0956afad52db77dba1988c508cf4289f9b5a18242a206a315145b8e0d
internal/instancectl/cmd.go Server.oneShotStatus legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 6: handleCmdStatus's body moved whole and made role-aware (it serves GET /cmd/{host} and GET /tty/{host} through handleOneShotStatus(role), both claimAwareLegacy): the same three file:Query sites (the URL query read for the invocation, for parseQuery and for the role check); the role check now refuses any role field but the route's own (role=tty on /cmd and role=cmd on /tty are 400, before any show); the unit shown is UnitName(role, host) or RootfsUnitName(role, host) for runtime=rootfs, a name root builds from a validated host and a route constant; read-only systemctl show, starts and stops nothing; no file read added file:Query@1090,file:Query@384,file:Query@759 9ea847d9a1e6b0e0929f27b27a9ade5c783c0de1ba0d997523c939be8293e701
@@ -121,9 +121,9 @@ internal/activator/rootfs_service.go Service.rootfsTick legacy accepted-legacy a
@remove internal/instancectl/cmd.go Server.handleCmdStatus
@removed internal/instancectl/cmd.go Server.handleCmdStatus H3 census-ruling-rootfs-apps-6;absent;basis=rootfs Plan 6 Task 6: moved whole to Server.oneShotStatus (role-aware; see its claim), not deleted: no check, refusal or validation is lost
@coverage . 766879a140477803bc6e00e07c33e36d500b4600e69596cbfb4be07427784746
-@coverage internal/activator ca11a10e8d8d494376ebf3fd0a4d7aa2ea471ec696732849c8cb2afb6bbe3ac0
+@coverage internal/activator 72f34fc88388e97bbd0d84d0256f409ca6931af0b6127ebb7895b01a02f2e73d
@coverage internal/appconfig cac8d8ef7538a456d034801c95ce6508a4983e5516b3bbbd302bec0fbafdd479
-@coverage internal/host 8ffe38068d3e19d4c1aa76283505ce011fc4a6a2c40d85a48123267982d65749
+@coverage internal/host 5fa4abbdabdf0d6816ab3e589fd563fe9291b5921fe529cb2383adf0497937b1
@coverage internal/host/units c3cc4f3b917fdb938f20d406b1704ec54e24553851c298e312056d397d10b0e1
@coverage internal/instancectl 096e845eb71478e8b68726160cff450f8ba850869dae65582dabd25f445527e9
@coverage internal/instanceexec 65f6db1c6bf469f1d19615ec989f54c20de3b73c3c03ae2d677cffbcc60470fd