GeezerVison is showing github.com — fix(schema): reject empty model alias targets by dezren39 · Pull Request #413 · developing-today-forks/opencode
Conversation
dezren39
commented
Oct 25, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #411
What
ModelAlias.resolveRef (packages/schema/src/model-alias.ts) guarded its three model-alias lookups on truthiness (if (aliasTarget) / if (origScopedAlias) / if (scopedAlias)), so a model alias with an empty-string target was silently ignored — resolution proceeded as if the alias did not exist:
resolve({ models: { "openai/pro": "" } }, "openai/pro") returned "openai/pro" unchanged
resolve({ providers: { ds: "deepseek" }, models: { "ds/pro": "" } }, "ds/pro") returned "deepseek/pro" (provider alias applied, empty model alias dropped)
Provider alias targets (#407/#410) and variant alias targets (#406/#410) already throw Invalid model reference for an empty target; model aliases were the remaining gap.
Change
- All three model-alias application points (global, scoped under the original provider name, scoped under the provider-alias-resolved name) now check
!== undefined and throw Invalid model reference: <current> for an empty target, mirroring the provider-alias validation added in fix(schema): validate provider and variant alias targets #410.
- One new test (test 24) covers the empty target for the global lookup and both scoped lookups (including the scoped key reached through a provider alias).
Verification
packages/core: bun test test/model-alias.test.ts — 24/24 pass (was 23).
- Ablation: with only
packages/schema/src/model-alias.ts reverted, exactly the new test fails and the other 23 pass.
- Neighbours:
model-alias + session-runner-model + model-resolver — 81/81 pass.
packages/schema: full suite 70/70 pass.
- Prettier-formatted; diff is only the two files above (+22/−3).
Note: GitHub Actions has created no workflow runs repo-wide since 2026-10-23 (#365), so local suites are the verification available.
![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
- Empty model alias targets now return an “Invalid model reference” error instead of being treated as though no alias were configured.
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
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-25T02:23:03.929353Z |
837c4e0 |
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 25, 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:
2eaa1b1c-2491-48ff-8279-8538fa6c5624
Commits
-
Reviewing files that changed from the base of the PR and between d0ba111 and 837c4e0.
Files selected for processing: 2
-
packages/core/test/model-alias.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
-
Model alias resolution now distinguishes an absent alias from one explicitly mapped to an empty string. It throws Invalid model reference for empty global and provider-scoped alias targets. Tests cover global and scoped cases.
Changes: Model alias validation
| Layer / File(s) |
Summary |
Reject empty alias targets packages/schema/src/model-alias.ts, packages/core/test/model-alias.test.ts |
Global and provider-scoped lookups now reject explicitly empty alias targets. Tests cover global aliases and scoped aliases keyed by the original or resolved provider. |
Priority: Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Possibly related PRs
Merge Risk: Minimal · up to 837c4
-
The alias validation change is ready to merge.
Pre-merge checks: 5
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title "fix(schema): reject empty model alias targets" matches the main change. The schema change in model-alias.ts makes resolveRef throw Invalid model reference for empty-string model alias targe… |
| Description check |
 |
The description follows the repository template. It links the issue (Fixes #411), gives the type of change implicitly as a bug fix, and explains the problem, the change, and why it works. It also incl… |
| Linked Issues check |
 |
Issue #411 requires that a matching scoped model alias with an empty-string target throws Invalid model reference: <input> under both the original-provider key and the provider-alias-resolved key. A… |
| Out of Scope Changes check |
 |
The PR changes two files: packages/schema/src/model-alias.ts and packages/core/test/model-alias.test.ts. Both changes relate directly to #411. - model-alias.ts: the three guards are changed from truth… |
| 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. Analyzed 1 functions across 2 files. |
Full details: Title check
-
Explanation
The title "fix(schema): reject empty model alias targets" matches the main change. The schema change in model-alias.ts makes resolveRef throw Invalid model reference for empty-string model alias targets at the global and both scoped lookups, instead of ignoring them. The title is specific, concise, and follows a conventional commit style.
Full details: Description check
-
Explanation
The description follows the repository template. It links the issue (Fixes #411), gives the type of change implicitly as a bug fix, and explains the problem, the change, and why it works. It also includes verification steps: test counts, an ablation check, neighbor suites, and the full schema suite. The description includes an AI-generated footer and images from the tool, which are not template content. The 'Type of change' checkboxes are not ticked, and the 'Checklist' section is not ticked either. The description does not include a Screenshots section, which is acceptable for a non-UI change.
Full details: Linked Issues check
-
Explanation
Issue #411 requires that a matching scoped model alias with an empty-string target throws Invalid model reference: <input> under both the original-provider key and the provider-alias-resolved key. At head, packages/schema/src/model-alias.ts meets this for the direct match case:
- Rule 1 (global,
aliases.models?.[base]): !== undefined check, then throws on empty target.
- Scoped under original provider (
origScopedKey): !== undefined check, then throws on empty target.
- Scoped under resolved provider (
scopedKey, after Rule 2): !== undefined check, then throws on empty target.
resolve delegates to resolveRef, so both entry points throw.
The thrown message uses ${current}. On the first hop, current equals the trimmed input, so the message matches <input> for direct matches. This matches the existing provider-alias validation (Rule 2). For a chained alias, the message names the hop being resolved, not the original input. The issue does not require the chained form.
Non-empty behavior is unchanged. The guard change only adds an empty-string throw. Tests 4, 5, and 13 use non-empty targets and their logic paths are unchanged.
New test 24 in packages/core/test/model-alias.test.ts covers: the global empty target, the original-provider scoped key (openai/pro), the scoped key reached via provider alias using the original key (ds/pro), and the scoped key under the resolved provider (deepseek/pro). These cases match the issue's requirement for tests under both scoped paths.
The optional global-message improvement was not made. The issue marks it optional.
Limit: the test diff tool was unavailable. The test content was read at head. I did not run the test suite. The author-reported results (24/24, 81/81, 70/70) are not independently verified.
Full details: Out of Scope Changes check
-
Explanation
The PR changes two files: packages/schema/src/model-alias.ts and packages/core/test/model-alias.test.ts. Both changes relate directly to #411.
- model-alias.ts: the three guards are changed from truthiness to
!== undefined. Each adds an empty-string throw. No other resolver logic changes.
- model-alias.test.ts: test 24 is added. It covers the empty-target cases for
#411. No existing test is modified in the reviewed content.
The global empty-target error message changes from Invalid model reference after alias resolution: <base> to Invalid model reference: <current>. The issue lists this improvement as optional and related. It is a direct consequence of the same guard change, so it is not out of scope.
No unrelated refactors, documentation, or configuration changes were identified in the PR summary.
Limit: other test suites that may assert the old global message were not inspected. The author reports neighbouring suites pass.
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.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 25, 2026
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.
|