openclaw/src/agents/pi-embedded-runner
Forgely3D 4fa11632b4
fix: escalate to model fallback after rate-limit profile rotation cap (#58707)
* fix: escalate to model fallback after rate-limit profile rotation cap

Per-model rate limits (e.g. Anthropic Sonnet-only quotas) are not
relieved by rotating auth profiles — if all profiles share the same
model quota, cycling between them loops forever without falling back
to the next model in the configured fallbacks chain.

Apply the same rotation-cap pattern introduced for overloaded_error
(#58348) to rate_limit errors:

- Add `rateLimitedProfileRotations` to auth.cooldowns config (default: 1)
- After N profile rotations on a rate_limit error, throw FailoverError
  to trigger cross-provider model fallback
- Add `resolveRateLimitProfileRotationLimit` helper following the same
  pattern as `resolveOverloadProfileRotationLimit`

Fixes #58572

* fix: cap prompt-side rate-limit failover (#58707) (thanks @Forgely3D)

* fix: restore latest-main gates for #58707

---------

Co-authored-by: Ember (Forgely3D) <ember@forgely.co>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-04-01 17:54:10 +09:00
..
run fix: escalate to model fallback after rate-limit profile rotation cap (#58707) 2026-04-01 17:54:10 +09:00
abort.ts
anthropic-cache-retention.ts refactor(anthropic): move stream wrappers into plugin 2026-04-01 09:21:48 +01:00
anthropic-family-tool-payload-compat.ts refactor(anthropic): move stream wrappers into plugin 2026-04-01 09:21:48 +01:00
bedrock-stream-wrappers.ts refactor: split bedrock provider stream helpers 2026-03-28 01:40:30 +00:00
cache-ttl.test.ts
cache-ttl.ts
compact-reasons.test.ts fix(compaction): surface safeguard cancel reasons and clarify /compact skips (#51072) 2026-03-25 11:03:22 -07:00
compact-reasons.ts fix(compaction): surface safeguard cancel reasons and clarify /compact skips (#51072) 2026-03-25 11:03:22 -07:00
compact.hooks.harness.ts refactor: route memory runtime through memory plugin 2026-03-26 22:30:47 +00:00
compact.hooks.test.ts fix(compaction): resolve model override in runtime context for all context engines (#56710) 2026-03-31 15:25:16 -07:00
compact.runtime.ts
compact.ts fix(compaction): resolve model override in runtime context for all context engines (#56710) 2026-03-31 15:25:16 -07:00
compaction-hooks.ts refactor: split compaction hooks 2026-03-27 01:36:13 +00:00
compaction-runtime-context.test.ts fix(compaction): resolve model override in runtime context for all context engines (#56710) 2026-03-31 15:25:16 -07:00
compaction-runtime-context.ts fix(compaction): resolve model override in runtime context for all context engines (#56710) 2026-03-31 15:25:16 -07:00
compaction-safety-timeout.ts
context-engine-maintenance.test.ts test: continue vitest threads migration 2026-03-24 08:37:00 +00:00
context-engine-maintenance.ts
extensions.test.ts refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
extensions.ts refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
extra-params.cache-retention-default.test.ts
extra-params.google.test.ts refactor: dedupe test helpers and harnesses 2026-03-24 21:41:46 +00:00
extra-params.kilocode.test.ts test: continue vitest threads migration 2026-03-24 08:37:00 +00:00
extra-params.ollama.test.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
extra-params.openai.test.ts fix: add OpenAI version attribution header 2026-03-27 20:29:18 +00:00
extra-params.openrouter-cache-control.test.ts
extra-params.pi-ai-mock.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
extra-params.test-support.ts fix: use azure-openai-responses for Azure custom providers (#50851) (thanks @kunalk16) 2026-03-30 16:17:03 +05:30
extra-params.ts refactor(anthropic): move stream wrappers into plugin 2026-04-01 09:21:48 +01:00
extra-params.xai-tool-payload.test.ts xAI: strip unsupported payload fields 2026-03-28 21:35:13 +00:00
extra-params.zai-tool-stream.test.ts refactor: dedupe test helpers and harnesses 2026-03-24 21:41:46 +00:00
google-stream-wrappers.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
google.test.ts
google.ts fix: use azure-openai-responses for Azure custom providers (#50851) (thanks @kunalk16) 2026-03-30 16:17:03 +05:30
history.test.ts fix: normalize history session provider lookup 2026-03-27 21:19:09 -05:00
history.ts fix: normalize history session provider lookup 2026-03-27 21:19:09 -05:00
kilocode.test.ts
lanes.test.ts
lanes.ts
logger.ts
message-action-discovery-input.test.ts
message-action-discovery-input.ts
minimax-stream-wrappers.ts feat(minimax): add image generation provider and trim model catalog to M2.7 (#54487) 2026-03-25 09:29:35 -07:00
model.forward-compat.errors-and-overrides.test.ts refactor: move provider runtime into extensions 2026-03-27 05:38:58 +00:00
model.forward-compat.test-support.ts refactor: dedupe test helpers and harnesses 2026-03-24 21:41:46 +00:00
model.forward-compat.test.ts test: inject model runtime hooks for thread-safe tests 2026-03-23 03:25:42 -07:00
model.provider-normalization.ts refactor: generalize provider transport hooks 2026-03-29 23:05:58 +09:00
model.provider-runtime.test-support.ts build: update deps and align pi sdk usage 2026-03-31 22:56:20 +09:00
model.startup-retry.test.ts fix: apply Mistral compat across proxy transports 2026-03-29 16:32:31 +09:00
model.test-harness.ts build: update deps and align pi sdk usage 2026-03-31 22:56:20 +09:00
model.test.ts fix: clear stalled model resolution lanes 2026-03-30 05:09:26 +09:00
model.ts fix: use azure-openai-responses for Azure custom providers (#50851) (thanks @kunalk16) 2026-03-30 16:17:03 +05:30
moonshot-stream-wrappers.test.ts fix: decouple moonshot stream wrappers from provider runtime 2026-03-27 00:40:51 +00:00
moonshot-stream-wrappers.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
moonshot-thinking-stream-wrappers.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
openai-stream-wrappers.ts Codex: add native web search for embedded Pi runs 2026-04-01 03:30:06 +09:00
openrouter-model-capabilities.test.ts
openrouter-model-capabilities.ts
proxy-stream-wrappers.test.ts
proxy-stream-wrappers.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00
run.codex-server-error-fallback.test.ts fix(agents): fail over and sanitize Codex server_error payloads (#42892) 2026-03-27 16:51:39 +03:00
run.overflow-compaction.fixture.ts
run.overflow-compaction.harness.ts fix(agents): fail over and sanitize Codex server_error payloads (#42892) 2026-03-27 16:51:39 +03:00
run.overflow-compaction.loop.test.ts
run.overflow-compaction.test.ts test(agents): cover undersized model dispatch guard (#55369) 2026-03-26 20:30:20 -04:00
run.timeout-triggered-compaction.test.ts test: share msteams monitor and pi runner fixtures 2026-03-26 15:40:51 +00:00
run.ts fix: escalate to model fallback after rate-limit profile rotation cap (#58707) 2026-04-01 17:54:10 +09:00
runs.test.ts fix: apply live model switches during active retries 2026-03-27 12:01:55 +00:00
runs.ts fix: apply live model switches during active retries 2026-03-27 12:01:55 +00:00
sandbox-info.ts
sanitize-session-history.tool-result-details.test.ts
session-manager-cache.test.ts refactor: convert session manager cache to factory 2026-03-22 22:10:48 +00:00
session-manager-cache.ts refactor: convert session manager cache to factory 2026-03-22 22:10:48 +00:00
session-manager-init.ts
session-truncation.test.ts
session-truncation.ts
sessions-yield.orchestration.test.ts
skills-runtime.integration.test.ts
skills-runtime.test.ts fix(agents): prefer runtime snapshot for skill secrets 2026-03-23 13:04:12 -07:00
skills-runtime.ts fix(agents): prefer runtime snapshot for skill secrets 2026-03-23 13:04:12 -07:00
stream-payload-utils.ts
system-prompt.test.ts
system-prompt.ts
thinking.test.ts
thinking.ts
tool-name-allowlist.ts
tool-result-char-estimator.ts
tool-result-context-guard.test.ts
tool-result-context-guard.ts
tool-result-truncation.test.ts test: continue vitest threads migration 2026-03-24 08:37:00 +00:00
tool-result-truncation.ts
tool-split.ts
transcript-rewrite.test.ts refactor: dedupe test and script helpers 2026-03-24 15:48:35 +00:00
transcript-rewrite.ts
types.ts fix: preserve cli sessions across model changes 2026-03-26 20:25:20 +00:00
usage-accumulator.test.ts fix: unify pi runner usage snapshot fallback 2026-03-24 10:33:18 -07:00
usage-accumulator.ts fix: unify pi runner usage snapshot fallback 2026-03-24 10:33:18 -07:00
usage-reporting.test.ts Reduce lint suppressions in core tests and runtime 2026-03-27 02:11:26 -05:00
utils.ts
wait-for-idle-before-flush.ts
zai-stream-wrappers.ts refactor: move stream payload compat into provider seams 2026-03-28 00:10:39 +00:00