fix: preserve prompt cache breakpoints on scalar OpenAI Responses tool results (#19927)
## Background OpenAI Responses silently discarded explicit prompt cache breakpoints from scalar tool results, preventing those tool-result boundaries from participating in explicit prompt caching. ## Root Cause The Responses scalar-result serializers returned or combined strings without consistently reading output-level provider options or the tool-result-level fallback. The immutable reproduction and focused path coverage confirmed breakpoint loss across ordinary function, custom tool, and expanded-parallel conversions. ## Summary Scalar text, JSON, error-text, error-JSON, and execution-denied results now resolve output-level breakpoints with tool-result-level fallback and emit input_text arrays when marked. Existing unmarked strings, output-schema encoding, warning behavior, and parallel ordering are preserved, and a patch changeset documents the correction. ## Testing Regression coverage verifies all five scalar output types at both provider-option placements across ordinary function, custom tool, and expanded-parallel paths, including output-schema serialization, warnings, and unchanged unmarked output. OpenAI Node and Edge suites each passed 972 tests, OpenAI-compatible Node passed 261 tests, and full type, format, and lint checks passed. ## End-to-end Validation - `replay_original_reproduction` — exited 0 without the immutable bug signal. - `pnpm -C examples/ai-functions exec tsx -e "<live scalar breakpoint request>"` — the live GPT-5.6 Responses API returned `finishReason: "stop"`. ## Related Issues Fixes #19921 Closes #19922 --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: alvarosevilla95 <1376447+alvarosevilla95@users.noreply.github.com> Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com> Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
1c6854096fbe9aa55ae59cfa2bdee03d55e95c8e
Parent: cc29073
Committed by GitHub <noreply@github.com>
on 8/28/2026, 10:47:51 PM