reviews: Astra brief for the G6 write fence plan, round 2 (last)
1 file changed,
+90
−0
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN-R2.md+90 −0
CI failed — run details
Intent
diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN-R2.md| new file mode 100644 |
| index 000000000..44854e28c |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-G6-FENCE-PLAN-R2.md |
| @@ -0,0 +1,90 @@ |
| +# Review brief: G6 write fence implementation plan, round 2 of 3 (the LAST round) |
| + |
| +Repo carlos/platform, branch `g6-fence`, commit named in the reviewer's prompt. |
| +Under review: `docs/superpowers/plans/2026-11-12-g6-write-fence.md`. |
| +Authorities (MERGED on main, 8660f95a): `docs/superpowers/specs/2026-11-11-g6-write-fence-design.md` (rev 3.1), |
| +`docs/superpowers/reviews/FABLE-SPOTCHECK-G6-FENCE.md`, `CODEX-FINDINGS-G6-R1.md`, `CODEX-FINDINGS-G6-R2.md` (fence |
| +items), and `docs/superpowers/specs/2026-10-26-region-ha-without-claims-design.md` (§5.2, §5.3, §5.5, §9.8). |
| +Litestream is github.com/benbjohnson/litestream v0.5.14 in the module cache (`go env GOMODCACHE`). |
| + |
| +You are an independent reviewer. Read the plan, then the code it names (platform AND litestream/ltx sources), and check |
| +every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's ruling 2026-11-11: a holder whose replica sync fails for about 30 s stops serving (503 with Retry-After) and |
| + releases unclean. Late flush, storage fencing, batched/daily in a pool stay deferred. |
| +- Spec §3-§4 design: obligation queue, 1 s check, 30 s limit, root-side host fence covering all seven roles, slice |
| + SIGKILL, unclean release, rail refusing batched/daily on HA routes. Report only mechanisms in the plan that fail to |
| + honour the spec or would not work. |
| +- Copy: user/operator strings are COPY-PENDING placeholders until Paul approves them (Task 7). Do not review wording. |
| +- Another branch (ha-unclean-marker-waits) makes an unclean marker wait for lease expiry; it is out of scope here. |
| + |
| +## What to check |
| + |
| +1. **The plan departs from the spec in one mechanism** (plan "Spec corrections" 4): instead of |
| + `Replica.MonitorEnabled = false` + `Replica.Stop(true)` at the latch it puts a gate on the replica client that cancels |
| + in-flight replica calls and refuses later ones except those tagged as inside the finalization. Is that sound against |
| + litestream v0.5.14 (every path that uploads: replica monitor, DB.init's Start, compaction and snapshot monitors, |
| + SyncAndWait, DB.Close's syncReplicaWithRetry)? Can any upload still start after the marker PUT? Can the finalization's |
| + own final attempt be refused or hang? Can the context tag leak to a non-finalize caller? Does an ordinary finalize |
| + blocked in SyncAndWait behind a hung upload unblock within its release budget (G6-2.3)? Deadlocks: rn.mu, finMu, |
| + syncMu, db.mu. |
| +2. **Obligation queue (Task 1).** Is the transcribed algorithm correct against litestream's capture (DB.Pos, LTX header |
| + WAL offset/size/salts, WAL restart, checkpoints)? Bound 32 s; same-run write (Fable F2); slow-then-hung (G6-1.2); |
| + capture blocked with continuous writes (G6-2.1); delayed capture then hung upload; missing -wal; idle never trips. |
| + Are the stated residuals (plan corrections 8) the only ones, and is any of them worse than the spec accepted? |
| +3. **Root fence (Task 3).** `fenceMu` + `startInSlice` + refusal at handler entry: can any start in the host slice |
| + bypass the mark (all seven roles, every start site, restart/respawn paths, rootfs and gvisor variants)? Is the AST |
| + guard test strong enough? Kill + wait-for-in-flight + kill + wait-empty: correct and bounded? Marks in memory: what |
| + happens if instance control restarts mid-fence? Is the new /fence /unfence endpoint reachable only by the agent's |
| + trusted caller (socket permissions, authn), and can a tenant trigger it or unfence? |
| +4. **Activator (Task 4).** One watcher per HA stream entry; stop only from awake; request vs watcher both seeing the |
| + fence -> exactly one stop and one release; stop already blocked in each of its waits; clean hibernation ends the |
| + watcher; e.writeFenced fast path; Unfence at the HA acquire (best effort: what if it fails, is the host then |
| + permanently refused starts?). |
| +5. **Rail (Task 5)** covers every door that sets replication on an HA route (CLI, console, record fields). |
| +6. **Tests prove the change**: each refusal / termination test would fail if the mechanism were missing; census scope. |
| + |
| +## Round 2 (last) |
| + |
| +Earlier rounds: `docs/superpowers/reviews/CODEX-FINDINGS-G6-FENCE-PLAN-R1.md` (NOT READY, 6 P1 + 2 P2). The design and |
| +plan families (outstanding-write age, release cancellation, writer cessation) hit stopping rule 2; the agent manager |
| +ruled option B (2026-11-12): writer cessation enforced once in the kernel (cgroup.freeze=1 on the host slice, then |
| +cgroup.kill, wait empty), thaw only by an unfence carrying the NEW acquisition's identity (the lock generation) after |
| +the fence call finished; plus the two lease-side fixes and the watcher at replicator start. That ruling is FIXED: |
| +report only mechanisms that fail to honour it. A P1 in the same family in this round sends the fence to fallback A |
| +(latch + ordinary lease-lost stop, no root fence), so be precise about what is P1. |
| + |
| +First give one line per P1 and P2 from round 1: resolved, partly, or not. Then new findings. Check especially: |
| +- **systemd liveness under a frozen slice** (plan "Spec corrections", the stall): systemd 257 waits for a spawned |
| + child to exec, so a start or an ExecStopPost landing in a frozen slice can stall PID 1 until killed. The plan |
| + answers with a root reaper (inotify on cgroup.events + 100 ms poll) and liveness-only entry refusals. Is the PID 1 |
| + stall bounded and small on a production box that also serves other tenants? Can the reaper miss a child (e.g. one |
| + attached to a nested unit cgroup below the slice, or one spawned while root itself is blocked)? Is a box-wide PID 1 |
| + stall acceptable versus fallback A? Say which you would choose and why. |
| +- the lock generation as acquisition identity: monotonic under every take path (fresh lock, expired, release marker, |
| + clean/unclean, forced takeover), never reused; HA locks never deleted. |
| +- the mandatory unfence after every HA acquire (failure -> acquire fails, released unclean): can that wedge a host |
| + permanently, or loop? |
| +- instance-control restart mid-fence and the /run records; fail closed without cgroup2/cgroup.freeze. |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The census, and review of any newly changed security, |
| + root, termination or production-storage behaviour, still check the fix; see AGENTS.md, "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the task, the problem, the evidence (file:line, verified), the failure scenario, |
| +a concrete fix and the invariant or trust boundary it breaks (its fault family). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of your own. Do not run the full test suites. |