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. |
|
This PR remains mergeable with all checks passing and no open review threads. I checked current main and the next-retry detail is still absent there. Could a maintainer review this when convenient? |
Resolve cooldown error conflicts by keeping upstream's Claude cooldown metadata (newModelCooldownErrorForCandidates) and chaining withNextRetry onto it, so cooldown errors carry both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13217c6095
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| NextHint string `json:"next_credential_hint"` | ||
| } `json:"error"` | ||
| } | ||
| if errUnmarshal := json.Unmarshal([]byte(err.Error()), &payload); errUnmarshal != nil { |
There was a problem hiding this comment.
Parse the cooldown payload with ojson
This newly added assertion decodes JSON with the standard encoding/json package, while the repository requires github.com/MoeForge/moego/ojson for all JSON operations. Rework the assertion to validate and inspect the payload with ojson instead of extending the prohibited API usage.
AGENTS.md reference: AGENTS.md:L53-L53
Useful? React with 👍 / 👎.
| errorBody["provider"] = e.provider | ||
| } | ||
| if !e.retryAt.IsZero() { | ||
| errorBody["next_retry_at"] = e.retryAt.UTC().Format(time.RFC3339) |
There was a problem hiding this comment.
Preserve fractional precision in next_retry_at
When a cooldown deadline retains nanoseconds, as deadlines created with time.Now().Add(...) normally do, formatting it with time.RFC3339 truncates the fractional part. The new next_retry_at can therefore advertise a time up to almost one second before the credential is actually eligible, causing clients that honor this field to retry while it is still blocked even though Retry-After correctly rounds upward; preserve the fraction with RFC3339Nano or round the timestamp up.
Useful? React with 👍 / 👎.
Summary
When every credential for a model is cooling down, add the earliest known retry time to the human-readable 429 message. Claude Code and other clients that display only
error.messagecan then show when the proxy will next try a credential. Keep the existingreset_time,reset_seconds, andRetry-Afterbehavior, and add structurednext_retry_at(UTC) for clients that parse the JSON.Include a short credential prefix such as
claude-1234abcdin the message when the credential ID has the standard generated form. This matches the visible credential filename while omitting the account email and file path. The structurednext_auth_indexis emitted only when the index is a 16-character lowercase hex value. Unknown or malformed identities are omitted.The timestamp is the proxy's earliest next retry, not a guarantee that the upstream provider will accept a request then. Preserve the selected retry time and credential through route-model restoration, and cover the scheduler, mixed-provider, and selector paths.
Validation
go test ./sdk/cliproxy/authpassed.CGO_ENABLED=0 go build -o /tmp/cliproxyapi-cooldown-next-retry-check ./cmd/serverpassed.