webui: every open page holds 15+ event streams, exhausting the browser's six HTTP/1.1 connections and hanging all later requests #1220
Notifications
Due Date
No due date set.
Blocks
Depends on
Reference: sam/archie#1220
Reference in new issue
Block a user
archie-ui serves plain HTTP/1.1 (internal/app/archieui/run.go: http.Server on a plain listener, no TLS, no h2c), so a browser allows six concurrent connections per origin. The dashboard opens a separate EventSource per concern:
After visiting one settings page the pool is full; every later fetch queues until its AbortSignal timeout ('signal timed out'), and a full page navigation to the same origin hangs. Reproduced against a local archie-ui through the Vite dev proxy: New task dialog fetch of /api/workflows timed out after /settings/models, while the endpoint answered in 2ms from curl; the next navigation to / did not complete in 60s.
Server cost scales the same way: each control-plane watch opens its own gRPC Watch to the State Store (internal/webui/api_control_plane.go handleControlPlaneWatch), and each identities watch polls once a second per client (api_identities.go).
Fix: one stream per client (see the blocking beads). HTTP/2 would only raise the ceiling, not remove the design fault.
Acceptance criteria
A tab that has visited every page holds exactly one long-lived connection to archie-ui (plus a chat turn while one is running); fetches and navigation never queue behind streams.
Close reason
Fixed in
93446477Imported from beads
archie-core-aipd· GitHub #1003 · type bug · priority P1 · created 2026-09-25 · closed 2026-09-26sam wrote (originally 2026-09-25):
Investigation complete (no code changed). Claim verified live against the dev stack (archie-ui :8484 via Vite :5173): after one visit to /settings/advanced the control-plane Pinia store holds 12 EventSources (one per generic catalog kind: provider-settings, model-role-assignments, repository-policies, channel-settings, scheduling-policy, tool-settings, plugin-settings, container-runtime-policies, personas, schedules, workflow-execution-settings, workflow-definitions) plus /api/stream = 13 per tab; identities page adds a 14th, logs page a 15th while open. A plain fetch('/api/version') from that tab did not settle within 8s (curl answers in ~2ms), and full page navigation to the same origin timed out after 20s. Recovering required closing the tab. Also observed: the Advanced page audit fetch returned an HTML error page (queued-then-failed symptom). Server side: each watch is one gRPC stream on the single staterpc connection (controlplane.Server.Watch polls store.Resource every 250ms per stream), so cost is store reads per kind per tab, not TCP connections. Fix path confirmed = blocking beads: 1ccs (one multiplexed stream) needs l23o (one upstream watch per kind, keepWatch backoff precedent internal/app/archied/control_plane_watch.go) and 1edh (single identities poller). Note: State Store has no native resource-watch RPC, so the upstream watch stays a poll — one per kind per process, independent of clients. Multiplexed hub precedent exists in internal/webui/sse.go registerSSEConn; chat stream is request-scoped and fine. ConnectionPill reads only /api/stream state, so it shows Connected while fetches starve — worth addressing in 1ccs.