Skip to content

Commit ab96907

Browse files
fix(wait): poll partially_resumed rows so chained waits resume
The chained-pause flow leaves a row in 'partially_resumed' status (wait1 done, wait2 still waiting). The poll's WHERE filter only matched 'paused', so wait2 was never picked up. Include 'partially_resumed' in the filter.
1 parent 6a927c9 commit ab96907

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

apps/sim/app/api/resume/poll/route.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { pausedExecutions } from '@sim/db/schema'
33
import { createLogger } from '@sim/logger'
44
import { toError } from '@sim/utils/errors'
55
import { generateShortId } from '@sim/utils/id'
6-
import { and, asc, eq, isNotNull, lte } from 'drizzle-orm'
6+
import { and, asc, inArray, isNotNull, lte } from 'drizzle-orm'
77
import { type NextRequest, NextResponse } from 'next/server'
88
import { verifyCronAuth } from '@/lib/auth/internal'
99
import { acquireLock, releaseLock } from '@/lib/core/config/redis'
@@ -62,7 +62,10 @@ export const GET = withRouteHandler(async (request: NextRequest) => {
6262
.from(pausedExecutions)
6363
.where(
6464
and(
65-
eq(pausedExecutions.status, 'paused'),
65+
// 'partially_resumed' rows occur when a chained-pause workflow advanced past
66+
// an earlier wait — e.g. wait1 → agent → wait2 — and now wait2's time pause
67+
// is the one waiting for the cron. Include it alongside fresh 'paused' rows.
68+
inArray(pausedExecutions.status, ['paused', 'partially_resumed']),
6669
isNotNull(pausedExecutions.nextResumeAt),
6770
lte(pausedExecutions.nextResumeAt, now)
6871
)

0 commit comments

Comments
 (0)