From fbf889db83c83db8f4304279cdb5c0398efb5143 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:57:21 -0500 Subject: [PATCH] fix(tui): preserve worker rejection handling (#33448) Co-authored-by: Dax Raad --- packages/opencode/src/cli/tui/worker.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/opencode/src/cli/tui/worker.ts b/packages/opencode/src/cli/tui/worker.ts index 9f33cd5b9..4cf6b2d44 100644 --- a/packages/opencode/src/cli/tui/worker.ts +++ b/packages/opencode/src/cli/tui/worker.ts @@ -13,6 +13,13 @@ import { disposeAllInstancesAndEmitGlobalDisposed } from "@/server/global-lifecy Heap.start() +const onUnhandledRejection = (_error: unknown) => {} + +const onUncaughtException = (_error: Error) => {} + +process.on("unhandledRejection", onUnhandledRejection) +process.on("uncaughtException", onUncaughtException) + // Subscribe to global events and forward them via RPC GlobalBus.on("event", (event) => { Rpc.emit("global.event", event) @@ -65,6 +72,8 @@ export const rpc = { async shutdown() { await InstanceRuntime.disposeAllInstances() if (server) await server.stop(true) + process.off("unhandledRejection", onUnhandledRejection) + process.off("uncaughtException", onUncaughtException) }, }