Skip to content

feat(frontdoor): tell Claude Code which limit a provider's spent quota is - #627

Merged
Mearman merged 1 commit into
mainfrom
feat/provider-quota-refusal-headers
Oct 27, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/provider-quota-refusal-headers

Conversation

@Mearman

@Mearman Mearman commented Oct 27, 2026

Copy link
Copy Markdown
Member

A z.ai five-hour limit reaches Claude Code as "Server is temporarily limiting requests (not your usage limit)", although it is the account's own limit: the 429 names the window only in its error text, so the client reads a throttle and retries (#448).

The pass-through now holds back a 429's small body and, when the upstream sent none of the real API's unified rate-limit headers and the error is a quota the usage log already classifies as exhausted, with a message naming a five-hour or weekly limit, adds the binding window, its status, utilisation and reset, retry-after and x-should-retry: false. The body is passed on untouched, and a refusal that names no window, gives no reset or is a short rate limit is left as it came. The reset is the response's own retry-after; only a response with none is read from the message's reset time, which is wall time on the backend's UTC+8 clock. Because the usage store records the translated headers, the provider's five-hour window gets its real reset instead of a day-old one.

The headers the Antigravity route adds for a spent window are now built by the same function.

Refs #448

…a is

An http provider that refuses a request with a 429 for a spent five-hour or weekly plan window
names the window only in the error text, so Claude Code read it as a throttle and retried. The
pass-through now holds back a 429's small body, and when the upstream sent none of the real API's
unified rate-limit headers and the error is a quota the usage log classifies as exhausted, with a
message naming the window, it adds the binding window, its status, utilisation and reset,
retry-after and x-should-retry: false, leaving the body as it was. The reset is the response's
own retry-after, which carries no zone; a response with none is read from the message's reset
time on the backend's UTC+8 clock. The usage store records the translated headers, so the
provider's window shows its real reset. The headers the Antigravity route adds for a spent
window are built by the same function.

Refs #448
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ⚠️ Failed 2026-10-27T21:09:47.400683Z
We couldn’t complete this review. Comment @codex security review to try again.
b38d461 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@Mearman
Mearman merged commit 019c887 into main Oct 27, 2026
32 checks passed
@Mearman
Mearman deleted the feat/provider-quota-refusal-headers branch October 27, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant