fix(proxy): contain post-terminal health write failures - #2319
JustYannicc wants to merge 1 commit into
Conversation
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (12)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe retry loop now contains ordinary failures from post-terminal account-health writes. Responses streams preserve the original terminal event and completion. Specifications and regression tests cover keyed, unkeyed, first-event, later-event, and upstream-error paths. ChangesPost-terminal health failure handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to The streaming change preserves terminal-response completion while containing post-terminal health-write failures; no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files. (10 skipped: 9 unsupported, 1 too large.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review Please review head |
|
✅ Action performedReview finished.
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
This pull request has been automatically marked as stale because it has had no activity for 7 days. It will be closed in 23 more days unless there is new activity. If this is still relevant, please:
Thanks for the contribution 🙏 |
Summary
A failing account-health write after a Responses terminal can emit a second
response.failedevent or abort stream completion. Catch and log ordinary post-terminal health exceptions while preserving the original response, reservation settlement order, and cancellation propagation.Type of change
fix:— bug fix (no behavior change beyond the bug)Linked issue: Fixes #2033
OpenSpec
Change directory:
openspec/changes/archive/2026-09-10-fix-post-terminal-health-failures/Changes
/v1/responsesregression and four stream-handler cases covering keyed owner continuations and an unkeyed stream with visible text followed by a quota error.Pre-terminal health writes, settlement failures, and success recording keep their existing behavior. This is independent of unmerged PRs, including #1905.
Test plan
Both database environment variables pointed to the same dedicated disposable SQLite database before app imports and tests.
The four new stream-handler cases and the public HTTP test fail against pinned main
0f6a31c56and pass with this patch. The active change passed strict validation before archive; main specs passed again after sync. Independent review found no actionable defects. Hosted CI and maintainer review remain pending.Screenshots / output
Public request:
POST /v1/responseswith{"model":"gpt-5.1","instructions":"hi","input":"hello","stream":true}. A synthetic upstream emits text and then raises a quota error; the injected health write raisesRuntimeError.response.failed/usage_limit_reached, thenresponse.failed/upstream_error.response.failed/usage_limit_reached; the health failure is logged with exception information.Checklist
makesubset locally.