You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Serve mode can retain idle instances and stale subprocess state #21570
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.
Activity
github-actions commentedon Apr 8, 2026
This issue might be a duplicate of existing issues. Please check:
serveandwebcommands leak child processes on exit; SSE heartbeat interval leaks on server-initiated close #14091: Memory leak:serveandwebcommands leak child processes on exit — covers similar subprocess and resource cleanup concerns in theservecommand (closed)github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.