diff --git a/apps/sim/lib/mothership/persistence/tool-confirm/index.ts b/apps/sim/lib/mothership/persistence/tool-confirm/index.ts index 5c15be12bde..800e162c265 100644 --- a/apps/sim/lib/mothership/persistence/tool-confirm/index.ts +++ b/apps/sim/lib/mothership/persistence/tool-confirm/index.ts @@ -11,6 +11,7 @@ import { } from '@/lib/mothership/async-runs/lifecycle' import { getAsyncToolCalls, + getClaimedWorkflowExecutionId, revokeExpiredSimToolExecutions, } from '@/lib/mothership/async-runs/repository' import { MothershipStreamV1ToolOutcome } from '@/lib/mothership/generated/mothership-stream-v1' @@ -51,8 +52,10 @@ export async function getToolConfirmation( }) if (!row) return null if (row.status === ASYNC_TOOL_STATUS.delivered) { + const executionId = getClaimedWorkflowExecutionId(row.claimedBy) return { status: ASYNC_TOOL_CONFIRMATION_STATUS.background, + ...(executionId ? { data: { executionId } } : {}), timestamp: row.updatedAt?.toISOString?.(), } } diff --git a/apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts b/apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts index de69ea80969..a67cdf1e019 100644 --- a/apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts +++ b/apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts @@ -36,6 +36,7 @@ import { detachAsyncToolCall, settleClientWorkflowToolExecution, } from '@/lib/mothership/async-runs/repository' +import { getToolConfirmation } from '@/lib/mothership/persistence/tool-confirm' import { waitForWorkflowToolCompletion } from '@/lib/mothership/request/tools/client' import { reportQueuedClientWorkflowTool, @@ -288,6 +289,10 @@ describe.runIf(Boolean(redisUrl))('settled client-claimed workflow tools', () => await reportQueuedClientWorkflowTool({ toolCallId, executionId, workflowId }) + expect(await getToolConfirmation(toolCallId)).toMatchObject({ + status: 'background', + data: { executionId }, + }) expect(await waiting).toMatchObject({ status: 'background', data: { workflowId, executionId },