openclaw - 💡(How to fix) Fix session status `Context:` line conflates cumulative session tokens with per-call context window [2 comments, 3 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#73578Fetched 2026-04-29 06:17:58
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
0
Timeline (top)
commented ×2closed ×1

Error Message

  1. If actual context were 3.8M in a 1M window, the model call would hard-error. It didn't — it replied normally.

Root Cause

  • Users see scary "359%" numbers and assume something is broken or that compaction is misconfigured.
  • It hides the real signal — actual context window utilization — which is the only one that matters for compaction triggering and turn-cost prediction.
  • It encourages premature /compact or session restarts on otherwise healthy sessions.

Code Example

📚 Context: 3.8m/1.0m (359%) · 🧹 Compactions: 0

---

📚 Context: 95k/1.0m (9%) · 🧹 Compactions: 0

---

📚 Context (next turn): 95k / 1.0m (9%)
🧮 Session tokens (cumulative): 3.8m
🧹 Compactions: 0
RAW_BUFFERClick to expand / collapse

Bug

The status card line 📚 Context: X/Y (Z%) displays a cumulative session-token counter against the per-call context window size, which produces nonsensical "utilization" percentages on long-running sessions.

Reproduction

In a multi-day persistent session (Telegram-direct, agent=main, model=claude-cli/claude-opus-4-7, 1M window):

📚 Context: 3.8m/1.0m (359%) · 🧹 Compactions: 0

Then on the very next turn, after no large input was sent:

📚 Context: 95k/1.0m (9%) · 🧹 Compactions: 0

What's happening

The first number (X) is being summed across every input + cached prompt-read + tool result over the session's lifetime, while the denominator (Y) is the per-call context window. They are not comparable.

Two pieces of evidence:

  1. If actual context were 3.8M in a 1M window, the model call would hard-error. It didn't — it replied normally.
  2. Compactions: 0 is consistent with the working set being fine. No compaction fired because none was needed.

Why this matters

  • Users see scary "359%" numbers and assume something is broken or that compaction is misconfigured.
  • It hides the real signal — actual context window utilization — which is the only one that matters for compaction triggering and turn-cost prediction.
  • It encourages premature /compact or session restarts on otherwise healthy sessions.

Suggested fix

Either:

(a) Show only working-set utilization — what the model will actually receive on the next turn — and drop the cumulative counter from the status card. This is the expected meaning of "context."

(b) Show both, clearly labeled:

📚 Context (next turn): 95k / 1.0m (9%)
🧮 Session tokens (cumulative): 3.8m
🧹 Compactions: 0

Option (a) is simpler and matches what every other agent runtime reports. Option (b) is honest about the long-session bookkeeping but adds a line to a card that is already busy.

Environment

  • OpenClaw 2026.4.24 (cbcfdf6)
  • Model: claude-cli/claude-opus-4-7
  • Session kind: Telegram-direct main
  • Compaction config: mode=safeguard, reserveTokensFloor=40000, softThresholdTokens=4000

extent analysis

TL;DR

The status card should display the working-set utilization instead of the cumulative session-token counter to provide a more accurate representation of context window utilization.

Guidance

  • Consider implementing option (a) to show only the working-set utilization, which is the expected meaning of "context" and matches other agent runtimes.
  • If option (b) is preferred, ensure that the labels are clear and concise to avoid confusion between the cumulative session tokens and the working-set utilization.
  • Verify that the compaction configuration is correct and that the mode=safeguard setting is suitable for the specific use case.
  • Review the session kind and model configuration to ensure that they are compatible with the desired behavior.

Example

No code snippet is provided as the issue is related to the display of information on the status card, and the suggested fix involves changing the way the data is presented rather than modifying the underlying code.

Notes

The suggested fix assumes that the working-set utilization is the most relevant metric for context window utilization. However, the suitability of this metric may depend on the specific use case and requirements.

Recommendation

Apply workaround (a) to show only the working-set utilization, as it is simpler and matches the expected meaning of "context". This change will provide a more accurate representation of context window utilization and avoid confusing users with cumulative session-token counters.

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

openclaw - 💡(How to fix) Fix session status `Context:` line conflates cumulative session tokens with per-call context window [2 comments, 3 participants]