fix(ai): retry pre-output stream failures - #421
Merged
Conversation
code-yeongyu
enabled auto-merge
July 28, 2026 08:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
npx vitest run test/openai-completions-retry.test.tsnpx vitest run test/provider-retry.test.tsreturn()npx vitest run test/provider-retry.test.ts test/openai-completions-retry.test.ts(13/13)npm run checknode .agents/skills/senpi-qa/scripts/mock-loop-stream-retry.mjsnode .agents/skills/senpi-qa/scripts/mock-loop.mjs --self-test --api openai-completions(20/20)APPROVEafter the iterator-cancellation blocker was fixed and revalidatedSummary by cubic
Fixes OpenAI-compatible streaming by retrying failures before the first SSE chunk and ensuring
onResponsefires once in the right order. Handles DigitalOcean’s “stream failed” error, avoids duplicate output, and preserves iterator cleanup.retryProviderStreamRequestto prefetch the first chunk under the existing bounded, abortable provider retry policy.openai-completionsto the new stream retry wrapper;onResponsenow fires only after a successful prefetch and beforestart, preserving callback ordering.return()for proper cleanup.Written for commit 6012db5. Summary will update on new commits.