Status light says offline when 5+ agent steps stream at once: the browser's 6-connection limit is used up #48
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The status light says offline while osfd is healthy and the run is progressing.
What happened
On 2026-09-26 at 12:39, run
run_01M3F8PTF3EWBCB721BP869E9N(soundcheck#32,minimalist) fanned out to five agent steps at once: fouropenspec.propose.spec[...]steps andopenspec.propose.design. The web app then reported the backend offline. At the same moment:curl /api/statusanswered 200 in 13 ms, withstate: runningand the backend reachable/healthzwasok: trueand showedsse: {a: 1, b: 5}Cause
osfd is served by uvicorn over HTTP/1.1 (no HTTP/2, no proxy), and browsers allow at most 6 connections per host over HTTP/1.1.
The UI holds two kinds of long-lived connection:
/api/stream: one/api/steps/{id}/deltas: one per running agent step on the open run, capped byMAX_LIVE_STREAMS = 8(ui/src/state/store.ts,syncLiveStreams)With five agent steps running, that is 1 + 5 = 6 open streams, which uses every connection the browser has. Every ordinary request then waits for a free connection, including the 5 s
/api/statuspoll (useStatusinui/src/components/chrome.tsx). AfterOSFD_UNREACHABLE_MS = 12_000without an answer,braidStatereturnsoffline. Snapshots, gate answers and composer sends would stall the same way.It clears once fewer than five agent steps run, or when the tab is closed or switched to another run. The fan-out in
minimalistand in the default pipeline's review lenses can reach this, and the cap of 8 assumed it never would.Fix options
/api/deltas?steps=a,b,c, reopened when the set changes. That is two connections total regardless of fan-out, and every running step stays live. It needs a server-side change.Done when
/api/statuskeeps answering in the browser and the light never says offline.Shipped in #68 (
7c715ec, archived as2026-09-26-one-delta-stream), deployed asfea8788at 23:11 EDT.Hit on production on 2026-09-26 (
run_01M3GB3KN38YT9TZJ7KA7RQ5M0): a fan-out of five agent steps used all six connections. The light said offline, steps showed as silent, step details failed with "signal is aborted without reason", and the page wouldn't reload. A second fault made it last: a step's delta stream never ended with the step, and/healthzshowed five delta streams for finished steps.GET /api/deltas?steps=a,b,ccarries every running agent step's live text on one connection (option 2 above). A page holds two long-lived connections however many agents run.endframe once none of their steps can still write, checked at connect and every heartbeat, and the console does not reconnect. The one-step route stays for pages loaded before the deploy, and ends the same way.e2e/connection-budget.spec.tsruns six agents at once on the fixture and asserts one delta stream plus answering requests. Chromium enforces the six-connection limit, so it reproduces the bug for real.Checked on production after the deploy: a stream for a finished step answered
endand closed in 9 ms, and/healthzshowedsse: {a: 0, b: 0}.