openclaw - 💡(How to fix) Fix Model switch can fail silently when carried-over session context is too large [2 comments, 3 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#58957Fetched 2026-04-08 02:30:46
View on GitHub
Comments
2
Participants
3
Timeline
2
Reactions
1
Timeline (top)
commented ×2

When switching models or continuing in a long-running session, OpenClaw can appear to fail silently when the carried-over context is too large. There is no clear error message indicating that the prompt/context window was exceeded, so users cannot tell whether the problem is caused by context overflow, model switching, transport issues, or something else.

Error Message

When switching models or continuing in a long-running session, OpenClaw can appear to fail silently when the carried-over context is too large. There is no clear error message indicating that the prompt/context window was exceeded, so users cannot tell whether the problem is caused by context overflow, model switching, transport issues, or something else.

  • No obvious error message explaining the root cause

1) Better error reporting

If the target model has a smaller effective context budget than the current session size, warn before switching or provide an automatic downgrade path.

Root Cause

Summary

When switching models or continuing in a long-running session, OpenClaw can appear to fail silently when the carried-over context is too large. There is no clear error message indicating that the prompt/context window was exceeded, so users cannot tell whether the problem is caused by context overflow, model switching, transport issues, or something else.

RAW_BUFFERClick to expand / collapse

Summary

When switching models or continuing in a long-running session, OpenClaw can appear to fail silently when the carried-over context is too large. There is no clear error message indicating that the prompt/context window was exceeded, so users cannot tell whether the problem is caused by context overflow, model switching, transport issues, or something else.

Why this is confusing

From the user side, it looks like:

  • the model switch "doesn't work"
  • the session becomes unresponsive or errors unclearly
  • there is no actionable hint that the previous session history is the real cause

In practice, starting a fresh session (/new <model>) works, which strongly suggests the old context was too large and got carried into the model switch.

Expected behavior

At minimum, OpenClaw should surface a clear, user-visible reason, e.g.:

  • context window exceeded
  • prompt too large for selected model
  • session history too long to carry over during model switch

And ideally it should offer a graceful fallback, such as:

  1. automatically compacting the session before/while switching models
  2. prompting the user to compact
  3. transparently starting a compacted continuation session
  4. providing a one-click suggested recovery action in the UI/CLI

Actual behavior

  • No obvious error message explaining the root cause
  • Users have to guess that the session context is too large
  • Recovery is manual and non-obvious (/new <model> or maybe /compact, if the user already knows to try that)

Reproduction (likely)

  1. Use a long-running session with a lot of accumulated history/tool output
  2. Switch to another model
  3. Observe that the session fails unclearly / does not provide a useful explanation
  4. Start a fresh new session with the same target model
  5. The new session works normally

Proposed improvements

1) Better error reporting

If a request fails due to token/context limits, show a specific message instead of a generic or silent failure.

Example:

This session is too large to continue with the selected model. Try /compact or start a fresh session with /new <model>.

2) Automatic compaction

On model switch (or any continuation that exceeds limits), automatically attempt compaction before failing.

3) Safer model switching UX

If the target model has a smaller effective context budget than the current session size, warn before switching or provide an automatic downgrade path.

4) Better observability

Include some visibility into:

  • current estimated session size
  • selected model context budget
  • whether compaction was attempted

Environment

Observed in Telegram/OpenClaw chat workflow while switching models in an existing session.

Impact

This creates a bad UX because the failure mode is silent or ambiguous. Users who are not already familiar with OpenClaw internals will not know that the session simply became too large.

extent analysis

TL;DR

Implement better error reporting and automatic compaction to handle large session contexts when switching models in OpenClaw.

Guidance

  • Improve error messages to specifically indicate when a session is too large to continue with the selected model, suggesting alternatives like /compact or starting a fresh session with /new <model>.
  • Automatically attempt session compaction before failing when switching models or continuing a session that exceeds context limits.
  • Consider adding a warning or automatic downgrade path when the target model has a smaller context budget than the current session size.
  • Provide visibility into current session size, selected model context budget, and whether compaction was attempted to enhance user understanding and debugging capabilities.

Example

A potential error message could be: "This session is too large to continue with the selected model. Try /compact or start a fresh session with /new <model>."

Notes

The proposed improvements focus on enhancing user experience by providing clear error messages and implementing automatic compaction. However, the effectiveness of these solutions may depend on the specific implementation details and the underlying architecture of OpenClaw.

Recommendation

Apply workaround by implementing better error reporting and automatic compaction, as this approach directly addresses the silent failure issue and improves the overall user experience.

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…

FAQ

Expected behavior

At minimum, OpenClaw should surface a clear, user-visible reason, e.g.:

  • context window exceeded
  • prompt too large for selected model
  • session history too long to carry over during model switch

And ideally it should offer a graceful fallback, such as:

  1. automatically compacting the session before/while switching models
  2. prompting the user to compact
  3. transparently starting a compacted continuation session
  4. providing a one-click suggested recovery action in the UI/CLI

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 - 💡(How to fix) Fix Model switch can fail silently when carried-over session context is too large [2 comments, 3 participants]