Skip to content

Commit adc5b80

Browse files
committed
Tool call timeouts turn into tool results messages of the error instead of kiling the agent
1 parent aa804b1 commit adc5b80

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

backend/src/websockets/websocket-action.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ export const callMainPrompt = async (
229229
})
230230

231231
const { sessionState, toolCalls, toolResults } = result
232-
233232

234233
// Send prompt data back
235234
sendAction(ws, {
@@ -429,7 +428,7 @@ export async function requestToolCall(
429428
}
430429
error?: string
431430
}> {
432-
return new Promise((resolve, reject) => {
431+
return new Promise((resolve) => {
433432
const requestId = generateCompactId()
434433
const timeoutInSeconds =
435434
(input.timeout_seconds || 30) < 0
@@ -443,11 +442,10 @@ export async function requestToolCall(
443442
: setTimeout(
444443
() => {
445444
unsubscribe()
446-
reject(
447-
new Error(
448-
`Tool call '${toolName}' timed out after ${timeoutInSeconds}s`,
449-
),
450-
)
445+
resolve({
446+
success: false,
447+
error: `Tool call '${toolName}' timed out after ${timeoutInSeconds}s`,
448+
})
451449
},
452450
timeoutInSeconds * 1000 + 5000, // Convert to ms and add a small buffer
453451
)

0 commit comments

Comments
 (0)