fix(providers): replay ambiguous resets on the OpenCode Go initial send - #5223
Merged
Merged
Conversation
Zen gateway stalls-then-drops inference sends; the ambiguous pre-header reset became a synthetic non-replayable 429 that surfaced immediately (and logged as rate_limit_exceeded, hiding the real cause). The Go destination carries subscription inference-only traffic, so the passthrough initial send now opts into bounded reset replays there; recovery legs keep the fail-closed refusal. The log classifier also names the proxy refusal by its message instead of calling it provider throttling.
Contributor
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (6)
✨ 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 |
Contributor
|
✅ Deterministic PR hygiene checks passed. |
Contributor
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
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
Follow-up to #5067/#5158. The patient 429 fallback covers real upstream throttles, but a second 429 shape kept surfacing untouched: the Zen gateway stalls-then-drops inference sends, and the ambiguous pre-header reset becomes a synthetic non-replayable 429 (deliberately never replayed, never logged as anything but a 429). One such case (18s stall, single send, no recovery) aborted a user goal with
exceeded retry limit.This scopes a bounded reset replay to the OpenCode Go initial send on the Responses passthrough lane (
replaySafe, still capped by the shared per-request send budget). Rationale for the scope: Zen/Go traffic is subscription inference-only, so a replay cannot duplicate anything but compute; every other destination keeps the fail-closed refusal, and recovery legs are untouched. A second, purely observational change: the log classifier now names a proxy refusal by its message (upstream_reset_replay_refused) instead of logging it as provider throttling (rate_limit_exceeded).Verification
bun test tests/usage/request-log.test.ts tests/responses/responses-passthrough-transient-policy.test.ts tests/lib/upstream-retry.test.ts tests/providers/upstream-transient-retry.test.ts tests/providers/rate-limit-retry.test.ts— 164 pass, 0 fail, including new cases for the refusal code and the single-legged replaySafe wiring.bun run typecheck— clean.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.