-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
Status display shows 200k context instead of 1M when context1m is enabled #26627
Description
Bug
When context1m: true is set in model params (e.g. agents.defaults.models["anthropic/claude-opus-4-6"].params.context1m), the /status command still displays Context: 17k/200k instead of Context: 17k/1024k.
Root Cause
In the reply pipeline, context tokens are resolved at the model selection stage using:
agentCfg?.contextTokens ?? lookupContextTokens(model) ?? DEFAULT_CONTEXT_TOKENSThis code path does not check for context1m in the configured model params. It falls back to lookupContextTokens() which returns the model catalog default (200k for Opus/Sonnet 4).
The proper context1m check exists in resolveContextTokensForModel(), but it never gets reached because:
- The initial resolution returns 200k
- That value gets passed as
contextTokensOverrideintobuildStatusMessage resolveContextTokensForModelshort-circuits on a positivecontextTokensOverride
Affected
/statusdisplay shows wrong context window- All agents, all channels
- Actual API calls correctly use 1M (the beta header is applied correctly)
Workaround
Set contextTokens: 1048576 explicitly in agents.defaults. This overrides the catalog lookup.
Suggested Fix
The context token resolution in the model selection stage should also check context1m:
// Before (broken):
agentCfg?.contextTokens ?? lookupContextTokens(model) ?? DEFAULT_CONTEXT_TOKENS
// After (fixed):
agentCfg?.contextTokens ?? resolveContextTokensForModel({ cfg, provider, model, fallbackContextTokens: DEFAULT_CONTEXT_TOKENS }) ?? DEFAULT_CONTEXT_TOKENSOr equivalently, add the context1m check inline at that resolution point.
Environment
- OpenClaw 2026.2.23 (b817600)
- Model: anthropic/claude-opus-4-6 with
context1m: true