Repository navigation
fix(mlx): populate sync context cache from capabilities layer - #383
Merged
Merged
Conversation
The adapter computed the real 262144 window but nothing propagated it to getContextWindowForModel: its cache had no setter and the only async filler was dead code, so preflight and autocompact always saw the 32768 fallback. getMlxModelCapabilities now writes the cache (dynamic import, no cycle), and it runs before the first query in both REPL and headless sessions. Verified live (bench T13 smoke, Qwen3.8-27B-4bit-mtp): preflight window=262144 on 8/9 queries (first query warms the cache), full 29-tool set on every request, zero OVER BUDGET reductions - previously every query after the first ran on 5-6 tools at a 32k window. Co-Authored-By: Claude Code <[email protected]>
This was referenced Nov 28, 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
getContextWindowForModelstill returns the 32768 fallback because nothing writes the cache (no setter existed; the only async filler was dead code with zero callers).setMlxModelContextCacheand calls it fromgetMlxModelCapabilities(runs before the first query in REPL and headless sessions).window=262144on 8/9 preflight queries, full 29-tool set on every request, zero OVER BUDGET reductions. Without it: every query after the first runs on 6 tools at a 32k window.Test plan
bun test: 1885 pass / 0 failbun run build: green🤖 Generated with Claude Code