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
[global-sdk] event stream failed race condition on startup and after config hot-edit causes UI to hang indefinitely #41986
This occurs ~281ms after server ready is logged in main.log. The UI displays "Reasoning" animation but no request is ever sent to the AI server. The only way to recover is to resend a message or create a new chat, which re-establishes the connection.
Steps to Reproduce
Start opencode (or edit opencode.json while running)
The SDK should retry establishing the event stream automatically, or wait for sidecar to be fully ready before attempting connection.
Actual Behavior
Connection fails silently on first attempt. UI state is not synchronized with actual connection status. User must manually "kick" by resending message or creating new chat.
Race condition between sidecar server ready event and SDK initialization. The renderer attempts to establish an event stream before the internal connection pool is fully initialized, especially after config hot-edit when sidecar restarts but renderer does not receive a proper readiness notification.
Suggested Fix
Add retry logic with exponential backoff for [global-sdk] event stream failed errors
Ensure renderer waits for a confirmed ready state from sidecar before attempting SDK initialization
Sync UI "Reasoning" state with actual connection status to prevent indefinite spinner when connection is down
The core symptom — renderer losing the event stream with no recovery, sidecar appearing ready but connection failing — matches across all three reports, though your case specifically adds the startup race condition timing and config hot-edit trigger.
Seeing what looks like the same startup race with a headless opencode serve (1.18.18, Linux), driven by an SDK client (Paseo daemon), so this is not desktop-specific.
Timeline from the client journal plus opencode.db timestamps: the server answers HTTP (session.create) 2 seconds after spawn, but a /global/event subscription opened right at startup delivers nothing, not even the initial greeting, for 30+ seconds. The client's 30s first-record deadline fires and the run dies. The consumer recovers on a later reconnect against the same server and session.
Once a server is past startup, fresh subscribers get their first SSE record in a few ms (checked against 18 running servers), so the bad window is only right around boot. Happy to share logs and timestamps if useful.
Activity
github-actions commentedon Aug 12, 2026
This issue might be a duplicate of existing issues. Please check:
[global-sdk] event stream error [object Object]symptom, silent death with no sidecar/main log entries, and UI hang until restart[global-sdk] event stream error→Failed to fetchcascade on macOS (fresh install, no plugins), references Desktop: sidecar dies silently on Windows, renderer loses connection (event stream error) #30597 as relatedThe core symptom — renderer losing the event stream with no recovery, sidecar appearing ready but connection failing — matches across all three reports, though your case specifically adds the startup race condition timing and config hot-edit trigger.
axsuul commentedon Aug 24, 2026
Seeing what looks like the same startup race with a headless
opencode serve(1.18.18, Linux), driven by an SDK client (Paseo daemon), so this is not desktop-specific.Timeline from the client journal plus opencode.db timestamps: the server answers HTTP (session.create) 2 seconds after spawn, but a /global/event subscription opened right at startup delivers nothing, not even the initial greeting, for 30+ seconds. The client's 30s first-record deadline fires and the run dies. The consumer recovers on a later reconnect against the same server and session.
Once a server is past startup, fresh subscribers get their first SSE record in a few ms (checked against 18 running servers), so the bad window is only right around boot. Happy to share logs and timestamps if useful.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