CC Switch with "unify Codex session history" runs the official sign-in
as model_provider = "custom" (name OpenAI, requires_openai_auth,
supports_websockets), so failover goes on that table's base_url, not
openai_base_url. f156d9046 already gates and ends both; this pins it with
CC Switch's literal config. Run: the test, red with the proxy gate removed
and with dropMirrorFailover left out of EndFailover; CCSwitch tests green.
Muma102kMichael (Windows): after magpie took Codex over, every project
and every new chat got 502. Codex's reqwest sends its requests for
http://127.0.0.1:3425 through HTTP_PROXY/ALL_PROXY or the system's
proxy, and only an exact IP or a CIDR in NO_PROXY (on Windows, with no
NO_PROXY, the bypass list with "*." removed) keeps 127.0.0.1 off it:
"127.*" and "localhost" don't, and macOS' exceptions aren't read. A
proxy in global mode answers 502 for every request. With [features]
respect_system_proxy Codex asks the system alone and goes direct with
no proxy set there. Account failover, which magpie writes uninvited
when 2+ ChatGPT accounts are on, put all of Codex's traffic, its own
models included, behind that proxy.
- codex_proxy.go works out Codex's proxy the way Codex does and probes
GET / through it (must answer as magpie). Failover waits for that
probe and isn't written while the proxy doesn't pass Codex on; one
written before goes again.
- New drift kind "proxied": the Agents pill says Codex reaches magpie
through a proxy that doesn't pass its requests on, How to fix names
the fix (DIRECT rule for 127.0.0.0/8, NO_PROXY=127.0.0.1, or
127.0.0.1 in Windows' bypass list), and the dialog has a one-click
Disconnect from magpie (also on unreachable drift).
- Leon920717: after quitting magpie Codex kept retrying. The app that
serves the gateway now takes failover out in OnShutdown
(EndCodexFailover); the next start's Sync writes it again. A
connected Codex is kept (its model is magpie's; Disconnect restores).
A kill or crash still leaves failover in place.
- thisisvainxx: "several restarts". Codex's app-server keeps the base
URL it started with, and KeepCodexDaemonCurrent ends with magpie, so
EndCodexFailover restarts it when no codex session is on it.
Run:
- real codex-cli 0.162.1 in a sandbox CODEX_HOME against a fake 502
proxy and a fake gateway: NO_PROXY=localhost,127.* -> 30 POSTs to the
proxy; NO_PROXY=localhost -> proxy; NO_PROXY=127.0.0.1 -> gateway;
respect_system_proxy with HTTP_PROXY set -> gateway directly.
- go test -tags nogui ./internal/agent/ (full package, 465s, ok) and
the new tests after the daemon change; each new test went red with
its guarantee broken by hand (failover gate, drift, EndFailover,
daemon restart on quit).
- node --test agent-proxied/agent-unreachable/agent-failover/
agent-disconnect-preview: 104 passed, chromium + webkit, en zh zh-TW
ja de, window and panel.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui clean.
Not tried: the quit path in the real app, on the Windows box, or
whether computer use / remote connection broke for this same reason.