fix(models): resolve openrouter compat aliases#68579
Conversation
Greptile SummaryThis PR fixes the mis-resolution of Confidence Score: 5/5Safe to merge — core fix is correct and well-tested; all remaining findings are style/cleanup suggestions. The fix correctly handles both aliases: CHANGELOG.md (wrong version block + mid-section insertion); src/agents/model-selection.ts (minor indirection and known gap in interactive model-switch path for
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b3750120ec
ℹ️ 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: bd6a90a972
ℹ️ 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".
3c65036 to
adc0915
Compare
adc0915 to
b06e8d3
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b06e8d3e64
ℹ️ 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".
| const openrouterCompatRef = resolveConfiguredOpenRouterCompatAlias({ | ||
| cfg: params.cfg, | ||
| raw: trimmed, | ||
| defaultProvider: params.defaultProvider, | ||
| }); |
There was a problem hiding this comment.
Preserve alias precedence for OpenRouter compat aliases
resolveAllowedModelRef now short-circuits through resolveConfiguredOpenRouterCompatAlias before alias lookup, so a user-defined alias named openrouter:free/openrouter:auto is ignored and resolves to the first configured compat target instead. This is a regression from prior behavior and also diverges from model-selection-resolve.ts, where resolveModelRefFromString still checks aliasIndex first; in practice the same config can resolve to different models depending on which resolver path is used.
Useful? React with 👍 / 👎.
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
* fix(models): resolve openrouter compat aliases * fix(models): cover openrouter free interactive alias * fix(models): mirror openrouter compat aliases in runtime resolver * fix(models): align openrouter free allowlist aliases
Summary
openrouter:freeandopenrouter:autofall through the providerless model path, soopenrouter:freegets mis-resolved under the default provider andopenrouter:autois not treated as the canonical OpenRouter auto model.anthropic/openrouter:freeand then hit unknown-model failures even though the issue is only the compatibility alias resolver.parseModelRefnow normalizesopenrouter:autoto the canonicalopenrouter/autoref, and configured-model resolution now mapsopenrouter:freeto the first configured concreteopenrouter/...:freemodel from allowlist/config instead of shoving it under the default provider.reasoning_detailsparsing.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
openrouter:freeresolves toanthropic/openrouter:free;openrouter:autoshould also be handled explicitly #57066Root Cause (if applicable)
/, so OpenRouter compatibility aliases using:never got their own path and were treated like bare model names under the default provider.openrouter:freeto one vendor model, but that is the wrong architectural shape because the right free target depends on user config.Regression Test Plan (if applicable)
src/agents/model-selection.test.tsopenrouter:autoresolves canonically, andopenrouter:freeresolves to a configured concrete free OpenRouter model instead of the default provider.User-visible / Behavior Changes
openrouter:autonow resolves toopenrouter/auto.openrouter:freenow resolves to the first configured concreteopenrouter/...:freemodel when one exists.Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
openrouter:autooropenrouter:freeSteps
openrouter:autooropenrouter:free.openrouter/...:freemodel in the allowlist ormodels.providers.openrouter.modelsfor the free case.Expected
openrouter:autoresolves toopenrouter/auto.openrouter:freeresolves to a concrete configured OpenRouter free model.Actual
Evidence
Human Verification (required)
pnpm test:serial src/agents/model-selection.test.tsand confirmed the new parse case plus both configured resolution paths.openrouter:auto;openrouter:freevia allowlist config;openrouter:freeviamodels.providers.openrouter.modelswhen allowlist is absent.Review Conversations
Compatibility / Migration
Yes)No)No)Risks and Mitigations
openrouter:freecould resolve to an unexpected free model when multiple concrete free models are configured.