Repository navigation
Conversation
… in session listing (openclaw#15705)
This was referenced Feb 15, 2026
thewilloftheshadow
force-pushed
the
main
branch
from
February 15, 2026 18:46
bfc1ccb to
f92900f
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
Contributor
|
Closing as AI-assisted stale-fix triage. Linked issue #15705 ("fix(sessions): Use model contextWindow instead of agent contextTokens in session listing") is currently closed and was closed on 2026-02-14T02:11:08Z with state reason completed. If this specific implementation is still needed on current main, please reopen #15726 (or open a new focused fix PR) and reference #15705 for fast re-triage. |
9 tasks
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
Fixes #15705. Also addresses #15697.
The
sessionsCommandfallback chain forconfigContextTokensincorrectly prioritizedcfg.agents.defaults.contextTokens(the agent max buffer setting) over the model's actual context window. When users set a large buffer value (e.g. 1M), session listings showed inflated context windows and misleading token percentages.\n\n## Root Cause\n\nInsrc/commands/sessions.ts, the fallback chain was:\n\ntypescript\nconst configContextTokens =\n cfg.agents?.defaults?.contextTokens ?? // agent buffer (e.g. 1M)\n lookupContextTokens(resolved.model) ?? // model's actual contextWindow\n DEFAULT_CONTEXT_TOKENS; // 200k\n\n\ncfg.agents.defaults.contextTokensis the agent's max buffer setting, not the model's context window. Because??only falls through onnull/undefined, a configured value (e.g.1_000_000) always wins, even when the model's actual context window is known.\n\n## Fix\n\nRemovecfg.agents.defaults.contextTokensfrom the fallback chain:\n\ntypescript\nconst configContextTokens =\n lookupContextTokens(resolved.model) ?? DEFAULT_CONTEXT_TOKENS;\n\n\n## Before / After\n\nBefore (agent buffer = 1M, model = MiniMax-M2.5-Omni with 204k context):\n\ndirect +15555550123 30m ago MiniMax-M2.5-Omni 60k/1000k (6%)\n\n\nAfter:\n\ndirect +15555550123 30m ago MiniMax-M2.5-Omni 60k/200k (30%)\n\n\n## Test Plan\n\n- Updated existing e2e test assertions to reflect correct fallback behavior\n- Added regression test verifyingagents.defaults.contextTokensdoes not leak into display\n- All 4 tests pass:pnpm vitest run src/commands/sessions.e2e.test.ts --config vitest.e2e.config.tsGreptile Overview
Greptile Summary
This PR updates
sessionsCommandto derive the displayed context window from model metadata (lookupContextTokens(resolved.model)) and fall back toDEFAULT_CONTEXT_TOKENS, rather than incorrectly preferringcfg.agents.defaults.contextTokens(agent buffer size). The sessions e2e tests are updated accordingly and add a regression assertion to ensureagents.defaults.contextTokensdoes not affect the JSON/table display when the model context window is unknown.Confidence Score: 5/5
sessionsCommandand aligns the displayed context window with model metadata, preventing misleading token percentages. Test updates and an explicit regression test cover the behavior change for both table and JSON outputs.Last reviewed commit: 058ef3f