Skip to content

fix(providers): replay ambiguous resets on the OpenCode Go initial send - #5223

Merged
lidge-jun merged 1 commit into
lidge-jun:devfrom
agentHits:fix/opencode-go-reset-replay
Sep 19, 2026
Merged

lidge-jun merged 1 commit into
lidge-jun:devfrom
agentHits:fix/opencode-go-reset-replay

Conversation

@agentHits

@agentHits agentHits commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

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

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed (code comments carry the contract).
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults (replay is same-request, same-key, same body; OAuth/forward/local paths untouched).

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.

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.
@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a0d8acf4-f87b-4ba2-a57e-1c281a756a7f

📥 Commits

Reviewing files that changed from the base of the PR and between b9d430b and 366480c.

📒 Files selected for processing (6)
  • src/lib/errors.ts
  • src/providers/key-failover.ts
  • src/server/request-log.ts
  • src/server/responses/passthrough-dispatch.ts
  • tests/responses/responses-passthrough-transient-policy.test.ts
  • tests/usage/request-log.test.ts
 ________________________________________________________________________________________________________________________________________
< It is a truth universally acknowledged, that a single developer in possession of a good feature, must be in want of an AI code review. >
 ----------------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • review readiness checklist open (0/4 boxes ticked).

What to do

  • Tick all four boxes in the PR description once you're done (currently 0/4).

Review readiness checklist

  • ⬜ 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.

0/4 boxes ticked.

Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked.

@lidge-jun
lidge-jun marked this pull request as ready for review September 19, 2026 22:29
@lidge-jun
lidge-jun merged commit 3f9b956 into lidge-jun:dev Sep 19, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants