Skip to content

[Bug]: Control UI shows 100% context when actual is ~56% #48252

Description

@progamman

Bug type

Regression (worked before, now fails)

Summary

Control UI context percentage uses lifetime inputTokens instead of current context, showing 100% when actual is ~56%

Steps to reproduce

  1. Use OpenClaw for extended conversation (causing context compaction)
  2. Open Control UI (http://127.0.0.1:18789/)
  3. Observe context percentage in status bar
  4. Compare with actual context (via /status or API)

Expected behavior

Context percentage should show actual current context window usage (~56%), not lifetime accumulated tokens (612k/200k = 306% capped to 100%)

Actual behavior

UI shows "⚠️ 100% context used 612.5k / 200k" when actual is ~56% (112k/200k). The calculation uses lifetime inputTokens instead of current context.

OpenClaw version

2026.3.13

Operating system

macOS 13.7

Install method

No response

Model

minimax/MiniMax-M2.5

Provider / routing chain

minimax

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

ROOT CAUSE: Control UI uses lifetime accumulated inputTokens instead of current context.

Location: control-ui/assets/index-UvgeZ3yV.js ~line 829 (function Af)

Code issue:

let r = e?.inputTokens ?? 0  // lifetime tokens
let a = e?.contextTokens ?? t ?? 0  // limit (200k)
let o = r / a  // 612500/200000 = 306% -> capped at 100%

After compaction, lifetime tokens (612k) remain but current context is only ~112k.

FIX: Use current context window tokens instead of lifetime inputTokens, or add a field for currentContextTokens in gateway API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions