fix: add Qwen3.5 model context window tokens#12693
Open
alievrusik wants to merge 1 commit intodanny-avila:mainfrom
Open
fix: add Qwen3.5 model context window tokens#12693alievrusik wants to merge 1 commit intodanny-avila:mainfrom
alievrusik wants to merge 1 commit intodanny-avila:mainfrom
Conversation
Qwen3.5 models (e.g. Qwen/Qwen3.5-397B-A17B-FP8) have a 262,144 token native context window, but were falling back to the generic `qwen3` entry (40,960 tokens) via fuzzy name matching. This caused the agent graph's pruneMessages to aggressively drop messages — including the user query, assistant tool_calls, and tool results — when tool output exceeded the undersized token budget, leading to the model receiving only the system message and producing broken responses.
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
qwen3.5(262,144) andqwen3.5-397b(262,144) entries to theqwenModelstoken mapProblem
Qwen3.5 models (e.g.
Qwen/Qwen3.5-397B-A17B-FP8) have a 262,144 token native context window, but were falling back to the genericqwen3entry (40,960 tokens) viafindMatchingPatternfuzzy name matching.This caused the agent graph's
pruneMessages(in@librechat/agents) to aggressively drop messages — including the user query, assistanttool_calls, and tool results — when tool output exceeded the undersized token budget (~36K tokens after the 0.9x scaling formula), leading to the model receiving only the system message and producing broken or empty responses.Symptoms observed
Test plan
Qwen/Qwen3.5-397B-A17B-FP8now resolves to 262,144 tokens instead of 40,960