70d50254c (v0.1.2387) took the model list out of the route the Codex
app's app-server is ended on. The effort the app saves on each pick
went into the catalog, the next sync rewrote it, and the route's hash
of the catalog changed, so the app-server was ended every few minutes
and the ChatGPT app read that as a crash (goto_nozomi on Discord,
ggbdpq on #4550). This adds two things on top of that.
- codexAppStep logs each end with what made the app-server stale:
"codex: ended the Codex app's app-server [pid] for the app to start
another: <why>". The reason is the ChatGPT account switched, the
route changed, or the used-up takeover. Before this a successful end
logged nothing, so a reported crash couldn't be put down to magpie or
to the app (ggbdpq asked for it on #4550).
- TestCodexAppRouteKeepsThroughListFlaps runs in a sandbox HOME
through SyncCatalog. A relay's list drops a model and has it back,
the catalog is re-ranked in another order with other descriptions,
and the catalog is caught half-written. Each must leave the route as
it was. 70d50254c's tests cover an effort pick and a rename.
Product call, as 70d50254c made it: a list change alone never restarts
the app-server, not even once Codex has been idle for a while. The
restart is what crashes ChatGPT when an MCP server is slow, and idle
time doesn't make it safe. The new list is read at the app's next
launch, or on the Agents row's Restart (StaleCopies). Where requests
go (model_provider, openai_base_url, the magpie table's base_url,
requires_openai_auth, the used-up takeover) still restarts it, as
TestCodexAppRouteFollowsConnectAndDisconnect and
TestCodexAppRouteFollowsOpenAIAuth hold.
Run (mote):
- go vet, GOOS=linux go vet and GOOS=windows go vet of ./internal/agent
and ./internal/provider: clean.
- go test -count=1 -timeout 45m ./internal/agent ./internal/provider on
e484b1e93: ok. Rebased onto 5cc2eea2f (dsh in internal/agent), then
go vet and go test -count=1 -timeout 45m ./internal/agent again, and
-run CodexApp ./internal/provider: ok.
- gofmt -l on both packages: nothing.
Broken by hand:
- TestCodexAppRouteKeepsThroughListFlaps at 70d50254c^ (the route
still hashed the catalog) is red three ways: a model dropped (:119),
another order (:141) and a half-written catalog (:147) each changed
the route.
- With the used-up reason taken out of codexAppStep,
TestCodexAppEndSaysWhy is red ("... start another: where Codex's
config sends it changed", want "used up").
Not tried:
- The real ChatGPT/Codex app. Nothing here changes when the app-server
is ended, only what is logged.
- The whole ./... suite and the GUI suite. Neither package touches the
GUI.
- Whether goto_nozomi's crashes stop on v0.1.2387. #4550 stays open
for them to say, with the new log line asked for if any crash is
left.