Repository navigation
Open
Labels
area/infraInfrastructure, deployment, and operationseffort/mMedium: expected under 1 day of workepic/fleet-orchestrationReprioritization program epic (2026-11-12)kind/performancePerformance problem or optimizationpriority/normalOrdinary priority (the default)status/in-progressQueue worker lifecycle statework/assignedQueue worker lifecycle state
Description
Multiplexed persistent streams over ONE tunnel for the sandbox↔laptop path (WS-C design, from #5701)
Part of epic #5412. Design evidence: WS-C connection-performance comment on #5701 (2026-11-04).
Measured problem (2026-11-04, trips.jsonl n=1149 + live probes)
- Warm single trivial call: client trip p50 369 ms (status-200, <2 s subset, n=800) while daemon work is 1–11 ms (daemon trips.jsonl; example trip aedc705d4294: client 445 ms vs daemon 1 ms). Transport ≈ 99% of cost.
- The path is HTTP/1.1-request-per-call over a pooled CONNECT tunnel (pool 50 in
fleet proxy serve). Even warm, one request/response costs ~170–600 ms over the runtime-proxy (:3130) + DERP hairpin path. A warm RTT is the floor for EVERY operation, and every CLI operation is a separate call. - Cold CONNECT measured 1,434 ms trip (same-minute warm trip: 212 ms) — CONNECT setup ≈ 1.2–1.8 s, and the ramp test on Incident record 2026-11-04: afternoon responsiveness loss — sandbox wedged after post-boot herd (daemon restart, 88-min sampler silence); laptop path exonerated 21:00–21:28 UTC #5701 showed CONNECT setup serializes under concurrency (128 tunnels = 14.6 s wall, no failures).
- Failure amplification: during proxy wobble, trips cluster at 502 after ~16.3 s (p50, n=119) and no-status after ~26 s (p50, n=73) — retry chains multiply the herd.
Proposal
Replace HTTP-per-call over N pooled tunnels with ONE (or two, for redundancy) persistent tunnel carrying multiplexed streams:
- Framed stream multiplexer on the tunnel (the broker already speaks length-prefixed frames on its unix socket — extend that framing end-to-end): each request is a stream (id, port/service, method, path, body) over a single TCP/TLS-less CONNECT tunnel; responses interleave by stream id. Candidates: yamux-style custom framing in the existing Rust
fleet-proxy, HTTP/2 over the tunnel (h2 gives streams + HPACK + PING keepalive for free), or QUIC if the runtime proxy path ever allows UDP (it does not today — CONNECT/TCP only, so QUIC is out until that changes). - No per-call CONNECT, no pool checkout, no HTTP/1.1 head-of-line blocking per request; pool of 50 tunnels collapses to 1–2 tunnels + stream concurrency (ramp proved the tunnel path itself survives 128 concurrent; streams remove the serialized CONNECT setup that made the ramp slow).
- Keepalive: application-level PING on the tunnel (replaces per-pool-connection health keepalives; current Python-broker constants KEEPALIVE_S=180 / idle-exit 3600 s carry over as starting values, but the broker must not idle-exit while a tunnel with in-flight streams is healthy — exit only when the tunnel is dead AND no calls for 3600 s).
- Backpressure + bounded retry: per-stream timeout with a hard ceiling well under the current 16–26 s failure cluster; one retry on a FRESH stream (not a fresh CONNECT) when the tunnel is alive; tunnel re-establishment is single-flight (one CONNECT at a time, queued streams wait on it) so a proxy wobble cannot stampede 50 CONNECTs.
- TCP_NODELAY on tunnel sockets end-to-end (absent in the Python stack today: grep finds no TCP_NODELAY in laptop-agent.py / laptop-agent-broker.py / laptop-agent-daemon.py) and coalesce header+body into one write per frame to avoid Nagle/delayed-ACK stalls on small request/response pairs.
Acceptance
- Warm trivial exec trip p50 ≤ 50 ms (from 369 ms) at comparable load, daemon duration unchanged.
- 128 concurrent requests over the single tunnel: 0 failures, wall ≤ ramp's 128-tunnel wall (14.6 s) by ≥5×.
- Failure injection (kill runtime proxy briefly): calls fail or recover in ≤2 s, no 16–26 s cluster in trips.jsonl.
- Trip logs on both sides keep the same trip id so the client/daemon split stays measurable.
Risks: single tunnel = single point of congestion/failure → mitigate with 2 tunnels + stream load-balancing and the single-flight reconnect above. HTTP/2 dependency in Rust (h2 crate) vs hand-rolled framing is an implementation choice for the builder; the wire contract (streamed frames, per-stream ids) is the requirement.
Acceptance criteria
- The sandbox↔laptop path runs over multiplexed persistent streams on one tunnel, replacing the HTTP-per-call + pool-of-50 shape described in the body.
- Client trip latency is re-measured with the same method as the 2026-11-04 baseline (trips.jsonl) and the p50 improvement is recorded on this issue.
- Failure behaviour is specified and tested: a dropped tunnel fails calls visibly and recovers without a pool of half-open connections.
Metadata
Metadata
Assignees
Labels
area/infraInfrastructure, deployment, and operationseffort/mMedium: expected under 1 day of workepic/fleet-orchestrationReprioritization program epic (2026-11-12)kind/performancePerformance problem or optimizationpriority/normalOrdinary priority (the default)status/in-progressQueue worker lifecycle statework/assignedQueue worker lifecycle state
Activity
developing-today commentedon Nov 5, 2026
CODE-1443
dezren39 commentedon Nov 5, 2026
🤖 Agent note · handed off
developing-today commentedon Nov 5, 2026
🤖 Agent note · handed off
developing-today commentedon Nov 5, 2026
🤖 Agent note · handed off
121 remaining items
Merge pull request #16001 from developing-today/oc-code-06/25686-prox…
developing-today-fleet commentedon Nov 27, 2026
Lane oc-code-03, task 25686 verification (2026-11-27):
Resume condition: when a real paired runtime-proxy endpoint is reachable, run all four live measurements and record SHA, load, samples, thresholds, and client/daemon trip correlation.
developing-today-fleet commentedon Nov 27, 2026
🤖 Agent note · revalidated + parked
dezren39 commentedon Nov 28, 2026
agent-note:v1
lane: 1207-D (charlie ADVANCE queue-draw, 2026-11-28)
task: 25686
state: parked — live pair re-probed firsthand
Fresh checks 2026-11-28:
Live acceptance therefore still cannot run from this lane; starting a proxy pair on the laptop is machine-state work outside this lane's route. Task 25686 parked. Resume condition: a live paired runtime-proxy endpoint is running on the laptop — then run scripts/fleet/proxy-mux-acceptance.sh against it and post the four threshold samples here; do not claim thresholds from loopback.
dezren39 commentedon Nov 29, 2026
🤖 Census note — 2026-11-29 (lane CEN-C04, full-census pass)
Verdict: blocked on a live measurement venue. Rechecked firsthand. Landed: the mux implementation plus the step-5 acceptance harness (probe PR #15865; runner PR #16001,
scripts/fleet/proxy-mux-acceptance.sh), loopback-verified (warm p50 ~115µs, 128 concurrent 0 failures, 328/328 trip IDs). Blocker: the four §6 LIVE thresholds remain UNVERIFIED because no paired runtime-proxy endpoint is running on the laptop (checked firsthand 2026-11-28: laptop reachable, no fleet-proxy/runtime-proxy processes). Resume: when a real paired endpoint is up, run the harness against it and post warm p50, 128-concurrent, failure/recovery, and trip-ID samples with exact SHA/load. Do not claim thresholds from loopback.Census actions: added labels
priority/normal,kind/performance.developing-today-fleet commentedon Nov 29, 2026
Census 2026-11-29 (Felix):
scripts/fleet/proxy-mux-acceptance.sh), loopback-verified (warm p50 ~115µs, 128 concurrent streams, 0 failures, 328/328 trip IDs).developing-today-fleet commentedon Nov 29, 2026
Issue census — 2026-11-29
Gaps found: no effort/* and no app//area/ label; no acceptance criteria section.
Strengths: the problem is measured, not asserted — client trip p50 369 ms against 1–11 ms of daemon work (trips.jsonl, n=1149, plus live probes) — and the design source is cited (WS-C on #5701, epic #5412). Labels otherwise consistent (kind/performance, priority/normal, status/in-progress, work/assigned).
Actions: added labels effort/m and area/infra; appended a
## Acceptance criteriasection including re-measurement against the recorded baseline (original text untouched). Priority unchanged (normal).