You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Race Condition: Resume request fails with "Paused execution not found" during pause persistence #3081
There is a race condition between the persistence of a paused workflow execution and the processing of incoming resume requests. If a resume request (e.g., via API) arrives immediately after a workflow pauses but before the pausedExecutions record is fully committed to the database, the resume attempt fails with a "Paused execution not found" error.
This is critical for high-throughput automation where external systems may attempt to resume a workflow milliseconds after it enters a paused state.
Current Behavior
Workflow Execution: A workflow reaches a pause point.
Persistence Start: The system calls PauseResumeManager.persistPauseResult to save the state.
Race Window: During the DB write operation, an external API calls the resume endpoint (/api/resume/...).
Resume Check: The resume API calls enqueueOrStartResume, which attempts to fetch the pausedExecutions record.
Failure: Since the record is not yet visible/committed, the fetch returns null, and the API throws Paused execution not found.
Persistence End: persistPauseResult completes, but the valid resume request has already been rejected.
Wrap the pause persistence and the subsequent queue processing in a database transaction. This ensures that the paused state is atomically visible to any concurrent resume requests, or properly locks the row so the resume request waits until the transaction completes.
Proposed Implementation:
Modify persistPauseResult to use a transaction that includes both the insertion of the paused execution and the checking of the resume queue.
Activity
h30s commentedon Jan 30, 2026
Hello @waleedlatif1 Can I work on this Issue.
waleedlatif1 commentedon Jan 30, 2026
@h30s yes
cc: @Sg312
h30s commentedon Feb 2, 2026
Hello, @waleedlatif1 @Sg312 I have open the PR #3088 Please Review :)
fix: retry resume during pause persistence
fix(executor): harden resume lookup retries
fix: resolve pause-resume race condition with transaction + retry (si…
fix: add retry for resume race condition (simstudioai#3081)
icecrasher321 commentedon Apr 10, 2026
Fixed in #4058