anomalyco / anomalyco/opencode
upgrade: long-running serve from previous version keeps running after auto-update (404 on /api/status, service exits)
Open
@rekram1-node is already working on this.
Since Sep 18, 2026.
2.0
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
After an auto-update (autoupdate: true, 2.0.5 → 2.0.7), the previously running background serve process is not stopped. The stale process keeps reconnecting to the new installation: /api/status returns 404, service registration data appears missing/overwritten, and the background service exits. Killing the stale process restores normal startup.
Environment
- opencode version: 2.0.7 (upgraded from 2.0.5)
- OS: macOS (Darwin 27.0.0, arm64)
- Terminal: Ghostty, TERM=xterm-256color
- Shell: /bin/zsh
- Install/channel: latest (npm
@opencode/cli),autoupdate: true - Active plugins:
/Users/zhangxiaokang/Workspace/opencode2-quota
Reproduction
- Start opencode's background service (e.g.
opencode serve) and leave it running. - Keep that process alive, then install / auto-update to a newer version (here 2.0.5 → 2.0.7).
- Observe the previous-version
serveprocess continuing to run and reconnect to the updated on-disk state. - Use the service / open a session.
Expected Behavior
- An upgrade should terminate or cleanly hand off the long-running
serveprocess from the previous version, or otherwise prevent a stale process from reconnecting against the new installation. - The background service should stay healthy after the upgrade.
Actual Behavior
- The old process logs repeated reconnection attempts and
/api/statusreturns 404. - Service registration data appears lost / overwritten ("service registration file …", "background service exited").
- The background service exits and opencode appears broken until the stale process is killed manually.
Additional Context
- Frequency: occurred once, immediately after the upgrade, only while a stale previous-version
serveprocess was still alive. Killing that process recovered startup instantly; not reproducible when only a single current-version process is running. - Workaround: terminate all stale opencode processes before/after upgrading, or restart the service after the upgrade.
- Related but separate: this environment also overrides the data location via the
OPENCODE_DBenv var; that caused a different symptom (sessions appearing missing due to the wrong DB being opened by a non-interactive start), not the 404/registration failures described here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.