GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — service: concurrent launch stalls after background auto-update · Issue #38567 · anomalyco/opencode

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

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
service: concurrent launch stalls after background auto-update#38567
Copy link
Assignees
rekram1-node
Labels
2.0

Description

@ewatch
ewatch
opened on Jul 23, 2026
Issue body actions

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
    assigned
    rekram1-node
    on Jul 23, 2026
  2. github-actions commented on Jul 23, 2026

    @github-actions
    github-actionsBot
    on Jul 23, 2026 – with GitHub Actions
    Contributor
    More actions

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

    • 2.0: managed-service restart causes reconnect herd and resource spikes #36285: Covers the broader umbrella of managed-service auto-update replacing a healthy service and disconnecting connected clients, including reconnect herds and cold-start delays during version replacement — very closely related to the stall described here.
    • cli: managed reconnect waits until fourth failure to ensure service #36581: Covers the managed reconnect delay (client waits until the fourth failure before attempting to ensure the service is running), which matches the repeated two-minute timeouts observed in this report.
    • service (v2): restart spawns serve --service in a silent retry loop, forcing manual process kill #37239: Covers the background service spawning many serve --service processes in a retry loop after a restart/update, which may share a root cause with the repeated launch attempts visible in this report's logs.
  3. opencode-agent
    added
    2.0
    on Jul 23, 2026
  4. suse-coder commented on Aug 25, 2026

    @suse-coder
    suse-coder
    on Aug 25, 2026
    More actions

    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)
    
  5. jonhydetitanbay commented on Sep 11, 2026

    @jonhydetitanbay
    jonhydetitanbay
    on Sep 11, 2026
    More actions

    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.

  6. opencodejr commented on Oct 28, 2026

    @opencodejr
    opencodejrBot
    on Oct 28, 2026
    Contributor
    More actions

    Thanks for the detailed report and the logs. I tried to reproduce this but couldn't.

    The builds you reported (0.0.0-next-15919 → 0.0.0-next-16088) aren't published on npm, so I used the nearest published pair, 2.1.4 → 2.2.0, on Linux:

    1. Started the background service on 2.1.4 and kept a 2.1.4 TUI open.
    2. Swapped the installed version to 2.2.0 while that service was still running, to stand in for the auto-update.
    3. Started three 2.2.0 TUI clients at the same moment.

    Each new client saw the older service version and replaced it. One 2.2.0 service came up, and all three clients opened the TUI within seconds. The log had no server resolution failed or Timed out waiting for the background service to start lines.

    Several changes to service startup and replacement have landed since next-16088. If it happens again on a current release, these would help:

    • The full log section from the updated OpenCode line to the first server resolution failed, especially any background service starting lines and their reason, plus any errors from the serve --service runs. Please redact anything private.
    • Whether your cmux plugins were loaded in the new service, since startup logged schema-validation warnings for both. If you can, also try with them turned off.
    • Whether ~/.local/state/opencode/service.json changed while the client was waiting (version and pid).
    • Whether the older session was still busy with a prompt when the update happened.
  7. opencodejr
    closed this as not plannedon Oct 31, 2026
  8. opencodejr commented on Oct 31, 2026

    @opencodejr
    opencodejrBot
    on Oct 31, 2026
    Contributor
    More actions

    Closing this for now: I couldn't reproduce the stall, and without the extra details it isn't possible to look further. When I swapped versions under a running service (2.1.4 → 2.2.0) and launched several clients at once, every client replaced the older service and opened the TUI within seconds, with no service-resolution timeouts.

    If it happens again on a current release, please comment here or open a new issue. These would help:

    • The log section from updated OpenCode through the server resolution failed lines, including any background service starting lines and errors from the serve --service runs.
    • Whether the cmux plugins were loaded in the new service.
    • Whether ~/.local/state/opencode/service.json changed while the client was waiting.

    Thanks again for the detailed report.

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

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

2.0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.