codex: a routing group whose first model is a ChatGPT account's is listed to a signed-in Codex — it was taken for that account's model, which the backend lists already, and left out, so the group was missing from the Codex app's picker and from /model. Issue #100

This commit is contained in:
yetone
2026-09-27 15:26:50 +08:00
parent 372bf7331b
commit 6d80295d00
2 changed files with 24 additions and 2 deletions
+6 -2
View File
@@ -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})
+18
View File
@@ -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)
}
}