openclaw - ✅(Solved) Fix Model-scoped cooldowns are not persisted for incomplete-turn exhaustion paths [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#67661Fetched 2026-04-17 08:29:52
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Participants
Timeline (top)
cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #67662: fix(run): preserve model-scoped cooldown writes on incomplete turns

Description (problem / solution / changelog)

Closes #67661

Problem

Fallback did not always work as expected because OpenClaw could keep retrying a model/provider that was already exhausted and still within its active cooldown window.

In the incomplete-turn paths, the auth-profile failure write could omit the active modelId. That weakened model-scoped cooldown enforcement and allowed the same exhausted model to be retried again within the same run/session instead of continuing cleanly to the next fallback.

Change

  • pass the active modelId when persisting incomplete-turn auth-profile failures
  • cover both reasoning-only exhausted responses and incomplete-turn failure writes with unit tests
  • keep the fix scoped to the incomplete-turn cooldown write path only

Tests

  • pnpm test src/agents/pi-embedded-runner/run.incomplete-turn.test.ts

Limitation

This improves fallback within the same run/session only.

It does not add a persistent cross-session or cross-agent exhausted-model registry. Fresh new sessions can still retry a model later unless that provider already participates in the existing persisted auth-profile cooldown system.

Changed files

  • src/agents/pi-embedded-runner/run.incomplete-turn.test.ts (modified, +88/-0)
  • src/agents/pi-embedded-runner/run.overflow-compaction.harness.ts (modified, +6/-1)
  • src/agents/pi-embedded-runner/run.ts (modified, +2/-0)
RAW_BUFFERClick to expand / collapse

Problem

When an exhausted/rate-limited model fails through the incomplete-turn paths, OpenClaw can record the auth-profile failure without the active modelId.

That breaks model-scoped cooldown behavior for the rest of the same run/session: the provider/profile may be marked bad, but the exhausted model is not properly recorded as unavailable for that active model, so fallback can end up retrying the same exhausted model again instead of moving cleanly to the next fallback.

Where this shows up

This affects incomplete-turn handling paths in runEmbeddedPiAgent, including cases like:

  • reasoning-only exhausted/rate-limit responses
  • incomplete turns that classify into a failover-worthy cooldown reason

Expected

If a model hits an exhausted/cooldown condition and OpenClaw decides to persist that failure during the same run/session, the stored failure should include the active modelId so model-scoped cooldown checks can prevent retrying that same exhausted model again in that run/session.

Actual

The incomplete-turn failure write can omit modelId, which weakens model-scoped cooldown enforcement and allows repeated in-run retries of a model that is still in an active exhausted/cooldown period.

Scope

This issue is about same-run/session behavior.

It does not cover a persistent cross-session or cross-agent exhausted-model registry. Fresh new sessions can still retry a model later unless that provider is already covered by the existing persisted auth-profile cooldown system.

extent analysis

TL;DR

The issue can be addressed by ensuring that the modelId is included when recording auth-profile failures for exhausted or rate-limited models during the same run/session.

Guidance

  • Review the runEmbeddedPiAgent function to identify where the modelId is not being included when recording auth-profile failures for incomplete-turn paths.
  • Verify that the modelId is being passed correctly through the function calls and is available when needed.
  • Consider adding a check to ensure that the modelId is included before recording the auth-profile failure.
  • Investigate the cooldown logic to ensure that it is correctly preventing retries of exhausted models within the same run/session.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

This solution focuses on addressing the issue within the same run/session and does not cover persistent cross-session or cross-agent exhausted-model registry.

Recommendation

Apply a workaround to include the modelId when recording auth-profile failures for exhausted or rate-limited models, as this will help prevent repeated retries of the same exhausted model within the same run/session.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Model-scoped cooldowns are not persisted for incomplete-turn exhaustion paths [1 pull requests, 1 participants]