fix: improve Windows managed OpenCode shutdown and launch behavior (#844)

* fix: windows shutdown and restart orphaned cleanup

* fix: launch managed OpenCode directly on Windows
Unwrap OpenCode wrappers to launch directly on Windows, improving shutdown reliability and avoid orphans.

* fix: restore desktopNotifyEnabled in health snapshot

---------

Signed-off-by: Dr. Zed <142888684+DocterZed@users.noreply.github.com>
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Dr. Zed
2026-04-11 22:29:09 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent a3d73a8b67
commit 636dcd5314
8 changed files with 512 additions and 100 deletions
@@ -17,6 +17,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
getOpenCodeProcess,
setOpenCodeProcess,
killProcessOnPort,
waitForPortRelease,
getServer,
getUiAuthController,
setUiAuthController,
@@ -58,7 +59,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
if (openCodeProcess) {
console.log('Stopping OpenCode process...');
try {
openCodeProcess.close();
await openCodeProcess.close();
} catch (error) {
console.warn('Error closing OpenCode process:', error);
}
@@ -66,6 +67,9 @@ export const createGracefulShutdownRuntime = (dependencies) => {
}
killProcessOnPort(portToKill);
if (!(await waitForPortRelease(portToKill, 5000))) {
console.warn(`Timed out waiting for OpenCode port ${portToKill} to be released during shutdown`);
}
} else {
console.log('Skipping OpenCode shutdown (external server)');
}