Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
agent: a model Codex hides but the user ticked is offered in Codex's picker
yetonec80b32c93655
diff --git a/internal/agent/codex.go b/internal/agent/codex.goindex 9a8eed793..4b6367b97 100644--- a/internal/agent/codex.go+++ b/internal/agent/codex.go@@ -1163,7 +1163,7 @@ func codexIn(at place) *Agent {if !through && (!onSignIn || codexFailover()) {return append(own, viaMagpie("codex", "")...)}- return append(own, viaMagpieFor("codex", "")...)+ return append(own, codexViaMagpieFor(own)...)}// unroute takes magpie out as the way Codex reaches its models and puts// back what the stash kept from before magpie was wired in (its@@ -2010,7 +2010,7 @@ func ownCodex() []catalog.Model {// codexInMagpie marks Served those of Codex's own models that magpie's list// shows Codex on a ChatGPT account of the user's (codex/gpt-5.5): its-// pickers leave out magpie's codex/… as only a hop (viaMagpieFor), so these+// pickers leave out magpie's codex/… as only a hop (codexViaMagpieFor), so these// are how they are offered, and the agent's own models switched off// (provider.OwnModelsHidden) never takes them out. It did once a routing// group gave the picker a catalog entry, and Codex's picker was the group@@ -2029,6 +2029,29 @@ func codexInMagpie(own []Option) []Option {return own}+// codexViaMagpieFor is viaMagpieFor("codex") keeping the models magpie+// serves on a ChatGPT account that own, Codex's own list, leaves out: one+// Codex hides from its picker (gpt-6.1-terra) but the user ticked on the+// subscription was offered nowhere (ysm119 on Discord), as the hop is all+// that reaches it.+func codexViaMagpieFor(own []Option) []Option {+ in := map[string]bool{}+ for _, o := range own {+ in[o.Value] = true+ if m := codexOwnOf(o.Value); m != "" {+ in[m] = true+ }+ }+ var out []Option+ for _, o := range viaMagpie("codex", "") {+ if strings.HasPrefix(o.Value, "codex/") && in[codexOwnOf(o.Value)] {+ continue+ }+ out = append(out, o)+ }+ return out+}+// codexOwnViaMagpie is the catalog id magpie serves one of Codex's own// models by on a ChatGPT account of the user's ("codex/gpt-5.5"), those// shown to Codex first; "" when none serves it.diff --git a/internal/agent/codex_hidden_test.go b/internal/agent/codex_hidden_test.gonew file mode 100644index 000000000..bb9f0f819--- /dev/null+++ b/internal/agent/codex_hidden_test.go@@ -0,0 +1,47 @@+package agent++import (+ "encoding/base64"+ "encoding/json"+ "os"+ "path/filepath"+ "testing"+ "time"++ "github.com/yetone/magpie/internal/provider"+)++// A model Codex hides from its own picker (gpt-6.1-terra) but the user+// ticked on the Codex subscription is still offered in Codex's picker,+// via magpie, while one Codex lists is offered once, as Codex's own+// (ysm119 on Discord: 4 ticked, 3 to pick from).+func TestCodexHiddenTickedModelOffered(t *testing.T) {+ claims := func(m map[string]any) string {+ b, _ := json.Marshal(m)+ return "h." + base64.RawURLEncoding.EncodeToString(b) + ".s"+ }+ me, _ := json.Marshal(map[string]any{"auth_mode": "chatgpt", "tokens": map[string]any{+ "id_token": claims(map[string]any{"email": "[email protected]"}),+ "access_token": claims(map[string]any{"exp": time.Now().Add(time.Hour).Unix()}),+ "refresh_token": "r", "account_id": "acct-1"}})+ home, _ := codexHome(t, string(me), "model = \"gpt-a\"\n")+ os.WriteFile(filepath.Join(home, ".codex", "models_cache.json"), []byte(`{"models":[+ {"slug":"gpt-a","display_name":"A","priority":1},+ {"slug":"gpt-h","display_name":"H","priority":2,"visibility":"hide"}]}`), 0o644)+ if err := provider.Save(provider.Provider{ID: "codex", Models: []string{"gpt-a", "gpt-h"}}); err != nil {+ t.Fatal(err)+ }+ seen := map[string]int{}+ var all []string+ for _, o := range codex(home).Fields[0].Options(nil) {+ all = append(all, o.Group+":"+o.Value)+ m := o.Value+ if own := codexOwnOf(o.Value); own != "" {+ m = own+ }+ seen[m]+++ }+ if seen["gpt-h"] != 1 || seen["gpt-a"] != 1 {+ t.Fatalf("want gpt-a and gpt-h once each: %v", all)+ }+}diff --git a/internal/agent/route.go b/internal/agent/route.goindex a198c07db..b52303fb0 100644--- a/internal/agent/route.go+++ b/internal/agent/route.go@@ -114,18 +114,6 @@ func listLabels(agent string) map[string]string {return out}-// viaMagpieFor is viaMagpie without the agent's own account: Codex CLI going-// through magpie to its own ChatGPT login would only add a hop.-func viaMagpieFor(agentID, prefix string) []Option {- var out []Option- for _, o := range viaMagpie(agentID, prefix) {- if !strings.HasPrefix(o.Value, prefix+agentID+"/") {- out = append(out, o)- }- }- return out-}-// isMagpie reports whether a model value is a catalog reference.func isMagpie(v string) bool {if pid, _, ok := strings.Cut(v, "/"); ok && dryProviders[pid] {diff --git a/internal/agent/wsl.go b/internal/agent/wsl.goindex 529fc101d..28d6f5c74 100644--- a/internal/agent/wsl.go+++ b/internal/agent/wsl.go@@ -298,7 +298,8 @@ var wslKinds = []wslKind{if codexFailover() {return append(group("OpenAI", options(ownCodex(), "")), viaMagpie("codex", "")...)}- return append(codexInMagpie(group("OpenAI", options(ownCodex(), ""))), viaMagpieFor("codex", "")...)+ own := codexInMagpie(group("OpenAI", options(ownCodex(), "")))+ return append(own, codexViaMagpieFor(own)...)}case "effort":return func(cur map[string]string) []Option {