You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Event stream (SSE) doesn't resume after tab is backgrounded and restored — requires manual page refresh #47258
In packages/app/src/context/server-sdk.tsx, pagehide always calls stop() on the event stream (lines ~325-328), but pageshow only calls start() again if event.persisted === true (resumeStreamAfterPageShow, lines 162-165).
Since the event stream itself is an open streaming fetch() connection, it is a known bfcache blocker in most browsers — meaning the page is often not bfcache-eligible, so persisted comes back false on pageshow, and start() is never called.
Result: After backgrounding/returning to the tab (switching apps, locking screen, etc.), the live event stream stays dead and the UI stops reflecting session updates until a full manual page refresh remounts the app.
Confirmed as web-UI-specific: OpenChamber (a third-party client using the same server API/event stream) does not exhibit this issue — server side is fine.
This is fixed in v2: the web app restarts its event stream on every pageshow, and resynchronizes after returning to the foreground following inactivity or regaining network connectivity. Upgrade with npm i -g @opencode/cli@latest (or update the desktop app). If you still see this on v2, please open a new issue with the details.
Activity
github-actions commentedon Sep 4, 2026
This issue might be a duplicate of an existing issue. Please check:
server-sdk.tsxnot reconnecting after tab is backgrounded and restored, with the samepagehide/pageshow+event.persistedmechanics identified as the problem.holny commentedon Sep 4, 2026
Same root cause as #39030 (the
pageshowhandler only restarts the stream after a bfcache restore) — picking both up in one fix there.aydemir commentedon Sep 12, 2026
Same issue on Android Chrome here: app goes to background, the SSE stream goes half-open, and nothing reconnects on foreground.
Our fix: aydemir/opencode@sse-only (e8ccb4e) — stall guard + watchdog timer + visibility/online reconnect in packages/app/src/context/server-sdk.tsx, with unit tests (server-sdk.test.ts, 22 passing).
Verified on a real device (3 sessions x ~90 tool calls, no hangs). Feel free to cherry-pick if useful, based on 193de13.
neriousy commentedon Oct 19, 2026
This is fixed in v2: the web app restarts its event stream on every pageshow, and resynchronizes after returning to the foreground following inactivity or regaining network connectivity. Upgrade with
npm i -g @opencode/cli@latest(or update the desktop app). If you still see this on v2, please open a new issue with the details.