Skip to content

[Bug]: [WebChat/Control-UI] Context calculation is inaccurate - shows 100% before actual limit reached, while TUI works correctly #51507

@stonewin540

Description

@stonewin540

Bug type

Regression (worked before, now fails)

Summary

The webchat (also known as control UI) shows incorrect context usage percentage. It displays "100% context used"
when the actual context is far from the limit, making it impossible to continue the conversation. Meanwhile, the TUI
(terminal UI) correctly calculates and displays the context usage, allowing normal continuation.

Steps to reproduce

  1. Start a conversation via webchat/control UI
  2. After several message exchanges (not reaching actual limit)
  3. The UI shows "100% context used" or similar indication
  4. Unable to send more messages even though actual context is not exhausted

Expected behavior

  • Context usage should be accurately calculated and displayed
  • Should be able to continue chatting until actual context limit is reached

Actual behavior

  • WebChat/Control-UI shows 100% context used prematurely
  • TUI shows accurate context usage and works normally
  • This suggests the context calculation logic differs between the two interfaces

OpenClaw version

2026.3.13

Operating system

macOS 15.7.2

Install method

npm global

Model

MiniMax-M2.5

Provider / routing chain

openclaw -> minimax

Additional provider/model setup details

No response

Logs, screenshots, and evidence

<img width="803" height="188" alt="Image" src="https://github.com/user-attachments/assets/8d153a7e-20b2-4d09-9029-9028d95eab0e" />

<img width="831" height="280" alt="Image" src="https://github.com/user-attachments/assets/14ee7331-cde5-4b6b-8087-511cc08198f8" />

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions