Skip to content

desktop: ignores service disabled flag, background service persists after quit #55861

Open

Description

@ol-loginov

Summary

The desktop app always starts (or connects to) the shared background service by spawning its managed CLI with serve --service, ignoring opencode service set disabled true. The service process keeps running after the app is closed, leaving a lingering daemon that the disabled flag was supposed to prevent.

Environment

  • opencode version: 2.0.30 (CLI); desktop app 2.0.30 (deb, linux amd64)
  • OS: Linux 7.0.0-38-generic x86_64 (Ubuntu)
  • Terminal: n/a (desktop app); TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/bash
  • Install/channel: latest (CLI via opencode upgrade; desktop via opencode-desktop-linux-amd64.deb)
  • Active plugins: opencode-terminal-progress

Reproduction

  1. opencode service set disabled true, then verify:
    • opencode service get disabled → true
    • opencode service status → no shared service running
  2. Launch the OpenCode desktop app.
  3. It spawns its managed CLI: ~/.config/ai.opencode.desktop/cli/2.0.30-x64/opencode-cli serve --service, and opencode service status now returns http://127.0.0.1:49374.
  4. Quit the desktop app.
  5. The serve --service process is still alive; opencode service status still returns the URL.

Expected Behavior

With disabled: true, the desktop app should not start the shared background service — it should use a private server that exits when the app closes, the same behavior documented for CLI clients (https://opencode.ai/v2/docs/cli, opencode service set disabled true). A desktop-side setting to control the shared service would also work.

Actual Behavior

The desktop app never reads the disabled key of the service config. In the desktop app.asar (2.0.30) the service-start command is unconditional:

command: [<managed cli path>, 'serve', '--service', ...]

(with an optional --hostname 0.0.0.0 --port 3084 variant). The disabled flag is only honored by CLI commands (TUI/run/api correctly use private servers with it set). Observed on desktop 2.0.6 (AppImage) and 2.0.30 (deb).

Additional Context

  • Service config ~/.config/opencode/service.json: {"password": "<redacted>", "disabled": true}.
  • The spawned process has no env overrides (XDG_CONFIG_HOME is the default), so it reads the standard config location.
  • Registration in ~/.local/state/opencode/service.json points at the spawned process's pid/url.
  • Reproducible: consistently.
  • Workaround in use: a launcher wrapper that runs opencode service stop after the desktop app exits.

Activity

  1. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report and the clear reproduction steps!

    You're asking for the desktop app to respect opencode service set disabled true (or have its own setting): it would use a private server that exits when the app closes, instead of starting the shared background service and leaving it running.

    Right now the disabled flag only applies to CLI commands. The CLI docs describe it as making private servers the default "for CLI commands". The desktop app always connects to, or starts, the shared service. So this is new behaviour for the desktop app rather than a bug, and I've marked it as a feature request for maintainers to consider. Your wrapper that runs opencode service stop after the app exits is a reasonable workaround for now.

    Related issues:

  2. ol-loginov commented on Oct 15, 2026

    @ol-loginov
    Author

    feature request is ok.
    now I used to launch it with miniwrapper to stop service after close

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

Metadata

Metadata

Assignees

No one assigned

    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