(MOT-4014) fix: align context compaction with router output budget - #501
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (25)
📝 WalkthroughWalkthroughChangesThe router gains Model budget flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ContextAssembly
participant ModelResolver
participant Router
participant BudgetCalculator
ContextAssembly->>ModelResolver: resolve model and limits
ModelResolver->>Router: router::models::budget
Router->>BudgetCalculator: resolve effective max output tokens
BudgetCalculator-->>Router: effective limit
Router-->>ModelResolver: model and effective limit
ModelResolver-->>ContextAssembly: resolved model budget
ContextAssembly-->>ContextAssembly: assemble and report token accounting
Possibly related PRs
Suggested reviewers: Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
skill-check — worker0 verified, 42 skipped (no docs/).
Four for four. Nicely done. |
Problem
Context assembly reserves the model catalog's maximum output ceiling even when the router will request a smaller effective output allocation. This unnecessarily reduces the usable input budget and can trigger premature compaction for any provider or model whose effective router allocation differs from its catalog ceiling.
Solution
router::models::budgetcontract, backed by the same output-token precedence used byrouter::chatImpact
Sessions across registered providers and models can use their available input capacity without premature compaction while retaining the existing hard over-budget protection. The effective budget accounts for provider configuration, model ceilings, provider defaults, router limits, and model-specific input limits.
Validation
context-manager: unit, BDD, integration, manifest, and schema testsllm-router: unit, live-engine integration, and schema testsharness: unit, manifest, and schema testsRefs MOT-4014
Summary by CodeRabbit
New Features
Bug Fixes
Documentation