fix: more descriptive tool or subtask execution failed error (#5337)

Signed-off-by: Christian Stewart <christian@aperture.us>
This commit is contained in:
Christian Stewart 2025-12-10 15:12:49 -08:00 committed by GitHub
parent e36c349222
commit cbb591eb7d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -338,6 +338,7 @@ export namespace SessionPrompt {
},
},
})) as MessageV2.ToolPart
let executionError: Error | undefined
const result = await taskTool
.execute(
{
@ -362,7 +363,11 @@ export namespace SessionPrompt {
},
},
)
.catch(() => {})
.catch((error) => {
executionError = error
log.error("subtask execution failed", { error, agent: task.agent, description: task.description })
return undefined
})
assistantMessage.finish = "tool-calls"
assistantMessage.time.completed = Date.now()
await Session.updateMessage(assistantMessage)
@ -388,7 +393,7 @@ export namespace SessionPrompt {
...part,
state: {
status: "error",
error: "Tool execution failed",
error: executionError ? `Tool execution failed: ${executionError.message}` : "Tool execution failed",
time: {
start: part.state.status === "running" ? part.state.time.start : Date.now(),
end: Date.now(),