fix(session): harden shell cancellation (#24553)
This commit is contained in:
@@ -334,6 +334,22 @@ describe("Runner", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.live(
|
||||
"cancel does not mask shell defects",
|
||||
Effect.gen(function* () {
|
||||
const s = yield* Scope.Scope
|
||||
const runner = Runner.make<string>(s, { onInterrupt: Effect.succeed("interrupted") })
|
||||
|
||||
const sh = yield* runner
|
||||
.startShell(Effect.never.pipe(Effect.ensuring(Effect.die("boom")), Effect.as("ignored")))
|
||||
.pipe(Effect.forkChild)
|
||||
yield* Effect.sleep("10 millis")
|
||||
|
||||
yield* runner.cancel
|
||||
expect(Exit.isFailure(yield* Fiber.await(sh))).toBe(true)
|
||||
}),
|
||||
)
|
||||
|
||||
// --- shell→run handoff ---
|
||||
|
||||
it.live(
|
||||
|
||||
@@ -1470,6 +1470,10 @@ unix(
|
||||
|
||||
const exit = yield* Fiber.await(loop)
|
||||
expect(Exit.isSuccess(exit)).toBe(true)
|
||||
if (Exit.isSuccess(exit)) {
|
||||
const tool = completedTool(exit.value.parts)
|
||||
expect(tool?.state.output).toContain("User aborted the command")
|
||||
}
|
||||
|
||||
yield* Fiber.await(sh)
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user