ac4af582301a4e8a29245dbba767eba31334ddf9
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0d14aa4d08 |
gateway: a model the vendor lists after the codex picks were saved still reaches the desktop catalog (#5062)
What changed
- CodexNativePicked built its keep-set from p.Models, the account list
frozen at the moment the user last picked - so a model the vendor
began listing afterwards (gpt-6.1-terra, the reporter's case) was
excluded from the desktop catalog the gateway writes for Codex
Desktop's model_catalog_json, and the picker could not see it even
though the gateway's own /v1/models served it. The keep-set now comes
from p.Picks(): the picked ids stay picked, and anything the vendor
lists since is kept beside them.
Run
- TestCodexDesktopCatalogKeepsNewlyListedBesidePicks on a3768cdd1-era
product (reverted, tests kept): FAIL - the newly listed model was
dropped from the catalog; with the fix: ok. gofmt clean; vet -tags
nogui (provider+gateway) clean.
Reviewed and ported: every line read against origin/main
|
||
|
|
c9af344466 |
codex: the Codex app's model list follows the account Codex is signed in to
chzbz on X: a ChatGPT 20x (Pro) account added and switched to, and GPT-6.1 Sol never showed in the Codex app's picker; ~/.codex/magpie-desktop-models.json didn't update. The backend's list for the Codex app (CodexDesktopCatalog) was kept for an hour whatever account Codex was signed in to, and a Pro account lists models a Plus one doesn't. After a switch the sync wrote the other account's list again, for up to an hour. The kept list now names its sign-in (provider.CodexSignInWho: the account and its plan); on another one it isn't handed out, the backend is asked at once, and the file is written again once it answers. A switch made while an ask is under way is told as a change, so the next look asks about the new account. Run (mote): go test -run 'TestCodexDesktop|Revoked' ./internal/gateway ok. Broken by hand: with the sign-in check off (mine := true), TestCodexDesktopCatalogFollowsTheSignIn is red (the Plus list handed out as the Pro account's). go vet of ./internal/gateway ./internal/provider on darwin, GOOS=linux and GOOS=windows: clean. go test -count=1 ./internal/provider ./internal/gateway (mote): provider ok; gateway red only on TestCodexPoolSaysTheClientsVersion, #4807 (a newer Codex version known on mote, 0.165.0 over the test's 0.161.0), code this change doesn't touch. Not tried: a real Plus to Pro switch with the Codex app open. |
||
|
|
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
|
||
|
|
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 |