carlos / platform Public

cli: a session's restore, stdin reader, output and refusal reads are bounded (rootfs plan 6 task 13 fix round 1)

Astra P2s 1, 2, 3 and 5:
- A restore counts only when it succeeds: it is tried twice, a failure
  leaves the terminal unrestored for a later end to retry, and one
  diagnostic line says so. The unix restore no longer spends its once on
  a failed ioctl.
- The stdin reader is owned: a sessionInput whose Stop ends a Read in
  progress (fdInput: select with a 100 ms timeout on linux and macOS),
  and the session's end stops it and waits for it.
- The handshake reads at most MaxRefusalBody plus 16 KiB before the
  upgrade, so x/net's drain of a huge or endless refusal ends by size.
- A failed or short write to the terminal ends the session, exit 1.

Census: overlay rootfs-apps-6 re-proposed (claims carried, four units'
claims extended, fdInput.Read new), seal e1618040 -> 977d75ba; the
record-write census re-pins openSession.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 51d03d8a8f47498ef6d99650cf0103865858658b parent cbd939d
11 files changed, +466 −50
  • docs/superpowers/notes/census-proposal-rootfs-apps-6.md +4 −3
  • interactive_cli.go +60 −14
  • interactive_cli_test.go +149 −2
  • interactive_term_other.go +8 −0
  • interactive_term_unix.go +72 −4
  • interactive_term_unix_test.go +55 −0
  • internal/interactive/frames.go +33 −13
  • internal/interactive/frames_test.go +68 −1
  • internal/provision/rootfs_apps_6_census_test.go +3 −1
  • internal/provision/testdata/plan14-root-reads-chain.tsv +1 −1
  • internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv +13 −11

Intent

Human

<task-notification> <task-id>afd712709c8e68b49</task-id> <tool-use-id>toolu_01PgoLnnEuE3QpUcmqysNDxE</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/afd712709c8e68b49.output</output-file> <status>completed</status> <summary>Agent "Plan 6 Task 14: docs" 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>Commit `cbd939d3` landed in spite of the `packed-refs.lock` message, which you said to ignore. The status after it was clean. `go test ./internal/docsite/ -count=1` first failed on the missing `### carlos console` heading and now passes. `go test . -run 'Copy|Rootfs' -count=1` also passes. I also touched the gate file `approved_rootfs_copy_test.go`, adding C58 to C61 to its built list. The rest of the commit is `docs/site/cli.md` and `docs/superpowers/plans/2026-10-24-rootfs-apps-copy.md`.</result> <usage><subagent_tokens>54320</subagent_tokens><tool_uses>7</tool_uses><duration_ms>50121</duration_ms></usage> </task-notification>

Human

<task-notification> <task-id>bphtxr17v</task-id> <tool-use-id>toolu_01BYUxW3xk3LhwthcdHFrCGF</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/bphtxr17v.output</output-file> <status>completed</status> <summary>Background command "Fallback watch for the Task 13 commit" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>by04i55v2</task-id> <tool-use-id>toolu_01Psm6QK1hopWEQ6jmqt1ot5</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/by04i55v2.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of Plan 6 Task 13" completed (exit code 0)</summary> </task-notification>

Human

<task-notification> <task-id>b3hss30uv</task-id> <tool-use-id>toolu_01RJhbqR8j8qiBG7h8pMPeLX</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/b3hss30uv.output</output-file> <status>completed</status> <summary>Background command "Wait for the copy review result" completed (exit code 0)</summary> </task-notification>

Human

Are we logging rails console access attempts via the Carlos command?

Human

Sure.

