e4e9eb0928becfa4e48484dde85ef5032671d582
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
96558cfde6 |
agent: Codex thread tables are written only for ids magpie can own
JsonParser (X) found [model_providers.openai_token_sharing] in
~/.codex/config.toml, written by magpie, and Codex refusing to start:
"provider auth cannot be combined with experimental_bearer_token". The
id is T3 Code's: T3 starts Codex with -c model_providers.
openai_token_sharing={..., auth={command=...}}, its threads name that
id, and putThreadTables (#1372) wrote a magpie table (name, base_url,
wire_api, experimental_bearer_token) for every provider a thread named
that config.toml lacked. Codex merges T3's -c over it, and the merged
table has both auth and a bearer token.
putThreadTables now writes a table only for a CC Switch id
(ccSwitchProvider) or an id config.toml itself once held, recorded per
Codex home in the stash (codex.filed_tables) whenever magpie reads the
file. A table an older magpie wrote for any other id, recognised by its
exact shape (four keys, name == id, wire_api responses, magpie's own
gateway key), is taken out at Sync, at Disconnect (uninstall and quit
restore) and in TakeLeftovers, unless a profile or model_provider names
it or it has sub-tables. The user's own tables, other apps' tables and
tables with any other key are left alone.
Known tradeoff: a magpie-written table for a card-named CC Switch id
that config.toml lost before this release, and magpie never recorded,
is removed once and not written again. CC Switch's own ids still are.
Run (mote): go test ./internal/agent -count=1 -timeout 45m ok (421s);
gofmt -l clean; go vet ./internal/agent for darwin, linux and windows
ok. Real codex 0.165.0 in a sandbox CODEX_HOME: magpie's stray table
plus T3's -c override reproduces the exact error; without the table
Codex loads.
Tests: TestCodexLeavesOtherAppsProviders (threads name
openai_token_sharing, custom and a relay config.toml once held: no table
for T3's id, the other two written back), TestCodexDropsStrayThreadTables
(wired and unwired; another app's table, a profile-named one and the
user's own key stay), TestCodexSyncDropsStrayThreadTable.
Broken by hand: without the threadTableFor guard and the tidy calls,
TestCodexLeavesOtherAppsProviders and TestCodexDropsStrayThreadTables
went red; without only the Disconnect tidy, TestCodexDropsStrayThreadTables
went red; without only the Sync tidy, TestCodexSyncDropsStrayThreadTable
went red.
Not tried: the TakeLeftovers tidy was not broken by hand on its own;
T3 Code itself was not run, only codex with its -c override.
|
||
|
|
4e3078ee47 |
agents: a Codex thread started on any provider table goes through magpie when reopened, not only CC Switch's
A report the owner relayed from WeChat (10-26): in Codex, with apikeyfan's gpt-6.1-sol on, an old thread failed every turn with "unexpected status 404 Not Found: Model "apikeyfan/gpt-6.1-sol" is not supported by any configured account in this group, url: https://slb.apikey.fan/responses". A new thread worked, and updating magpie didn't help. The url is Codex's own call: Codex reopens a thread on the provider it was started on, and that thread's table pointed straight at the relay (no /v1, so not a table magpie wrote), so the magpie model id went to the relay. |
||
|
|
9fbdd584ed |
codex: a thread started on a provider config.toml no longer has opens again, through magpie (#1372, obstrux: "ChatGPT 无法加载 config.toml … Model provider custom not found")
The Codex app resumes a thread on the provider it was started on, kept in
Codex's state database (app-server thread_processor.rs:
merge_persisted_resume_metadata), whatever config.toml's model_provider is
now, and loads no config for it when config.toml has no table of that id
(core config: "Model provider `{id}` not found"). CC Switch puts every
third-party thread on "custom" and rewrites config.toml whole when it
switches, so a switch to its official provider leaves those threads with no
table, and the app can't open them. magpie never removes [model_providers.custom],
but nothing put it back either.
While magpie is wired into Codex (takeTables: set, Join and Sync), each
provider a thread in state_*.sqlite names that config.toml has none of
(table, inline or dotted) gets a table pointed at magpie's gateway, as
CC Switch's own tables already are. Codex's built-in providers (openai,
ollama, lmstudio, amazon-bedrock[-runtime], ollama-chat) and magpie's own
are left out, and a provider the user has stays as it is. The table stays
when Codex steps off magpie, as magpie's own does, for the threads that
name it. Not wired, nothing is written. sessions.CodexThreadProviders reads
the distinct model_provider of the threads table, read-only.
Run:
- Real Codex 0.161 in a sandbox HOME: `codex exec` recorded a thread under
a [model_providers.custom] pointed at a fake Responses server, the table
was removed, and the app-server's thread/resume answered "failed to load
configuration: Model provider `custom` not found" (the reporter's error).
With this build's `magpie codex fakerelay/m1` (sandbox HOME, gateway on
127.0.0.1:3546), [model_providers.custom] was written to the gateway, the
same thread/resume succeeded, and a turn on it completed through magpie to
the provider (its request reached the fake). The thread kept "custom".
- TestCodexWritesTablesThreadsName (signed in and not) fails without the
call ("custom not written through magpie"), and its inline case fails
without the parsed check ("edited TOML is invalid: key inl should be a
table"); TestCodexThreadTablesOnlyWired.
- gofmt -l, go vet, GOOS=linux/windows go vet -tags nogui on agent and
sessions, GOOS=linux go build -tags nogui, GOOS=windows go build, and
go test -tags nogui ./... under a temp HOME. One full run failed
TestSetAnswersWhileDevinAndProvidersHang (internal/gui, set took 1.6s
against its 1.5s wall-clock bound; Claude only, Codex not wired, so this
code isn't on its path); it passes alone 5/5 (0.19-0.42s) and in a rerun
of gui, agent and sessions together.
|