carlos / platform Public

remote-instance-metrics: whole-branch review brief

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev e1233c74eaade1b0c8f0829ad1bf2c1be9d9c07b parent eed58ac
1 file changed, +95 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-remote-instance-metrics-branch.md +95 −0

CI failed — run details

diff --git a/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-remote-instance-metrics-branch.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-remote-instance-metrics-branch.md
new file mode 100644
index 000000000..34f752ce2
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-remote-instance-metrics-branch.md
@@ -0,0 +1,95 @@
+# Review brief: branch remote-instance-metrics, round 1 of 3
+
+Repo carlos/platform, branch `remote-instance-metrics`, commit named in the
+reviewer's prompt.
+Under review: the diff `origin/main..<commit>` (merge base 56345380).
+Authorities: the code on main at the merge base; the design note on this
+branch, `docs/superpowers/notes/remote-instance-metrics.md`, which had its
+own review (rounds 1 and 2, findings in
+`docs/superpowers/reviews/CODEX-FINDINGS-remote-instance-metrics-note-r1.md`
+and `-r2.md`; round 2 READY AFTER FIXES, fixed). Do not review against
+unmerged branches; if this work needs one, say so as a P1 and stop.
+
+You are an independent reviewer. Read the note, then the diff, and check
+the code against the note and the note's claims against the code.
+
+## Fixed: do not re-argue
+
+- Paul's rulings for this work (task brief, 2026-10-26): the boxes tag
+ every metrics sample with the instance's identity and the console
+ accepts a sample on a remote row only when the tag matches the record it
+ shows; untagged samples from old boxes are never shown remotely; local
+ rows keep today's behaviour; no new per-box polling.
+- The note's design choices reviewed in its rounds 1 and 2: the identity is
+ the tenant (account and app), not the incarnation; a host is vouched only
+ if every activator entry this agent made for it named one tenant; a
+ hostname that changes tenant on a box shows no remote readings until the
+ agent restarts; same-owner recreation is out of the fault family; a
+ remote-only view may start the existing sweep. Raise one again only with
+ new evidence that it lets a sample reach the wrong account.
+
+## What to check
+
+Fault family: **tenant identity of samples** (whose process or cgroup a
+sample measured, and whether any page, API answer or number can show it to
+the wrong account). Name it beside every finding in that family.
+
+1. Box: `internal/metrics/owner.go` (`Vouched`, `TagUnits`, `CarryTags`),
+ `internal/activator/tenancies.go` (`putEntryLocked`, `Tenancies`) and
+ the seven insertion sites it replaced, `internal/cgroup` `Leftover`,
+ `internal/host/metrics_owner.go` and `metrics_loop.go` (`sampler.tick`),
+ and the wiring in `agent.go`. Can any reading be tagged with a tenant
+ that is not the only tenant the host's exec cgroup ever held in this
+ agent's life?
+2. Console: `ownerAppMetricsFrom` (the tag filter, the newest-sample rule,
+ the per-sample graph filter, the `created_at` bound), `buildBoxView`'s
+ owner table, `remoteRoute`, `appResourceMetrics`, `instanceHealth`.
+ Can any remote row, page, `carlos instances list` answer or Overview
+ number carry a sample not tagged with the record's own account and app?
+ Do local rows behave exactly as before?
+3. Tests: are they production-wired where the note says, and do they cover
+ a reused hostname (including samples after the new record's creation),
+ a successor shown to the old owner, untagged samples, and another
+ account's report? Mutations were run (19 mutants, all killed): spot
+ check that the named tests would fail on the obvious breakages.
+4. Wire shape and consumers: the additive `owner` field; everything that
+ parses raw chunks or rollups.
+5. Request budget: no new box request; the console's sweep as the note
+ describes.
+6. **Census (cross-model approval).** The card is
+ `docs/superpowers/notes/census-proposal-remote-instance-metrics.md`.
+ Give a verdict, approve or escalate, for every changed unit and every
+ re-pinned envelope it lists, per AGENTS.md "The census: an approval,
+ not a decision", citing the lines you read. The four new units in
+ `internal/provision/testdata/plan14-root-reads-remote-instance-metrics-decisions.tsv`
+ are decisions for the census owner: say whether each row's basis is
+ accurate.
+
+## 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 section or task, the problem,
+the evidence (file:line, verified), the failure scenario, a concrete
+fix and the invariant or trust boundary it breaks (that is its fault
+family). Then the census verdicts. 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.