fix: prevent completed workflow harness turns from being suspended at time-slice deadlines (#19432)
## Background Completed harness turns could fail at the workflow time-slice boundary with a "no unfinished turn to suspend" error while their UI stream was still closing. ## Root Cause The time-slice timer called suspendTurn() unconditionally, using stream completion instead of the session lifecycle state. The deterministic reproduction confirmed the timer fired after hasUnfinishedTurn() became false. ## Summary Guarded timer-driven suspension with hasUnfinishedTurn(), added a patch changeset, and removed reproduction-only artifacts. ## Testing Added deterministic regression coverage for a completed turn with an open stream, asserting normal completion, stream closure, detach cleanup, and zero suspension calls. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx src/reproduction/issue-19419-workflow-harness-time-slice.ts` exited successfully with all terminal assertions passing. ## Related Issues Fixes #19419 Closes #19422 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: jdanielnd <571693+jdanielnd@users.noreply.github.com> Co-authored-by: Felix Arntz <felix.arntz@vercel.com>
A
ai-sdk-factory[bot] committed
309ba00dd4398a37bcd0f2758ecf3c1de2df1c7d
Parent: 32349cc
Committed by GitHub <noreply@github.com>
on 8/25/2026, 4:13:44 PM