Skip to content

Commit f2bcdcd

Browse files
committed
fix(session): propagate all-tools-aborted error to parent (anomalyco#18108)
1 parent 0e1d1bd commit f2bcdcd

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎packages/opencode/src/session/processor.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,17 @@ export namespace SessionProcessor {
519519
})
520520
}
521521
}
522+
// Check if ALL tools were aborted (likely due to output truncation)
523+
const parts = await MessageV2.parts(input.assistantMessage.id)
524+
const toolParts = parts.filter((p) => p.type === "tool")
525+
const aborted = toolParts.filter(
526+
(p) => p.state.status === "error" && p.state.error === "Tool execution aborted",
527+
).length
528+
if (toolParts.length > 0 && aborted === toolParts.length) {
529+
input.assistantMessage.error = new MessageV2.AbortedError({
530+
message: "All tool calls were aborted (likely due to output truncation)",
531+
}).toObject()
532+
}
522533
input.assistantMessage.time.completed = Date.now()
523534
await Session.updateMessage(input.assistantMessage)
524535
if (needsCompaction) return "compact"

0 commit comments

Comments
 (0)