diff --git a/apps/sim/lib/mothership/request/handlers/tool.ts b/apps/sim/lib/mothership/request/handlers/tool.ts index 038944e3420..97ede02d5d0 100644 --- a/apps/sim/lib/mothership/request/handlers/tool.ts +++ b/apps/sim/lib/mothership/request/handlers/tool.ts @@ -1094,6 +1094,7 @@ async function dispatchToolExecution( */ function waitForClientExecution(): Promise { 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( @@ -1216,6 +1217,12 @@ async function dispatchToolExecution( if (completion) { span.setAttribute(TraceAttr.ToolOutcome, completion.status) } + logger.info('Client tool execution settled', { + 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( @@ -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')