diff --git a/internal/provider/codex_models.go b/internal/provider/codex_models.go index fcec704e4..535c473f1 100644 --- a/internal/provider/codex_models.go +++ b/internal/provider/codex_models.go @@ -190,10 +190,14 @@ func codexFetchSaved(ctx context.Context) { // which the backend lists already. A group answers for its first member // but is not that provider's. func CodexListed() []catalog.Model { - var ms []catalog.Model shown, _ := CatalogFor("codex") + return codexListed(shown) +} + +func codexListed(shown []Entry) []catalog.Model { + var ms []catalog.Model for _, e := range shown { - if e.Provider.Account != nil && e.Provider.Account.Agent == "codex" { + if e.Group == "" && e.Provider.Account != nil && e.Provider.Account.Agent == "codex" { continue } ms = append(ms, catalog.Model{ID: e.ID, Name: e.Label(), Efforts: e.Efforts, Images: e.Images, Context: e.Context}) diff --git a/internal/provider/group_test.go b/internal/provider/group_test.go index 93fccff0d..2dcefefc4 100644 --- a/internal/provider/group_test.go +++ b/internal/provider/group_test.go @@ -66,3 +66,21 @@ func TestGroupImagesKeepUnknownMemberUnknown(t *testing.T) { t.Fatalf("group with inferred image support lost images: %+v", groups) } } + +// A group whose first member is a ChatGPT account's model is still magpie's +// to list to a signed-in Codex: the backend lists the model, not the group. +func TestCodexListedKeepsGroups(t *testing.T) { + acct := Provider{ID: "codex-me", Account: &Account{Agent: "codex"}} + ms := codexListed([]Entry{ + {ID: GroupPrefix + "fast", Model: "gpt-5.5", Name: "fast", Provider: acct, Group: "fast"}, + {ID: "codex-me/gpt-5.5", Model: "gpt-5.5", Provider: acct}, + {ID: "or/glm-5.3", Model: "glm-5.3", Provider: Provider{ID: "or"}}, + }) + var ids []string + for _, m := range ms { + ids = append(ids, m.ID) + } + if len(ids) != 2 || ids[0] != GroupPrefix+"fast" || ids[1] != "or/glm-5.3" { + t.Errorf("listed %v", ids) + } +}