Bug Description
When a session is created, the contextTokens value from the model catalog is cached in sessions.json. If the catalog later updates with a corrected value (e.g., after a pi-ai update or OpenClaw upgrade), the stale cached value persists indefinitely. The only fix is manually deleting contextTokens from sessions.json and restarting the gateway.
Steps to Reproduce
- Start a session with a model whose catalog entry has an incorrect
contextWindow (or any value)
- The value gets cached in
~/.openclaw/agents/<agent>/sessions/sessions.json as contextTokens
- Update OpenClaw or the catalog so the model now has the correct
contextWindow
- Restart the gateway
- Run
/status — the old cached value is still displayed
Expected Behavior
On gateway restart (or session resume), contextTokens should be refreshed from the current model catalog rather than relying on the cached value in sessions.json.
Actual Behavior
/status shows the stale cached value (e.g., 1.0m instead of 200k for Claude Sonnet/Opus 4.5).
Workaround
- Stop the gateway
- Remove
contextTokens from all entries in sessions.json
- Restart the gateway
Environment
- OpenClaw: 2026.2.2-3
- OS: Linux (Ubuntu)
- Node: v24.13.0
Bug Description
When a session is created, the
contextTokensvalue from the model catalog is cached insessions.json. If the catalog later updates with a corrected value (e.g., after a pi-ai update or OpenClaw upgrade), the stale cached value persists indefinitely. The only fix is manually deletingcontextTokensfromsessions.jsonand restarting the gateway.Steps to Reproduce
contextWindow(or any value)~/.openclaw/agents/<agent>/sessions/sessions.jsonascontextTokenscontextWindow/status— the old cached value is still displayedExpected Behavior
On gateway restart (or session resume),
contextTokensshould be refreshed from the current model catalog rather than relying on the cached value insessions.json.Actual Behavior
/statusshows the stale cached value (e.g.,1.0minstead of200kfor Claude Sonnet/Opus 4.5).Workaround
contextTokensfrom all entries insessions.jsonEnvironment