Files
magpie/internal/codexcat
yetone fcae505ff7 gateway, codexcat: Codex is offered Fast on a remote magpie's model where that magpie offers its own Codex Fast, and the tier asked reaches it (#1234, PennyVibe)
remote-magpie/codex/gpt-6.1-sol had service_tiers [] in the local
/v1/codex/models while the remote's own codex/gpt-6.1-sol had Fast: the
local catalog only gave tiers to a provider added by its address
(OwnTier, Preset == ""), and the gateway sent service_tier only to one.

Now a remote magpie's /v1/models (asked with X-Magpie-Drawers) tells each
model's service_tiers as its own Codex catalog offers them
(codexcat.ServiceTiers over the same CodexCatalog/Entries as its
/v1/codex/models). The local keeps the ids (catalog.Model.Tiers ->
Entry.Tiers), codexListed hands them on for the remote's models, and
codexcat.Entries offers them with Codex's own names. The gateway sends the
tier Codex asked for to a remote magpie as it was asked (OwnTier, still
dropped and remembered if refused); the remote serves it as its own
Codex's turn. A remote from before this sends no tiers: unchanged.

Run:
- TestRemoteMagpieOffersItsTiers (gateway, the gateway as both computers
  over HTTP): fails without the codexListed change with
  `office/relay/gpt-6.1-sol offered "" ..., want "priority:Fast "`, and
  without the gateway change with `tier sent to the remote magpie [(none)],
  by it to its vendor [(none)]; want priority, priority`.
- TestServiceTiersGoOnToAnotherMagpie (codexcat): a ChatGPT account's
  model with Codex's own entry tells priority+ultrafast, a relay's GPT
  Fast, glm none; fails when either the own-entry branch of ServiceTiers
  or the namedTiers branch of Entries is taken out.
- gofmt -l clean; go vet -tags nogui for darwin, linux, windows on
  gateway, provider, codexcat, catalog, agent; go test -tags nogui of those
  five packages under a temp HOME: ok.
Not tried with a real ChatGPT account behind a real remote magpie.
2026-10-10 17:55:14 +08:00
..
codex, claude: a model with a window above 272K is compacted at 272K, as OpenAI's and Anthropic's own are (X: Chen — through magpie on DeepSeek flash, Codex and Claude Code both "wait" before every answer, and more the longer the task) — magpie told both agents a 1M model's whole window, so neither compacted until near 1M and every turn sent the whole conversation again: the live ledger had turns of ~550K tokens waiting 70–90s for a first token, while magpie's own time before the vendor stays under 0.2s. OpenAI runs its own 1M-capable models at 272K in Codex (context_window 272000, max_context_window 872000) and Anthropic its at 200K unless a [1m] one is picked; magpie now does the same by default. Codex's catalog gives such a model context_window 272000 and its whole window as max_context_window; Claude Code gets CLAUDE_CODE_AUTO_COMPACT_WINDOW=272000 while it runs on magpie (it compacts at the smaller of that and the model's window, a [1m] model's too), kept apart from a value the user set and taken out with magpie. Settings → Long conversations ("Compact at 272K" / "Full window", en and zh) turns it off (settings.FullContext), and both agents' lists are written again at once. In a sandbox with the owner's real accounts: Codex's /models listed group/test and group/auto-glm-5-3-flash at 272000 with max 1000000 (stepfun's 32K and 16K as they were, gpt-6-* still 272000/872000), Claude Code on deepseek/deepseek-flash[1m] answered and its /context said 16.3k / 272k, and Full window turned both back to 1M (/context 16.3k / 1m). TestClaudeCompactWindow and the extended TestCodexCatalogToolSearch fail on the old code. go vet (darwin, GOOS=windows), builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass.
2026-10-04 18:27:09 +08:00
test: every package's tests pass on Windows, and none writes outside its sandbox (the user: 把 Windows 上那几个失败的测试修掉) — on a Windows box the suite failed in most packages, and the root package hung for 25 minutes. Tests set HOME, which os.UserHomeDir ignores on Windows (it reads USERPROFILE), so they read and wrote the runner's own home; each now sets USERPROFILE beside HOME, and Devin's, Goose's, Crush's and Claude Desktop's tests set APPDATA/LOCALAPPDATA, where those keep their files there. said() read the command's output only once it returned, and a pipe holds a few KB on Windows, so magpie model --help blocked forever; it reads while the command writes. Unix permission bits (the gateway key store's 0600 too), exec bits and symlinks Windows lacks are checked only off Windows; TOML strings hold Windows paths as literal strings, JSON as marshalled ones; a URL's path is compared as one. The provider and usage packages run in a home of their own (TestMain, as the gateway's already does), since a CLI's identity kept by a refresh still going when its test ended landed in the runner's ~/.config/magpie — and on a Mac in the user's own. Two product fixes came out of it: imagemcp took a file:///C:/… root or image for the path /C:/…, which doesn't exist on Windows, and now makes a Windows path of it (a host for a UNC share); and session discovery could keep a new Cowork session hidden on Linux, where a folder's mtime is a kernel tick and its size doesn't change, so an entry added within the tick of the last listing left both as they were — a listing made within 2s of its folder's last change is read again, as git does for racy files. TestFilePath and TestRacyDirectoryListedAgain fail without the change. On Windows 11 every package passes (32 of 32) and a run of each package in a fresh home leaves nothing in home, APPDATA or LOCALAPPDATA; on Linux (WSL) and macOS go test -tags nogui ./... passes. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build pass.
2026-10-01 23:15:07 +08:00