fix(claude): derive context token budget from the Claude model in Claude Code mode#42
Closed
herikwebb wants to merge 1 commit into
Closed
fix(claude): derive context token budget from the Claude model in Claude Code mode#42herikwebb wants to merge 1 commit into
herikwebb wants to merge 1 commit into
Conversation
…ude Code mode In Claude Code mode ai_service_manager.chat_model reflects the user's most recent non-Claude provider selection and is None on a Claude-only setup. The attachment budget fell through to the legacy 100-token floor (80 tokens after the 0.8 factor), which silently skipped cell-output context and dropped every attachment after the first via the budget break in on_message. Resolve the budget from the configured Claude model instead, via model_info_from_id (200K-window fallback for unknown or default model ids).
Automated PR ReviewModel: Changed files: Review result: No automated findings were found in the changed code. Residual risks: this review is based on the provided diff only; behavior still depends on |
Owner
Author
|
Raised upstream as plmbr#390; closing this fork PR. Review history retained here. |
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.
Problem
In Claude Code mode,
ai_service_manager.chat_modelreflects the user's most recent non-Claude provider selection and isNoneon a Claude-only setup. The attachment token budget inon_messagefell through to the legacy 100-token floor (80 tokens after the 0.8 factor), which:remaining_token_budget <= 0break.Change
_resolve_context_token_limithelper: in Claude Code mode the budget comes from the configured Claude model viamodel_info_from_id(200K-window fallback for unknown/default ids); other modes keep the existing behavior.on_messagetest proving a >80-token output context survives on a Claude-only setup.Testing
Full Python suite passes (1298 tests).