Retry OpenAI-compatible stream_read_error failures - #888
Conversation
…885) OpenAI-compatible endpoints may emit structured stream failures with type: upstream_error and code: stream_read_error. These should be treated as transient stream/transport failures, entering the bounded retry loop with rollback of partial output. Added stream_read_error to the shared is_transient_transport_error classifier and added regression test covering the structured error payload as suggested in the issue.
adf6ec1 to
250c71a
Compare
Greptile SummaryStructured OpenAI Confidence Score: 5/5No blocking failure remains. The focused regression passed with the actual structured OpenAI error format and confirmed that the shared transport classifier recognizes it as transient.
What T-Rex did
Reviews (2): Last reviewed commit: "test: cover structured stream_read_error..." | Re-trigger Greptile |
| // Formatted output from extract_error_with_retry when receiving: | ||
| // { "type": "error", "error": { "type": "upstream_error", "code": "stream_read_error" } } | ||
| assert!(is_transient_transport_error( | ||
| "upstream_error: stream_read_error" | ||
| )); |
There was a problem hiding this comment.
Fixture misstates formatter output
The structured OpenAI error shown here is formatted by extract_error_with_retry as upstream_error (stream_read_error): OpenAI response stream error (unknown), not upstream_error: stream_read_error. This assertion therefore tests an invented input against the shared predicate instead of the extractor-to-classifier path described by the regression. Add coverage that extracts this payload and classifies the returned value, then update the fixture/comment to the actual formatter output.
Artifacts
- Temporarily injects and runs an exact-payload unit test against the private extractor, captures both expectations, and restores the source; the takeaway is that production files are left unchanged.
- Runs the exact extractor/classifier path while asserting the string documented in transport.rs; the assertion fails because the formatter returned a different value.
- Runs the exact extractor/classifier path with the observed formatter value; it passes and prints `formatted=upstream_error (stream_read_error): OpenAI response stream error (unknown); classified=true`, proving the integration behavior.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-provider-core/src/transport.rs
Line: 196-200
Comment:
**Fixture misstates formatter output**
The structured OpenAI error shown here is formatted by `extract_error_with_retry` as `upstream_error (stream_read_error): OpenAI response stream error (unknown)`, not `upstream_error: stream_read_error`. This assertion therefore tests an invented input against the shared predicate instead of the extractor-to-classifier path described by the regression. Add coverage that extracts this payload and classifies the returned value, then update the fixture/comment to the actual formatter output.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
Addressed the review concern in 437c661. The regression now exercises the real OpenAI error extractor and passes its exact output, Verified locally: — Jcode agent (automated triage), on behalf of @1jehuang |
Summary
stream_read_erroridentifier as a transient transport failureVerification
cargo test -p jcode-provider-core --lib(125 passed)pinned_todos_payload_stays_empty_when_config_offfailure tracked in CI failure: pinned_todos_payload_stays_empty_when_config_off (stale config cache leak from sibling test) #877; Format/Quality are blocked by pre-existing desktop formatting onmasterFixes #885
— Jcode agent (automated triage), on behalf of @1jehuang