census: 9B8 re-digest of claimBoundTemplate; witness needs an alien fast exit
TestPlan9B8RecordWriteCensus pins the claim template's source digest; its body changed (KillMode=control-group, CARLOS_INIT_STOP), so the row moves 9ff0f840 -> f27e8b84 (same decl-span sha256 the test computes; kinds unchanged). Astra R2 P2: the witness now fails if no fast-exit start was alien.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/host/instancestop_rootrunner_linux_test.go+3 −0internal/provision/plan14_e_write_census_test.go+1 −1
CI passed — run details
Intent
<task-notification> <task-id>aa4f6b09d00fff073</task-id> <tool-use-id>toolu_01AQC7EUhmPePbjk5h2UqhRu</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/57f7b202-ce27-4792-9462-b99ef5f502c4/tasks/aa4f6b09d00fff073.output</output-file> <status>completed</status> <summary>Agent "Fix 2: #528 PrivatePIDs stop" is waiting on its own background work</summary> <note>This agent stopped with background work of its own still running. It may resume on its own when that work completes or reports, and the same task-id notifies again if it does; the result below may be interim.</note> <result>Fix 2 (#528) is not merged. I stopped under stopping rule 2 and need your ruling. The cause is found and fixed on the branch, and the real-box witness passes. Astra's second round raised a new P1 that it says belongs to the same fault family as its first, which is the point where the brief says to escalate rather than decide. **Root cause.** - With `PrivatePIDs=yes`, systemd 257 forks once more, and the parent sends the child's PID to the manager and exits. If the manager checks the PID before that parent has exited, it marks the main process "not our child" (alien). - At stop, `unit_kill_context_one()` returns 0 for an alien main. `KillMode=mixed` signals nothing else in the SIGTERM phase, so `service_enter_signal()` goes straight to SIGKILL. The app gets no grace and the unit ends `Result=signal`. - Checked in the systemd v257.9 source; upstream `main` still has this code. - Journal evidence, matching each stop result to its own start: every `signal` failure was an alien start. Demo box: 17 of 17 failures alien, 27 of 27 non-alien stops clean. sophie's generation units: 73 of 73 failures alien, 259 of 259 non-alien stops clean. **Fix on branch `instance-stop-528`** (tip `4f7a8d207234f8b6818e8e2f83f2d42d228085db`, origin/main `f4d9b095` merged in): - `KillMode=control-group` on the 11 tenant templates and `claimBoundTemplate`. systemd now signals the app directly as well, so it always has a process to wait on. - `Environment=CARLOS_INIT_STOP=cgroup` in those templates, so the trampoline doesn't forward a second SIGTERM. Astra R1 found that a double SIGTERM is a real P1: a Go app using `NotifyContext` can die mid-drain on the second. - A claims-on generation's `Retire` now sends `instancectl.RetireSignal` (SIGPWR), which the trampoline turns into one SIGTERM. - An invariant test refuses any other `KillMode` beside `PrivatePIDs=yes`, and requires the env line wherever the trampoline runs. - New unit tests cover the trampoline and the `Retire` signal. **Witness.** `TestRootInstanceStopUnderPrivatePIDs` on the root runner, run 20261108T160744-e76dbf: PASS. - With the old template restored, the race reproduces: 3 of 40 starts alien, 3 of 40 stops `Result=signal`. - With the shipped template, 40 draining stops and 40 fast-exit stops are all `Result=success`, exit 0, with exactly one SIGTERM each, alien starts included. - A retire signal drains the app on one SIGTERM. - An app that ignores SIGTERM is killed at 3.3 s with `TimeoutStopSec=3`, and every cgroup is gone or empty after its stop. - No runner instances were left running. **Reviews and census.** - Astra R1: NOT READY; its P1s and P2s are fixed. - Astra R2: NOT READY, with one new P1 and one P2: - **P1, version mixing during a roll or rollback.** An old trampoline under the new unit gives the app two SIGTERMs. A new trampoline under a rolled-back `mixed` unit gives it no SIGTERM, so it is SIGKILLed after 20 s. Astra recommends refusing up front: gate the install and the rollback until running instances have stopped under their original policy. - **P2.** The witness should require at least one alien fast-exit start. That is a one-line fix I haven't made yet. - Census: `make census-propose NAME=instance-stop-528` was re-run on the merged tree; the seal now chains after instance-syscall-filter's. Astra's cross-family verdict is APPROVE for all 12 units and all 5 envelopes, recorded on #280 for this tip. Any later tip needs a fresh census-propose and a new verdict. - CI was still running on `4f7a8d20` when I stopped. **Your data point.** It matches the code and changes nothing here: an app run as PID 1 under PrivatePIDs drops SIGTERM, which is why the templates run the trampoline as PID 1. That is a separate issue from the alien race. **What I need from you.** A ruling on the R2 P1: gate the roll as Astra suggests, accept the brief double or missing SIGTERM while a roll or rollback is in progress, or another approach. After that I'll fix the P2, re-run census-propose, do Astra R3 (the last allowed round), wait for green CI and squash-merge. There is no merged SHA yet to pass to 8a3d302. **Recorded and kept.** The root cause and status are on #528. The branch handoff and tasks 666–669 are on [instance-stop-528](https://amadan.net/carlos/platform/-/branch/instance-stop-528). Review outputs and runner logs are in `~/.cache/tmp/f528/` until the branch lands. **Commits on the branch:** - `e2e06843`: templates and invariant test - `ce423ca0`: witness - `17917e6d`: witness fixes - `a5a05cb5`: merge of origin/main - `5771a1ca`: census proposal - `4f7a8d20`: single SIGTERM and the retire signal</result> <usage><subagent_tokens>368828</subagent_tokens><tool_uses>144</tool_uses><duration_ms>5031046</duration_ms></usage> </task-notification>
<task-notification> <task-id>aa4f6b09d00fff073</task-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/57f7b202-ce27-4792-9462-b99ef5f502c4/tasks/aa4f6b09d00fff073.output</output-file> <status>completed</status> <summary>Agent "Fix 2: #528 PrivatePIDs stop" 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>That notice is about an old wait loop I'd started for Astra's first review. It hit its time limit after the review had already finished, so nothing was lost and it doesn't need restarting. My report above still stands: Fix 2 is not merged and is waiting on your ruling about the roll/rollback P1.</result> <usage><subagent_tokens>367538</subagent_tokens><tool_uses>144</tool_uses><duration_ms>5177304</duration_ms></usage> </task-notification>
Check the Fix 2 fork (branch instance-stop-528, worktree .claude/worktrees/instance-stop-528); when it reports a merged SHA, verify it on origin/main, send it to 8a3d302 (paseo send 8a3d302a-eac7-407c-b61c-f5ccc66b5544) and report to 55f1f6a; continue the brief ~/.cache/start-hardening/BRIEF.md.
Attributed to this commit: 13.0 g CO₂e (1,640,097 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on instance-stop-528, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/host/instancestop_rootrunner_linux_test.go b/internal/host/instancestop_rootrunner_linux_test.go| index df141181a..3524179c9 100644 |
| --- a/internal/host/instancestop_rootrunner_linux_test.go |
| +++ b/internal/host/instancestop_rootrunner_linux_test.go |
| @@ -394,6 +394,9 @@ func TestRootInstanceStopUnderPrivatePIDs(t *testing.T) { |
| } |
| } |
| t.Logf("verdict: fast exit: %d/%d alien, all Result=success unless an error above", fastAlien, n) |
| + if fastAlien == 0 { |
| + t.Fatalf("no start was alien in %d fast-exit cycles: the fast exit was not exercised against the race", n) |
| + } |
| // 2c. A retire signal to the main process alone: the tenant drains on |
| // one SIGTERM and the unit ends by itself. |
diff --git a/internal/provision/plan14_e_write_census_test.go b/internal/provision/plan14_e_write_census_test.go| index 6ba6fe579..85c6c7e52 100644 |
| --- a/internal/provision/plan14_e_write_census_test.go |
| +++ b/internal/provision/plan14_e_write_census_test.go |
| @@ -3,7 +3,7 @@ package provision |
| // Track E overlays the reviewed Part 1 write census without changing its baseline. |
| var plan14EWriteCensusOverlay = []censusEntry{ |
| {"internal/hostbox/journalservice.go", "journalRequestHash", "key-site", "key:RecordKey", "b6248a416cb57046d014a95b22f3798f156e0cde5aba189f5f82c36d4c7a5e78"}, |
| - {"internal/host/claimunit_template.go", "const claimBoundTemplate", "key-site", "lit:instances", "9ff0f84071165eb2d642596f1c4b28241f872fea99f7bf8e3d77f51785ad270a"}, |
| + {"internal/host/claimunit_template.go", "const claimBoundTemplate", "key-site", "lit:instances", "f27e8b84e958fb621ec875ca37ccfbedd5aecb9f13f74c8211475e27420e6700"}, |
| {"internal/hostbox/inventory_expected.go", "StopInventoryDB.writeExpected", "key-site", "key:RecordKey", "6bd77e75ff73ac8e461bb0687b183e031e2864d8455f58513b71aade995cb2b1"}, |
| {"internal/hostbox/journalservice.go", "type JournalRequest", "key-site", "key:RecordKey", "be65901745c9d840a1f6cbb7c82f2443482f85b652b7b1635f38fc0524aec38c"}, |
| {"internal/host/rootgeneration_requirements.go", "generationLocalObligations", "key-site", "key:RecordKey", "7bf08b3afdf12e81188123e0257ef90cea91091a8ab3bfb975e9a0200619dd1b"}, |