fix(agents): broaden 402 temporary-limit detection and allow billing cooldown probe#38533
fix(agents): broaden 402 temporary-limit detection and allow billing cooldown probe#38533altaywtf merged 7 commits intoopenclaw:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f7a4dfc75
ℹ️ 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".
Greptile SummaryThis PR fixes a misclassification bug where HTTP 402 responses were treated as persistent billing failures, causing indefinite provider lockout even for temporary usage/spend limit errors. The fix broadens the 402 classifier to detect:
Key implementation details:
The changes maintain existing behavior for explicit billing signals (credit balance, insufficient credits) and auth/auth_permanent errors. Test isolation is correctly handled via Confidence Score: 4/5
Last reviewed commit: 7f7a4df |
|
this ci failed is nothing to do with this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 42cdef24ed
ℹ️ 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".
083a81b to
75960a8
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75960a8af1
ℹ️ 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".
…cooldown probes - Broaden classifyFailoverReasonFromHttpStatus to treat periodic usage limits and org/workspace spend limits as rate_limit instead of billing - Treat billing as semi-persistent in model-fallback: allow probes when no fallbacks exist (30s throttle) or when fallbacks exist (near expiry) - Add tests for new 402 classification and billing probe behavior
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38dc21271e
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 282b9186c6
ℹ️ 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".
| decision.reason === "rate_limit" || | ||
| decision.reason === "overloaded" || | ||
| decision.reason === "billing" | ||
| ) { |
There was a problem hiding this comment.
Avoid escalating billing backoff on failed cooldown probes
This change now enables billing probes (allowTransientCooldownProbe) for cooldowned providers, but failed probe attempts still flow into maybeMarkAuthProfileFailure and increment failureCounts.billing even while disabledUntil is active (computeNextProfileUsageStats keeps the active window but still bumps counts). In a fallback-enabled setup, repeated requests during the near-expiry probe window can quickly raise billing count so the next disable jumps from 5h to 10h/20h/24h, which makes lockouts longer after a probe sequence instead of aiding recovery. Fresh evidence in this diff is the new near-expiry billing probe path exercised in src/agents/model-fallback.probe.test.ts, which makes this escalation reachable in normal traffic.
Useful? React with 👍 / 👎.
|
Merged via squash. Thanks @xialonglee! |
上游主要更新(5d22bd029 → 92648f9): - fix(agents): 扩大 402 临时限速错误的检测范围,允许计费冷却探测(openclaw#38533) - fix(ui): 修正控制台设备鉴权 token 签名问题 - CLI: 避免无监听归因时的误判更新重启失败(openclaw#39508) - fix: 合入社区贡献 PR openclaw#39516(@Imhermes1) - build: 版本升级至 2026.3.8,发布 v2026.3.7 tag 本地累积更新(自上次同步): - feat: OAuth token 自动续期 —— cron 触发前预检 token 并自动刷新 - fix: oauth-refresh-daemon shouldRefresh 修复(已过期 token 不再被跳过) - fix: 守护进程失败3次后重置计数器,避免永久停止刷新 - feat: 智能路由模型账号选择、模型管理全面优化 - feat: 飞书/钉钉频道会话聚合历史视图
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Cherry-picked from openclaw/openclaw@92648f9ba (AUTO-PARTIAL). Discarded gutted files: CHANGELOG.md, model-fallback.ts, model-fallback.probe.test.ts, failover-error.test.ts, pi-embedded-helpers.isbillingerrormessage.test.ts, pi-embedded-runner/run.ts. Kept classifyFailoverReasonFrom402Text addition in classifyFailoverReason; discarded classifyFailoverReasonFromHttpStatus (gutted model-fallback layer) and isPeriodicUsageLimitErrorMessage references (function does not exist in fork). Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]>
…cooldown probe (openclaw#38533) (#1252) Cherry-picked from openclaw/openclaw@92648f9ba (AUTO-PARTIAL). Discarded gutted files: CHANGELOG.md, model-fallback.ts, model-fallback.probe.test.ts, failover-error.test.ts, pi-embedded-helpers.isbillingerrormessage.test.ts, pi-embedded-runner/run.ts. Kept classifyFailoverReasonFrom402Text addition in classifyFailoverReason; discarded classifyFailoverReasonFromHttpStatus (gutted model-fallback layer) and isPeriodicUsageLimitErrorMessage references (function does not exist in fork). Co-authored-by: Peter Lee <[email protected]> Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]>
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
…cooldown probe (openclaw#38533) Merged via squash. Prepared head SHA: 282b918 Co-authored-by: xialonglee <[email protected]> Co-authored-by: altaywtf <[email protected]> Reviewed-by: @altaywtf
fix #38465
Summary
rate_limit; (2) Treat billing as semi-persistent in model-fallback, allowing probes when no fallbacks exist (30s throttle) or when fallbacks exist (near cooldown expiry).Change Type
Linked Issue/PR
User-visible / Behavior Changes
rate_limitinstead ofbilling, enabling fallback and probe behavior.Repro + Verification
Steps
Expected
rate_limit→ fallback/probe allowed.billing→ cooldown with probe recovery.Actual (before fix)
billing→ indefinite skip, no probes.