carlos / platform Public

Tunnel WebSockets (#471): Astra spec review brief, round 2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 1f4afbf483a66b8f5730c7d25efd659ee7759e2c parent c96dd93
1 file changed, +54 −0
  • docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R2.md +54 −0

CI passed — run details

Intent

Attributed to this commit: 17.9 g CO₂e (2,326,120 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-R2.md b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R2.md
new file mode 100644
index 000000000..5929610a5
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-REVIEW-BRIEF-tunnel-websockets-R2.md
@@ -0,0 +1,54 @@
+# Review brief: tunnel WebSockets design (#471), round 2 of 3
+
+Repo carlos/platform, branch `design-tunnel-websockets-471`, commit c96dd93d9d0926094933fe0de84ab5a9d1e3e777.
+Under review: `docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md` (rev 2).
+Authorities: main's code (origin/main 65fd8060, fleet public routes merged and live in v0.32.0), docs/superpowers/specs/2026-10-29-fleet-public-routes-design.md (forward rows, one enforcement point at the hub), AGENTS.md (census, request budget, provider-neutral core, production-wired witnesses, stopping rules). 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 document, then the code it names, and check every claim against that code (file:line). Library code is golang.org/x/net v0.60.0 and the Go 1.26.10 standard library.
+
+## Fixed: do not re-argue
+
+- Goal (Paul via #471): WebSocket upgrades to fleet apps work through the hub's fleet tunnel (Action Cable on dev shop), keeping one enforcement point at the hub.
+- Controller's calls on the spec's open questions (platform-60), recorded in spec §11: option B (the upgrade carried unchanged in one HTTP/2 stream); Q1 cap 128 open upgrades per fleet box in v1; Q2 do not shrink the hub's per-stream window now; Q3 -tunnel hand rows get WebSockets too; Q4 add an Action Cable channel to examples/rails-shop as the last task; Q5 file the client-address finding as its own discussion (#476). Report only mechanisms that fail these.
+- Controller's rulings on round 1 (platform-60): every upgraded socket records the tenancy that admitted it, the hub keeps a registry of open upgrades by host, and one sweep after every Reload's map swap, synchronised with admission, closes any socket whose host is no longer served by the shared decision for the same account, app and fleet, including accounts outside plan tracking; one reservation object with exactly-once release on every terminal path; a hub-restart witness that kills established connections and brings the hub back with the box re-registering; prove the maximum-load guarantee rather than narrow it; re-verify §10.2 and delete it if it is not real. Report only mechanisms that fail these.
+
+## What to check
+
+1. The tenancy sweep (§4.6.1): is the race argument between admission and Reload's swap airtight against the code (`edge.go:1208-1234`, `lookupUpstreamPath` at `:1574`)? Can any socket be admitted against an old map and survive? Does the equality on `tenancy{Arm, Account, App, Fleet, Tunnel}` close every case the ruling names, and none that it should not (no false closes on unrelated reloads, rotation)? Does it reach accounts plans do not govern?
+2. The reservation (§4.6.2): is every terminal path in the table real and released exactly once, including the stdlib proxy paths that drop a 101 body (`reverseproxy.go:579-592`, `:842-857`) and the `context.AfterFunc` backstop's reliance on `net/http/server.go:2087-2089`? Any path that leaks a slot or double-decrements?
+3. The maximum-load proof (§4.8, §8.2 case 13, §8.1 case 6): does the invariant over the four constants imply the stated guarantee given x/net's flow-control and stream-slot behaviour? Would case 13 at production values fail if the guarantee were false? Is the SETTINGS/WINDOW_UPDATE check correct for `http2/server.go:780-801`?
+4. The restart witness (§8.2 case 9): does closing every accepted connection through a tracking listener model process death for both the tunnel and the public socket, and does the box re-register through its real loop?
+5. Anything rev 2 broke in what round 1 did not flag: the trust rule (§4.4) with the new admission, the lifecycle table (§4.7), census list (§7), request budget.
+6. §10: is the withdrawal of §10.2 correct, and is §10.1 now accurate?
+
+## Round 2
+
+Earlier rounds: `docs/superpowers/reviews/CODEX-FINDINGS-tunnel-websockets-R1.md` (round 1, NOT READY, 1 P1 and 4 P2). The round number counts every earlier review of this design, under any file name or reviewer.
+
+Where rev 2 answers each round 1 finding:
+
+- R1-1 (P1, owner change leaves sockets open): §2 goal 6; evidence §3.5 last paragraph; design §4.6.1 (tenancy, registry, the sweep after the swap, synchronisation with admission, channel changes, bound); §4.7 new row; §4.10 `upgrades.go`; tests §8.2 cases 15, 16, 17.
+- R1-2 (P2, cap reservation cleanup): evidence §3.5 (stdlib paths, server context cancel); design §4.3 steps 4 and 9 and last paragraph, §4.6.2 (one object, `sync.Once` release, terminal-path table, `context.AfterFunc` backstop, per-connection keying); §4.7 last paragraph; test §8.2 case 12 (200 failures at cap 128, then a success).
+- R1-3 (P2, closing the server is not a restart): §4.7 hub-restart row; test §8.2 case 9 (tracking listener closes every accepted connection, a new hub on the same address, the real loop re-registers; a separate listener-only `Shutdown` case).
+- R1-4 (P2, resource witness): §4.8 constants and invariant with a unit test; §8.1 case 6 (SETTINGS and the stream-0 WINDOW_UPDATE checked separately) and case 7; §8.2 case 13 at production values (128 stalled sockets, 129th refused, 100 concurrent plain GETs and a 16 MiB POST, count back to 0), scaled under `-short`.
+- R1-5 (P2, §10.2 unsupported): re-verified against `tunnel.go:197-203`, `x/net/http2/transport.go:539-543`, `crypto/tls/conn.go:1254`, `:1392-1403`; withdrawn in §10.2 with the reason, and the defensive-forward idea rejected for the reason the finding gave.
+
+First give one line per P1 and P2 from round 1: resolved, partly, or not. Carry every unresolved or partly resolved finding forward at its current severity, then add new findings. The verdict covers everything outstanding, earlier rounds included.
+
+## 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). 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.