Files
magpie/internal/codexcat
yetone 343920464f routing: Fast keeps the provider's extra-body Ultrafast; a relay's GPT model can go Ultrafast (KoiLx0 on X)
KoiLx0 on X: with Azure or another provider that takes service_tier
"ultrafast", the group's speed toggle stopped at Fast, and they asked
whether the group's Fast overwrites {"service_tier": "ultrafast"} put
in the provider's extra request body. Before this commit it did. A member
sent fast got service_tier "priority" in its body before the extra body
was merged. A non-forced extra-body field only fills in a missing value,
so "priority" went upstream. Only "!service_tier" survived.

Precedence now:
- Member not sent fast: as before. The agent's own tier is kept, and the
  extra body's service_tier fills in when the agent sends none.
- Member sent Fast: priority. If the provider's extra body asks for
  "ultrafast", it is sent ultrafast, so Fast is never sent slower than
  the user asked of the provider. A slower extra-body tier (flex) gives
  way to the toggle, which the user set on this member.
- Member sent Ultrafast: ultrafast.
- A forced "!service_tier" in the extra body still goes over all of
  these as written.
The same holds for an agent's fast pick (same member loop).

Ultrafast on a provider the user added by its address (OwnFast): the
toggle goes on to Ultrafast for a GPT model when OpenAI offers the tier
on that model. That is known when one of Codex's accounts lists it, or
when Codex's own entry in models_cache.json for the slug does
(codexcat.OwnOffers). Codex itself is already offered the tier on such a
provider from that same entry (ownTiers). Like its Fast, Ultrafast is
only asked for. A provider that turns the field away is asked again
without it. Other vendors and OpenAI's own API are unchanged. The
Ultrafast button's tooltip on such a provider says the tier is asked of
the provider (new string in zh, zh-TW, ja, de).

Tests, red on the old code:
- TestFastMemberOwnProviderExtraTier: the outgoing body for each
  combination of group speed and extra body, from Chat, Responses and
  Anthropic agents. Old code sent "priority" for "fast + extra ultrafast"
  and for "Ultrafast".
- TestCanUltraOwnProvider: old code returned false for a relay's
  gpt-6.1-sol that Codex's entry offers Ultrafast on.
- group-member-fast.test.cjs: an own provider's member steps usual,
  Fast, Ultrafast and saves ultra; one with no Ultrafast steps back to
  usual. en/zh, Chromium and WebKit.

Docs: gateway-routing.md (a group member's speed) and
providers-accounts.md (Extra body) say the precedence and the
Ultrafast rule.

Run on mote at df2652f63 (base b0d634b85), log kept whole:
- gofmt -l internal: nothing.
- go vet (darwin) provider, gateway, codexcat, gui, agent; GOOS=linux
  and GOOS=windows go vet provider, gateway, codexcat: clean.
- go test -timeout 45m -count=1 provider (176s), gateway (1017s),
  codexcat, agent (275s), settingsapi: ok. go test -tags nogui gui: ok.
- GUI on mica, Chromium and WebKit: group-member-fast, model-speed,
  routing-service-tier, i18n-keys, i18n-en-no-cjk pass. fast-ultra is
  red the same way on b0d634b85 (extra POST /api/update/using, #6201).
- Broken by hand: the new Go tests red on the old sources (above).
Rebased onto 338eae3c2 (provider/models.go, remote groups) after
4f40a1061 (sessions, agent/codex.go, app.js, i18n.js; none
of this change's files). At that head, on mica: TestLoopGuardLeavesOrdinaryRepliesAlone (reads
the two edited docs), TestFastMemberOwnProviderExtraTier,
TestGroupMemberUltrafast and TestCanUltraOwnProvider ok; at 338eae3c2
plus this, go vet and go test of provider (143s) and codexcat, and
gateway's fast, ultra, model-tier and loop-guard tests: ok.

Not tried: a real request to Azure or a relay that serves "ultrafast";
the whole GUI suite; a Linux or Windows run beyond cross-vet.
2026-11-15 19:06:45 +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