Bug Report
Summary
The Usage page in Control UI shows significantly lower token/cost usage than actual. After investigating locally, I found that the Gateway only counts tokens from active .jsonl session files, but ignores .jsonl.reset.* archived files generated by /new or session resets.
Steps to Reproduce
- Use OpenClaw normally across multiple sessions, using
/new to reset between topics
- Open Control UI → Usage page → select last 7 days
- Observe that token counts are far lower than actual usage
Root Cause
Each /new or session reset renames the active session file from:
<uuid>.jsonl → <uuid>.jsonl.reset.<timestamp>
The .jsonl.reset.* files contain full token usage data (input, output, cacheRead, cacheWrite, cost), but the sessions.usage / sessions.usage.timeseries WebSocket handlers appear to only scan active .jsonl files, skipping the reset archives.
Evidence
Inspecting a reset session file shows valid usage data:
{
"input": 18443,
"output": 129,
"cacheRead": 2560,
"cacheWrite": 0,
"totalTokens": 21132,
"cost": { "total": 0.0117 }
}
In my local setup, there are 31 reset files and 12 deleted files for the main agent — none of these appear in the Usage dashboard.
Expected Behavior
.jsonl.reset.* files should be included in Usage statistics. These represent real usage from the same user/agent — the session was just reset, not deleted.
Notes
.jsonl.deleted.* files (manually deleted sessions) — reasonable to exclude
.jsonl.reset.* files (reset via /new) — should be counted
Environment
- OpenClaw version: 2026.3.8
- OS: macOS (Darwin 23.6.0, arm64)
- Node: v22.14.0
Bug Report
Summary
The Usage page in Control UI shows significantly lower token/cost usage than actual. After investigating locally, I found that the Gateway only counts tokens from active
.jsonlsession files, but ignores.jsonl.reset.*archived files generated by/newor session resets.Steps to Reproduce
/newto reset between topicsRoot Cause
Each
/newor session reset renames the active session file from:The
.jsonl.reset.*files contain full token usage data (input, output, cacheRead, cacheWrite, cost), but thesessions.usage/sessions.usage.timeseriesWebSocket handlers appear to only scan active.jsonlfiles, skipping the reset archives.Evidence
Inspecting a reset session file shows valid usage data:
{ "input": 18443, "output": 129, "cacheRead": 2560, "cacheWrite": 0, "totalTokens": 21132, "cost": { "total": 0.0117 } }In my local setup, there are 31 reset files and 12 deleted files for the main agent — none of these appear in the Usage dashboard.
Expected Behavior
.jsonl.reset.*files should be included in Usage statistics. These represent real usage from the same user/agent — the session was just reset, not deleted.Notes
.jsonl.deleted.*files (manually deleted sessions) — reasonable to exclude.jsonl.reset.*files (reset via/new) — should be countedEnvironment