From 8df9f54c1def26c91f222868c969f4a9165695a7 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Mon, 27 Apr 2026 16:33:06 -0400 Subject: [PATCH] fix(session): narrow shell cancel fallback --- packages/opencode/src/effect/runner.ts | 5 ++++- packages/opencode/src/session/prompt.ts | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/opencode/src/effect/runner.ts b/packages/opencode/src/effect/runner.ts index bbc85309e8..cbd2359e91 100644 --- a/packages/opencode/src/effect/runner.ts +++ b/packages/opencode/src/effect/runner.ts @@ -159,7 +159,10 @@ export const make = ( Effect.gen(function* () { const exit = yield* Fiber.await(fiber) if (Exit.isSuccess(exit)) return exit.value - if (Cause.hasInterruptsOnly(exit.cause) || ((yield* Deferred.isDone(cancelled)) && !Cause.hasDies(exit.cause))) { + if ( + Cause.hasInterruptsOnly(exit.cause) || + ((yield* Deferred.isDone(cancelled)) && Cause.hasInterrupts(exit.cause) && !Cause.hasDies(exit.cause)) + ) { if (onInterrupt) return yield* onInterrupt return yield* Effect.die(new Cancelled()) } diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 2f359610a3..22d1da4e8f 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -787,9 +787,8 @@ NOTE: At any point in time through this workflow you should feel free to ask the }, } yield* sessions.updatePart(part) - yield* markReady return { msg, part, cwd: ctx.directory } - }).pipe(Effect.onExit(() => markReady)) + }).pipe(Effect.ensuring(markReady)) const cfg = yield* config.get() const sh = Shell.preferred(cfg.shell) @@ -848,7 +847,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the }).pipe(Effect.scoped, Effect.orDie), ).pipe(Effect.exit) - if (Exit.isFailure(exit) && Cause.hasInterrupts(exit.cause)) { + if (Exit.isFailure(exit) && Cause.hasInterrupts(exit.cause) && !Cause.hasDies(exit.cause)) { aborted = true } yield* finish