Skip to content

fix(mlx): populate sync context cache from capabilities layer - #383

Merged
dahai80 merged 1 commit into
mainfrom
fix/mlx-context-cache-propagation
Nov 28, 2026
Merged

dahai80 merged 1 commit into
mainfrom
fix/mlx-context-cache-propagation

Conversation

@dahai80

@dahai80 dahai80 commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • fix(mlx): read engine context_length; Write joins the core tool tier #381 merged before its second commit landed, so the cache-propagation half is missing from main: the adapter now computes the real 262144 window, but getContextWindowForModel still returns the 32768 fallback because nothing writes the cache (no setter existed; the only async filler was dead code with zero callers).
  • Cherry-picks c6a2a11: adds setMlxModelContextCache and calls it from getMlxModelCapabilities (runs before the first query in REPL and headless sessions).
  • Live-verified before push: bench T13 smoke with this commit shows window=262144 on 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 fail
  • bun run build: green

🤖 Generated with Claude Code

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]>
@dahai80
dahai80 merged commit 3efd896 into main Nov 28, 2026
1 check passed
@dahai80
dahai80 deleted the fix/mlx-context-cache-propagation branch November 28, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant