Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/sim/lib/mothership/request/handlers/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,6 +1094,7 @@ async function dispatchToolExecution(
*/
function waitForClientExecution(): Promise<AsyncCompletionSignal> {
toolCall.status = 'executing'
const waitStartedAt = Date.now()
const ownTimeoutMs = options.timeout || CLIENT_TOOL_RESULT_TIMEOUT_MS
// Even past its deadline a wait lasts long enough to read a result the client already saved.
const timeoutMs = Math.max(
Expand Down Expand Up @@ -1216,6 +1217,12 @@ async function dispatchToolExecution(
if (completion) {
span.setAttribute(TraceAttr.ToolOutcome, completion.status)
}
logger.info('Client tool execution settled', {
Comment thread
waleedlatif1 marked this conversation as resolved.
Resolved
toolCallId,
toolName,
outcome: completion?.status ?? 'missing',
durationMs: Date.now() - waitStartedAt,
})
const backgroundIsSuccess = toolName === 'run_workflow' && args?.async === true
handleClientCompletion(context, toolCall, toolCallId, completion, backgroundIsSuccess)
await emitSyntheticToolResult(
Expand All @@ -1231,6 +1238,7 @@ async function dispatchToolExecution(
logger.error(`Client-executable ${scopeLabel}tool wait failed`, {
toolCallId,
toolName,
durationMs: Date.now() - waitStartedAt,
error: toError(err).message,
})
return errorCompletion('Tool wait failed')
Expand Down