e4e9eb0928becfa4e48484dde85ef5032671d582
9
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
70ad7cf30f |
provider: an OpenAI key's GPT-6 Astra and Sol can go Ultrafast, on its Responses (OoopsHh on X)
OoopsHh on X: in Docker, an OpenAI API provider's GPT-6 Astra offered Standard and Fast only, in the model's speed, in routing groups and in the Agents settings. Every Ultrafast offer came from a Codex account's or Codex CLI's list, which a Docker magpie with an API key has none of, and buildResponses sent "ultrafast" to chatgpt.com alone. OpenAI's Ultrafast mode guide (developers.openai.com/api/docs/guides/ultrafast-mode) names GPT-6.2 Astra, GPT-6.2 Sol, GPT-6 Astra and GPT-6.1 Sol, with service_tier "ultrafast" on the Responses API. provider.OpenAIUltra holds those four (a dated snapshot too). UltraOn offers Ultrafast for them on an OpenAI key's Responses, and on a provider added by its address (OwnFast) with no Codex cache; the GUI's three speed controls read UltraOn (providers.go canUltra, groups.go ultraOK, agent route UltraOK), so no GUI asset changed. buildResponses sends the tier to api.openai.com for those models only (any other goes priority, as before). OpenAI's Chat Completions turns the tier away on every model, so a Chat request to api.openai.com that would carry it, a client's own ask too, goes priority (chatNoUltra, in the tierMate check). Another vendor's model is untouched. The Codex subscription half (Docker asked the ChatGPT list as 0.159.0, below the 0.166.0 that lists GPT-6.2 and Ultrafast) was fixed meanwhile on main by |
||
|
|
e1c186cfee |
provider: Codex's models are asked for as npm's latest Codex, never older than 0.169.1, so GPT-6.2 shows
zzstar101 and m0eaki on X: after a refresh the GPT-6.2 models never
appeared ("magpie内置的codex cli版本过低"). The ChatGPT backend lists a
model only to a client at or past its minimal_client_version, and
GPT-6.2 Sol and Astra have 0.166.0. magpie asks /models, and signs
requests, as the newest of a fixed floor (0.159.0), models_cache.json's
client_version, the installed codex CLI and a Codex seen through the
gateway. With no Codex CLI here, or one older than 0.166 (this Mac has
0.165.0), every source was older than 0.166, so the list left 6.2 out
and a request for it was refused.
- codexClientVersion goes to 0.169.1, npm's latest @openai/codex today.
- codexPublished reads npm's latest @openai/codex (source.Do, so the
mirrors answer when npm doesn't) in the background at most every 6h,
and codexVersion counts it, so the floor no longer goes stale as
Codex releases. Only an x.y.z release counts, never an alpha; a
failed read keeps the last one or the floor. A test binary never asks
npm unless a test points codexNpmLatest at a fake.
- codexListBehind already re-fetches a list asked at an older version,
so a saved list from 0.159.0 is fetched again.
The reporter's follow-up, "请求头版本太低了": the request headers
carry it too. codexSign, which every ChatGPT account's request goes
through after the client's own headers are copied (gateway.go's
codexHeader copy, then Provider.Sign; codex_backend.go's passthrough),
sets the version header and User-Agent (originator codex_cli_rs or
Codex Desktop) to the newer of codexVersion and the client's own, so an
old Codex's request goes on as 0.169.1. Every caller of codexVersion
takes it: the /models fetch
(codex_models.go, CodexLiveList), codex_entries.go's client_version,
codexSign's version header and User-Agent, account.go,
codex_device_signin.go, signin.go and test_as.go. magpie bundles no
Codex CLI of its own (Docker image included); the "built-in" version
is this floor.
Real account (the owner's ChatGPT sign-in, auth.json copied to a
sandbox HOME, token not near expiry, so no refresh; compared byte for
byte after):
- GET /models at 0.159.0 and 0.165.0: no gpt-6.2-*; at 0.166.0 to
0.171.0: gpt-6.2-sol and gpt-6.2-astra, each with
minimal_client_version 0.166.0.
- POST /responses gpt-6.2-sol: 0.159.0 answers 400 "The 'gpt-6.2-sol'
model is not supported when using Codex with a ChatGPT account."
(the reported refusal); 0.169.1 answers 200, response.completed.
- A throwaway binary of this tree calling CodexLiveList under that
HOME with no codex on PATH: old code lists no 6.2; this change lists
both. Built with the floor at 0.150.0, it started at 0.150.0 (no
GPT-6.x) and after the background npm read asked as 0.169.1 and
listed 6.2: the real registry read works.
Tests (mica-run, at this tree before rebase onto
|
||
|
|
06420a7121 |
tests: a fake program is a file macOS has already let run (testenv.Program), so a fake's first start no longer eats a test's wait under load
macOS checks a newly written executable before its first exec: 0.27s alone, 2-5s while other new programs start (a go test ./... starting its test binaries). The same file again takes 0.009s, and the pass is kept across a rename and an in-place rewrite. |
||
|
|
4183f516bf | agent, provider: a CLI whose --version fails isn't run again until it changes, and an npm CLI's version is read from its package (#864) — macOS put up 「已阻止恶意软件:未打开 "codex"」 each time magpie's window opened: the codex magpie finds was asked its version every ten minutes (the model list's client version) and again with the Agents page (a failure retried after ten minutes), and macOS stops a program XProtect flags with that alert on every start. proc.Version is the one way both ask now: an npm CLI (…/node_modules/@openai/codex/bin/codex.js) has its package.json's version read and isn't run at all; any other is run with --version, and a run that ran and said nothing, or couldn't start, isn't made again until the binary's path, size or mtime changes (a reinstall); one cut off by the timeout is. A CLI that answered is asked as before. TestCodexVersionNotRerun (a codex that exits 137 run once over three ten-minute refreshes; an npm codex's version read, not run) fails on the old code (run 3 times); TestVersionRunsOnce. TestUpdateCLI and the agent and provider tests pass. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but for TestClientGoneRecordedAsCanceled, which passes alone (-count=3). | ||
|
|
a2714f7506 | claude: a Claude account's usage resets are read in the zone /usage names on Windows too, and the provider tests pass whole on Windows (goal: 插件订阅 provider 跟内置的所有逻辑都要一模一样, run on Windows and Linux) — Windows has no time zone database, so "resets Oct 1 at 3:30pm (Asia/Shanghai)" was read in the machine's own zone, hours off for anyone not in that zone; magpie now carries the database (time/tzdata). The provider tests set HOME but not USERPROFILE, which Windows takes the home from, so on Windows they read the test box's own agent sign-ins (Gemini models in a list, an extra provider, a Cursor version); every test home sets both now. Tests whose fake CLI is a shell script (Claude Code's auth status, codex --version, macOS's security) skip on Windows, as the fake devin did, and file mode bits go unchecked there. TestParseClaudeUsage fails on Windows without the change. On Windows and on Linux (WSL) the provider package passes whole, three times on Windows (15 failed before), the plugin package and the move/plugin/Grok/Devin/usage tests five times over on Linux. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. | ||
|
|
dd12c75bff |
codex: a turn relayed through Codex accounts says it is the Codex client it came from, or newer, so a model Codex CLI reaches on its own is no longer refused through magpie (Discord, lantern2077 / TuskerManshu: gpt-6.1-sol through a routing group answered 400 "The 'gpt-6.1-sol' model is not supported when using Codex with a ChatGPT account" while Codex CLI alone could use it) — the ChatGPT backend serves a model only to a client new enough for it. Re-signing a pool turn, codexSign set User-Agent codex_cli_rs/<codexVersion()>, the newest of a constant 0.154.0, ~/.codex/models_cache.json's client_version (written by the Codex before the last update) and codex --version when codex was on PATH, ~/.local/bin or Homebrew's — nvm, mise, fnm, npm prefixes, pnpm and Volta were out of reach, above all in magpie serve — while the client's own version header was relayed: one turn saying two versions, the older in the User-Agent. Now codexSign writes one version in both, never older than the relayed one; the gateway notes the newest version a Codex client (originator or codex… User-Agent) has come with (SawCodexClient) and codexVersion, also asked by the accounts' model lists, takes it; the fallback is 0.159.0; the models cache is read from CODEX_HOME when set; codexExecutable also looks in proc.UserBinDirs() (every Node of nvm, mise and fnm, ~/.npmrc's prefix, pnpm, bun, Volta; %APPDATA%\npm and the like on Windows; codex.cmd/.exe there). Tested with TestCodexPoolSaysTheClientsVersion against a fake backend refusing gpt-6.1-sol below 0.161.0: Codex CLI 0.161.0 through the pool failed on main with codex_cli_rs/0.154.0 and passes; TestCodexVersionSeen (Claude Code's User-Agent ignored, CLI and Desktop versions read, never lowered, the model list asked with it), TestCodexVersion with CODEX_HOME, TestCodexExecutableOffPath (nvm, mise, an .npmrc prefix with PATH /usr/bin:/bin). go vet ./internal/..., go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. Not tried against the real backend: the version gating is read from the error and the models cache, not seen on the wire.
|
||
|
|
2d0058b9b9 | providers: the context window field offers its usual sizes under it, one click each — 128K, 200K, 256K, 1M — and, where models take more than they are said to, each one's own most: Codex's GPT-6 and GPT-5.6 are said to hold 272K and take 872K when asked, a size nobody remembers, so one chip sets it for every such model (#120). The most is read from max_context_window in the list ChatGPT gives and in Codex CLI's cache | ||
|
|
06997e90eb | gateway(routing groups) + gui(picker, gateway, routing) + codex: routing groups come first in the model picker under a routing icon of their own, each shown as its providers' icons stacked, and are listed first in the Gateway view's models too; a model is found to be the same under the ids its vendors give it — claude-opus-5-5 and claude-opus-5.5, dated or not — so the Claude subscription's Opus 5.5 joins its group; keys made for different protocols are pools apart, a request going round the keys that suit it before trying another's; Codex's model list is asked for as the newest Codex on the machine (codex --version) rather than the version its cache last wrote, so models only newer clients are shown — GPT-6 Sol and Luna — are listed; the Routing view keeps its providers in one order rather than reshuffling them per request; mask icons in the picker have a size to fall back on, so OpenRouter's and Copilot's show | ||
|
|
fa30d2b8ce | subscriptions: a ChatGPT account lists the Codex models of its own plan, asked from ChatGPT with its own sign-in when models are refreshed — it was Codex CLI's cache, which is of whichever account Codex CLI last asked with, or nothing if it never ran, so a Free account was offered models its plan answers with a 400 |