Uh oh!
There was an error while loading. Please reload this page.
fix(serve): add signal handlers for graceful shutdown on Windows - #9866
fix(serve): add signal handlers for graceful shutdown on Windows#9866JosXa wants to merge 1 commit into
Conversation
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
94ed4d7 to
1865217Comparef1ae801 to
08fa7f7Compare1865217 to
02a7979Compare02a7979 to
a4b89fcComparerekram1-node
commented
May 15, 2026
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. |
Summary
Fixes#9859 - Adds signal handlers for graceful shutdown in
opencode serveto prevent ghost port bindings on Windows when the process is terminated by external tools like openralph/opencode-ralph.Changes
packages/opencode/src/cli/cmd/serve.ts: Added signal handlers forSIGINT,SIGTERM, andSIGBREAK(Windows-only) that callserver.stop()before exitingpackages/opencode/src/server/server.ts: AddedreusePort: truetoBun.serve()for defense-in-depth, allowing immediate port reuse even after abnormal terminationRoot Cause
The
opencode servecommand lacked signal handlers to catch termination signals. When plugins like openralph send SIGTERM to terminate the server, the process would die immediately without callingserver.stop(), causing:Solution
SO_REUSEPORTon the server socket, allowing immediate port reuse as a fallback for edge cases