GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@dezren39 dezren39 commented Oct 25, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

View with [code]smith Autofix with [code]smith
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
All reactions
  • 👍 1 reaction
@dezren39
fix(schema): use own-property alias lookups and reject padded alias t…
07e7963
…argets
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Review in Change Stack →

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

  • fix(schema): ModelAlias variant alias target is never validated — empty or #-containing target yields a malformed ref #406: The change adds whitespace-padded segment checks for variant alias targets, but does not address the empty-target and #-containing cases described in the issue.

Possibly related PRs

  • developing-today/opencode#410: Both changes update provider and variant target validation in ModelAlias.
  • developing-today/opencode#413: Both changes update global and scoped model alias handling in ModelAlias.
  • developing-today/opencode#390: PR #390 adds a session-runner path that sends bare alias references to the resolver changed here.
Merge Risk: Minimal · up to 07e79

The alias changes appear ready to merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed checks: 4 passed
Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 merged commit 9a132ec into main Oct 25, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the sweep/414-412-modelalias-validation branch October 25, 2026 05:25
This was referenced Oct 25, 2026
docs: ROADMAP Done table omits the #414/#412 and #416 completions (PRs #415, #417) #418
Closed
docs: record the #414/#412 and #416 completions in ROADMAP Done #419
Merged
docs: ROADMAP Done table omits the #418 completion (PR #419) #420
Closed
docs: record the #435, #436/#437 and #438 completions in ROADMAP Done #446
Merged
This was referenced Oct 25, 2026
fix(schema): reject model reference segments with internal whitespace #445
Merged
fix(schema): reject padded, empty and whitespace segments in Model.Ref.parse #459
Merged
fix(core): preserve __proto__ entries in config alias resolution #544
Merged
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
This was referenced Nov 24, 2026
fix(schema): ModelAlias alias lookups match Object.prototype members — toString/constructor names crash the #410/#413 validation with TypeError #414
Closed
fix(schema): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring #412
Closed
@dezren39 dezren39 mentioned this pull request Nov 24, 2026
AUDIT-7 Lane 2 — Closed-Issues Review (past month, since 2026-10-23) developing-today/code#13878
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

fix(schema): ModelAlias alias lookups match Object.prototype members — toString/constructor names crash the #410/#413 validation with TypeError fix(schema): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.