Builder unblocked when corrections arrive during confirmation
A race condition has been introduced to prevent the AI builder from freezing when users submit corrections mid-confirmation, addressing a deadlock that would otherwise leave workflows stuck indefinitely.
When building workflows with AI assistance, users sometimes spot mistakes mid-process and send corrections. Previously, if a correction arrived while the system was waiting for human approval on a step like credential setup, the builder would freeze permanently — stuck waiting for confirmation that would never come, while the correction sat ignored in a queue.
The issue stemmed from how corrections were processed. The system could only drain queued corrections during active stream chunks. Once the builder paused to wait for confirmation, no new chunks arrived, so corrections were never picked up. The builder remained blocked.
A new race condition resolves this. When a confirmation is pending, the system now simultaneously listens for either a user confirmation or a queued correction. If a correction arrives first, the system automatically confirms the suspended step and resumes the builder with the correction data, allowing the process to continue without manual intervention.
This fix lives in the instance AI runtime, primarily affecting how the resumable stream executor handles suspended tool calls during workflow builds.
View Original GitHub Description
Summary
Fixes a deadlock where the AI builder agent gets stuck forever when a user sends a correction while the builder is waiting for HITL confirmation (e.g. setup-credentials).
Root cause: drainCorrections() is only called inside the stream chunk loop (for await (const chunk of activeStream)). Once the stream ends and the builder hits await waitForConfirmation(), no more chunks are produced, so corrections queued via correct-background-task are never processed... the builder blocks forever.
Fix: Add a waitForCorrection signal that races against waitForConfirmation in resumable-stream-executor.ts. When a correction arrives first, auto-confirm the suspended tool call with override data so the builder can resume and incorporate the correction.