Skip to content

Desktop: ~5 min startup delay retrying background service (probed: false, event stream disconnects every ~3s) #52271

Open

Description

@RomarioBook

Description

After restarting the desktop app, models/tools stay empty for ~5.5 minutes before the UI becomes usable.

The app's main process repeatedly starts/probes the background service and always gets probed: false, while the renderer's event stream (SSE) disconnects every ~3 seconds. The loop runs ~110 times (~5.5 min) and then stops, after which the app works normally.

This is not the engine/server: a standalone opencode run --standalone reaches mcp connected in ~1.4 s and opencode models returns in ~0.2 s. The background server was already running (started earlier); only the app <-> service connection failed.

Evidence (sanitized, Windows desktop 2.0.20, single launch)

main.log:

[12:00:40.174] (main) starting v2 background service
[12:00:40.175] (main) v2 CLI background service ready { version: '2.0.20', probed: true,  url: 'http://127.0.0.1:49374', port: '49374' }
[12:00:42.255] (main) starting v2 background service
[12:00:42.261] (main) v2 CLI background service ready { probed: false, url: 'http://127.0.0.1:49374', port: '49374' }
... repeated every ~3 s ...
[12:06:15.325] (main) starting v2 background service
[12:06:15.329] (main) v2 CLI background service ready { probed: false, url: 'http://127.0.0.1:49374', port: '49374' }

Counts for that run: 111 x starting v2 background service, 110 x probed: false, 1 x probed: true (only the very first probe right after launch succeeded).

renderer.log:

[12:00:42.253] [global-sdk] event stream disconnected [object Object]
[12:00:44.266] [global-sdk] event stream disconnected [object Object]
... every ~3 s ...
[12:06:15.324] [global-sdk] event stream disconnected [object Object]   <- last (110 total)

The background service URL/port stays constant (127.0.0.1:49374), yet the probe keeps reporting false.

Steps to reproduce

  1. On Windows, launch/restart the OpenCode desktop app (2.0.20) while a background service is already running (e.g. restart the app window without stopping the service).
  2. Observe models/tools stay empty for several minutes.
  3. Inspect %APPDATA%\ai.opencode.desktop\logs\<run>\main.log (repeated starting v2 background service / probed: false) and renderer.log (event stream disconnected every ~3 s).

Expected

The app connects to the background service within seconds after launch and models/tools become available immediately.

Actual

~5.5 minutes of ~3-second retries (110 attempts) before the app recovers on its own.

Notes

  • Restarting the app window does not restart the long-running background service; the retry storm happens against an already-running service.
  • opencode service status reports http://127.0.0.1:49374.
  • Full sanitized main.log / renderer.log available on request.

Plugins

None.

OpenCode version

2.0.20 (desktop)

Operating System

Windows 10 Pro 22H2 (10.0.19045), x64

Terminal

Desktop app (Electron); not terminal-specific.

Activity

  1. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    • #52234: Background-service startup retries when port 49374 is unavailable; it also reports Desktop collisions with an existing CLI service.
    • #51587: Desktop cannot reach the local server when the protocol probe times out, with an event-stream failure during startup.
    • #23011: Windows Desktop models/providers/history are unavailable during startup until the app recovers after a long delay.
    • #30597: Windows Desktop renderer loses its server connection and reports event-stream errors after the sidecar silently dies.
  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed logs. I couldn't reproduce this here: it needs the desktop app on Windows, and this sandbox is Linux-only.

    What I could check: with @opencode/[email protected] on Linux, a background service started with opencode service start (it came up on 127.0.0.1:49374) kept the event stream open with regular heartbeats and didn't disconnect. The probed: false lines look expected: the desktop app only runs the early probe on its first connect, and every later reconnect logs probed: false. Each of those reconnects starts because the event stream dropped. So the real question is why the stream disconnects every ~3 s on your machine.

    These would help a maintainer with a Windows setup:

    • The actual disconnect error. renderer.log shows it only as [object Object]. If you open DevTools in the desktop app during the slow window, the console entry [global-sdk] event stream disconnected should show an error field with the real message.
    • Whether it still happens on the latest desktop release, since several desktop service fixes have landed since 2.0.20.
    • Whether anything sits between the app and 127.0.0.1 (antivirus or firewall software, a proxy, VPN), and whether curl -N -u opencode:<password> http://127.0.0.1:49374/api/event stays connected during that window. The password is in the service's service.json; please don't post it here.

    A maintainer with a Windows environment will need to look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions