Bug type
Behavior bug (incorrect output/state without crash)
Summary
When switching models in an existing session, contextTokens can become "stuck" at a lower value.
Example:
- Model A context window: ~198k
- Switch to Model B context window: ~160k
- Switch back to Model A
- Session still reports/uses ~160k context window (in session file and runtime behavior)
This causes premature compaction and incorrect context accounting.
Steps to reproduce
- Configure two models with different context windows (for example 198k and 160k).
- Start a session (OpenClaw TUI / gateway-client).
- Use Model A (198k).
- Switch to Model B (160k).
- Switch back to Model A (198k).
- Check
/status and/or session store file (contextTokens).
Expected behavior
- Context window should update based on the currently selected provider/model each time.
- After switching back to Model A, context should return to ~198k
Actual behavior
contextTokens remains at the lower value (~160k) and appears effectively hardcoded in session state.
- Switching back to higher-context model does not restore the larger context window in that session.
OpenClaw version
2026.3.2
Operating system
Ubuntu 24.04.4
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
- Early compaction / pruning
- Incorrect status reporting
- Reduced usable context in long-running sessions
Additional information
This looks related to previous context-window cache/provider-resolution issues:
Could be a regression or another path where session state keeps stale contextTokens after model switch
Bug type
Behavior bug (incorrect output/state without crash)
Summary
When switching models in an existing session,
contextTokenscan become "stuck" at a lower value.Example:
This causes premature compaction and incorrect context accounting.
Steps to reproduce
/statusand/or session store file (contextTokens).Expected behavior
Actual behavior
contextTokensremains at the lower value (~160k) and appears effectively hardcoded in session state.OpenClaw version
2026.3.2
Operating system
Ubuntu 24.04.4
Install method
npm global
Logs, screenshots, and evidence
Impact and severity
Additional information
This looks related to previous context-window cache/provider-resolution issues:
Could be a regression or another path where session state keeps stale
contextTokensafter model switch