Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
provider: the shared-list tests count Codex's own ask of the list apart (#3854)
JoeyWu-teched49d1b38e11
diff --git a/internal/provider/multiproto_dedup_test.go b/internal/provider/multiproto_dedup_test.goindex 13daab1a3..5520449c2 100644--- a/internal/provider/multiproto_dedup_test.go+++ b/internal/provider/multiproto_dedup_test.go@@ -110,8 +110,14 @@ func TestFetchAsksOneListOnceForTwoBasesOfIt(t *testing.T) {asked := map[string]int{}srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {w.Header().Set("Content-Type", "application/json")+ k := r.URL.Path+ if r.URL.Query().Has("client_version") {+ // Codex's own ask of the Responses list (codexEntries),+ // a request of its own+ k += "?client_version"+ }mu.Lock()- asked[r.URL.Path]+++ asked[k]++mu.Unlock()if r.URL.Path != "/v1/models" {http.NotFound(w, r)@@ -144,7 +150,8 @@ func TestFetchAsksOneListOnceForTwoBasesOfIt(t *testing.T) {}mu.Unlock()// and the same base as Chat and Responses is one list too, the one- // case the base string already covered+ // case the base string already covered; Codex's own ask of the+ // Responses list is counted apart (#3854)if err := Save(Provider{ID: "one", Name: "One", Chat: srv.URL + "/v1", Responses: srv.URL + "/v1", Key: "sk-p"}); err != nil {t.Fatal(err)}@@ -163,6 +170,9 @@ func TestFetchAsksOneListOnceForTwoBasesOfIt(t *testing.T) {if asked["/v1/models"] != 1 {t.Errorf("chat and responses fetched the list %d times, want once", asked["/v1/models"])}+ if n := asked["/v1/models?client_version"]; n > 1 {+ t.Errorf("the list asked as Codex asks %d times, want once at most", n)+ }}// What a base's list refused is reported once (#1006). Chat and Responsesdiff --git a/internal/provider/multiproto_models_test.go b/internal/provider/multiproto_models_test.goindex 88f0e519b..584e8bf71 100644--- a/internal/provider/multiproto_models_test.go+++ b/internal/provider/multiproto_models_test.go@@ -111,7 +111,8 @@ func TestFetchUnionsProtocolLists(t *testing.T) {// The order the protocols are asked in must not decide which models are// kept: a provider with a Responses base and an Anthropic base and no Chat-// one is asked both.+// one is asked both, each list once. Codex's own ask of the Responses+// list (codexEntries) is counted apart (#3854).func TestFetchUnionsProtocolListsWithoutChat(t *testing.T) {isolate(t)h := t.TempDir()@@ -124,13 +125,17 @@ func TestFetchUnionsProtocolListsWithoutChat(t *testing.T) {t.Setenv(v, "")}- var responsesHits, anthropicHits atomic.Int32+ var responsesHits, responsesCodexHits, anthropicHits atomic.Int32responses := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {if r.URL.Path != "/v1/models" {http.NotFound(w, r)return}- responsesHits.Add(1)+ if r.URL.Query().Has("client_version") {+ responsesCodexHits.Add(1)+ } else {+ responsesHits.Add(1)+ }w.Write([]byte(`{"data":[{"id":"gpt-a"}]}`))}))defer responses.Close()@@ -167,6 +172,9 @@ func TestFetchUnionsProtocolListsWithoutChat(t *testing.T) {if responsesHits.Load() != 1 || anthropicHits.Load() != 1 {t.Errorf("asked responses %d times, anthropic %d", responsesHits.Load(), anthropicHits.Load())}+ if responsesCodexHits.Load() > 1 {+ t.Errorf("asked responses as Codex asks %d times, want once at most", responsesCodexHits.Load())+ }}// One model in two lists is one model: its image capability is merged the@@ -283,7 +291,9 @@ func TestFetchAsksOneProtocolOnce(t *testing.T) {}// Chat and Responses at one base ask it once, as they did when the first-// answer ended the fetch.+// answer ended the fetch. Codex's own ask of the Responses list+// (codexEntries, with client_version) is a request of its own, once a+// fetch for a provider added by its address, and is counted apart (#3854).func TestFetchAsksASharedBaseOnce(t *testing.T) {isolate(t)h := t.TempDir()@@ -296,13 +306,17 @@ func TestFetchAsksASharedBaseOnce(t *testing.T) {t.Setenv(v, "")}- var hits atomic.Int32+ var hits, codexHits atomic.Int32shared := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {if r.URL.Path != "/v1/models" {http.NotFound(w, r)return}- hits.Add(1)+ if r.URL.Query().Has("client_version") {+ codexHits.Add(1)+ } else {+ hits.Add(1)+ }w.Write([]byte(`{"data":[{"id":"gpt-a"}]}`))}))defer shared.Close()@@ -326,6 +340,9 @@ func TestFetchAsksASharedBaseOnce(t *testing.T) {if hits.Load() != 1 {t.Errorf("asked %d times, want once", hits.Load())}+ if codexHits.Load() > 1 {+ t.Errorf("asked as Codex asks %d times, want once at most", codexHits.Load())+ }}// Where no protocol answers, the error is the one it was: every base asked