From 5c8728b0045a7ec14ba275e9ca33c0e820e16a47 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 18 Nov 2026 16:43:38 -0800 Subject: [PATCH 1/2] improvement(mothership): log each client tool's outcome and wait time --- apps/sim/lib/mothership/request/handlers/tool.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/sim/lib/mothership/request/handlers/tool.ts b/apps/sim/lib/mothership/request/handlers/tool.ts index 038944e3420..de3142b264b 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( From 14cadaff56e328e8d0761edb7faa281b5cdf8eb2 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Wed, 18 Nov 2026 16:58:44 -0800 Subject: [PATCH 2/2] improvement(mothership): record the wait time on a client tool wait that throws --- apps/sim/lib/mothership/request/handlers/tool.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/sim/lib/mothership/request/handlers/tool.ts b/apps/sim/lib/mothership/request/handlers/tool.ts index de3142b264b..97ede02d5d0 100644 --- a/apps/sim/lib/mothership/request/handlers/tool.ts +++ b/apps/sim/lib/mothership/request/handlers/tool.ts @@ -1238,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')