Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The cooldown 429 already states its reset in error.message, but an upstream 429 that CLIProxyAPI passes through keeps its Retry-After only in the header. Claude Code ignores that header, so the first rate-limit error never shows when the limit resets. Append the delay from the Retry-After actually written to any 429 that does not already carry a reset hint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1f34ab6 to
754d4db
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 754d4db64d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| message += " (reset after " + delay + ")" | ||
| // Claude Code shows only error.message and ignores Retry-After, so state the delay there too. | ||
| if status == http.StatusTooManyRequests && !strings.Contains(message, "(reset after ") { |
There was a problem hiding this comment.
Preserve the local reset hint when the upstream cause has one
When a cooldown's saved upstream error already contains (reset after ...), for example from an upstream CLIProxyAPI instance, modelCooldownError.Error() embeds that hint inside (last error: ...). This new substring check then suppresses the current local countdown: a response with Retry-After: 60 can show only the stale upstream reset after 5m0s, whereas the previous implementation also appended the correct reset after 1m0s. Claude Code users therefore lose the authoritative recovery time on subsequent cooldown responses. Restrict deduplication to a hint matching the current delay, or retain the local hint for cooldown errors.
Useful? React with 👍 / 👎.
Follow-up to #7285 and e458999.
Problem
e458999 states the reset in
error.messagefor cooldown 429s. An upstream 429 that CLIProxyAPI passes through still keeps its delay only inRetry-After. Claude Code ignores that header, so the first rate-limit error a user sees never says when the limit resets. Only later requests, which hit the cooldown, do.Change
The Claude handler appends
(reset after …)to any 429 whoseRetry-Afteris positive, not only to cooldowns:Retry-Afteractually written, so the text always matches the header. For cooldowns that is still the trusted local deadline.(reset afteris left alone.Retry-After, and direct responses are unchanged.TestClaudeCooldownLeavesOrdinary429MessageUnchangedasserted the old behavior. It is nowTestClaudeOrdinary429MessageStatesPassedThroughRetryAfterand expects the hint. The other cooldown tests pass unchanged.Verification
go test ./sdk/api/handlers/claude/,go vet,gofmt,go build ./cmd/serverpass.Retry-After, two requests through this build:On
devthe first message has no reset time.🤖 Generated with Claude Code