opencode/packages
Kit Langton ea19ee7966 refactor(session): use onInterrupt finalizer for cancelled tool output
Wire the AI SDK's abortSignal into the tool fiber via runPromiseExit's
signal option so interruption is first-class, and move the "finalize on
cancel" path into an Effect.onInterrupt finalizer that re-awaits the
still-running native Promise uninterruptibly, builds the output, and
posts it through completeToolCall.

Replaces the imperative `if (options.abortSignal?.aborted)` tail check
with structural interruption handling. When the fiber is interrupted,
the finalizer captures the truncated bash output (or MCP tool result)
and the .then on runPromiseExit resolves the SDK's Promise with the
captured value instead of propagating the interrupt cause as a
rejection, so the tool is reported as successfully completed rather
than as a tool-error.

InstanceRef is provided on the tool fiber so InstanceState.context
resolves through ServiceMap rather than falling through to the
AsyncLocalStorage, which the onInterrupt finalizer runs outside of.
2026-04-09 16:40:57 -04:00
..
app release: v1.4.2 2026-04-09 16:24:43 +00:00
console release: v1.4.2 2026-04-09 16:24:43 +00:00
containers chore: bump Bun to 1.3.11 (#18144) 2026-03-23 10:19:21 +10:00
desktop release: v1.4.2 2026-04-09 16:24:43 +00:00
desktop-electron release: v1.4.2 2026-04-09 16:24:43 +00:00
docs
enterprise release: v1.4.2 2026-04-09 16:24:43 +00:00
extensions/zed release: v1.4.2 2026-04-09 16:24:43 +00:00
function release: v1.4.2 2026-04-09 16:24:43 +00:00
identity
opencode refactor(session): use onInterrupt finalizer for cancelled tool output 2026-04-09 16:40:57 -04:00
plugin release: v1.4.2 2026-04-09 16:24:43 +00:00
script refactor: replace bun semver with npm semver package 2026-03-09 15:29:55 -04:00
sdk chore: generate 2026-04-09 20:05:05 +00:00
slack release: v1.4.2 2026-04-09 16:24:43 +00:00
storybook chore(app): markdown playground in storyboard 2026-03-25 09:14:35 -05:00
ui release: v1.4.2 2026-04-09 16:24:43 +00:00
util release: v1.4.2 2026-04-09 16:24:43 +00:00
web release: v1.4.2 2026-04-09 16:24:43 +00:00