Skip to content

resolver: canonical family name exhausts both match steps before any alias is tried - #74

Merged
Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/alias-canonical-exhausts-both-steps
Sep 7, 2026
Merged

Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/alias-canonical-exhausts-both-steps

Conversation

@bkrabach

Copy link
Copy Markdown
Collaborator

provider: openai resolved to the ChatGPT subscription on a host with six provider-openai instances configured, the best at priority 2. Found live on the reporting host right after #71/#322 landed.

Cause

find_provider_by_type ran step 1 (match by key) for every accepted name before running step 2 (match by module type) for any. The openai instances are keyed by instance id (sol, terra, luna, …), so openai missed by key; openai-chatgpt — one instance, keyed by its bare type — hit by key and returned, before step 2 ever resolved openai through the mount plan.

"Canonical first within each step" is not "canonical first".

Fix

Each accepted name gets both steps before the next name is tried. Verified against the reporting host's real settings.yaml:

BEFORE  provider: openai -> openai-chatgpt  (provider-openai-chatgpt, priority 17)
AFTER   provider: openai -> terra           (provider-openai,         priority 2)

Priority within a module type was already honored (step 2's tie-break); this makes the family preference hold across avenues too, so the result matches what "lowest number wins" would give on this config.

Tests (601 → 603)

  • the exact production shape: instance-id-keyed canonicals + a bare-type-keyed alias → canonical wins at best priority
  • the case the alias exists for: no canonical anywhere → alias still resolves

ruff clean · 48 root tests.

… any alias

`provider: openai` resolved to the ChatGPT subscription on a host with six
provider-openai instances configured, the best at priority 2.

Cause: find_provider_by_type ran step 1 (match by key) for EVERY accepted
name before running step 2 (match by module type) for any. The openai
instances are keyed by instance id (sol, terra, luna, ...), so `openai` missed
by key; `openai-chatgpt` -- one instance, keyed by its bare type -- HIT by key
and returned, before step 2 ever resolved `openai` through the mount plan.
"Canonical first within each step" is not "canonical first".

Fix: each accepted name gets both steps before the next name is tried.
Verified against the reporting host's real settings.yaml:

    BEFORE  provider: openai -> openai-chatgpt  (provider-openai-chatgpt, priority 17)
    AFTER   provider: openai -> terra           (provider-openai,         priority 2)

Two tests: the exact production shape (instance-id-keyed canonicals + a
bare-type-keyed alias -> canonical wins at best priority), and the case the
alias exists for (no canonical anywhere -> alias still resolves). 601 -> 603.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach
Brian Krabach (bkrabach) merged commit 2f15476 into main Sep 7, 2026
7 checks passed
@bkrabach
Brian Krabach (bkrabach) deleted the fix/alias-canonical-exhausts-both-steps branch September 7, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants