Skip to content

fix(core): parse embedded "#variant" in model selections - #50853

Closed
CalyxLab wants to merge 1 commit into
anomalyco:devfrom
CalyxLab:fix/model-selection-embedded-variant
Closed

CalyxLab wants to merge 1 commit into
anomalyco:devfrom
CalyxLab:fix/model-selection-embedded-variant

Conversation

@CalyxLab

@CalyxLab CalyxLab commented Sep 23, 2026 •

Copy link
Copy Markdown

Configured model references like model: provider/model#variant kept the #variant suffix inside the model id (ModelV2.parse only splits on /), so agents, commands, and the default model silently resolved to nothing and fell back to an inherited/default model. The legacy v1 migration path dropped these refs entirely before the recent refactor.

This splits the embedded variant off in ModelV2.parse and applies it at the agent/command call sites, where an embedded variant wins over a separate variant: field (matching the semantics of the previous native Model.Ref.parse).

Fixes #50849 (root cause, repro, and session-level evidence there).

Validation: new tests in test/model.test.ts and test/config/agent.test.ts fail without the fix and pass with it; test/config/, test/model.test.ts, and test/tool-subagent.test.ts are green (58 tests) and tsgo --noEmit is clean.

Related: #47413 covers the separate variant: field case (fixed by f1eed8b); this PR handles the embedded model: provider/model#variant case, which is still broken on dev.

A configured model reference like "provider/model#variant" kept the
"#variant" suffix inside the model id, so the selection never resolved
and agents/commands silently ran on an inherited or default model.
Split the embedded variant off in ModelV2.parse and let it win over a
separate variant field, matching native selection semantics.

Fixes anomalyco#50849
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: legacy Markdown agent silently drops "model: provider/model#variant" — subagent inherits parent model

2 participants