GeezerVison is showing github.com — fix(core): preserve a bare-alias target's variant in ModelResolver (#391) by dezren39 · Pull Request #758 · developing-today-forks/opencode
Conversation
dezren39
commented
Oct 28, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #391
Problem
ModelResolver.resolve built only String(target.providerID) for an empty-id (bare-alias) target, dropping target.variant, while SessionRunnerModel.resolve built ${providerID}#${variant}. The same bare-alias selection (e.g. flash with variant low, alias flash -> deepseek/deepseek-chat#high) therefore resolved to the alias target's variant through the programmatic Generate/ModelResolver path but the user's variant through the session runner — a silent divergence, and #385's shared-construction acceptance unmet.
Solution
- One shared helper:
ModelAlias.refString in packages/schema/src/model-alias.ts builds the ref string for a structured target (provider/id#variant, or provider#variant for a bare alias). Both ModelResolver.resolve and SessionRunnerModel.resolve now use it.
- Tests:
ModelResolver side added in packages/core/test/session-runner-model.test.ts, mirroring the runner's discriminating case (target variant low vs alias target high — user's variant wins) plus the no-variant case (alias target's variant applies).
Verification
- Laptop (worktree
~/git/fleet/sweep-391-bare-alias-variant @ a25206e): bun test test/session-runner-model.test.ts test/model-alias.test.ts test/model-resolver.test.ts — 91 pass, 0 fail.
- Typecheck:
tsc --noEmit clean for both packages/schema and packages/core on the laptop.
- CI: expecting green except the two known pre-existing unit: two permission-focus tests fail on linux + windows (pre-existing) #565 TUI permission-focus tests on unit linux/windows.
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2F33b6f70f3541c4e93f4503d29cbfec051fa1b040d8e0ae9313a51c4ece44a627%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2d33782e706e67)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- Bug Fixes
- Improved resolution of model aliases that omit a model ID. When a variant is explicitly supplied, it takes precedence over the alias’s configured variant; when no variant is supplied, the configured variant is retained. This makes provider-only aliases resolve consistently with the requested model configuration.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
ModelResolver.resolve built only String(providerID) for an empty-id (bare-alias) target, dropping target.variant, while SessionRunnerModel built providerID#variant. The same selection therefore resolved to the alias target's variant through Generate/ModelResolver but the user's variant through the session runner.
Share the construction: ModelAlias.refString in @opencode/schema/model-alias is now the single helper both resolvers use. Add ModelResolver-side tests mirroring the runner's discriminating case (target variant low vs alias target high) plus the no-variant case.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-28T20:41:48.374821Z |
a25206e |
PR opened |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Recent review info
-
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2aa61bec-b679-49f0-ad7b-e9e25ed23543
Commits
-
Reviewing files that changed from the base of the PR and between cd21eab and a25206e.
Files selected for processing: 4
-
packages/core/src/model-resolver.ts
packages/core/src/session/runner/model.ts
packages/core/test/session-runner-model.test.ts
packages/schema/src/model-alias.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Walkthrough
-
The schema adds ModelAlias.refString to format model references, including bare aliases with optional variants. Both core resolver paths use it. Added tests cover explicit variant precedence and fallback to the alias target’s variant.
Changes: Bare-alias resolution
| Layer / File(s) |
Summary |
Shared alias reference formatter packages/schema/src/model-alias.ts |
Adds refString to format a provider and optional model ID, with an optional variant. |
Resolver integration and variant tests packages/core/src/model-resolver.ts, packages/core/src/session/runner/model.ts, packages/core/test/session-runner-model.test.ts |
Both resolver paths use ModelAlias.refString. Tests check that an explicit variant takes precedence over the alias target’s variant, and that the target variant is used when no variant is supplied. |
Priority: Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- developing-today/opencode#390: Updates the same session-runner alias reference construction; this PR replaces that local construction with the shared formatter.
Suggested reviewers: thdxr
Merge Risk: Minimal · up to a2520
-
No actionable merge-blocking risk was identified.
Pre-merge checks: 5
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely identifies the primary change: preserving a bare-alias target variant in ModelResolver. |
| Description check |
 |
The description explains the issue, solution, tests, and typecheck verification. It omits the template's Type of change and Checklist sections, but the main required information is complete. |
| Linked Issues check |
 |
Issue #391 requires shared bare-alias reference construction, variant preservation in both resolvers, and focused tests. packages/schema/src/model-alias.ts adds ModelAlias.refString, and both `Mod… |
| Out of Scope Changes check |
 |
The changes are limited to the shared reference-string helper, its two resolver call sites, and tests for issue #391 behavior. The test and documentation changes directly support the issue. No unrelat… |
| Docstring Coverage |
 |
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… |
Full details: Linked Issues check
-
Explanation
Issue #391 requires shared bare-alias reference construction, variant preservation in both resolvers, and focused tests. packages/schema/src/model-alias.ts adds ModelAlias.refString, and both ModelResolver.resolve and SessionRunnerModel.resolve use it. packages/core/test/session-runner-model.test.ts tests variant low overriding alias variant high through both resolvers. It also tests the no-variant case. The PR reports passing model-resolver, session-runner-model, and alias tests.
Full details: Out of Scope Changes check
-
Explanation
The changes are limited to the shared reference-string helper, its two resolver call sites, and tests for issue #391 behavior. The test and documentation changes directly support the issue. No unrelated production behavior or unrelated files appear in the pull-request diff.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files.
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
❤️ Share
-
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate:
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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 72 hours, or it will be automatically closed.
If you believe this was flagged incorrectly, please let a maintainer know.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Salvage note from queue task 2708 (Lane A, opencode): this PR was found on revalidation to already implement issue #391 exactly as the queue packet specifies — the shared ModelAlias.refString helper in packages/schema/src/model-alias.ts used by both ModelResolver.resolve and SessionRunnerModel.resolve, plus the discriminating ModelResolver tests (target variant low vs alias target high). The queue lane created no duplicate PR; a diff of the planned queue fix against this PR shows nothing unique to salvage. Task 2708 is parked pending this PR's merge; on merge the task will complete against this PR as the outcome. CI note: unit failures are only the two known pre-existing #565 TUI permission-focus tests; e2e failures are unrelated UI timeline legs.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|