Description
Shared opencode serve instances can keep stale per-directory resources alive longer than intended: idle instances, subprocess handles, RPC/listener state, and related background cleanup work are not aggressively reclaimed. This shows up as long-lived server state even after the relevant worktree/session is no longer active.
The hardening work here adds explicit instance activity tracking, idle disposal, stale bash process reaping, and listener/cache cleanup so per-directory instances can shut down cleanly instead of accumulating background state.
Plugins
No response
OpenCode version
0.0.0--202604082056 (local built binary / dev branch work)
Steps to reproduce
- Start
opencode serve against a project.
- Create activity that opens per-directory instances and starts subprocess-backed work (bash/task/LSP/session flows).
- Leave the server idle or switch away from the active worktree/directory.
- Observe that process/listener cleanup is incomplete and state can linger longer than expected.
Screenshot and/or share link
No response
Operating System
Ubuntu 24.04
Terminal
Ghostty
Description
Shared
opencode serveinstances can keep stale per-directory resources alive longer than intended: idle instances, subprocess handles, RPC/listener state, and related background cleanup work are not aggressively reclaimed. This shows up as long-lived server state even after the relevant worktree/session is no longer active.The hardening work here adds explicit instance activity tracking, idle disposal, stale bash process reaping, and listener/cache cleanup so per-directory instances can shut down cleanly instead of accumulating background state.
Plugins
No response
OpenCode version
0.0.0--202604082056 (local built binary / dev branch work)
Steps to reproduce
opencode serveagainst a project.Screenshot and/or share link
No response
Operating System
Ubuntu 24.04
Terminal
Ghostty