Repository navigation
perf: optimize inference control flow tracing and cache reuse - #56
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5f78828. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f7882811f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 930507532e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcc85cb9cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90a31c04b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Note
High Risk
Touches core inference and cache/attention paths (Gemma4 paged attention + MLX eval/materialization) and server request dispatch limits, so regressions could impact correctness, latency, or stability under load.
Overview
Improves server-side observability and request shaping by adding a
/v1/messages/count_tokensendpoint (non-generating chat-template tokenization with race-guards against model re-registration), enforcing a per-model queue cap (429 +Retry-After) and introducing a process-wideModelWorkCoordinatorto prioritize model loads over new inference.Extends wire/CLI logging with richer timing + cache context (server vs native TTFT/TTFB, cached-prefix accounting, paged tuning metadata), clamps
max_tokensto per-model output caps, adds a Claude Code title-generation fast path (disable thinking + cap tokens), and tightens tool-call suppression so parsed tool-call markup isn’t emitted when tools are absent.On the native side, adds
MLX_INFERENCE_TRACElogging, makes MLXeval/weight materialization failures surfaced as errors (with chunked, auto-budgeted materialization), and updates Gemma4 paged attention to prefer graph-native paged gather paths with fallbacks plus stricter mask validation (with new correctness tests).Reviewed by Cursor Bugbot for commit b915ceb. Bugbot is set up for automated code reviews on this repo. Configure here.