Commit Graph
3181 Commits
Author SHA1 Message Date
yetone 55213c1b4d agent: the Windows Codex app's version comes from its main Store package only, and agent tests never read the machine's AppX registry (#1334)
Review follow-up to 46e4107 (AwadYoo).

What:
- storeAppVersion counts only the main package (empty resource id). The
  Windows box's AppX registry key keeps a resource package that Get-AppxPackage
  no longer lists (Clipchamp.Clipchamp_4.6.10420.0_neutral_split.scale-125_…
  beside the installed 4.7.10020.0_x64__…). A stale entry like that is no sign
  the app is installed, and a newer-numbered one would win "newest".
- internal/agent's TestMain stubs windowsStorePackages, as it already does
  for nodeModulesOf and the other machine readers (#1823's rule): on a
  Windows box with the Codex app installed, tests read nothing of it.
- the doc comment for storeAppVersion had a blank line in the middle of it.
  It is joined, and windowsStorePackages has its own comment.

Run (go1.26.8, sandbox HOME, private GOCACHE):
- Windows box (Win 11 x64): installed the real Store app (winget
  9PLM9XGG6VKS, "ChatGPT", OpenAI.Codex_26.1007.2314.0_x64__2p2nqsd0c76g0).
  A probe built from origin/main printed AppVersion="" HasApp=false; built
  from this series: AppVersion="26.1007.2314.0" HasApp=true, and CLI()
  ok=true App="26.1007.2314.0" with no codex CLI on PATH.
- break checks: the resource-id filter put back to len(fields) < 3 ->
  TestCodexWindowsStoreAppVersion FAIL `Codex Store app: "27.0.0.0"`;
  AppVersion without the Store read -> FAIL `Codex Store app: ""`.
  Restored: pass on darwin and on the Windows box (test binary built with
  GOOS=windows GOARCH=amd64, run there with the real app installed).
2026-10-13 05:48:39 +08:00
尤贺雨 4697ff2324 agent: the Agents page shows the Windows Codex app's version, read from the Microsoft Store package registered for the user (#1334, laacmilan)
On Windows the Codex app is the Store package OpenAI.Codex
(C:\Program Files\WindowsApps\OpenAI.Codex_26.1002.7124.0_x64__2p2nqsd0c76g0
in the report), which magpie didn't read: only %LOCALAPPDATA%\Programs was
looked in. The version now comes from the package full names under the
current user's AppX repository key (HKCU\...\AppModel\Repository\Packages),
which needs no access to the protected WindowsApps folder and starts no
PowerShell. The newest OpenAI.Codex package with publisher id 2p2nqsd0c76g0
wins.

Test: TestCodexWindowsStoreAppVersion (picks the newest, skips a bad
version and another publisher, and a WSL twin shows none).

[Message rewritten at review to say what and why; the code is AwadYoo's. The
conflict with 2221b63f9 (macAppFolders) was resolved by keeping both.]
2026-10-13 05:48:39 +08:00
yetone bc2743f4b9 routing: a picked request goes back to live once it leaves the list, and the panel's stage has a place per provider (#1389, Creat55)
The reporter's two screenshots are the Routing window holding one
request: at 13:42 the stage still showed a 13:22 Antigravity request,
and at 15:58 it still showed a 13:42 qoder request while every request
listed went to WorkBuddy's deepseek. A request picked in the list (or
from the tray panel's row that opens the window on it) pins the stage.
followListed lets a pin go when a filter leaves it out, but poll never
did when the request dropped out of the 60 the page keeps, so the stage
stayed on it for hours. poll now lets it go and follows live.

The tray panel's mini stage (pDraw) had three places on the right, each
a provider's account. A provider whose requests went from account to
account filled all three, and the providers other sessions used were
left off. A place is now a provider, naming the account its latest try
went to, with how that went.

A request under way when the page dropped it kept its panel dot waiting
at its account until pUntil's 180 s limit, holding the dot, the place
and one of four play slots. pPlay now ends it at the next trace update,
as the window's play does through its rt(). The dot doesn't fly home
red, since nothing failed.

Run:
- routing-pin-leaves.test.cjs (new): 5 languages, 420 and 1100 wide,
  chromium and webkit. On main it fails in every case with "the stage
  stayed on the picked request".
- panel-routing-providers.test.cjs (new): 5 languages, chromium and
  webkit. On main it fails with three Qoder places. With only the pDraw
  part, it fails with "a dropped request still flies".
- All 67 routing/panel/tray-bird GUI files: 429/429 in chromium and
  428/429 in webkit. The one webkit red was routing-steady under
  --test-concurrency=4 (1.69 px), which is the known #1804. It passed
  3/3 alone and 6/6 in parallel with and without this change.
  panel-routing's stage expectations are unchanged.

Not tried: the reporter's real gateway traffic, and Windows.
2026-10-13 05:47:55 +08:00
yetone 8accabf0d9 library: an MCP server off for every agent shown isn't started when magpie opens (#1597, xiaozhu1337)
The library page checks (starts) every server it counts as in use when
it opens. inUse counted any agent id in the server's library record, and
any project entry. The library keeps the agents it once gave a server to
even when the page doesn't show them: one hidden on the Agents page, one
no longer installed, one with no MCP of its own (skills only), and
projects whose folder is gone. A server on only for those had every chip
off on the page and was still started each time, which is what the
reporter saw with ida-pro-mcp and windbg-mcp.

inUse now counts only agents the page shows with MCP (mcpAgents), and
project entries for shown agents with project MCP, in projects whose
folder is there. Such a server shows "not checked" and a click checks
it, as before. Its tooltip says no agent shown here has it on (new
string in zh, zh-TW, ja, de), and one on for nobody keeps the old text.

Siblings: inUse is the only thing that picks the servers checked on
open (renderServers and paintHealth both call it). The Go side,
library.CheckServers, checks only the names the GUI sends. The
remove-all confirmation still counts every project, which is right for
a removal.

library-mcp-health's fixture agent now declares projectMCP, since its
project-only server is meant to count as in use.

Run: new library-mcp-unshown.test.cjs (5 languages, 420 and 980,
chromium and webkit) fails on main with ida-pro-mcp, projgone,
projhidden, skillonly and windbg-mcp in the first check. With the fix,
all 34 library/MCP GUI test files pass in chromium and webkit (270
each), and go test ./internal/gui passes. Not tried: the reporter's
Windows machine; which of the hidden, uninstalled or no-MCP cases they
hit isn't confirmed.
2026-10-13 05:47:55 +08:00
yetone d13a4a1396 gui: Routing's story of a request keeps its logos as it is redrawn, so they no longer blink
The owner: in "How the request at … was routed" the provider logos "会不
停地闪烁". renderSteps made every line and logo afresh whenever the story
changed, which is on every new request and at each step of a live one,
so with an agent at work the logos were made again and again, and WebKit
draws a mask logo made afresh as nothing for a moment.

A line whose text, kind, model and logos are unchanged is now kept as it
is, and a changed line takes the logos of the lines it replaces
(keepIcons), so only what changed is made.

Run: routing-log-icons.test.cjs's new case walks a live request through
three steps (trying, 429 and trying the next, done) and checks the why
line and every logo are the same nodes after: chromium and webkit, en,
zh, zh-TW, ja, de, 14/14 with the old cases; the 10 new cases fail on
origin/main 689edbd6b. Not reproduced: the blank frame itself, which
headless WebKit didn't show; on an idle pinned request the logos'
pixels were stable before and after. Every GUI test that reads the
Routing page passes in both engines.
2026-10-13 05:44:08 +08:00
yetone 6746655a8c gui: a Library row's agent chips fan out like a hand of cards, by translate alone
The owner: hovering an MCP server's row, the agent icons came out with
"一点都不丝滑优雅精致美观,应该像翻起扑克牌一样丝滑优雅". The fan grew every
chip's margin at once while a spacer before them shrank, so the row was
laid out again on every frame and all the cards moved as one block.

The chips are now laid out fanned for good and drawn stacked by sliding
each one by translate (--k, the chips to its right, set in agentChips).
Hovering only clears translate: the compositor moves the cards, the
strip, All and the name beside them never move, and the cards are dealt
one after another (a stagger of at most 120ms in all), the one with the
furthest to go first, so none passes over another; they go back
together, quicker. Transform stays free for the press. Reduced motion
fans at once.

Run: library-chip-fan.test.cjs (new), chromium and webkit, en, zh,
zh-TW, ja, de, with and without reduced motion: 22/22; 0/22 on
origin/main 689edbd6b. It samples each frame: no relayout, no card
passing another, more than three frames in motion. It caught that the
reduced-motion rule lost to the stagger's specificity, fixed here.
Measured with the dev instance's real 26 agents at 1800px: strip, All
and name at the same places as before at rest and fanned. The library
and skill GUI tests pass in both engines, except pick-skills on WebKit,
which fails 0/3 the same on origin/main 689edbd6b (.lib-pickbar takes
the click on the pdf skill's name).
2026-10-13 05:44:08 +08:00
yetone 841af36bfc gateway: models the user disabled are refused on every route, and leave every list (#1867)
oxsean asked for one place to turn a model (claude-fable-5) off for good:
not reached by a direct request, an old session, a routing group member,
a fallback, a sub-agent, count_tokens or a decision model.

What changed:
- settings.DisabledModels: patterns, an exact id or a glob (* any run, /
  included; ? one), matched ignoring case against provider/model, the
  bare id and its last segment (provider/disabled.go). Empty by default,
  so nothing changes for anyone who doesn't set it.
- Lists: buildEntries (entriesOff) leaves a disabled model out of the
  catalog, so /v1/models, agents' model files and pickers, Codex's list
  and every group go without it; membersIn skips it as a member, Deciders
  as a decision model; codexModels drops Codex's own disabled slugs and
  codexListTag changes so Codex refetches.
- Requests (gateway/disabled.go): 403 "model <id> is disabled in magpie"
  in each API's error shape, at #882's choke points: serve (idOff),
  perKeyBarred (no candidate: group next member, provider Fallback),
  count_tokens and Gemini :countTokens, serveSystemOne,
  serveDecisionGroup and postDecide, draw/video/embeddings, and
  codexBackend for Codex's own bare models. A group with a member left
  goes on without it; one with none left is refused naming them. A bare
  id the catalog no longer has is refused as disabled, not 404. A Codex
  sub-agent pick onto a disabled model stays on its lead's model.
- An unreadable settings.json is never "none disabled": the list read
  last stays; with none read, every request is refused; nothing is
  written over the file.
- CLI: magpie model disable <model|glob>..., enable ..., disabled
  (list-disabled).
- GUI: Settings > Models > Disabled models: each pattern with the models
  it matches now and Enable; Disable... opens the model picker, which
  also takes a typed glob. Says only requests through magpie are covered.
  POST /api/settings/disabled-models; POST /api/settings keeps the list.
  Strings in zh, zh-TW, ja, de.
- docs/subsystems/gateway-routing.md: Disabled models section.

What was run (worktree at origin/main 091593f7d, private GOCACHE, temp HOME):
- gofmt -l clean; go vet on darwin (touched pkgs), GOOS=linux -tags nogui
  ./..., GOOS=windows ./... clean; go build ./...
- go test -count=1 ./internal/provider ./internal/gateway ./internal/cli
  ./internal/gui ./internal/settings: all ok (gui after adding the field to
  TestSettingsSaveKeepsWhatItDoesNotSend's fixture, which it asked for).
- node --test internal/gui/tests/disabled-models.test.cjs: 16/16 (chromium
  + webkit, en/zh/ja/de, 1100/420); neighbouring Settings > Models tests
  and i18n-keys: 131/131.
- Broken by hand, each turned TestDisabled* red: serve's idOff (404
  instead of 403), perKeyBarred's filter (fallback reached spare), the
  catalog filter (/v1/models and Codex list), countOff (count_tokens 200),
  postDecide's check (decision call went out).
- Not tried with a real vendor account or a real agent.

Ref #1867
2026-10-13 05:34:13 +08:00
yetone f94809d23e agent: Claude Code isn't handed 272000 for a routing group made only of Claude models (#1741, yanjieee)
writeCompact gives a Claude model its own window (no
CLAUDE_CODE_AUTO_COMPACT_WINDOW unless the user set a threshold), but
claudeModel looks only at the id's last part, so group/auto-claude-opus-5-5
or any group of Claude [1m] models was told magpie's default 272000.
provider.ClaudeGroup is true when every member of a group (nested groups
flattened, by the listed name or the wire name, Bedrock names included)
is a Claude model; writeCompact now treats such a group as it treats a
Claude model. A group with another vendor's model keeps 272000. A
threshold set on a member's provider still comes first (CompactSet), and
the user's own env, autoCompactWindow and modelSettings are untouched.

Siblings: only Claude Code has a Claude exemption. Codex (codexcat
work.Working, route.go/models.go CompactFor) applies the working window
to every model, so has no group misread. claudeOutput's claudeModel uses
are about output tokens and are left as they are. Part (b), per-model
modelSettings windows, is tracked separately.

Run: TestClaudeGroupCompactWindow (new) fails on the old writeCompact
("a group of Claude models: 272000"), passes now, with a user-owned env
500000 and autoCompactWindow 900000 kept; go test ./internal/agent
./internal/provider; gofmt -l; go vet darwin, linux -tags nogui, windows.
Not tried in a real Claude Code session.
2026-10-13 05:21:04 +08:00
yetone 9be1bc4562 gui: Settings' menu-bar allowance picker lists a key's plan and balance as one row, not two "Command Code" rows ticked together (#1658, MizuIro-H)
658fbdc14 merged a key's plan and balance into one card on the Usage
page and the tray panel (keyCards), but the picker under Settings ›
Allowances › Shown beside the icon still built its rows from the
unmerged quotas. MizuIro-H's Command Code key reports a plan card and a
balance card, neither with a user, so both rows were "Command Code" with
the same trayCardID ("commandcode"), and ticking one showed both ticked.

The picker now takes keyCards' list, as the Usage page does. A balance
keyCards leaves on its own (a stale stand-in) whose id another row
already has is left out: the menu bar resolves an id to the first card
that has it (trayPick), so a second row of that id could only ever tick
the first. A failed balance was already left out (it has an error).

Run:
- tray-usages.test.cjs: a new test from the reporter's `magpie quota
  --json` (Codex, Command Code plan + balance with no user, SudoCode,
  DeepSeek) plus a plan with a stale balance, in Chromium and WebKit, en,
  zh, zh-TW, ja, de: each card is one row, ticking Command Code ticks
  that row alone and saves ["commandcode"]. With the old app.js all 10
  fail: the names list has "Command Code" and "Kimi Code" twice.
- every tray*.test.cjs and key-balance-card.test.cjs, both engines,
  --test-concurrency=4: 60 pass, 0 fail.
- Not run: the real Windows tray with a real Command Code key.
2026-10-13 05:21:04 +08:00
yetone 22ec7b14ff gui tests: key-balance-card watches for the card's flash rather than polling for it, which a busy WebKit missed under reduced motion
The test runs with reducedMotion "reduce", where app.css cuts every
animation to .01ms: the flash class panelQuotaFocus puts on the Command
Code card is removed on animationend a frame later (instrumented:
animationstart and animationend both at 43ms, elapsedTime 0.00001). A
waitForFunction poll landing outside that frame timed out at 5s. On
origin/main 0d39515b1, 8 runs of key-balance-card + tray-usages in WebKit
at --test-concurrency=4 had 10 such failures; no app code is involved.

A MutationObserver set before the focus now records that the card was
flashed. tray-cell-click, the other test that asserts the flash, runs
without reduced motion and only waits for its absence under it.

Run: 6 more WebKit runs of the same pair at --test-concurrency=4, 0
failures; key-balance-card in Chromium, 10/10.
2026-10-13 05:21:03 +08:00
yetone 73ce9765f1 proc: EndProbes returns once a killed probe's whole group is gone, so an exit right after can't leave a missed child running (#1278)
JJ-Lin's fault injection on #1278: when the first signal to a probe's
group missed a process being forked, group.kill went on signalling it
from a goroutine nobody waited for, and the probe counted as ended as
soon as the first signal went out. EndProbes returned in ~0.2ms; magpie
then exiting (or Exec'ing the new version) ended that goroutine, and the
missed child lived on with PPID 1.

group.kill now returns a channel closed once none of the group is left
(or killFor has passed). A probe's Cancel marks its kill as begun and
counts the probe ended only when that channel closes. EndProbes waits up
to endWait for each kill to begin (a probe that already answered has
none, as before) and then for the group to be empty, bounded by killFor
plus a second. Every exit path goes through EndProbes: the GUI's
OnShutdown, the CLI's return and signal handler, and update.Reexec.

Windows: the job's TerminateJobObject takes no new process once it is
ending, and a probe is killed alone with TerminateProcess, so there was
no background loop to outlive; kill returns a closed channel there. The
known Windows gap that a shim's children aren't in a job for probes is
unchanged.

Run:
- TestEndProbesThenExitLeavesNothing (new) re-runs the test binary as a
  magpie whose group signals miss for 300ms, which calls EndProbes and
  os.Exit(0) at once. On the old code it fails 3/3 on darwin: "what the
  probe started (pid N) outlived magpie's exit after EndProbes".
- darwin: go test -race ./internal/proc ok; -race -count=10 of the
  probe/EndProbes tests ok.
- linux (docker golang:1.26.8 --init, GOTOOLCHAIN=local): -race -count=5
  of the probe/tree tests ok. Without --init the container's PID 1
  reaps nothing and every group test fails on zombies, on old code too.
- Windows box: new TestEndProbesWindows (ping probe ended, EndProbes
  ~0ms) passes 3/3; the rest of the package passes except
  TestNoCommandBypassesProc, which walks ../.. and found other
  checkouts in C:\Users\yeton since the binary ran outside a tree.
- gofmt -l, go vet (darwin), GOOS=linux vet -tags nogui, GOOS=windows vet.
2026-10-13 05:21:03 +08:00
yetoneandfjrtdk 1f0ff81dfc agent: Grok App's own route picked in magpie is taken, and Disconnect can put one back; a sync that isn't connected writes nothing (#1625)
Follow-up to fjrtdk's commit before this one, which this keeps: magpie never names
itself as Grok App's route.

- Set refused every own route (errGrokAppRoute) while Options still
  offered them, so the picker showed choices that only errored. It also
  broke Disconnect: when unwire leaves no route (Use set it to magpie,
  nothing stashed), Disconnect sets connect.was's route back through Set,
  got the error and stopped half done. An own route now takes magpie's
  channel out and is written as [models] default, the way picking
  another provider leaves magpie on other agents. That route can't be
  magpie, so the App's sign-in is never touched.
- Sync ran rememberRoute/releaseRoute before checking for the channel,
  so every user with Grok App installed but not connected got stash
  entries. Now it returns before them unless the channel is there or
  the route is still magpie (an older magpie's takeover to put back).
- Check again warns when the route is magpie and the channel is gone,
  which that commit dropped.
- The notice uses the App's own labels (Settings › Account, Use; ja
  「使う」, de Einstellungen › Konto / Verwenden, from grok-app 0.2.40's
  settings.nav.account and prov.useThis) and says a chat can pick
  magpie's models in its model picker (composer_prefs_set, which
  doesn't move the route).
- Sibling: rtk init has no grok agent for Grok Build either (rtk 311ebcb
  agents: claude codex copilot cursor droid gemini hermes opencode pi
  trae vibe antigravity), so Grok Build is in rtkNoHook too.

Run: gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and
GOOS=windows clean; go test ./internal/gateway ./internal/agent
./internal/library -count=1 pass; node --test i18n-keys and
agent-notice-lang pass. Broken by hand: that commit's grokapp.go fails
TestGrokAppOwnRouteStays, TestGrokAppDisconnectPutsTheRouteBack and
TestGrokAppSyncUnconnected; dropping the Check branch fails
TestGrokAppSyncUnconnected; dropping rtkNoHook["grok"] fails
TestRTKNoHookGrokBuild. Not tried: the Grok App GUI itself; the config
format and behaviour are from grok-app 0.2.40's source.

Co-authored-by: fjrtdk <fjrtdk@gmail.com>
2026-10-13 05:09:18 +08:00
fjrtdk ea3d480edf agent: Grok App keeps its own route; magpie is a custom provider under Accounts, and the Library writes instructions, MCP and skills on agent-home (#1625) 2026-10-13 05:09:18 +08:00
yetoneandRuijia Zhang 8d2a1f7cfe docs: list Ante and AstrBot in both README agent lists, which missed them the way they missed StepCode (#1526)
Checked every Name: of an agent in internal/agent against the README
list after the StepCode commit before it: Ante (e5e87d98, #1210) and AstrBot (2c75d898) were
the other two agents magpie connects that weren't listed. docs/reference.md
already has both rows.

The site's lists (site/public/index.html, docs/start.html in en, zh, ja)
are a hand-picked subset with icons, not every agent, so they're left as
they are.

Run: the same name check over README.md and README.zh-CN.md now finds
none missing (Magpie, Cindy's own custom provider, isn't an agent).

Co-authored-by: Ruijia Zhang <ruijiazhang76@gmail.com>
2026-10-13 05:09:18 +08:00
Ruijia Zhang cb6242572d docs: list StepCode in both README agent lists
Add StepCode beside Pi and oh-my-pi in the English and Simplified Chinese supported-agent lists, matching the existing implementation and reference documentation from 8b393938 (#1526, BUKOWSKIREAL).

Verified with git diff --check and a manual word-diff review. Go tests and builds were not run because this only changes README text.
2026-10-13 05:09:18 +08:00
yetoneandump45nose 1e080cc7e7 gateway: the saved Anthropic-to-Responses body carries the image's detail auto that the commit before it sends (#1474)
TestUpstreamBodiesUnchanged (5feadabe, added after ump45nose's branch)
saved the bytes a vendor gets before input_image carried detail, so it
went red with the fix. Re-saved with UPDATE_UPSTREAM_BODIES=1; the only
byte change is "detail":"auto" on the one input_image.

Run: the two new tests fail on the old responses.go and pass on the new;
openai-python's ResponseInputImageParam (pydantic TypeAdapter) refuses
the old shape with "detail Field required" and takes the new one.

Co-authored-by: ump45nose <52391318+ump45nose@users.noreply.github.com>
2026-10-13 05:09:18 +08:00
ump45nose bbc7ee0a96 gateway: an image Claude Code sends to a Responses provider carries detail auto, so a strict upstream (vLLM) no longer refuses it with 400 (#1474, zacharyxz) 2026-10-13 05:09:18 +08:00
yetoneandwangru8080 b3805203d8 gateway: drawing reads a relay's whole model list for which key serves an image model, and a key's 404 about the model asks the next key (#1657)
What: Provider.Serves now reads a new catalog.LiveAll (the fetched list
with image and video models kept) instead of live(), which drops Draws and
Films models. The draw key loop and the custom video path move on to the
next key when a key answers 404 whose body says the model isn't served
(keyLacksModel = 404 + modelRefused's wording); any other 404 still stops.

Why: wangru8080's analysis on #1657. A relay whose per-key lists name
gpt-image-2 under one key only still had drawing try a key that lacks it:
Serves read a list with the image model filtered out, so every key looked
unlisted, and that key's 404 "Model ... is not supported by any configured
account in this group" ended the loop instead of asking the next key.
Embeddings already move on any error short of the last key.

Run (sandbox HOME, private GOCACHE, worktree at origin/main 97dfed0f3):
- TestDrawGoesPastAKeyTheRelayListsForText, TestCustomVideoGoesPastAKeyThatLacksTheModel.
  Break checks: old Serves -> subtest 1 asks key-a first; draw loop without
  keyLacksModel -> subtest 2 gets the 404; video loop off -> 404 on start.
  A bare 404 still never reaches key-b.
- gofmt -l; go vet ./... (darwin), GOOS=linux -tags nogui, GOOS=windows;
  go build for all three.
- go test -tags nogui ./internal/gateway ./internal/provider
  ./internal/catalog ./internal/codexcat: all ok.
Not tried against a real relay.

Co-authored-by: wangru8080 <22983744+wangru8080@users.noreply.github.com>
2026-10-13 05:05:23 +08:00
yetone 125dad5cbb gateway: a codex provider used only through routing groups keeps the ChatGPT account's own models out of Codex's list (#1602)
With Codex signed in to ChatGPT, Codex asks magpie's /backend-api/codex/models
for its list, and codexModels passes the backend's own models through,
narrowed only by the codex provider's picks (CodexNativePicked) and the
Agents page's hides (CodexNativeHidden, built from Catalog()). A provider
set to "Only through routing groups" (Provider.Unlisted) has none of its
models in Catalog(), so neither filter saw them: all of the account's
models stayed in Codex's picker, and the Agents page had no Codex group to
hide. Every other agent's list is Catalog-based and already left them out.

provider.CodexNativeUnlisted says which of the account's models are kept
out of agents' lists: every one when the codex provider is Unlisted, and by
slug those a group with Unlists names. codexModels drops them (hidden
entries such as codex-auto-review stay, as with picks; a Codex reached for
failover alone keeps them, as it is handed no groups), spawnChoices drops
the same ones from spawn_agent's list, and CodexListTag carries them so
Codex refetches. gateway-routing.md says so.

Test: TestCodexModelListUnlistedForGroups (a group unlisting gpt-5.5 takes
gpt-5.5 alone; the provider Unlisted takes gpt-6-sol and gpt-5.5 and keeps
codex-auto-review; ETag changes; spawn_agent offers neither; own-only keeps
them). With codex_backend.go and codex_spawn_models.go reverted it fails on
all three checks. Not tried with a real ChatGPT sign-in and Codex app.

Run (sandbox HOME, private GOCACHE, worktree at origin/main 97dfed0f3):
gofmt -l; go vet ./... (darwin), GOOS=linux -tags nogui, GOOS=windows;
go build for all three; go test -tags nogui ./internal/gateway
./internal/provider ./internal/catalog ./internal/codexcat: all ok.
2026-10-13 05:05:23 +08:00
yetone dc2e1cc124 gateway: MiniMax's and Volcengine Ark's refusals of thinking turned off are asked again with it left to the model (#1141)
thinkingOffUnlessAsked turns thinking off on a Messages request for a
non-Claude model that doesn't mention it (Claude Desktop's model_validation
probe, its health probe, title generation). MiniMax-M3.1-Flash-Preview and
Ark's glm-5.3 / glm-5.3-flash refuse that with 400, in wordings neither
alwaysThinks, mandatoryReasoning nor thinkingOffRefused matched, so the 400
went back to the client and Desktop wouldn't switch to the model.

alwaysThinks now matches the reporters' literal messages, narrowly:
- MiniMax: `requires adaptive thinking; thinking.type="disabled" (including
  reasoning.effort=none) is not allowed (2013)`
- Ark: "thinking.type `disabled` is not supported by this model"
Both retry sites use it: the relayed Messages path (withoutThinkingOff,
gateway.go) and the translated Chat/Responses path (thinkingBackOn).

Tests: TestAnthropicPassthroughMiniMaxArkThinkingOffRefused (each vendor's
body: omitted thinking succeeds after one retry without thinking; adaptive
goes once, as sent; another 400 of MiniMax's own 2013 and a near Ark
wording "top_k is not supported by this model" are not retried), and
TestTranslatedThinkingOffRefused now runs the GLM, MiniMax and Ark wordings.
With the regex change reverted both fail (400 handed back). The JSON
envelopes around the reporters' messages are assumed (Anthropic's error
shape); not tried against the live MiniMax or Ark endpoints.

Run (sandbox HOME, private GOCACHE, worktree at origin/main 97dfed0f3):
gofmt -l; go vet ./... (darwin), GOOS=linux -tags nogui, GOOS=windows;
go build for all three; go test -tags nogui ./internal/gateway
./internal/provider ./internal/catalog ./internal/codexcat: all ok.
2026-10-13 05:05:23 +08:00
yetone 0d39515b14 gui: Connect's Shell and curl snippets can be for Windows or macOS · Linux, whichever machine runs them (#1514)
FourLeafTec on #1514: at home on Windows, but mostly running things on a
Linux server over ssh, and Connect only ever wrote the snippets for the
machine magpie runs on (PowerShell + curl.exe on Windows, bash elsewhere).

What changes
- Beside the snippet language, the Shell and curl tabs get a two-way
  segmented control, Windows | macOS · Linux. It starts as the host's OS
  (also when Local network / Public address is picked: those say where the
  gateway is reached, not where the snippet is pasted), and the pick is
  kept in localStorage (magpie.snipOS), next to magpie.lang. The Shell tab
  is named PowerShell or Shell after it. Python and Node show no switch.
- Quoting is now right for any key a user brings (ownSecret allows every
  ASCII symbol): POSIX values and headers go in '...' with ' as '\'' when
  they hold ' " $ ` \ !, the -d body escapes its own ', and a URL with
  brackets (a [1m] model id) is quoted and gets -g. PowerShell values go in
  '...' with ' doubled when they hold $ ` "; a header holding " goes to
  curl.exe after --% on one line, quoted as the C runtime reads it, since
  Windows PowerShell 5.1 split such a header in two (seen on the box). A
  %NAME% of a defined variable in such a key is still expanded there; noted
  in the code.
- Translations for the control's label in zh, zh-TW, ja, de.

What was run
- New internal/gui/tests/connect-snippet-shell.test.cjs: Chromium and
  WebKit x en/zh/zh-TW/ja/de x 1100/390 px, 20/20 pass. It picks a LAN
  address on a Win32 page, checks the PowerShell form, switches to
  macOS · Linux (the control's position and the page's scroll unchanged),
  runs the export snippet in bash and zsh and the curl snippet against an
  echo server in the test (the key with ' " $ ! ` \ arrives whole, body
  parses), reloads (pick kept), switches back (--% form), Python shows no
  switch, a Mac page starts on macOS · Linux, and no horizontal overflow.
  With the old app.js it fails: "Expected values to be strictly equal"
  on the PowerShell env snippet ($env:OPENAI_API_KEY="k'ey"$HOME..." was
  unquoted), and there is no .snip-os control at all.
- On the Windows box (Windows PowerShell 5.1.26100; no pwsh there or on
  the Mac): the snippets the GUI made for OpenAI, Anthropic and Gemini,
  each as $env: and curl.exe, with three keys (sk-magpie-key-abc123,
  k'ey"$HOME!`x\y, ab\"cd%PATH%\), run with powershell -File against a
  TcpListener echo server started and stopped by the script. Plain and
  symbol keys arrive whole in the header and $env:, with the body as POST;
  the third shows the %PATH% limit above. Before the --% form, the symbol
  key's header was cut at the " and the request went out as a GET.
- Related GUI tests in both engines (click-scroll, connect-address-kept,
  gateway-*, phone-*, public-url*, omp-profile-connect, i18n-keys): all
  pass except mobile-web's "desktop matches origin/main" for the gateway
  view (415 px), the new control itself; screenshots looked at.
- go test ./internal/gui/ in a sandbox HOME: ok.
2026-10-13 04:57:00 +08:00
yetone aa1b04c324 provider: moved Cursor users get plugin 0.2.9 and WorkBuddy users 0.1.18 (magpie-community/plugins#55, #18)
Cursor 0.2.9: a default model whose own branch stops short of the asked
effort goes to its nearest effort, so the id and its parameters agree.
WorkBuddy 0.1.18: WorkBuddy 5.6+ keeps its desktop sign-in encrypted; the
plugin now says so and points to the browser sign-in, instead of
"isn't signed in" and a 502.

Both versions checked on registry.npmjs.org (dist-tags latest).
Run: gofmt -l, go vet (darwin, linux -tags nogui, windows) and
go test ./internal/provider -run 'Mov|Plugin|Migrat|Hand'.
2026-10-13 04:54:51 +08:00
yetone 1eea68e0cd gui: Plugins' "Unofficial, on GitHub" has its kinds to pick and a field of its own to narrow it
The owner: 这里应该有分类以及搜索框方便用户筛选. The section lists every
repository tagged magpie-plugin, 31 on the dev instance today, as one
long grid, and the page's only search ("Search plugins and npm…") sits
at the top and also asks npm.

Once more than six repositories are tagged, the section's head has:
- its kinds as a segmented control (All · 31, Provider · 27,
  Middleware · 3, Agent · 1): only kinds that have repositories, each
  counting what the field leaves, and none when one kind is all there is;
- a field that narrows by name, author or description as it is typed,
  with Escape to clear it;
- "No plugin on GitHub matches" with Show all when nothing is left.
Both narrow what the page's search has already found. Only the section
is drawn again as they change. The section, its field and the page's
body are made once and kept in the page, as the page's own field is
(#1055), so an answer that redraws the page while someone types (npm's)
keeps the field's focus and every key. Strings in zh, zh-TW, ja and de.

Run:
- plugin-github-filter.test.cjs (new), built on the dev instance's real
  /api/plugins/github answer: chromium and webkit, en/zh/zh-TW/ja/de,
  980px and 440px, 22/22. Putting back drawBody's replaceChildren turns
  the field-keeps-its-focus check red.
- Every other plugin-* GUI test, plus i18n-keys and nav-sub-unroll, in
  both engines: all green. plugin-github went 0/18 at first, because two
  fields matched its `.pm-find input`; with the six-repository threshold
  its four repositories show the plain grid, and it is 18/18.
- Looked at in dark WebKit at 1200px and light Chromium at 440px.
2026-10-13 04:52:38 +08:00
yetone 97dfed0f3e library: a site's well-known kit of skills is one group, by the lock's sourceBaseUrl (#1862)
WardLu (#1862): skills that `npx skills add` got from a site's
/.well-known/agent-skills/ index were one group per skill. That was
Feishu's lark-base, lark-doc and lark-sheets, and Fish Audio's
fish-audio-api and fish-audio-sdk. readSkillLock grouped them by each
skill's own sourceUrl (".../lark-base.tar.gz", ".../fish-audio-api/skill.md").

Now a lock entry with sourceType "well-known" is grouped by its
sourceBaseUrl, read as host/path (wellKnownBase/siteOf):
- the user, query and trailing slash are dropped, and the host is
  lower-cased without "www.";
- so Feishu's three are open.feishu.cn/lark-cli/skills/regular and Fish
  Audio's two are docs.fish.audio;
- a kit on the same host with a different base URL stays apart. Hosts are
  not merged.

Fallbacks:
- an older lock with no sourceBaseUrl takes the part of its sourceUrl
  before /.well-known/;
- an entry with neither is grouped by its sourceUrl, as before.

Two things this new key would otherwise get wrong:
- Group again (RegroupSkills) tried every owner/repo-shaped key on GitHub.
  A kit one folder down a site (docs.example.com/kit) has that shape, so a
  key whose owner has a dot is skipped now. GitHub owners have no dot.
- the heading's link sent a key with no path ("docs.fish.audio") to
  github.com. repoURL now opens it at https://docs.fish.audio.

Run:
- go test ./internal/library (all pass). New TestWellKnownKitGrouped uses
  the issue's base and source URLs for 3 Feishu + 2 Fish Audio skills, plus
  another kit on open.feishu.cn, an entry with no base, and a
  docs.example.com/kit kit that Group again must not fetch.
  - With the well-known branch disabled it fails, with the reporter's five
    one-skill groups.
  - With the dot check removed it fails on a GitHub fetch.
- new TestWellKnownBase: a table of base and source forms.
- skill-repo-groups.test.cjs now has a docs.fish.audio group that opens the
  site. It fails with origin/main's assets, which say "on GitHub". It and
  skill-regroup/skill-groups pass in chromium and webkit.
- gofmt -l; go vet for darwin, linux -tags nogui and windows on
  internal/library.

Not run: the reporter's real ~/.agents/.skill-lock.json. The issue quotes
only these three fields of it. A row's own link still isn't its sourceUrl.
2026-10-13 04:32:20 +08:00
yetone 9a34a784dc library: Collapse all / Expand all for the skill groups (#1862)
WardLu (#1862) asked for a way to fold every skill group at once in a
library of many groups. Library > Skills now has a Collapse all / Expand
all button beside the sort (foldAllButton in library.js):

- without a filter it sets every shown group's kept fold
  (magpie.libSkillFolds), the same as clicking each heading;
- while filtering it folds or opens only the groups the filter shows,
  until the filter changes (unfiltered), and leaves the kept folds alone;
- it says Collapse all while any shown group is open, else Expand all;
- it is hidden with fewer than two groups (A->Z, or a filter only one
  group matches);
- a part inside a group keeps its own fold, and nothing is sent.

skillHits/groupFolded pull out the rules drawSkills already used, so the
button and the headings can't disagree. Strings in en, zh, zh-TW, ja, de.
docs/subsystems/library.md's Skill groups row describes it.

Run:
- new internal/gui/tests/skill-fold-all.test.cjs: chromium and webkit,
  en/zh/zh-TW/ja/de, at 640 and 1180. 22/22 pass, three times. With
  origin/main's assets it fails in every case (no button).
- the skill-*, library-* (skills side), pick/remove/import skill tests
  and i18n-keys, at concurrency 4: everything passes except
  pick-skills.test.cjs in WebKit. That test is red with main's own assets
  too (#1672, being fixed separately).
- screenshots in German at 640 and 1180: the button sits in the heading
  row and wraps with it.

Not run: a real library with many groups in the app window. I didn't
check by hand that the scroll check fails when something scrolls.
2026-10-13 04:32:20 +08:00
yetone 76c6580ea6 gui: a skill group's agent chips count only the skills magpie decides, and a row's chip for one an agent reads from ~/.agents/skills itself is locked (#1862, WardLu)
A skill kept in ~/.agents/skills is had by every agent that reads that
folder itself (SkillView.Always), whatever is ticked. Its row's chip said
so only on a click, greyed like a chip that can't take the skill, while
the group's chip counted s.agents alone. Turning the group off for Codex
then said "off for Codex" and left the row lit.

What changed:
- groupChips (group headings, parts and the Select bar) counts, gives and
  takes only the skills magpie decides for each agent. agents-some is
  sent, per agent, the names it doesn't read itself, so a skill Codex
  reads from the shared folder is never sent for Codex.
- A chip whose agent reads only some of them itself says how many, in its
  tooltip. After a click, the status says "Codex still reads 1 of them
  from ~/.agents/skills itself".
- An agent that reads every one of them itself has a lit, locked chip, as
  the row's is. It sends nothing, and a click says why.
- The group's heading says "N in ~/.agents/skills", with a tooltip naming
  the agents that read it, before any click.
- A row's locked chip is lit, with a small lock on its corner, rather
  than greyed out at .35.
- Nothing deletes from the shared folder or touches another agent's
  config. Servers and hooks keep their own reach rules unchanged.
- Strings in zh, zh-TW, ja and de. docs/subsystems/library.md (Skill
  groups) says it.

What was run:
- New skill-group-shared.test.cjs, in Chromium and WebKit; en, zh, zh-TW,
  ja and de; 640px and 1180px:
  - heading note;
  - partial chip tooltip;
  - the locked row chip's opacity and its lock;
  - the post sent, the status, and parents and rows agreeing after a
    click;
  - All;
  - a fully locked group chip sends nothing;
  - no sideways scroll.
  22/22 pass, twice. It fails on the old code (no heading note; Codex is
  sent mango too).
- group-skill-chips, skill-parts, skill-groups, shared-skills,
  every-skill, library-all, i18n-keys, library-own-folder,
  skill-repo-groups, library-pick-remove and library-null-agents pass in
  both engines.
- pick-skills is red in WebKit on origin/main's own assets too, the same
  as here. It is out of date since 18e82adc6, and the GUI-triage session
  is fixing it (#1672).
- Looked at in WebKit screenshots, light.

What wasn't run:
- Not tried with a real Codex reading a real ~/.agents/skills. The
  backend (SkillView.Always, agents-some) is unchanged.
2026-10-13 04:32:20 +08:00
yetone 091593f7d3 gateway, gui: a WorkBuddy account the vendor restricted (403 11140) rests 2 hours as restricted, and Routing names the appeal as the way back (#1849)
WorkBuddy answers an account it restricted for unusual activity with
403 {"code":11140,"msg":"request illegal","displayMsg":{"en":"Your
account has been restricted due to unusual activity",...}}. failure()
read it as an unknown failure, so the account rested 1-10 minutes and
was asked again, refused, all day.

What changed:
- provider: WBRestricted knows the refusal by code 11140 (top level,
  data or error; number or string; whole, so 111400 isn't it) or by its
  displayMsg words. wbExplain ends the built-in's error with
  WBRestrictedHint.
- gateway: a new failRestricted ("restricted") rests restrictedRest, 2h:
  one refused request per account per 2h, and a lifted restriction (or a
  misread refusal) comes back the same afternoon; Unrest lifts it at
  once. It is read from the hint in the error (restrictedSaid; both the
  built-in and the plugin translate the vendor's body before failure()
  sees it, so the raw JSON never reaches it in a chat try), or from the
  raw body only for a WorkBuddy candidate (restrictedRefused,
  isWorkBuddy), since another vendor's 11140 is its own. Bare "request
  illegal" is not matched. 11128 stays promptRefused and rests nobody.
  The stale-allowance shortcut skips it, as it does model refusals.
  drawsWorkBuddy now uses isWorkBuddy.
- plugin: @magpie-community/opencode-workbuddy-auth 0.1.17 (plugins
  caf3908) ends the error with the same hint; the mover's min is 0.1.17
  so keepMovedCurrent brings moved users to it.
- gui: Routing labels the try "account restricted by the vendor", says it
  rests because only the vendor lifting it brings it back and to appeal,
  shows the hint translated, and the account's row has "The restriction
  is lifted — try it again" (POST /api/gateway/unrest). en, zh, zh-TW, ja,
  de.
- docs/subsystems/gateway-routing.md says the above.

Run: gofmt -l (clean); go vet darwin, GOOS=linux -tags nogui, GOOS=windows
on gateway, provider, gui; go test ./internal/gateway ./internal/provider
./internal/gui (ok). New Go tests use the reporter's literal body through
the vendor's shape, the built-in's and the plugin's, a string code and the
words alone; another vendor's 11140, a non-WorkBuddy account with the same
body, 11128/14018/111400 not restricted; an e2e through the fake plugin
host where the restricted account is skipped by the next request.
Broken by hand, each went red: rest case removed, restrictedSaid removed,
the match unscoped, the raw match removed, the provider hint removed.
GUI: routing-wb-restricted (chromium and webkit x en/zh/zh-TW/ja/de x
1100/420px, 20 pass), routing-wb-refused, i18n-keys; after the rebase
every GUI test of the Routing page (107 files, both engines): 103 green.
The 4 red ones fail the same in WebKit on origin/main 689edbd6b run
alone and are filed: group-member-info (#1745), routing-sessions
(#1307, #1672), routing-steady (#1804, passed on this head on a rerun),
routing-group-fold's group-of-eight (#1672).
Rebased onto 2c30e5cee (with #1672's test fixes) and run again: vet x3,
go test ./internal/gateway ./internal/provider ok. On the final base
5756651e3 (only GUI assets and READMEs changed since): routing-wb-restricted
20/20, routing-wb-refused, i18n-keys, routing-held-dot, mono-icon-redraw,
routing-sessions 38/38, routing-group-fold 40/40; routing-steady's WebKit
case red again, the flake filed as #1804.
 Not tried against a real restricted account;
plugin users on <0.1.17 rest by minutes until their plugin updates.
2026-10-13 04:32:09 +08:00
yetone 5ca9dc19db usage, gui: a model says how many of its replies were ended for looping (#1858)
#1858 asked for recovery across turns when a model loops. magpie is a
gateway and can't rewind the agent's session, so that is not planned now.
What it can do is let the reader see which model loops. Each reply the loop
guard ends (#1359) is logged with err_type "reply_loop", but Usage only
counted it among the failures.

usage.LoopErrType is now that type (the gateway's loopErrType is it), and
Totals.Loops counts, among the failed requests, those ended for looping. A
handed-on try is still no request. The Overview's model, agent, account
and key rows and the Requests ranking say "{n} looped" beside "{n}
failed", and the ranking's "Other" adds them up. Translated into zh,
zh-TW, ja and de.

Run: TestLoopsCountedPerModel (Overview groups, the ledger sum and
Breakdown; red with the increment removed). go test ./internal/usage
./internal/gateway ./internal/gui; gofmt -l; go vet on darwin, linux
-tags nogui and windows. The new usage-loops.test.cjs ran in chromium and
webkit, 5 languages at 360 and 1100px, 20 pass; it fails 10 of 10 on HEAD~
assets. usage-*, ledger-*, own-requests, i18n-keys and gui-zh-tw/ja/de in
both engines: 565 pass.
Not run: a real looping model through the gateway (the logging path is
unchanged from #1359).
2026-10-13 04:31:07 +08:00
yetone 0102915fe0 gui: Tuned for you lets a compaction window be picked, each with its estimated extra tokens and compactions (#1860)
MrMengJ applied the advised 200K auto-compaction window and wanted 250K or
300K instead, seeing what each costs against the cheapest. A compaction
row now has "Other window…", which opens the app menu (never a native
select) with every value of the curve the card already replays. Each says
its estimated extra tokens over the fewest (or "Fewest tokens" / "As few
tokens") and about how many compactions it would have made over the range.
The head says it is estimated from the reader's calls. The one picked is put
in through /api/tune/apply like Use, with Undo.

tune.Point gains compacts, counted by the same replayCompact that prices
the point, so tokens and compactions come from one model.

Run: go test ./internal/tune ./internal/gui; TestCompactCurveCountsCompactions
(compactions fall as the window grows; the last point is close to
Facts.Compacts). gofmt -l; go vet internal/tune on darwin, linux -tags
nogui, windows. GUI: context-*, gui-zh-tw/ja/de, compact-at, click-scroll,
i18n-keys in chromium and webkit, 144 pass. The new context-tune test covers
5 languages at 360 and 1100px: menu inside the window, 300K ticked, notes
for 250K and 160K, picking 250K posts apply with no page scroll, Escape
posts nothing. On HEAD~ assets context-tune fails 22 of 23.
Not run: against a real Claude Code settings.json (the apply path is
unchanged from Use).
2026-10-13 04:31:07 +08:00
yetone 6e5f4fc97f gui: Tuned for you names its advice "Fewest tokens" and says a compaction window is a token estimate, not what the agent keeps (#1854)
cnlove7777777-art: the card called 230K -> 150K "best for you" on token
savings alone, while compacting sooner may lose more of a long coding
task. A retention benchmark isn't built now; the card says what it
measures instead:

- the advised value's label is "Fewest tokens", not "Best for you";
- a compaction row that advises a change adds "A token estimate only: it
  doesn't measure how well the agent keeps the task after a compaction.
  The lower the window, the more often it compacts." Not on a window
  already the leanest, nor on the cache lifetimes.
- zh, zh-TW, ja, de translations; agent-wiring.md says the same.

Run: context-tune.test.cjs (new assertions on label and caveat) passes in
Chromium and WebKit, 360 and 1100 wide, en/zh/zh-TW/ja/de; on
origin/main's assets it fails 11 of 12. context-*.test.cjs, gui-zh-tw,
gui-ja, gui-de, compact-at, i18n-keys: 99 pass, 0 fail. Not tried in the
real app window.
2026-10-13 04:31:07 +08:00
yetone 8b9d63f58a usage: a cost total says how many calls it couldn't price, never reads them as free (#1856)
cnlove7777777-art's Kimi K3 Auto and GLM-5.3 Max calls had "no price",
and Usage's sum counted them as $0 with nothing beside it but a "+" and a
tooltip. Now every total that sums cost says the count:

- GUI: Overview's and Requests' heads read "≈$0.001+  2 calls unpriced";
  with nothing priced, the count alone (Requests showed nothing at all
  before). Overview's calls tile adds "2 unpriced". Sessions, which prices
  by model, says "1 model unpriced" in its head and cost tile. The count
  stays at every width: the narrow and .tight rules no longer hide it,
  and the head goes tight when the count would be cut, sum or not.
  "no price for these models" is no longer shown, its key removed.
- CLI `magpie usage`: "≈$0.001+ (2 calls unpriced)". TUI Usage page: the
  same after its cost.
- docs/reference.md: unpriced calls are left out, said beside the total;
  magpie doesn't guess a variant's price from a similar name.

No variant price is mapped: models.dev lists neither "Kimi K3 Auto" nor
"GLM-5.3 Max", Zhipu's "Max" is a Coding Plan tier, and -fast variants
are 1.5x their base, so a suffix strip would be a guess. The existing
per-model price override (provider editor, `magpie model price`) covers it.

Run: go test ./internal/cli ./internal/tui ./internal/gui (ok);
TestUsageSaysCallsUnpriced and TestUsagePageSaysCallsUnpriced fail with
the fix taken out. usage-unpriced-sum.test.cjs (new) passes in Chromium
and WebKit, en/zh/zh-TW/ja/de, 360-1240px, and fails 5 of 5 on
origin/main's assets. Related GUI files (every test naming usageCost,
unpriced, effective prices, usage-head or "{n} failed", plus i18n-keys,
gui-zh-tw/ja/de, number-units, text-size, usage-ledger, ledger-protocol,
usage-range, mobile-web, phone-web, view-no-sideways): 655 pass; the
WebKit text-size foot case and routing-sessions fail the same run alone
on origin/main 5c82e6880 (filed #1672, #1307). gofmt -l clean; go vet
darwin, GOOS=linux -tags nogui, GOOS=windows clean. Not tried in the
real app window.
2026-10-13 04:31:07 +08:00
yetone 3cd55f6547 images: a ChatGPT account lists one GPT Image, said to be ChatGPT's pick (#1865)
Settings › Models › Image generation offered "GPT Image 2 · Codex" and
"GPT Image 2.5 · Codex". chatgpt.com/backend-api/codex/images/generations
ignores the model (and size): tested with the owner's Pro account, it
answers gpt-image-2, gpt-image-2.5, gpt-image-2.5-sunburst and a made-up
"x" with 200 and the same image (#1865 comment 6131731318), as 3a18ec8e
already suspected. The picker implied a choice that doesn't exist.

What changed:
- gateway: codexDrawers is one entry, gpt-image-2 named "GPT Image" (what
  Codex CLI asks for). VendorPicksDrawer(p) marks a ChatGPT account.
  ListedDrawer(ref) maps any gpt-image-* picked on a ChatGPT account
  (a saved codex/gpt-image-2.5) to that entry, for display only.
  drawsFamily still lets a named or saved gpt-image-2.5 draw there.
- gui: /api/settings sends imageGenShown when the saved ImageGen stands
  for another listed entry, and vendorPicks on the ChatGPT entry. The row
  shows and ticks the entry, picking it again saves nothing (the saved
  value is never rewritten), its option note and a line under the row say
  ChatGPT's image backend picks the model itself. en/zh/zh-TW/ja/de.
- Aside: magpie/codex/gpt-image-2.5, picked when it was offered, is still
  taken as an image model (asideImageOffered maps it via ListedDrawer).
- An API key's gpt-image-2.5 (OpenAI, relays) is listed and drawn as
  before: there the model field matters.

Checked: no doc, site page, MCP tool description or CLI lists these ids.
The remote-magpie list (drawerObjects) follows Drawers and now lists one.

Run, at this head:
- New tests failing on the old code: TestCodexListsOneGPTImage ("codex
  lists [gpt-image-2 gpt-image-2.5], want only gpt-image-2") and
  TestCodexAccountDraws with the old codexDrawers;
  TestAsideCodexOneGPTImage ("magpie/codex/gpt-image-2.5 not offered")
  without the aside mapping; TestImageGenCodexOneEntry ("shown \"\"")
  without the api.go wiring; images-codex-one.test.cjs with the old
  app.js (button "codex/gpt-image-2.5", not "GPT Image · Codex").
- go test -tags nogui ./internal/gateway ./internal/gui ./internal/agent
  ./internal/catalog ./internal/provider under a sandbox HOME: ok.
- gofmt -l (empty), go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
  GOOS=windows go build: clean.
- Playwright (1.62.0), chromium and webkit: images-codex-one (en, zh,
  zh-TW, ja, de at 1000px; en, zh at 360px), images-missing, vision-mcp,
  searcher-pick, routing-vision-why, i18n-keys: all pass.
Not run: the full go test ./... and the whole GUI suite; no new request
was made to chatgpt.com (the backend's behaviour is the #1865 test).
2026-10-13 04:27:40 +08:00
yetone 5756651e3b readme: the architecture diagram shows each agent's and provider's real logo
The owner asked for real logos on the agents and the models. Each agent
row now carries its own mark (Claude Code, Codex, Gemini CLI, OpenCode),
the "+ 40 more" row shows Zed, Cursor, Cline and Goose, and every
provider name sits behind its logo (DeepSeek, Kimi, GLM, OpenRouter;
Claude, ChatGPT, Copilot, Gemini; Ollama, LM Studio). The marks are
inlined from internal/gui/assets/icons, the same files the GUI shows,
with their gradient ids prefixed per use so the four copies don't clash;
monochrome marks follow the theme's ink. Text and chip widths are now
measured from SF Pro rather than estimated per character.

Run: rendered all four SVGs in headless Chrome on #fff and #0d1117 at
2x and at the README's 880px width; no overlaps, every logo resolves.
2026-10-13 04:25:02 +08:00
yetone 77a3deaed2 readme: the architecture diagram is a drawn picture in both themes, not a mermaid flowchart
The mermaid "How it fits together" / 整体结构 chart rendered as grey
boxes in GitHub's default style. It is now four hand-made SVGs
(en/zh × light/dark) under site/public/img/architecture*.svg, shown
through <picture> with prefers-color-scheme:
- agents on the left (the 40+ others as a dashed row), providers on the
  right, joined by curves into one magpie card;
- the magpie card is inverted (black in light, near-white in dark), with
  the logo, 127.0.0.1:3425 in a mono face, and the gateway → routing
  groups → plugins stages on a rail, the four protocols as chips;
- system font stacks only, since an SVG in <img> loads no web fonts.

Run: rendered all four in headless Chrome on GitHub's backgrounds
(#fff, #0d1117) at 2x and at the README's 880px width; checked no text
overlaps or is clipped and the shadows aren't cut by the viewBox.
Both READMEs no longer contain a mermaid block. Docs-only.
2026-10-13 04:20:41 +08:00
yetone a1ffeff87a readme: the Chinese README's bold lead-ins render as bold again, not as **…**
CommonMark only closes ** that is right-flanking: one after punctuation
(。 ) or a link's ")") must be followed by a space or punctuation. In
"**1 · 安装。**从" it is followed by 从, so GitHub showed the asterisks.
The three Quick start steps and "方案(Profile)" move their punctuation
out of the bold; the two bold links put the bold inside the link text.

Run: every tracked .md with CJK text (12 files) rendered through GitHub's
own renderer (gh api markdown, gfm); README.zh-CN.md was the only one
with stray ** (6), and after this change it has 0.
2026-10-13 04:16:14 +08:00
yetone 73c3c16cf1 gui: on Routing picked mid-request, the request's dot waits at the account answering it, not where the account was a frame before (#1859)
What changed: a request's dot, let go at the account that answers it, is
held there (`.pkt.held`) until the try ends. It was posed only while
flying, so any layout after it landed left it where the seat had been.
Picking Routing while a request is under way does exactly that: the
view's box is 0 wide while hidden, so byWidth marks it max560 and the
stage comes back stacked (accounts under magpie) for its first frames.
With reduced motion the flight is one frame, so the dot lands at the
stacked seat's edge; the stage then goes wide and the wires follow
(the stage's ResizeObserver runs layout()), but the dot doesn't. That
is ouchxp's screenshot: a dot at the left of the line under the stage,
and the seat's own dot plain. A window resized while a request waits
did the same with any motion setting.

Now play() records each held dot with its row (`holds`), and layout()
poses every held dot at the end of its row's wires again (holdAll),
so it follows the seat through the narrow-to-wide switch, resizes and
FLIP moves. holds is cleared with the play, and by stopPlays.

Not changed: byWidth still marks a hidden box narrow, so the stage is
stacked for a frame or two after the view is picked. Skipping a 0
width there also hides this case at wide windows, but not a resize or
a narrow window, so the fix is in the held dot.

Run (worktree on 5c82e6880, then rebased on 3869b0a27):
- new routing-held-dot.test.cjs: chromium and webkit, en zh zh-TW ja
  de, 1100 and 560px, reduced motion: Agents first, the request under
  way, Routing picked, the held dot at the seat's edge; then the window
  resized to the other width and checked again. 20/20 pass. On the old
  routing.js it fails in both engines (dot at x 267, seat at 607 after
  the switch; and after the resize). With only the byWidth change and
  not holds, it still fails, so the test guards holds.
- all routing-*.test.cjs and panel-routing, both engines: 715/719 on
  5c82e6880; the 4 (routing-group-fold webkit en/ja/de,
  routing-sessions webkit en) fail the same there without this change
  and pass on origin/main 3869b0a27 (fixed by 94aa793db). Rerun on
  3869b0a27 + this: 718/719; routing-steady webkit "requests coming in
  leave the routing groups where they are" moved the editor 1.69px under
  load. That is #1804: alone it passes 3/3 with and without this
  change; 4 copies at once fail 4/8 on the old routing.js and 0/8 with
  this change.
- Not tried in the real app window with a live request.
2026-10-13 04:14:20 +08:00
yetone 6a85bce6f0 gui: a mono logo drawn again paints at once: each mask picture is probed once and kept on a hidden shelf (#1847)
kyya saw Command Code's logo blink in the Routing group editor on every
redraw, while the colour logos (<img>) beside it stayed put. A mono logo
is a CSS mask on a span, and icon() did two things wrong with it:

- It made a probe Image for every logo it drew, so every redraw asked for
  the file again: in the new test one group editor probed commandcode.svg
  14 times. Chromium revalidated it on the redraw, and a WKWebView with a
  wails:// handler went from 17 to 18 requests.
- Nothing kept the picture between the old span going and the new one
  painting. A new span has nothing that holds the decoded picture, so the
  engine is free to drop it and paint the new span empty until it has
  loaded the picture again. keepIcons (Providers only) doesn't help here,
  even if more pages used it: a node it moves is taken out and put back,
  and its CSS image is resolved again.

maskSpan (app.js) now builds every mask span. Each picture is probed once
per page, not once per logo. When the picture loads, a span of its own is
put on a hidden shelf (.mask-shelf: fixed, 0x0, visibility hidden,
aria-hidden) that holds it for as long as the page is open. A picture
that fails still falls back to the plain outline, the same as before.
library.js's RTK logo, the only other place that set a mask's --i
itself, now goes through maskSpan too. Logos look the same as before.
The shelf costs one extra load per distinct mask picture, once each.

Run:
- New internal/gui/tests/mono-icon-redraw.test.cjs, in Chromium and
  WebKit, en and zh: the rows really are drawn afresh (the editor's own
  redraw and drawGroups' replaceKeeping), logos look the same, one probe
  per picture, no new request for it, the shelf holds it once, takes no
  room, is hidden, and a missing logo stays the outline. A source guard
  checks that only maskSpan sets a mask's picture.
  - On the old code all five tests are red (14 probes, and the guard
    names app.js:237).
  - With the shelving taken out by hand, the WebKit cases are red.
- 112 related GUI files (group-*, routing-*, icons, rtk, mask, keepIcons),
  both engines: 1053 of 1058 pass. The 5 reds are group-member-info,
  routing-group-fold and routing-sessions in WebKit, and they fail the
  same run alone on unchanged main (#1672, #1745).
- The full GUI suite, once, under load 60-150 from other sessions: 7261
  of 7290 pass. Every failing file was rerun alone on the fix and on
  unchanged main, and fails the same on both, under #1672, #1745 and
  #1609. library-mcp-tool-switch fails 1-4 random WebKit cases per run on
  both (#1609). profile-in-use and library-mcp-tools have been fixed on
  main since (cce4960bd, b7df1b7c6).
- A Swift WKWebView harness (wails:// scheme handler, real assets) with
  60fps screen recordings analysed frame by frame: the request counts
  above, and with the fix no request on a redraw (26 -> 26) and the logo
  identical, frame by frame.

Not done: the blink itself never showed, on macOS 26.2 in WKWebView,
playwright WebKit or Chromium, before or after the fix. So the fix is
grounded in the two defects above, not in a reproduced blink, and isn't
confirmed on the reporter's machine. The Windows (WebView2) and Linux
(WebKitGTK) webviews were not tried. No Go changed.
2026-10-13 04:12:23 +08:00
yetone 2c30e5cee7 usage, gui: revert def3a41e3 until Fallmonkey says what context it missed
Fallmonkey asked on Discord (#feedback, 10-12 19:55) to hold the
single-call Codex threshold: "先别做?感觉你漏掉context了". It is not in a
release yet, so take it off main until the rule is agreed, rather than
ship a speed rule its own requester has paused.

This reverts commit def3a41e36.

Run: gofmt -l, go vet, go test ./internal/usage.
2026-10-13 04:07:30 +08:00
yetone e0ecf01610 mcpauth: an MCP server's own OAuth app is called back at Claude Code's http://localhost:<port>/callback, so an app made for Claude Code signs magpie in as it is (新v学员 on Discord)
What changed: accc8c090 took Claude Code's names for a server's own
OAuth app (oauth.clientId, clientSecret, callbackPort) but sent
redirect_uri=http://127.0.0.1:<port>/callback. Claude Code sends
http://localhost:<port>/callback:
- code.claude.com/docs/en/mcp, "Use pre-configured OAuth credentials":
  register http://localhost:PORT/callback; --callback-port fixes the
  port to match it. Its version note says 2.1.229 sent 127.0.0.1 and
  servers that match the registered URL exactly refused the sign-in,
  so 2.1.231 went back to localhost.
- The installed Claude Code 2.1.296 binary builds
  `http://localhost:${n}/callback` (default port 3118 / a random
  free one, MCP_OAUTH_CALLBACK_PORT) and listens on 127.0.0.1 only.
So an app registered for Claude Code at an exact-match server was
refused by magpie. StartWith now sends localhost for a user's own app
and still listens on 127.0.0.1 alone, as Claude Code does, so the hosts
don't differ and the editor needs no note. magpie's own dynamic
registration keeps 127.0.0.1 (it registers that URL itself).

The no-registration error, the editor's hint (now
http://localhost[:port]/callback), its zh/zh-TW/ja/de translations,
the OAuthApp comment and docs/subsystems/library.md say localhost.

Run:
- New TestAppMadeForClaudeCode: the GitHub-shaped fake matching one
  exact registered URL http://localhost:<port>/callback, at authorize
  and at the token request. With the old mcpauth.go it fails (as do
  the three GitHub tests now asserting localhost); with the fix all
  pass. go test -race ./internal/mcpauth/...
- go test -tags nogui ./internal/library ./internal/gui
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
- GUI mcp-oauth-app (Chromium+WebKit, 1100/390, en zh zh-TW ja de,
  22/22) and i18n-keys; with the hint's old 127.0.0.1 put back by hand,
  mcp-oauth-app goes red (0/11 Chromium).

Not run: a real sign-in with a real OAuth app (none to use). GitHub's
docs say a loopback redirect needn't match the registered port but
don't say whether that holds for localhost as it does for 127.0.0.1;
if GitHub wants the port, the user sets Callback port and registers
http://localhost:<port>/callback, as Claude Code's docs also say.
2026-10-13 04:01:32 +08:00
yetone 05ef7bcec7 gateway: Cursor's built-in shows the model a tool's images, in the message after its results (#1861)
Found while checking every translation of a tool's images for #1861.
cursorMessages wrote a tool result's text alone, so an image Codex's
view_image (or any tool) returned never reached a model behind the
Cursor built-in. Cursor's plugin already gets it, since magpie hands it
a Chat body (seeLater: the result says the image follows, and a user
message after the results carries it).

The built-in now does the same: a result with images says
"[The tool returned an image; it follows in the next message.]", and a
user message after the results holds "[From the result of <name> (tool
call <id>):]" and each image as Cursor's image block (cursorImage, the
same block a user's own image already used). gateway-routing.md names
Cursor among the translations.

TestCodexToolImageCursor, from codex-rs 0.162's view_image output, fails
on the old cursor.go and passes now.

Run: gofmt -l; go vet darwin, linux -tags nogui, windows on
internal/gateway; go test -tags nogui ./internal/gateway
./internal/provider (sandbox HOME, ok).
Not tried: a real Cursor account. Whether Cursor's backend shows the
model an image in a user message that follows tool results is taken from
how it takes a user's own image, not seen.
2026-10-13 04:00:57 +08:00
yetone 285e17b061 provider: a moved Kiro shows the model a tool's images, Codex's view_image among them (#1861)
simonsmh (v0.1.1215) saw Codex's view_image and screenshot results come
back empty on a Kiro subscription. magpie hands Kiro's plugin an Anthropic
body whose tool_result holds the image as a base64 image block, but the
plugin (@magpie-community/opencode-kiro-auth up to 0.1.8) read only a
tool_result's text, so the image was dropped and the model was told
"(no output)". #369 had fixed this in the built-in for Claude Code; the
plugin never got it.

Kiro plugin 0.1.9 (magpie-community/plugins 66facac) sends a tool's images
with the userInputMessage that answers the call, latest images only, as
the built-in does. This raises the mover's min to 0.1.9, so
keepMovedCurrent updates every moved user.

tool_images_1861_test.go builds the request from what codex-rs 0.162
sends (FunctionCallOutputContentItem, view_image's input_image data: URL
with detail "high") and checks the handoff to the plugin (the image in
the tool_result, bytes intact) and the built-in Kiro body. Both pass on
the old code too: the bug was in the plugin, whose tool-images.test.mjs
fails 3 of 4 on 0.1.8. gateway-routing.md says how a tool's images reach
the model on each translation.

Run: gofmt -l; go vet darwin, linux -tags nogui, windows on
internal/gateway and internal/provider; go test -tags nogui
./internal/gateway ./internal/provider (sandbox HOME, ok); the plugin's
bun test (1152 pass) and scripts/check.mjs; npm view on
registry.npmjs.org shows 0.1.9.
Not tried: a real Kiro account, or real Codex against it.
2026-10-13 04:00:56 +08:00
yetone 3869b0a27c gui tests: searcher-pick wheels down to the web search row, which Image recognition's MCP address put past the window's foot (#1745)
Cause: 6c1c0a747. It made image recognition an MCP server of magpie's
own, and added its address row (#visionMcpRow) to Settings › Models.
That is intended. In the "search help preserves ellipsis and hover
titles" case, the row pushes the web search row past the window's foot.
The app puts back Playwright's own scroll, so in WebKit the hover times
out in en, ja and de. Bisected with the test: green on 6c1c0a747^, red
from 6c1c0a747.

Change: wheel to the row's searcher button with reader.cjs's reach
before the hover. The assertions on the help's ellipsis and titles are
unchanged.

Run (playwright 1.62.0, alone):
- On origin/main 31c1e3ab1: 6/6 in chromium and webkit. Before: 3/6 in
  webkit.
- Rebased on accc8c090, which adds searcher-pick's failed-searcher cases
  (50adf78e6, which also names this red as #1745): 11/11 in both engines.
  The other seven of #1672's files and text-size were rerun on that head
  in both engines too, all green: gui-ja, routing-sessions, pick-skills,
  routing-group-fold, library-mcp-tools, profile-in-use.
Not run: the full GUI suite.
2026-10-13 03:54:48 +08:00
yetone cce4960bd3 gui tests: profile-in-use wheels down to the profile chips and Apply, which the Get started card put past the window's foot (#1853)
Cause: 3e88fc09d. Its diff also brought in the Get started card (per
#1825), which is intended. In profile-in-use's window case (1100 wide,
460 high) the card pushes the profile chips and the detail's Apply past
the window's foot. The app puts back Playwright's own scroll, so in
WebKit "<footer class=foot> intercepts pointer events" until the click
times out. Bisected with the test: green on 3e88fc09d^, red from
3e88fc09d.

Change: wheel to the chip and then to Apply with reader.cjs's reach
before each click. The assertions are unchanged.

Run (worktree on origin/main 31c1e3ab1, playwright 1.62.0, alone):
11/11 in chromium and webkit. Before: 5/11 in webkit.
Not run: the full GUI suite.
2026-10-13 03:54:48 +08:00
yetone b7df1b7c6d gui tests: library-mcp-tools wheels down to Check again, which the Hooks tab put under the window's foot at 420 in German
Cause: e3a497d7a (Hooks, a fifth Library category). It is intended,
since Hooks were asked for (#1790). The new tab adds a row to the
Library's head at 420 points wide in German, which pushes the tool
list's Check again button under the window's foot. The app puts back
Playwright's own scroll, as any scroll that isn't the reader's, so in
WebKit the click times out. Bisected with the test: green on
e3a497d7a^, red from e3a497d7a.

Change: wheel to the button with reader.cjs's reach before the test
reads the scroll and presses it. The test's assertions are unchanged:
the list stays and the scroll doesn't move while it checks.

Run (worktree on origin/main 31c1e3ab1, playwright 1.62.0, alone):
10/10 in chromium and webkit. Before: 9/10 in webkit.
Not run: the full GUI suite.
2026-10-13 03:54:48 +08:00
yetone 94aa793db0 gui tests: routing-sessions, pick-skills and routing-group-fold wheel to the control they press, as the reader would, since the sidebar moved it out of sight or under a bar (#1672)
Cause: 18e82adc6 (the sidebar). From 1024 points wide the page sits
beside the sidebar, and a width change lets go of what the last click
held (heldWidth). Both are intended: a sidebar like a Mac app's, and a
relayout isn't the click's doing. That commit updated the tests whose
window is 1024+, but missed these three. Each now presses a control that
is out of sight or under a bar:
- routing-sessions ("background memory groups"): after the resize from
  1100 to 560, By request is at y=902 in an 800px window, with scrollTop
  0. Before 18e82adc6 the click's hold kept scrollTop at 296, and the
  button was at y=606.
- pick-skills: pdf's row is at 683-750. That is partly under the sticky
  bar Select brings up (664-712), and the view ends at 732. Before, the
  row was wholly below the view (715-782), and Playwright scrolled it.
- routing-group-fold: with the pool open, the Team and Big folds are
  under the window's foot (en, ja, de).
The app puts back any scroll that isn't the reader's, Playwright's
included. Playwright doesn't scroll a control that is partly in sight at
all. So in WebKit the click waits ("element is outside of the viewport",
"<footer class=foot> intercepts pointer events") until it times out.
Chromium gets through some of these by a few pixels.

Change: reader.cjs gets reach(page, locator). It is inView for any
page: it wheels the control's own .view until the control is wholly
inside it and elementFromPoint at its centre is the control. The three
tests call it before those clicks. Nothing is loosened: every assertion
is unchanged, and the press is still a real click on the control.

Run (worktree on origin/main 31c1e3ab1, playwright 1.62.0, each file
alone):
- routing-sessions: 19/19 in both engines. Before: 18/19 in WebKit.
- pick-skills: 3/3 in both. Before: 0/3 in WebKit.
- routing-group-fold: 20/20 in both. Before: 17/20 in WebKit.
- The bisect for each lands on 18e82adc6.
- inView and every other export of reader.cjs is unchanged. The 37
  resize/scroll files, several of which use inView, are green apart
  from #1863, which fails on 31c1e3ab1 too.

Not run: the full GUI suite.
2026-10-13 03:54:48 +08:00
yetone d01635797a gui: a window made wider or narrower keeps the reader where they were, or at the foot, while the page is laid out again, so Settings no longer ends 6px short of its foot across the sidebar's width in WebKit (#1672)
Cause: 18e82adc6 (the sidebar) added heldWidth, which lets go of what the
last click held when the window's width changes. Before it, the held
click's ResizeObserver followed the page as it grew back. text-size's
#911 case scrolls Settings to its foot and then resizes the window
across SIDE_AT (960 to 1440). In WebKit the scroll is clamped to each
layout the page passes through:
1. scrollTop goes from 120 to 46 on the resize;
2. after the side-nav swap the max is 10, so scrollTop is 10;
3. about 40ms later a part grows 6px (max 16), but nothing moves the
   scroll back.
So the page ends 6px short of its foot, and 3 of text-size's 11 subtests
fail in WebKit, run alone.

Change: on a width change, for a second, a ResizeObserver on the open
view's parts calls backToReader. The reader's own place (readerAt, still
120) is kept, or as far down as the page now goes. It doesn't act while a
click holds the page or while a purposeful scroll runs. Calling
backToReader at the end of layoutNav was tried first and didn't help,
because the growth comes after it. docs/subsystems/gui-shell.md says so.

Run (worktree on origin/main 31c1e3ab1, playwright 1.62.0, chromium-1234
and webkit-2336, each file alone):
- text-size: 11/11 in WebKit, repeated, and 11/11 in Chromium.
  Without the change 3 of 11 fail in WebKit, as on 31c1e3ab1.
- 37 files that resize the window and check scroll, or are the
  sidebar's: agent-update-all, cli-update, click-scroll, menu-scroll,
  panel-usage, sidebar*, side-toggle, sidebar-tab-top, phone-web,
  header-zoom-fit, usage-*, settings-groups and others. In both engines,
  4 at a time: 73 of 74 green.
  The one red is sidebar-overlay-scrollbar in chromium ("dragged to the
  end: 162 of 191"). It fails 1 run in 3 alone on unchanged 31c1e3ab1
  too, so it is filed as #1863.
- Under parallel load, text-size's "zh, dark: nothing runs off the side
  at 150%" sometimes fails on 31c1e3ab1 too ("ResizeObserver loop
  completed with undelivered notifications", 2 of 4 runs), and once with
  this change ("element not stable"). It passes 3/3 alone and 3/3 in
  parallel with the change. Noted on #1672.

Not run: the Windows and Linux apps, and the full GUI suite. No Go code
changed.
2026-10-13 03:54:48 +08:00
yetone def3a41e36 usage, gui: a Codex turn of one call is measured only over a second and 100 tokens after its first token, else told as the least it wrote over the whole turn (Fallmonkey on Discord)
Fallmonkey's repro: a Codex turn whose first token came at 6.8 s (the
model working) and the rest 0.2 s later in one network push read as
thousands of tok/s from its session file. The promised rule, now in:

- A Codex turn of one call read from its session file (source "log",
  turn TTFT known) tells a measured speed only when the window after its
  first token is 1 s or more and its body 100 tokens or more
  (usage.CodexWindowMs, CodexBodyTokens; Row.Decode, app.js ledDecode).
- The floor from e5b82cf38 for such a turn that reasoned (its answer over
  the time after the first token, "②") is held to the same threshold:
  827 ms after a 10.2 s first token no longer reads ≥329, as that window
  can be one push too.
- A turn that tells neither tells its output over the whole turn
  (Row.Floor, ledFloor_ "turn"), the wait in it, of any size: everything
  it wrote was written in that time, so it is a true floor. 380 tokens in
  6.8 + 0.2 s read ≥54 tok/s. Its tooltip says the whole turn was used and
  why, with the time after the first token (new string in en, zh, zh-TW,
  ja, de).

Gateway rows and other agents' rows keep DecodeOf as before; Codex calls
in turns of several keep the 1,000-token rule. The ledger's period sum
now adds each row after it is built (Totals.addFrom) so it uses
Row.Decode too. docs/reference.md says the rule.

Tests: TestCodexTurnMeasuredOnlyOverASecondAndAHundredTokens (new: 380
over 0.2 s after 6.8 s, 60 over 2 s, the 1 s/100 edges, gateway and
Claude rows unchanged, group, ledgerWith sum, Part) and
TestCodexRowsTellAFloor (updated cases) fail on the old ledger.go and
usage.go; the sum check fails with only the ledger closure reverted.
usage-speed-count.test.cjs: the 496/224 row now ≥45 with the whole-turn
tooltip, a 1,000-token answer over 10 s ≥100, Fallmonkey's row ≥54;
fails on the old app.js.

Ran: go test -tags nogui ./internal/usage ./internal/gui ./internal/cli;
gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
internal/usage and internal/gui; 50 GUI suites (usage-*, ledger-*,
reasoning-speed, routing-burst-speed, routing-request-metrics,
panel-usage, gui-de/ja/zh-tw, i18n-keys) in Chromium and WebKit: 506/507,
the one red usage-sum-whole chromium ja at 780px under load, reproduced
on origin/main 5c82e6880 and filed as #1864. On copies of the owner's
recent Codex rollouts (955 calls), 2 were turns of one call; one, 13
tokens 315 ms after a 4.3 s first token, moves from 41 tok/s to a floor.
Not tried with Fallmonkey's own sessions.
2026-10-13 03:51:38 +08:00
yetoneandEdward4226 da085e3f78 gateway: joinToolRuns leaves the model's own step and every call-carrying item in place, and a result written before its call opens no run (#1752, #1822)
What: follow-up to Edward4226's joinToolRuns (previous commit), after review
against Codex rust-v0.162.1 and the code around it.

- An item carrying a call_id is never moved, whatever its type. Before, only
  function_call/custom_tool_call/tool_search_call counted as calls, so a
  local_shell_call (or any call type Codex adds) inside a run was moved after
  results, its own output's among them.
- Before the run's first result, what the model wrote between its own calls
  (reasoning, assistant text, a hosted tool's call) stays where it is. Before,
  [call_a, reasoning, call_b, out_a, out_b] sent the reasoning after the
  results, where it reads as the next step's: DeepSeek, whose step must lead
  with its reasoning (reasonFirst, f4cc7459), would get a step that isn't.
  Anything else there (a subagent's agent_message, a note) still moves after
  the run, so TestGrokGetsAgentMessageAsUser's expectation from the previous
  commit stands.
- A call opens a run only when a result after it answers it. Before, a result
  written before its call (an odd replay) left the run open for the rest of
  the request, and every later message was moved to its end.

Where it happens, checked in Codex's source: prepare_response_items
(core/src/image_preparation.rs) pushes the developer <image_resize_notice>
right after each function_call_output / custom_tool_call_output whose image
it resized, so a batch of two image results has it between them, as #1822's
rollout shows (lines 347-349).

Routes: joinToolRuns sits in attempt before every destination, so the
Responses relay, plugins (relayed through passthrough) and translations all
get it. Translations rebuilt the order themselves for a developer or user
item (the developer one is lifted into the system prompt, user turns merge
and results go first), but an assistant message between two results closed
the chat exchange: pairToolMessages answered the second call with the
synthetic "unavailable" result and sent the real one as user text
(TestTranslatedToolRunKeepsItsRealResults, red without the call site).

Docs: gateway-routing.md says what attempt mends in a Responses request's
tool exchanges (joinToolRuns, orphanedToolOutputs, pairToolItems).

Run:
- TestRelayedCodexImageBatchKeepsItsResultsTogether (#1822's call ids, two
  view_image results, the notice between; the fake answers DeepSeek's "No
  tool output found for tool call …") and TestTranslatedToolRunKeepsItsRealResults
  fail with the call site removed (400 / synthetic result) and pass with it.
  TestJoinToolRunsOnlyMovesWhatBreaksARun fails on the previous commit's
  joinToolRuns (reasoning moved, local_shell_call moved, a request rewritten
  for a result before its call) and passes now.
- go test -tags nogui -count=1 ./internal/gateway/ under a sandbox HOME with
  a private GOCACHE: ok (376s). gofmt -l: nothing. go vet (darwin),
  GOOS=linux go vet -tags nogui, GOOS=windows go vet on ./internal/gateway/:
  clean.
- Real DeepSeek (api.deepseek.com/v1/responses, deepseek-v4-flash), direct:
  a developer note between the two results 400 "No tool output found for
  tool call call_01_x2"; the same note after the results 200. Through a
  sandbox magpie (own HOME, :3591, only the deepseek provider), streamed and
  whole: origin/main's build 400 with that refusal, this build 200. The
  <image_resize_notice> text itself between the results is answered 200 by
  DeepSeek directly, before and after, with text results.

Not tried: OpenCode Go (this account's workspace isn't set to Global
regions, so every request there is refused before the model); the
reporter's image results and full-length history; Volcengine; a real Grok
subscription for the agent_message's new place.

Co-authored-by: Edward4226 <234070868+Edward4226@users.noreply.github.com>
2026-10-13 03:49:32 +08:00
Edward4226 5b7112fe2f gateway: an item a batch's tool results were interrupted by goes after them, so strict Responses upstreams stop refusing the relayed request
What: the normalization a relayed Responses request goes through before it
leaves (gateway.go, attempt) gains joinToolRuns beside orphanedToolOutputs
and pairToolItems: an item that sits inside a run of tool calls and results
- between a call and the result that answers it - is moved to the end of
that run. A run is open while one of its calls has been seen and the result
answering it is still ahead, so an item between two whole exchanges stays
where it is. Codex writes such an item itself: when a tool returned an
image it resized, its <image_resize_notice> goes between one batch's two
results (the report from the Codex app on Windows, one assistant step with
view_image and exec_command).

Before, the run reached the upstream with the item inside it and a strict
one refused the whole request with 400: Volcengine's Agent Plan "An
assistant message with 'tool_calls' must be followed by tool messages
responding to each 'tool_call_id'", OpenCode Zen/Go "No tool output found
for tool call <id>" - both naming a result that is in the request. After,
the results follow the calls, the item goes after them, and both answer
200. This is the rule the chat path has had since #1275 (pairToolMessages
closes a run with its results, interrupted ones included, before another
message) and the same family as #1341 (pairToolItems, a call nothing
answers), and it is applied before the request is relayed or translated,
so every destination whose own form is strict gets it in the same change.

The item's own bytes, its role and its order among the other non-tool items
are as they were. A request with no tool items, one whose exchanges are each
whole, and a body that is not a Responses request come back byte for byte
(TestJoinToolRunsLeavesWholeExchangesAlone). One expectation changed on
purpose: TestGrokGetsAgentMessageAsUser's turn holds a subagent's reply
between the send_message call and its output, and Grok is now given that
reply after the run. Its conversion is unchanged (same user message, same
"From <author> to <recipient>" header, same text and images) and only its
place moved, the way every other item Grok is handed keeps the place magpie
gave it; a review that knows Grok's backend needs the reply in place can
narrow the rule to messages other than agent_message.

Run:
- go test -tags nogui ./internal/gateway/: 2 failures, both red on
  origin/main 6c1c0a7 as well and neither from this change -
  TestClaudeAsRootEnv (a Linux-only expectation with no Windows guard) and
  TestSweepBridgeProjectsTakesOnlyTheBridgesFolders (needs a symlink
  privilege this Windows box doesn't hold). Everything else passes,
  TestQueuedStreamKeptAliveOnceSentToItsVendor among them (that one failed
  once on main under load; it is the queued-stream timing in the standards).
- the same run under a temporary HOME with GOPATH/GOMODCACHE/GOCACHE pinned
  from go env: the same two failures.
- gofmt -l on the four changed files: nothing. go vet ./..., GOOS=linux go
  vet -tags nogui ./..., GOOS=windows go vet ./...: clean. go build,
  GOOS=windows go build, GOOS=linux go build -tags nogui: ok.
- without the change: with the one call-site line taken out,
  TestResponsesRelayKeepsAToolRunTogether prints
  `status 400: ... "Fake: An assistant message with 'tool_calls' must be
  followed by tool messages responding to each 'tool_call_id'."`; the line
  back, it passes.
- real upstreams, the reporter's shape (two parallel calls, an image
  result, Codex's <image_resize_notice>, the second result), the same build
  with the line and without it, streamed the way Codex sends it:
  Volcengine Agent Plan / deepseek-v4.1-flash - run whole 200/200; the
  notice between the results 400 "insufficient tool messages following
  tool_calls message" then 200; any other note there 400 then 200.
  OpenCode Zen/Go / deepseek-v4.1-flash - run whole 200/200; a note between
  the results 400 "No tool output found for tool call call_b" then 200; the
  notice between them 200/200, their gateway recognizing that one item.
- the reporter's own rebuilt turn (1399 items, from their rollout) to
  Volcengine: refused "insufficient tool messages following tool_calls
  message" without the change, past that check with it (what is left is the
  input's length, 1.7M tokens, over the model's limit).

Not tried: a real Grok subscription - the reply's new place is unverified
against xAI's backend, though its conversion is unchanged and its plugin
(community plugins packages/grok) converts in place the same way; a real
ChatGPT (native Codex account) destination, which takes standalone tool
outputs itself and is left as it came; the Windows GUI. The OpenCode Zen/Go
400 of the original report is not reproduced by the reporter's own bytes:
with both results and the notice between them that gateway answers 200
before and after this change, so the report's refusal may be the follow-up
body assembled before the batch's last output was in it
(openai/codex#44604).

Refs: #1341, #1275. Reported as anomalyco/opencode#54698 and
openai/codex#44604.
2026-10-13 03:49:32 +08:00
yetone accc8c0903 library: an MCP server whose sign-in has no client registration (GitHub's) is signed in to as the user's own OAuth app (新v学员 on Discord)
What changed: GitHub's remote MCP server (api.githubcopilot.com/mcp/)
points to https://github.com/login/oauth, whose metadata has no
registration_endpoint, so magpie's sign-in, which always registered
itself (DCR), could never sign in to it. A server now carries an
optional OAuth app, `oauth: {clientId, clientSecret, callbackPort}`,
Claude Code's names for --client-id/--client-secret/--callback-port
(oauth.clientId in its .claude.json). mcpauth.StartWith signs in as
that app without registering: PKCE S256, a loopback callback
http://127.0.0.1:<port>/callback (any port unless callbackPort is set),
client_secret_post with a secret (basic only when the server lists
basic alone), "none" without one.

Without an app, a server with no registration endpoint now fails with
mcpauth.ErrNoRegistration, which says to make an OAuth app with the
vendor (GitHub's under Settings > Developer settings > OAuth Apps, with
http://127.0.0.1/callback) and give it under "OAuth app" in the editor.
The editor opens those fields with Client ID focused when that error
comes back. Filling them makes Sign in read "Save and sign in", and
Cancel asks before dropping them, as the earlier Cancel fix does.

GitHub answers token errors with 200 and {"error": ...}; tokenRequest
now reads a 2xx body with `error` as the error, and bad_refresh_token /
incorrect_client_credentials count as a dead sign-in as
invalid_grant/invalid_client do.

Secrets: the client secret sits in library.json like header and env
values. A backup without keys blanks it; WithSecrets puts this
computer's secret back only for the same client ID. No agent file is
given the app. The TUI editor, which doesn't show it, keeps it on save.
check() keeps it only on an HTTP server, requires a client ID when a
secret or port is given, and a port 1-65535.

Run (worktree at 98b5a02d1 + the two earlier commits):
- go test -race ./internal/mcpauth/... (new github_app_test.go: an
  httptest fake built from GitHub's real PRM and AS metadata bytes:
  no app -> ErrNoRegistration, sign-in as the app, wrong secret, fixed
  callback port, bad refresh token)
- go test -tags nogui ./internal/library ./internal/tui ./internal/gui;
  go test ./internal/gateway -run MCP
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
- GUI, Chromium and WebKit, 1100/390, en zh zh-TW ja de:
  mcp-oauth-app (new, 22/22), mcp-editor-cancel, mcp-signin,
  mcp-signin-health, library-mcp-health, i18n-keys - all pass
- Broken by hand, each went red: no 2xx error parse, GitHub codes out
  of dead(), app ignored in StartWith, secret not blanked / not matched
  by client ID in carry, check() without the non-HTTP rule; in the GUI,
  oauth left out of the save, and the failed hook not opening the fields.
- Sandbox HOME, rebuilt magpie web, against the real GitHub server:
  Sign in showed the new error and opened the fields; Save and sign in
  saved the app and produced a real github.com/login/oauth/authorize
  URL with the app's client_id, S256 and a 127.0.0.1 redirect, which
  GitHub answered with its login page. .claude.json didn't hold the app.

Not run: a real GitHub sign-in to completion. There's no real OAuth app
to use, and I didn't make one on the owner's account. Claude Code's
callback says localhost where magpie's says 127.0.0.1, so an app made
for Claude Code needs its callback URL changed; that isn't bridged.
2026-10-13 03:43:05 +08:00