design-tunnel-websockets-471
WebSockets through the fleet tunnel (#471)
The hub now carries a WebSocket to an app on a fleet box down the existing fleet tunnel, as one HTTP/2 stream. The app's own handshake reaches the browser unchanged, so Action Cable, subprotocols and compression work. Spec docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md (rev 4, approved 2026-10-30, with rulings recorded in the build ledger).
- The hub admits an upgrade the same way as a plain request: rate limit, plan throttle, and closing a throttled account's open sockets. The box marks the stream only when it carries an admission.
- Each box allows at most 128 open WebSockets. The next one gets a 503 with Retry-After: 5. Every reserved slot is released exactly once on every terminal path.
- Route reloads are serialised (reloadMu). Each reload sweeps the open sockets whose recorded tenancy (account, app, fleet, box) the route no longer serves, so owner changes, moves, removals and detaches close them.
- A registration that races a credential revocation or rotation is no longer published: the re-check runs under TunnelHub.mu.
- A login to an ungated -tunnel row passes down the tunnel to the box gate, but only when
nextselects that row itself. Its body is read under a size cap and a 10 s deadline. - Old boxes and old hubs keep today's 502. There is no release floor and no switch.
- The rails-shop sample gains a live Action Cable channel: the counts update over the socket, and the page reconnects with capped backoff.
- Production-wired witnesses cover end to end, maximum load, hub restart as process death, and two reloads interleaved with open sockets.
Reviews: per-task Astra reviews; whole-branch Astra R1 READY AFTER FIXES, P2 fixed (db1b1797). Census tunnel-websockets, seal 949bc734, APPROVED (Astra), recorded on #280. Follow-ups: #480 (startup log noise, pre-existing) and #482 (edge flake).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Commits
34
Discussions
0
0 open
Tasks
11/11
done
Discussions
- No discussions on this branch yet.
Tasks 11/11 done
- Task 0: Copy deck Done
- Task 1: The box half Done
- Task 2: The hub half: RoundTripUpgrade Done
- Task 3: Hub registry, reservation, tenancy, scrub Done
- Task 4: One reload mutex, and the sweep Done
Activity
- task updated: Task 10: Live on dev
- task updated: Task 9: Census, whole-branch review, merge
- claude agent, operated by paul@keymail.dev pushed 00584e581 ci: rerun the gate (unrelated edge flake TestProbedClientCancelDuringHoldDoesNotEject)
- claude agent, operated by paul@keymail.dev pushed db1b1797a examples/rails-shop: the page's cable socket reconnects with capped backoff (#471 branch review R1 P2)
- claude agent, operated by paul@keymail.dev pushed 447a57076 review brief: #471 whole branch and census, round 1
- claude agent, operated by paul@keymail.dev pushed d21e40f19 census: propose the tunnel-websockets overlay (#471 Task 9)
- claude agent, operated by paul@keymail.dev pushed aa744f82c edge: whole-branch minors: the registration lock guard, a quiet forward fixture, a lower bound named (#471 Task 9)
- task updated: Task 8: The sample's Action Cable channel
- claude agent, operated by paul@keymail.dev pushed abf581110 examples/rails-shop: an Action Cable channel keeps the job counts live (#471 Task 8)
- task updated: Task 7: Maximum load, hub restart, interleaving
- claude agent, operated by paul@keymail.dev pushed a4707bc51 edge: conservative process-held accounting and explicit record barriers (#471 Task 7 fix round 1)
- claude agent, operated by paul@keymail.dev pushed 501f27241 spec: the push-back bound covers process memory; kernel TCP queues are a known limit (#471)
- claude agent, operated by paul@keymail.dev pushed f0f699d7c edge: maximum load, hub restart and two Reloads over open sockets (#471 Task 7)
- task updated: Task 6: The production-wired witness
- claude agent, operated by paul@keymail.dev pushed 070433f07 edge: the kept -tunnel login body is read under a deadline (#471 Task 6 fix round 3)
- claude agent, operated by paul@keymail.dev pushed 12e5531d6 edge: a -tunnel login passes through only when next selects the tunnel row (#471 Task 6 fix round 2)
- claude agent, operated by paul@keymail.dev pushed 021c7307b edge: a -tunnel row's login passes through to the box; witness fixes (#471 Task 6 fix round 1)
- claude agent, operated by paul@keymail.dev pushed eef20b79c edge: the production-wired witness for tunnel WebSockets (#471 Task 6)
- task updated: Task 5: Switch on the hub's marker
- claude agent, operated by paul@keymail.dev pushed 10151ad5a edge: switch on the hub's marker, upgrades cross the fleet tunnel (#471 Task 5)
- task updated: Task 4: One reload mutex, and the sweep
- claude agent, operated by paul@keymail.dev pushed 3baa50b5d edge: a registration racing a revocation is not published (#471 Task 4 fix round 1)
- claude agent, operated by paul@keymail.dev pushed f7754746f edge: one reload mutex, and the sweep of open upgrades (#471 Task 4)
- task updated: Task 3: Hub registry, reservation, tenancy, scrub
- claude agent, operated by paul@keymail.dev pushed e5d2d14b0 edge: Task 3 test uses baj, not k3x, for the -tunnel row (#471 Task 3 review P2)
- claude agent, operated by paul@keymail.dev pushed 0fe483dba edge: the hub's open-upgrades registry, reservation, tenancy and scrub (#471 Task 3)
- task updated: Task 0: Copy deck
- claude agent, operated by paul@keymail.dev pushed 249b38f4a copy deck and gate for tunnel WebSockets (#471 Task 0)
- task updated: Task 2: The hub half: RoundTripUpgrade
- claude agent, operated by paul@keymail.dev pushed 0e59cb970 tunnelclient: the hub half of tunnel WebSockets (#471 Task 2)