gvisor: probe failure log reads only its own attempt's journal
After ef8371cb, a gvisor box still logged 16 "carlos-instance-gvisor- probe.service: no ExecStart= Refusing" lines at instance-control start (v0.34.38, dev demo box-1, 07:35:10-21Z). They were not new events: each failed probe logged `journalctl --lines=20` of the probe unit, whose tail replays earlier attempts, including pre-fix Refusing lines. The dump now runs only once the probe asked systemd to start the unit, and only with --since=@<this attempt's start>. A failure before the start (the update's first probe failing the baseline) logs its verdict line alone. The flow test covers every fault both ways. Census re-proposed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+53
−5
docs/superpowers/notes/census-proposal-gvisor-probe-diag.md+19 −0internal/instancectl/gvisorprobe.go+11 −2internal/instancectl/gvisorprobe_flow_linux_test.go+17 −3internal/provision/testdata/plan14-root-reads-chain.tsv+1 −0internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv+5 −0
CI passed — run details
diff --git a/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md b/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md| new file mode 100644 |
| index 000000000..1d96383e1 |
| --- /dev/null |
| +++ b/docs/superpowers/notes/census-proposal-gvisor-probe-diag.md |
| @@ -0,0 +1,19 @@ |
| +# Census approval: gvisor-probe-diag |
| + |
| +Ruling `census-ruling-gvisor-probe-diag`. The independent reviewer approves or rejects every change below, 0 with a new disposition; nothing goes to the census owner (Paul, #280, 2026-10-26). |
| + |
| +| unit | change | read sites | what changed | |
| +|---|---|---|---| |
| +| `internal/instancectl/gvisorprobe.go` `Server.runGVisorProbe` | body | unchanged (4) | Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. | |
| + |
| +Envelopes re-pinned: `internal/instancectl`. |
| + |
| +Review: a model from the other family than the author reads the branch's diff against main on the amadan.net remote (`origin` or `amadan`, whichever points at amadan.net) and gives a verdict for every unit and every re-pinned envelope above. For a unit, compare the change with its recorded disposition and basis below; for an envelope, read every changed function in the package and what it reaches. Reject if the change lets root open, run, query or follow anything it did not before from a path or input a tenant, an app or a box agent can create, write or name; if it weakens a check, refusal, validation, argument or environment the basis relies on; or if the diff cannot settle either. Otherwise approve. Record each verdict on #280 with the tip. A rejected unit goes back to the author to correct; nothing escalates to the census owner. |
| + |
| +Recorded dispositions, which each change must still satisfy: |
| + |
| +- `internal/instancectl/gvisorprobe.go` `Server.runGVisorProbe`: legacy, task accepted-legacy. Basis: accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1, applying the controller rulings: serialized probe construction uses root random nonce/fixed paths, root-only O_EXCL fixture, abstract listener, typed verified bundle/unit and context recheck. Read bounded root-owned nonce-bound output and the guest socket handshake; inspect kernel/proc runtime and limits while guest waits. Termination uses inactive/not-loaded state, no job/PIDs and empty cgroup, never per-command stop-post records. Keep the prior pass during the run and publish report plus runtime identity once, after cleanup; any failed attempt invalidates it and records the bounded diagnostic. A private package-test-only operations struct substitutes paths, executable preparation and output opening; production keeps GVisorProbePaths, fixed output/procfs, ensureExe and execsandbox.OpenRootFile. No new tenant-controlled path, launch/source/database read, or runtime-state read. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner. |
| + |
| +Seal: `9668105384b1abd5009d76a73e37eef7f5c358eb5b08a3d1fe35f7c411e4d200` → `783b69536e061e6b11127b343b603cbfc3cde0868cf3f1ba91d60e26adadac84`. |
| + |
| +Overlay: `internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv`, appended to `internal/provision/testdata/plan14-root-reads-chain.tsv`. |
diff --git a/internal/instancectl/gvisorprobe.go b/internal/instancectl/gvisorprobe.go| index b40817b28..ad188d0b6 100644 |
| --- a/internal/instancectl/gvisorprobe.go |
| +++ b/internal/instancectl/gvisorprobe.go |
| @@ -155,6 +155,12 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) { |
| s.gvisorProbeMu.Lock() |
| defer s.gvisorProbeMu.Unlock() |
| var identity string |
| + // The diagnostic below reads only this attempt's journal, and only once |
| + // it has asked systemd to start the unit: the unit's journal tail holds |
| + // earlier attempts too, and replaying it at every failure (each update's |
| + // first probe on a gVisor box) re-logged old lines as if new. |
| + started := time.Now() |
| + attempted := false |
| ops := s.gvisorProbeOperations() |
| fail := func(check string, err error) ProbeReport { |
| return ProbeReport{Lines: []VerdictLine{{Check: check, Verdict: "fail", Detail: err.Error()}}} |
| @@ -169,14 +175,16 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) { |
| } |
| s.report, s.probed = report, true |
| s.mu.Unlock() |
| - if !report.Ready && s.Run != nil { |
| + if !report.Ready && s.Run != nil && attempted { |
| diag, cancel := context.WithTimeout(context.WithoutCancel(ctx), 5*time.Second) |
| defer cancel() |
| - out, err := s.Run(diag, "journalctl", "--no-pager", "--output=cat", "--lines=20", "--unit="+gvisorProbeUnit) |
| + out, err := s.Run(diag, "journalctl", "--no-pager", "--output=cat", "--lines=20", "--since=@"+strconv.FormatInt(started.Unix(), 10), "--unit="+gvisorProbeUnit) |
| if len(out) > 4096 { |
| out = out[len(out)-4096:] |
| } |
| s.logf("instance-control: gvisor probe: %s (%v)", strings.TrimSpace(out), err) |
| + } else if !report.Ready && len(report.Lines) > 0 { |
| + s.logf("instance-control: gvisor probe: not started: %s %s", report.Lines[0].Check, report.Lines[0].Detail) |
| } |
| }() |
| if _, err := s.unitFamily(s.effectiveSandbox(), roleProbe, nil); err != nil { |
| @@ -251,6 +259,7 @@ func (s *Server) runGVisorProbe(ctx context.Context) (report ProbeReport) { |
| if err = ctx.Err(); err != nil { |
| return fail("start", err) |
| } |
| + attempted = true |
| if _, err = s.Systemctl(ctx, "start", gvisorProbeUnit); err != nil { |
| return fail("start", err) |
| } |
diff --git a/internal/instancectl/gvisorprobe_flow_linux_test.go b/internal/instancectl/gvisorprobe_flow_linux_test.go| index 4c8e6ecc5..bb20025dd 100644 |
| --- a/internal/instancectl/gvisorprobe_flow_linux_test.go |
| +++ b/internal/instancectl/gvisorprobe_flow_linux_test.go |
| @@ -14,6 +14,8 @@ import ( |
| "os" |
| "path/filepath" |
| "runtime" |
| + "slices" |
| + "strconv" |
| "strings" |
| "sync" |
| "testing" |
| @@ -168,8 +170,12 @@ func newProbeFlow(t *testing.T) *probeFlow { |
| return nil |
| } |
| s.Run = func(ctx context.Context, args ...string) (string, error) { |
| - if strings.Join(args, " ") != "journalctl --no-pager --output=cat --lines=20 --unit="+gvisorProbeUnit { |
| + // Only this attempt's lines: a --since bound no earlier than the |
| + // probe's start, so a failure never replays older probes' journal. |
| + if len(args) != 6 || strings.Join(args[:4], " ") != "journalctl --no-pager --output=cat --lines=20" || args[5] != "--unit="+gvisorProbeUnit || !strings.HasPrefix(args[4], "--since=@") { |
| t.Error(args) |
| + } else if since, err := strconv.ParseInt(strings.TrimPrefix(args[4], "--since=@"), 10, 64); err != nil || time.Since(time.Unix(since, 0)) > time.Minute { |
| + t.Error("journal window not bounded to this attempt", args[4]) |
| } |
| deadline, ok := ctx.Deadline() |
| if !ok || time.Until(deadline) > 5*time.Second { |
| @@ -508,8 +514,16 @@ func TestGVisorFix1ProbeFailures(t *testing.T) { |
| if w.Code != http.StatusServiceUnavailable { |
| t.Fatal(w.Code, w.Body) |
| } |
| - if f.journals != 1 || len(f.logs) != 1 || len(f.logs[0]) > 4200 || !strings.Contains(f.logs[0], "journal-tail") { |
| - t.Fatal("diagnostic not bounded", f.journals, len(f.logs), f.logs) |
| + // The unit's journal is read only once its start was asked for; |
| + // an earlier failure logs its verdict line alone. |
| + wantJournal := 0 |
| + f.mu.Lock() |
| + if slices.Contains(f.events, "start") { |
| + wantJournal = 1 |
| + } |
| + f.mu.Unlock() |
| + if f.journals != wantJournal || len(f.logs) != 1 || len(f.logs[0]) > 4200 || strings.Contains(f.logs[0], "journal-tail") != (wantJournal == 1) { |
| + t.Fatal("diagnostic not bounded", fault, f.journals, f.runs, len(f.logs), f.logs) |
| } |
| f.s.mu.Lock() |
| token := f.s.gvisorProbeIdentity |
diff --git a/internal/provision/testdata/plan14-root-reads-chain.tsv b/internal/provision/testdata/plan14-root-reads-chain.tsv| index 41b97d8df..6913813e3 100644 |
| --- a/internal/provision/testdata/plan14-root-reads-chain.tsv |
| +++ b/internal/provision/testdata/plan14-root-reads-chain.tsv |
| @@ -150,3 +150,4 @@ plan14-root-reads-no-negative-prime-724.tsv ab10145ee873e26b87a653f728cd0c973759 |
| plan14-root-reads-gvisor-probe-retry.tsv 499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24 |
| plan14-root-reads-billing-dash-2-pages.tsv 499c08fd29787c5de2aa0197c05f82f6db0ab7760eb7d980bb24211e289e4c24 |
| plan14-root-reads-group-roll-verb.tsv 9668105384b1abd5009d76a73e37eef7f5c358eb5b08a3d1fe35f7c411e4d200 |
| +plan14-root-reads-gvisor-probe-diag.tsv 783b69536e061e6b11127b343b603cbfc3cde0868cf3f1ba91d60e26adadac84 |
diff --git a/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv b/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv| new file mode 100644 |
| index 000000000..085700ded |
| --- /dev/null |
| +++ b/internal/provision/testdata/plan14-root-reads-gvisor-probe-diag.tsv |
| @@ -0,0 +1,5 @@ |
| +# Census overlay gvisor-probe-diag, written by census-propose (#369). census-ruling-gvisor-probe-diag, approved on #280 before the merge; the approval card is docs/superpowers/notes/census-proposal-gvisor-probe-diag.md. |
| +# 1 body, 0 sites, 1 envelope: each changed unit re-frozen at its existing disposition with its claim appended. |
| +@legacy 5256984ec6774b37c1f795c054f95c4e3ec5854e380db9ff6a6614861728a505 internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1, applying the controller rulings: serialized probe construction uses root random nonce/fixed paths, root-only O_EXCL fixture, abstract listener, typed verified bundle/unit and context recheck. Read bounded root-owned nonce-bound output and the guest socket handshake; inspect kernel/proc runtime and limits while guest waits. Termination uses inactive/not-loaded state, no job/PIDs and empty cgroup, never per-command stop-post records. Keep the prior pass during the run and publish report plus runtime identity once, after cleanup; any failed attempt invalidates it and records the bounded diagnostic. A private package-test-only operations struct substitutes paths, executable preparation and output opening; production keeps GVisorProbePaths, fixed output/procfs, ensureExe and execsandbox.OpenRootFile. No new tenant-controlled path, launch/source/database read, or runtime-state read. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3082,file:OpenFile@2445,file:Read@2135,file:ReadAll@5444 f70a3fe9d3945a8b22cf32f8fafd447b5ba3d3c0c031ae3d11b4e5379f39768e |
| +internal/instancectl/gvisorprobe.go Server.runGVisorProbe legacy accepted-legacy accepted-legacy;rev3=census-ruling-gvisor-demos;basis=Task 6 fix round 1, applying the controller rulings: serialized probe construction uses root random nonce/fixed paths, root-only O_EXCL fixture, abstract listener, typed verified bundle/unit and context recheck. Read bounded root-owned nonce-bound output and the guest socket handshake; inspect kernel/proc runtime and limits while guest waits. Termination uses inactive/not-loaded state, no job/PIDs and empty cgroup, never per-command stop-post records. Keep the prior pass during the run and publish report plus runtime identity once, after cleanup; any failed attempt invalidates it and records the bounded diagnostic. A private package-test-only operations struct substitutes paths, executable preparation and output opening; production keeps GVisorProbePaths, fixed output/procfs, ensureExe and execsandbox.OpenRootFile. No new tenant-controlled path, launch/source/database read, or runtime-state read. CI fix: route serialized nonce fixture/output cleanup through existing pinned removeGenFiles owner with closed gVisor selectors and fixed probe paths. Existing reads and stop proof unchanged; no new raw removal owner.;rev3=census-ruling-gvisor-probe-diag;basis=Diagnostic only: the failure dump runs journalctl for the fixed probe unit only once a start was asked for, with --since=@<this attempt's start time>, so it no longer replays earlier attempts; a failure before the start logs its verdict line instead. No new path, input or systemctl verb; probe steps unchanged. file:Lstat@3082,file:OpenFile@2445,file:Read@2135,file:ReadAll@5444 f70a3fe9d3945a8b22cf32f8fafd447b5ba3d3c0c031ae3d11b4e5379f39768e |
| +@coverage internal/instancectl 71b1fe77cc6fc67d7394b4dc6168f926ff9917997b1018c98df780917d1c2c30 |