Skip to content

[Bug] opencode serve: multiple instances sharing ~/.config/opencode and ~/.local/share/opencode lose sessions and show broken MCP status after v1.15.11 #30302

Description

@gund

Description

Running multiple opencode serve instances that share the same ~/.config/opencode and ~/.local/share/opencode directories (the default setup — no custom --config flag) no longer works correctly after v1.15.11. This is the expected configuration for serve mode on a server, including Docker containers that bind-mount the user home config/state dirs.

Two distinct symptoms:

1. Sessions disappear from sidebar (project identity deduplication)

When two serve instances run on different local copies of the same git remote repository, one instance's sessions vanish from the sidebar. Opening the duplicate project shows it for ~0.1s then it disappears. This was introduced by v1.15.11's "Remote-backed projects now resolve a stable project identity" — the shared SQLite DB now deduplicates projects by remote identity instead of filesystem path, so the second instance's project identity collides with the first.

See also #29962 (closed as "not planned" without considering serve mode), #19348, #27539, #14570.

2. MCP server status is stale/cross-contaminated

MCP servers defined in the shared opencode.json show incorrect status across instances. One instance starts a Docker MCP server, the other shows it as green (but it's unreachable) or red (but it's running). This is a stale cached state in the shared MCP process tracking.

See also #27771, #16449, #24855, #8171.

Expected Behavior

Multiple opencode serve instances sharing the same config and state directories should each correctly:

  • Show their own sessions in the sidebar, keyed by filesystem path not remote identity
  • Display correct MCP server status independently
  • Not collide on project identity deduplication

Actual Behavior

After v1.15.11:

  • Second copy of same-remote project disappears from sidebar ("project appears for 0.1 second and then disappears")
  • MCP servers show stale/incorrect status across instances

Steps to Reproduce

  1. Run opencode serve on /path/to/project-a (a git repo with remote origin)
  2. Run a second opencode serve on /path/to/project-b (a different local copy of the same git repo)
  3. Both use the default shared ~/.local/share/opencode and ~/.config/opencode
  4. Observe: sessions from step 2 do not appear in the sidebar, or appear briefly then vanish
  5. Configure Docker-based MCP servers in the shared config
  6. Observe: MCP status shows incorrect state across instances

Environment

  • opencode v1.15.11+
  • Ubuntu Server (Docker containers)
  • Shared bind-mounted home directories
  • Default config/state dirs (no --config flag)

Related Issues

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