Skip to content

fix(models): 6 ModelRegistry alias and credential-resolution tests are red on dev #4582

Description

@probepark

Summary

packages/coding-agent/test/model-registry.test.ts has 6 failing tests on current dev. They are not caused by any open PR - I attributed them while reviewing #4561 and confirmed they reproduce on an unmodified base checkout.

Four cover alias/provider-selection contracts and two cover credential resolution, so provider selection is meaningfully unguarded at the moment.

Reproduction

Clean detached worktree at dev @ 2e3ccb589, fresh bun install --frozen-lockfile, natives rebuilt:

$ bun test packages/coding-agent/test/model-registry.test.ts
(fail) ModelRegistry > active provider resolution > keeps credentialless discovery active with an irrelevant dangling selector
(fail) ModelRegistry > generic local OpenAI-compatible provider config > uses stored credentials for OpenAI-compatible providers without inline auth
(fail) ModelRegistry > provider selection policy and alias resolution > alias A cannot select a sibling variant that only has alias B in the same record
(fail) ModelRegistry > provider selection policy and alias resolution > fails closed for known aliases with no eligible variants
(fail) ModelRegistry > provider selection policy and alias resolution > preserves full model and wire ids when resolving via alias
(fail) ModelRegistry > provider selection policy and alias resolution > resolves final-slash-segment aliases through canonical records

Sample failure:

packages/coding-agent/test/model-registry.test.ts:1399
expect(resolved?.provider).toBe("demo");

Expected: "demo"
Received: "github-copilot"

Why it matters

These are not cosmetic assertions:

  • fails closed for known aliases with no eligible variants - a fail-open alias resolution silently routes a request to some other provider instead of erroring. The sample failure above is exactly that shape: a fixture expecting demo resolves to github-copilot.
  • alias A cannot select a sibling variant that only has alias B in the same record - alias isolation within a record. Without it, one alias can reach a variant it was never meant to address.
  • uses stored credentials for OpenAI-compatible providers without inline auth - credential resolution for local/compatible providers.
  • keeps credentialless discovery active with an irrelevant dangling selector - discovery must not be disabled by an unrelated stale selector.

A provider-selection change landing today would not be caught by any of these.

Acceptance

  • All six pass on dev, or each one that encodes an intent the product deliberately no longer has is rewritten to the current contract with the reasoning recorded - not deleted silently.
  • If the demo -> github-copilot resolution is now correct behaviour, the alias fixtures need updating and the fail-closed assertion needs to be re-expressed against whatever the new fallback rule is, since "fails closed" and "falls back to another provider" cannot both be true.

Context

Found during exact-head review of #4561 (47da2b9b4), which introduces zero new failures - head and base both report the same 6 in the same file set. Filing separately so it is not mistaken for that PR's problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions