Skip to content

Web UI context percentage shows 0% or >100% when using LCM #55217

@liuy

Description

@liuy

When using LCM (Lossless Context Management), the Web UI occasionally displays incorrect context percentages (0% or >100%), while the /status command shows the correct value.

Example:

  • Web UI shows: ctx = 0% or ctx = 150%
  • /status command shows: Context: 44%

This inconsistency occurs because the Web UI and /status command use different logic to calculate totalTokens. The Web UI checks a totalTokensFresh flag and falls back to a cumulative transcript usage value when the flag is false, which can result in either 0% (no data) or >100% (cumulative historical usage).

Expected Behavior:
Web UI should display the same context percentage as the /status command.

Environment:

  • OpenClaw version: latest
  • LCM enabled: yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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