1ccacad63281094de8a3372d5a507d38f9969e5c
147
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bf0a1252fa |
codex: the chat open in the Codex app follows a provider switch (hubo31377762 on X)
Switching Codex between magpie and OpenAI left the chat that was open unusable. The Codex app holds the writer lock of every chat it has loaded, so no move touched that chat's row, and Codex 0.167 refuses to resume a chat whose provider isn't the configured one (modelProviderMismatch openai to magpie, modelProviderNotConfigured magpie to openai). Reopening it did not help. Just before magpie ends the Codex app's app-server for the route change, the held chats are now moved to the provider Codex is on: a paginated one by its row, a legacy plain rollout in place at equal id length (openai and magpie), packed legacy rollouts and other lengths left to the next sync (provider.CodexBeforeAppEnd, agent.codexRetagOpenThreads, sessions.RetagLoadedCodexThreads). The end is a clean SIGTERM and Codex writes nothing back. Run (mote-run): gofmt -l on the three packages; go vet for darwin, windows and linux with nogui over ./internal/...; go test internal/sessions, provider and agent. Real codex 0.167.1 app-server in a sandbox CODEX_HOME, both ways: no retag gives modelProviderMismatch (openai to magpie) and modelProviderNotConfigured (magpie to openai); with the row retagged and the app-server SIGTERMed, thread/resume succeeds on the new provider in both. Broken by hand: the hook call removed and the retag call emptied; both new tests go red (open chat stays on the old provider, order is [end] only). Not tried: the Codex app GUI itself, Windows runs, a packed legacy thread held open (left to the next sync). A resumed thread's sandbox falling back to config.toml's default happens with no provider change and is #6028. |
||
|
|
418bb6c9e1 |
codex: Show Codex's own models off leaves them out of Codex's own picker (iiiiiimone on X)
The switch (#1642) only narrowed the Agents page's pickers. Codex's own list, which the gateway hands it beside its sign-in and as the Codex app's list file, kept every model of the ChatGPT account, also with the Codex provider switched off. codexMerged now leaves the sign-in's visible models out when the switch is off (provider.CodexOwnLeftOut); the model Codex is set to, models magpie serves on a ChatGPT account and hidden jobs stay, and the list's ETag carries the switch so Codex asks again. Codex has one openai_base_url for every model, so one it is still set to goes through the gateway to OpenAI on its own sign-in; a model of it can't be sent direct beside magpie's models. Run: TestCodexListWithOwnModelsOff, red with the filter turned off (own models all listed, ETag unchanged); gateway, provider tests at this tree. Not tried: a real Codex app against the list. |
||
|
|
bc0d9e8739 |
agent: magpie's own Claude work folder isn't Claude Code bypassing magpie (ifccod7391564 on X)
The bridge runs Claude Code in os.TempDir()'s magpie-claude-work(-<uid>), and on the user's own home those prompts go into ~/.claude/history.jsonl too. LastUsed read them as Claude Code used with none of its requests reaching magpie, and the Agents page warned "Claude Code 最近绕过了 magpie". The owner's own history.jsonl has 1594 such lines, project /private/var/folders/.../T/magpie-claude-work-501. LastUsed now passes over lines whose project is that folder (inMagpieWork: the last path element, either slash, so a Mac's /private/var, C:/…, C:\… and a WSL mount all match; magpie-claude-workshop does not). lastJSONLTime takes a skip; Codex's history.jsonl has no project and passes nil. Run (wsl-run, magpie-desktop; mote refused SSH the whole time): - go test -count=1 -timeout 45m ./internal/provider ./internal/agent: provider ok; agent ok but TestGrokInstalled, the known WSL2 binfmt red (#3548), unrelated - TestClaudeBridgePromptsArentBypass, TestDriftBypassed on Windows: ok - cross-OS go vet as in the provider commit; gofmt -l clean Broken by hand: LastUsed with skip nil: the new test is red with the reporter's bypassed drift. Not tried: the GUI (no GUI change), the macOS run (mote down). |
||
|
|
720200092e |
agent: turn off an agent's own telemetry from its settings (OipsAnthony on X)
An agent with a documented telemetry switch has a Telemetry row in its
Settings on the Agents page (opened row and settings sheet). Off writes
that switch into the agent's own config the way magpie writes it already:
- Codex: [analytics] enabled = false in config.toml (feedback left alone)
- Claude Code: env DISABLE_TELEMETRY and DISABLE_ERROR_REPORTING = "1"
- Gemini CLI, Qwen Code: privacy.usageStatisticsEnabled = false
Nothing is written until the user turns it off. Off writes only keys the
file lacks and records them in the stash; a key the user set on refuses
Off and names it; one they set off stays, and the row says so. On takes
out only the keys magpie wrote that still hold magpie's value. An
unreadable config is unknown: the row says so and can't be pressed.
Agent.Telemetry is not a Field, so profiles never carry it and Unwire
leaves it. Only agents on this computer (no WSL distro, #3896).
POST /api/agents/telemetry/{id}; strings in zh, zh-TW, ja, de.
The row is paid for in the core budget with sixteen Agents-page comments
cut in app.js (core 1,532,840 of 1,533,802 after the rebase), no raise.
Run (mote, at this head on origin/main 1ad9d157f; vet, the three packages and agent-telemetry, i18n-keys, agent-details-ready, click-scroll again there, 98 of 98):
- go test -run Telemetry ./internal/agent, then go test -count=1
./internal/agent ./internal/gui ./internal/cli: ok
- go vet ./..., GOOS=linux -tags nogui, GOOS=windows: ok; gofmt clean
- GUI, chromium and webkit: agent-telemetry (34 pass: every language at
1100 and 640px, no scroll on click, no select, the user's own off,
a refusal, the sheet), and 104 agent-*, i18n-*, click-scroll,
settings-search, panel-agent and agent-settings files: reds only in
page-width-steady and mobile-web (red the same at origin/main
|
||
|
|
e4197144a8 |
perf: every package's package-level regexps compile on first use
v0.1.3516 made gateway's and redact's patterns lazy. The other 299 package-level regexp.MustCompile calls, in 148 files across agent, provider, gui, library, codexcat, sessions, usage, plugin and the rest, now go through lazyre.New too, so a launch that never reaches them (`magpie statusline`, run by Claude Code on every message) doesn't compile them. Fields, maps and params that held them are *lazyre.RE. Measured on mote (M5 Pro), sandbox HOME, v0.1.3516-equivalent build (t42) against this one (t43): - GODEBUG=inittrace=1 sum: 7.39 MB / 69,837 allocs -> 4.62 MB / 46,765 - `magpie statusline`, 3 runs each: instructions retired ~212M -> ~176M, peak memory footprint 19.2-19.4 MB -> 16.8-17.0 MB Run: go vet ./... (darwin) ok; GOOS=windows go vet on each of the 30 changed packages ok; GOOS=linux go vet ok except ., internal/cli and internal/gui, which stop in wails v3's cgo files when cross-compiled (the same at main). New TestAllLazyPatternsCompile at the root compiles all 574 registered patterns (ok), so a bad pattern fails a test rather than a first use. Not run before push: the changed packages' own test suites; they run on mote after it. |
||
|
|
1b078d404b |
gui: a state poll encodes into buffers kept from the last one, and Codex's own models are read without a copy
Each /api/state poll json.Marshal'd the state without its agents twice (to send it and for keepState's sum) into fresh slices, and made a new 32KB writer; ownCodex cloned Codex's whole model list for a caller that only reads it. One set of buffers and the writer is now kept between polls (an atomic slot, not a sync.Pool, which a GC between polls empties; a poll that finds it taken makes its own, and buffers over 4MB are dropped), and ownCodex reads catalog.CodexShared. Run on mote at this tree: go vet ./internal/gui ./internal/agent; go test -run "State|Settings|Allow" ./internal/gui, the same -race for StateWritten, -run "Codex|OwnCodex|Pick" ./internal/agent: ok. TestStateWrittenAsEncoded now writes big after small and small after big; with encodeTo's Reset taken out by hand it is red (a stale tail). Real accounts, 40 polls of /api/state, alloc_space: 27.8 and 26.1 MB before, 18.4 and 22.7 MB after. Not tried: Windows and Linux runs (no OS-specific code). |
||
|
|
079da3a785 |
perf: a state poll lists dsh profiles once, and skips work for Codex's models and gateway base
Each /api/state poll redid work for each agent row. That work is now done
once, or skipped:
- dsh's profile list is held for the request (dshProfilesHeld). dshModern,
Joined and dshLead each globbed profiles/*/cordis.patch.yml again.
Writers still call dshProfiles.
- CodexSignInGone reads the record first. With nothing on record for the
home, the usual case, it no longer parses auth.json and hashes the
refresh token on each look. A record that can't be read answers as
before.
- Codex's effort field reads catalog.CodexShared(), which doesn't copy.
With both lists, they are joined into one presized slice.
- codexViaMagpieFor builds one presized slice instead of two that grow
and are then joined.
- onAnotherMachine answers a plain loopback base (localhost, 127.0.0.1,
[::1], digits-only port, no user info) without url.Parse. Anything
else still goes through url.Parse.
Measured on mote with the real-account sandbox, allocations over 40
/api/state polls, two alternating pairs:
- before (
|
||
|
|
b3a57b3d8f |
codex: turning the takeover off restarts the Codex app, so its ChatGPT projects come back
Herzz____ on X, the Windows Codex app: with Codex through magpie the sidebar's project list is empty; they use magpie only when their subscription runs out, and want to switch between magpie and the native sign-in with the projects whole each way. What happens. When the ChatGPT account is used up, magpie becomes Codex's provider (codex.out) without requires_openai_auth: on that account the app's composer gate greys Send for every model, magpie's too (#540). Checked again in ChatGPT.app 26.1029's bundle: the gate picks the account's own snapshot (limitName null) whenever it is blocked, before any per-model additional_rate_limits, so keeping the account during the takeover would still grey Send. The app-server then answers account/read with no account and the app hides its ChatGPT projects and chats ( |
||
|
|
fc8e98ba47 |
edit: Codex's thousands of [projects] tables are left out of the reads that don't want them (#2278)
Codex writes a [projects."…"] table for every project it is trusted in;
the owner's config.toml has 10,933 of them in 1.5 MB. go-toml's decoder
checks each table against its siblings one at a time, so every decode
of the file cost ~0.3s of CPU, and six readers decoded it again each
time Codex wrote it, plus a whole-file check before each write magpie
made to it.
- edit.TOMLWithout drops [projects…] tables in a single unstable.Parser
pass. The agent's codexTopOf, sessions' readCodexConfig, provider's
readCodexStoreSetting, library's rtk sandbox, hooks rekey and MCP
entries read through it. None of them reads projects. A file that
doesn't parse is passed through unchanged, so it still fails.
- validateTOML checks definitions with the rest of the file and the
projects decoded apart, 128 projects to a decode. A bare [projects]
table, a dotted projects.… key outside the tables, or any error
decodes the whole file, so the error is the one it gives.
Run on mote (M5 Pro):
- BenchmarkCodexConfigDecode (10,933 projects): 283ms -> 7.6ms a decode.
- BenchmarkValidateCodexConfig: 52ms (the whole decode was 283ms).
- Startup CPU profile, first 70s, the real-account copy (the real
1,524,099-byte config.toml): 2.76s -> 2.26s of samples; go-toml
0.32s -> none sampled.
- go test ./internal/edit ./internal/sessions ./internal/provider
./internal/library ./internal/agent: all ok.
- go vet of the same five on darwin, GOOS=linux and GOOS=windows; gofmt -l clean.
Broken by hand:
- Decoding the batches into struct{} instead of a map:
TestValidateTOMLDefinitionsInGroups went red ("a key twice", "a
subtable then its key"), so the check keeps maps.
Not tried:
- the whole suite. Only the five packages that read the file were run.
- Now that projects is left out, a project table defined twice no longer
fails these readers' decode. Codex itself refuses such a file.
|
||
|
|
56f0956044 |
codex: switching Codex off gives a relay's table its own base_url back
Switching Codex off on the Agents page left a provider table of the
user's own (a relay, not CC Switch's) pointed at magpie's gateway, and
forgot the relay's URL for good. takeTables points such a table at
magpie while a Codex thread names it, and keeps its base_url in the
stash (codex.tables). bringOver then moves that thread onto magpie, so
by the Disconnect no thread names the table any more: giveTables asked
ccSwitchTables for the tables on magpie, which skips a table no thread
names, put nothing back, and dropped the stash. Codex was left on the
user's provider again, with that provider sending to 127.0.0.1:3425.
giveTables now reads each stashed table as it is and puts the URL back
where it still says magpie's; one the user changed since stays.
The report ("all of Codex's configuration was reset to defaults" after
the switch and a Codex restart) is not reproduced as such: every other
line of a full config.toml survives the Disconnect, an edit made while
connected too, in each auth and provider case. The new test is the
guard for all of it. TestCodexOffKeepsAppsOwnConfig guards the other
writer the switch sets off (agent.Rewired starts the library's Sync,
which gives Codex its MCP servers one way on magpie and another off it):
what the Codex app writes for its browser, Chrome and computer use
(plugins, marketplaces, node_repl with its env table and env_vars, a
server kept off, shell_environment_policy.set, [desktop]) stays through
on and off, node_repl imported into the library or not. It passed on the
old code too.
Run (mote, then the Linux box once mote's disk filled up): go test -run TestCodexOffKeepsUsersConfig ./internal/agent
(10 subtests: ChatGPT, API key, no auth, relay, relay + ChatGPT, each
with and without an edit while connected), go test -run Codex
./internal/agent ok 37s, go vet for darwin, linux and windows; on Linux (wsl-run) go test -run
'TestCodexOffKeepsAppsOwnConfig|TestRunCodexEntry|TestRunDirectServerIsCodexsCommand'
./internal/library and TestCodexOffKeepsUsersConfig ok, go vet for all
three systems of internal/agent and internal/library. The
config.toml each subtest leaves was loaded by the real Codex CLI
0.164.0-alpha.11.1 (codex mcp list, sandbox CODEX_HOME): all ten load
and list the user's MCP servers.
Broken by hand: the old giveTables back, the four relay subtests go red
with "lost base_url = https://relay.example.com/v1".
Not tried: the Codex app (ChatGPT.app) itself switched off and
restarted; the reporter's own config, version and OS (not known).
Reported-by: darwish4021 (Discord)
|
||
|
|
e9bde2520d |
codex: OpenAI's threads follow Codex onto magpie from a provider of the user's, and a move the budget stopped asks for the next sync (Lice9735 on X)
Lice9735 on X, Windows, magpie 0.1.3233, Codex app 26.1104: an old chat (10-13) answered "模型提供商不匹配 — 此聊天使用的是 OpenAI,但你当前 的提供商是 magpie。请切换至 OpenAI 以继续", only a new chat worked, after |
||
|
|
a9667daad5 |
codex: CC Switch's OpenAI mirror's threads follow OpenAI, and OpenAI's follow the mirror
Chris on Discord (the Codex app on a Mac): "Model provider mismatch. This chat uses OpenAI, but your current provider is OpenAI. Switch to OpenAI to continue." The Codex app names a provider by its table's name. CC Switch's OpenAI mirror ([model_providers.custom], name "OpenAI", requires_openai_auth, no base_url) is named OpenAI as the built-in openai is, and Codex up to 0.167 resumes a thread only on the provider id it is on now (app-server config_manager.rs load_for_resume and check_thread_model_provider_for_input: ModelProviderMismatch; 0.168.0-alpha drops that check). magpie left the mirror out of every thread move: bringBeside skipped it as the provider it took down, lendOwn skipped it at the top, and bringOfficial took only cc-switch-official. So a thread on the mirror stayed refused with Codex on OpenAI beside magpie, and OpenAI's threads with Codex on the mirror. Both are the ChatGPT account's threads, so they follow whichever of the two Codex is on: - bringOfficial moves every mirror table's threads to the provider Codex is on with magpie (openai or magpie), unless the mirror is at the top, a profile names it, or it is the provider magpie took down (stash codex.provider); - bringBeside takes that one, recorded, and giveBeside gives its threads back at the Disconnect that puts the mirror back on top; - lendOwn moves OpenAI's threads to a mirror at the top, and giveLent back once Codex is on OpenAI. Existing threads: each sync moves them, "custom" in place (OpenAI's length), a paginated one by its row, any age; others' ids the last 30 days with a copy kept, as before. Config.toml and the provider ids magpie writes are unchanged. Run: real codex 0.167.0 in a sandbox CODEX_HOME, `codex exec resume` of a thread on custom with Codex on openai: "This chat uses custom, but your current provider is openai" (modelProviderMismatch), resumed past the check after the relabel to openai; the reverse (custom at the top, thread on openai) refused the same way. mote (go 1.26.8): go test -count=1 ./internal/agent/ ./internal/sessions/ ok (408s, 58s); go vet ./internal/agent/ native, GOOS=windows, GOOS=linux ok; gofmt -l clean. Broken by hand: the three old exclusions back, all three new tests red (thread left on custom / on openai); bringOfficial without the stash skip, TestCodexMirrorAtTopJoinsWithItsThreads red (the mirror's thread left on openai after the Disconnect). Not tried: the Codex desktop app itself (not on any test box), and Chris's config.toml wasn't seen, so which way round his threads were is inferred from the two ids that name "OpenAI". A thread on a mirror with a profile naming it stays; after the Disconnect, OpenAI's own threads stay on OpenAI as before. Reported-by: Chris (Discord) |
||
|
|
fb4632ee0c |
agent, provider: Codex's polls and the usage quotas read what is kept
Heap profile diff of the live magpie (v0.1.2906, /v1/magpie/heap, two idle minutes with the window open: 269 MB allocated): - ownCodex found the codex provider through provider.All, a copy of every provider, on each look (~9 MB). Its picks are now kept per stamp (codexPicks, stampedLists), read only. - Codex's model and effort fields copied magpie's whole model list on each Options call, every poll of the effort field (~11 MB). They read sharedModels, the list kept, which they only read. - visibleQuotas built every provider's offered models to narrow Gemini's and Antigravity's quotas (~20 MB). exposedIDs builds the providers asked only. Run (mote, at this tree): - gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet ./internal/agent/ ./internal/provider/: clean - go test -count=1 -timeout 45m ./... (all three commits' tree): 85 packages ok, internal/gateway 748s, internal/provider 193s. Two red: internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, filed before, untouched here), and internal/agent's TestCodexEffortOptionsReadTheKeptList, whose bar counted the environment's copy (see the effort test's comment), fixed in its test. - then go test -count=1 -timeout 45m ./internal/agent/ with that fix: ok (200.1s) Broken by hand: - codexPicks through provider.Find again: 285 allocations, red (TestCodexOwnModelsFollowPicks, bar 20). - the effort field on magpieModels again: 199896 bytes a look past its StampNow's 1712, red (TestCodexEffortOptionsReadTheKeptList, bar 20000). The test takes the look's StampNow off: os.Environ copies the environment, and each t.Setenv before it in the package made that longer (an Unsetenv leaves its slot), ~56 KB a look in the whole package; run alone it is 1.7 KB. - exposedIDs without the ids check: "other" built, red (TestExposedIDsBuildsOnlyTheProvidersAsked). Not tried: the numbers on the live app after this build; that profile is taken once it is released. |
||
|
|
d2c29abe73 |
codex: a chat the Codex app had open as magpie became its provider moves once the app lets it go (crypto0xfish on Discord)
crypto0xfish on Discord, the Codex app: "Model provider mismatch. This chat uses OpenAI, but your current provider is magpie. Switch to OpenAI to continue." magpie makes itself Codex's provider (model_provider = "magpie") when Codex has no ChatGPT sign-in, is signed in with an API key, the user picks magpie API, or the ChatGPT account is used up (the takeover). bringOver then moves OpenAI's threads to magpie, a paginated one by its row (RetagPagedCodexThreads), skipping any a Codex holds open (its writer lock) or wrote to in the last minute, "for the next sync". The Codex app holds the lock of every thread it has loaded, the chat on screen among them, however long ago it was written (tried below), and nothing asked for that next sync: Sync runs on catalog changes, which can be hours away. So the chat open at the switch stayed on OpenAI; the app refuses it while loaded (app-server check_thread_model_provider_for_input compares the loaded thread's provider with config.toml at each turn), and after the app let it go it was refused again on resume by its row, until something else synced. |
||
|
|
429f9317d2 |
uninstall: Codex's base URL at magpie's gateway goes even with magpie's notes gone (#3866)
Uninstalling disconnected only the agents that read as connected. A
Codex whose config still had openai_base_url at magpie's gateway (or
model_provider = "magpie") but whose notes in magpie's folder were gone
(the folder deleted by hand, a fresh install beside an old config, a
magpie older than the notes) read as not connected, so the uninstall
left it pointing at a port nothing answers: every Codex turn then failed
with a connection error that never names magpie.
Uninstall's Agents step now ends with Codex's leftovers pass
(agent.TakeCodexLeftovers, the Agent's TakeLeftovers): the base URL goes
by viaBase()/dropBase and magpie as provider by asProvider()/dropProvider,
the same gates and drops a Disconnect uses, notes or not. Codex's own
model, its own provider and keys stay, and so does
[model_providers.magpie], which threads started on magpie name. Taking
anything shows "Codex's leftover settings" in the report and restarts
the Codex app's app-server. docs/subsystems/agent-wiring.md says so.
Not changed: deleting magpie.exe by hand runs no code, so the reporter's
Windows case is covered only through Settings > About > Uninstall magpie
or `magpie uninstall`. The pass is this machine's Codex only, like
EndCodexFailover; a WSL distro's config is left as it was. viaBase
matches any loopback port with /backend-api/codex, as Disconnect does.
Run on mote, base origin/main
|
||
|
|
1493acb468 |
gui: Codex's memories default reads right on Codex 0.167.0 and before
Codex 0.167.0 (openai/codex#58091) moved its default memory models:
extraction from gpt-5.6-luna to gpt-6-luna, consolidation from
gpt-5.6-terra to gpt-6.1-terra. The memories square's unset text and the
Settings row's tooltip named the old pair. They now say "Codex's own
memory models", true on either version, in en, zh, zh-TW, ja and de.
The code comments (agent/codex.go, gateway/codex_memory.go,
gateway/codex_follow.go, the tests' headers) name both pairs with the
Codex version that uses them. No behaviour changes: magpie routes these
calls by kind (memgen, memory_consolidation), not by the model name.
Run on mote at the pre-rebase base
|
||
|
|
1d704f8190 |
codex: OpenAI's threads follow a provider of the user's at the top, where Codex resumes them
harris on Discord (the Codex app, after switching from CC Switch): "This chat uses openai, but your current provider is custom. Switch to openai to continue." CC Switch left its "custom" as config.toml's model_provider, which magpie keeps since #4347, and Codex 0.166 resumes a thread only on the provider it is on now. Every thread started on OpenAI before was refused, and switching to OpenAI would refuse custom's threads instead, so the user was stuck. Nothing moved them: bringOver moves only onto magpie, bringBeside only from such a provider onto OpenAI. lendOwn (each Sync) moves OpenAI's threads onto that provider, as bringBeside does the other way: in place at OpenAI's length, by the row for a paginated thread, the last 30 days rewritten with a copy kept otherwise. The ids go in stash codex.lent; giveLent returns exactly those to OpenAI once Codex is on it again (CC Switch's official card), keeps the record while Codex is on that provider or on magpie, and drops it on any other. Nothing moves while a profile names openai, after the user disconnected Codex, or from a distro's Codex. TestCodexThreadsComeBackOffMagpie/by_hand expected an OpenAI thread to stay on OpenAI with custom set by hand at the top, the stuck state itself; it now expects it on custom. docs/subsystems/agent-wiring.md says so. Run (mote, go 1.26.8): go test -count=1 ./internal/agent/ ok (250s); GOOS=windows, GOOS=linux and native go vet ./internal/agent/ ok; gofmt -l clean. Broken by hand: Sync without lendOwn, TestCodexOwnProviderTakesOpenAIThreads red (thread left on "openai", rollout not on custom); without the disconnected and profile guards, TestCodexOwnProviderLeavesOpenAIThreads red for both cases. Not tried: a real Codex app resuming a moved thread on a real relay; harris's config.toml wasn't seen, so the "custom" here is CC Switch's relay table as it writes it. A thread moved from the ChatGPT backend to a relay carries its encrypted reasoning, which a relay on another account may not accept; the thread then fails on the relay as a switch to it by hand would. |
||
|
|
d620ff6b54 |
codex: an old OpenAI thread follows Codex onto magpie by its row, and back at the Disconnect (Parry_Moody, Cyrus)
Parry_Moody and Cyrus on Discord: Codex on OpenAI through an API key
before magpie, and for two days the Codex app answered every older
conversation "继续聊天未成功: This chat uses openai, but your current
provider is magpie. Switch to openai to continue."
Cause, from Codex's source (rust-v0.167.0-alpha.3.1, same in 0.166.0):
every thread Codex 0.166 starts is paginated (history_mode 'paginated'
in its state-DB row), and for those thread-store read_thread takes the
provider from the row, never the rollout ("Paginated history may contain
only a suffix, so its display metadata lives in SQLite"). The app sends
thread/resume with modelProvider null (ChatGPT.app 26.1021, Kct in
app-shared), so the row alone decides, and load_for_resume refuses a row
other than the current provider. bringOver moved threads by rewriting
files: plain ones in place, packed ones only from the last 30 days and
128 MB a sync. An older or packed OpenAI thread kept an openai row.
Now sessions.RetagPagedCodexThreads moves every paginated thread on a
provider by its row alone: any age, packed or not, an id of any length,
no file read, written or copied. Each thread is held by its writer lock
(an open one stays: its writer would write the provider back), one
written to in the last minute waits, 200 rows a transaction. It runs
after the in-place relabel in bringOver, bringBack (so a Disconnect no
longer copies a whole paginated history to the trash), bringOfficial and
bringBeside, and giveBeside by ids (RetagPagedCodexThreadIDs). Legacy
threads keep the file path. The Sessions page lists a paginated thread
on its row's provider (codexPagedProviders, memoised on the DB and WAL
stamp), so it isn't offered a Move it had.
Run:
- real codex-cli 0.166.0 (npm latest) on mote in a sandbox CODEX_HOME,
a fake Responses server: a thread started with OpenAI (API key,
openai_base_url) is paginated, row openai; with model_provider magpie
`codex exec resume` failed with exactly "This chat uses openai, but
your current provider is magpie" (modelProviderMismatch). After
magpie's RetagPagedCodexThreads on that home (a throwaway test calling
it, not committed) it resumed and answered; the rollout still names
openai. Reversed (magpie -> openai) with config back on OpenAI, it
resumed again. The first retag try moved nothing: the rollout had been
written <1 minute before, the ActiveWindow skip, as intended.
- mote: gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
for ./internal/sessions ./internal/agent; go test ./internal/sessions
./internal/agent: ok (sessions 20.1s, agent 194.4s) on mote, plus go vet on darwin, linux -tags nogui and windows
Broken by hand:
- RetagPagedCodexThreads returning nil (the old behaviour):
TestCodexPagedThreadsFollowByRow red (250 packed 90-day-old threads
"on openai, want magpie"), TestRetagPagedCodexThreads red.
- the writer-lock hold skipped: TestCodexPagedThreadsFollowByRow red,
the open thread moved to magpie.
Not tried: the Codex app GUI itself (the app goes through the same
app-server thread/resume, whose modelProvider it sends null); Windows
and Linux runs (vet only). Codex rebuilds a row from its rollout when a
search listing reconciles it, which puts a retagged thread back on its
file's provider until the next sync; not seen, read from the source.
A legacy thread packed over 30 days still waits for Sessions' Move.
|
||
|
|
681a472cab |
agent: a Codex thread started during the takeover comes back to OpenAI once it is quiet, not hours later (nb5p on Discord)
nb5p on Discord (v0.1.3001, Codex app): after Send greyed out, Retry in
Codex did nothing. The model picker and Send spun, the same dialog came
back a few seconds later, and the model field read "model unavailable".
With the ChatGPT account Codex is signed in to used up, magpie makes
itself Codex's provider (codex.out), so a turn sent then starts a thread
saved with model_provider "magpie". When the account has room again,
Sync puts Codex back on OpenAI, and its deferred bringBack moves magpie's
threads to OpenAI. It skips a thread written to in the last minute,
which is the one the user was in, and leaves it "for the next Sync".
Nothing schedules one, though: Sync runs on a catalog change, which can
be hours away. The app then can't resume that thread on the provider it
is now on ("This chat uses magpie, but your current provider is
openai", the string still in the Codex the app bundles), so each Retry
failed the same way.
bringBack now asks whether a thread is still on magpie because it was
being written to (sessions.CodexThreadsBusyOn: the state databases' rows
on magpie whose rollout changed within ActiveWindow). If one is, it asks
for one more Sync after ActiveWindow+5s. Only one wait is pending at a
time.
docs/subsystems/agent-wiring.md says so beside bringBack.
Test: TestCodexTakeoverThreadComesBackOnceQuiet. The takeover is on, and
a thread on magpie is written to now. The account comes back, and the
thread stays on magpie while it is written to. A later Sync is asked
for, and that Sync, with the thread quiet, moves it to openai. No other
Sync is asked for after that.
Broken by hand: with the bringBack hook turned off (`if false && ...`),
it fails with "no later Sync asked for" (5.3s). Restored, it passes.
Run on mote at this tree (base
|
||
|
|
8eb2193540 |
agent: Codex's own models are drawn by their names in its picker, as every other list's are (nb5p on Discord)
nb5p's screenshot of the Agents page: Codex's model picker drew each of
Codex's own models by its slug (gpt-6-astra · 经 magpie · GPT-6-Astra in
grey). Every other list in magpie, magpie's catalog included, draws the
model's name. options() gives a model its name only as the grey note;
Codex's own were the one list built straight from it, and on magpie API or
with magpie Codex's provider the label was set to the slug outright.
codexNamed gives each of Codex's own models its name (the display_name
Codex lists it by) as the label, for the picker of this machine's Codex
and of a WSL distro's (wsl.go, both of its lists), and the magpie-API
branch no longer writes the slug over it. The value is the slug, as
before: what Codex is set to and sends is unchanged (codex/gpt-… on
magpie API, gpt-… otherwise). The Codex app's own picker was not the
cause: magpie's catalog file already gives it the names.
Test: TestCodexOwnModelsNamedInPicker (beside the ChatGPT sign-in, and
magpie the provider) checks each own model is labelled by its name and
valued by its slug. TestCodexAPIKeepsMagpieOnOwnModel and
TestCodexProviderOwnModelSaysItsPath now check the name too.
Run on mote at this tree: go test ./internal/agent ok (176s); go vet for
darwin, linux -tags nogui and windows on internal/agent; go build ./...;
gofmt -l clean.
Broken by hand: codexNamed left without the label, all three tests red
("gpt-6-astra is offered as "" ... want it named "GPT-6-Astra"").
Not tried: the GUI suite (no GUI file changed; the picker already draws
a label when there is one), a real Codex in WSL.
|
||
|
|
387b386c84 |
codex: threads of the provider an older beside wiring took down move to OpenAI (yikelizi9438 on Discord)
yikelizi9438 (Windows, the Codex app): models wouldn't load, "This chat uses custom, but your current provider is openai. Switch to custom to continue", and "Model unavailable" in the composer. "custom" is CC Switch's provider id; magpie never names one so. Before #4347 ( |
||
|
|
d6e3a36ffc |
codex: threads of the provider Codex was on before magpie follow it onto magpie (hxy920830 on X)
hxy920830 on X: "magpie希望codex接入的时候自定义供应商名称,我现在名称被替换成了
magpie,原来的会话可以看到,但是加载不出来模型了". Codex had been on a
provider of the user's own (a relay's [model_providers.<id>] table, or CC
Switch's "custom"). Wired with no ChatGPT sign-in, magpie sets
model_provider = "magpie". bringOver moved only OpenAI's threads onto
magpie, so the relay's threads stayed on their provider. From Codex 0.166
(codex-rs app-server config_manager.rs load_for_resume) a thread resumes
only on the provider Codex is on now. The app lists them (thread/list
with model_providers [] lists every provider) but opening one stops at
modelProviderMismatch: "This chat uses <id>, but your current provider is
magpie". Nothing a user can set changes that, so a setting to rename the
provider wouldn't be needed. The threads should just open.
bringOver now moves the threads of the provider Codex was on before magpie
(stash codex.provider, "openai" when none was set), not only OpenAI's:
- an id of magpie's length ("custom") is relabelled in place
(RelabelCodexThreads), then packed ones from the last 30 days
(MovePackedCodexThreads), as OpenAI's already were;
- any other id ("myrelay") can't be written in place, so the threads of
the last 30 days, plain or packed, are rewritten with a copy kept in
the trash, newest first, 128 MB a sync (new
sessions.MoveRecentCodexThreads, sharing MovePackedCodexThreads' body
with packedOnly off). Older ones are left for Sessions' Move/Resume.
#887's guarantee still holds where it matters. Threads of any other
provider stay put. OpenAI's stay when Codex was on another provider. No
threads move for a provider a profile names (the user picks it with -p),
for cc-switch-official (bringOfficial handles it), or for a distro's
Codex. The Disconnect puts the user's model_provider back and bringBack
returns the threads to it, and CC Switch switching back to that provider
does the same. If Codex leaves magpie for a different provider,
bringBack hands them to that one, as it already did with OpenAI's moved
threads. profileNamed moved up so bringOver can use it.
docs/subsystems/agent-wiring.md says so.
Tests:
- TestCodexThreadsFollowMagpieIn "on a provider of the user's before"
used to assert that the custom thread stays. Now it moves to magpie in
place, with no copy, and goes back to custom at Unwire, with
model_provider custom restored.
- New subtest "on a relay's table of another length": myrelay's plain
and packed threads move with a copy kept, a 40-day-old one stays,
OpenAI's stays, and everything goes back at Unwire.
- New subtest "on a provider a profile names": the thread stays.
- New TestMoveRecentCodexThreads: newest first, a copy each, an old
thread and another provider's stay, and the packed-only move still
leaves a plain thread.
Run at this tree (on origin/main
|
||
|
|
0ee424e3ee |
codex: a thread Codex 0.166 won't resume for its provider moves with Codex (毅, AcMilan on Discord)
Codex 0.166 (openai/codex#57840) refuses to resume a thread whose saved
provider isn't the configured one: "This chat uses openai, but your
current provider is magpie. Switch to openai to continue." (毅), and
"This chat uses cc-switch-official, but your current provider is
openai" (AcMilan). The rollout's session_meta provider wins over the
state DB row, and no -c override gets past it (openai/codex#58865).
Cause on magpie's side: bringOver relabelled only plain rollouts in
place. A thread Codex had packed to .jsonl.zst (a week after its last
turn) stayed on openai, so with magpie as provider it can't resume.
cc-switch-official is the id CC Switch 3.17-3.20 gave the official
account; CC Switch 4 moves those threads back to openai itself (#7948
there), but a user who left CC Switch keeps them stranded.
- sessions.MovePackedCodexThreads: packed threads on `from` updated in
the last 30 days, newest first, up to 128 MB per sync, each moved by
the existing packed rewrite with its copy kept in the trash. Rows
are checked against the file (plain absent, .zst present, meta on
`from`, same home). A state DB without updated_at moves nothing.
- bringOver calls it after RelabelCodexThreads; bringBack already
moves packed threads back.
- bringOfficial: while magpie wires Codex and Codex is on openai or
magpie, cc-switch-official threads move there, unless the user's
top-level model_provider or a profile names cc-switch-official.
- Other providers and packed threads older than 30 days are left; the
Sessions page's Move or Resume takes them.
Run (mote, at the pushed base
|
||
|
|
247794c613 |
codex: an account that is out takes over for other models too (reverses f37742e14)
With one ChatGPT account out and nothing to serve Codex's own model on (provider.CodexServesWhileOut false), |
||
|
|
1e1068c86c |
codex: "Same as the lead" holds every subagent to the lead's model (cleverpigo on X)
cleverpigo (Windows, Codex App 26.1027.6604.0) had Codex's lead on WorkBuddy's DeepSeek-V4.1-Flash, the subagent model on what the GUI called "Same as the lead", and the Routing page still showed a subagent on gpt-5.6-sol through Codex's own sign-in. Cause: that setting, unset, never held a subagent to anything. Since |
||
|
|
f37742e14d |
agent: a used-up ChatGPT account magpie can't serve past leaves the Codex app on its sign-in (xiaoq6285)
xiaoq6285 on Discord (magpie 0.1.2798, the Windows Codex app, one ChatGPT Plus account, Codex on its own model joined beside the sign-in): at the five-hour limit the app showed an error and had to be restarted, then its account menu showed only "magpie" with no quota; at the reset it restarted by itself and the account came back. Cause. When the active account was held (used up, no credits), Sync's own-model takeover made magpie Codex's provider on codex/<model> whenever magpie's catalog listed that model on any Codex account -- the same used-up one included. With one account and no fallback every turn it took over is refused on that account anyway, while the takeover: - has account/read answer no account, so the menu drops the user, Plus and the usage meter until the reset; - changes the route twice (into it, back at the reset), and KeepCodexAppOnItsProvider ends the app's app-server each time, which ChatGPT desktop 26.1027.x shows as "ChatGPT 遇到了问题" and relaunches (#4550, still open, the app's own reaction to an ended app-server). Separately, magpie's [model_providers.magpie] requires_openai_auth follows the account out and back (openaiAuth), and codexAppRoute counted it even when that table was not Codex's model_provider, so staying beside the sign-in would still have ended the app-server at the limit and at the reset. Change. - provider.CodexServesWhileOut(model): the Codex subscription has fallbacks for codex/<model> (FallbackModels), or another ChatGPT account is not known held and not lapsed. - Sync's own-model takeover runs only when that holds. Otherwise Codex stays on its sign-in: the app keeps the account, its quota and reset, and shows its own limit message. With a fallback set it moves as before ( |
||
|
|
e02bc8c49b |
fix(agent/codex): keep the user's model_provider over a takeover or reset (#4347)
What changed: the beside wiring of a Codex takeover took the top-level model_provider down silently whenever a magpie model was picked beside the ChatGPT sign-in — a provider of the user's (CC Switch's custom, an older takeover's) went with it, and every Codex thread saved with that provider stopped resuming (modelProviderMismatch: Codex falls back to its built-in openai, the threads name the provider they were started on, #4347). The wiring now steps beside only from a provider magpie puts back itself (its own, none, CC Switch's mirror of OpenAI, as Join already has it); over a provider of the user's the takeover names magpie instead and keeps the user's spelling in the stash, for Unwire to put back, as any takeover does. A reset leaves the line where the user put it too: it takes magpie's keys out, not theirs. Run: go test -tags nogui -run 'TestCodexTakeoverKeepsUserProvider|TestCodexResetKeepsUserProvider' ./internal/agent/ (both fail on the parent, pass here); go test -tags nogui ./internal/agent/ passes. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
6712e367e8 |
agent: a look at the stash shares one read of it
Each /api/state and /api/drift poll asked the stash (stash.json) for one value hundreds of times, through Detected, Drift and the agents' wiring checks, and each ask read the file and parsed it again. In a real-account heap profile (20 rounds of drift, state and providers) stashLoad was 24-34 MB of what was allocated. stashShared reads it through filememo.Read, so every look shares one parse until the file changes, by magpie or by another process. Every read-only caller uses it now, the 24 files here and QwenPaw's unstashPeek. stashLoad, which callers change and write back, still gives each its own map, cloned from the same parse. Real use: the owner's real-account sandbox, offline (proxy to :9), 20 warm rounds of /api/drift, /api/state and /api/providers: - allocated 477 MB ( |
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
2597c96365 |
agent: Codex's config.toml is decoded once a read for a sync's own looks
A sync to Codex decoded the whole config.toml again for each thing it checked: codexMultiAgentV2On, putThreadTables, codexEnableEfforts and codexAsyncNow each ran toml.Unmarshal over the file. Codex writes a [projects."…"] table for every folder it was opened in; the owner's config is 1.5 MB with 10,932 tables, and with 10,000 such tables one sync allocated 21 MB. codexTopOf decodes only the top tables these look at (features, model_providers, desktop, profile, profiles) and keeps the result in filememo by the file's mod time and size, so a sync and the polls after it share one decode until the file changes. A missing file is an empty config, as before. TestCodexSyncDecodesTheConfigOnce: 10,000 project tables, one sync to settle, then five more; each must allocate under 12x the file and leave config.toml unwritten. Now ~5 MB a sync. Red on the old code: 51,257 KB a sync over an 868 KB file, past the 10,421 KB bound. Run at this head on mote: gofmt clean; go vet (darwin, GOOS=windows, GOOS=linux) ok; go test -timeout 45m ./internal/agent ./internal/gateway ok. |
||
|
|
2e9df9b1be |
agent: which of Codex's models magpie serves is kept while the catalog stays
codexInMagpie marks Codex's own models that magpie serves on the
user's ChatGPT account. Codex's options are asked per field of its
Drift on every drift poll, and each time it built Codex's whole
catalog (provider.CatalogFor) for these few names: 0.2 GB of the
2.6 GB a real config allocated over 20 polls.
The names are now kept in a stampedLists, as magpieModels and
viaMagpie are: built again when provider.StampNow moves, or a minute
after they were.
TestCodexServedKeptWhileCatalogStays: a signed-in account beside a
300-model relay; gpt-5.5 is marked served and the relay's model is
not, a kept answer takes under a twentieth of a build's bytes, and
the account's models picked since are followed at once. Red with the
set found each time ("a set already found took 9948425 bytes, finding
it 9954954").
Run on mote at this tree (
|
||
|
|
bec9df0888 |
sessions: a provider move leaves a thread a Codex has open (#3751)
#3751's second half; |
||
|
|
47173f593a |
sessions: a Codex thread left magpie keeps no reasoning OpenAI didn't seal
hentulong on X: after routing Codex through WorkBuddy and switching back,
Codex couldn't connect, and a fork said "Persisted response contains
hosted-tool, compaction, or unverifiable hidden reasoning state that
Rustponses cannot replay".
Cause: while Codex is routed through magpie to another vendor, the
reasoning items magpie hands it stay in the thread's rollout. After the
switch back Codex talks to chatgpt.com itself, and OpenAI refuses every
reasoning item it didn't seal. On the owner's real account:
- summary only, no encrypted_content: unsupported_persisted_item_context
(the reporter's Rustponses error) on a previous_response_id
continuation;
- with content (reasoning_text, what Codex 0.165 writes for DeepSeek via
magpie): 400 array_above_max_length "Invalid 'input[5].content'";
- foreign encrypted_content: invalid_encrypted_content.
Codex treats each as fatal, so that thread and its forks fail while new
threads work. No stale config: Unwire/EndFailover drop openai_base_url.
Fix: when Codex is no longer routed or failing over (Unwire, quit,
uninstall and the periodic pass), PortCodexRolloutsLeft rewrites, in
threads begun on openai/magpie, every reasoning item (and every one in a
compacted line's replacement_history) whose encrypted_content isn't an
OpenAI Fernet token ("gAAAA") into type "magpie_reasoning", without id
and encrypted_content. Codex reads an unknown type as Other and never
sends it; magpie's sessions readers still show it. The edit keeps member
order and line length (same fitLine/lock path as the existing port),
has its own state entry, and starts at 2026-09-21. A survey of 150 live
rollouts found 340 of 340 OpenAI reasoning items in the gAAAA shape.
Run (mote, at
|
||
|
|
a5ba5f23bd |
agent: a requires_openai_auth = false the user wrote in magpie's Codex table stays
蛋仔 on Discord wanted the Codex app wholly on magpie, with no ChatGPT
account of its own, and set requires_openai_auth = false in
[model_providers.magpie] by hand. While their ChatGPT sign-in had room,
the next Sync (authStale) set it back to true, and putProvider's
SetTOMLTable replaced the table without it. magpie only ever writes true
or nothing, so a false is the user's: openaiAuth now reports it as not
known (no rewrite, no drift), and putProvider carries it into the table
it writes.
Run (mote, at this head):
- go test ./internal/agent -count=1 (whole package, rebased on
|
||
|
|
fb2e11e288 |
agent: a Codex sign-in OpenAI refused to refresh for good counts as none (#4308)
jjt on Discord: Codex's ChatGPT sign-in was revoked, and magpie's
models were gone from Codex until they signed in again.
Cause: Codex keeps a revoked sign-in's auth.json as it was and remembers
the permanent refresh failure in memory alone (codex-rs
login/src/auth/manager.rs). magpie read auth.json alone
(codexChatGPTKnown), counted the sign-in and wired Codex beside it
(openai_base_url, requires_openai_auth). There, Codex's /models went to
the gateway, which passed OpenAI's 401 token_revoked through, so the
picker had no magpie model; and every turn, magpie's models too, failed
at Codex 0.162.1's workspace routing discovery
(/backend-api/wham/accounts/check, 401).
Change:
- provider: codexRefresh tells a refusal Codex takes as permanent
(request_chatgpt_token_refresh: refresh_token_expired, _reused or
_invalidated, a 400 invalid_grant, or a 401 - here only a 401 that
carries an error code, read as oauth/error.rs reads it). When magpie's
own refresh of Codex's sign-in (codexTokenRenewing, from the usage read
that KeepOnAnAccountWithRoom runs) is refused that way, and the store
still holds that refresh token, codex-signin-gone.json keeps the Codex
home -> sha256 of the refused refresh token (no token stored). A
successful refresh forgets it. Writes Touch the catalog so the agents
resync; the loop's noteCodexGoneNow notices a sign-in made again
elsewhere within minutes.
- agent: codexChatGPTKnown reads such a sign-in as none
(provider.CodexSignInGone), as v0.1.2087 did for forced_login_method =
"api": magpie is Codex's provider without requires_openai_auth, the
user's auth.json stays. A record that can't be read is unknown (as
magpie last wired it). Signing in again gives another refresh token,
which the record doesn't name: Sync writes requires_openai_auth back.
- gateway: codexModels doesn't pass a revoked /models answer
(provider.SignInRevoked) through: it lists Codex's cached models and
magpie's. The desk file does the same while the live list says revoked
(CodexListRevoked). Any other refusal (token_expired, 5xx) is as before.
- docs: agent-wiring and gateway-routing.
Run:
- real codex 0.162.1 (app-server over stdio, and exec) on mote, sandbox
HOME/CODEX_HOME, fake OpenAI (chatgpt_base_url,
CODEX_REFRESH_TOKEN_URL_OVERRIDE, provider.CodexBase) answering 401
token_revoked and refresh_token_invalidated; no real network.
- Old wiring beside the dead sign-in, old gateway: model/list had no
magpie model (jjt's case). With the gateway change: fake/m1 listed,
but exec -m fake/m1 fails at workspace routing discovery (401), and
account/read errors too - why the wiring change is needed.
- Uncommitted e2e in the agent package with magpie's own written
config: Set("fake/m1") wrote it beside the sign-in; magpie's
LoginUsage("codex") then heard the refresh refused, Sync rewrote it
to model_provider = "magpie", model_catalog_json, no
requires_openai_auth. account/read: {"account":null,
"requiresOpenaiAuth":false}; model/list: fake/m1 plus Codex's
models; exec -m fake/m1 answered "hi from magpie"; auth.json byte
for byte the same.
- Red on the old code (broken by hand): without the codexChatGPTKnown
check TestCodexGoneSignInIsNoChatGPT is red; without the
noteCodexSignInGone call TestCodexSignInGoneWhenRefusedForGood is red;
with codexRefreshGone true for every failure TestCodexRefreshGoneRule
is red; TestCodexModelListRevokedSignIn and
TestCodexDesktopCatalogRevokedSignIn are red on the old gateway.
Taking out the store re-check in noteCodexSignInGone leaves the tests
green: a token Codex rotated meanwhile is already held by the hash
comparison, and the re-check only saves a needless record, log line
and resync. Not guarded on its own.
- via mote-run, at this commit rebased on origin/main
|
||
|
|
f5806ed21e |
agent: Codex's forced_login_method = "api" counts as no ChatGPT sign-in (Tiger)
Tiger on Discord: after restarting Codex the Codex app showed a sign-in screen whose only option was "Sign in with an API key", and they couldn't get back in. Cause: a top-level forced_login_method = "api" in ~/.codex/config.toml. Other tools and guides write it; magpie never has (git log -S). With it, Codex won't use a ChatGPT sign-in: the TUI logs it out as it starts (codex-rs login/src/auth/manager.rs enforce_login_restrictions) and the app server reads no account (load_auth). The app takes its allowed methods from configRequirements/read, which then says ["api"]. magpie read auth.json alone (codexChatGPTKnown), counted the sign-in, and wired Codex beside it: the built-in provider, which requires OpenAI auth. The app asked for a sign-in that only an API key could give. Fix: codexChatGPTKnown reads forced_login_method = "api" as no ChatGPT sign-in. magpie is then Codex's provider without requires_openai_auth, and Codex needs no sign-in for magpie's models. The user's line stays (magpie's default never overrides the user's value). Taking it out brings the ChatGPT account back: Sync writes requires_openai_auth = true again. connectinfo's codexChatGPT gets the same answer. Run: - real codex app-server 0.162.1 on mote in sandbox CODEX_HOMEs (stdio JSON-RPC: account/read, getAuthStatus, config/read, configRequirements/read). Beside a ChatGPT sign-in with forced api: account null, requiresOpenaiAuth true, allowedLoginMethods ["api"] — Tiger's screen. magpie as the provider, no requires_openai_auth, same auth.json: requiresOpenaiAuth false, and auth.json kept. - TestCodexForcedAPILoginIsNoChatGPT is red on the old codex.go (it wrote openai_base_url and requires_openai_auth = true beside the sign-in) and green with the fix. - via mote-run: gofmt -l; go vet ./internal/agent for darwin, linux (-tags nogui) and windows; go test -timeout 45m ./internal/agent ok (150.6s); ./internal/provider ok earlier on the same codex.go change. Not tried: the real Codex app (ChatGPT.app) against a running magpie built with this; managed requirements.toml / MDM allowed_login_methods and forced_chatgpt_workspace_id, which this doesn't read; a revoked ChatGPT sign-in (jjt's report): magpie still counts its tokens as a sign-in and wires Codex beside it, and the /models 401 there comes from OpenAI, passed through. |
||
|
|
adc618bbf9 |
codex: a Codex switched off in magpie still has its held ChatGPT account read, so the Codex app sends magpie's models (sherlock_23333 on X)
sherlock_23333 on X: once the ChatGPT account Codex is signed in to ran out, the Codex app's Send stayed greyed even on a magpie model, through restarts and reconnects. The gate is the Codex app's own (ChatGPT.app 26.1021, composer gM): Send is blocked while its authMethod is chatgpt and its own /wham/usage says rate_limit.allowed false with no credits. magpie's one lever is the takeover (codex.out): magpie becomes Codex's provider without requires_openai_auth, so the app-server reports no ChatGPT account and the gate lifts. That runs only when provider.CodexUsedUp says the account is held, and CodexUsedUp read LoginUsage, which returns nothing for a provider switched off or removed in magpie (leftAlone). So a user who turned Codex off in magpie once its allowance ran out never got the takeover, and one already taken over was put back on the held account. Now, with Codex left alone, CodexUsedUp reads the active account alone (codexHoldReading) while Codex takes magpie's models beside its sign-in or magpie is its provider for the held account (Agent.HoldMatters, via the new provider.CodexHoldMatters hook). At most once a minute (the loginReading cache), with the token as Codex keeps it, never renewed or written (codexTokenAsKept); the Usage page still shows nothing of it. Codex's prompts and base_instructions are untouched. Run at |
||
|
|
4534561f6b |
codex: a thread open when magpie quits goes on through a relay, not a 503
idkatbro on X: a Codex session started while magpie was open keeps failing after magpie quits with "unexpected status 503 Service Unavailable: Unknown error, url: http://127.0.0.1:3425/backend-api/codex/responses", until magpie is opened again. Cause: Codex signed in to ChatGPT, with more of its accounts on in magpie, gets openai_base_url = the gateway's /backend-api/codex (failover). At quit EndCodexFailover takes it out of config.toml, but a thread already open, in the Codex app and its app-server above all, keeps the base URL it started with. Every turn after went to a closed port. With a system or env proxy in between, the proxy answers 503 with an empty body, which Codex shows as "Unknown error"; without one Codex says "Connection refused" and reconnects. Reproduced on mote with codex 0.162.1 and a proxy answering 503 for the closed port. Masking plays no part: it runs only in the gateway, is opt-in, and its own 503 carries a readable message. Fix: when quit really ends failover (EndCodexFailover now says so), the gateway is on loopback, and Codex processes run (provider.CodexPIDs), magpie starts a detached `magpie codex-relay` (internal/codexrelay). It waits up to 60s for the gateway's port, then passes /backend-api/codex/* on to the ChatGPT backend with the same transforms the gateway applies to Codex's own turns, signed by the caller's own Authorization; it adds no credential (gateway.CodexRelay). - Refused with a readable 400 (Codex retries a 5xx five times over): a magpie model, a turn naming one of magpie's Codex accounts, and a turn masking would have masked, which is never sent unmasked. - 403 for any Origin (null too) or a non-loopback Host, as corsGuard. - Any other path gets 503 "magpie isn't running", never readable as magpie by ServedBy. - It ends once every Codex process it was left for is gone and nothing is in flight. - The next magpie (GUI or `magpie serve`) calls codexrelay.Leave first: a POST with the token from a 0600 state file. The relay closes its listener at once, so the port is free when Leave returns, and finishes its streams (up to 30 minutes). No running turn is cut. Run (at 6df7dc287 on origin/main |
||
|
|
fae438b4a5 |
agent: Codex switched on again is joined, and its own models say where a pick goes
NancyTom18 on X: Codex on a routing group, Disconnect and restore, switched on again, then an OpenAI model picked: every OpenAI row said 直连. After a routing group again they said 经 magpie. Reproduced in a sandbox HOME (ChatGPT sign-in, a group): reconnect put the group back by Apply alone, so Codex was beside its sign-in and not joined (codex.joined went with the Disconnect). Picking one of its own models then took magpie out (set → unroute, #940): config.toml had no openai_base_url and no model_provider, so Codex went straight to OpenAI and the 直连 tags were true. Back on the group, the rows said via magpie from routed(), while a pick would again go straight to OpenAI, with no ask: that label was false. - reconnect calls Join first where the agent has one, so a Codex switched on again comes back as the switch first connects it: joined, its own models staying through magpie. - modelOptions: beside its sign-in, not joined (with ChatGPT), and failover off, Codex's own models say Direct "OpenAI", so the picker tags them 直连 and asks before a pick takes Codex off magpie. Tests: TestCodexReconnectStaysJoined (red on the old applied.go: "connected again, not joined"), TestCodexBesideOwnModelsSayDirect (red on the old codex.go: "gpt-5.5 says via"). Each fix reverted by hand, its test went red. Run on mote at this tree: go test -timeout 45m ./... all ok except internal/gui TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 red filed as #3949 (window chrome, untouched here). go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build ./..., gofmt -l clean. GUI files unchanged; agent-leave-magpie and agent-path-same pass in Chromium and WebKit (4/4 each). Not tried: a real Codex binary with a real ChatGPT sign-in sending a turn; the route is read from config.toml as Codex's own provider rules read it. A Codex already beside a group from before this release stays so: its OpenAI rows now say 直连 and ask; switching it off and on joins it. |
||
|
|
72ca3d593b |
codex: magpie as Codex's provider keeps the Codex app's ChatGPT account while it has room, so its Work chats and projects stay
Qyburn3 on X: with magpie taking Codex over, the Codex app's "Work"
sessions don't load while the model still answers; turned off, they
come back.
Cause: [model_providers.magpie] had no requires_openai_auth, so Codex's
app-server answers account/read and getAuthStatus with no account and no
token whenever magpie is Codex's provider (magpie API, or the codex.out
takeover). ChatGPT.app 26.1021 then switches to an identity of no
account: onboarding again with no name, ChatGPT mode's projects and
chats ("Work") empty, no avatar, no Chrome control (#1824).
Now putProvider writes requires_openai_auth = true while Codex has a
ChatGPT sign-in with room (openaiAuth: codexChatGPTKnown and not
codexUsedUp), and takes it out otherwise:
- API key alone: left out. With it Codex drops image_gen (captured: 11
tools without, 10 with), and there is no account to keep.
- No sign-in: left out (the app would ask for a sign-in).
- A sign-in the Codex app holds (codex.out, or magpie API while used
up): left out, since the app's composer gate (authMethod chatgpt +
allowed false, #540) would grey Send for magpie's models again. The
takeover's note now names "its ChatGPT chats and projects" among what
is off till the reset, beside Keep on ChatGPT.
- An unknown sign-in read leaves the table as it is.
Sync rewrites the key on any table that disagrees (authStale), an older
magpie's included, and the key joins codexAppRoute, so the Codex app's
app-server is restarted onto its account with nothing for the user to
do. The magpie API note no longer says Chrome control needs ChatGPT (en,
zh, zh-TW, ja, de); agent-wiring.md says why.
Real app (mote, ChatGPT.app 26.1021 with its codex 0.164.0-alpha.11,
sandbox CODEX_HOME, copied real ChatGPT auth, auth.json unchanged after):
- native config: the account's projects and recent chats listed.
- magpie table without the key: onboarding, "ChatGPT Work" with no
projects, no chats. app-server: account null, authMethod null.
- magpie table with requires_openai_auth = true (the keys this commit
writes): every project and chat back; account/read chatgpt pro,
getAuthStatus authMethod chatgpt with a token.
- Model requests to a capturing server, with and without the key:
Bearer is magpie's experimental_bearer_token, no ChatGPT-Account-ID,
15 tools both ways with a ChatGPT sign-in (image_gen kept).
Tests: TestCodexMagpieProviderKeepsChatGPTAccount (ChatGPT + magpie API,
used up and back; taken over and the reset; an older magpie's table from
live config bytes; API key and no sign-in, fresh and after ChatGPT) and
TestCodexAppRouteFollowsOpenAIAuth. Broken by hand: on the old codex.go
5 of 7 subtests red; without the Sync re-derive 3 red; with the key kept
while used up 2 red; agents.go without the route key, the route test red.
Run (mote-run, at this tree on origin/main 157d575c3; the build and the
agent run again after the rebase onto
|
||
|
|
67c8f562cd |
codex: a subagent named a model goes on it with "Same as the lead" (mengxiao on Discord)
mengxiao left Codex's subagent model at "Same as the lead" in magpie, asked the lead for a subagent on GPT-6.1 Terra, and magpie put the subagent on the lead's model anyway. The cause was codexFollowTo (internal/gateway/codex_follow.go): on the ChatGPT-sign-in path, a collab_spawn request asking for one of Codex's bare models, with nothing set in magpie or [agents] default_subagent_model, was moved onto the model the conversation's own turns go on ( |
||
|
|
f201183047 |
tune: the compact window is Long conversations, one value for both agents
7eleven (Discord #help): the Usage page's "Tuned for you" compaction
value and the agents' sheet "Long conversations" window were two values
that could disagree. Codex's tune wrote model_auto_compact_token_limit
into config.toml beside the catalog's context_window that Long
conversations writes; Claude's read its own env.
One source of truth: settings.CompactAt / FullContext. Tune's compact
row for Codex and Claude Code now has source "long": its Current is
settings.Compact(), Use calls provider.SetCompactAt (Sync writes Codex's
catalog and Claude's CLAUDE_CODE_AUTO_COMPACT_WINDOW as before), Undo
puts back the CompactAt/Full it stashed under tune.long.compact. So a
value set on either page shows on the other and writes the same config.
writeCompact marks claude.compact_long when the env value came from
settings, so Claude's row reads it as ours, not as the user's.
Migration (Codex Sync, local place): an old tune.codex.compact stash
whose limit is still the one tune wrote moves into Long conversations.
At default or Full it takes tune's value; with a value the user set it
takes tune's only when smaller. config.toml gets the user's earlier
limit back or loses the key; the stash is forgotten. A limit the user
changed after tune wrote it, or wrote themselves, stays and reads
Locked. A provider's Compact at or the user's own Claude env stays
Locked too.
Run (mote, at this tree):
- go vet on agent, provider, gui, tune; GOOS=linux go vet -tags nogui
./...; GOOS=windows go vet ./...; go build ./... and -tags nogui: ok
- go test -tags nogui ./internal/agent ./internal/provider
./internal/tune ./internal/gui: ok (TestCoreScriptBudget within the
budget, not raised; context.js is 33 bytes smaller)
- GUI: compact-one-value.test.cjs (new; Chromium and WebKit, en zh
zh-TW ja de) and context-tune: 104/104 at the rebased head
Broken by hand: the Codex long branch, the Claude long env check and
the Sync migration call each turned red TestClaudeCompactAt,
TestCodexHomeEnvTakesThePick, TestTuneCodexCompact,
TestTuneCodexOwnLimit, TestTuneCodexMigrate (4 subtests),
TestTuneClaudeLong and TestTuneCodexMigrateOnSync. Old context.js and
i18n.js turn compact-one-value red ("You set 272K").
Not run: full suite, Go or GUI (shipped at once per owner; the GUI suite
is still running on mote, reds get their own issues).
Not tried: a real Codex or Claude Code session reading the written
config; the migration on Windows/WSL places (it runs for the local
place only).
|
||
|
|
c544789047 |
agent, gui: the Codex takeover names browser use and offers Keep on ChatGPT
eddie.zhan on Discord (10-27): once Codex's allowance ran out, magpie
took it over and "many features stop working, browser use is blocked,
the agent says it has no permission".
Cause, from openai/codex 5a361b5: under the takeover magpie is Codex's
model provider without requires_openai_auth, so app-server's
getAuthStatus hands the app no auth token. The Codex app's Chrome
control needs that token, so browser use is off till the reset, with
cloud tasks, the usage meter and Log out. Image generation (actor
authorization header) and web search (provider default) stay. Bringing
requires_openai_auth back would bring back the greyed Send the takeover
exists to avoid, so it can't be kept by config.
The off switch existed (sign-in > Always ChatGPT, `magpie codex login
chatgpt`) but nothing under the takeover pointed to it. The default is
kept; the opened Codex row's takeover note now names browser use and has
a Keep on ChatGPT button (login=chatgpt) on its own line. In every
language.
Also fixed: Always ChatGPT picked while Codex was taken over on one of
its own models left model_provider = "magpie" for good. set now puts it
back on the sign-in as Join leaves it.
Run (on mote, at this tree):
- go test ./internal/agent ./internal/gui: ok except
TestWSLColdPlaceOpensNothing (#3924) and TestMainWindowCorners/macOS_26
(#2645), both red on origin/main
|
||
|
|
6c063ac1b2 |
agent: a model Codex hides joins Codex's own group in the picker
v0.1.1737 offered a model the user ticked but Codex's bundled catalog
hides (GPT-6.1 Terra) under a "Codex" section of its own, beside the
provider's group. ysm119 asked on Discord why one provider's ticked
models showed up as two groups. codexViaMagpieFor now gives such a
model the group and icon of the provider's own entries and lists it
first among them.
Run: go test -run 'Codex|WSL|Wsl|Via|Magpie' ./internal/agent ok;
go vet ./internal/agent for darwin, windows and linux (nogui) ok;
gofmt clean.
Broken by hand: with the group assignment removed,
TestCodexHiddenTickedModelOffered fails ("gpt-h in \"Codex\", gpt-a in
\"OpenAI\"").
Not tried: the GUI picker with a real Codex account.
|
||
|
|
c80b32c936 |
agent: a model Codex hides but the user ticked is offered in Codex's picker
ysm119 (Discord) ticked four models on the Codex subscription and Codex's picker offered three. GPT-6.1 Terra is "visibility": "hide" in Codex's models_cache.json, so catalog.Codex() leaves it out of Codex's own list, and viaMagpieFor dropped every codex/… entry as only a hop, so it was offered nowhere. codexViaMagpieFor now drops a codex/… entry only when Codex's own list already has its model; the rest stay, via magpie. Both pickers (live Codex and Codex in WSL) take it; viaMagpieFor had no other caller and is gone. Run: TestCodexHiddenTickedModelOffered is red with the codex/… entries dropped as before ([OpenAI:gpt-a]) and green with the fix; go test ./internal/agent -run 'Codex|WSL|Wsl|Via|Magpie' ok; go vet darwin and GOOS=windows; gofmt clean. Not tried: picking gpt-6.1-terra with a real ChatGPT account. |
||
|
|
add927e604 |
codex: the Codex app beside the ChatGPT sign-in lists magpie's models too
laddieyao (Discord #general, 10-27): with Codex joined to magpie beside its ChatGPT sign-in, the Codex desktop app's model picker showed OpenAI's GPT models alone, while the Codex CLI listed magpie's. The /models request does reach magpie's gateway and its answer holds magpie's models. ChatGPT.app 26.1013's picker then narrows app-server model/list to the models a Statsig config (107580212, use_hidden_models / available_models) names, while Codex is on its built-in provider, unless Codex reads its list from a file (model_catalog_json, hasConfiguredModelCatalog) or names a provider of its own. The CLI has no such filter. Where the Codex app is installed (codexReaders has an "app"), and only joined/beside the sign-in (not magpie as Codex's provider, not account failover alone), magpie writes the list it hands Codex at /backend-api/codex/models to ~/.codex/magpie-desktop-models.json and names it with model_catalog_json. Codex is still on its built-in provider. With a catalog named Codex asks for no list, so magpie asks the backend itself, with Codex's live sign-in (provider.CodexLiveList): its entries go in verbatim, base_instructions and all, merged as the gateway merges them (codexMerged, factored out of codexModels: picked, hidden, window, V1, AutoReview edits), magpie's models after them. - A list not known (not asked yet, or the backend failing) is unknown: the file as it was stays, never an empty list; a key naming a file that is gone goes, as Codex loads no config then. - Written via temp+rename at Join, set, settle and every Sync (so a change of magpie's models, picks or hidden models rewrites it, as SyncCatalog runs on them); the backend list is asked again hourly (5 min after a failure) and a change syncs again. - A model_catalog_json of the user's own stands; none is written beside. - magpie API, the app gone, or unwire take the key and the file out; unroute never restores the desk file as the user's catalog. - connectinfo counts the file, so a running app on an old list reads as needing a restart. - CLI-only machines: unchanged, the live /models path as before. Run: - Real account, sandbox HOME (copy of auth.json, chatgpt Pro; live ~/.codex untouched): Join wrote model_catalog_json and the file with the real backend's 10 entries (gpt-6.1-sol ... codex-auto-review, each with base_instructions) plus relay/claude-opus-5.5 and relay/claude-sonnet-4-5. Then the real app-server bundled in ChatGPT.app (codex 0.163.0-alpha.10.2, CODEX_HOME sandbox, base URL pointed at a dead port) model/list returned all 12, relay models visible, and config/read showed model_catalog_json set, which is what the app's picker checks to skip its filter. - New tests: TestCodexDesktopListBesideSignIn, ...CLIOnly, ...KeepsTheirs (internal/agent), TestCodexDesktopCatalog (internal/gateway). - Broken by hand, each went red: deskList a no-op (all three agent tests), the user's-own branch removed (KeepsTheirs), the gone-file branch removed (KeepsTheirs), the keep-last-good rule broken in codexDeskRefresh (TestCodexDesktopCatalog). - go test -tags nogui -timeout 45m ./internal/agent ./internal/gateway ./internal/provider ./internal/cli at bc0a99bb6 (on |
||
|
|
28f3c4d7fd |
codex: the Codex app's first 100 models hold the ones used, hidden ones last
@ZhenLuoTTAWDTT on X: with Codex on magpie the model list stops short, and the models past it can't be chosen. Cause, from the clients' own code: the Codex app (ChatGPT.app 26.1013.40934, app-initial-90eb42395b7d.js) and the VS Code extension (openai.chatgpt 26.51021.22027, model-queries-667cf4bd657d.js) both ask their app-server for model/list with includeHidden, cursor null and limit 100 (e?.limit??100) and never ask for nextCursor. codex-rs's list_models pages the list sorted by priority, hidden entries counted, so anything past the 100th is in no picker there. The CLI's /model (tui model_popups.rs) lists every preset in a scrolling popup and has no cap. magpie truncated nothing; its models are numbered after the account's own, so a user with many models lost everything past ~100 in the app, while hidden entries (codex-auto-review and the like) took slots at the top. Fix: codexcat.Fit ranks the list last of all, on every route magpie hands Codex a list (/backend-api/codex/models after the user's own order, /v1/codex/models before its 1 MiB cut, and the model_catalog_json file via CatalogUsed): hidden entries go after every listed one, and with more than 100 listed, the models Codex used in the last 30 days (usage.CodexUsed, most recent first, at most 100; on /v1/codex/models only the asking key's, CodexUsedBy) are brought into the first 100 in the order they stood. The rest keep their order. The list's ETag and X-Models-Etag carry a tag of the used set (codexcat.UsedTag), so Codex asks again when it uses a model it hadn't; CodexUsed is read at most once a minute, or at once when Append writes a Codex call to a model it doesn't hold. Documented in docs/subsystems/gateway-routing.md. Tests (each red on the old code, broken by hand: Fit a no-op, the gateway calls and the used tag removed, Append's codexUsedNew removed): TestFitKeepsUsedModelsWhereTheCodexAppReads, TestFitLeavesAShortListsOrder, TestCatalogUsedFits, TestUsedTagIsTheSet (codexcat), TestCodexUsed (usage), TestCodexModelListKeepsUsedModelsInTheAppsHundred and TestCodexCatalogKeepsTheKeysUsedModelsFirst (gateway). Real run: codex-cli 0.162.1's app-server in a sandbox CODEX_HOME (never ~/.codex) with a model_catalog_json of 3 hidden entries at priority 1-3 and 150 listed models, driven over stdio with the app's own request (model/list includeHidden, limit 100). Before: page 1 held 100 of 153, 3 of them hidden, the last many/model-096, nextCursor "100". The same catalog put through Fit with many/model-140 used: page 1 has no hidden entry and ends with many/model-140. The TUI's /model scrolled to all 150 (tmux). Run with this change on |
||
|
|
e7f21dba5e |
codex: Disconnect keeps an effort or model list the user set by hand after Connect
@yhwangl on X asked that putting an agent's config back never write
over what the user changed by hand after magpie took it over: only the
keys magpie changed go back, and a key magpie wrote that the user has
changed since keeps the user's value.
Codex's Disconnect put back the pre-connect model_reasoning_effort and
model_catalog_json whatever they were by then. An effort the user set
by hand to high after connecting went back to the low it was before,
and a model list of their own put in by hand was deleted.
Now:
- the effort goes back only while it is still one magpie set: the one
settle moved it to (stashed as codex.effort_set), the one picked on
the Agents page (the applied record), or none;
- dropProvider takes model_catalog_json out only when it is magpie's
list (or empty), and unroute puts the old list back only where the
key is empty;
- model_provider is put back only where the key is empty.
Other agents' fields already clear only a value still magpie's, and
put the pre-connect backup only into a field left empty.
Run, at this commit's tree (HEAD
|
||
|
|
508911e431 |
agent, gui: Codex's ChatGPT models stay in its picker with a routing group on and its own models switched off (shiqi_40904 on Discord)
shiqi_40904 on Discord: "开启路由组后,agent 设置页面-codex-模型列表里不会显示
codex 模型,关闭路由组后才会显示".
Cause: the switch "Show Codex's own models" (#1642, provider.
OwnModelsHidden) has agent.Picks drop every option of the agent's own
(no catalog Ref) from a picker that offers one of magpie's models. On a
ChatGPT sign-in, Codex's picker offers its own models and leaves out
magpie's codex/... (viaMagpieFor: only a hop), so with no routing group
it has no Ref option and the switch did nothing; a group gives it one
(group/mygpt) and the switch then took out every Codex model but the one
it was set to. The picker was Default, gpt-5.5 and the group; turned
off, the group took the Ref away and they were back. The list's switch
itself shows only while a group is on (OwnModels), so with the group off
nothing on screen said why.
Fix: Option.Served marks one of the agent's own that magpie's list shows
it too, on the account it is signed in to. Codex's own models a ChatGPT
account in magpie serves (codex/<model> in CatalogFor("codex")) are
marked so (codexInMagpie, live and WSL Codex), and agent.Own leaves them
out, so the switch never takes them out; the list's tick decides them
(one taken out there is the switch's again). With all of them served,
OwnModels is false and the list has no switch for Codex. The GUI's
filter on closing the list (closeAgentModels) keeps o.served the same
way. Codex on a relay of its own (model_provider of the user's) is
unchanged: those go straight to the relay, the switch's to take out.
Sibling check: Claude Code offers magpie's models on its own account as
catalog options (Same, with Ref), so the switch leaves them; DeepSeek
Harness's own are not served by magpie; the TUI and the tray panel take
their options from agent.Picks (server); WSL Codex's options marked too.
Reproduced first in a sandbox HOME (fake ChatGPT auth.json,
models_cache.json, catalog.SaveLive codex with 5 models, group MyGPT of
codex/gpt-5.5 + codex/gpt-5.4, own models switched off): agent.Picks
gave [gpt-5.5 group/mygpt] with the group, all five without it. Then
drove the real GUI (Handler on 127.0.0.1:3719, Playwright chromium):
Codex connected, its picker with the fix lists Default, Disconnect,
gpt-5.5, MyGPT, gpt-5.4, gpt-5.4-mini, gpt-5.3-codex, gpt-5.2; the list
shows Routing groups 1/1, Codex 5/5 and no own-models switch.
Run at this head (rebased on origin/main
|