fix: prevent Pi turns from deadlocking on multiple host tool approvals in one step (#19309)
## Background A Pi step containing two approval-required host tool calls exposed only the first approval, leaving the resumed turn permanently waiting for the second result. ## Root Cause runPrompt paused and abandoned the event reader after the first host approval because the protocol did not communicate the step's tool-call cardinality, while Pi's journal and resume barrier retained and awaited both calls. The recorded reproduction and source tracing confirmed this mismatch. ## Summary Added an optional step tool-call count to the harness protocol, made Pi emit the known count, and made runPrompt collect all counted approval or result requests before pausing. Added patch changesets for both published packages. ## Testing Added regression coverage for Pi's parallel tool-call count translation and for surfacing every approval from a counted step, including protocol type coverage. ## End-to-end Validation - `pnpm -C examples/ai-functions exec tsx --input-type=module --eval "<recorded reproduction source>"` exited successfully and reported that both approval requests were surfaced with no deadlock. ## Related Issues Fixes #19302 Closes #19304 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: orcunbalcilar <77508227+orcunbalcilar@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
32349cc10e834452d3601fe9c9445b8fe972bf89
Parent: fe69342
Committed by GitHub <noreply@github.com>
on 8/25/2026, 3:56:29 PM