fix(auth): preserve per-model cooldown windows#45113
Conversation
Greptile SummaryThis PR correctly addresses the root bug where a later transient failure could overwrite a model-scoped rate-limit cooldown and revert it to profile-wide behavior. The approach — storing One logic issue was found:
One style/hygiene observation:
Confidence Score: 3/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd78c52f17
ℹ️ 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".
This comment was marked as spam.
This comment was marked as spam.
|
Pushed 87c4111. This follow-up does two things in
Added regressions in |
…mit message Combines ideas from PRs openclaw#45113, openclaw#31962, and openclaw#45763 to address three cooldown-related issues: 1. Stepped cooldown (30s → 1m → 5m cap) replaces the aggressive exponential formula (1m → 5m → 25m → 1h) that locked out providers for far longer than the actual API rate-limit window. 2. Per-model cooldown scoping: rate_limit cooldowns now record which model triggered them. When a different model on the same auth profile is requested, the cooldown is bypassed — so one model hitting a 429 no longer blocks all other models on the same provider. 3. FallbackSummaryError with soonest-expiry countdown: when all candidates are exhausted, the user sees a clear message like '⚠️ Rate-limited — ready in ~28s' instead of a generic failure. Files changed: - types.ts: add cooldownReason/cooldownModel to ProfileUsageStats - usage.ts: stepped formula, model-aware isProfileInCooldown, modelId threading through computeNextProfileUsageStats/markAuthProfileFailure - model-fallback.ts: FallbackSummaryError class, model-aware availability check, soonestCooldownExpiry computation - pi-embedded-runner/run.ts: thread modelId into failure recording - agent-runner-execution.ts: buildCopilotCooldownMessage helper, rate-limit detection branch in error handler - usage.test.ts: update expected cooldown value (60s → 30s)
|
Closing this as a duplicate to keep the discussion and landed fix in one place. What shipped instead:
Why this is duplicate:
If there is any behavior here that you think is still missing from #49834 on current Thank you for the contribution, @siewcapital. |
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Rate-limit cooldowns on one model no longer block fallback to a different model on the same auth profile, and later transient failures during that active cooldown window no longer collapse the cooldown back to profile-wide behavior.
Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
*.e2e.test.tsfile via the defaultpnpm testentrypoint, because this repo excludes E2E tests from that filter.Review Conversations
Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
src/agents/auth-profiles/usage.ts,src/agents/model-fallback.ts,src/agents/pi-embedded-runner/run.tsRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.