Skip to content

fix(models): strip relay routing prefix before model-listing lookup - #620

Merged
Kyzcreig merged 1 commit into
mainfrom
fix/model-verifier-routing-prefix
Aug 20, 2026
Merged

Kyzcreig merged 1 commit into
mainfrom
fix/model-verifier-routing-prefix

Conversation

@Kyzcreig

Copy link
Copy Markdown
Collaborator

Problem

A relay/pool provider takes a model string shaped name:<sub>/<model-id> — the name:<sub>/ prefix pins which upstream subscription serves the request; only the final segment is the model id the endpoint's /v1/models listing contains.

validate_requested_model() compared the whole routed string against the listing, so a model that is listed produced a false warning:

Warning: Note: could not verify `name:claude-apx-0/claude-fable-5` against Claude APR
(api-proxy multi-sub relay) at http://127.0.0.1:18810/anthropic. The endpoint's model
listing does not include it; it may still work if the server supports hidden or aliased models.

The endpoint does list claude-fable-5, and the model resolved and ran fine — only the verification was wrong. That is the corrosive kind of bug: it trains users to ignore a warning that should mean something.

Fix

When the requested model carries the name:.../ routing prefix, look up the bare id after the final / — mirroring the existing normalize_copilot_model_id branch immediately above it. Narrow by construction: gated on the name: prefix, so bare model ids and all other providers are untouched.

Tests

tests/hermes_cli/test_model_validation.py::TestSubRoutingPrefixStripped

  • routed model present in the listing verifies silently — RED before this fix (reproduces the exact reported warning)
  • routed model absent from the listing still warns — guards the strip against degrading into a blanket accept
  • bare model id unaffected — no regression on the normal path

44 passed in the file.

A relay/pool provider takes a model string of the form `name:<sub>/<model-id>`,
where the `name:<sub>/` prefix pins WHICH upstream subscription serves the
request and only the final segment is the model id the endpoint's /v1/models
listing actually contains.

validate_requested_model() compared the whole routed string against the listing,
so a model that IS listed produced a spurious warning:

  Warning: Note: could not verify name:claude-apx-0/claude-fable-5 against
  Claude APR ... The endpoint's model listing does not include it; it may
  still work if the server supports hidden or aliased models.

The model resolved and worked fine — only the verification was wrong — which
trains users to ignore a warning that should mean something.

Fix: when the requested model carries the `name:.../` routing prefix, look up
the bare id after the final `/`, mirroring the existing copilot normalization
one branch above. Narrow by construction: gated on the `name:` prefix, so bare
model ids and every other provider are untouched.

Tests (tests/hermes_cli/test_model_validation.py::TestSubRoutingPrefixStripped):
- routed model present in the listing verifies silently (RED before this fix)
- routed model ABSENT from the listing still warns (guards against the strip
  degrading into a blanket accept)
- bare model id unaffected
44/44 in the file pass.
@Kyzcreig
Kyzcreig added this pull request to the merge queue Aug 20, 2026
Merged via the queue into main with commit ac92718 Aug 20, 2026
44 checks passed
@Kyzcreig
Kyzcreig deleted the fix/model-verifier-routing-prefix branch August 20, 2026 01: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.

1 participant