reviews: Astra #996 design round 1 (NOT READY)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R1.md+40 −0
Intent
<task-notification> <task-id>bt4n0ax6n</task-id> <tool-use-id>toolu_01B5n4Vd2vGBJVkzetnZNvz2</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/96a09f74-e398-48ed-a97f-140bd1f7e255/tasks/bt4n0ax6n.output</output-file> <status>completed</status> <summary>Background command "Run Astra review of #996 design" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 17.7 g CO₂e (2,266,859 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-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R1.md| new file mode 100644 |
| index 000000000..63e0afc52 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-FINDINGS-INSTANCE-MEMORY-ALERT-996-R1.md |
| @@ -0,0 +1,40 @@ |
| +Reviewed design commit `ace5c8093eee83a05407a88ac1921755f0ae5d36` against `origin/main` at `4c641678`. Round 1 findings follow. No files edited or tests run. |
| + |
| +1. **P1 — OOM events can disappear between samples.** |
| + **Invariant: every reported kill survives cgroup teardown.** The design’s minute sampling and reset-to-baseline rule ([design:56–62](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:56)) cannot guarantee this. After `cmd.Wait()`, the exec backend immediately removes the child and host cgroups ([backend_exec.go:2737–2754](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/activator/backend_exec.go:2737)). An instance can OOM, disappear and wake again between ticks; the sampler sees only a new baseline and never reports the kill. |
| + **Fix:** capture and retain trusted OOM evidence before cgroup disposal, or establish a retained, correctly attributed aggregate that survives it. Test an OOM and replacement entirely between ticks, including before the first sample. |
| + |
| +2. **P1 — Retained reports lose the tenant identity needed for isolation.** |
| + **Invariant: readings remain attributable to their original tenant.** The proposed heartbeat contains a hostname-keyed map with verdict, time, usage and kill count, retained after closure ([design:90–105](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:90)). Vouching at collection does not protect subsequent reads after that hostname changes hands. Existing resource metrics explicitly require matching account/app tags because hostname alone is insufficient ([metricsview.go:873–885](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/console/metricsview.go:873)). Copying the DB-size join would expose the previous tenant’s retained episode to the new tenant. |
| + **Fix:** retain account/app and instance-lifetime identity with every episode; validate them against the authorized instance when displaying or routing alerts. Reject historical reports belonging to another tenant. |
| + |
| +3. **P2 — Episode continuity and unavailable readings are unspecified.** |
| + **Invariant: one episode remains one episode across lifecycle changes.** The design specifies fire/clear windows and counter resets, but no recovery or reconciliation contract ([design:49–74](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:49)). The existing sampler starts empty ([metrics_loop.go:982](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/host/metrics_loop.go:982)). An agent restart therefore loses the episode and kill count; hibernation supplies no sample that can prove 30 quiet minutes; a move can leave two boxes reporting conflicting retained states. The suggested DB join simply overwrites by iteration order ([apiinstances.go:1080–1105](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/console/apiinstances.go:1080)). |
| + **Fix:** specify durable episode state or console reconciliation, stable deduplication identity, source precedence after moves, and distinct healthy/asleep/unavailable states. Define whether missing samples pause or end windows. These rules also need to prevent deliberate kill/restart cycles from bypassing notification suppression. |
| + |
| +4. **P2 — `oom_kill` does not establish “ran out and restarted N times.”** |
| + **Invariant: alerts state only what the evidence proves.** The wording at [design:110–120](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:110) conflates killed processes, OOM incidents and successful restarts. `oom_kill` counts processes killed by any OOM killer, including global pressure; one group kill can increment it multiple times. [Kernel documentation](https://docs.kernel.org/admin-guide/cgroup-v2.html). Nested instances explicitly use `Restart=no`; another request wakes them ([carlos-instance@.service:43–45](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/host/units/carlos-instance@.service:43)). |
| + **Fix:** report an observed OOM kill without claiming its cause or a restart. Derive restart counts and successful recovery from lifecycle evidence, and distinguish process counts from incident counts. |
| + |
| +5. **P2 — “Generation or slice” leaves the enforcing cap unresolved.** |
| + **Invariant: the event, usage figure and limit describe the same resource boundary.** The design permits reading hierarchical events at the slice while leaving generation selection to the builder ([design:76–80](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:76), §7). During a swap, generations retain individual limits while the parent gets their summed budget ([gen.go:54–58](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/cgroup/gen.go:54); [instancectl/gen.go:75–80](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/instancectl/gen.go:75)). A child can throttle below the parent’s limit; its event combined with parent usage/max misstates which limit was approached. Reading only the serving generation also omits other capped activity. |
| + **Fix:** define the monitored cgroups and aggregation policy for each layout, including overlapping generations and sibling roles. Associate displayed usage and limits with the relevant boundary, without double-counting hierarchical events. |
| + |
| +6. **P2 — The pressure fallback and clear rule can retain false alarms.** |
| + **Invariant: “near its limit” requires sustained meaningful pressure.** At [design:51–55](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:51), an unreadable pressure file removes the pain threshold entirely. After a genuine episode, occasional inexpensive reclaim can keep `high` increasing indefinitely even after PSI falls below 5%, so the episode never clears. PSI measures stalled time, whereas `high` counts reclaim/throttling events. [PSI documentation](https://docs.kernel.org/accounting/psi.html). |
| + **Fix:** define degraded behavior when PSI is unavailable and a sustained recovery threshold that accounts for pressure subsiding. Calibrate and test cache-heavy workloads, missing PSI and low-pressure recovery. |
| + |
| +7. **P2 — The vouch requirement excludes the advertised flat systemd units.** |
| + **Invariant: each supported layout has an attributable signal.** The design includes `carlos-app@` units and then requires vouched readings ([design:66–74](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:66)). Existing `Vouched` explicitly excludes these units and operator-stamped units ([owner.go:35–55](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/metrics/owner.go:35)). Their episodes would never start. |
| + **Fix:** either narrow the supported scope explicitly or design a safe attribution mechanism for these units. Do not bypass vouching with hostname-only attribution. |
| + |
| +8. **P2 — The service’s user does not prove “no root read.”** |
| + **Invariant: runtime privilege and census obligations are explicit.** [Design:82–88](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:82) relies solely on `User=carlos`. The metrics loop supports root-run agents and explicitly gates other readers by effective UID ([metrics_loop.go:971–1003](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/host/metrics_loop.go:971)). Changes to the proposed host packages also fall under the census regardless of their usual runtime user ([AGENTS.md:337–370](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/AGENTS.md:337)). |
| + **Fix:** specify an effective-UID gate if “no root read” is required, document the actual cgroup access boundary, and include census proposal and independent approval in implementation validation. |
| + |
| +9. **P3 — Correct two factual claims.** |
| + [Design:128](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/docs/superpowers/specs/2026-11-13-instance-memory-alert-design.md:128) omits the engine’s five-minute notification hold ([alertengine.go:77](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/console/alertengine.go:77)): heartbeat publication, ingestion and grouping can approach 15 minutes after detection. Also qualify “no reader” at design:46 as **no production per-cgroup reader**; existing tests read `memory.events` ([size_rootrunner_linux_test.go:213–221](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/plan-tito-nesting-moves/internal/host/size_rootrunner_linux_test.go:213)). |
| + |
| +The existing sampler cadence, private heartbeat placement and console read paths support the proposed carrier and its no-new-S3-request claim. The blocking problems concern event capture and attribution. |
| + |
| +NOT READY |
| \ No newline at end of file |