fix(sse): serve the stored 429 instead of re-sending refused requests - #14588
Merged
diegosouzapw merged 1 commit intoSep 24, 2026
Conversation
maxmad64bis
force-pushed
the
fix/opencode-proxy-dedup-per-request
branch
2 times, most recently
from
September 23, 2026 08:16
0ea3d9a to
3619004
Compare
maxmad64bis
marked this pull request as ready for review
September 23, 2026 08:16
maxmad64bis
force-pushed
the
fix/opencode-proxy-dedup-per-request
branch
from
September 23, 2026 08:40
3619004 to
1a8c367
Compare
This was referenced Sep 23, 2026
Owner
|
Nice, targeted fix — avoiding a re-send through a proxy route that the provider just refused |
diegosouzapw
merged commit Sep 24, 2026
ccb1012
into
diegosouzapw:release/v3.8.51
9 of 16 checks passed
This was referenced Sep 24, 2026
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
A 429 that names a real rate limit used to be served again on the next leg of the same wave: each leg re-offered the same refused route, so one refusal could surface as several identical 429s. The wave now serves the stored 429 directly instead of re-sending a request the provider already refused. Scope: the
attemptloop only; the opt-in park-and-replay path (OPENCODE_PARK_AND_RESUME, default off) runs outside the loop and is out of scope. When every route is refused, the stored 429 is served as-is (no extra call).Why this has no flag, unlike the early stop you gated in #13657: that rework keeps every opencode
429moving to the next account (#9611), and so does this. The request still tries every other route. What changes is that it no longer re-sends through a proxy route that just returned429for this same request: the provider answers per egress address (#9611), so another account behind that route gets the same429. When nothing else is left, the client gets that real upstream429untouched, the same contract as your #13657 rework. The only calls removed are ones that couldn't succeed, which also spares the provider a burst of identical refused requests.Related Issues
Validation
npm run lint— ESLint on the touched files is clean (exit 0 with repo suppressions); the full run is red on the base (🔴 Release branch not green: release/v3.8.51 #14547 —cliproxyAccountHealth.tsTS2322, file outside this diff, identical on base)18bbb101, focused checks rerun afterward: file-size green, complexity 0, eslint 0, unit 3/3 + neighbors 22/22)Tests Added Or Updated
tests/unit/opencode-429-proxy-dedup.test.ts(new, 3 tests): refused route served once instead of re-sent (2 accounts/1 route → 1 call), all-refused fail-open (stored 429 served, no extra call), same-host distinct-port untouched (2 calls, 200 served). Park + early-stop flags unset during tests, restored after.opencode-429-park-resume.test.ts8/8,opencode-transient-rotation.test.ts11/11,opencode-accounts-per-request.test.ts5/5.Coverage Notes
open-sse/executors/opencode.tsonly (+ test): the 3 new cases cover the stored-429 path (write, read, guard). No coverage moved down in any touched file.Reviewer Notes
typecheck:coresingle errorsrc/lib/services/cliproxyAccountHealth.ts(157,5)is base-red (file identical to base, out of scope); zero errors on the touched files. File-size gate is green locally (opencode.tsat the frozen line count, net zero vs base, re-verified after the base advance to18bbb101).✗lines reproduce on the bare base (git diff $mbempty on all three files), same family as test(sse): lock per-key ceiling 429 out of neighbor cooldown scope #14581/feat(sse): distinguish content-stall from transport failure in stream error codes #14582. Docs Gates red is likewise inherited (DEEP_HEALTH_CHECK_ENABLEDenv-contract gap,diff $mbempty on docs). Unit shards red is unstable, not from this PR: this PR's own test never appears in any shard failure log (0 hits on all 4 shards), local re-runs are 3/3 + neighbors 8/8 + 11/11 + 5/5 green. Fast Quality Gates mutation drift covers third-party modules only (opencode.tsis not a mutated module, 0 hits locally). Base-red 🔴 Release branch not green: release/v3.8.51 #14547 cited.