openclaw - ✅(Solved) Fix [Bug] Context overflow produces 0 payloads, UI shows infinite spinner instead of error [2 pull requests, 1 comments, 2 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#63661Fetched 2026-04-10 03:42:19
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2commented ×1referenced ×1

Error Message

When a context overflow error occurs (model_context_window_exceeded), the error is logged but the UI (webchat) shows either an infinite spinner or no output at all, instead of displaying an error message to the user. 3. UI shows infinite spinner or nothing, no error is displayed When context overflow occurs, the user should see a clear error message such as:

  • Error is logged server-side but not surfaced to the user When the model hits a context overflow error, it produces 0 output payloads. The UI has nothing to render, so it just shows a spinner indefinitely. When payloads=0 and isError=true, the gateway should generate a synthetic error payload (e.g., a text message containing the error description) so the UI has something to render and display to the user.

Root Cause

Root Cause (from logs)

Fix Action

Fixed

PR fix notes

PR #63796: fix: surface context overflow error when stop reason is model_context_window_exceeded

Description (problem / solution / changelog)

Summary

  • Extends contextOverflowError to also check lastAssistant.stopReason directly via isLikelyContextOverflowError
  • Fixes providers like ZhipuAI/GLM that surface context overflow via a dedicated model_context_window_exceeded stop reason instead of an error-coded stop with errorMessage
  • Without this fix, the turn returned 0 payloads, causing an infinite spinner instead of the expected error message

Closes #63661


This PR was developed with AI assistance (Claude). Built with islo.dev

Changed files

  • src/agents/pi-embedded-runner/run.overflow-compaction.test.ts (modified, +30/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +11/-0)

PR #63839: fix: surface context overflow error for model_context_window_exceeded stop reason

Description (problem / solution / changelog)

Summary

When providers like ZhipuAI/GLM surface context overflow via a dedicated stop reason (model_context_window_exceeded) rather than an error-coded stop with an errorMessage, the contextOverflowError detection was returning null. This fix handles both forms.

Closes #63661

Testing

  • Relevant tests pass

This PR was developed with AI assistance (Claude). All code has been reviewed and tested. Built with islo.dev

Changed files

  • src/agents/pi-embedded-runner/run.overflow-compaction.test.ts (modified, +30/-0)
  • src/agents/pi-embedded-runner/run.ts (modified, +11/-0)

Code Example

incomplete turn detected: runId=... stopReason=toolUse payloads=0
RAW_BUFFERClick to expand / collapse

Bug Description

When a context overflow error occurs (model_context_window_exceeded), the error is logged but the UI (webchat) shows either an infinite spinner or no output at all, instead of displaying an error message to the user.

Steps to Reproduce

  1. Have a long conversation until the model's context window is exceeded
  2. Send another message
  3. UI shows infinite spinner or nothing, no error is displayed

Expected Behavior

When context overflow occurs, the user should see a clear error message such as:

Context overflow: prompt too large for the model. Try /reset to start a fresh session.

Actual Behavior

  • UI shows infinite loading spinner or empty response
  • Error is logged server-side but not surfaced to the user

Root Cause (from logs)

incomplete turn detected: runId=... stopReason=toolUse payloads=0

When the model hits a context overflow error, it produces 0 output payloads. The UI has nothing to render, so it just shows a spinner indefinitely.

Environment

  • OpenClaw: 2026.4.9 (0512059)
  • Model: zai/glm-4.5-air
  • Channel: webchat
  • OS: Linux

Suggested Fix

When payloads=0 and isError=true, the gateway should generate a synthetic error payload (e.g., a text message containing the error description) so the UI has something to render and display to the user.

extent analysis

TL;DR

Implement a synthetic error payload generation in the gateway when payloads=0 and an error occurs, to display an error message to the user.

Guidance

  • Check the gateway logic to handle cases where payloads=0 and isError=true, to ensure it generates a synthetic error payload.
  • Verify that the UI can correctly render and display the synthetic error payload as an error message to the user.
  • Review the error logging mechanism to ensure it provides sufficient information for debugging and monitoring purposes.
  • Consider adding a timeout or fallback mechanism to handle cases where the UI is stuck in an infinite loading state.

Example

if payloads == 0 and isError:
    synthetic_error_payload = {
        "text": "Context overflow: prompt too large for the model. Try /reset to start a fresh session."
    }
    # Return the synthetic error payload to the UI for rendering

Notes

This solution assumes that the gateway has the capability to generate and return synthetic payloads. Additional modifications may be required to handle edge cases or specific UI requirements.

Recommendation

Apply workaround: Implement synthetic error payload generation in the gateway to display error messages to the user, as this directly addresses the issue of the UI showing an infinite spinner or no output when a context overflow error occurs.

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