carlos / platform Public

reviews: Astra #996 design round 2 (NOT READY, stopping rule 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev a31ae2b9071faa05b05721f47e9b5c54d3102e39 parent 49c7c74
1 file changed, +58 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R2.md +58 −0

CI passed — run details

Intent

Human

<task-notification> <task-id>b6yan4sm7</task-id> <tool-use-id>toolu_018cpdEBEw3eMV7VMhEvMe3d</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/b6yan4sm7.output</output-file> <status>completed</status> <summary>Background command "Run Astra round 2 on #996 design" completed (exit code 0)</summary> </task-notification>

Attributed to this commit: 10.7 g CO₂e (1,399,939 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on plan-tito-nesting-moves, 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-INSTANCE-MEMORY-ALERT-996-R2.md b/docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R2.md
new file mode 100644
index 000000000..e191719f6
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R2.md
@@ -0,0 +1,58 @@
+- R1-1 **P1, event capture: partly resolved.** Flat exits have a capture point; the nested path still depends on a conditional read.
+- R1-2 **P1, tenant identity: resolved.** Entries carry account, app and incarnation, checked before display or routing.
+- R1-3 **P2, episode continuity: partly resolved.** Stable subjects and move precedence help; restart recovery and counter resets remain undefined.
+- R1-4 **P2, evidence and wording: partly resolved.** The restart claim is removed, but the proposed evidence still cannot establish the cause of every stop.
+- R1-5 **P2, enforcing boundary: partly resolved.** Generation selection is explicit, but it excludes an enforcing parent cap.
+- R1-6 **P2, PSI and recovery: resolved.** Missing PSI gives no verdict; low PSI can clear despite increasing `high`.
+- R1-7 **P2, vouch scope: resolved.** Unsupported units are explicitly excluded.
+- R1-8 **P2, privilege and census: resolved.** The design requires an effective-UID gate and independent census approval.
+
+Reviewed the design at `ab036d9610926a18a346a14d10f27a2c51d32ba7`, using code read with `git show origin/main:<path>` at `4c6416787a42ce5da5964588de721817d25fc15d`. The worktree HEAD had advanced. No files edited, subagents spawned or tests run.
+
+1. **P1 — Adding `Result` to the existing call does not capture every nested exit.**
+ **Invariant: every reported kill survives cgroup teardown.**
+ [Design:33–44](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:33) proposes adding a property to the existing exit query. That query runs only when the advisory record exists and its `Code` is empty: [unitproc.go:519–522](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/activator/unitproc.go:519). An absent, malformed or completed record skips it. The record is tenant-accessible, and read failures return `false` ([unitproc.go:724–733](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/activator/unitproc.go:724)). Thus the proposed trusted observation still depends on advisory input.
+
+ **Failure:** an OOM exit leaves no readable record; adding `Result` to `systemctlUnitMainExit` produces no observation and no stop count.
+
+ **Fix:** require an unconditional, invocation-matched lifecycle observation, independent of the advisory record. Test absent, malformed and populated records. Also make the PrivatePIDs verification a prerequisite: if `Result` does not identify OOM reliably, the design currently specifies no fallback. Reporting unsupported/unknown is safe; silently claiming complete detection is not.
+
+2. **P2 — Reading only the generation misses pressure and kills caused by the parent cap.**
+ **Invariant: the event, usage figure and limit describe the enforcing resource boundary.**
+ [Design:94–103](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:94) selects the serving generation and excludes role children. However, those children consume the parent’s budget ([gen.go:261–264](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/cgroup/gen.go:261)); the parent retains `memory.max` and `memory.high` outside swaps ([gen.go:300–318](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/cgroup/gen.go:300)).
+
+ **Failure:** the generation uses 70% of the tier and a sidecar uses another 25%. Parent reclaim stalls the instance, but the generation’s own `high` need not increase. If the parent reaches OOM and kills the generation, the flat exit rule can likewise miss it because it requires an `oom` increase at the child. Events propagate upward, not downward. [Kernel documentation](https://docs.kernel.org/admin-guide/cgroup-v2.html).
+
+ **Fix:** account for every enforcing boundary on the instance’s path, retaining each boundary’s identity and avoiding duplicate incidents. Alternatively, explicitly exclude these layouts until supported.
+
+3. **P2 — A lifetime `oom` delta does not establish why this exit happened.**
+ **Invariant: alerts state only what the evidence proves.**
+ [Design:38–49](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:38) correlates the exit with any `oom` increase since spawn.
+
+ **Failure:** a failed successor raises the host slice’s hierarchical `oom` count while the incumbent survives. Later, a box-wide OOM kills the incumbent. Both proposed nested conditions hold, so it is reported as having exhausted its own allocation.
+
+ The second unverified premise is confirmed in systemd 257: `unit_check_oom` watches `oom_kill`, and the service handler maps that notification to `oom-kill`; it does not distinguish global from local OOM. [cgroup.c](https://raw.githubusercontent.com/systemd/systemd/v257/src/core/cgroup.c), [service.c](https://raw.githubusercontent.com/systemd/systemd/v257/src/core/service.c). Separately, Linux increments `oom` before the kill attempt, which can finish without killing a process; a later SIGKILL is therefore insufficient for the flat rule too. [Linux v6.12 implementation](https://raw.githubusercontent.com/torvalds/linux/v6.12/mm/memcontrol.c).
+
+ **Fix:** use wording limited to the observed evidence unless the design provides event-specific causal attribution. The slice-counter condition is not a safe substitute.
+
+4. **P2 — Restarting or moving loses the hysteresis needed to keep an episode open.**
+ **Invariant: one episode remains one episode across lifecycle changes.**
+ [Design:69–83](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:69) clears windows on agent restart while asserting that console ownership only delays firing. But the box decides whether pressure has recovered.
+
+ **Failure:** an episode is open, then the agent restarts while PSI remains at 3%—below the firing threshold but above recovery. An empty local state cannot reconstruct the existing pressure latch. Treating it as `ok` clears prematurely; treating it as unavailable indefinitely prevents recovery. Omitting healthy entries ([design:113–117](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:113)) also leaves omission ambiguous. The existing engine removes a firing member when given a non-firing signal ([alertengine.go:192–208](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/console/alertengine.go:192)).
+
+ **Fix:** define explicit warm-up and recovery evidence independent of the box’s previous latch, or persist that latch. Specify omission semantics and reset counter baselines when cgroup identity changes across wakes or swaps.
+
+5. **P2 — Stop totals cannot be reconciled reliably across agent restarts.**
+ **Invariant: one episode remains one episode across lifecycle changes.**
+ Counts reset at agent start ([design:51–53](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:51)), but the carrier supplies no counter epoch; deduplication uses incarnation, box and last-stop time ([design:113–125](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:113)).
+
+ **Failure:** the console sees count 5, the agent restarts, then eight new stops occur before the next read. Count 8 and a new last-stop time cannot distinguish eight new stops from three. A restart before publication loses captured stops entirely. A cumulative count plus one timestamp also cannot substantiate “3 times today” across midnight.
+
+ **Fix:** define counter epochs and retention guarantees, or reduce the promise to the latest observed stop. Calendar-day totals require corresponding time-bucketed evidence.
+
+The sampler cadence, private heartbeat placement, existing console reads, and absence of a production per-cgroup `memory.events` reader check out. Extending that carrier can avoid new S3 objects and requests; the recommendation is reasonable on that basis. The root-read gate and census requirement are appropriate.
+
+These repeat round-one capture, boundary, evidence and continuity fault families. Under stopping rule 2, stop iterative fixes and obtain Paul’s choice: gate unsupported cases, cut the affected feature, or enforce the invariant centrally with guard tests. I recommend gating unsupported stop attribution and defining one lifecycle/reconciliation contract before another revision.
+
+NOT READY
\ No newline at end of file