fix(status): show runtime model context limit instead of stale session value#23299
Open
SidQin-cyber wants to merge 1 commit intoopenclaw:mainfrom
Open
fix(status): show runtime model context limit instead of stale session value#23299SidQin-cyber wants to merge 1 commit intoopenclaw:mainfrom
SidQin-cyber wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…n value Closes openclaw#23122 When a session's model is changed at runtime (e.g. via model override), entry.contextTokens still holds the value from session creation time. Prioritize lookupContextTokens(resolvedModel) so the status display reflects the actual runtime model's context window. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/commands/sessions.ts
Line: 265
Comment:
Inconsistent with the fix in `status.summary.ts:135`. This should also prioritize `lookupContextTokens(model)` first to show the runtime model's context limit.
```suggestion
const contextTokens = lookupContextTokens(model) ?? row.contextTokens ?? configContextTokens;
```
How can I resolve this? If you propose a fix, please make it concise. |
LalithaMV
approved these changes
Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Security Impact (required)
Repro + Verification
Steps
Expected
Actual (before fix)
Evidence
Before (line 134-135 in `status.summary.ts`):
```typescript
const contextTokens =
entry?.contextTokens ?? lookupContextTokens(model) ?? configContextTokens ?? null;
```
After:
```typescript
const contextTokens =
lookupContextTokens(model) ?? entry?.contextTokens ?? configContextTokens ?? null;
```
`lookupContextTokens(model)` uses the resolved runtime model, giving the correct context window. The stale `entry?.contextTokens` only applies as fallback for unknown/custom models.
Human Verification (required)
Compatibility / Migration
Failure Recovery (if this breaks)
If `lookupContextTokens` returns an unexpected value, the display would show wrong context but has no functional impact (display-only). Fallback chain preserved.
Risks and Mitigations
Low risk — single line priority change in fallback chain, with existing fallbacks preserved.
Greptile Summary
Fixed stale context limit display in
openclaw statusby prioritizing runtime model lookup over session-stored value.Key Changes:
status.summary.ts:135fromentry?.contextTokens ?? lookupContextTokens(model)tolookupContextTokens(model) ?? entry?.contextTokensresolveSessionModelRefcorrectly resolves runtime model fromentry.model, solookupContextTokens(model)gets the right valueIssues Found:
src/commands/sessions.ts:265still uses the old priority order and should be updated for consistencyConfidence Score: 4/5
resolveSessionModelRefgets the runtime model, thenlookupContextTokensreturns its context window. However, there's an identical pattern insessions.ts:265that wasn't updated, creating an inconsistency where the two commands may show different context limits for the same session.src/commands/sessions.ts:265- needs the same priority swap for consistencyLast reviewed commit: 6c49fda