diff --git a/docs/superpowers/notes/census-proposal-rootfs-apps-6.md b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
index 1de9d24d8..789624505 100644
--- a/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
+++ b/docs/superpowers/notes/census-proposal-rootfs-apps-6.md
@@ -1,6 +1,6 @@
# Census approval: rootfs-apps-6
-Ruling `census-ruling-rootfs-apps-6`. The independent reviewer approves or rejects every change below, 37 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
+Ruling `census-ruling-rootfs-apps-6`. The independent reviewer approves or rejects every change below, 38 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26).
| unit | change | read sites | what changed |
|---|---|---|---|
@@ -88,6 +88,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `interactive_cli.go:session.bridge`: reads +file:Read; written legacy, accepted-legacy, frozen
- new `interactive_cli.go:sessionOpen`: reads +file:Open ×3; written legacy, accepted-legacy, frozen
- new `interactive_cli.go:type session`: reads +file:Open; written legacy, accepted-legacy, frozen
+- new `interactive_term_unix.go:fdInput.Read`: reads +file:Read ×2; written legacy, accepted-legacy, frozen
- new `internal/activator/backend_rootfs.go:ExecBackend.KillOneShot`: reads +registry:Host ×9, +whole:Route; written legacy, accepted-legacy, frozen
- new `internal/activator/backend_rootfs.go:ExecBackend.startRootfsRun`: reads +registry:Host ×3, +whole:Route ×6; written legacy, accepted-legacy, frozen
- new `internal/activator/backend_unit.go:SplitBackend.KillOneShot`: reads +registry:Host, +whole:Route ×2; written legacy, accepted-legacy, frozen
@@ -111,7 +112,7 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `internal/instancectl/cmd.go:Server.oneShotStatus`: reads +file:Query ×3; written legacy, accepted-legacy, frozen
- new `internal/instanceexec/tty_linux.go:receivePTY`: reads +file:Fstat; written legacy, accepted-legacy, frozen
- new `internal/interactive/frames.go:Receive`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
-- new `internal/interactive/frames.go:handshakeRecorder.Read`: reads +file:Read ×2; written legacy, accepted-legacy, frozen
+- new `internal/interactive/frames.go:handshakeRecorder.Read`: reads +file:Read ×3; written legacy, accepted-legacy, frozen
- new `internal/interactive/frames.go:readRefusal`: reads +file:ReadAll; written legacy, accepted-legacy, frozen
- new `internal/interactive/grant.go:MintToken`: reads +file:Read; written legacy, accepted-legacy, frozen
- new `internal/interactive/interactive.go:Open.Check`: reads +file:Open; written legacy, accepted-legacy, frozen
@@ -120,6 +121,6 @@ New dispositions, which census-propose wrote and the reviewer checks against the
- new `run.go:runRun`: 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` → `e16180401ee1f990308c7d89e679fd93888b1563f6b722160675aebf69298e5c`.
+Seal: `1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7` → `977d75ba26008adb69ada0897ea5cdc37efa7b1019ccfd1c56ad4f0f9795f7b1`.
Overlay: `internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`.
diff --git a/interactive_cli.go b/interactive_cli.go
index ea7748084..15a1cc953 100644
--- a/interactive_cli.go
+++ b/interactive_cli.go
@@ -95,12 +95,27 @@ type terminal interface {
IsTerminal() bool
}
+// sessionInput is the keyboard a session reads: Stop makes a Read in
+// progress, and every later one, return, so the session's cleanup can stop
+// its reader and wait for it.
+type sessionInput interface {
+ io.Reader
+ Stop()
+}
+
+// errInputStopped is a sessionInput's Read after Stop.
+var errInputStopped = errors.New("carlos: input stopped")
+
+// restoreFailedMsg is the one diagnostic for a terminal left raw (internal,
+// not reviewed copy).
+const restoreFailedMsg = "carlos: could not restore the terminal: %v"
+
// sessionClient is what runSession runs on: the dial, the terminal, the
// streams and the signals that end a session (SIGINT, SIGTERM, SIGHUP).
type sessionClient struct {
dial func(ctx context.Context, url, origin string, h http.Header) (*websocket.Conn, error)
term terminal
- in io.Reader
+ in sessionInput
out, errw io.Writer
signals <-chan os.Signal
// alive and lost are the keepalive interval and the silence after
@@ -213,9 +228,11 @@ type session struct {
stop chan struct{} // closed when the session is over
stopOnce sync.Once
- restore func() error // set once raw mode is on
- restored bool
- resizes func() // stops the terminal's resizes, once they are watched
+ restore func() error // set once raw mode is on
+ restored bool // set only by a restore that succeeded
+ warned bool // restoreFailedMsg printed
+ resizes func() // stops the terminal's resizes, once they are watched
+ copier chan struct{} // closed when the stdin copier has returned
}
type sessionFrame struct {
@@ -287,7 +304,11 @@ func (s *session) run(ctx context.Context) int {
s.bridge(panics)
}
case interactive.KindData:
- _, _ = s.c.out.Write(f.payload)
+ // Output that cannot be written is a lost terminal: the
+ // session ends, exit 1.
+ if n, err := s.c.out.Write(f.payload); err != nil || n != len(f.payload) {
+ return s.finish(1, "")
+ }
case interactive.KindEnd:
var e interactive.End
if json.Unmarshal(f.payload, &e) != nil || e.Reason == "" {
@@ -314,7 +335,9 @@ func (s *session) run(ctx context.Context) int {
// sessionReadBytes a read) and the window's resizes (KindResize): first the
// size now, if it is not the Open's. A panic in the copier goes to panics.
func (s *session) bridge(panics chan<- any) {
+ s.copier = make(chan struct{})
go func() {
+ defer close(s.copier)
defer func() {
if p := recover(); p != nil {
panics <- p
@@ -381,25 +404,48 @@ func (s *session) keepalive() {
}
}
-// end is every way out's first step: the terminal restored, once, then
-// the session's goroutines stopped and its connection closed. A send
-// stuck on a console that stopped reading is cut off by the write
-// deadline, so the close never waits on it.
+// end is every way out's first step: the terminal restored, then the
+// session's goroutines stopped, its connection closed and the stdin copier
+// waited for. A send stuck on a console that stopped reading is cut off by
+// the write deadline, so neither the close nor the wait hangs on it.
func (s *session) end() {
- if s.restore != nil && !s.restored {
- s.restored = true
- _ = s.restore()
- }
+ s.restoreTerminal()
s.stopOnce.Do(func() {
close(s.stop)
if s.resizes != nil {
s.resizes()
}
+ s.c.in.Stop()
_ = s.ws.SetWriteDeadline(time.Now().Add(time.Second))
_ = s.ws.Close()
+ if s.copier != nil {
+ <-s.copier
+ }
})
}
+// restoreTerminal restores raw mode, trying twice. Only a restore that
+// succeeded counts: after a failure the terminal stays unrestored, so a
+// later end (the panic path's) tries again, and one diagnostic line says
+// so.
+func (s *session) restoreTerminal() {
+ if s.restore == nil || s.restored {
+ return
+ }
+ err := s.restore()
+ if err != nil {
+ err = s.restore()
+ }
+ if err == nil {
+ s.restored = true
+ return
+ }
+ if !s.warned {
+ s.warned = true
+ s.c.say(fmt.Sprintf(restoreFailedMsg, err))
+ }
+}
+
// finish ends the session, then prints line, if any, and returns code.
func (s *session) finish(code int, line string) int {
s.end()
@@ -491,7 +537,7 @@ func openSession(sess *apiSession, acct apiAcct, app, host string, open interact
signal.Notify(sig, os.Interrupt, syscall.SIGTERM, syscall.SIGHUP)
defer signal.Stop(sig)
c := sessionClient{dial: interactive.Dial, term: newTerminal(os.Stdin, os.Stdout),
- in: os.Stdin, out: os.Stdout, errw: os.Stderr, signals: sig}
+ in: newInput(os.Stdin), out: os.Stdout, errw: os.Stderr, signals: sig}
door := sess.c.base + apiPath(acct, app, "/instances/"+url.PathEscape(host)+"/interactive")
return runSession(context.Background(), c, door, sess.c.base, sess.c.token, host, app, open)
}
diff --git a/interactive_cli_test.go b/interactive_cli_test.go
index 63a05c507..49f6d189f 100644
--- a/interactive_cli_test.go
+++ b/interactive_cli_test.go
@@ -112,6 +112,7 @@ func (b *lockedBuffer) String() string {
type fakeTerm struct {
log *eventLog
notTerm bool
+ restoreErr []error // each restore takes the next; none left is success
mu sync.Mutex
cols, rows uint16
resizes chan struct{}
@@ -125,7 +126,18 @@ func (f *fakeTerm) IsTerminal() bool { return !f.notTerm }
func (f *fakeTerm) MakeRaw() (func() error, error) {
f.log.add("raw")
- return func() error { f.log.add("restore"); return nil }, nil
+ return func() error {
+ f.mu.Lock()
+ defer f.mu.Unlock()
+ if len(f.restoreErr) > 0 {
+ err := f.restoreErr[0]
+ f.restoreErr = f.restoreErr[1:]
+ f.log.add("restore failed")
+ return err
+ }
+ f.log.add("restore")
+ return nil
+ }, nil
}
func (f *fakeTerm) Size() (uint16, uint16, error) {
@@ -218,6 +230,34 @@ func nextFrame(ws *websocket.Conn) (byte, []byte, error) {
}
}
+// pipeInput is a sessionInput over an io.Pipe: Stop closes the pipe, after
+// delay, and returned records that a Read has returned since.
+type pipeInput struct {
+ *io.PipeReader
+ delay time.Duration
+ returned chan struct{}
+ once sync.Once
+}
+
+func newPipeInput(r *io.PipeReader) *pipeInput {
+ return &pipeInput{PipeReader: r, returned: make(chan struct{})}
+}
+
+func (p *pipeInput) Read(b []byte) (int, error) {
+ n, err := p.PipeReader.Read(b)
+ if err != nil {
+ p.once.Do(func() { close(p.returned) })
+ }
+ return n, err
+}
+
+func (p *pipeInput) Stop() {
+ go func() {
+ time.Sleep(p.delay)
+ p.PipeReader.CloseWithError(errInputStopped)
+ }()
+}
+
// sessionRig is one runSession: its terminal, stdin, stdout, signals and
// event log.
type sessionRig struct {
@@ -235,7 +275,7 @@ func newRig(t *testing.T) *sessionRig {
inR, inW := io.Pipe()
t.Cleanup(func() { inW.Close() })
r := &sessionRig{log: l, term: newFakeTerm(l, 120, 40), inW: inW, out: &lockedBuffer{}, sig: make(chan os.Signal, 1)}
- r.c = sessionClient{dial: interactive.Dial, term: r.term, in: inR, out: r.out, errw: stderrLog{l}, signals: r.sig}
+ r.c = sessionClient{dial: interactive.Dial, term: r.term, in: newPipeInput(inR), out: r.out, errw: stderrLog{l}, signals: r.sig}
return r
}
@@ -410,6 +450,8 @@ type panicReader struct{}
func (panicReader) Read([]byte) (int, error) { panic("copier fault") }
+func (panicReader) Stop() {}
+
// TestSessionRestoresTheTerminalOnEveryExit (Review Focus 1): whichever way
// a started session ends, the terminal is restored exactly once, and before
// the last line.
@@ -762,3 +804,108 @@ func interruptOnWaiting(sig chan os.Signal) io.Writer {
type writerFunc func([]byte)
func (f writerFunc) Write(p []byte) (int, error) { f(p); return len(p), nil }
+
+// TestSessionRestoreFailure (fix round 1, P2 1): a restore that fails is
+// tried again and only a success counts. A restore that keeps failing
+// prints one diagnostic before the last line; the exit code is the End's.
+func TestSessionRestoreFailure(t *testing.T) {
+ for _, tc := range []struct {
+ name string
+ errs []error
+ diag bool
+ calls int
+ }{
+ {"fails once", []error{errors.New("EINTR")}, false, 2},
+ {"keeps failing", []error{errors.New("EIO"), errors.New("EIO"), errors.New("EIO"), errors.New("EIO")}, true, 2},
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ r := newRig(t)
+ r.term.restoreErr = tc.errs
+ door := newFakeDoor(t, func(t *testing.T, ws *websocket.Conn, o interactive.Open) {
+ started(t, ws)
+ for deadline := time.Now().Add(5 * time.Second); r.log.count("raw") == 0 && time.Now().Before(deadline); {
+ time.Sleep(5 * time.Millisecond)
+ }
+ sendEnd(ws, interactive.End{Reason: interactive.EndIdle})
+ })
+ if code := r.run(door.doorURL(), door.url, argvOpen("sh")); code != 124 {
+ t.Fatalf("code %d", code)
+ }
+ ev := r.log.all()
+ calls := r.log.count("restore") + r.log.count("restore failed")
+ diag := "err: carlos: could not restore the terminal: EIO\n"
+ last := "err: " + ixCLIHost + ": the session ended after 30 minutes without a keystroke\n"
+ switch {
+ case calls != tc.calls:
+ t.Fatalf("%d restore calls, want %d: %q", calls, tc.calls, ev)
+ case ev[len(ev)-1] != last:
+ t.Fatalf("last event %q, want the C19 line", ev[len(ev)-1])
+ case tc.diag && (r.log.count(diag) != 1 || ev[len(ev)-2] != diag):
+ t.Fatalf("events %q; want one diagnostic, before the last line", ev)
+ case !tc.diag && r.log.count("restore") != 1:
+ t.Fatalf("events %q; want the retry to restore", ev)
+ }
+ })
+ }
+}
+
+// TestSessionJoinsItsStdinReader (fix round 1, P2 2): a session's stdin
+// never closes; its end stops the reader and waits for it, so runSession
+// returns only once the reader has.
+func TestSessionJoinsItsStdinReader(t *testing.T) {
+ r := newRig(t)
+ in := r.c.in.(*pipeInput)
+ in.delay = 100 * time.Millisecond // the reader takes a while to notice
+ door := newFakeDoor(t, func(t *testing.T, ws *websocket.Conn, o interactive.Open) {
+ started(t, ws)
+ for deadline := time.Now().Add(5 * time.Second); r.log.count("raw") == 0 && time.Now().Before(deadline); {
+ time.Sleep(5 * time.Millisecond)
+ }
+ sendEnd(ws, interactive.End{Reason: interactive.EndExited})
+ })
+ if code := r.run(door.doorURL(), door.url, argvOpen("sh")); code != 0 {
+ t.Fatalf("code %d", code)
+ }
+ select {
+ case <-in.returned:
+ default:
+ t.Fatal("runSession returned with its stdin reader still in Read")
+ }
+}
+
+// failWriter fails every write.
+type failWriter struct{}
+
+func (failWriter) Write([]byte) (int, error) { return 0, errors.New("EIO") }
+
+// shortWriter writes one byte less than asked, with no error.
+type shortWriter struct{}
+
+func (shortWriter) Write(p []byte) (int, error) { return max(len(p)-1, 0), nil }
+
+// TestSessionEndsOnAFailedWrite (fix round 1, P2 5): output the terminal
+// will not take ends the session, exit 1, through the same cleanup.
+func TestSessionEndsOnAFailedWrite(t *testing.T) {
+ for name, w := range map[string]io.Writer{"an error": failWriter{}, "a short write": shortWriter{}} {
+ t.Run(name, func(t *testing.T) {
+ r := newRig(t)
+ r.c.out = w
+ closed := make(chan error, 1)
+ door := newFakeDoor(t, func(t *testing.T, ws *websocket.Conn, o interactive.Open) {
+ started(t, ws)
+ interactive.Send(ws, interactive.KindData, []byte("hello"))
+ _, _, err := nextFrame(ws)
+ closed <- err
+ })
+ if code := r.run(door.doorURL(), door.url, argvOpen("sh")); code != 1 {
+ t.Fatalf("code %d; stderr %q", code, r.log.stderr())
+ }
+ if err := <-closed; err == nil {
+ t.Fatal("the connection stayed open")
+ }
+ if ev := r.log.all(); r.log.count("restore") != 1 || ev[len(ev)-1] != "restore" {
+ t.Fatalf("events %q; want one restore, last", ev)
+ }
+ })
+ }
+}
diff --git a/interactive_term_other.go b/interactive_term_other.go
index 177473d56..f5e65b9f6 100644
--- a/interactive_term_other.go
+++ b/interactive_term_other.go
@@ -24,3 +24,11 @@ func (noTerm) IsTerminal() bool { return false }
func (noTerm) MakeRaw() (func() error, error) { return nil, errTermUnsupported }
func (noTerm) Size() (uint16, uint16, error) { return 0, 0, errTermUnsupported }
func (noTerm) Resizes() (<-chan struct{}, func()) { return nil, func() {} }
+
+// fileInput is stdin where sessions do not run: runSession refuses (C07)
+// before it reads anything.
+type fileInput struct{ *os.File }
+
+func newInput(f *os.File) sessionInput { return fileInput{f} }
+
+func (fileInput) Stop() {}
diff --git a/interactive_term_unix.go b/interactive_term_unix.go
index 87464cb0f..b69c383b2 100644
--- a/interactive_term_unix.go
+++ b/interactive_term_unix.go
@@ -6,9 +6,12 @@ package main
// request numbers in interactive_term_linux.go and interactive_term_darwin.go.
import (
+ "io"
"os"
"os/signal"
"sync"
+ "sync/atomic"
+ "time"
"golang.org/x/sys/unix"
)
@@ -47,11 +50,21 @@ func (t *unixTerm) MakeRaw() (func() error, error) {
if err := unix.IoctlSetTermios(fd, ioctlSetTermios, &raw); err != nil {
return nil, err
}
- var once sync.Once
+ // The restore is done once it has succeeded; a failure leaves it to
+ // be tried again.
+ var mu sync.Mutex
+ done := false
return func() error {
- var err error
- once.Do(func() { err = unix.IoctlSetTermios(fd, ioctlSetTermios, old) })
- return err
+ mu.Lock()
+ defer mu.Unlock()
+ if done {
+ return nil
+ }
+ if err := unix.IoctlSetTermios(fd, ioctlSetTermios, old); err != nil {
+ return err
+ }
+ done = true
+ return nil
}, nil
}
@@ -90,3 +103,58 @@ func (t *unixTerm) Resizes() (<-chan struct{}, func()) {
})
}
}
+
+// inputPoll is how long fdInput waits for the keyboard before it looks at
+// its stop flag again: the most a session's cleanup waits for its reader.
+const inputPoll = 100 * time.Millisecond
+
+// fdInput reads a file descriptor (stdin) through select with a timeout,
+// so Stop ends a Read in progress within inputPoll instead of leaving it
+// blocked in read(2) for the next keystroke.
+type fdInput struct {
+ fd int
+ stopped atomic.Bool
+}
+
+func newInput(f *os.File) sessionInput { return &fdInput{fd: int(f.Fd())} }
+
+func (in *fdInput) Stop() { in.stopped.Store(true) }
+
+func (in *fdInput) Read(p []byte) (int, error) {
+ if in.fd < 0 || in.fd >= unix.FD_SETSIZE {
+ return 0, unix.EBADF
+ }
+ for {
+ if in.stopped.Load() {
+ return 0, errInputStopped
+ }
+ var r unix.FdSet
+ r.Set(in.fd)
+ tv := unix.NsecToTimeval(inputPoll.Nanoseconds())
+ n, err := unix.Select(in.fd+1, &r, nil, nil, &tv)
+ switch {
+ case err == unix.EINTR:
+ continue
+ case err != nil:
+ return 0, err
+ case n == 0:
+ continue
+ }
+ if in.stopped.Load() {
+ return 0, errInputStopped
+ }
+ for {
+ n, err := unix.Read(in.fd, p)
+ if err == unix.EINTR {
+ continue
+ }
+ if err != nil {
+ return 0, err
+ }
+ if n == 0 {
+ return 0, io.EOF
+ }
+ return n, nil
+ }
+ }
+}
diff --git a/interactive_term_unix_test.go b/interactive_term_unix_test.go
new file mode 100644
index 000000000..e27089329
--- /dev/null
+++ b/interactive_term_unix_test.go
@@ -0,0 +1,55 @@
+//go:build linux || darwin
+
+package main
+
+import (
+ "errors"
+ "os"
+ "testing"
+ "time"
+)
+
+// TestFdInputStops (fix round 1, P2 2): a Read blocked on a descriptor
+// that never closes returns errInputStopped soon after Stop, and leaves
+// what is written afterwards unread.
+func TestFdInputStops(t *testing.T) {
+ r, w, err := os.Pipe()
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { r.Close(); w.Close() })
+ in := newInput(r)
+ if _, err := w.Write([]byte("ls\r")); err != nil {
+ t.Fatal(err)
+ }
+ buf := make([]byte, 16)
+ if n, err := in.Read(buf); err != nil || string(buf[:n]) != "ls\r" {
+ t.Fatalf("Read = %q, %v", buf[:n], err)
+ }
+ done := make(chan error, 1)
+ go func() {
+ _, err := in.Read(buf)
+ done <- err
+ }()
+ time.Sleep(50 * time.Millisecond)
+ start := time.Now()
+ in.Stop()
+ select {
+ case err := <-done:
+ if !errors.Is(err, errInputStopped) {
+ t.Fatalf("Read after Stop = %v", err)
+ }
+ case <-time.After(2 * time.Second):
+ t.Fatal("Read still blocked 2s after Stop")
+ }
+ if d := time.Since(start); d > time.Second {
+ t.Fatalf("Stop took %s", d)
+ }
+ if _, err := w.Write([]byte("x")); err != nil {
+ t.Fatal(err)
+ }
+ _ = r.SetReadDeadline(time.Now().Add(time.Second))
+ if n, err := r.Read(buf); err != nil || string(buf[:n]) != "x" {
+ t.Fatalf("after Stop the pipe read %q, %v; want the x nobody took", buf[:n], err)
+ }
+}
diff --git a/internal/interactive/frames.go b/internal/interactive/frames.go
index 50362f926..98d3c182a 100644
--- a/internal/interactive/frames.go
+++ b/internal/interactive/frames.go
@@ -233,6 +233,14 @@ func DialFrame(ctx context.Context, url, origin string, header http.Header, maxF
if err != nil {
return nil, err
}
+ return handshake(ctx, cfg, raw, maxFrame)
+}
+
+// handshake is DialFrame's upgrade over raw, which it owns: closed on any
+// failure. What it reads before the upgrade is done is bounded at
+// maxHandshake (handshakeRecorder), so a refusal with a huge or endless
+// body ends by size, not only at ctx's deadline.
+func handshake(ctx context.Context, cfg *websocket.Config, raw net.Conn, maxFrame int) (*websocket.Conn, error) {
rec := &handshakeRecorder{Conn: raw}
if dl, ok := ctx.Deadline(); ok {
_ = raw.SetDeadline(dl)
@@ -286,10 +294,10 @@ const MaxRefusalBody = 64 << 10
// readRefusal reads again the refusal x/net turned into ErrBadStatus. x/net
// read the response's head through rec and then drained its body (closing
-// it reads it to the end), so rec's copy is the whole response unless it
-// passed maxHandshake; a copy cut there gives a body cut short, which is
-// kept as it came. A body that never ends holds x/net's drain until the
-// dial's context ends, as any stalled handshake does.
+// it reads it to the end), so rec's copy is the whole response up to
+// maxHandshake, where the drain was stopped; a body cut there is kept as it
+// came, up to MaxRefusalBody. A body that stalls holds x/net's drain until
+// the dial's context ends, as any stalled handshake does.
func readRefusal(rec *handshakeRecorder) error {
resp, err := http.ReadResponse(bufio.NewReader(bytes.NewReader(rec.buf.Bytes())), nil)
if err != nil {
@@ -323,13 +331,20 @@ func dialTransport(ctx context.Context, cfg *websocket.Config) (net.Conn, error)
return nil, websocket.ErrBadScheme
}
-// maxHandshake bounds what handshakeRecorder keeps.
-const maxHandshake = 64 << 10
-
-// handshakeRecorder keeps a copy of the bytes read until stopped, so
-// DialFrame can read the handshake response x/net does not return. It may
-// keep the start of the first frames too; negotiated reads only the
+// maxHandshake bounds what the handshake reads from the connection, and
+// so what handshakeRecorder keeps: MaxRefusalBody and room for a
// response's head.
+const maxHandshake = MaxRefusalBody + 16<<10
+
+// errHandshakeTooBig is handshakeRecorder's read past maxHandshake.
+var errHandshakeTooBig = errors.New("interactive: the handshake response is over its size limit")
+
+// handshakeRecorder keeps a copy of every byte read until stopped, so
+// DialFrame can read the handshake response x/net does not return, and
+// reads no more than maxHandshake bytes before then: x/net drains a
+// refusal's body, and a Read past the bound fails instead, which ends the
+// drain. It may keep the start of the first frames too; negotiated reads
+// only the response's head.
type handshakeRecorder struct {
net.Conn
buf bytes.Buffer
@@ -337,10 +352,15 @@ type handshakeRecorder struct {
}
func (r *handshakeRecorder) Read(p []byte) (int, error) {
- n, err := r.Conn.Read(p)
- if !r.stopped && r.buf.Len() < maxHandshake {
- r.buf.Write(p[:min(n, maxHandshake-r.buf.Len())])
+ if r.stopped {
+ return r.Conn.Read(p)
+ }
+ room := maxHandshake - r.buf.Len()
+ if room <= 0 {
+ return 0, errHandshakeTooBig
}
+ n, err := r.Conn.Read(p[:min(len(p), room)])
+ r.buf.Write(p[:n])
return n, err
}
diff --git a/internal/interactive/frames_test.go b/internal/interactive/frames_test.go
index 14423b690..b45b3f472 100644
--- a/internal/interactive/frames_test.go
+++ b/internal/interactive/frames_test.go
@@ -570,7 +570,7 @@ func TestDialRefusalBodyIsBounded(t *testing.T) {
defer cancel()
_, err := Dial(ctx, wsURL(t, srv), testOrigin, nil)
var re *RefusedError
- if !errors.As(err, &re) || re.Status != http.StatusConflict || len(re.Body) == 0 || len(re.Body) > MaxRefusalBody ||
+ if !errors.As(err, &re) || re.Status != http.StatusConflict || len(re.Body) > MaxRefusalBody ||
len(bytes.Trim(re.Body, "y")) != 0 {
t.Fatalf("Dial = %v (%T); want a 409 RefusedError with at most %d bytes of the body", err, err, MaxRefusalBody)
}
@@ -597,3 +597,70 @@ func TestDialRefusalBodyIsBounded(t *testing.T) {
t.Fatalf("stalled Dial took %s", d)
}
}
+
+// TestHandshakeBoundsWhatARefusalConsumes (fix round 1, P2 3): a refusal
+// whose body is huge, or never ends, is read only up to maxHandshake bytes
+// in all; the dial ends then, by size, keeping at most MaxRefusalBody.
+// net.Pipe is unbuffered, so what the server got written is exactly what
+// the dial read.
+func TestHandshakeBoundsWhatARefusalConsumes(t *testing.T) {
+ y := bytes.Repeat([]byte("y"), 1024)
+ for name, tc := range map[string]struct {
+ head string
+ chunk []byte
+ }{
+ "a 1 TiB body": {"HTTP/1.1 409 Conflict\r\nContent-Length: 1099511627776\r\n\r\n", y},
+ "a chunked stream without end": {"HTTP/1.1 409 Conflict\r\nTransfer-Encoding: chunked\r\n\r\n",
+ append(append([]byte("400\r\n"), y...), "\r\n"...)},
+ "a body that ends at the close": {"HTTP/1.1 409 Conflict\r\nConnection: close\r\n\r\n", y},
+ } {
+ t.Run(name, func(t *testing.T) {
+ client, server := net.Pipe()
+ t.Cleanup(func() { server.Close() })
+ written := make(chan int, 1)
+ go func() {
+ br := bufio.NewReader(server)
+ if _, err := http.ReadRequest(br); err != nil {
+ written <- -1
+ return
+ }
+ total := 0
+ if _, err := io.WriteString(server, tc.head); err != nil {
+ written <- -1
+ return
+ }
+ total += len(tc.head)
+ for {
+ n, err := server.Write(tc.chunk)
+ total += n
+ if err != nil {
+ written <- total
+ return
+ }
+ }
+ }()
+ cfg, err := websocket.NewConfig("ws://pipe.test/x", testOrigin)
+ if err != nil {
+ t.Fatal(err)
+ }
+ cfg.Protocol = []string{Subprotocol}
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
+ start := time.Now()
+ _, err = handshake(ctx, cfg, client, MaxFrame)
+ var re *RefusedError
+ // (x/net drains a body with a length or chunks; one that ends at
+ // the close it does not, so less of it, or none, is kept.)
+ if !errors.As(err, &re) || re.Status != http.StatusConflict || len(re.Body) > MaxRefusalBody ||
+ len(bytes.Trim(re.Body, "y")) != 0 {
+ t.Fatalf("handshake = %v (%T); want a 409 RefusedError with at most %d bytes of the body", err, err, MaxRefusalBody)
+ }
+ if d := time.Since(start); d > 2*time.Second {
+ t.Fatalf("the dial took %s: it ended by time, not size", d)
+ }
+ if n := <-written; n < 0 || n > maxHandshake {
+ t.Fatalf("the dial read %d bytes of the response; the bound is %d", n, maxHandshake)
+ }
+ })
+ }
+}
diff --git a/internal/provision/rootfs_apps_6_census_test.go b/internal/provision/rootfs_apps_6_census_test.go
index 609c12fc2..f3a8850d4 100644
--- a/internal/provision/rootfs_apps_6_census_test.go
+++ b/internal/provision/rootfs_apps_6_census_test.go
@@ -73,6 +73,8 @@ package provision
// (/api/cli/apps/<acct>/<app>/instances/<host>/interactive), as
// runAPI.path builds the run routes' path: a key-site on the literal,
// no record key built and nothing written.
+// - Task 13 fix round 1: openSession wraps stdin in newInput; the same
+// path literal, nothing written; re-pinned.
func rootfsApps6WriteCensusInventory() []censusEntry {
entries := append([]censusEntry(nil), fleetPublicRoutesWriteCensusInventory()...)
replacements := []censusEntry{
@@ -106,7 +108,7 @@ func rootfsApps6WriteCensusInventory() []censusEntry {
{"internal/console/apiinteractive.go", "Server.putGrant", "nonrecord", "sel:Put", "22a18ef45051da8cfb8a6a62ad8891afd28e3bf71cc26a541639cd2a1dc0a1ff"},
{"internal/console/server.go", "consolePerfSkip", "key-site", "lit:instances", "d4b65473d3702b49d79a799d46f078e4491b6e86a59a101dd4c1ce4d50f698e7"},
{"internal/console/runsweep.go", "Server.clearDeadMarker", "record-writer", "key:SetRecordInteractive", "3e26dfe2a13a9e3b6525fb3c4f4a54da79a464c061f95eaa9fadbaf1ee041f9a"},
- {"interactive_cli.go", "openSession", "key-site", "lit:instances", "5d9326c04a8a24792b048be5201e79b9f4911077080b253c1f71f06bfcf6f25a"},
+ {"interactive_cli.go", "openSession", "key-site", "lit:instances", "35c4382b05ef131c2d37d834283f70adb78e7e782b7b540889599b8b9e6c19e8"},
}
for _, a := range added {
for _, e := range entries {
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv
index 5753d2c9d..ed51038fa 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 e16180401ee1f990308c7d89e679fd93888b1563f6b722160675aebf69298e5c
+plan14-root-reads-rootfs-apps-6.tsv 977d75ba26008adb69ada0897ea5cdc37efa7b1019ccfd1c56ad4f0f9795f7b1
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 fc6bbc4d1..0260e2f9c 100644
--- a/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
+++ b/internal/provision/testdata/plan14-root-reads-rootfs-apps-6.tsv
@@ -1,7 +1,7 @@
# Census overlay rootfs-apps-6, written by census-propose (#369). census-ruling-rootfs-apps-6, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-rootfs-apps-6.md.
# 25 body, 5 sites, 10 envelope: each changed unit re-frozen at its existing disposition with its claim appended.
# 1 removed: each unit's declaration, or each envelope's directory, is absent from the scanned tree, so its row goes, a frozen declaration is retired as absent, and an envelope is retired.
-# 37 new dispositions: 1 reads re-frozen at their disposition with the claim, 36 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
+# 38 new dispositions: 1 reads re-frozen at their disposition with the claim, 37 new units frozen accepted-legacy, 0 quiet units retired while they read nothing, 0 other.
@legacy c41d9a1319e7f19435f88127ae64ec2739a24900da6942fe69e710eb6d47e36c internal/activator/activator.go Service.finishStop legacy accepted-legacy accepted-legacy;rev3=census-ruling-carlos-run;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos): main's body with a run's settle checked before replication closes, which keeps the stop pending until the run is proven stopped; read sites unchanged, offsets moved;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos: an HA entry (its replica is an HA one, haEntryRep) now releases through releaseHAClean (a new unit on this card) instead of e.rep.Close; when that answers errHostSliceUnproven the stop is kept pending (keepPendingLocked) with the lease held and renewing, and the sweep finishes it once proven; a non-HA entry is unchanged; the same five sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Task 8: a forgotten entry's stop is noted for its resident (noteResidentStopLocked: crash or lost lease backs off, any other stop restarts on the next tick) and its ownerDone channel is closed; no read added;rev3=census-ruling-rootfs-apps-3-release;basis=rootfs Plan 3 Group R: while the host has a release command's record (a.releaseOps[e.host], running or not proven stopped), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the record's proof; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.20: while a rootfs worker may run or is a stray (rootfsWorkersLiveLocked, in-memory, read under a.mu), replication and the lease stay and the stop is kept pending (keepPendingLocked) until the workers are proven stopped; the same five read sites, no read added; only holds a release back;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a fix round 1 (Astra P1): beside the worker check, under the same lock, a stop with a lease stop of its commands outstanding (e.leaseStops) is kept pending, the replica and lease held, and the sweep finishes it once they have returned; the entry is never released while a kill captured for it may still reach its unit; the same five read sites, no read added Task 9 (PF-3): the count is pendingLeaseStopsLocked(e), the sum of e.leaseStops over both one-shot roles (now a map per role, cmd and tty), so a session's lease stop of the tty unit keeps the stop pending, the replica and lease held, as a run's does; the same five read sites, no read added registry:Socket@4068,registry:Socket@4173,whole:Route@4018,whole:Route@4070,whole:Route@4175 9748565e756038b7da9a06daefeb758fae4705ecb8ce400a1d4ea3e5231a7271
@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
@@ -26,11 +26,12 @@
@legacy 438a9858d01281800b89923ab2c4bf47bba5c3eab23e07fe43af9a5e3a9ae755 internal/provision/reconcile.go Reconcile legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), from its reconcile loops: each listed record is observed through the box's lifetime judge (ObserveWith: the record, then its host incarnation slot) before the shape, channel and scope checks, a stale record is left out and an unjudgeable one protected; the removal phase observes a row's own record key when the pass holds none for it under that key, and deletes a held row whose record is gone or stale through DeleteIfHold; a nil judge (claims on) is main's body; registry read sites unchanged, offsets moved; fix round 1: the removal phase observes a row's own key only under an account the listing trusts, so a retired or unmaterialised account's row keeps record gone, and the pass arms its own context with the judge; Task 7: under a judge an existing provisioned row of the record's own app and account follows the existing-row rules (heldByVanishedPredecessor and retireHeldPredecessor's DeleteIfHold first, the record then minted on the same pass; the hold; installRowLifetime), each a separate write under the host's hold lock; registry read sites unchanged, offsets moved;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=#328/#329 plan 1 Task 7: the pass reads its apps' policy objects (control/app-policy/<sqid>/<app>.json in the bucket) through the agent's PolicyCache, each verified with ReleasePub by apppolicy.VerifyKey (ed25519 over the policy's own domain line, bound to the account and app, unexpired, not future-dated; anything else is no policy), and carries the columns into its rows. New kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, all the assignment of a fresh row's columns (nr) from policies.cols; plus one whole:Route site, the existing row handed to policies.forRow. Other read sites unchanged, offsets moved; the agent's own pass, no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, from its reconcile loops: after the scan, hands the in-scope records to cfg.Lifetimes (the box's lifetime index): Merge after a failed read or partial listing, Replace after a complete one, nothing on a dry run or with no index; the scan, judge and removal phases unchanged; the same 166 sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 5 (D5, spec §5.0): a seeded record over a row with a runtime is skipped and logged; a row with a runtime (or a new record with one) takes no seed; runtime and a rootfs row's hibernation are never converged from a record (a mismatch is logged; a record claiming a runtime its row lacks is not applied); reads Runtime of the record and the row; the box writes less; fix wave 1 (ceea6353, whole-branch P1-2): before minting a row for a record with no runtime and no row (both mint paths), the pass reads the app's kind marker once per app per pass (release.ReadAppKindMarker: one GET of the create-only kind.json from the release store s, through freshStore, validated by readAppKindMarker); a rootfs marker leaves the record unmaterialized and logged (an older console stripped its runtime), and a marker that cannot be read defers the mint this pass; a refusal before minting only, registry read sites unchanged, the box writes less; fix wave 2 (whole-branch r2 P1): the kind-marker read and its refusal apply only to a socket-backed instance record (DerivesPaths), so a static or upstream-backed record of a rootfs app, which carries no runtime by design, is minted as before with no read; fewer reads, registry read sites unchanged;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 10: the forward phase on the hub (FleetOwners set): the scan keeps the fleet-placed records it skips and counts records per host; a trash-only marker prefetch; disputed (failed-GET) hosts; armed, a host an in-scope and a fleet record both name is given neither, its journal waits and the removal phase keeps its row (+registry:Account, +registry:App, +registry:Host x2: the collision guard, its log line and report mark); the instance loop leaves a forward host; retirable excludes forward rows. Same record keys; writes only the registry (PutForward, DeleteForward); no bucket write.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 3: in the per-record loop, beside the RunSeen call, calls cfg.InteractiveSeen(rec) when the hook is set and the in-scope record carries an interactive-session marker (rec.Interactive != nil), once per record per pass, before the pass acts on it; the hook is the box worker's non-blocking note (Task 12). Same record keys and literal; no read added (registry read sites unchanged, 178); nothing written by the call registry:Account@36233,registry:Account@37498,registry:Account@55577,registry:Account@55623,registry:Account@56467,registry:Account@56844,registry:Account@57070,registry:Account@57137,registry:Account@57183,registry:Account@57276,registry:Account@57318,registry:Account@57966,registry:Account@58224,registry:Account@58764,registry:Account@58812,registry:Account@59185,registry:Account@59231,registry:Account@59476,registry:Account@59901,registry:Account@60389,registry:Account@61125,registry:Account@61318,registry:Account@61664,registry:Account@62229,registry:App@36206,registry:App@37471,registry:App@55597,registry:App@55635,registry:App@56479,registry:App@56856,registry:App@57082,registry:App@57157,registry:App@57195,registry:App@57296,registry:App@57978,registry:App@58236,registry:App@58776,registry:App@58824,registry:App@59205,registry:App@59243,registry:App@59488,registry:App@59913,registry:App@60401,registry:App@61137,registry:App@61330,registry:App@61676,registry:App@62241,registry:ClaimOwnership@36820,registry:DBPath@45677,registry:DBPath@45692,registry:DBPath@45938,registry:DBPath@46541,registry:DBPath@46554,registry:EgressAllow@35319,registry:Gate@42022,registry:Gate@42162,registry:Gate@42449,registry:Hibernate@40694,registry:Hibernate@40892,registry:Hibernate@40957,registry:Hibernate@41296,registry:Hibernate@41647,registry:Hibernate@41957,registry:HoldOp@60870,registry:HoldOp@60961,registry:HoldOp@61096,registry:HoldOp@61472,registry:Host@26327,registry:Host@55556,registry:Host@56443,registry:Host@56820,registry:Host@56984,registry:Host@57090,registry:Host@57986,registry:Host@58192,registry:Host@59068,registry:Host@59340,registry:Host@59455,registry:Host@59778,registry:Host@59875,registry:Host@60266,registry:Host@60363,registry:Host@60577,registry:Host@60952,registry:Host@61087,registry:Host@61291,registry:Host@61364,registry:Host@61463,registry:Host@61638,registry:Host@61713,registry:Host@61799,registry:Host@62206,registry:Kind@36962,registry:Kind@37225,registry:Kind@45595,registry:Kind@45608,registry:Kind@45718,registry:Kind@45731,registry:Kind@46452,registry:Kind@46463,registry:Kind@54680,registry:Kind@60568,registry:Kind@61078,registry:Kind@61454,registry:Kind@61629,registry:Kind@61790,registry:PolicyExpiresAt@35344,registry:Pool@54766,registry:Provisioned@36182,registry:Provisioned@37447,registry:Provisioned@54725,registry:RateLimit@42535,registry:RateLimit@42686,registry:RateLimit@42973,registry:Region@54755,registry:Replication@41381,registry:Replication@41508,registry:Runtime@28984,registry:Runtime@29162,registry:Runtime@31367,registry:Runtime@40061,registry:Runtime@40115,registry:Runtime@40319,registry:Seed@44075,registry:SeedSource@43558,registry:Size@35335,registry:Socket@45643,registry:Socket@45658,registry:Socket@45955,registry:Socket@46511,registry:Socket@46524,registry:Unit@45561,registry:Unit@45574,registry:Unit@46478,registry:Unit@46489,whole:ClaimOwnership@36823,whole:ClaimOwnership@36840,whole:Route@26309,whole:Route@26320,whole:Route@26338,whole:Route@27619,whole:Route@29479,whole:Route@29486,whole:Route@29526,whole:Route@29887,whole:Route@30225,whole:Route@30672,whole:Route@30723,whole:Route@30760,whole:Route@32432,whole:Route@32641,whole:Route@32980,whole:Route@32989,whole:Route@33035,whole:Route@35268,whole:Route@35827,whole:Route@36298,whole:Route@36308,whole:Route@36665,whole:Route@36672,whole:Route@36740,whole:Route@37063,whole:Route@38096,whole:Route@41047,whole:Route@45787,whole:Route@47373,whole:Route@47418,whole:Route@47428,whole:Route@48298,whole:Route@49325,whole:Route@54791,whole:Route@54939,whole:Route@56036,whole:Route@56395,whole:Route@56777,whole:Route@61551,whole:Route@62136,whole:Route@62186 be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17
@legacy da695cf047ad1ddad8d36bfc6ab71bae2afe595233e3628f4e990b10d3221950 internal/provision/seed.go SeedAbortBecause legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the console (cmd/console serve under console.service, user carlos-console): the record transition the --from door aborts a seed with, recording its reason;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (carried from Task 3's review): after the open-run refusal, an import's abort is also refused while the record carries a session marker (rec.Interactive), with an InteractiveOpenError; a --from seed's abort is unchanged; it only refuses more, no read added file:Open@432 1b3914ea6c6e599868c2736ab21601b8f112acab9220119e633fbf7fbd4c32c2
@legacy 24888be0f70a4d2684194c7613a2b59d741ca11a60e02fba53c9bfde31e19dde interactive_cli.go consoleOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, carlos console's session Open (Process console, no argv); +file:Open is the interactive.Open type name, not os.Open; reads nothing file:Open@19,file:Open@46 049ebe355fca9a478b0598057faadc16e09fd999a72a66d1113451793af969a6
-@legacy a1626184ef7baa193d4bdc7e6b7ff9412422e6bba1e33e54245e2fa03ef0f098 interactive_cli.go openSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the CLI's session on the signed-in console (a laptop process, not root on a box): this terminal's stdin and stdout, SIGINT, SIGTERM and SIGHUP, the door's URL; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk file:Open@72 5d9326c04a8a24792b048be5201e79b9f4911077080b253c1f71f06bfcf6f25a
+@legacy 428e3c25c1d866b73ecc613e5f9a67e614b745790c0960f683029d93aff2bb4a interactive_cli.go openSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the CLI's session on the signed-in console (a laptop process, not root on a box): this terminal's stdin and stdout, SIGINT, SIGTERM and SIGHUP, the door's URL; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk Task 13 fix round 1: stdin is wrapped in newInput (fdInput, the same stdin descriptor read through select with a 100 ms timeout so the session can stop its reader); no read added, the same one site file:Open@72 35c4382b05ef131c2d37d834283f70adb78e7e782b7b540889599b8b9e6c19e8
@legacy e7ca33cf58d42da56c8188ae94fac7d96977a887da9297a76eb12c744c7a8bdc interactive_cli.go runSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, carlos run -it's and carlos console's session: refuses without a terminal, dials the console's session door once and runs the session; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk file:Open@101 c425502da54fbda621c3b5f5815be77dfe1a6abcc4902950c9537a7508f32515
-@legacy 308c5d85c033edbfa3825681bcda31bf4cec04c0e376f59a3a3292c11e5b71b4 interactive_cli.go session.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the session's bridge once the command starts: +file:Read is the CLI's own stdin (the user's keyboard, 4 KiB a read) sent as KindData, and the window's size sent as KindResize; opens and reads no file file:Read@197 31f33c35e49798d668f6cf3c174f672ca5ba4f05cd80148bab3071580412cb24
+@legacy 4503db4f8b5da340c5cc8c5227815d37743851ba4abfd7c8f00160a94bb6eeeb interactive_cli.go session.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the session's bridge once the command starts: +file:Read is the CLI's own stdin (the user's keyboard, 4 KiB a read) sent as KindData, and the window's size sent as KindResize; opens and reads no file Task 13 fix round 1: the copier is owned: s.copier is closed when it returns and the session's end waits for it; its +file:Read is still the CLI's own stdin (now a sessionInput, fdInput on a real terminal); same one site file:Read@253 0a4a3816de79f8c813a27c4e5193963bd79b302788ae498b590b3e0808d0c639
@legacy ad71a5528842b791edc2554f9745237dee53acef5d01dadcf02268b644d4ea5a interactive_cli.go sessionOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, fills the Open's terminal type from $TERM and its size from the terminal; +file:Open is the interactive.Open type name, not os.Open; reads nothing from disk file:Open@132,file:Open@22,file:Open@55 0eeb82605a87c4aa513fd9f3ec5f3219596c093eb1004bd90af54832d6f65e15
-@legacy 77a911e2fed247b0ab08334fc3651958e4006113231f29311a439b22714ed4b9 interactive_cli.go type session legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, one dialled session's state; +file:Open is the interactive.Open field type, not os.Open; reads nothing file:Open@135 30b87bb4940706d930a06a0c6409e569b11a42087b630e031d04b1889c5f80e9
+@legacy b07b7ea673e9a37164c38ce626e79cde4042a166b4b829dd3c78bc245d3e23a3 interactive_cli.go type session legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, one dialled session's state; +file:Open is the interactive.Open field type, not os.Open; reads nothing Task 13 fix round 1: gains the restore-succeeded and diagnostic flags and the copier's done channel, all in memory; reads nothing file:Open@135 0b289a8c835afd6ac0f84f89af48b7a0c70432012a770cf43ddb40bf23127613
+@legacy 50eb937207a81e4bb9968b5040fc1a7fb22d50816d059eb8677d2449f6537159 interactive_term_unix.go fdInput.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13 fix round 1: new, the CLI's stdin on linux and macOS (a laptop process): select(2) on the stdin descriptor with a 100 ms timeout and its stop flag, then read(2) of what is ready; the two +file:Read sites are unix.Read of that descriptor and the method's own name; opens nothing file:Read@19,file:Read@517 267e1318c37217d0b39c9e3eac1183aa993e98917a6b46c9ffeb155c74922db0
@legacy 432e0850cbdf6796ff4582bada35e5617292317b50f822fb18896cd64819f35e internal/activator/backend_rootfs.go ExecBackend.KillOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a (Call A1), new: a rootfs row only (else errOneShotKillBinary) and a one-shot role only (cmd or tty): StopRootfs(host, role, 0, no worker, kill) to root's existing /stop on DeadlineControl, then waitRoleCgroupEmpty (unitEvents on the role's rootfs unit) on roleEmptyBound; nil is the proof; the registry:Host sites are log and error text and the host passed to root, which names the unit from its own validated host; fix round 2: root's kill waits on oneShotKillControlBound, a package var equal to DeadlineControl (30 s) so a test can shrink it, in place of the constant; the same budgets, the same reads registry:Host@1023,registry:Host@154,registry:Host@279,registry:Host@374,registry:Host@433,registry:Host@559,registry:Host@657,registry:Host@716,registry:Host@954,whole:Route@877 8168e9fc15e050df81837e7a66e6d20feed7df36639d119f14824c8be3bcbad5
@legacy 6f89b17e52b3166bcee93563263c4d66854ff60dab0dc6fecbca8a4f08b352a5 internal/activator/backend_rootfs.go ExecBackend.startRootfsRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: StartCmd's rootfs arm: refuses a run with no serving image (errNoCmdExe) or a partial one (errPartialStagedIdentity), both marked, and one with no launch environment (errNoGenEnv); asks replicaKeyGate; composes rootfsCmdVars over the generation's launch environment and the row's dbPath; then startRootfsCmd with the operator's argv exactly as given; root validates the image by digest and runs the argv inside the instance's namespace; the registry:Host sites are error text; Plan 6 Task 8: also a session rootfs arm: the same serving-image, partial-identity, launch-environment and replica-key refusals first; with spec.TTY set it composes rootfsTTYVars (no run id or directory; TERM and CARLOS_SESSION_ID) and starts startRootfsCmd in the tty role with spec.Process (console) or spec.Args, else rootfsCmdVars and the cmd role as before; +whole:Route x2 are rt to rootfsTTYVars and the dbPath read once for both registry:Host@192,registry:Host@450,registry:Host@587,whole:Route@1013,whole:Route@1160,whole:Route@1240,whole:Route@773,whole:Route@872,whole:Route@930 62055615354e08d3c3ca91486ab3e0604367a1f013e263984df2962dafcf26b3
@legacy c6d7609e34806d3c51e249713109f3bb9bae3c0645d4b6bf9f8190e48f9ce88b internal/activator/backend_unit.go SplitBackend.KillOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: forwards KillOneShot by pick(rt), as KillGen does; a half without it refuses (errOneShotKillBinary); reads only the route registry:Host@219,whole:Route@123,whole:Route@286 59823fbe5e35c5b54e0843a681ad59f684bd28e3a8315c1571198b3e5c43d3ee
@@ -54,7 +55,7 @@
@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
@legacy 8e00efef4ecab3057d44b14e01fba5aa93e5359ba841c4fea91b57487481202f internal/instanceexec/tty_linux.go receivePTY legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7 (PF-9), new: the trampoline's tty role, run by instance-exec [--rootfs] tty %I as carlos inside the instance's namespace (never root): one recvmsg on its own stdin (the tty unit's StandardInput= socket to the agent), exactly the hello carlos-tty/1 and exactly one SCM_RIGHTS fd (received close-on-exec), else refused with every received fd closed; the one Fstat is of that received fd, which must be a character device of a Unix98 pty slave major (136-143) that answers TCGETS, else refused and closed; it opens, runs and follows no path; the fd becomes only the tenant's stdio and controlling terminal (runTTYInit through runInitChecked, which closes the init's copy after the fork); no root process reads anything new file:Fstat@1454 1099af8a1dc0732b74afbe42bc45ccce6df3db9662ff7dc41f278e2bd4a274ce
@legacy 18a10bcf3209d920c99f0a72c8f96a25be52f391b0d37190d6ed5a31a1427f80 internal/interactive/frames.go Receive legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: package interactive enters the root binary's scope, unchanged (Task 2, reviewed there), because the agent's session worker imports it; Receive reads one WebSocket frame from a connection the agent dialed (file:ReadAll is the frame header reader); nothing root reads file:ReadAll@349 eb3c090baaf5cbdd95d4fc687533d9bc8718a09f2c825dd17aaac560fe7d4258
-@legacy 73e30cba17a190ceb15d043b51f71cd71efced333803bfb166114eedc79d85eb internal/interactive/frames.go handshakeRecorder.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); records the dial's handshake response bytes from the agent's own connection; nothing root reads file:Read@28,file:Read@69 b7a9a92dbc3123e7dce85de78e6a0a9a8c522affb4b66fce729493b85e305062
+@legacy a68652c46c3ef0eb4cec9e642b3566f18a9b3c6e155ba40746ea6969594a51b7 internal/interactive/frames.go handshakeRecorder.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); records the dial's handshake response bytes from the agent's own connection; nothing root reads Task 13 fix round 1: before the upgrade is done, reads at most maxHandshake (MaxRefusalBody plus 16 KiB) in all and then fails, so x/net's drain of a refusal body ends by size; after it, reads straight through; the two +file:Read sites are the dial's own connection; nothing root reads file:Read@198,file:Read@28,file:Read@83 69886b3c8b1924a36d2394cda30c9c348cd614c8de0b581af783f5004a19d88d
@legacy ca862879163cf63d6800084a42b6b474ef389d2eca6be5bb44f9e19130a449a3 internal/interactive/frames.go readRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, DialFrame's refusal before the upgrade read again from the handshake recorder's in-memory copy (http.ReadResponse over a bytes.Reader); +file:ReadAll is io.ReadAll of that response's body, bounded at MaxRefusalBody; touches no file and no socket file:ReadAll@226 16f69d301f88fc1e79b7fa6d1aae9a2d47e1fc5ca444c1347cfbc123890681f7
@legacy 58fd6f7a9276687c44512a2acc415fc5c89a4f5a9779edf0786e02c2eafca6f5 internal/interactive/grant.go MintToken legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); reads crypto/rand for a console token (the console's caller; the agent never calls it); nothing root reads file:Read@90 3a68f4541e11c18dd6367555a260565a152d0f175e43f763ea70e788e337f094
@legacy 0d7bb9ecaf1ac28bc128a6507aeb0ca47bd5575f64b0410e20f396887fd4cbc7 internal/interactive/interactive.go Open.Check legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); validates the Open frame's fields in memory; file:Open is the type's name; nothing root reads file:Open@8 85e0b6d5317672f9e959d6cb2640de6e28d48eb333f2a6ce1e5557e15cc32b22
@@ -93,11 +94,12 @@ internal/layout/plan.go NestedPlatformNames legacy accepted-legacy accepted-lega
internal/provision/reconcile.go Reconcile legacy accepted-legacy accepted-legacy;rev3=census-ruling-self-serve-moves-1;basis=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos), from its reconcile loops: each listed record is observed through the box's lifetime judge (ObserveWith: the record, then its host incarnation slot) before the shape, channel and scope checks, a stale record is left out and an unjudgeable one protected; the removal phase observes a row's own record key when the pass holds none for it under that key, and deletes a held row whose record is gone or stale through DeleteIfHold; a nil judge (claims on) is main's body; registry read sites unchanged, offsets moved; fix round 1: the removal phase observes a row's own key only under an account the listing trusts, so a retired or unmaterialised account's row keeps record gone, and the pass arms its own context with the judge; Task 7: under a judge an existing provisioned row of the record's own app and account follows the existing-row rules (heldByVanishedPredecessor and retireHeldPredecessor's DeleteIfHold first, the record then minted on the same pass; the hold; installRowLifetime), each a separate write under the host's hold lock; registry read sites unchanged, offsets moved;rev3=census-ruling-instance-egress-sizes-328-329;identity=the agent (/opt/carlos/carlos agent, carlos-edge.service, user carlos);basis=#328/#329 plan 1 Task 7: the pass reads its apps' policy objects (control/app-policy/<sqid>/<app>.json in the bucket) through the agent's PolicyCache, each verified with ReleasePub by apppolicy.VerifyKey (ed25519 over the policy's own domain line, bound to the account and app, unexpired, not future-dated; anything else is no policy), and carries the columns into its rows. New kinds registry:EgressAllow, registry:Size and registry:PolicyExpiresAt, one site each, all the assignment of a fresh row's columns (nr) from policies.cols; plus one whole:Route site, the existing row handed to policies.forRow. Other read sites unchanged, offsets moved; the agent's own pass, no root decision;rev3=census-ruling-region-ha-p1a;basis=the agent as carlos, from its reconcile loops: after the scan, hands the in-scope records to cfg.Lifetimes (the box's lifetime index): Merge after a failed read or partial listing, Replace after a complete one, nothing on a dry run or with no index; the scan, judge and removal phases unchanged; the same 166 sites, no read added;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 2 and 5 (D5, spec §5.0): a seeded record over a row with a runtime is skipped and logged; a row with a runtime (or a new record with one) takes no seed; runtime and a rootfs row's hibernation are never converged from a record (a mismatch is logged; a record claiming a runtime its row lacks is not applied); reads Runtime of the record and the row; the box writes less; fix wave 1 (ceea6353, whole-branch P1-2): before minting a row for a record with no runtime and no row (both mint paths), the pass reads the app's kind marker once per app per pass (release.ReadAppKindMarker: one GET of the create-only kind.json from the release store s, through freshStore, validated by readAppKindMarker); a rootfs marker leaves the record unmaterialized and logged (an older console stripped its runtime), and a marker that cannot be read defers the mint this pass; a refusal before minting only, registry read sites unchanged, the box writes less; fix wave 2 (whole-branch r2 P1): the kind-marker read and its refusal apply only to a socket-backed instance record (DerivesPaths), so a static or upstream-backed record of a rootfs app, which carries no runtime by design, is minted as before with no read; fewer reads, registry read sites unchanged;rev3=census-ruling-fleet-public-routes;basis=fleet public routes (spec 2026-10-29 rev 4, §4.2 writer rule): Task 10: the forward phase on the hub (FleetOwners set): the scan keeps the fleet-placed records it skips and counts records per host; a trash-only marker prefetch; disputed (failed-GET) hosts; armed, a host an in-scope and a fleet record both name is given neither, its journal waits and the removal phase keeps its row (+registry:Account, +registry:App, +registry:Host x2: the collision guard, its log line and report mark); the instance loop leaves a forward host; retirable excludes forward rows. Same record keys; writes only the registry (PutForward, DeleteForward); no bucket write.;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 3: in the per-record loop, beside the RunSeen call, calls cfg.InteractiveSeen(rec) when the hook is set and the in-scope record carries an interactive-session marker (rec.Interactive != nil), once per record per pass, before the pass acts on it; the hook is the box worker's non-blocking note (Task 12). Same record keys and literal; no read added (registry read sites unchanged, 178); nothing written by the call registry:Account@36233,registry:Account@37498,registry:Account@55577,registry:Account@55623,registry:Account@56467,registry:Account@56844,registry:Account@57070,registry:Account@57137,registry:Account@57183,registry:Account@57276,registry:Account@57318,registry:Account@57966,registry:Account@58224,registry:Account@58764,registry:Account@58812,registry:Account@59185,registry:Account@59231,registry:Account@59476,registry:Account@59901,registry:Account@60389,registry:Account@61125,registry:Account@61318,registry:Account@61664,registry:Account@62229,registry:App@36206,registry:App@37471,registry:App@55597,registry:App@55635,registry:App@56479,registry:App@56856,registry:App@57082,registry:App@57157,registry:App@57195,registry:App@57296,registry:App@57978,registry:App@58236,registry:App@58776,registry:App@58824,registry:App@59205,registry:App@59243,registry:App@59488,registry:App@59913,registry:App@60401,registry:App@61137,registry:App@61330,registry:App@61676,registry:App@62241,registry:ClaimOwnership@36820,registry:DBPath@45677,registry:DBPath@45692,registry:DBPath@45938,registry:DBPath@46541,registry:DBPath@46554,registry:EgressAllow@35319,registry:Gate@42022,registry:Gate@42162,registry:Gate@42449,registry:Hibernate@40694,registry:Hibernate@40892,registry:Hibernate@40957,registry:Hibernate@41296,registry:Hibernate@41647,registry:Hibernate@41957,registry:HoldOp@60870,registry:HoldOp@60961,registry:HoldOp@61096,registry:HoldOp@61472,registry:Host@26327,registry:Host@55556,registry:Host@56443,registry:Host@56820,registry:Host@56984,registry:Host@57090,registry:Host@57986,registry:Host@58192,registry:Host@59068,registry:Host@59340,registry:Host@59455,registry:Host@59778,registry:Host@59875,registry:Host@60266,registry:Host@60363,registry:Host@60577,registry:Host@60952,registry:Host@61087,registry:Host@61291,registry:Host@61364,registry:Host@61463,registry:Host@61638,registry:Host@61713,registry:Host@61799,registry:Host@62206,registry:Kind@36962,registry:Kind@37225,registry:Kind@45595,registry:Kind@45608,registry:Kind@45718,registry:Kind@45731,registry:Kind@46452,registry:Kind@46463,registry:Kind@54680,registry:Kind@60568,registry:Kind@61078,registry:Kind@61454,registry:Kind@61629,registry:Kind@61790,registry:PolicyExpiresAt@35344,registry:Pool@54766,registry:Provisioned@36182,registry:Provisioned@37447,registry:Provisioned@54725,registry:RateLimit@42535,registry:RateLimit@42686,registry:RateLimit@42973,registry:Region@54755,registry:Replication@41381,registry:Replication@41508,registry:Runtime@28984,registry:Runtime@29162,registry:Runtime@31367,registry:Runtime@40061,registry:Runtime@40115,registry:Runtime@40319,registry:Seed@44075,registry:SeedSource@43558,registry:Size@35335,registry:Socket@45643,registry:Socket@45658,registry:Socket@45955,registry:Socket@46511,registry:Socket@46524,registry:Unit@45561,registry:Unit@45574,registry:Unit@46478,registry:Unit@46489,whole:ClaimOwnership@36823,whole:ClaimOwnership@36840,whole:Route@26309,whole:Route@26320,whole:Route@26338,whole:Route@27619,whole:Route@29479,whole:Route@29486,whole:Route@29526,whole:Route@29887,whole:Route@30225,whole:Route@30672,whole:Route@30723,whole:Route@30760,whole:Route@32432,whole:Route@32641,whole:Route@32980,whole:Route@32989,whole:Route@33035,whole:Route@35268,whole:Route@35827,whole:Route@36298,whole:Route@36308,whole:Route@36665,whole:Route@36672,whole:Route@36740,whole:Route@37063,whole:Route@38096,whole:Route@41047,whole:Route@45787,whole:Route@47373,whole:Route@47418,whole:Route@47428,whole:Route@48298,whole:Route@49325,whole:Route@54791,whole:Route@54939,whole:Route@56036,whole:Route@56395,whole:Route@56777,whole:Route@61551,whole:Route@62136,whole:Route@62186 be1b699f14a2f8d6935d959dee168bdf6fb556cd78da458f5ba8a1c0e8512a17
internal/provision/seed.go SeedAbortBecause legacy accepted-legacy accepted-legacy;rev3=census-ruling-seeded-instances;basis=the console (cmd/console serve under console.service, user carlos-console): the record transition the --from door aborts a seed with, recording its reason;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 9 (carried from Task 3's review): after the open-run refusal, an import's abort is also refused while the record carries a session marker (rec.Interactive), with an InteractiveOpenError; a --from seed's abort is unchanged; it only refuses more, no read added file:Open@432 1b3914ea6c6e599868c2736ab21601b8f112acab9220119e633fbf7fbd4c32c2
interactive_cli.go consoleOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, carlos console's session Open (Process console, no argv); +file:Open is the interactive.Open type name, not os.Open; reads nothing file:Open@19,file:Open@46 049ebe355fca9a478b0598057faadc16e09fd999a72a66d1113451793af969a6
-interactive_cli.go openSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the CLI's session on the signed-in console (a laptop process, not root on a box): this terminal's stdin and stdout, SIGINT, SIGTERM and SIGHUP, the door's URL; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk file:Open@72 5d9326c04a8a24792b048be5201e79b9f4911077080b253c1f71f06bfcf6f25a
+interactive_cli.go openSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the CLI's session on the signed-in console (a laptop process, not root on a box): this terminal's stdin and stdout, SIGINT, SIGTERM and SIGHUP, the door's URL; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk Task 13 fix round 1: stdin is wrapped in newInput (fdInput, the same stdin descriptor read through select with a 100 ms timeout so the session can stop its reader); no read added, the same one site file:Open@72 35c4382b05ef131c2d37d834283f70adb78e7e782b7b540889599b8b9e6c19e8
interactive_cli.go runSession legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, carlos run -it's and carlos console's session: refuses without a terminal, dials the console's session door once and runs the session; +file:Open is the interactive.Open parameter type, not os.Open; reads nothing from disk file:Open@101 c425502da54fbda621c3b5f5815be77dfe1a6abcc4902950c9537a7508f32515
-interactive_cli.go session.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the session's bridge once the command starts: +file:Read is the CLI's own stdin (the user's keyboard, 4 KiB a read) sent as KindData, and the window's size sent as KindResize; opens and reads no file file:Read@197 31f33c35e49798d668f6cf3c174f672ca5ba4f05cd80148bab3071580412cb24
+interactive_cli.go session.bridge legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, the session's bridge once the command starts: +file:Read is the CLI's own stdin (the user's keyboard, 4 KiB a read) sent as KindData, and the window's size sent as KindResize; opens and reads no file Task 13 fix round 1: the copier is owned: s.copier is closed when it returns and the session's end waits for it; its +file:Read is still the CLI's own stdin (now a sessionInput, fdInput on a real terminal); same one site file:Read@253 0a4a3816de79f8c813a27c4e5193963bd79b302788ae498b590b3e0808d0c639
interactive_cli.go sessionOpen legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, fills the Open's terminal type from $TERM and its size from the terminal; +file:Open is the interactive.Open type name, not os.Open; reads nothing from disk file:Open@132,file:Open@22,file:Open@55 0eeb82605a87c4aa513fd9f3ec5f3219596c093eb1004bd90af54832d6f65e15
-interactive_cli.go type session legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, one dialled session's state; +file:Open is the interactive.Open field type, not os.Open; reads nothing file:Open@135 30b87bb4940706d930a06a0c6409e569b11a42087b630e031d04b1889c5f80e9
+interactive_cli.go type session legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, one dialled session's state; +file:Open is the interactive.Open field type, not os.Open; reads nothing Task 13 fix round 1: gains the restore-succeeded and diagnostic flags and the copier's done channel, all in memory; reads nothing file:Open@135 0b289a8c835afd6ac0f84f89af48b7a0c70432012a770cf43ddb40bf23127613
+interactive_term_unix.go fdInput.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13 fix round 1: new, the CLI's stdin on linux and macOS (a laptop process): select(2) on the stdin descriptor with a 100 ms timeout and its stop flag, then read(2) of what is ready; the two +file:Read sites are unix.Read of that descriptor and the method's own name; opens nothing file:Read@19,file:Read@517 267e1318c37217d0b39c9e3eac1183aa993e98917a6b46c9ffeb155c74922db0
internal/activator/backend_rootfs.go ExecBackend.KillOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a (Call A1), new: a rootfs row only (else errOneShotKillBinary) and a one-shot role only (cmd or tty): StopRootfs(host, role, 0, no worker, kill) to root's existing /stop on DeadlineControl, then waitRoleCgroupEmpty (unitEvents on the role's rootfs unit) on roleEmptyBound; nil is the proof; the registry:Host sites are log and error text and the host passed to root, which names the unit from its own validated host; fix round 2: root's kill waits on oneShotKillControlBound, a package var equal to DeadlineControl (30 s) so a test can shrink it, in place of the constant; the same budgets, the same reads registry:Host@1023,registry:Host@154,registry:Host@279,registry:Host@374,registry:Host@433,registry:Host@559,registry:Host@657,registry:Host@716,registry:Host@954,whole:Route@877 8168e9fc15e050df81837e7a66e6d20feed7df36639d119f14824c8be3bcbad5
internal/activator/backend_rootfs.go ExecBackend.startRootfsRun legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: StartCmd's rootfs arm: refuses a run with no serving image (errNoCmdExe) or a partial one (errPartialStagedIdentity), both marked, and one with no launch environment (errNoGenEnv); asks replicaKeyGate; composes rootfsCmdVars over the generation's launch environment and the row's dbPath; then startRootfsCmd with the operator's argv exactly as given; root validates the image by digest and runs the argv inside the instance's namespace; the registry:Host sites are error text; Plan 6 Task 8: also a session rootfs arm: the same serving-image, partial-identity, launch-environment and replica-key refusals first; with spec.TTY set it composes rootfsTTYVars (no run id or directory; TERM and CARLOS_SESSION_ID) and starts startRootfsCmd in the tty role with spec.Process (console) or spec.Args, else rootfsCmdVars and the cmd role as before; +whole:Route x2 are rt to rootfsTTYVars and the dbPath read once for both registry:Host@192,registry:Host@450,registry:Host@587,whole:Route@1013,whole:Route@1160,whole:Route@1240,whole:Route@773,whole:Route@872,whole:Route@930 62055615354e08d3c3ca91486ab3e0604367a1f013e263984df2962dafcf26b3
internal/activator/backend_unit.go SplitBackend.KillOneShot legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a, new: forwards KillOneShot by pick(rt), as KillGen does; a half without it refuses (errOneShotKillBinary); reads only the route registry:Host@219,whole:Route@123,whole:Route@286 59823fbe5e35c5b54e0843a681ad59f684bd28e3a8315c1571198b3e5c43d3ee
@@ -121,7 +123,7 @@ internal/host/units/carlos-instance-tty@.service external legacy accepted-legacy
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
internal/instanceexec/tty_linux.go receivePTY legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7 (PF-9), new: the trampoline's tty role, run by instance-exec [--rootfs] tty %I as carlos inside the instance's namespace (never root): one recvmsg on its own stdin (the tty unit's StandardInput= socket to the agent), exactly the hello carlos-tty/1 and exactly one SCM_RIGHTS fd (received close-on-exec), else refused with every received fd closed; the one Fstat is of that received fd, which must be a character device of a Unix98 pty slave major (136-143) that answers TCGETS, else refused and closed; it opens, runs and follows no path; the fd becomes only the tenant's stdio and controlling terminal (runTTYInit through runInitChecked, which closes the init's copy after the fork); no root process reads anything new file:Fstat@1454 1099af8a1dc0732b74afbe42bc45ccce6df3db9662ff7dc41f278e2bd4a274ce
internal/interactive/frames.go Receive legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: package interactive enters the root binary's scope, unchanged (Task 2, reviewed there), because the agent's session worker imports it; Receive reads one WebSocket frame from a connection the agent dialed (file:ReadAll is the frame header reader); nothing root reads file:ReadAll@349 eb3c090baaf5cbdd95d4fc687533d9bc8718a09f2c825dd17aaac560fe7d4258
-internal/interactive/frames.go handshakeRecorder.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); records the dial's handshake response bytes from the agent's own connection; nothing root reads file:Read@28,file:Read@69 b7a9a92dbc3123e7dce85de78e6a0a9a8c522affb4b66fce729493b85e305062
+internal/interactive/frames.go handshakeRecorder.Read legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); records the dial's handshake response bytes from the agent's own connection; nothing root reads Task 13 fix round 1: before the upgrade is done, reads at most maxHandshake (MaxRefusalBody plus 16 KiB) in all and then fails, so x/net's drain of a refusal body ends by size; after it, reads straight through; the two +file:Read sites are the dial's own connection; nothing root reads file:Read@198,file:Read@28,file:Read@83 69886b3c8b1924a36d2394cda30c9c348cd614c8de0b581af783f5004a19d88d
internal/interactive/frames.go readRefusal legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 13: new, DialFrame's refusal before the upgrade read again from the handshake recorder's in-memory copy (http.ReadResponse over a bytes.Reader); +file:ReadAll is io.ReadAll of that response's body, bounded at MaxRefusalBody; touches no file and no socket file:ReadAll@226 16f69d301f88fc1e79b7fa6d1aae9a2d47e1fc5ca444c1347cfbc123890681f7
internal/interactive/grant.go MintToken legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); reads crypto/rand for a console token (the console's caller; the agent never calls it); nothing root reads file:Read@90 3a68f4541e11c18dd6367555a260565a152d0f175e43f763ea70e788e337f094
internal/interactive/interactive.go Open.Check legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 12: enters scope unchanged with package interactive (Task 2); validates the Open frame's fields in memory; file:Open is the type's name; nothing root reads file:Open@8 85e0b6d5317672f9e959d6cb2640de6e28d48eb333f2a6ce1e5557e15cc32b22
@@ -136,13 +138,13 @@ internal/activator/cmdunit.go cmdUnit.Poll legacy accepted-legacy accepted-legac
internal/activator/rootfs_service.go Service.rootfsTick legacy accepted-legacy accepted-legacy;rev3=census-ruling-rootfs-apps-3;basis=rootfs Plan 3 Tasks 7 and 8: per activator tick, lists residents (Registry.ResidentInstances through the DueStore), and for each rootfs entry kills generations whose replica reports a lost lease with no watch installed, stops an exited rootfs process (StopExited), and supervises; then drops forgotten residents and reserves proactive starts (residentJob) for resident-shaped, unheld rows within the start ceiling after the locked admission;rev3=census-ruling-rootfs-apps-3-workers;basis=rootfs Plan 3 Group W, W1.10: when the tick kills a lost-lease resident's generations it also starts stopRootfsWorkersAtLoss(e) beside them; superviseRootfsLocked (a no-op in Group A) is now the worker supervision; the same 15 read sites, no read added; stops more, starts nothing new on its own;rev3=census-ruling-rootfs-apps-6;basis=rootfs Plan 6 Task 7a: the no-signal fallback also covers a hibernating rootfs entry with a one-shot unit that may run (oneShotHoldsLocked); it latches ownerKilled and runs each one-shot kill func (KillOneShot to root's existing /stop) with go off a.mu, beside a resident's killResidentGens and stopRootfsWorkersAtLoss as before; new site +whole:Route is e.route.Rootfs(); stops more, starts nothing registry:Host@1842,registry:Host@2071,registry:Host@2427,whole:Route@113,whole:Route@1200,whole:Route@1795,whole:Route@1824,whole:Route@1993,whole:Route@2024,whole:Route@2106,whole:Route@2271,whole:Route@2320,whole:Route@2465,whole:Route@397,whole:Route@803,whole:Route@824 de44f5578a049a224f06a302863752c3a4ff53767478a54d08e373db018efe82
@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 . d48fbe9eb3725bd8745382798854d8ef94eed2352e46f77da6beeeae4618c154
+@coverage . f1f5e77164e82e841c1e24274d24425a0f028b848d187e66d2e4a709ff65d21b
@coverage internal/activator 72f34fc88388e97bbd0d84d0256f409ca6931af0b6127ebb7895b01a02f2e73d
@coverage internal/appconfig cac8d8ef7538a456d034801c95ce6508a4983e5516b3bbbd302bec0fbafdd479
@coverage internal/host 5fa4abbdabdf0d6816ab3e589fd563fe9291b5921fe529cb2383adf0497937b1
@coverage internal/host/units c3cc4f3b917fdb938f20d406b1704ec54e24553851c298e312056d397d10b0e1
@coverage internal/instancectl 096e845eb71478e8b68726160cff450f8ba850869dae65582dabd25f445527e9
@coverage internal/instanceexec 65f6db1c6bf469f1d19615ec989f54c20de3b73c3c03ae2d677cffbcc60470fd
-@coverage internal/interactive 9cf637e7fd08dbf499f7c4d6d1eb59e83244a83aababd1bc49584904d7b3203f
+@coverage internal/interactive 8a1ebe32f890f25463971e662aa33a380fc6d484fee0392ec819d5dc7bd532a3
@coverage internal/layout 1527c3b31d87743798002b1ebefcd2cb0dc422a8642f72a3ff8dbefbd2c84d9b
@coverage internal/provision b987b9c81cae353279ac80747047e3b29783643bfe39c67167a535f3fd529254