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
Bug: Shared OpenCode host keeps per-directory MCP child processes alive on Windows after switching routed directories/worktrees #21557
On Windows, a shared OpenCode host does not clean up old MCP child processes when switching between routed directories/worktrees.
After using MCP in directory A and then directory B, I still see both mcp-server.exe processes alive under one opencode.exe, even after mcp.disconnect(...) or instance.dispose() for the previous directory. This keeps the executable locked and blocks rebuilds.
Steps to reproduce
Start one shared OpenCode host.
Use MCP in directory A.
Switch to directory B and use MCP there.
Dispose or disconnect the previous directory instance.
Check running processes.
Expected behavior
The old MCP child exits.
Actual behavior
The old MCP child stays alive.
Notes
The host itself is not exiting here. I attached a markdown file with more detailed investigation.
The description appears to be AI-generated — it is an extremely long wall of text with extensive structured sections (lifecycle sketches, upstream evidence lists, root cause hypotheses, risk/caution sections, test plans, etc.). AI-generated walls of text are not acceptable per our contributing guidelines. Please rewrite the issue in your own words, concisely describing the bug, how to reproduce it, and what you observed.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
Thanks for updating the issue! It now follows the contributing guidelines and includes all the necessary information. We appreciate the detailed reproduction steps and the additional context. Your report has been reviewed and the compliance flag has been removed.
The description appears to be AI-generated — it is an extremely long wall of text with extensive structured sections (lifecycle sketches, upstream evidence lists, root cause hypotheses, risk/caution sections, test plans, etc.). AI-generated walls of text are not acceptable per our contributing guidelines. Please rewrite the issue in your own words, concisely describing the bug, how to reproduce it, and what you observed.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
If you believe this was flagged incorrectly, please let a maintainer know.
The linked issues are related because they are all child-process cleanup/lifecycle problems, but they do not appear to be duplicates. Those issues are about cleanup on host/process exit, while this issue is about per-directory MCP cleanup failing inside a still-running shared host on Windows.
Activity
github-actions commentedon Apr 8, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
opencode serveshould propagate SIGTERM to its child processes #20899:opencode serveshould propagate SIGTERM to its child processes — related issue about orphaned child processes accumulating under the opencode hostIf you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Apr 8, 2026
Thanks for updating the issue! It now follows the contributing guidelines and includes all the necessary information. We appreciate the detailed reproduction steps and the additional context. Your report has been reviewed and the compliance flag has been removed.
VooDisss commentedon Apr 8, 2026
The linked issues are related because they are all child-process cleanup/lifecycle problems, but they do not appear to be duplicates. Those issues are about cleanup on host/process exit, while this issue is about per-directory MCP cleanup failing inside a still-running shared host on Windows.
github-actions commentedon Jul 4, 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.