GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): keep Claude gateway cooldowns after untimed rejections by Brechard · Pull Request #39694 · pingdotgg/t3code

fix(server): keep Claude gateway cooldowns after untimed rejections #39694

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Brechard wants to merge 3 commits into pingdotgg:main from Brechard:fix/claude-gateway-cooldown

Uh oh!

There was an error while loading. Please reload this page.

Closed

fix(server): keep Claude gateway cooldowns after untimed rejections #39694

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
256567b
fix(server): keep Claude gateway cooldowns after untimed rejections
rodrigoB-CB Nov 20, 2026
c9a0ad4
fix(server): read the outer Claude gateway cooldown
rodrigoB-CB Nov 20, 2026
e16372a
Merge upstream main into Claude cooldown fix
rodrigoB-CB Nov 20, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
fix(server): read the outer Claude gateway cooldown
Apply the same gateway cooldown parser to both CLI 429 prefixes. A countdown inside the nested upstream error can describe a different limit.

Implemented and reviewed with Codex gpt-6.2-sol through T3 Code.
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@rodrigoB-CB
rodrigoB-CB committed Nov 20, 2026
commit c9a0ad43761b21474d39a4546f912956de755dab

Some comments aren't visible on the classic Files Changed page.

There are no files selected for viewing

23 changes: 21 additions & 2 deletions 23 apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -9710,8 +9710,9 @@ describe("ClaudeAdapterV2 background wake turns", () => {
),
);

const gatewayLimitWithCountdown =
"API Error: Server is temporarily limiting requests (not your usage limit) · All credentials for model claude-opus-5-5 are cooling down (last error: rate_limit_error: This request would exceed your account's rate limit. Please try again later.) (reset after 2h26m17s)";
const gatewayLimitMessage =
"API Error: Server is temporarily limiting requests (not your usage limit) · All credentials for model claude-opus-5-5 are cooling down";
const gatewayLimitWithCountdown = `${gatewayLimitMessage} (last error: rate_limit_error: This request would exceed your account's rate limit. Please try again later.) (reset after 2h26m17s)`;

it.effect.each([
{ status: 503, cooldown: "4m 6s", seconds: 246 },
Expand Down Expand Up @@ -9752,6 +9753,24 @@ describe("ClaudeAdapterV2 background wake turns", () => {
assistantResetSeconds: 9000,
result: gatewayLimitWithCountdown,
},
{
status: 429,
cooldown: "a countdown only inside the last error",
seconds: 0,
proxy: true,
sdkResetSeconds: null,
sdkRateLimitUntyped: true,
result: `${gatewayLimitMessage} (last error: rate_limit_error (reset after 1h))`,
},
{
status: 429,
cooldown: "an outer countdown after a nested countdown",
seconds: 60,
proxy: true,
sdkResetSeconds: null,
sdkRateLimitUntyped: true,
result: `${gatewayLimitMessage} (last error: rate_limit_error (reset after 1h)) (reset after 1m)`,
},
{
status: 429,
cooldown: "nested 1h",
Expand Down
34 changes: 20 additions & 14 deletions 34 apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -4827,6 +4827,25 @@ function gatewayCooldownResetAt(
: undefined;
}

function claude429Cooldown(result: string): RegExpExecArray | null {
const pooledCooldown = result.replace(
/^API Error: (?:Request rejected \(429\)|Server is temporarily limiting requests \(not your usage limit\)) · All credentials for model /,
"",
);
if (pooledCooldown === result) {
return /\(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)/.exec(result);
}
// The gateway can include a separate upstream cooldown in its nested last error.
return (
/^[^\s()]+ are cooling down \(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)/.exec(
pooledCooldown,
) ??
/^[^\s()]+ are cooling down \(last error: [\s\S]*\) \(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)$/.exec(
pooledCooldown,
)
);
}

const CLAUDE_UNSUPPORTED_VERSION_ERROR =
/^API Error: 400 Claude Code (\d+\.\d+\.\d+) does not support this model; version (\d+\.\d+\.\d+) or newer is required\./;

Expand Down Expand Up @@ -4904,20 +4923,7 @@ function providerFailureFromResult(
// API-key sessions get no rate_limit_info, so a gateway's 429 carries its reset only as text.
const resetAt =
apiErrorStatus === 429 && message.result.startsWith("API Error:")
? gatewayCooldownResetAt(
// CLIProxyAPI nests upstream errors in its message; only its own cooldown counts.
message.result.startsWith(
"API Error: Request rejected (429) · All credentials for model ",
)
? (/^API Error: Request rejected \(429\) · All credentials for model [^\s()]+ are cooling down \(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)/.exec(
message.result,
) ??
/^API Error: Request rejected \(429\) · All credentials for model [^\s()]+ are cooling down \(last error: [\s\S]*\) \(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)$/.exec(
message.result,
))
: /\(reset after (?:(\d+)h ?)?(?:(\d+)m ?)?(?:(\d+)s)?\)/.exec(message.result),
receivedAt,
)
? gatewayCooldownResetAt(claude429Cooldown(message.result), receivedAt)
: undefined;
return makeProviderFailure({
message: listedError ?? structuredError ?? failureHint ?? message.result,
Expand Down
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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.
You are visitor 01402809 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.