Repository navigation
fix(proxy): single-count 5xx last-attempt fall-through - #7
Merged
Merged
Conversation
Guard the 5xx branch recordRequest with if (attempt < maxAttempts - 1) so the final attempt counts once via the tail recorder (same pattern as f85cb2e throttle-403). Display-only: add throttle-403 legend chip + retitle other-4xx. Plan: 2026-10-10-5xx-last-attempt-double-count (amended: breaker 1/0 first-5xx-only feed).
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 #6. The 5xx branch in
src/proxy/server.tscalledkeyManager.recordRequest(key.id, { ... successful: false })and then, on thelast attempt, fell through to the tail recorder instead of
continue-ing —counting one upstream 5xx twice (
requestCount+2,errorCount+2, latencysample folded twice).
Changes (2 files, +13/−8)
src/proxy/server.ts— wraps the branch recorder inif (attempt < maxAttempts - 1), the exact pattern off85cb2e, sofailover attempts count in-branch and the terminal attempt counts once at
the tail.
src/dashboard/public/app.js— display-only: adds thethrottle-403 → short cooldown + failoverlegend chip and retitles theother 4xxneighbor so itno longer claims 403s.
Behavior guarantee
The ONLY behavior change is which of two identical-valued
recordRequestcalls executes. Breaker feed,
markError,attemptedKeyIds, circuit-openemit, cooldowns, affinity, quota/throttle/burst paths: byte-identical.
Verification
npm run typecheckgreen;npm run build(tsc + dashboard-public copy) green.configDir, spare ports, stub 500 upstream, fake keys,NTFY off) 9/9 PASS: per-key request/error exactly 1/1, breaker 1/0 per the
first-5xx-only feed design (
server.ts:253-258), both keysactive,verbatim 500 back.
key2.requestCount === 2/errorCount === 2; fixed code shows 1/1.node --checkpasses;throttle-403andgenuine auth 403seach appear exactly once in built
distoutput.(req/ok/err, last 200) — no +2 signature, counters honest.
Plan:
2026-10-10-5xx-last-attempt-double-count(amended mid-flight: breakerassertion corrected 1-per-key → 1/0 with
server.ts:253-258citation, plus §7erratum entry; executed proof is the empirical settler).