Repository navigation
[STALE: REBASE FROM NEW FORK] anthropic-pool: per-model-family cooldown on seven_day_<family> 429s; log limit headers on every 429 - #14
Draft
vadymhimself wants to merge 4 commits into
Conversation
… log limit headers on every 429 A 429 whose representative claim is seven_day_<family> (e.g. seven_day_opus) for a request of that family now cools only (account, family): the account keeps serving its other models, and an Opus request is refused only when every account is out of Opus. Every other 429 still cools the whole account. Each 429 logs model, representative-claim, unified/5h/7d status, retry-after, reset and the chosen cooldown, and the no-eligible-account line now counts cooled, re-auth and unusable accounts instead of claiming they are all in cooldown. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
✅ Deterministic PR hygiene checks passed. |
Co-Authored-By: Claude Code <noreply@anthropic.com>
⏳ DRAFT
What to do
Its title has been prefixed with |
…nd the cooldown end on each 429 Co-Authored-By: Claude Code <noreply@anthropic.com>
…line The 429 log line now prints on every 429 (pinned included), so the pin e2e counts the '; failing over to' line that only a real account switch prints. Co-Authored-By: Claude Code <noreply@anthropic.com>
vadymhimself
added a commit
that referenced
this pull request
Nov 10, 2026
…quest-shape 429 no longer cools the account (+ #14, .18) (#15) * fix(anthropic-pool): cool a model-scoped weekly 429 per model family, log limit headers on every 429 A 429 whose representative claim is seven_day_<family> (e.g. seven_day_opus) for a request of that family now cools only (account, family): the account keeps serving its other models, and an Opus request is refused only when every account is out of Opus. Every other 429 still cools the whole account. Each 429 logs model, representative-claim, unified/5h/7d status, retry-after, reset and the chosen cooldown, and the no-eligible-account line now counts cooled, re-auth and unusable accounts instead of claiming they are all in cooldown. Co-Authored-By: Claude Code <noreply@anthropic.com> * chore(release): 2.65.0-vadymhimself.18 Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(anthropic-pool): log every anthropic-ratelimit-unified-* header and the cooldown end on each 429 Co-Authored-By: Claude Code <noreply@anthropic.com> * test(pin): count only real 429 failovers, not the per-429 diagnostic line The 429 log line now prints on every 429 (pinned included), so the pin e2e counts the '; failing over to' line that only a real account switch prints. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(anthropic): give an OAuth source replay the Claude identity system block A replayed Anthropic Messages body from a non-Claude-Code client (Hermes) reached the subscription endpoint with only its own system prompt. The translated path always prepends the identity block; the replay path did not. Prepend it on OAuth when no system block already carries a Claude Code or Agent SDK identity line, so Claude Code bodies (identity after the billing-header block) are not doubled. Replay test sources that stand for Claude Code now carry its identity line. Co-Authored-By: Claude Code <noreply@anthropic.com> * fix(anthropic-pool): a request-shape 429 fails only the request, never cools the account An account is cooled (and the request fails over) only on a real limit: a unified window marked rejected, or a Retry-After when Anthropic sent no unified status. A 429 whose unified status is still "allowed", or with no limit evidence, is a refusal of this request's shape (e.g. a replay without the Claude Code identity); before, it benched every client on the account. Also moves prependClaudeIdentity next to the identity constant in src/oauth/anthropic.ts so src/adapters/anthropic.ts stays within its file-size cap. Co-Authored-By: Claude Code <noreply@anthropic.com> * Cool on a 429 with no unified status, as before Only a 429 whose unified status is present and says allowed skips the cooldown; a header-less 429 keeps the legacy cooldown and failover the routing tests expect. Co-Authored-By: Claude Code <noreply@anthropic.com> --------- Co-authored-by: Claude Code <noreply@anthropic.com>
Collaborator
Author
|
This PR is based on the superseded 2.65 gateway line. Rebuild the change from |
This branch has not been deployed
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.
P1 (Harvest HQ, Andrew on Hermes): only 429s on Claude. Today any 429 cools the whole account, and the headers that say which limit refused are never logged, so the cause cannot be read from logs.
Change
anthropic-ratelimit-unified-representative-claimisseven_day_<family>and whose request model is that family (opus/sonnet/haiku/fable) cools only (account, family), untilRetry-After, else the unified reset, else 60 s. The account keeps serving its other models; an Opus request returns the pool 429 only when every account is out of Opus, with that family's earliest reset as Retry-After.[anthropic-pool] 429 on <account> model=<id> claim=<..> status=<..> 5h=<..> 7d=<..> retry-after=<..> reset=<..> cooldown=<s>s (<source>) scope=<family|account>, including on single-account gateways with no failover pool (cooldown=none (no failover pool)). No credential is in these headers.no other eligible Anthropic OAuth account; returning 429 (others=N cooled=N reauth=N unusable=N)instead of claiming every account is in cooldown.route.modelIdis passed from the 3 rotate callers and the 2 pool-selection callers.Test:
tests/adapters/anthropic/anthropic-ratelimit-headers.test.ts, "a model-scoped weekly 429 cools only that model family" (Opus cooled per account, Sonnet still routes, pool 429 Retry-After = family reset, clear removes family entries, five_hour on Opus still cools the account, exact log line). Local:tsc --noEmitclean, 183/183 across the 5 pool/failover test files (lane witness VOID on git ENOBUFS in this repo, so CI is the owner run).Eval added/updated: N/A deterministic (unit test: tests/adapters/anthropic/anthropic-ratelimit-headers.test.ts)
🤖 Generated with Claude Code