Skip to content

service: concurrent launch stalls after background auto-update #38567

Open

Description

@ewatch

Summary

Starting a second opencode2 instance while another session was active triggered a background-service update. The new client remained on "Waiting for background service" and eventually returned to the shell instead of reconnecting, while the logs showed repeated service-resolution timeouts and repeated attempts to launch the service.

No session data was lost, and starting opencode2 again recovered successfully.

Environment

  • opencode version: 0.0.0-next-16088, automatically updated from 0.0.0-next-15919
  • OS: Darwin 25.5.0, arm64
  • Terminal: Ghostty; TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: next, npm installation under Node.js 22.20.0
  • Active plugins: cmux-session.js and cmux-feed.js configured globally; the startup log also contains schema-validation warnings while loading both plugins

Reproduction

  1. Run an opencode2 session and leave a prompt potentially still processing.
  2. From another terminal, start a second opencode2 instance while the shared service is still running the previous next-channel version.
  3. The background service detects and installs a newer next-channel version.
  4. Observe the second client displaying "Waiting for background service."
  5. The client eventually returns to the shell instead of opening the TUI or reconnecting.
  6. Start opencode2 again; it connects successfully and existing session data is still present.

This occurred once during an automatic update and has not yet been reproduced deliberately.

Expected Behavior

The update and service restart should be coordinated across active clients. A newly launched client should wait for the updated service and reconnect automatically, or terminate promptly with an actionable error.

Active sessions should either remain connected or reconnect without losing in-flight state.

Actual Behavior

The newly launched client stayed at "Waiting for background service" and returned to the shell. A manual second launch was required.

The log confirms the update:

timestamp=2026-07-23T20:38:58.698Z level=INFO run=6c24ee7c message="updated OpenCode" from=0.0.0-next-15919 to=0.0.0-next-16088 method=npm role=server

A client using the new version started shortly afterward:

timestamp=2026-07-23T20:41:08.093Z level=INFO run=5f55bac4 message="cli starting" version=0.0.0-next-16088 channel=next local=false args=[] role=cli

Multiple client run IDs then reported repeated two-minute service-resolution timeouts:

timestamp=2026-07-23T20:43:08.466Z level=INFO run=9939547c message="server resolution failed" component=client attempt=1 error="Timed out waiting for the background service to start" role=cli
timestamp=2026-07-23T20:45:09.720Z level=INFO run=9939547c message="server resolution failed" component=client attempt=2 error="Timed out waiting for the background service to start" role=cli
timestamp=2026-07-23T20:47:10.975Z level=INFO run=9939547c message="server resolution failed" component=client attempt=3 error="Timed out waiting for the background service to start" role=cli
timestamp=2026-07-23T20:49:12.228Z level=INFO run=9939547c message="server resolution failed" component=client attempt=4 error="Timed out waiting for the background service to start" role=cli
timestamp=2026-07-23T20:51:13.488Z level=INFO run=9939547c message="server resolution failed" component=client attempt=5 error="Timed out waiting for the background service to start" role=cli
timestamp=2026-07-23T20:53:14.734Z level=INFO run=9939547c message="server resolution failed" component=client attempt=6 error="Timed out waiting for the background service to start" role=cli

Three run IDs followed this repeated timeout pattern, while the log also showed many opencode2 serve --service launch attempts.

Additional Context

  • Frequency: observed once.
  • Trigger: automatic next-channel update while another OpenCode session was active.
  • Recovery: running opencode2 again worked.
  • Data loss: none observed.
  • The state of the original in-flight prompt at update time is uncertain.
  • opencode2 service status currently succeeds.
  • opencode2 api get /api/health currently reports the service as healthy on 0.0.0-next-16088.
  • Standalone mode was not tested because the apparent trigger is specifically an update of the shared background service.
  • Relevant logs were taken from ~/.local/share/opencode/log/opencode.log and sanitized to exclude prompts, project paths, credentials, and unrelated output.

Activity

  1. github-actions commented on Jul 23, 2026

    @github-actions
    Contributor

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

  2. suse-coder commented on Aug 25, 2026

    @suse-coder

    I get he same error

    opencode2 service restart
    [10:03:25.418] ERROR (#1): Error: Timed out waiting for the background service to start
        at <anonymous> (/$bunfs/root/chunk-bxg2m7b2.js:3:2196)
        at service.ensure (/$bunfs/root/chunk-0k4ww1ay.js:2:1057)
        at service.ensure (definition) (/$bunfs/root/chunk-bxg2m7b2.js:3:729)
        at cli.service.restart (/$bunfs/root/chunk-hyf3pfrk.js:64:1007)
        at cli.service.restart (definition) (/$bunfs/root/chunk-0k4ww1ay.js:2:961)
    
  3. jonhydetitanbay commented on Sep 11, 2026

    @jonhydetitanbay

    I’m seeing this consistently in OpenCode Beta Desktop on macOS arm64 after updates.

    Reproduced across:

    • beta-19086 → beta-19157
    • beta-19157 → beta-19192
    • beta-19192 → beta-19425

    The app updates successfully, but the detached service from the previous version remains running. The updated app then stalls while starting its service.

    Example:

    • App: beta-19425
    • Running service: .../cli/0.0.0-beta-19192/opencode-cli serve --service
    • Error: Timed out waiting for the background service to start

    Quitting OpenCode before applying the update does not stop the service.

    Workaround:

    <current bundled opencode-cli> service stop

    Then relaunch OpenCode Beta.

    Expected: Desktop should detect the service version mismatch and restart it automatically.

    No session data loss observed.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions