anomalyco / anomalyco/opencode

Web UI freezes mid-session when the event stream dies silently; only a page refresh recovers

Open
#39,352 1 comment 1 reaction 1 assignee View on GitHub

@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:

  1. 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 in server-sdk.tsx never 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.

  2. Even when a reconnect does happen, nothing repairs the drift. session_status is only written by session.execution.* events, so a run that finished during the outage stays busy forever, and the active-sessions refetch on server.connected is 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.