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): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring · Issue #412 · developing-today-forks/opencode

fix(schema): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring #412

New issue
Copy link
New issue
Copy link
Closed
#415
Closed
fix(schema): ModelAlias whitespace-only alias targets yield blank provider/model/variant segments instead of erroring#412
#415
Copy link
Labels
app/schemaPackage: schema (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)

Description

@dezren39
dezren39
opened on Oct 25, 2026
Issue body actions

Summary

In ModelAlias.resolveRef (packages/schema/src/model-alias.ts), alias targets are validated only against the empty string, / and #. A whitespace-only (or whitespace-padded) target segment passes every check and becomes the provider, model or variant of the resolved ref — producing refs whose segments are blank spaces, which the no-alias parser rejects for the equivalent input.

Evidence (verified on main d0ba1110fb, the #410 merge)

Probe (bun, importing packages/schema/src/model-alias.ts directly):

resolve({ providers: { x: " " } }, "x/model")                 => " /model"              // provider is a single space
resolve({ models: { "openai/pro": " " } }, "openai/pro")      => "openai/ "             // model is a single space
resolve({ models: { "openai/pro": "  " } }, "openai/pro")     => "openai/  "            // model is two spaces
resolve({ models: { bad: "openai/ " } }, "bad")               => "openai/ "             // global target, model is a space
resolve({ models: { bad: " /gpt-4o" } }, "bad")               => " /gpt-4o"             // global target, provider is a space
resolve({ variants: { hi: " " } }, "openai/gpt-4o#hi")        => "openai/gpt-4o# "      // variant is a single space
resolve({ variants: { hi: "\t" } }, "openai/gpt-4o#hi")       => "openai/gpt-4o#\t"     // variant is a tab
resolve({ models: { bad: "openai/gpt-4o " } }, "bad")         => "openai/gpt-4o "       // trailing space kept in model id

Why it happens:

  • The initial input is trimmed (const trimmed = input.trim()), but alias targets substituted into current mid-loop are never trimmed or re-checked for whitespace.
  • Provider-alias validation (Rule 2) rejects only !providerAlias || includes("/") || includes("#") — " " passes.
  • Variant validation after resolveVariant rejects only !finalVariant || includes("#") — " " / "\t" pass.
  • The settled-ref check rejects only slashIdx <= 0 || slashIdx === settledBase.length - 1 — a model consisting solely of spaces has non-zero length, so it passes.

Contrast with the no-alias path: resolve(undefined, "openai/ ") throws (the input trim turns it into openai/), and resolve(undefined, " /gpt-4o") throws (trimmed to /gpt-4o). The alias path is therefore more permissive than the plain parser for the same final ref — the same class of divergence closed for empty/# targets in #398, #406 and #407.

Why it matters

Alias config is user-authored; stray whitespace from editing or generated config currently produces a resolved ref with blank segments that downstream model lookup cannot match, surfacing as a confusing "model unavailable"-style failure far from the config mistake instead of an Invalid model reference error at resolution time.

Acceptance criteria

  • An alias target segment (provider name, model name, or variant name) that is whitespace-only, or that carries leading/trailing whitespace, causes resolve/resolveRef to throw Invalid model reference — for provider aliases, global and scoped model aliases, and variant aliases alike.
  • Refs whose segments are already well-formed are unchanged (packages/core/test/model-alias.test.ts existing tests all still pass).
  • New tests in packages/core/test/model-alias.test.ts cover at least: whitespace-only provider target, whitespace-only scoped model target, whitespace-only variant target.

Related but distinct: #411 (empty scoped model alias target silently ignored — the truthiness-guard counterpart of this validation gap).

Single-repo: the ModelAlias resolver lives only in developing-today/opencode (packages/schema/src/model-alias.ts).

Activity

  1. dezren39
    closed this as completedin #415on Oct 25, 2026
  2. dezren39
    added a commit that references this issue on Oct 25, 2026

    docs: record the #414/#412 and #416 completions in ROADMAP Done (#419)

    954ff7c
  3. developing-today-fleet commented on Nov 24, 2026

    @developing-today-fleet
    developing-today-fleetBot
    on Nov 24, 2026 – with developing.today fleet
    More actions

    AUDIT-7 Lane 2 slice 3 — closing evidence. Verified against the issue body and merged implementation PR(s):

    • PR #415 — fix(schema): use own-property alias lookups and reject padded alias targets (merged 2026-10-25)

    The issue had zero comments in the fresh pre-action read; this comment records the missing close evidence.

  4. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    app/schemaPackage: schema (pkgs/ or apps/ in this repo)
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/schemaPackage: schema (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.