Skip to content

fix: suggest /clear in context overflow error message#12973

Merged
Takhoffman merged 2 commits intoopenclaw:mainfrom
RamiNoodle733:fix-context-overflow-message
Feb 10, 2026
Merged

fix: suggest /clear in context overflow error message#12973
Takhoffman merged 2 commits intoopenclaw:mainfrom
RamiNoodle733:fix-context-overflow-message

Conversation

@RamiNoodle733
Copy link
Contributor

@RamiNoodle733 RamiNoodle733 commented Feb 10, 2026

Summary

Update the context overflow error message to suggest using /clear to reset session history, which immediately resolves the issue for users stuck in an overflow loop.

Problem

When the context window overflows, the error message was:

Context overflow: prompt too large for the model. Try again with less input or a larger-context model.

This left users stuck — especially when receiving the error via messaging channels (Telegram, etc.) where they couldn't easily troubleshoot:

  • User was locked out for hours receiving this error on every message
  • Gateway restarts didn't help (session history preserved)
  • /compact couldn't run (needs context to execute)
  • /clear would have immediately resolved it

Fix

Changed the error message to:

Context overflow: prompt too large for the model. Try /clear to reset session history, or use a larger-context model.

Files Changed

  • src/agents/pi-embedded-helpers/errors.ts - Updated error messages in formatAssistantErrorText() and sanitizeUserFacingText()
  • src/agents/pi-embedded-runner/run.ts - Updated error message in context overflow handling

Closes #12940

Greptile Overview

Greptile Summary

This PR updates the user-facing “context overflow” error text in the embedded Pi agent stack to recommend using /clear to reset session history, instead of only suggesting reducing input or switching to a larger-context model.

The change is applied in both the generic error formatting helpers (formatAssistantErrorText() and sanitizeUserFacingText()) and in the embedded runner’s context overflow handling path, keeping messaging consistent across the helper-based formatting and the runner-level early return.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The diff only changes static user-facing strings for a specific error case and does not modify control flow, parsing, or state. The same new message is applied consistently in the helper functions and in the runner’s context overflow handling branch.
  • No files require special attention

Context used:

  • Context from dashboard - CLAUDE.md (source)
  • Context from dashboard - AGENTS.md (source)

@openclaw-barnacle openclaw-barnacle bot added the agents Agent runtime and tooling label Feb 10, 2026
Copy link
Contributor

@Takhoffman Takhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this. The actionable-recovery idea is right, but /clear is not a built-in chat command in OpenClaw today.

BLOCKER

  • The new message recommends Try /clear to reset session history..., but session reset is /reset (or /new). /clear does not exist by default, so this would leave users stuck.
    • Docs list /reset and /new (see docs/tools/slash-commands.md).
    • Command registry defines /reset and /new (see src/auto-reply/commands-registry.data.ts).

Please update the wording to recommend /reset (and optionally /new) instead of /clear.

Optional alternative (bigger scope): actually add /clear as an alias/default reset trigger across channels and update docs.

Also note: GitHub reports this PR as merge-conflicting (mergeable: CONFLICTING), so it likely needs a rebase/resolve.

@Takhoffman Takhoffman force-pushed the fix-context-overflow-message branch from 055cfb6 to 5201b77 Compare February 10, 2026 02:26
Takhoffman pushed a commit to RamiNoodle733/openclaw that referenced this pull request Feb 10, 2026
@Takhoffman
Copy link
Contributor

I rebased onto current main, resolved the conflicts, and updated the message to recommend /reset (and mention /new) instead of /clear.

Pushed update to fix-context-overflow-message:

Local verification:

  • pnpm build
  • pnpm check
  • pnpm test

Prep notes: .local/prep.md

@RamiNoodle733 RamiNoodle733 force-pushed the fix-context-overflow-message branch from 5201b77 to 14e786d Compare February 10, 2026 02:28
RamiNoodle733 and others added 2 commits February 9, 2026 20:33
When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>
@Takhoffman Takhoffman force-pushed the fix-context-overflow-message branch from 14e786d to d5ad76e Compare February 10, 2026 02:43
Copy link
Contributor

@Takhoffman Takhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto current main and fixed the recovery guidance to recommend /reset (and mention /new) instead of /clear. Updated tests and ran local gates (build/check/test).

Copy link
Contributor

@Takhoffman Takhoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased onto current main and fixed the recovery guidance to recommend /reset (and mention /new) instead of /clear. Updated tests and ran local gates (build/check/test).

@Takhoffman Takhoffman merged commit c2b2d53 into openclaw:main Feb 10, 2026
19 checks passed
lucasmpramos pushed a commit to butley/openclaw that referenced this pull request Feb 10, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
ProgramCaiCai pushed a commit to ProgramCaiCai/openclaw that referenced this pull request Feb 10, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
Hansen1018 pushed a commit to Hansen1018/openclaw that referenced this pull request Feb 10, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
michaelleone pushed a commit to michaelleone/openclaw that referenced this pull request Feb 11, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
skyhawk14 pushed a commit to skyhawk14/openclaw that referenced this pull request Feb 13, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
(cherry picked from commit c2b2d53)

# Conflicts:
#	src/agents/pi-embedded-helpers.sanitizeuserfacingtext.test.ts
#	src/agents/pi-embedded-helpers/errors.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
(cherry picked from commit c2b2d53)

# Conflicts:
#	src/agents/pi-embedded-helpers.sanitizeuserfacingtext.test.ts
#	src/agents/pi-embedded-helpers/errors.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
* fix: suggest /reset in context overflow error message

When the context window overflows, the error message now suggests
using /reset to clear session history, giving users an actionable
recovery path instead of a dead-end error.

Closes openclaw#12940


* fix: suggest /reset in context overflow error message (openclaw#12973) (thanks @RamiNoodle733)

---------

Co-authored-by: Rami Abdelrazzaq <RamiNoodle733@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context overflow error should suggest /clear as recovery option

2 participants