Skip to content

Commit 504f5e3

Browse files
committed
fix(assistant-actions): report nothing waiting when a run closes mid-read
1 parent c8341b9 commit 504f5e3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • apps/sim/lib/assistant-actions/application

‎apps/sim/lib/assistant-actions/application/review.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,14 @@ export const listOrganizationAssistantActions = defineAuthorizedOrganizationUseC
6666
.limit(1)
6767
if (!latest) return { runId: null, streamId: null, actions: [], nextCursor: null }
6868
const runId = latest.id
69-
const run = await requireAssistantRun(principal, { ...input, runId }, context.userId)
69+
// The run can close between the lookup above and this one, which means nothing is waiting.
70+
const run = await requireAssistantRun(principal, { ...input, runId }, context.userId).catch(
71+
(error: unknown) => {
72+
if (error instanceof OrchestrationError && error.code === 'conflict') return null
73+
throw error
74+
}
75+
)
76+
if (!run) return { runId: null, streamId: null, actions: [], nextCursor: null }
7077
const records = await db
7178
.select()
7279
.from(copilotAsyncToolCalls)

0 commit comments

Comments
 (0)