fix(opencode): prevent process.exit() from killing parent terminal on Windows#29281
fix(opencode): prevent process.exit() from killing parent terminal on Windows#29281LifeJiggy wants to merge 1 commit into
Conversation
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
4804265 to
8f8044b
Compare
|
@rekram1-node, @thdxr and @Brendonovich PTAL |
|
This PR seems to be blocked because several required checks are still showing "Expected — Waiting for status to be reported". Are these CI jobs expected to run automatically here, or could the required checks be stale/misconfigured? |
|
@neur1n Thanks for checking in! The "Expected — Waiting for status to be reported" status is normal — those CI workflows require maintainer approval before they can run (it's a security measure for first-time contributors). Once a maintainer like @rekram1-node, @thdxr, or @Brendonovich approves the workflows, the checks will execute automatically. The branch is up-to-date with dev and conflict-free, so it's just waiting on that approval gate. |
06ca17b to
0164545
Compare
|
Just to keep this active... |
… Windows On Windows, process.exit() calls ExitProcess() which sends CTRL_CLOSE_EVENT to the console, killing the parent terminal (pwsh/cmd). This was exposed by the opentui dependency bump (0.1.99 -> 0.1.103) in v1.14.25 which changed how the TUI process terminates. Fix by avoiding process.exit() entirely on Windows: - In thread.ts: use process.exitCode = 0 and return instead - In index.ts: set exitCode and let the event loop drain; MCP subprocesses are already cleaned up by Effect finalizers Closes anomalyco#28673
0164545 to
2cc7d83
Compare
|
Yes still active 😁 |
|
@LifeJiggy Thanks for the follow-up! Just posting to avoid bot auto-close. 😁 BTW, I've tried to build OpenCode from source with your patch. It seems that the |
|
@neur1n appreciate your concern 😌 I will look into it now I keep waiting and hoping for the team to proceed with it |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
@LifeJiggy Sorry to bother. Are you patching your own OpenCode for daily use? |
|
Yes, I'm using my patched version daily. The PR got auto-closed unfortunately. I just requested a reopen from the maintainers. If they reopen it, I'll fix the compilation issue you mentioned with the |
|
@github-actions @rekram1-node @thdxr @Brendonovich This PR was closed by automated cleanup, but it is still active.
Requesting manual reopen + workflow approval so the CI can run. Happy to address any feedback. Thanks! |
Issue for this PR
Closes #28673
Type of change
What does this PR do?
On Windows, process.exit() calls ExitProcess() internally, which sends CTRL_CLOSE_EVENT to the console group. If the parent terminal (pwsh/cmd) shares the same console group, it gets killed too. This regression was introduced by the opentui dependency bump (0.1.99 ? 0.1.103) in v1.14.25, which changed how the TUI process terminates.
Root cause of the fix: On POSIX, process.exit() sends SIGTERM to the process only. On Windows, ExitProcess() tears down the entire console group. By avoiding process.exit() on Windows and using process.exitCode instead, the parent terminal is never signaled.
Changes:
How did you verify your code works?
Checklist