review brief: #471 whole branch and census, round 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-branch.md+61 −0
CI cancelled — superseded by a newer push — run details
Intent
<task-notification> <task-id>aa19feb5193e2e0fa</task-id> <tool-use-id>toolu_017m5izVUe5zdG6X5m1NW5aa</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ba9fa944-a429-4788-9b3c-f2b2f42617f3/tasks/aa19feb5193e2e0fa.output</output-file> <status>completed</status> <summary>Agent "#471 Task 9: minors, census, push" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>**Status: DONE_WITH_CONCERNS.** The minors and the census overlay are committed, the branch is pushed to amadan, and CI was queued when I checked. **Commits** - `aa744f82`: the three deferred minors. - **Task 4 guard.** New test `internal/edge/tunnel_publish_guard_test.go`, `TestTunnelRegistrationRecheckAndPublishShareOneLock`. It pins that the credential re-check and the insertion of the connection sit inside one `TunnelHub.mu` hold. The only unlock allowed between them is on the refusal branch that returns. It also pins that `SetDynamicAuth` reads and replaces the map inside one hold, and is the only writer of it. Four mutations each fail it: the re-check moved before the Lock (the one you asked for), an unlock and relock before the insertion, an unlock inside a branch that carries on, and the map replaced after the Unlock. `tunnel.go` was restored byte for byte afterwards. - **Task 5 fixture.** Your fix, setting the environment before the first Reload, does not stop the logs. I tried it and the three refusals still printed. Reload only checks the hub environment once tunnels are enabled, and `EnableTunnels` runs after `New`'s startup Reload. So `forwardHubAndBox` now writes its hub rows after `EnableTunnels`, just before its own Reload. Only the test's deliberate refusal is logged now. - **Task 7 message.** "at most" is now "at least" (the line is a failure message, not a comment). - **Tests.** All 32 tests that use the fixture, both guard tests and the maximum-load test pass with `TMPDIR=/tmp/g`. - `d21e40f1`: the census overlay `internal/provision/testdata/plan14-root-reads-tunnel-websockets.tsv`, one line added to `plan14-root-reads-chain.tsv`, and the card `docs/superpowers/notes/census-proposal-tunnel-websockets.md`. **Census:** the card and §7 match, so §7 needed no fix. - **Card:** five units. `loginPassesThrough`, `UpgradeConn.Read` and `upgradedConn.Read` are new; `Edge.Reload` and `Edge.ServeHTTP` have new reads. - **Envelopes re-pinned:** `internal/apperr`, `internal/edge` and `internal/tunnelclient`, which are the three §7 expects. - **Tasks 7 and 8:** they changed only tests and `examples/`, which are outside the census scope. - **Census tests:** `TestPlan14RootReadCensus` and `TestCensusScopeIsTheRootBinary` pass. - **#280:** no verdict recorded there. **Census seal:** `1379d066c8dd2335d95d5f6e9c7bce65ff57f00b2b287a308d9b3f47911ae5e7` → `949bc734a293366e6b2700244af5110dd6e84b5432023e991c09e806afd62483` **Gate:** `go vet ./...` is clean, and the darwin/arm64, windows/amd64 and linux/arm64 builds all succeed. **Pushed tip:** `d21e40f19d7f691d61ee674f26bdd360b0e65160`, pushed to origin (amadan) only, no force (`464897b7..d21e40f1`). The remote ref matches. **CI state:** "carlos/platform @ d21e40f19 (branch design-tunnel-websockets-471): CI queued". I did not wait for it. **Concerns** - Production probably has the same ordering as the old fixture: `New`'s startup Reload runs before `enableTunnelsFromEnv`. If so, a hub logs one "forward row on a box that is not the hub" refusal per forward row every time it starts. I left this alone; it is worth flagging to the whole-branch reviewer. - Git printed the known `packed-refs.lock` error on both commits and a credential-storage lock warning on the push. Both were harmless and the lock files are untouched. Scratch files are deleted and nothing I started is still running. The full report is appended to `/home/paulca/amadan.net/carlos/platform/.claude/worktrees/design-tunnel-websockets-471/.superpowers/sdd/2026-10-30-tunnel-websockets/task-9-report.md`.</result> <usage><subagent_tokens>111637</subagent_tokens><tool_uses>49</tool_uses><duration_ms>500809</duration_ms></usage> </task-notification>
Attributed to this commit: 26.7 g CO₂e (3,245,507 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on design-tunnel-websockets-471, 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-REVIEW-BRIEF-tunnel-websockets-branch.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-branch.md| new file mode 100644 |
| index 000000000..3ba026bff |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-branch.md |
| @@ -0,0 +1,61 @@ |
| +# Review brief: #471 WebSockets through the fleet tunnel, whole branch and census, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `design-tunnel-websockets-471`, commit d21e40f19d7f691d61ee674f26bdd360b0e65160. |
| +Under review: the diff `c24e7a04..d21e40f1` (main has not moved since c24e7a04), plus the census proposal |
| +`docs/superpowers/notes/census-proposal-tunnel-websockets.md` and overlay |
| +`internal/provision/testdata/plan14-root-reads-tunnel-websockets.tsv` (seal 949bc734…). |
| +Authorities: the spec `docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md` (rev 4, approved by Paul 2026-10-30, amended in-branch with recorded rulings), the plan `docs/superpowers/plans/2026-10-30-tunnel-websockets.md`, and the fleet public routes spec merged on main (65fd8060). The build ledger `.superpowers/sdd/2026-10-30-tunnel-websockets/progress.md` holds every ruling. |
| + |
| +You are an independent reviewer. Read the spec, then the code it names, and check every claim against that code. Every task was reviewed on its own already; this review is for what only shows across the whole branch. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul's approval of spec rev 4 (option B: the upgrade travels in one HTTP/2 tunnel stream; cap 128 per box; no idle timeout; no WebSocket byte metering; no release floor or switch). |
| +- Controller rulings in progress.md. Report only mechanisms that fail to honour them: |
| + - the registration re-check under TunnelHub.mu |
| + - a login passes through only when `next` resolves to the ungated ArmTunnel front row itself |
| + - the login body read deadline |
| + - the §4.8(c) bound covers process-held bytes, with kernel queues excluded |
| + - Task 8's arm64 check moves to Task 10 |
| +- The copy TWS-C01..C03 is approved byte for byte. |
| + |
| +## What to check |
| + |
| +1. The trust rule. The Carlos-Tunnel-Upgrade marker reaches a box only with an admission: right host, right path, tenancy with Arm != ArmNone, a capability the box advertised, and a reservation. Can any path (fleetProxy, tunnelProxy, a forward row, a hand tunnel row, the static t1 client, a stale or missing admission context, a hub without EnableTunnels) send an upgrade without one, or let a box treat an ordinary request as an upgrade? |
| +2. The reservation's terminal paths. Every reserved slot is released exactly once on: refusal, transport error, malformed 101, ordinary non-101 answer, success then close, request-context cancellation (the backstop), hijack unsupported, sweep, CloseAccountUpgrades, tunnel loss and hub restart. Can the count leak upward and 503 a box permanently, or go negative? |
| +3. reloadMu and the sweep. Every Reload serialises publication, sweep and fingerprint recording. A socket's recorded tenancy (account, app, fleet, box channel) closes within the stated bound when the route stops being served for it, including owner change, a move to another fleet, app removal and box detach. Is there any Reload or route-publishing path that bypasses reloadMu? Does the sweep take locks in an order that can deadlock with admission, SetDynamicAuth or the TunnelHub lock? |
| +4. The limits invariant. With the maximum admitted upgrades stalled, plain requests to the same box still get stream slots and connection credit (spec §4.8). Check the production SETTINGS and initial WINDOW_UPDATE values in code, not only the test. |
| +5. The login pass-through (edge.go loginPassesThrough and the ServeHTTP login branch). The body read happens before rate admission: is it bounded in size and time? Is the body restored byte for byte? Can a password reach a box other than the one whose gate rendered the form? Does every other row type behave exactly as on main? |
| +6. Compatibility. An old box (no Carlos-Tunnel-Caps upgrade/1) or an old hub gets the same 502 as on main, and nothing else changes for plain traffic. The box shim refuses a marker it did not expect. |
| +7. Startup ordering (Task 9's concern). New's startup Reload runs before enableTunnelsFromEnv in production. Does a hub log a spurious refusal per forward row at every start, or worse, briefly refuse or misroute forward rows until the next Reload? Say which, with evidence. |
| +8. Census. For each unit on the card and each re-pinned envelope (internal/apperr, internal/edge, internal/tunnelclient), APPROVE or REJECT with evidence. Earlier per-task census verdicts are in the task review files under .superpowers/sdd/2026-10-30-tunnel-websockets/. |
| +9. Cross-compile: anything linux-only (ioctls such as SIOCOUTQNSD) behind a linux build tag with a non-linux stub where non-test code needs it. CI builds darwin and windows. |
| + |
| +## 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. |