reviews: Astra round 2 on the G6 write fence plan (NOT READY, fallback A)
1 file changed,
+52
−0
docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-PLAN-R2.md+52 −0
CI cancelled — superseded by a newer push — run details
Intent
Attributed to this commit: 29.7 g CO₂e (3,622,735 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on g6-fence, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-PLAN-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-PLAN-R2.md| new file mode 100644 |
| index 000000000..41e7d4b59 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-PLAN-R2.md |
| @@ -0,0 +1,52 @@ |
| +| Round 1 finding | Disposition | |
| +|---|---| |
| +| P1-1: writes before first sample | **Resolved** — the initial nonempty WAL creates an obligation. | |
| +| P1-2: earlier lease loss suppresses fencing | **Resolved** — `Fenced()` and gate cancellation are independent of the renewer’s error. | |
| +| P1-3: queued starts escape termination | **Partly** — freezing covers an existing slice, but the absent-slice path permits execution before freezing. | |
| +| P1-4: egress restart bypass | **Partly** — the entry refusal covers later calls; an already-admitted restart retains the absent-slice escape. | |
| +| P1-5: watcher attaches too late | **Resolved** — attachment moves immediately after replication starts. | |
| +| P1-6: old fence kills new acquisition | **Resolved** — generation ordering and the operation mutex address that race. | |
| +| P2-7: coverage-reader absence/EOF handling | **Resolved** — filesystem cases now distinguish expected absence from failure. | |
| +| P2-8: CLI rail lacks wiring test | **Resolved** — the subprocess test and removal-of-call mutation exercise enforcement. | |
| + |
| +Reviewed `20c60191c32fae3fa5f1654dd961f312a6c17421`, final plan-review round 2. |
| + |
| +1. **P1 — Task 3: instance-control failure can leave PID 1 blocked indefinitely.** |
| + |
| + **Evidence:** The reaper belongs to instance control, and recovery runs only when that service starts ([plan:248](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:248), [plan:252](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:252)). Its restart depends on systemd, with `RestartSec=1` ([control service:38](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/internal/host/units/carlos-instance-control.service:38)). Instance units spawn `ExecStopPost` after termination ([generation service:38](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/internal/host/units/carlos-instance-gen@.service:38)). |
| + |
| + **Failure:** Instance control dies after freezing/killing the slice. Before its restart, systemd spawns a cleanup child into the frozen slice. PID 1 blocks waiting for that child to exec or exit. The reaper is dead, and PID 1 cannot run the restart needed to recreate it. The `/run` record survives but cannot execute recovery. The 100 ms poll offers no bound here. |
| + |
| + This follows systemd 257’s `posix_spawn_wrapper`, which combines cgroup placement with a parent-blocking spawn: [https://raw.githubusercontent.com/systemd/systemd/v257/src/basic/process-util.c](https://raw.githubusercontent.com/systemd/systemd/v257/src/basic/process-util.c). |
| + |
| + **Fix:** Take the prescribed fallback A. Retaining B would require recovery that does not depend on the blocked manager; constructing a new `Server` in the proposed restart test does not establish that property. |
| + |
| + **Fault family:** writer cessation and shared-host control-plane liveness. |
| + |
| +2. **P1 — Tasks 3–4: unfence removes the reaper while frozen children can still arrive.** |
| + |
| + **Evidence:** `handleUnfence` explicitly stops the reaper, kills once, then waits for emptiness. Timeout returns 504 while leaving the host fenced ([plan:250](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:250)). Unlike `handleFence`, this sequence specifies neither repeated kills nor reaper restoration on failure. The mandatory acquire-side unfence then fails the wake ([plan:288](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:288)). |
| + |
| + **Failure:** After the one kill, a pending start or cleanup invocation enters the still-frozen slice. The emptiness wait cannot finish, and the child can block PID 1. At timeout the reaper remains stopped. Subsequent control connections can also fail authentication because obtaining the edge’s MainPID calls `systemctl` ([peer_linux.go:74](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/internal/instancectl/peer_linux.go:74)). Repeated acquisitions do not repair this state. |
| + |
| + **Fix:** Under B, reaping would have to continue throughout unfence and every unsuccessful exit, with a repopulation-after-kill witness. That still leaves finding 1, so the concrete recommendation for this final round is fallback A. |
| + |
| + **Fault family:** writer cessation and recovery liveness. |
| + |
| +3. **P1 — Task 3: absent or unsupported freezing does not enforce ruling B.** |
| + |
| + **Evidence:** An absent slice returns successful emptiness without freezing; the reaper freezes it only after creation ([plan:224](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:224)). An unsupported freezer likewise returns 200 after a one-time kill, explicitly allowing later writers ([plan:223](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/docs/superpowers/plans/2026-11-12-g6-write-fence.md:223)). Starts already past entry admission can reach `systemctl start --no-block` later ([cmd.go:119](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/g6-fence/internal/instancectl/cmd.go:119)). |
| + |
| + **Failure:** Pause an admitted start before submission. Fence while the slice is absent, then resume the start. Systemd creates an unfrozen cgroup and the process can execute before the reaper observes creation. Inotify is notification, not an execution barrier. With no working freezer, the same escape persists after every kill. Neither case preserves “execute nothing until a newer acquisition unfences.” |
| + |
| + Linux also permits deleting an empty frozen cgroup; freezing does not preserve its lifetime. [https://docs.kernel.org/6.12/admin-guide/cgroup-v2.html](https://docs.kernel.org/6.12/admin-guide/cgroup-v2.html) |
| + |
| + **Fix:** Do not accept these outcomes as a successful B fence. B would need a barrier established before execution and preserved across cgroup recreation. Under the stated stopping rule, use fallback A and its weaker bound. The absent-slice test must permit a process to execute between creation and notification; its current assertions miss that race. |
| + |
| + **Fault family:** writer cessation; carries forward round-1 P1-3/P1-4. |
| + |
| +I would choose **fallback A**. A healthy reaper can observe nested children because cgroup population notifications propagate through descendants, but its lifecycle does not bound the box-wide systemd stall. The post-merge timing drill cannot establish recovery from a dead or stopped reaper. |
| + |
| +The queue’s principal scenarios matched their specified trip times in an in-memory transcription. I found no additional blocker in the replica-client gate, generation increment/preservation paths, or endpoint authentication. No files were changed, subagents spawned, or full test suites run. |
| + |
| +**NOT READY** |
| \ No newline at end of file |