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_TOKENS
This 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
contextTokensOverride into buildStatusMessage
resolveContextTokensForModel short-circuits on a positive contextTokensOverride
Affected
/status display 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_TOKENS
Or 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
Bug
When
context1m: trueis set in model params (e.g.agents.defaults.models["anthropic/claude-opus-4-6"].params.context1m), the/statuscommand still displaysContext: 17k/200kinstead ofContext: 17k/1024k.Root Cause
In the reply pipeline, context tokens are resolved at the model selection stage using:
This code path does not check for
context1min the configured model params. It falls back tolookupContextTokens()which returns the model catalog default (200k for Opus/Sonnet 4).The proper
context1mcheck exists inresolveContextTokensForModel(), but it never gets reached because:contextTokensOverrideintobuildStatusMessageresolveContextTokensForModelshort-circuits on a positivecontextTokensOverrideAffected
/statusdisplay shows wrong context windowWorkaround
Set
contextTokens: 1048576explicitly inagents.defaults. This overrides the catalog lookup.Suggested Fix
The context token resolution in the model selection stage should also check
context1m:Or equivalently, add the
context1mcheck inline at that resolution point.Environment
context1m: true