Cause: the owner's codex provider keeps picks (providers.json "models")
made while ChatGPT listed gpt-5.5. ChatGPT has since stopped listing it:
the backend's /codex/models for the Pro account (client_version 0.165.0,
asked 11-01) and the saved Plus account's list both have gpt-6.1-sol,
gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol/terra/luna
and no gpt-5.5, and Codex CLI 0.165.0's models_cache.json has none
either. ExposedOf offers a pick the vendor's list lacks as typed in by
hand, and an account's refetch never drops gone picks (dropGonePicks is
for key providers), so codex/gpt-5.5 stayed first in /v1/models. The
backend refuses any model its list leaves out: a real request for
gpt-5.5 on the Pro account answered 400 model_not_found "The 'gpt-5.5'
model is not supported when using Codex with a ChatGPT account", while
gpt-5.6-luna answered 200. Not plan-specific: Plus and Pro alike.
Fix: a ChatGPT account (listedOnly) is treated as Copilot's already is:
with its list fetched, a pick the list doesn't have is left out of what
agents are offered. The pick itself stays saved and comes back when the
list has it again. The list is the pool's (codexPoolModels), so a model
only a saved account has is still offered and routed to it
(Account.Lists).
Run (mote, at this tree on origin/main 1fac66c06):
- gofmt -l internal: clean; go vet ./internal/provider, GOOS=linux
-tags nogui and GOOS=windows: ok
- go test ./internal/provider (full): ok 131s
- go test ./internal/tui ./internal/codexcat ./internal/usageapi
./internal/cli ./internal/catalog ./internal/agent: all ok
- go test -run 'Codex|Pick|Expos|Listed|Models' ./internal/gateway
./internal/gui: ok
- Real accounts, sandbox HOME (copy of ~/.codex/auth.json and the live
providers.json and codex model lists): `magpie models` built from
origin/main lists codex/gpt-5.5 first; built from this tree it lists
only the six models the account serves.
Broken by hand: with ExposedOf's condition put back to unusable != nil,
TestCodexPickTheListDroppedNotOffered fails ("offered [gpt-5.5
gpt-6-astra gpt-6-sol]").
Not tried: the full ./... suite and the whole gateway package (mote was
at load ~290 with another session's suite running); the GUI suite; the
ChatGPT API provider (siwc), which keeps a fetched list too but was not
checked for refusing unlisted models, so it is left as it was.
95 lines
2.6 KiB
Go
95 lines
2.6 KiB
Go
package provider
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"path/filepath"
|
|
"slices"
|
|
"sync/atomic"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// #4772: the owner picked Codex's models while ChatGPT listed gpt-5.5.
|
|
// ChatGPT then stopped listing it on Plus and Pro alike, and its backend
|
|
// answers every request for it 400 "The 'gpt-5.5' model is not supported
|
|
// when using Codex with a ChatGPT account". The pick stayed, and agents
|
|
// (Cindy) were offered codex/gpt-5.5 first. A pick the account's list
|
|
// doesn't have is not offered; it comes back when the list has it again.
|
|
func TestCodexPickTheListDroppedNotOffered(t *testing.T) {
|
|
isolate(t)
|
|
home := t.TempDir()
|
|
t.Setenv("HOME", home)
|
|
t.Setenv("USERPROFILE", home)
|
|
t.Setenv("XDG_CONFIG_HOME", filepath.Join(home, ".config"))
|
|
t.Setenv("XDG_CACHE_HOME", filepath.Join(home, ".cache"))
|
|
newFetches.Lock()
|
|
newFetches.m = map[string]time.Time{}
|
|
newFetches.Unlock()
|
|
|
|
var dropped atomic.Bool
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
if r.URL.Path != "/backend-api/codex/models" {
|
|
w.WriteHeader(404)
|
|
return
|
|
}
|
|
if dropped.Load() {
|
|
// the Pro account's list on 11-01
|
|
w.Write(codexListOf("gpt-6.1-sol", "gpt-6-astra", "gpt-6-sol", "gpt-5.6-luna"))
|
|
return
|
|
}
|
|
w.Write(codexListOf("gpt-5.5", "gpt-6-astra", "gpt-6-sol", "gpt-5.6-luna"))
|
|
}))
|
|
defer srv.Close()
|
|
codexListedAt(t, srv.URL)
|
|
codexSignedIn(t, home)
|
|
|
|
offered := func() []string {
|
|
t.Helper()
|
|
p, err := Find("codex")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var out []string
|
|
for _, m := range p.ExposedOf(p.Available()) {
|
|
out = append(out, m.ID)
|
|
}
|
|
return out
|
|
}
|
|
refetch := func() {
|
|
t.Helper()
|
|
p, err := Find("codex")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, err := p.fetch(t.Context()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
forgetAccountCaches()
|
|
}
|
|
|
|
refetch()
|
|
if err := SetModels("codex", []string{"gpt-5.5", "gpt-6-astra", "gpt-6-sol"}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := offered(); !slices.Equal(got, []string{"gpt-5.5", "gpt-6-astra", "gpt-6-sol"}) {
|
|
t.Fatalf("picks while listed: %v", got)
|
|
}
|
|
|
|
dropped.Store(true)
|
|
refetch()
|
|
if got := offered(); slices.Contains(got, "gpt-5.5") || !slices.Equal(got, []string{"gpt-6-astra", "gpt-6-sol"}) {
|
|
t.Fatalf("after ChatGPT stopped listing gpt-5.5, offered %v; want gpt-6-astra and gpt-6-sol", got)
|
|
}
|
|
// the user's pick is kept, only not offered
|
|
if p, _ := Find("codex"); !slices.Contains(p.Models, "gpt-5.5") {
|
|
t.Fatalf("the pick itself was dropped: %v", p.Models)
|
|
}
|
|
|
|
dropped.Store(false)
|
|
refetch()
|
|
if got := offered(); !slices.Contains(got, "gpt-5.5") {
|
|
t.Fatalf("listed again, gpt-5.5 not offered: %v", got)
|
|
}
|
|
}
|