GeezerVison is showing github.com — fix(schema): use own-property alias lookups and reject padded alias targets by dezren39 · Pull Request #415 · 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 #414
Fixes #412
Problem
Two related validation gaps in ModelAlias.resolveRef (packages/schema/src/model-alias.ts), both in the same alias-target validation set as #406/#407/#411:
- fix(schema): ModelAlias alias lookups match Object.prototype members — toString/constructor names crash the #410/#413 validation with TypeError #414: alias lookups read inherited
Object.prototype members as if they were configured aliases. A model, provider, or variant named toString, constructor, hasOwnProperty, valueOf, or __proto__ produced a non-string "target" and the fix(schema): validate provider and variant alias targets #410/fix(schema): reject empty model alias targets #413 validation crashed with a TypeError (current.indexOf / providerAlias.includes / finalVariant.includes is not a function) instead of resolving like the no-alias path.
- fix(schema): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring #412: alias targets were never whitespace-checked. A whitespace-only or whitespace-padded target segment (
providers {x:" "}, scoped model " ", variant "\t", trailing "openai/gpt-4o ") passed every check and became a blank provider/model/variant segment, which the no-alias parser rejects for the equivalent input.
Solution
- All alias lookups (global model, original-provider scoped model, resolved-provider scoped model, provider, and all five variant precedence keys in
resolveVariant) now go through an ownAlias helper: Object.hasOwn plus a typeof === "string" check, so only genuinely configured string aliases match. A configured alias whose key is a prototype member name still resolves (covered by a new test).
- Alias targets are rejected with
Invalid model reference when any segment (split on //#) is whitespace-only or carries leading/trailing whitespace — for provider aliases (Rule 2), global and scoped model aliases, and variant alias targets alike. Pass-through names from the input itself are unchanged, preserving parity with the no-alias parser.
Tests
- New tests 25–28 in
packages/core/test/model-alias.test.ts: prototype names unconfigured (model/provider/variant), configured prototype-named aliases still resolve, whitespace-only/padded provider + model targets, whitespace-only/padded variant targets.
model-alias suite: 28/28 pass. Ablation: with only the schema change reverted, exactly tests 25, 27, 28 fail (26 is a guard for previously working configured-alias behaviour).
- Neighbours
session-runner-model + model-resolver combined with model-alias: 85/85 pass. Schema package suite: 70/70 pass.
bun typecheck passes in both packages/schema and packages/core.
![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
- Model aliases now resolve only from explicitly configured string values, preventing inherited property names or non-string values from being treated as aliases.
- Invalid alias targets—including empty values, provider names with surrounding whitespace, and slash- or hash-separated segments with surrounding whitespace—are now rejected with an error.
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-25T05:22:23.329034Z |
07e7963 |
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:
d024c674-6759-48e5-926b-25c820b97fa7
Commits
-
Reviewing files that changed from the base of the PR and between 0fec462 and 07e7963.
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 ignores inherited and non-string alias entries. It also rejects empty or whitespace-padded alias targets. Tests cover prototype-member names and malformed targets.
Changes: Model alias resolution
| Layer / File(s) |
Summary |
Alias lookup and target validation packages/schema/src/model-alias.ts, packages/core/test/model-alias.test.ts |
Model, provider, and variant alias lookups now use own-property string values. Target validation rejects whitespace-padded segments. Tests cover unconfigured and configured prototype-member aliases and malformed targets. |
Priority: Normal
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
Possibly related PRs
Merge Risk: Minimal · up to 07e79
-
The alias changes appear ready to merge after normal checks.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the two main changes in the schema alias code: own-property alias lookups and rejection of padded alias targets. It matches the changeset summary and the linked issues #414 and #412, s… |
| Description check |
 |
The description follows the repository template. It links issues #414 and #412, explains the problem and solution, and lists the tests and verification steps. It does not fill in the 'Type of change' … |
| Linked Issues check |
 |
The change satisfies #414 and #412. ownAlias uses Object.hasOwn and accepts only string values for model, provider, and all five variant lookup keys. This prevents inherited prototype members from… |
| Out of Scope Changes check |
 |
The diff is limited to packages/schema/src/model-alias.ts and its focused packages/core/test/model-alias.test.ts tests. The source changes implement alias lookup and target validation required by … |
Full details: Title check
-
Explanation
The title names the two main changes in the schema alias code: own-property alias lookups and rejection of padded alias targets. It matches the changeset summary and the linked issues #414 and #412, so it is specific and accurate. It is slightly long at 75 characters, but it is clear.
Full details: Description check
-
Explanation
The description follows the repository template. It links issues #414 and #412, explains the problem and solution, and lists the tests and verification steps. It does not fill in the 'Type of change' checkboxes, the 'Screenshots / recordings' section, or the checklist items. The 'Closes #' line uses 'Fixes #' instead, which is a minor deviation. The author also does not state whether the change contains unrelated changes. These gaps are non-critical, so the description is mostly complete.
Full details: Linked Issues check
-
Explanation
The change satisfies #414 and #412. ownAlias uses Object.hasOwn and accepts only string values for model, provider, and all five variant lookup keys. This prevents inherited prototype members from being treated as aliases and preserves configured prototype-named aliases. hasPaddedSegment, provider trimming, and checkedVariantTarget reject whitespace-only and padded alias target segments. Tests 25–28 cover the required prototype-name and whitespace cases. The reported test and typecheck results support the implementation.
Full details: Out of Scope Changes check
-
Explanation
The diff is limited to packages/schema/src/model-alias.ts and its focused packages/core/test/model-alias.test.ts tests. The source changes implement alias lookup and target validation required by #414 and #412. The tests support those objectives. No unrelated production behavior or unrelated files are present.
Finishing Touches: 💡 1
-
📝 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
This was referenced Oct 25, 2026
This was referenced Nov 24, 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.
|