Skip to content

Commit 80e6602

Browse files
fix(mothership): preserve workflow identity in background confirmations (#8615)
1 parent f782409 commit 80e6602

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/sim/lib/mothership/persistence/tool-confirm/index.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from '@/lib/mothership/async-runs/lifecycle'
1212
import {
1313
getAsyncToolCalls,
14+
getClaimedWorkflowExecutionId,
1415
revokeExpiredSimToolExecutions,
1516
} from '@/lib/mothership/async-runs/repository'
1617
import { MothershipStreamV1ToolOutcome } from '@/lib/mothership/generated/mothership-stream-v1'
@@ -51,8 +52,10 @@ export async function getToolConfirmation(
5152
})
5253
if (!row) return null
5354
if (row.status === ASYNC_TOOL_STATUS.delivered) {
55+
const executionId = getClaimedWorkflowExecutionId(row.claimedBy)
5456
return {
5557
status: ASYNC_TOOL_CONFIRMATION_STATUS.background,
58+
...(executionId ? { data: { executionId } } : {}),
5659
timestamp: row.updatedAt?.toISOString?.(),
5760
}
5861
}

‎apps/sim/lib/mothership/request/tools/workflow-client-settlement.integration.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
detachAsyncToolCall,
3737
settleClientWorkflowToolExecution,
3838
} from '@/lib/mothership/async-runs/repository'
39+
import { getToolConfirmation } from '@/lib/mothership/persistence/tool-confirm'
3940
import { waitForWorkflowToolCompletion } from '@/lib/mothership/request/tools/client'
4041
import {
4142
reportQueuedClientWorkflowTool,
@@ -288,6 +289,10 @@ describe.runIf(Boolean(redisUrl))('settled client-claimed workflow tools', () =>
288289

289290
await reportQueuedClientWorkflowTool({ toolCallId, executionId, workflowId })
290291

292+
expect(await getToolConfirmation(toolCallId)).toMatchObject({
293+
status: 'background',
294+
data: { executionId },
295+
})
291296
expect(await waiting).toMatchObject({
292297
status: 'background',
293298
data: { workflowId, executionId },

0 commit comments

Comments
 (0)