anomalyco / anomalyco/opencode
Web UI freezes mid-session when the event stream dies silently; only a page refresh recovers
@Hona is already working on this.
Since Jul 28, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Very often the web UI gets stuck mid-session: the spinner keeps spinning on the last line (e.g. a tool header like "Thinking WHOIS:") but nothing new ever arrives. Refreshing the page shows the run actually finished long ago — I've waited 20 minutes on a session that had completed 19 minutes earlier. Without a refresh it never recovers.
Environment
- opencode 1.18.5,
opencode web --port 4096 - Browser on Windows, server inside WSL2 (so the connection crosses the Windows/WSL2 boundary, which is prone to silently killing idle sockets)
Root cause
Two problems stack:
-
The SSE consumer reads the event stream with no liveness check. If the socket dies without a FIN/RST (NAT/proxy eviction, suspend),
reader.read()just never resolves — no error, so the reconnect loop inserver-sdk.tsxnever re-enters. The server's heartbeats can't help: on v2 they're SSE comment frames (: heartbeat), which the parser discards without yielding an event, so the app literally cannot see them. -
Even when a reconnect does happen, nothing repairs the drift.
session_statusis only written bysession.execution.*events, so a run that finished during the outage staysbusyforever, and the active-sessions refetch onserver.connectedis gated on the query having no data — i.e. it only ever fires on the first connect.
#13947 fixed the missed-events-after-reconnect case, but that only helps when the client notices the disconnect. Here the stream dies silently, so there's no reconnect at all — and the status/timeline drift isn't reconciled either way.
Fix incoming.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.