-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Status/session context window can over-report the selected model's actual window #39857
Copy link
Copy link
Open
BingqingLyu/openclaw
#152Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
resolveContextTokensForModel()can over-report the effective context window for the selected model.If an override such as
agents.defaults.contextTokensis larger than the model's known context window, OpenClaw can persist and display the larger override instead of the model's real effective limit.This is a correctness bug, not just a wording/UI issue.
Why this is a bug
When OpenClaw already knows both:
then the effective session context window should be the smaller of the two.
Today the override can win even when it is larger, so OpenClaw ends up storing/reporting a value the model does not actually have.
User-visible impact
This can mislead both users and downstream logic that relies on resolved
contextTokens, including:/statusSo the bug is not that a config value is large by itself; the bug is that OpenClaw can treat that larger override as the model's effective window even when the model limit is already known and smaller.
Concrete example
agents.defaults.contextTokens: 1048000./statusor session metadata.Actual
OpenClaw can persist/report the larger override value as
contextTokens.Expected
When both values are known, effective context should be:
min(override, modelWindow)In other words,
agents.defaults.contextTokensshould behave like a ceiling on effective context, not a forced replacement for a smaller known model limit.Scope boundary
This issue is about effective window resolution and reporting/persistence correctness.
It is not claiming that OpenClaw should invent a model limit when none is known, and it is not asking to change provider-side request limits beyond using the correct effective window once it is already known.