diff --git a/packages/opencode/src/cli/bootstrap.ts b/packages/opencode/src/cli/bootstrap.ts index d5b646dd5c..7f5c9b7bf4 100644 --- a/packages/opencode/src/cli/bootstrap.ts +++ b/packages/opencode/src/cli/bootstrap.ts @@ -6,10 +6,10 @@ export async function bootstrap(directory: string, cb: () => Promise) { directory, init: InstanceBootstrap, fn: async () => { - // Ensure we always dispose instance state, even on errors, - // so the CLI does not hang due to lingering watchers/subscriptions. + // Guarantee teardown of process-scoped state even on errors try { - return await cb() + const result = await cb() + return result } finally { await Instance.dispose() }