Repository navigation
fix(mlx): read engine context_length; Write joins the core tool tier - #381
Merged
Merged
Conversation
Two related defects found by bench forensics (T13: agent's correct solution died because the reduced toolset rejected Write): 1. The adapter only read max_input_tokens from /v1/models, but the engine reports the native window as context_length (262144 for Qwen3.8-27B-4bit-mtp). Every model therefore fell back to the 32768 heuristic and ran with 1/8 of its real window - constant compaction, core-tier tool reduction, and 600s-cap failures. Fix: read context_length as a fallback. 2. MLX_CORE_TOOL_NAMES (the <=32k reduction tier) had Edit but not Write: agents could modify existing files but never create them. Bench T13 failed pytest collection because its Edit already imported exceptions.py while the Write creating it was rejected. Fix: Write joins the core tier (schema is small; the capability loss was not). Co-Authored-By: Claude Code <[email protected]>
This was referenced Nov 27, 2026
Merged
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
max_input_tokensfrom/v1/models, but the engine reports the native window ascontext_length(262144 for Qwen3.8-27B-4bit-mtp). Every model fell back to the 32768 heuristic and ran with 1/8 of its real context window — driving constant compaction, core-tier tool reduction, and 600s-cap bench failures.MLX_CORE_TOOL_NAMES(the over-budget reduction tier) had Edit but no Write: agents could modify files but never create them. Bench T13 died exactly this way (Edit importedexceptions.py, the Write creating it was rejected, pytest collection failed). Write's schema is small; the capability loss was not.context_lengthas fallback; Write joins the core tier; both regression-tested.Evidence
"context_length": 262144for Qwen3.8-27B-4bit-mtp[MLX-Preflight] tool tier=core (contextWindow=32768), toolSet size=5→No such tool available: WriteTest plan
bun test: 1885 pass / 0 fail (2 new tier-content tests)bun run build: green🤖 Generated with Claude Code