Repository navigation
fix(model-resolver): use numeric-aware version comparison for model alias resolution - #96609
Conversation
localeCompare sorts model IDs lexicographically, so claude-opus-4-9 sorts above claude-opus-4-10. This means alias resolution picks an older model once a family crosses into double-digit minor versions. Fix: compare numeric segments numerically, fall back to lexicographic. Fixes openclaw#96588 Co-Authored-By: Claude (via Anthropic API) <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs maintainer review before merge. Reviewed June 25, 2026, 3:10 AM ET / 07:10 UTC. Summary PR surface: Source 0, Tests +12. Total +12 across 2 files. Reproducibility: yes. A high-confidence source reproduction is Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused comparator and regression test, or an equivalent sibling, after maintainers accept the model-choice compatibility effect and exact-head checks pass. Do we have a high-confidence way to reproduce the issue? Yes. A high-confidence source reproduction is Is this the best way to solve the issue? Yes. Numeric-aware full-string collation at the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 31e941c3fc32. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +12. Total +12 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Updated PR body with proper What Problem This Solves and Evidence sections (English headers required by real-behavior-proof-check). @clawsweeper re-review |
|
Contributor review note, not an official maintainer review: this PR currently looks weaker than the active sibling #96640 for #96588. The changed path here is the right one, but this patch only updates The custom |
|
Simplified to localeCompare(undefined, {numeric:true}) — 18 fewer lines. Added regression test. @clawsweeper re-review |
|
Added real terminal output proof. @clawsweeper re-review |
Fixes #96588
What Problem This Solves
tryMatchModelsorts candidate model ids with plain lexicographiclocaleCompare, so ids likeclaude-opus-4-9sort aboveclaude-opus-4-10. When version numbers cross into double digits, partial aliases such asopusresolve to an older model.Evidence
Fix
src/agents/sessions/model-resolver.ts: replaced twolocaleCompare()sort calls withlocaleCompare(undefined, { numeric: true }), which natively compares numeric segments correctly.Regression test
Added
parseModelPattern("opus", [claude-opus-4-9, claude-opus-4-10, claude-opus-4-11])→ selectsclaude-opus-4-11.Terminal output (patched resolver)
What was not tested
Single-digit versions only (lexicographic and numeric ordering agree — no behavioral change). Custom model catalogs where version numbering does not follow
-N-Npatterns.AI Assistance
Changes
2 files, +15/-3. Lockfile unchanged.