Skip to content

The open source coding agent.

TypeScript

aborted toolcalls should be cleaned up

Dax Raadfdaa7f287cb3
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts
index 67e4081fde6..02c98a77be3 100644
--- a/packages/opencode/src/session/index.ts
+++ b/packages/opencode/src/session/index.ts
@@ -564,6 +564,18 @@ export namespace Session {
},
})
next.metadata!.time.completed = Date.now()
+ for (const part of next.parts) {
+ if (
+ part.type === "tool-invocation" &&
+ part.toolInvocation.state !== "result"
+ ) {
+ part.toolInvocation = {
+ ...part.toolInvocation,
+ state: "result",
+ result: "request was aborted",
+ }
+ }
+ }
await updateMessage(next)
return next
}