[codex] Retry empty AI stream responses#576
Conversation
PR Overview: Retry Empty AI Stream ResponsesSummaryThis PR fixes issue #575 by extending the retry mechanism to handle empty AI stream responses that occur after Files Changed
Architecture & ImpactProblem SolvedThe Vercel AI SDK's
These scenarios were not retried, causing unnecessary failures. Key Changes
Component Flowflowchart TD
A[answer method] --> B[streamTextWithRetryAndFallback]
B --> C[_executeWithVercelProvider]
C --> D[retryManager.executeWithRetry]
D --> E[streamText call]
E --> F{consumeResult callback?}
F -->|Yes| G[Post-stream consumption]
G --> H[await result.steps]
G --> I[await result.text]
H --> J{Empty?}
I --> J
J -->|Non-schema + empty| K[throw AI_NoOutputGeneratedError]
J -->|Schema or has content| L[Return finalText]
K --> M[Retry via retryManager]
M --> D
Scope & BoundariesIn Scope:
Out of Scope:
Related Components
TestingNew/Updated Tests
Validationcd npm
npm test -- --runInBand tests/unit/retryManager.test.js tests/unit/last-step-text.test.js tests/unit/answer-null-guard.test.jsResult: 3 test suites passed, 35 tests passed. References
Metadata
Powered by Visor from Probelabs Last updated: 2026-06-11T19:20:23.478Z | Triggered by: pr_updated | Commit: a3596c3 💡 TIP: You can chat with Visor using |
✅ Security Check PassedNo security issues found – changes LGTM. ✅ Security Check PassedNo security issues found – changes LGTM. \n\nArchitecture Issues (7)
Performance Issues (6)
Quality Issues (10)
Powered by Visor from Probelabs Last updated: 2026-06-11T19:20:02.323Z | Triggered by: pr_updated | Commit: a3596c3 💡 TIP: You can chat with Visor using |
Summary
Fixes #575.
This changes the AI request path so empty-output failures that happen after
streamText()returns are retried by the same retry budget that already handles provider stream creation. The retry scope now covers bothstreamText()and post-stream consumption (result.steps,result.text, and usage recording) without adding a nestedRetryManager.What changed
No output generatedAI_NoOutputGeneratedErrorstreamTextWithRetryAndFallback()with an optional consumer callback so post-stream consumption can run inside the existing provider retry attempt.result.stepsrejects with an empty-output error.result.outputcarries the payload.ProbeAgentand normalizedjitterhandling.error.name/ constructor name as well as message, code, type, and status.Tests
Focused tests added/updated:
npm/tests/unit/retryManager.test.jsNo output generatedandAI_NoOutputGeneratedErrorare retryable.jitternormalization.npm/tests/unit/last-step-text.test.jsresult.stepsrejects withAI_NoOutputGeneratedError.npm/tests/unit/answer-null-guard.test.jsValidation run:
Result: 3 test suites passed, 36 tests passed.
Additional check:
Result: passed.
I also previously ran the broader unit suite with:
That run had the new/changed tests passing, but the full suite did not complete green locally because several existing tests try to download the missing release asset
probe-v0.6.0-rc88-x86_64-unknown-linux-musl.tar.gzfrom GitHub and receive 404s. It also surfaced existing symbol-edit failures unrelated to this retry change.