From 6d80295d00c1b73d762d4e37ae0720bfcf1f00ee Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 27 Sep 2026 15:26:50 +0800 Subject: [PATCH] =?UTF-8?q?codex:=20a=20routing=20group=20whose=20first=20?= =?UTF-8?q?model=20is=20a=20ChatGPT=20account's=20is=20listed=20to=20a=20s?= =?UTF-8?q?igned-in=20Codex=20=E2=80=94=20it=20was=20taken=20for=20that=20?= =?UTF-8?q?account's=20model,=20which=20the=20backend=20lists=20already,?= =?UTF-8?q?=20and=20left=20out,=20so=20the=20group=20was=20missing=20from?= =?UTF-8?q?=20the=20Codex=20app's=20picker=20and=20from=20/model.=20Issue?= =?UTF-8?q?=20#100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/provider/codex_models.go | 8 ++++++-- internal/provider/group_test.go | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) 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) + } +}