Bare model IDs ("only" mode) don't apply to auto-discovered route groups with `unlists: true`
magpie version
v0.1.4479
Where
Gateway only
OS
Windows
Agent, provider and model
Any OpenAI-compatible client → /v1/models → customized auto-discovered groups (e.g. auto-gpt-6-2-astra, auto-deepseek-v4-1-flash)
Steps to reproduce
- Settings → Gateway → "Model IDs without provider" = only
- Customize an auto-discovered route group (members, rules, classifier) and set its model list to "list only this group" (
unlists: true) GET /v1/models
What happened, and what you expected
Expected: bare IDs like gpt-6.2-astra, since requesting gpt-6.2-astra already routes to the auto group via GroupFor.
Actual: these groups still show as auto/gpt-6.2-astra, while every other model becomes bare.
Cause (from reading the source):
- Bare IDs are only derived from listed provider models;
unlistshides the members, so no bare ID gets generated. - A group's own ID only becomes bare for named groups (
Named: !g.Auto), so auto groups keep theauto/prefix.
Workaround: magpie group set <id> listed=yes works, but it also lists members whose names differ (e.g. deepseek-v4.1-flash-max), which bypass the group.
Suggestion: in "only" mode, list an auto-discovered group under its bare model ID when that ID resolves to the group, even with unlists: true.
I have a fix on a fork branch per docs/contributors.md:
- Branch / Compare: https://github.com/yetone/magpie/compare/main...eisen0419:magpie:fix/7380-bare-auto-group-unlists (
b8e06d08)
Root cause
Bare model IDs were previously derived only from listed provider rows, which unlists: true hides, while groupBare in internal/provider/bare.go only recognized user groups whose catalog ID matched group/<id>. Auto-discovered groups (including customized ones where Auto is cleared and ID is auto-<slug>) advertise auto/<model> (Group.Ref), so they were skipped even though GroupFor already routes the bare <model> to the group.
Fix
internal/provider/bare.go: addedgroupBareIDsogroupBarederives the bare<model>fromauto/<model>rows (alongside existinggroup/<id>handling) and lists it only whenbareTargetresolves that bare ID to the same row viagroupForIn(matching gatewayGroupFor). Under bare IDson,<model>is listed alongsideauto/<model>; underOnly,<model>replacesauto/<model>whileauto/<model>,group/auto-<slug>, andprovider/modelkeep routing to the group. Ifunlists: false(member row already lists the bare ID) or another group owns that bare ID, no duplicate is added and the auto group keepsauto/<model>.internal/gateway/bare_group_ids_test.go: addedTestBareIDsListUnlistedAutoGroup,TestBareIDsListAutoGroupOfUnlistedProviders, andTestBareIDsSkipAutoGroupWhoseModelAnotherGroupTakes.docs/subsystems/gateway-routing.md: updated the bare model IDs section to match.
Verification
gofmt -lclean on touched Go files;go vet ./internal/provider/... ./internal/gateway/...clean.go test -race -count=1 ./internal/provider(ok) andgo test -race -count=1 -run 'TestBare|TestGroup|TestAuto' ./internal/provider/ ./internal/gateway/(ok).- Confirmed
TestBareIDsListUnlistedAutoGroupandTestBareIDsListAutoGroupOfUnlistedProvidersfail againstorigin/mainand pass with this commit; verified Chat Completions, Responses, and Messages routing + mixed-case / colon / OpenRouter-style model names and key restrictions.