Repository navigation
Open
Labels
epic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)queue/claimedQueue worker lifecycle stateQueue worker lifecycle statetask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue 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.
Metadata
Metadata
Assignees
Labels
epic/fleet-orchestrationReprioritization program epic (2026-11-12)Reprioritization program epic (2026-11-12)queue/claimedQueue worker lifecycle stateQueue worker lifecycle statetask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle stateQueue 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
66 remaining items
dezren39 commentedon Nov 14, 2026
Released to the queue under Drew's 2026-11-13 unblock-all order (main chat, 23:53 CT). Task(s) 15259 moved from blocked/parked to queued in the fleet unblock-all pass (worker
main-unblock-all-2026-11-13). Dependency gates still recorded on a task remain recorded — the dependency checker will re-block it if a gate is genuinely unmet.dezren39 commentedon Nov 14, 2026
agent-note:v1
state: triaged
Triage verdict (fresh, 2026-11-14): task 13913's packet-defect finding stands and its requested split is now executed.
Task 15259 completes as triaged naming task 16816.
Merge pull request #10686 from developing-today/queue/16816-5756-seam…
dezren39 commentedon Nov 16, 2026
Agent note — done: seam record landed (task 16816, lane any-b, 2026-11-16)
State: done (fixed_merged). The seam record is MERGED via PR #10686 (
ae7170d6e9c6cd5031b3d0b7a351df507f57a08b):doc/2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md.Decision recorded (D1): multiplexing extends the existing
fleet-proxy-protoframing — a stream frame family (open/data/window/rst/ping/pong) inside the proven 8-byte length-prefixed JSON contract, negotiated by a newproxy-muxhello capability; 64 KiB frame bound, 256 KiB per-stream credit window as the backpressure bound, rst-based cancellation with a 10 s default per-stream ceiling, and tunnel failure failing all in-flight streams fast with trip ids preserved. HTTP/2 (h2), yamux-crate framing, and QUIC are rejected with reasons in the record. Rollout is capability-gated (both peers advertise, or the pooled path stays in charge byte-for-byte) under the no-one-sided-shipment rule; PR #6490's fail-fast/single-flight recovery and TCP_NODELAY are recorded as landed assumptions, not redo items.Per the packet, the per-crate implementation follow-ons (proto → proxy → client → broker dispatch → acceptance harness) are named in the record §7 and are enqueued only now that the record has landed — that enqueue is the next fleet action on this issue; the acceptance bar for all of them is §6 (128 concurrent / zero failures / ≤2.92 s; warm p50 ≤ 50 ms; ≤2 s failure recovery; trip-ID correlation).
dezren39 commentedon Nov 22, 2026
Merged work, still open. Every pull request that references this issue has merged (#5930, #6490) and none is open, but the issue kept
status:in-review. Tasks that name it as a blocker have been waiting on it.status:in-reviewis removed. Whoever takes this next: run the issue's done check against main. Close the issue if it passes; if not, list what is left here and carry on with it (AGENTS.md, "Finishing work").By: Claude, 2026-11-22 flow review.
Generated by Claude Code
dezren39 commentedon Nov 23, 2026
🤖 Agent note · picked up
doc/2026-11-16T10-40-00Z_design_id5756_multiplexed_streams_seam.md).Done check at origin/main c1700bc (2026-11-23): NOT landed.
fleet-proxy-protostill carries only hello + request/response frames — no stream frame family, noproxy-muxcapability anywhere underpkgs/fleet/. Landed assumptions confirmed present and not redo items: pooled per-port CONNECT (serve.rs), TCP_NODELAY (tunnel.rs), fail-fast/single-flight recovery (PR #6490).This lane lands §7 step 1 only — the
fleet-proxy-protoslice: stream frame types (open/data/window/rst/ping/pong), theproxy-muxcapability id + both-peers negotiation helper, window/credit semantics as types (64 KiB data-frame bound, 256 KiB initial per-stream window), and contract tests (frame bounds, unknown-field tolerance, negotiation). Dormant wire contract only — no behavior change anywhere, per the record's no-one-sided-shipment rule (§5). Steps 2–5 (proxy mux, client path, broker dispatch, acceptance harness) remain for follow-on packets.dezren39 commentedon Nov 23, 2026
Picked up by
felix— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilefelixposts progress markers; after 30 minutes of silence any other worker may pick this up.)