fix(routing): resolve model-keyed lookups the way the runtime resolves them - #2140
Conversation
…s them Two evidence surfaces read per-model config with a bare map lookup while the runtime resolves the same keys through modelRecordValue, so family and case overrides were invisible to them and a prototype-shaped id resolved an Object.prototype member instead of missing. Routing capability evidence therefore gave gpt-oss:120b the provider-wide 8k window instead of the gpt-oss family's 131072, and ignored noVisionModels - values that select candidates, not just logs. The Lab behavior report missed the same overrides, and "constructor" resolved to Object.prototype.constructor, which made jcsStringify throw and silently dropped Lab subjects. Exact-own maps (modelPreferHostedTools, modelOpenRouterRouting) deliberately do not family-spread; that boundary is pinned by tests. Both patches are @ntdatt812's work from #2100 and #2077, applied unchanged. Closes #2100 Closes #2077
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughRouting capability evidence and compatibility behavior now resolve model overrides through safe, family-aware matching. Vision exclusions take precedence over modality metadata. New tests cover family, exact, case-insensitive, fallback, and prototype-shaped model IDs. ChangesModel-aware routing resolution
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This focused change aligns model-keyed lookups with runtime resolution rules, with the reported tests and checks passing; no actionable merge-blocking risk remains. Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
리뷰 · 우선순위 54 / 80모델 키 lookup이 #2100이랑 #2077을 한 테제로 합친 거임. 둘 다 ntdatt812 작업. exact-own 맵( 점수는 54임. 맞는데 지금 해결방안: 머지 후 원 PR 두 개 attribution 달고 닫기. 2.27 필수 아님. #2137 #2138 뒤에 넣으면 됨. 이 댓글은 grok-bot이 작성했습니다 |
|
Thanks for consolidating these, and for the write-up — the single-thesis framing is better than my two PRs were. "Model-keyed lookups must use the runtime's own resolution rules" is the right way to state it, and folding both files under one One mechanical thing, and only because the PR is still open so it costs you nothing now:
Your earlier merges did carry it through, which is how I noticed the difference: #2085 and #2086 landed as merge commits, so my commits survived intact and the API shows If you're willing, one line at the end of the commit body is all it takes: That is the identity GitHub already links to my account, so it will resolve. Entirely your call, and I would rather have the patches land as you have them than have them back. Just flagging it while it is still a one-line amend rather than after the merge. |
Ingwannu
left a comment
There was a problem hiding this comment.
I cannot approve the current head because it is 18 commits behind the current dev tip (caf20353f). The existing diff and CI results do not validate the change against the current integration state.
Please rebase onto the latest dev, resolve conflicts in the affected runtime paths, rerun the focused checks plus the full exact-head suite, and re-request review. This is a review-state blocker, not a rejection of the fix direction.
|
@Ingwannu's rebase blocker is fair, and since the diff here is my patch from #2100/#2077 I ran the validation against the current tip so the rebase does not have to be done blind. I cannot push to this branch, so this is data rather than a fix. The patch cherry-picks onto Nothing in the 18 intervening commits touches Results on that exact rebased head: On the full suite, and I would rather state this plainly than round it up: my Run in isolation on the same tree, those two files are 192 pass / 0 fail. They exercise OAuth pool login and GUI status copy; this patch touches two routing files and neither is in their import graph. So they are load-dependent on my Windows box, not consequences of the change — but I have not produced a clean full-suite total on the rebased head, and that is the one thing @Ingwannu asked for that I cannot hand you. Worth knowing when you read a full-suite result from this repo on Windows: I have run it four times today on four different heads and it reddened a different subset each time, always tests with multi-second timeouts. Separately, No action needed from me on the credit question in my earlier comment; it can wait until after the rebase. |
|
Thanks @ntdatt812 — the clean cherry-pick and focused results are useful evidence that the patch still applies. They do not update the PR head, though: My existing changes-requested review therefore remains in place. @lidge-jun, please rebase/amend this branch, preserve the contributor trailer, and let exact-head CI run. The isolated Windows timeout reruns support treating those local failures as load-related, but they are not a substitute for updating the actual PR head. |
Summary
Two evidence surfaces read per-model config with a bare map lookup while the runtime resolves the same keys through
modelRecordValue. Family and case overrides were invisible to them, and a prototype-shaped id resolved anObject.prototypemember instead of missing.Credit: both patches are @ntdatt812's work, from #2100 and #2077, applied unchanged. They are combined here because they are one thesis — model-keyed lookups must use the runtime's own resolution rules — on two disjoint files.
src/routing/capability.ts(fix(routing): resolve capability evidence the way the resolver resolves it #2100):gpt-oss:120binherited the provider-wide 8k window instead of thegpt-ossfamily's 131072, andnoVisionModelswas ignored. These values select routing candidates, not just log lines.src/routing/compatibility/behavior.ts(fix(lab): read per-model overrides in the report the way the runtime reads them #2077): the same lookup bug in the Lab behavior report, whereconstructorresolved toObject.prototype.constructor, madejcsStringifythrow and silently dropped Lab subjects.Exact-own maps (
modelPreferHostedTools,modelOpenRouterRouting) deliberately do not family-spread, and that boundary is pinned by its own tests.Verification
devand are proven RED: reverting only the two source files fails 13 of the new tests.bun test --isolate tests— 13,556 pass, 0 fail, 10 skip (856 files).tests/core-lab-boundary.test.tsgreen:behavior.tsalready imported Lab types, and this does not newly puncture the core/Lab boundary.bun run typecheck— clean.bun run privacy:scan— passed.Supersedes
Closes #2100 and #2077 once merged. Both are @ntdatt812's; I will close them with attribution rather than leaving duplicates open.
Checklist
Object.prototypeleak, which is a small safety improvement.)Closes #2100
Closes #2077
Summary by CodeRabbit