carlos / platform Public

spec: the push-back bound covers process memory; kernel TCP queues are a known limit (#471)

Coordinator ruling on Task 7's concern 1. Spec §4.8 (c) and §8.2 case 13
now bound the bytes the hub and box processes hold per stalled socket
at StreamWindow + 4 MiB. The bound is measured by subtracting the
kernel's send and receive queues (the client's SIOCOUTQ and SIOCINQ on
the hub's accepted conn), which is what f0f699d7's test asserts.

A known-limit note says the kernel's own TCP queues are outside the
bound, as for any proxy. Autotuning grows them toward tcp_wmem and
tcp_rmem: on loopback about 10 MiB per stalled socket, about 950 MB
across 128. They are capped system-wide by tcp_mem.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 501f27241d179adb97a9d730fb4260c97d749a78 parent f0f699d
1 file changed, +18 −6
  • docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md +18 −6

Intent

Attributed to this commit: 10.8 g CO₂e (1,265,064 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/specs/2026-10-30-tunnel-websockets-design.md b/docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md
index 93ae14191..8ded2468d 100644
--- a/docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md
+++ b/docs/superpowers/specs/2026-10-30-tunnel-websockets-design.md
@@ -846,10 +846,18 @@ with the cap's worth of upgraded streams open on one channel and every
one of their apps not reading, (a) at least `MaxStreams - cap` streams
remain for plain requests, (b) at least `PlainHeadroom` of connection
credit remains for plain request bodies, so a plain upload completes,
-and (c) each stalled socket's client is pushed back by flow control
-after at most `StreamWindow` plus kernel socket buffers, so nothing on
-either edge buffers without bound. §8.2 case 13 proves (a) to (c) at the
-production values, not only scaled down.
+and (c) each stalled socket's client is pushed back by flow control,
+with the bytes held by the hub and box processes per stalled socket
+`<= StreamWindow + 4 MiB`, measured by subtracting the kernel's send and
+receive queues, so nothing on either edge buffers without bound. §8.2
+case 13 proves (a) to (c) at the production values, not only scaled
+down.
+
+Known limit: the kernel's own TCP queues are outside this bound, as for
+any proxy. Linux autotuning grows a stalled client's send queue toward
+`tcp_wmem` and the hub's receive queue toward `tcp_rmem`. On loopback
+this was measured at about 10 MiB per stalled socket, and about 950 MB
+across 128. These queues are capped system-wide by `tcp_mem`.
Idle timeouts: none, as on every edge today (`edge.go:3940-3942`). Dead
peers are covered by the tunnel's 5 s pings on the box side and TCP
@@ -1242,8 +1250,12 @@ Cases, each against the same scene:
`StreamWindow` 1 MiB, `ConnWindow` 160 MiB, cap 128), on one tunnel:
- 128 upgrades open, every app side not reading, and each client
writing until its write blocks for 500 ms: each socket is pushed
- back (assert a write deadline trips) after at most `StreamWindow`
- plus 4 MiB of kernel buffers;
+ back (assert a write deadline trips), and the bytes held by the
+ hub and box processes per stalled socket are `<= StreamWindow +
+ 4 MiB`, measured by subtracting the kernel's send and receive
+ queues (the client's `SIOCOUTQ` and `SIOCINQ` on the hub's
+ accepted connection). The kernel's queues are outside the bound
+ (§4.8, known limit);
- the 129th handshake gets 503 `Retry-After: 5`;
- while all 128 stay stalled: 100 concurrent plain GETs, held open
by the app until all 100 have arrived, all reach the app (stream