From 708ae4144afb730e28bc7b3ba33ce9b0b98fd521 Mon Sep 17 00:00:00 2001 From: Evan Wang <63033114+milude-kent@users.noreply.github.com> Date: Tue, 13 Oct 2026 09:02:42 +0800 Subject: [PATCH] gui: add optional SOCKS5 proxy credentials (#852) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gui tests: market-have waits for the market's answer, not 2s, before looking for a mark (#1631) "a server added by hand is marked added" timed out under the full suite. The mark comes after two reads in a row: the change's answer, then the market asked again (take() -> fetchMarket). Holding those answers in the test showed nothing is dropped: with the save, the library and the market each held 0 to 1200ms the mark always came, at about the sum of the holds. The 2s bound on the whole was the busy machine's to miss: with the save and the market each held 1200ms the old test failed in both engines. Each of the three steps now waits for the market's answer that follows its change (10s, the page's 5s for each of the two reads), then for the mark with the page's own timeout. What the test checks is that the mark comes with no focus (still asserted), not how fast. Run: the save, library and market each held 0, 1200 and 3000ms: 8/8 green in Chromium and WebKit each time. Broken by hand (take() no longer asks the market again): all three steps red, 8 of 8. 20/20 green in WebKit and 20/20 in Chromium. * gui tests: privacy-hides-accounts scrolls to Hide accounts as a reader does, and usage-stale-answer lifts quotasOpened with loadUsage (#1632) Both were red on origin/main when run alone; each had its own cause. privacy-hides-accounts (WebKit, every run): since Settings' search box (51042630e; the test passes on its parent and fails on it) the Hide accounts row sits under the window's foot at 900x760. Playwright scrolls it into view by code, and the click guard puts a scroll that isn't the reader's back (a scrollIntoView from the page: 0 -> 38 -> 0 in both engines); WebKit's click came after the put-back and hit the foot. Nothing a reader meets: they scroll with the wheel. The test now wheels the settings view until the row is clear of the foot, waits for the scroll to settle, and checks the click doesn't move the view's own scrollTop (it read window.scrollY, which is always 0 here, so "a click never scrolls" checked nothing). usage-stale-answer (every run): since #1588 (917a36577) loadUsage(asked) calls quotasOpened(), which the test's faked page didn't have, so the asked read threw before it read anything ([] for [true]). The test now lifts quotasOpened and QUOTAS_OPEN_GAP from app.js with loadUsage, in both of its pages. Broken by hand (loadUsage no longer opening the allowances when asked): red again. Run: privacy-hides-accounts 20/20 green in WebKit and 20/20 in Chromium; usage-stale-answer 20/20; the other browserless GUI tests pass. * gui tests: routing-side-calls measures a row once Routing's groups are in and the row has stayed put (#1640) "a title and magpie's web search say what they were" failed with "picking the request moved the row" in Chromium, now and then alone and often under load. The row hadn't moved because of the click: it was measured before the page was done. Recorded frame by frame, the day's list draws at one frame and the part above it grows on a later one (rt 271 -> 428px), while the click guard scrolls to hold the day that was clicked (scrollTop 0 -> 176), so the rows move 444 -> 424 before any row is clicked. The test measured "was" between the two. Holding Routing's groups answer (/api/groups) 300, 600 or 1000ms makes the old test fail in most runs (7 of 9 runs red); that is what landed late. The test now waits for the first groups answer and for the row to stay put for 10 frames before measuring. Nothing a reader sees changes: the clicked day stays where it was, as the click guard means it to. Run: with groups held 600 and 2500ms the fixed test is green every run (3 runs each); 20/20 green in WebKit and 20/20 in Chromium. * gui: a Sessions figure never wraps, so picking a project no longer moves the page In Chinese at a 142pt tile (a 1100pt window beside the sidebar, or an 888pt one without it) "139 小时 27 分" broke onto a second line. Picking a project shortened it to "4 小时 28 分", the row of figures lost 23pt and everything under it moved up under the pointer. - .kpi b keeps to one line (ellipsis and a title as the last resort). - The active time's units are drawn smaller and muted, as the Health app draws "h" and "min", so the figure fits. - The six figures go to three columns under 960pt of pane, not 820pt. Run: sessions-overview (28/0) in Chromium and WebKit; before this it failed at the project bar (505.8 vs 528.8) on main with the sidebar and on d4eae3618 minus the sidebar at 888pt. number-units, usage-speed, usage-speed-count, usage-refresh, usage-refresh-flight and usage-ttft-rounding pass in both engines; go test ./internal/gui/ ok. Screenshots of the tiles in en and zh at 1100 and 1400 looked right. * gui tests: the sidebar's room 18e82adc6 shows the sidebar from 1024pt, so the window's pages are 212pt narrower and start at x=212. Eight files assumed the old room: - header-centre measures the tabs' gap from the layout button. - phone-web's desktop browser at 1000pt, under the sidebar's width. - routing-pause and routing-pointer-pin wheel over the view, not the sidebar at x<212. - routing-scroll-end takes its columns from .rt-more's own width (routing.js byWidth); usage-pack opens at 1512 to keep 1300 of room. - purpose-filter closes the menu by a scroll that ends at the view's top, and measures once the rows and scroll are at rest. - sessions-overview scrolls the shape card no further than a third down, and waits a frame after a resize: WebKit starts the reduced-motion transition of the sidebar's padding and settles it in the next frame. Run: all eight, plus sidebar, side-toggle, session-identity and usage-ledger, pass in Chromium and WebKit; each failed with 18e82adc6 and passed on d4eae3618 with it reverted. * agent tests: the sandbox home holds XDG_DATA_HOME and XDG_STATE_HOME too, so Grok App's drift test passes on Linux (#1668) codexHome, the helper TestDriftUnwiredEveryAgent and others start from, pointed HOME, XDG_CONFIG_HOME and XDG_CACHE_HOME at the test's home but left XDG_DATA_HOME at testenv's. On Linux grokAppDir (ee7a9b24a) reads $XDG_DATA_HOME/grok-app, so the App's config was written outside the home the test walks, its base_url never swapped, and no drift showed: "applied_test.go:219: unwired: " on ubuntu CI (run 38162553532). Run: with grokAppOS forced to "linux" in a throwaway file, the test fails exactly so without this and passes with it. go test ./internal/agent/ ok on macOS; gofmt clean; GOOS=linux and GOOS=windows go vet ok. * provider, plugin: a subscription's sign-in goes through the proxy its account's requests use, not always the global one (#1663, demystify0137) What changed: every sign-in started in magpie now leaves through the account's own proxy (ProxyOfLogin: the account's, else the subscription's, else the global one). Before, the sign-in's token exchange and checks went through the global proxy while the account's later refresh and usage calls went through its own (ViaLogin), so the vendor saw one account come from two exits. - signin.go: SignInOptions{Site, Proxy, User}, StartSignInWith; the flow picks its proxy (pickProxy, validated with settings.CheckProxy) and every request goes through s.via. Each built-in sign-in (Claude, Codex/ChatGPT, Grok, Zed, WorkBuddy, Copilot, ZCode, Factory, MiMo, Qoder, Command Code, Kiro) uses s.via; Claude Code's own login gets the proxy as *_PROXY (netproxy.EnvWith). - proxy.go keepSignInProxy: a proxy picked for the sign-in is kept as the subscription's when the account is its only one, else as that account's own entry. "" (global) is refused while the subscription has a proxy and other accounts, since nothing could keep it. - plugin host: authorize and callback run under via.run(proxy), so a plugin's sign-in fetches go through the same proxy; plugins_cli.go does the same for `magpie plugins login`. PluginAPIKey goes through Via. - gui: POST /api/signin and /api/plugin-signin take proxy and user. What was run: - go test -tags nogui ./... (sandbox HOME), all packages ok. - gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui on the touched packages. - Red without the change (each broken by hand, then restored): TestSignInGoesThroughItsProxy, TestDeviceSignInGoesThroughItsProxy, TestPluginSignInGoesThroughItsProxy, TestClaudeSignInGoesThroughItsProxy (internal/provider) and TestPluginSignInProxy (internal/plugin) each fail with the s.via / EnvWith / via.run / keepSignInProxy removed. Not tried: a real vendor account through a real proxy. The browser's own leg of an OAuth sign-in goes through the browser's network, not magpie's. Devin's CLI probes still use the global proxy. * gui: the sign-in box shows the proxy it goes through, and another can be picked and kept as the account's (#1663, demystify0137) What changed: while a sign-in waits (or after it failed), the box shows "Proxy: …" beside Open again. It opens the app menu (openProtoMenu, no native select) with Global (only when it could be kept), Direct, the subscription's proxy, each account's proxy and Custom…, which asks for an http://, https:// or socks5:// address. Picking one starts the sign-in again through it and cancels the open one; when it ends, the backend keeps the pick as the account's (keepSignInProxy). Userinfo in a proxy URL is never shown. "Sign in again" on an account now names that account (user), so it goes through the account's own proxy. The user and the pick are carried through the risk, site and plugin-method steps. Strings in zh, zh-TW, ja and de. docs/subsystems/providers-accounts.md describes the sign-in proxy. Why: the reporter asked that a sign-in use the subscription's or the account's proxy and be able to choose one; the default now does, and this lets the user choose and see it. What was run: - signin-proxy.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de, at 900 and 380 wide, 40/40. It fails against HEAD's app.js (no link). - The sign-in, add-sheet, plugin-signin, click-scroll, i18n-keys and gui- files: 203/203; signin-close.test.cjs updated (the acts row now also holds the proxy link). - go test -tags nogui ./... ok; gofmt; linux/windows vet. Not tried: a real vendor sign-in through a real proxy from the window. * library: a visit to the Library no longer parses Codex's config.toml again when it hasn't changed (#1665, laowangba233) laowangba233 saw magpie's CPU jump on each switch to a Library page. Profiled in a sandbox HOME with a copy of a real Codex config.toml (1.5 MB, 10,927 [projects.""] tables, one per folder Codex was ever opened in): 69% of GET /api/library's CPU was go-toml parsing that file through foundServersOf -> mcpFile.entries. go-toml's SeenTracker looks each table name up among every sibling before it, so the parse is quadratic in the number of projects, ~0.2 s of CPU each time, and the Library parsed it on every visit (edit.Read already kept the bytes, not the parse). mcpFile.entries now keeps what it parsed through filememo, keyed by the file's size and time (and, written in the last two seconds, its bytes), and hands each caller a deep copy of the servers it found, so a caller changing an entry doesn't change the next caller's. The RTK page's codexSandbox (Windows, Codex with rtk on) parsed the same file the same way on each visit and is kept the same way. Measured (sandbox HOME, the copied config and library, macOS, 10 warm GET /api/library after start): 2.67 s of CPU before, 0.55 s after (~0.27 s -> ~0.055 s a visit). TestCodexEntriesParsedOncePerChange: a config with 2000 projects read four times parses once, a caller's change to the entries doesn't reach the next, a change to the file is read, a file gone is no servers. It fails with the memo undone (entries parsing edit.Read's bytes each time) and with the copy undone. go test -tags nogui ./internal/library ./internal/filememo pass; TestCodexSandbox passes. The RTK memo has no test of its own (Windows only); filememo's own tests cover the keep. * sessions: a visit to Sessions no longer parses Codex's config.toml again when it hasn't changed (#1665, laowangba233) Profiled for laowangba233's report of CPU jumping on page switches: in a sandbox HOME with a copy of a real Codex config.toml (10,927 [projects.""] tables), 67% of GET /api/sessions/manage's CPU was go-toml parsing config.toml in readCodexConfig, for the provider Codex uses now (codexProviders -> CodexProviderIn). go-toml checks each table name against every sibling before it, so a file with that many projects takes ~0.2 s to parse, and it was parsed on every visit. readCodexConfig now keeps the parse through filememo, keyed by the file's size and time (and its bytes while it is less than two seconds old). Its callers only read the struct. Measured (sandbox HOME, 8.9 GB of copied sessions, macOS, 10 warm GET /api/sessions/manage after start): 3.00 s of CPU before, 0.94 s after (~0.30 s -> ~0.09 s a visit). TestCodexConfigParsedOncePerChange rewrites config.toml with the same size and time and expects the first parse; a real change is read. It fails with the memo undone. go test -tags nogui ./internal/sessions passes. * sessions: the warm-up at start reads with a quarter of the cores unless a page waits, and a long first read keeps what it read (#1665, laowangba233) #1665: magpie pegs the CPU on every start (Windows Task Manager showed 95.8%). Three seconds after start, warmSessions indexes every Claude/Codex session file and reads every file's calls for usage. refresh() ran min(max(8, 2*NumCPU), 32) parsers at once and usage's prefetch 8 more, so the background warm-up took every core while nobody was looking at the result. Two goals, in one commit because they touch the same loop in refresh(): 1. Quiet warm-up (quiet.go). gui's warmSessions runs inside sessions.Warm. While a warm-up runs and no request waits, every parse in refresh() and every readCalls takes one of max(1, NumCPU/4) slots. A request to /api/sessions* or /api/usage* (gui's held middleware) calls sessions.Ask(), which lifts the limit for as long as it runs, so a page the user opened isn't slowed down. A waiting reader re-checks every 50ms, so Ask takes effect mid-read. 2. Checkpoints. refresh() saved sessions.json only once all files were parsed. Quitting magpie before that (a slow machine, or the user closing it because the CPU is pegged) kept nothing, and the next start parsed every file again. Now every 5s (checkpointEvery) the files done so far are published and saved, if the cache generation still matches. Measured on a Mac (14 cores) with a sandbox HOME holding 8.9 GB of real sessions (copied read-only), sessions.json and calls-v11 removed, sampling ps every 2s: - cold start before: 41.2 CPU-s, peak 580-600%, done ~14s - cold start after: 34.7 CPU-s, peak ~300-360%, done ~16s - quit mid-index, before: quit at 6s (13.5 CPU-s spent) left no sessions.json and no calls files; the next start spent 41 CPU-s again. - quit mid-index, after: quit at 12s left a 1.3 MB sessions.json (of 3.0 MB); the next start spent 26.6 CPU-s instead of 34.7. Tests (each red with its part undone, script-checked: refresh's slot replaced by a no-op, readCalls' slot removed, the checkpoint block removed): - TestWarmReadsOnlyInItsSlots: with every slot held, neither the index nor the calls read anything for 300ms; Ask() lets both finish. - TestReadSlotOnlyWhileWarming: outside Warm, or while asked, reads don't wait. - TestLongReadKeepsWhatItRead: a read held after its 3rd file has saved sessions.json with fewer files than it has to do. Run: go test -tags nogui ./internal/sessions ./internal/gui ./internal/library ./internal/usage; gofmt -l; GOOS=linux and GOOS=windows go vet of sessions, gui, library; full go test ./... before push. Not tried: the reporter's machine or data volume; a Windows re-measure. * provider: signing out of ChatGPT and Devin's CLI checks go through the account's own proxy, as its sign-in does (#1663, demystify0137) What changed: two siblings of 3a53d06d9 still left through the global proxy, so an account's sign-out or its CLI checks came from a different exit than its sign-in and requests. - chatgpt_api.go forgetSIWCLogin: the refresh-token revoke (discovery and revocation endpoint) goes through ViaLogin for that account, read before the account is forgotten. - devin_accounts.go devinCommand: `devin auth status` and `devin models list` run with the proxy ctx names (a sign-in's), else the account's own (devinProxy: the logins.json entry for that home, the CLI's own for "", ProxyOfLogin; the subscription's for a home not kept yet), via netproxy.EnvWith, where it was netproxy.Env (global). - devin.go: askDevinStatusAt/askDevinIdentityAt/addDevinLogin take the sign-in's ctx, so the probe naming a just-signed-in account uses the proxy the sign-in goes through. askDevinIdentity had no caller left and is removed. - docs/subsystems/providers-accounts.md says so. What was run: - go test -tags nogui ./... (sandbox HOME) ok; gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on the touched packages. - New TestChatGPTSignOutGoesThroughItsProxy and TestDevinCLIGoesThroughItsProxy (internal/provider/signin_proxy_test.go). Red by hand: the revoke with context.Background() (it dials openai.invalid directly); devinCommand without devinProxy (models and status run with no proxy); askDevinStatusAt ignoring the sign-in's ctx (the new account's probe runs with the subscription's proxy, not the picked one). Not tried: a real ChatGPT or Devin account through a real proxy. Left out on purpose: a `--proxy` flag for `magpie accounts add`, and the installer's downloads (global proxy). * agent: Hermes's other bots (profiles) get magpie's provider too, and Disconnect takes it out of each (lijiho96940561 on X) Each Hermes bot is a profile at /profiles// whose config.yaml is read on its own (hermes_cli/config.py get_config_path; load_config doesn't fall back to the root's). magpie wrote providers.magpie only into $HERMES_HOME/config.yaml, so only the main bot's picker offered magpie. Now, with magpie connected, its provider entry also goes into the config.yaml of every profile Hermes lists (hermes_cli/profiles.py and hermes_constants.py, Hermes be5e9f72c): a name matching PROFILE_ID_RE, not "default", not tombstoned under profiles/.deleted/, with a config.yaml. The root follows get_default_hermes_root: ~/.hermes, or for a HERMES_HOME outside it, of /profiles/, else HERMES_HOME itself. Connecting writes it there, and each Sync refreshes it and adds it to profiles made later. Only providers.magpie is written, so each bot's own model.default/model.provider stays as its user set them. Disconnect deletes providers.magpie from every profile. In a profile whose model.provider is magpie (cloned from a connected main config, or picked in that bot), the model and provider are deleted too, so the profile isn't left naming a provider that is gone. There's no stash for those, so Hermes falls back to its defaults there. Run: go test ./... -count=1 under a scratchpad HOME (all ok); gofmt -l; go vet ./internal/agent for darwin, linux and windows. TestHermesProfiles and TestHermesProfilesOfCustomRoot fail on the old hermes.go ("coder after connect"). Fixtures follow Hermes's profile layout, read from its source. Not tried with a real Hermes running several bots; the live ~/.hermes was not touched and hermes was not run. * gateway: a 429 that says in words when it's back rests until then, in Chinese as in English (#1669, Natsumeretsu) WorkBuddy answers a frequency limit with the time it resets, in words: "将在 2026-10-11 20:16:02 UTC+8重置" and "your usage will reset at 2026-10-11 12:37:53 UTC+8, ...". resetsAt read neither (only Claude Code's "limit reached|" and ChatGPT's resets_at), so the Chinese one rested quotaRest (15 min, matched 用量) and the English one fallbackCooldown (1 min, no word list matched): the account was asked again long before it was back, refused, and benched again. - resetsWritten reads a time beside the reset phrasing (resetsWhen: "reset(s) at", 将在/将于), in the UTC/GMT offset it is written with. The offset must be followed by 重置 or punctuation, so a refusal cut after "UTC" or "UTC+" is never read as UTC; a date that isn't real, one past, or more than a week off (longestWritten) isn't read; another vendor's date in passing ("deprecated on ...", "retry after ...") is no reset. resetsAt falls back to it, so keepRetry notes it too. - failure reads such a 429 as out of quota in either language. - One that points to the account's other models ("切换其他模型", "switch to the other models") rests that model alone (restID), so the account's other models are still asked during an hours-long rest. - rateRest: a reset time the refusal names (resetsAt, or as keepRetry noted it) is believed up to longestQuota, as the quota branch does, and the trace says "resets"; a Retry-After or rate-limit reset header stays held to longestWait. Decided: the stated time is the vendor's statement of when the account is back, and how far it is believed shouldn't hang on which word list the message happened to match (8 days as quota vs 1 hour as rate for the same words); a Retry-After is generic advice and keeps the hour. The rest is the gateway's, so it holds for moved WorkBuddy users too: the plugin (packages/workbuddy 0.1.14, explained()) passes a 429 that isn't "unapproved channel"/14018 on as it came. TestPluginWrittenResetRests shows a plugin-served 429 with the reporter's refusal resting the model until the stated time. Tests: TestResetsWritten (reporter's bytes in both languages, other offsets, cut-short, garbled, past, >7 days, other vendors' dates), TestWrittenResetRestsUntilThen (both languages rest the model by "resets", noted path, cut-short falls back, other vendors' 429s unchanged), TestRateLimitBelievesItsReset, TestPluginWrittenResetRests. Broke each piece by hand (reader, classification, rate cap, model scope, offset, the terminator) and each made one of them fail. TestRateLimitBacksOffWhenItComesBack now expects "resets" for a noted reset. go test -tags nogui ./... under a temp HOME, rebased on 498b77fbc, passes but internal/provider's TestCopilotSecretToolUsername, which this doesn't touch: it is #1627 (5s secret-tool bound under load) and fails alone 3 of 5 on this head too. internal/gateway rerun after rebasing on 6ebe481f8; gofmt -l, go vet for darwin, GOOS=linux and GOOS=windows on internal/gateway. Not tried against WorkBuddy itself: its raw 429 JSON shape isn't known beyond the message (err_type 6004), and a body that escapes the Chinese as \uXXXX wouldn't be read (the reporter's classification by 用量 shows theirs isn't escaped). * gui tests: click-scroll's late wheel is looked at once the page has heard it and the reader's moment is over, not after a fixed 400ms (#1660) "a wheel the page hears of after its scroll is still the reader's" failed once in Chromium on a loaded machine. Cause: the subtest delays the app's wheel listener by 60ms (the busy page of the subtest), then waited a fixed 400ms before looking at the view, and 100ms after a scroll by code. The listener opens a 250ms moment in which scrolls are the reader's (readerScrolls(250)). That moment starts when the page hears the wheel, not when the wheel happens. When the machine ran the 60ms timer more than ~150ms late, the code's scroll that followed fell inside that moment and stood ("code's scroll is put back"). Later still, the view was looked at before the wheel was heard ("the late-heard wheel must scroll the view"). Fix: the wrapper counts the wheels the page has heard. Each wheel is looked at once the page has heard it and performance.now() has passed purposeUntil, the end of the reader's moment. The code's scroll is looked at three frames on, since it is put back at the frame it is told of. The wait of 100ms before the last wheel stays as a minimum gap: what was put back from 50ms before a wheel counts as that wheel's own (givesBack). The page is unchanged. Run (injected: the late wheel's delay raised from 60ms, the test copied to the scratchpad with only that number changed): - Before, Chromium: - 200ms: 4 of 22 cases red, "code's scroll is put back". - 500ms: 4 of 22 red, "the late-heard wheel must scroll the view". - 60ms: green. - After: - 200ms Chromium: 22 of 22. - 500ms Chromium: 22 of 22. - 500ms WebKit: 22 of 22. - Broken by hand: with givesBack left out of the wheel listener, the test is red on "the late-heard wheel must scroll the view". - A first try with no gap before the last wheel went red: the code's scroll was handed to the wheel. That is why the 100ms stays. - click-scroll.test.cjs, both engines, 20 runs: 440 of 440 cases passed, with a load average of 12 to 17. * gui tests: the 37 other Settings tests act on rows once the page has drawn its last read of the settings, as the masking-rules tests do since #1653 (#1659) Opening Settings reads the settings twice: the page's own read (showView), then the window's load() once the state is in. Each read redraws every row. A test that found a row after the first draw, and then called scrollIntoViewIfNeeded or boundingBox on it, failed when the second read landed in between. The errors were "Element is not attached", or a null box. #1653 fixed the three masking-rules tests and listed these 37 in #1659. Each of the 37 now calls watchSettingsReads(page) before every page.goto, and settingsDrawn(page) right after it. Right after goto is exact for ?view=settings: at boot, show(view) asks for showView's read before load() runs. load() sets load.done in the same run that then asks for its own read, so settingsDrawn's "load.done and every read asked for drawn" holds only once the second read is drawn. For a test opened on another page that clicks into Settings later, load is done by then, the click makes the only read, and the wait passes at once. watchSettingsReads now watches a page once, however many times it is opened, since some of these tests open one page several times. The page is unchanged. Reproduced with a generic injection (scratchpad inject1659.cjs, loaded with NODE_OPTIONS=--require). A route added at each goto holds the page's second GET /api/settings. It lets the read go just as the test calls scrollIntoViewIfNeeded or boundingBox, or waits on the page with waitForFunction (which settingsDrawn is), with a 4s timer as a backstop. This is #1653's injection, made generic. Before, injected, both engines, all languages: - 5 files red with the issue's error: - github-token: null box. - member-model-setting, searcher-pick, search-first and update-wait: "Element is not attached to the DOM". - 4 files red on a check of a row drawn from the first read: model-suffix-own, otel, readable-focus and warm-at-times. - 28 green. After, injected: 36 of the 37 files green, every held read let go by settingsDrawn's wait. otel stays red in WebKit at 360px. It is red the same way with no injection, on origin/main's own copy of the test. That cause is separate (the narrow nav laid out after setViewportSize returns) and has its own commit next. Plain (no injection), both engines, all 37 files: 460 cases passed and 2 failed, both otel's WebKit 360px check above. The 8 files red under injection before, injected again after, 5 rounds: 390 of 390 cases passed. * gui tests: otel measures its rows at each width two frames after resizing, since WebKit can still hand back the old width's layout when setViewportSize returns otel's "no overflowing controls at 360px" was red in WebKit with no change to the page, on origin/main's own copy of the test too (1 of 6 cases passed, 2 runs, at a load average near 11). #1659's injected runs first showed it. A probe at each width, run straight after setViewportSize and again two frames later, showed the cause. Going from 1100px to 520px, innerWidth is already 520 and body no longer has side-nav. But the views still start at left 212, the side nav's padding at the old width. #otelList measures 268px instead of 488px. Two frames later the views start at 0 and the list is 488px. At 360px a row then measured 106-108px instead of 320px, so its control overflowed it. The test now waits two requestAnimationFrames after each setViewportSize before measuring. The page is unchanged: a user's window is drawn at its new width by the next frame. Run (WebKit, the engine that was red): - Without the wait: 14 of 15 cases red over 5 runs, each on "no overflowing controls at 360px". - With it: 20 runs, 60 of 60 cases passed (load average 15-16). 33 other test files measure right after setViewportSize. They are filed as a follow-up, not changed here. * gateway: a Claude run its timer ended mid-reply is no longer kept idle, holding one of 6 places (#1667) A resumed turn's 30-minute timer calls abort. Fired during a reply, finish closed the run and removeRun took it out of b.idle, where it wasn't yet. The reply's last event, already in the segment, still reached the client whole, so ended was told ok and kept the closed run with keepIdle, then re-armed its timer. That timer found it closed and never took it out, so it held one of idleMost places until pushed out, and the push-out shelved a session removeRun may already have deleted. letGo's keepIdle had the same window. keepIdle now reads r.closed under b.mu and refuses an ended run, returning false; ended and letGo then return without re-arming the timer or rewinding. finish sets closed before removeRun takes b.mu, so a run is either refused here or kept and then taken out by removeRun. Tests: TestClaudeRunEndedMidReplyIsNotKeptIdle fires the run's timer (abort through removeRun) and then calls ended with a whole reply. On the old code it fails: "a run its timer ended mid-reply is kept idle (1 runs), holding a slot of 6"; it passes with the fix. TestClaudeIdle* kept closed runs only so abort did nothing; they now keep live runs, and TestClaudeIdleReplacementKeepsItsKey sets the other run at old's key directly, since keeping it there through keepIdle would end old. Run: go test -race -run 'Claude|Subscription|Idle|LetGo|Rewind' ./internal/gateway (ok); the full suite is in the next commit's body. Not tried with a real Claude Code: the window needs a 30-minute reply. * gateway: a long conversation's request costs about a third of the CPU it did, with the same bytes sent on (#1532, #1654) The gateway reads one request's body a dozen times or more on its way: modelOf, streamOf, conversationID, requestEffort, bodyEffort, walkImages and swapImageBlocks (more than once through a group), turnOf's parse, promptOf, chatToolNames, thinkingOffUnlessAsked, decodeRequest, and for Responses pairToolItems, orphanedToolOutputs, hasSealedAgentMessage and askedTier. Each read took a field or two with json.Unmarshal, which checks the whole input and then steps through every byte of every string one call at a time, so each read cost as much as decoding the whole conversation: 74-77% of a request's CPU in pprof, most of it checkValid and stateInString. decodeJSON (fastjson.go) is json.Unmarshal for these reads. It checks the body once with its own validator (json.Valid's grammar and 10000 depth, 8 string bytes at a time), splits objects and arrays at their members without decoding them, and decodes only what dst has a place for: strings, booleans, json.RawMessage (copied, as encoding/json does), structs, pointers, slices and string-keyed maps by their parts, and everything else (numbers, interfaces, types that decode themselves) by encoding/json itself. Whatever it doesn't take on exactly as json.Unmarshal would goes to json.Unmarshal with dst zeroed: invalid input, a dst already holding something, an embedded field, a ",string" option, two fields of one name, a key given twice, a value of the wrong type. A list or object where dst takes a string (a "string or parts" read) is answered by json.Unmarshal of its opening and close, which gives the same error at the same offset without reading the rest. The request paths' json.Unmarshal calls in gateway.go, decide.go, affinity.go, image_input.go, textcalls.go, anthropic.go, ir.go, prompt.go, chat.go, chattidy.go and responses.go, and hasSealedAgentMessage and askedTier, now call it. Nothing that writes a body changed. Numbers, M4 Pro under load 10-20 from other sessions, BenchmarkLargeRequest (new: a 2 MB agent conversation with 30 tools, tool calls and results, through a fake vendor), 20 requests each: CPU in the request's handler time per request (pprof, per request) (ns/op) anthropic 154ms -> 45ms 208-212ms -> 52ms anthropic, group 178ms -> 51ms 249-262ms -> 65-67ms chat 122ms -> 35ms 167-254ms -> 50-54ms responses 215ms -> 56ms 294-452ms -> 70ms TestLargeRequestEndpoints (64 MB padded bodies): 16.8-17.6s -> 2.9-4.8s (skipping runs of spaces 8 bytes at a time took its last ~5s). Tests: - TestUpstreamBodiesUnchanged sends 18 requests (Anthropic, Chat and Responses; direct, through a group, translated to each other protocol, with images, thinking, escapes, odd spacing, a repeated key, and four 2 MB conversations) and compares what the vendor gets with testdata/upstream_bodies, recorded on the code before this change (all 18 identical; three runs agreed). Breaking decodeJSON's \n unescape by hand turns the three translated cases holding one red. - TestDecodeJSONIsUnmarshal / FuzzDecodeJSON compare decodeJSON with json.Unmarshal (dst DeepEqual, error nil-ness) for 19 types shaped like the gateway's, and jsonValid with json.Valid, over seeds, every cut and a changed byte at every place of each seed, and 2.5 minutes of fuzzing (~1.75M inputs). Breaking the validator's control-byte check by hand turns it red. - go test -tags nogui -timeout 40m ./... on this commit rebased onto origin/main 498b77fbc, with #1667's fix below it: all 48 packages ok (gateway 394s). gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway clean. Not tried: real vendor traffic; Windows and Linux runs (vet only). * gui: the header is fitted again when the language or the interface font changes, so the tabs no longer run under the magpie and the traffic lights (kiwiflysky on X) With a wide interface font, the macOS window's header fit in Chinese but not in English, Japanese or German: the tabs slid left under the magpie and the window's buttons, and in German into the refresh button and the gear. fitTop draws the header in step by step (tight, cramped, inrow, crowded, packed), but it only ran again when .top, .brand or .actions changed size (ResizeObserver) and once on document.fonts.ready. Another language or a font picked later changes only #nav's width, so the header kept the fit it had for the old one. Now translateStatic (every language change) and desktopFonts.apply (every font applied: picked, saved in the other webview, from settings) call fitTop, and document.fonts' loadingdone does too, for a font still loading when it's applied. Both run synchronously, where the change happens. A ResizeObserver on #nav was tried first. It had to defer to a frame, since fitting resizes the nav and WebKit reports that loop as a page error, and the deferred refit moved the page after a click: text-size, number-units, tray-logos and rail-tip went red. That approach was dropped. Measured (830px, macOS window, before): switched live to en, ja and de, the tabs ran 61, 105 and 148px under the magpie (Chromium and WebKit alike). header-relang.test.cjs (new): - Opens a macOS window in Chinese, with the header's tabs picked over the sidebar. - Switches it from Settings to en, zh-TW, ja, de and back. - In English, on the Agents page, it hands in Menlo at each width from 1000 to 640px. Each fit must equal a fresh fitTop. - Sweeps each language from 1100 to 600px: 7.5px clear of the magpie or padding and of the buttons. - Chromium and WebKit. Run on this commit: - header-relang: 12/12 in Chromium and WebKit. Red on origin/main 781cb386c (en -61.5, ja -104.6, de -148.0 before the rebase onto the sidebar; ja -50.8, de -94.3 after it). Red with only the language hook removed (2 subtests). Red with only the font hook removed (5 subtests: "top tight" where a fresh fit is "top tight cramped"). - Header, font, click-scroll and language neighbours: 77/77. - text-size, number-units, tray-logos, rail-tip and menu-scroll alone: pass. - Full GUI suite, concurrency 3, rebased on 781cb386c: 6261/6347. Each of the 19 failing files was run alone with this change and without it, at the same tree; the counts were the same (a few ±1 each way). - On 6ebe481f8, after 054bdb8bb's sidebar fixes, 5 files are still red with or without this change: routing-group-fold, text-size (foot of the page), routing-sessions, pick-skills, otel. Filed as #1672. - go test ./internal/gui/: TestPanelCloseHidesIt and TestTrayCellClickReleasedPanel fail the same on a fresh origin/main 94fd332c3 (#1664, #1661). Everything else is ok. Not done: in German the Settings page's sub-tabs wrap to two lines, and in English and Japanese the "Find a setting" box drops to its own row. That is wrapping, not overlap, and left for its own change. Beside the sidebar (from 1024px, the default since 18e82adc6) the header has no tabs. Checked by screenshot in de with Menlo at 1100 and 1024px: nothing overlaps. * gateway: an error that escapes its Chinese as \uXXXX is read as one that doesn't, for why it failed and when it's back (#1669, Natsumeretsu) Every word list that decides why a reply failed (creditWords, brokeWords, rateWords, plannedWords, usedUpWords, quotaCodes) and af0558e6d's resetsWhen were matched against the raw body. A JSON error whose encoder escapes what isn't ASCII (Python's json.dumps by default) carries 用量 as 用量, so none of the Chinese words matched: WorkBuddy's escaped refusal read as a 1-minute rate limit with no reset time, Zhipu's escaped 1113 "余额不足…请充值" as a rate limit instead of out of credit, a sub2api key's escaped "7天限额已用完" as a rate limit instead of out of quota. wordsOf is the one shared point: a JSON body containing \u has its string values decoded and put after it, one to a line; any other body is matched as it is. failure() matches its words on it, resetsWritten reads the reset from it, the per-model rest's otherModels check uses it, and the two creditWords checks beside failure() (fallback.go's same-one retry, patience.go's busy) use it too. Tests: TestResetsWritten gains the reporter's Chinese refusal escaped (read, 3h16m2s) and escaped-but-cut-short (not read); TestWrittenResetRestsUntilThen rests the escaped refusal's model until then; TestFailureReadsEscapedWords: escaped Zhipu 1113 is credit, escaped sub2api 7天限额已用完 is quota, escaped WorkBuddy is quota. With wordsOf returning the body unchanged, all three fail. internal/gateway passes; go test -tags nogui ./... under a temp HOME; gofmt -l, go vet darwin, GOOS=linux, GOOS=windows on internal/gateway. * provider: a magpie run from a terminal that only lists accounts no longer writes logins.json, and every change to it is made under a lock the gateway holds too, so a token the gateway just refreshed is never written back over (#1674, FaintGhost) Every CLI command that reached Logins() (magpie ls, providers, sessions, usage) ran rememberLogins, whose 30-second throttle (loginsSeenAt) lives in the process, so in a new process it never held: each run moved Seen on for the signed-in Codex and Claude accounts and wrote logins.json back. loginsMu was an in-process mutex, so that read-modify-write could interleave with the gateway's renewSavedLogin: the CLI reads, the gateway writes a refreshed sign-in, the CLI writes what it read. Codex/OpenAI refresh tokens are single use, so the account would be signed out. - rememberLogins writes nothing when the only change is Seen and the saved Seen is less than seenEvery (10 minutes) old (onlySeenMoved, comparing with what was read, IDs and order normalised as writeLogins writes them; sortLogins is split out of writeLogins for that). - internal/filelock (new): davsync's TryLock/Unlock (flock; LockFileEx on Windows) moved here and davsync uses it; Lock(path, wait) and filelock.Mutex, a sync.Mutex that also holds the OS lock on a lock file. A lock another magpie holds is waited for up to filelock.Wait (10s), then gone on without, as before, so a stuck magpie never hangs others. - loginsMu is a filelock.Mutex on logins.json.lock, so all 107 existing Lock sites (every writeLogins is under one) are cross-process with no change at the call sites. Taking it calls filememo.Look (new), so the read under it isn't a parse filememo.Hold kept from before another magpie's write. savedTokenMu holds logins.json.renew.lock the same way: two magpies never refresh one saved account at once. - Siblings: caller-keys.json (access.mu: magpie keys from the CLI vs the window; a lost revoke would bring a key back) and mcp-signins.json (mcpauth.fileMu, plus mcp-signins.json.renew.lock around renew, since library's MCP check renews from the CLI too) get the same lock. plugin-auth.json already has one (plugin-auth.json.lock, shared with host.js). Not covered: providers.json (33 store sites with no in-process lock either; user-entered keys, nothing refreshed there), migrations.json/settings.json (no credentials), and the agents' own files (~/.codex/auth.json etc.: the agent itself writes them without any lock of ours, so a magpie-only lock can't make them safe). Tests: - TestReadOnlyRunLeavesLogins: Codex and Claude signed in, Seen a minute old, file time set back; three "new processes" of Logins("")/codex/ claude/All() leave logins.json's bytes and mtime as they were. Seen an hour old is written; Codex's own refresh is written at once. - TestLoginsKeepAnotherMagpiesWrite: between this process's read and write (beforeLoginsWrite hook) a second test process (TestLoginsOtherMagpie, os.Args[0] -test.run) renews the saved work@ account's refresh token; both the renewed token and this process's change are in the file. - TestLoginsReadAfreshUnderLock: with filememo.Hold held, a write filememo never heard of is seen by a read under loginsMu. - TestLockAcrossProcesses (filelock): a holder subprocess makes Lock wait and give up after its wait; killed, the lock is free; a Mutex holds it. Broken by hand: onlySeenMoved bypassed -> TestReadOnlyRunLeavesLogins FAIL "a run that only listed the accounts wrote logins.json"; the file lock taken out of filelock.Mutex.Lock -> TestLoginsKeepAnotherMagpiesWrite FAIL "the other magpie's renewed sign-in was written over"; Locked hook emptied -> TestLoginsReadAfreshUnderLock FAIL. Each restored, green. Ran: gofmt -l (nothing); go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; go build, GOOS=linux go build -tags nogui, GOOS=windows go build; go test -tags nogui -count=1 ./... under a temp HOME with pinned caches: all ok but internal/provider, whose TestReadOnlyRunLeavesLogins failed at that point from its own fixture (two rewrites of one size given the same mtime read as unchanged by filememo); fixed in the test, then internal/provider, access, mcpauth, filememo, filelock and davsync -count=1 all ok, and the three new provider tests -race -count=10 ok. Not tried: the reporter's Linux arm64 box with a real systemd gateway and real Codex accounts; Windows (LockFileEx path) only vetted and built, not run on the Windows box. * gui: on niri the tray panel opens under the bar beside the clicked icon, not in the middle of the screen (#1670, Kenoia) A Wayland window can't place itself. Under niri the panel opened where niri floats a new window, the middle of the output. Hyprland already had an adapter (omarchy/hypr.go); niri now has one too. niri (checked in niri v26.04's source, niri-ipc/src/lib.rs and src/ipc/server.rs) can't add window rules at runtime and doesn't report the pointer over IPC. So omarchy.NiriPanel watches niri's event stream ($NIRI_SOCKET, one line of JSON per message) and moves each window of magpie's pid titled "magpie panel" once as it opens: MoveWindowToFloating if it was tiled, then MoveFloatingWindow with SetFixed x/y, which count from the working area's top-left (below the bar). It goes 6 px under the bar, centred on the x that the tray host passed to the SNI Activate(x, y), kept inside the output. Wails' Linux tray keeps that x in private fields (lastClickX/lastClickY), read the same way trayProps already reads props; TestTrayClickIsWails reads Wails' source to fail if they move. Noctalia passes bar-surface-local coordinates, so the x is taken across the focused output. With no click (`magpie panel`), or with one off the output, it goes to the top right. Wails' HideOnFocusLost closes it when another window takes the focus. What was run: - go test -race ./internal/omarchy/, go test ./internal/gui/ (sandbox HOME, pinned GOMODCACHE/GOCACHE). The IPC fixtures are built from niri-ipc 26.4.0's Window/Output/Event/Reply types, quoted in the test. - Broke it by hand: dropping the placed-once map fails TestWatchWindows (placed [7 7 9 9 9]); dropping the right-edge clamp fails TestPanelSpot. - gofmt -l; go vet (darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; linux nogui and windows builds. - A nested niri 26.04 (winit backend on Xvfb, scale 1.5, Fedora 43 container, magpie built with -tags gtk3), with SNI Activate sent via dbus-send. Activate(300, 14) put the panel at [58, 6] (300 - 484/2). A second Activate closed it. `magpie panel` reopened it at the top right (853 - 484 - 6 = 363). Activate(800, 14) clamped it to 363. `magpie gui` taking the focus closed it. Not tried: a real niri desktop, Noctalia or another real tray host (Waybar, ironbar), more than one monitor, a bar at the bottom or the side (not accounted for), focus-follows-mouse. The panel still opens in the middle and slides up; how visible that is on real hardware wasn't seen. Not from this change: omarchy's TestCurrent fails with -count=2 on main (it passes with -count=1). * omarchy tests: TestCurrent starts from no theme read, so a second run (-count=2) isn't handed the first run's cached font Current keeps the last theme it read for a second, and the package state outlived the test, so the second run's first read came back from the cache with the font the first run ended on. Seen while working on #1670. Ran: go test -count=2 -run 'TestCurrent$' ./internal/omarchy/ fails on f13111797 (font "JetBrains Mono"... then "Iosevka"...), passes with -count=3 after; go test ./internal/omarchy/, gofmt -l, GOOS=linux go vet. * gui: the sidebar's edge drags it wider or narrower, kept for the window; dragged well past its narrowest it folds away, as a Mac app's sidebar does (enzyme_dev on X) The sidebar was always 212 points (184 in a narrow window). Its right edge is now a separator (role=separator, col-resize, no-drag for the window): dragged, it follows the hand between 168 and 320 points, the page beside it moving with it, and the width is kept in localStorage (magpie.sideWidth). A narrow window has it no wider than 36% of itself, so the page keeps its room, and back at full width when the window is. Dragged more than 64 points under its narrowest it folds into the header's tabs (the same as the title bar's button), and comes back at the width it had before that drag. The arrow keys move it 8 points, 32 with Shift. Under a coarse pointer (an iPad's magpie web) the edge is 24 points wide for a finger; a phone's magpie web has no sidebar and so no edge. "Sidebar width" (its label) in zh, zh-TW, ja and de. Run: side-width.test.cjs (new) in Chromium and WebKit, 3 times each: the drag mid-way and after, the narrowest and widest, every name and the magpie whole at 168, the keys, a reload, a 760 window, the fold and its width on return, an iPad touch drag (Chromium; WebKit's Playwright sends no touch moves), a phone with no edge. Without the fold's reset the return width test fails (168 for 240). sidebar, side-toggle, phone-web, mobile-web, view-no-sideways, header-centre, text-size pass in both engines, except WebKit text-size's two "100% picked at the foot" cases, which fail the same on origin/main f13111797 and are #1672. go test ./internal/gui ok. Tried on a sandbox magpie (go build -tags dev, own HOME, the owner's providers.json) through its dev UI in WebKit: dragged to 173, to 301, kept after a reload, folded and back at 301; and `magpie web` on a 390 phone (no sidebar, nothing sideways) and a 1180 iPad (the sidebar, 320). Not tried by hand in the real Wails window. * gateway, gui: magpie's image recognition is an MCP server of its own, /mcp/magpie/vision, with one analyze_image tool (JonahFu on X) What: beside /mcp/magpie/web-search, the gateway serves the model that describes images (Settings › Models › Image recognition, else magpie's automatic pick) as a Streamable HTTP MCP server. analyze_image takes an image (absolute file path, http(s) URL or data:image URL) and an optional prompt: without one it is described as a model's image is (same cache and system text), with one the prompt is asked beside it. The JSON-RPC serving, guard and Origin check are shared with the web search server (serveMCP). A file path is read only for a local, unproxied caller, up to 20 MB, and only when its bytes are an image; another computer sends a URL or data URL with a gateway key. Each call holds the key's limit (budget.Reserve) and reads in Routing as the agent's analyze_image call. Settings › Models shows the address under Image generation (#visionMcpRow), in every language. Run: - go test -tags nogui ./... (no failures); gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway. - New TestVisionMCPAnalyzesImage / WithNoSeer / Guarded / HeldToKeyLimit. Broke the local() guard by hand: TestVisionMCPGuarded went red on the other computer's file path being read. - GUI (chromium + webkit, en/zh/zh-TW/ja/de, 1100 and 520px): vision-mcp, search-mcp, public-url-default, images-missing, settings-sections, i18n-keys, routing-vision-why: 95 pass. The row was first put between the two pickers and images-missing went red (it finds them by position), so it sits last. - Real use: this build under a sandbox HOME holding only the owner's OpenRouter provider, Image recognition set to openai/gpt-6-luna. initialize, then tools/call with docs/screenshots/font-settings.png as a file path and a prompt: the model listed every settings row and its value correctly. Not tried: a real agent (Claude Code, Cursor) mounting it; its MCP exchange is the same as the web search server's. * gui: Usage's subscription cards in one row are as tall as each other, so their bottoms line up (ikunbots on X) ikunbots ("magpie 的这个卡片可以对齐吗") and duanjl_china ("有的长有的短"): Claude Code, Codex and Antigravity sat side by side in one row on the Usage page, each as tall as what it held, so their bottoms were ragged. What changed - packUsage (app.js) still packs the cards into columns as #860 made it (a short card stacks beside a tall one, never stretched to a row's height). After placing them, the last card in each column gets a min-height that takes it down to where the tallest column ends. - Cards side by side in one row (one card per column) are as tall as the tallest, bottoms on one line, content at each card's top. - A stack stays a stack: the upper cards are as tall as themselves and only the last one reaches down to end with the tall card beside it, which is what #860 asked for (堆叠和 Codex 对齐). - One column: each card is as tall as itself, nothing to line up. - The min-heights are cleared before every measuring, so a re-pack (resize, a fold opened, cards changed) measures each card as tall as itself. A min-height rather than a stretch keeps a card that outgrows it growing, so the ResizeObserver still re-packs. - docs/subsystems/gui-shell.md says so. Tests - usage-pack.test.cjs: - New: ikunbots' three cards (Claude Code 2 windows, Codex, Antigravity 6 families; content heights 107/169/217px) at 1400 and 1018px are one row with bottoms within 0.5px; at 480px one column, each card as tall as itself; widened again, one row lined up again. - The reporter's #860 stack at 897/1018/1400px still stacks: Antigravity as tall as itself, DeepSeek under it with the 7px gap, ending where Codex does. - sound(): a card is as tall as itself unless it is last in its column, which ends with the tallest; no card is shorter than its content. - The fold case: opening Codex's brief account grows what the card holds; the card already reaching down to the stack's end stays that tall rather than growing (was "the card grew"). - Broken by hand: no min-height applied -> "1400px: the cards' bottoms line up" red in all 8 (chromium/webkit x en/zh/ja/de); min-height not cleared before measuring -> "narrow: antigravity is as tall as itself" red. Restored: 8/8 pass. Run - usage-pack.test.cjs in Chromium and WebKit, en/zh/ja/de: 8/8 pass. - Every GUI test file touching the Usage page (75 files, those naming #subscriptionUsage/.subscription-card/view=usage, plus click-scroll), both engines, concurrency 6: 917/918 pass. panel-usage webkit en failed once under that load ("asked: period=today&limit=1", a 2.4s poll in its Requests-window step this change doesn't reach), passes 3/3 alone; added to #1544 with its cause. - Screenshots before/after with fixture data looked at: ragged row before, one line after; 897px stack unchanged but for DeepSeek/Codex ending together. - No Go change; gofmt/vet/build not run. Full GUI suite not run. * provider: a moved ZCode account is brought to plugin 0.1.16, whose app sign-in follows ZCode only while it is signed in to the same account (LingYi_Stu on X) Raises the zcode mover's min so keepMovedCurrent updates every moved user to @magpie-community/opencode-zcode-auth 0.1.16 (plugins d2be892). With the "ZCode app's sign-in" added for account A and again after ZCode switched to B, A's entry read ZCode's current credentials on every request, so it sent B's requests and its usage card showed B. 0.1.16 follows ZCode only while ZCode's user is the entry's account; otherwise it uses what was saved at sign-in, and asks for sign-in again when that session has run out. Published by the plugins repo's publish workflow; npm view says 0.1.16 is latest. Run: go test ./internal/provider/ (ok, 99s); gofmt -l internal/provider (clean); go vet ./internal/provider/ on darwin, GOOS=linux, GOOS=windows. * gui: a client in the Usage page's Agents list can be hidden from it, and shown again from the line under it (ikunbots on X) ikunbots asked to hide curl, Go-http-client, python-httpx and other clients from the Agents list beside the agents they actually use. What changed: - Each Agents row has a "…" button that shows on hover (always on touch) and opens the app's row menu (openRowMenu) with "Hide from this list". Right-clicking the row opens the same menu. No native select. - The hidden ids are saved by client id in settings.UsageAgentsHidden, trimmed and deduped. They go through POST /api/usage/arrange (agentsHidden), which changes only that field, and the Settings save carries the field over. - Hiding is display only. The ledger keeps the calls, and the totals, the chart and every share still count them. - When anything is hidden, a quiet "3 hidden" / "已隐藏 3 个" line sits under the list. It opens the hidden rows, dimmed, each with "Unhide" / "取消隐藏". No click scrolls the page: the scroll guard holds the clicked line in place. - Where a pointer hovers, the "…" takes no room. Its margins give back its width and gap, so a row at rest is laid out as on main (mobile-web's desktop comparison is the same). It shows over the end of the share bar. On phones (body.web) it has its own grid column. - Translated into zh, zh-TW, ja and de. docs/subsystems/gui-shell.md describes it. What was run, in a worktree off origin/main: - gofmt -l: clean. - go build ./... and go vet ./...: pass. - GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: pass. - HOME= go test -tags nogui ./...: 49 packages ok. Includes the new TestUsageArrangeAgentsHidden, which covers saving, surviving a settings save, narrowing and emptying. - New usage-agents-hide.test.cjs: 32/32 in Chromium and WebKit. It covers en, zh, zh-TW, ja and de at 1200, 560 and 390 (web). It hides by "…" and by right-click, checks the POST body, unchanged totals and an unmoved page, then unhides, reloads and checks the hidden rows persist. - All 48 usage, panel-arrange and click-scroll GUI files: 503/503. old-webkit and mobile-web: pass. - Full GUI suite (6489 tests, concurrency 5): the reds outside this change fail the same when run alone on origin/main 3deb85685, in WebKit only. They are filed in #1672 and #1609, and in #1745 (new: group-member-info, searcher-pick). - Broken by hand: - Without the hidden filter in renderUsage, the new GUI test fails 16/16 in Chromium (the shown rows still list curl). - Without the arrange handler, TestUsageArrangeAgentsHidden fails at line 82. - Without the Settings-save carry-over, it fails at line 84. * gateway: a ChatGPT account's turn goes zstd-compressed, as Codex's own client sends it (ylorn on X) ylorn (X, v0.1.1202) sent a text-only gpt-6-luna turn of 1,100,224 bytes straight to chatgpt.com/backend-api/codex/responses. Sent plain it got 503. The same turn zstd-compressed (259 B) got 200. magpie decodes Codex's inbound zstd and sent the backend plain JSON, so the turn got 503 through magpie too. What Codex does (openai/codex a9b08151, 2026-10-11): - codex-rs/core/src/client.rs:1704-1712 responses_request_compression: Zstd only with the enable_request_compression feature, a sign-in that uses_codex_backend, and the OpenAI provider. - client.rs:1780: used for the POST /responses stream only. /responses/compact and /models go plain. - codex-rs/features/src/lib.rs:1411-1416: the feature is Stable and on by default. - codex-rs/protocol/src/auth.rs:54-63: uses_codex_backend is true for the ChatGPT sign-ins and false for ApiKey and Bedrock. - codex-rs/codex-api/src/endpoint/responses.rs:130-147 sets it for /responses. - codex-rs/http-client/src/request.rs:196-217 compresses with zstd encode_all at level 3, sets Content-Encoding: zstd, and never compresses twice. What changed: - provider.CodexCompressed compresses a body sent to CodexBase/responses with klauspost zstd, already a dependency. It uses SpeedDefault (about level 3) and no frame checksum, like libzstd's default. It sets Content-Encoding, Body, GetBody and ContentLength to the compressed bytes, and returns the wire size. - It is called once the body is final and signed: in forwardOnce for a codex account, in codexUpstreamOn (the relay) on every try (so a try again or a body without an unreadable image is compressed afresh), and in warmCodex. - Unchanged: /responses/compact, an sk- key's requests to api.openai.com, every key provider (even one at the same URL), and a body already encoded. - The plain body is still what magpie keeps, masks, traces and shows. - codexDropped (#1628, a2b96139c/8029d98b7) judges "large request" by the bytes sent on the wire. A text turn that compresses to a few KB and is reset is a small request's 503, not a "MiB" hint asked again. A screenshot's random bytes stay past 1 MiB, and those are still asked again. - The gateway and provider TestMains leave turns plain (CodexZstdForTests), since their fake backends read the body as JSON. The new tests turn it on. - TestAsksOwnBackendAgreesWithTheGatewayDispatch read any call whose sixth letter is upper case (CodexCompressed) as a serveX dispatch. It now needs the "serve" prefix. Removing "kiro" from asksOwnBackend still turns it red. - docs/subsystems/gateway-routing.md: the "sent plain JSON" line now names this exception. Tests: internal/gateway/codex_zstd_test.go covers the accounts loop, the relay (inbound zstd and plain), a try again after a drop, compact and an API key plain, a key provider at the same URL plain, and a reset judged by wire bytes. internal/provider/codex_zstd_test.go covers the round trip, GetBody, Content-Length and the URLs left alone. Broken by hand, each went red: - no compression in forwardOnce: Account and AskedAgain - no compression in the relay: Relayed, AskedAgain and JudgedByBytes - no account guard: KeyProviderTurnStaysPlain - compact compressed: CompactAndAPIKeyStayPlain - the drop judged by len(body): JudgedByTheBytesSent Real account (the owner's ChatGPT sign-in, gpt-6-luna, 1,100,279 B text-only body, 391 B zstd): - Direct to chatgpt.com, twice: plain 200/200, zstd 200/200. ylorn's 503 did NOT reproduce from here (a2b96139c also saw 0.5-20 MiB served). The change rests on the official client's behaviour. - Through a sandbox magpie (own HOME, :3486) via a byte-counting CONNECT proxy: - Old build: relay-zstd, relay plain and the account path were 200, 200, 200, with 3,321,579 B uploaded to chatgpt.com. - New build: 200, 200, 200, with 13,362 B uploaded. Each 1.1 MB turn now goes as a few KB, as Codex sends it. Run at origin/main e21ea07e4: - go test ./... was all ok after the dispatch-test fix. The provider, agent and gateway packages were rerun. - go test -race -count=3 on the new tests. - gofmt -l is clean. - go vet: darwin and windows ./... ok. linux ok for the changed packages. linux ./... fails the same on clean e21ea07e4 (wails v3's cgo-only Linux files, cross-vet from macOS). * gateway: a key held to some models gets its model list as fast as one held to none, its groups read once a list, not once a group (#1762, LumenXY on X) LumenXY's /v1/models over Tailscale took 12.4s with a gateway key held to some models and 1.5s with an unheld one, so apps that list models timed out and showed an empty list. Cause (pprof, 1,000 models, 500 found groups): keyAllowed checked each catalog entry on its own. Each group entry called provider.FindGroup, which builds a new GroupFinder, so every provider's models were read again (providerEntries, its files stat'ed and settings loaded) once a group. That was 96% of the request. Each glob in the key's models was also compiled to a regexp on every check, and a key held to accounts listed each provider's accounts (Logins, from disk) once a model. What changed: - gateway/key_models.go: keyAllowed weighs a list through a keyList made for that request alone. It has one GroupFinder and each provider's AccountIDs read once. entryAllowed and accountServes are the same checks over them. accountServes(who, p, model) stays for decide.go's single check. - access/models.go: globRe keeps each pattern's compiled expression. A pattern compiles to the same expression whatever key holds it, so nothing kept goes stale. The map is let go of whole past 4096 patterns. - gui/groups.go: groupsState (the Routing page) called FindGroup once a group too, the same class. It now uses one GroupFinder. Every route that lists models goes through keyAllowed: /v1/models, /v1/models/{id}, /v1beta/models, /v1/codex/models, Muse's list and the deciders. The single-model checks (serve, count_tokens, embeddings, System One, draw, video) ask one group and are unchanged. Nothing is kept past a request, so a change to a key's models or accounts, a group's members or an account's own models shows on the next request. No key limit is loosened. The documented behaviour is unchanged, so no subsystem page changes. Tests: - TestKeyListShowsWhatItDid compares keyAllowed with the old per-entry check, kept in the test, for 14 keys over a catalog with found groups, named and nested groups, a no-key provider and an account's own models. The keys cover exact ids in any case, globs, group/, group/*, a group inside one named, accounts, and models with accounts. - TestKeyListSeesChangesNextRequest goes through /v1/models and /v1beta/models on one server while the key's models, the group's members, the key's accounts and an account's models change. - TestModelPatternsKeptCompiled checks each pattern keeps its own expression and that past the cap works. - Broken by hand, each went red: the accounts memo shared across providers (ShowsWhatItDid), the GroupFinder kept across requests (SeesChangesNextRequest), and the glob cache keyed by the pattern's first letter (KeptCompiled). Numbers, BenchmarkHeldKeyListsModels (2 providers x 500 models, 500 found groups, M4 Pro): - held to models: 2.36s before, 55ms after - held to accounts: 2.35s before, 60ms after - held to none: 43ms either way Real use: sandbox magpie on 127.0.0.1:3486 with its own HOME, the same 1,500-entry catalog, a key held to 5 patterns, and curl 3x each: - held key, /v1/models and /v1beta/models: 27.8-28.7s before, 0.18s after - unheld key: 0.12s either way - The held list (212 entries) and the unheld one (1500) were byte-identical between the old and new builds. - Changing the key's models while the server ran showed on the next request (10 entries, then 212 again). Run at origin/main 8f2a314cf: - go test ./...: every package ok (49), no FAIL - go test -race -count=3 on the access tests and -count=2 on TestKeyList*, TestGatewayKeyModels* and TestGatewayKeyAccounts* - gofmt -l and go vet ./... (darwin, GOOS=windows); GOOS=linux go vet -tags nogui on access, gateway and gui * plugin: the unofficial plugins on GitHub aren't cut short through a slow proxy, and a list cut short is asked again in 20s, not kept ten minutes (larchsis on X) larchsis (Windows, no system proxy, magpie's own proxy on) saw no unofficial plugins on the Plugins page, and saw them with the system proxy on and magpie's set to automatic. No request bypasses magpie's proxy. Every listing and install read (market.json, npm info and search, GitHub's search, package.json and README, Bun's download, plugin icons) goes through http.DefaultClient or DefaultTransport, which netproxy.Install routes through settings.Proxy, else the environment, else the system proxy (HKCU Internet Settings on Windows). Checked with a counting CONNECT proxy in a sandbox magpie on macOS and on the Windows box: every connection to api.github.com, raw.githubusercontent.com and registry.npmjs.org went through it, and lsof / Get-NetTCPConnection showed none going direct. The cause is timing. askTagged gave the whole listing 8s, six package.json reads at once, each bounded by that same 8s, and a repository whose read hadn't finished was left out. The cut list was then kept ten minutes, and on disk for a restart. Through a sandbox proxy that adds latency per chunk: no delay 29 repos, 150ms 21, 300ms 6. A slow proxy loses most of "Unofficial, on GitHub", and when it loses all of them the section is gone. The two setups differ in latency and in what was cached, not in proxy handling. Now: - Reads go on past the page's wait (taggedEach 20s each, 12 at once), on a context detached from the request. They are kept by repository and push, as before, so the next ask has them. - A repository whose read didn't come in time is as the last list had it (in memory, else on disk), with the search's current stars and description. - A list that left one out is asked again after 20s, not ten minutes. Its copy on disk is dated so that a restarted magpie asks again too. Run: - TestTaggedReposSlowRead (new) holds word-guard's package.json past a 300ms wait. It fails on the old code (5 repos, word-guard missing). It also fails with each part broken by hand: no fallback to the last list, a partial list kept 10 minutes, reads cancelled at the wait, and the disk copy not aged back. - Sandbox magpie web (own HOME, own ports, proxy 127.0.0.1:3481 with injected latency), no cache: at 300ms 11 repos at 8s, then all 29 25s later (the old code kept 6 for ten minutes). At 1s none at first, all 29 25s later. - go test ./... on 5e7efce3b (origin/main): green. go test -race -count=5 on the tagged tests. gofmt -l clean. go vet on darwin, GOOS=windows ./..., GOOS=linux -tags nogui ./internal/plugin. - Windows box: plugin.test.exe with the tagged tests, 3 of 3. In the full package run only TestMarketIconsAreBundled failed, because it reads ../gui/assets, which wasn't copied over. * site, readme: APINEBULA joins the sponsors, a card on usemagpie.ai and a small logo under the README badges APINEBULA paid for the website seat and the en/zh README seat. The logo is the SVG they sent (143x37). A white-text copy is used on dark backgrounds, through .for-light/.for-dark on the site and in the READMEs (the .bird invert would turn the orange mark blue). The site's sponsor cards now stack in an equal-width grid, so the two cards line up; the intro has zh, ja and de strings. Run: site worker and install tests (28 pass). The home page served locally and checked in chromium and webkit, at 1200 and 390px, light and dark, in en/zh/ja/de (dictionary applied in the page): both logos load, the right one per theme, and there is no horizontal scroll. * provider: moved Cursor users get plugin 0.2.8, whose empty-reply error says what Cursor's Run sent before it (magpie-community/plugins#60, congee949) Raises the cursor mover's min from 0.2.7 to 0.2.8 (published, npm view shows 0.2.8), so keepMovedCurrent updates moved users. 0.2.8 adds the thinking length, tokens, refused built-in tools, unknown messages and last frame to the empty-reply 502, for the next report on plugins #60. Ran gofmt -l, go vet (darwin, windows) and go test ./internal/provider (ok, 525s). * provider: a model models.dev has just listed without its reasoning levels takes its family's, so Codex's picker offers them for a relay's gpt-6.1-sol (NextCommit on Discord) NextCommit's Codex showed no reasoning-effort picker for a relay's (an OpenAI-compatible key provider) gpt-6.1-sol, while gpt-6-astra had one, and magpie's log said the effort went from none to low. models.dev had listed gpt-6.1-sol as a reasoning model but without reasoning_options yet, or not at all, so magpie knew no levels for it: Codex's catalog got supported_reasoning_levels [] (no picker), and the gateway, not knowing "none" was one of the model's levels, sent Codex's "none" as "low" (#899). What changed: - catalog: a thinking model with no levels of its own and no budget takes the levels of the newest model of its models.dev family (same provider, thinking, with levels) released on or before it (mdProvider.levels). Used by Provider and ListedBy. A model with its own levels, a budgeted one, one that doesn't think, or one with no family is as before. - catalog.KinEfforts: for an id no provider lists, the levels of the newest listed model of the same shape with the version numbers left out (gpt-6.1-sol -> gpt-#-sol), never a budgeted or non-thinking one. - provider.borrowedEfforts: tries ListedBy, then EffortsOf, then KinEfforts. Entry.Efforts, which every agent's model list is built from (Codex, Claude Code, OpenCode, dsh, ...), goes through it, as do Known, Levelless, groups and plugins. - Xiaomi's mimo, which takes a thinking switch only (#214), still gets no levels; gpt-4.1 gets none. With levels known, an effort the user picks in Codex goes through as picked. The none->low mapping remains for models whose levels are still unknown (#899). What was run: - New tests: TestFamilyLevels (catalog) and TestNewModelTakesItsFamilysLevels (provider, Codex catalog levels for relay/gpt-6.1-sol). Both fail with levels() and the KinEfforts call neutered (levels "" against the family's), and pass with them. - Real Codex CLI 0.162.1 under a sandbox HOME against a sandbox magpie gateway (127.0.0.1:3592) and a fake relay (127.0.0.1:3591) listing gpt-6.1-sol and gpt-6-astra. The models.dev cache had reasoning_options stripped from every gpt-6.1-sol entry to match the reporter's. - Built from origin/main: magpie-models.json gave relay/gpt-6.1-sol default None, levels []. - With this change: default medium, levels none..max,ultra. - Codex /model showed "Select Reasoning Level for GPT-6.1 Sol · relay". Picking Medium, High and None sent reasoning_effort "medium", "high" and "none" to the relay. - gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; GOOS=linux and GOOS=windows builds: all clean. - go test ./... under a temp HOME, with GOCACHE and GOMODCACHE pinned. Every package passed except four that hit the 10-minute default timeout with load average ~40 (TestCopilotSecretToolUsername's 5s secret-tool wait as well). Rerun with -timeout 40m -p 2, internal/agent, gateway, library and provider all passed. Not tried: the Claude Code, OpenCode and dsh model files written for the same relay model; they take Entry.Efforts like Codex. * gui: the Linux app's sidebar button switches the layout at once, no view transition, which WebKitGTK with compositing off crashed in (depravity_wings on X) Since 18e82adc6 (v0.1.1197) the sidebar button, Ctrl+Shift+S and dragging the sidebar's edge past its narrowest trade the two layouts in a view transition (navMorph). Under Wayland magpie turns WebKitGTK's compositing off (webkit_linux.go), and WebKitGTK 2.52 then crashes in the transition: SIGSEGV on the GTK main thread inside libwebkit2gtk-4.1, from a JavaScriptCore run-loop timer. The reporter saw the window freeze. The Linux app (body.linux) now has the new layout at once, the path reduced motion already takes; magpie web in a Linux browser keeps the motion. Other webviews get a guard: a transition still going after MORPH_MAX (1.5s, three times its length) is skipped, so one that never ends can't leave the window on the old layout's picture. Run: - Reproduced on the omarchy VM (Hyprland/Wayland, webkit2gtk-4.1 2.52.6), v0.1.1207 under a scratch HOME: the button crashed the app 4 of 4 clicks; with WEBKIT_DISABLE_COMPOSITING_MODE=0 it didn't. - The fixed build there (same Linux path, compositing at magpie's default): 8 button clicks, 4 Ctrl+Shift+S and an edge drag past its narrowest all switched the layout, checked by screenshot each step; no crash, no freeze. - side-toggle.test.cjs: "Linux: at once, no transition" and "a transition that never ends is cut short", chromium and webkit; both go red with the change undone by hand. side-toggle, sidebar, side-width, header-centre pass in both engines (60 tests). go test -tags nogui ./internal/gui ok. Not run: the 1.5s guard on a real webview that never ends a transition (none found); it is tested with a stub. * gui, profile: the profile in use is ticked and named on the panel's Profiles button, not a count read as its name (superhtoooth on X) superhtoooth (macOS): 保存方案设置了方案名字,但是应用方案没有用这个名字。 menu 里面变成了方案 1,方案 2。而且在应用里面没有显示当前使用的方案. The bug: the tray panel's Profiles button showed the number of saved profiles next to its label ("方案" + "2"), which reads as a profile named 方案 2. Profiles were saved and applied under the typed name all along; nothing anywhere said which profile was in use. What changed: - profile.InUse: a profile is in use while applying it would change nothing on this computer - every detected agent's saved field is as the profile has it (compared with the same renamed-ref spelling Apply writes), its model lists are held (provider.ModelListsHeld, a dry run of SetModelLists via the extracted putModelLists) and its library setup is as saved (library.Holds, the mirror of Restore). A profile that touches no agent here is not in use. - Why not "last applied": that would stay ticked after the user changes a model by hand, a tick that lies. With this definition a profile saved from the current setup is in use at once, a hand change clears the tick, and applying puts it back. Two identical profiles are both ticked; the button names the first. - GUI: /api/state carries inUse. The panel's button names the profile in use (a pop-up button showing what is picked), else counts them as before; its chip gets a check mark and aria-current, in panel and window; the chip's tooltip and its details say "In use" (string already in every language). CLI `magpie profiles` marks it, the TUI notes "in use". Docs (reference, start en/zh/ja) say so. What was run: - go test ./internal/profile (new TestProfileInUse: save, hand change, apply, hidden model list, library instructions, absent agents) and ./internal/gui (new TestStateProfileInUse through the HTTP handler), scratch HOME. Broken by hand: field compare, ModelListsHeld, library.Holds and state's InUse each turned a test red. - go test -tags nogui ./... in a scratch HOME (the four slow packages rerun with -timeout 40m under load ~45). - GUI: new profile-in-use.test.cjs (reporter's steps in the panel at 360px, every language, plus the window) and panel-profiles, profile-confirm, profile-details, old-webkit, i18n-keys, gui-zh-tw, gui-ja, gui-de in chromium and webkit: all pass. Old app.js fails the new test. - Real CLI in a sandbox HOME with a codex config: save/use/profiles show the mark, and it goes after a hand edit. - gofmt; go vet darwin, linux (nogui), windows. Not tried: the real tray app with real agents, and Windows/Linux at runtime. * provider, gui: a ChatGPT sign-in whose port 1455 can't be opened goes on, says why, and is finished by the pasted address (#1782) nianlee-official's ChatGPT sign-in stopped at "port 1455, where ChatGPT sends the sign-in back, is busy" with nothing of ChatGPT's running. That message was given for every listen error: a Windows port in a range Hyper-V, WSL or Docker excluded (WSAEACCES, no program holds it) read the same as one another program held, and either way the sign-in stopped, though ChatGPT's page puts the code in the address the browser ends on. What changed: - begin (signin.go): when listenCodexCallback can't have the port, the codex sign-in still starts. Its handler serves no port and it waits for the address, pasted, as a Docker sign-in does (pastedCallback goes through the same handler). SignInState says why in CallbackBlocked ("reserved" for Windows' WSAEACCES 10013, else "busy") and names the port in CallbackPort. The redirect stays localhost:1455, the only one ChatGPT's client takes. listenCodexCallback returns the real error. - GUI: the sign-in box says which of the two it is, with the port, in place of the server-or-Docker guess (5 languages). CLI: the same. - Not changed: Kiro's built-in tries ten ports already; the ChatGPT API sign-in falls back to any port. What was run: - go test ./internal/provider -run 'TestCodexSignInGoesOnWithItsPortTaken|TestCallbackBlocked|TestCodexSignIn|TestPasted|TestLoopback' -race -count=5: ok. With begin returning the listen error again, TestCodexSignInGoesOnWithItsPortTaken FAILs: "the sign-in stopped at the taken port: listen tcp 127.0.0.1:61025: bind: address already in use". - signin-port-blocked.test.cjs (new), signin-paste-codex, signin-callback: 45/45 in Chromium and WebKit, en/zh/zh-TW/ja/de, 900 and 420 wide. With app.js from HEAD the new test FAILs (the note never shows, TimeoutError). - gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows), full go test -tags nogui ./... before the push. Not tried: a real Windows excluded port range (the Windows box was unreachable over ssh); the reserved case is tested with errno 10013 as Go's net.Listen wraps it. The reporter's own cause isn't confirmed yet; the issue asks them. * gateway, gui: a Routing row's share used renews with its own window, not the biggest one (#1778) Vigilans' Factory account showed "32% used · renews in 27 days": the week's 32% beside the month's reset. Allowance.For gives the fullest window's share and the renewals biggest first, and routing.js paired the share with renews[0], so for any account of more than one window the row mixed two windows. - provider.Allowance.Fullest(model, now): the reset of the window For's share is of (the later of two as full; a window whose reset has passed counts as empty, as For does). - The trace's Weighed gains usedRenews (from weighRouted's left.fullest); routing.js's usedRenews(w) uses it in both the story rows and the account rows, and falls back to renews[0] only for an account of one window (a route recorded before this commit). - Smart's order is unchanged on purpose: it goes by the biggest window, and Factory's month holds less than its weeks add up to, so what a week leaves isn't lost at the week's reset. docs/reference.md says so, and gateway-routing.md names Fullest/usedRenews. Run: - go test ./internal/provider ./internal/gateway -run 'Fullest|UsedRenews|Weigh|Routing|Smart' and the packages whole. - TestUsedRenewsWithItsOwnWindow fails with left.fullest set to the biggest window's reset (broken by hand, then restored). - routing-key-windows.test.cjs: 44/44 in Chromium and WebKit, all languages and widths; it fails on HEAD's routing.js. - Every routing-*.test.cjs plus panel-routing in both engines: 594/601. The 7 WebKit failures are clicks waiting for an element to be "stable" under load average ~44, in routing-group-fold (#1612, #1672), routing-sessions (#1307) and routing-days-fit. routing-days-fit passes run alone. The other two fail the same alone with HEAD's routing.js. Not tried against a real Factory account: the windows are those the Factory plugin's limitWindows reports (5h/7d/30d with resetsAt). * davsync: a write a server without conditional PUTs let another go over is merged again at the next sync (#1776) On an S3 server that refuses If-Match (Aliyun OSS answers 400 NotImplemented), put falls back to HEAD then an unconditional PUT. Two computers writing in the moment between both pass the HEAD, both are told they wrote, and the later file is kept. Worse, the loser's next sync then took the winner's file as having seen its own: its st.Remote was the file it wrote, so its changed parts looked unchanged here and changed there, and the old parts were brought in over its own changes. The edit was lost on the server and on the computer that made it. - version.Blind marks a write the server didn't check (s3.go's fallback). - state.Blind keeps, for such a write, the file's sum and the remote and local part hashes from before it. The next sync that reads another file than that one merges from before the write. What this computer changed counts as changed again and goes back up beside the other's. A 304 or the same file clears it. Restore and Upload clear it. - docs/reference.md says what happens on such a server. No compare-and-swap exists on OSS, so the race itself isn't closed: the other computer's file is kept for up to one sync interval (3 minutes) before this computer's change is merged back. The reporter's AppendObject journal would close it but needs every computer upgraded and OSS-only signing. If the other computer saw this one's write and then changed the same part again, the next sync can't tell that from a write that went over it. It counts the part as changed on both sides: the newer stays, the other is saved, and a notice says so. Nothing is lost. Run: - TestS3BlindWriteGoneOverIsMergedAgain (fake S3 with no conditional writes, two computers): A renames a provider and B sets the theme, B's PUT goes over A's, then A's next sync puts both on the server with no conflict notice, B brings in the rename, and nothing more is written. With the reset taken out (broken by hand), it fails: "A's rename here after its next sync: \"DeepSeek\"". - go test ./internal/davsync whole. Not tried against real Aliyun OSS: the fake answers conditional PUTs the way the reporter quotes OSS (NotImplemented). * provider, gui, cli: a group can keep its models out of the lists agents see, offered through the group alone (#1783) cybershape asked for a client's model list to show only a group, not every model behind it. A provider could already be kept for routing groups (Provider.Unlisted), but that hides the whole provider, and the models a group names may come from providers used elsewhere too. Group.Unlists (json "unlists"): the models a group names (a member fixed at an effort counts as its model) and those its patterns match leave Catalog(), so `magpie models`, /v1/models and every agent's list (CatalogFor) show the group without them. They stay in Served(), so a group routes over them and a request naming one as provider/model is still answered, and Unlisted() returns them for the GUI as it does an unlisted provider's. A nested group keeps its own setting; a group switched off or hidden keeps nothing out. With no group unlisting, Catalog() takes a fast path and is unchanged. - Routing view: the group editor's "Model lists" (Its models too / The group alone, segmented, with a hint), saved with Save; the card shows "Its models unlisted". Both group Save paths send unlists. zh, zh-TW, ja, de. - CLI: `magpie group set listed=no|yes`; `magpie group ` shows listed: no. - TUI: the group member picker offered Catalog(), so models kept out of the lists (an unlisted provider's, before this too) couldn't be put in a group from the TUI. It offers Served(), as the GUI's picker does. - docs/reference.md, Routing groups: listed=no. Product call: a per-group switch, off by default, rather than hiding members of every group, so existing lists don't change under anyone. Run: - go test ./internal/provider -run 'Group|Catalog|Unlisted|Served', ./internal/gui, root package, ./internal/tui: ok. TestGroupUnlistsItsModels fails with the Catalog filter removed; TestMemberOptionsOfferUnlistedModels fails with the picker on Catalog(); TestApplyGroupPairs covers listed=no/YES/maybe. - GUI group-unlists.test.cjs, Chromium and WebKit, en zh zh-TW ja de, at 1100px and 420px: 20/20. i18n-keys: ok. - gofmt; go vet darwin, windows, linux (-tags nogui): clean. Not tried: with the reporter's own client; a real agent's model file written after toggling (CatalogFor is covered by the test). * plugin, gui: an installed plugin's row and page show its own magpie.icon, not its first provider's (#1775) peterroe's plugin signs in to several providers. Each provider gets its own picture from the auth hook, and package.json's magpie.icon is the picture for the plugin itself. Settings → Plugins → Installed only took a plugin picture from the market listing. A plugin that isn't listed (installed from a path, git or an unlisted npm package) had none, so its row and its page showed its first provider's picture. - plugin.InstalledIcon reads magpie.icon from the installed package.json. It goes through the same ownIcon check as a listing's icon (data: or https only). - pluginsState stores the picture through provider.RepoIcons, as listed plugins' pictures are, and returns it as `icon` on each plugin entry. - plugins.js: the installed row and the detail page use the listing's icon, then the plugin's own, then its first provider's, as before. - Docs (en, zh, ja): magpie.icon is the plugin's picture (Discover card and Installed row) and the fallback for providers without their own. A plugin of several providers gives each provider auth.icon. Run: - go test ./internal/plugin ./internal/gui: ok. TestPluginsStateGivesThePluginsOwnIcon covers a data: icon (kept), no icon and a plain-http icon (both ""). - internal/gui/tests/plugin-own-icon.test.cjs: Chromium and WebKit, en, zh, zh-TW, ja, de, at 980 and 420 wide. It fails on the old plugins.js (the row shows pa.png). - The plugins GUI tests: 34/34 in each engine. - gofmt; go vet darwin, windows, and linux -tags nogui. - Full go test ./...: the only red is gateway OTel timing under load ~79. That's #1794, commented there; alone it passes 3/3. Not tried with peterroe's real package; the fixture follows the layout the issue describes. * proc, provider, agent: a claude (or other agent CLI) that is a mise wrapper script is run as the program mise names, and a Claude sign-in that gets no link says which program it ran (deluxe on Discord) deluxe (Omarchy Linux, magpie started from the desktop) never saw the Claude sign-in link. ~/.local/bin/claude was a script ending `exec mise x "claude" -- "claude" "$@"`; without the shell's mise environment, `mise x` looks claude up on PATH, finds the same script (~/.local/bin is before mise's shims) and it runs itself for ever. What changed: - proc.Unwrap / proc.LookPath (internal/proc/wrapper.go): a small #! script whose line is `[exec] mise|rtx x|exec [opts] [tool] -- ` is resolved with `mise which ` (then `mise which --tool `), run as a probe (process group killed) with a 5s timeout, magpie's environment and the home folder as cwd. The answer must be an executable file that isn't the wrapper or another wrapper; otherwise, or with no mise, the old path is kept. Answers are cached per file (path, mtime, size); a failed ask is retried after a minute. Windows is unchanged. - proc.FindTool (claude via claudecode.Find: the sign-in, the gateway's Claude subscription, `magpie claude-code`) unwraps what it finds. - The siblings that looked an agent CLI up with exec.LookPath use proc.LookPath: agent.binAt (detection, CLI version/update), codex, kiro-cli, devin, cursor-agent, Air's opencode, nativemodels' npm package lookup. - The Claude sign-in already gave up after linkWait (30s) with "claude auth login gave no link to open". It now adds the last line the CLI printed, or, when it printed nothing, the program it ran and to run ` auth login` in a terminal to see what it does. asdf shims (`exec asdf exec "claude" "$@"`) are left alone: asdf exec resolves the real program itself and doesn't recurse. Verified (macOS, sandbox HOME, Go caches pinned): - New tests: internal/proc/wrapper_test.go (wrapper -> mise's program; no mise -> wrapper; mise fails / names the wrapper / names a folder / hangs -> wrapper, and the hung mise's pid is gone; deluxe's own fixed script, a node launcher, a wrapper of another command, a commented line -> unchanged and mise never asked; parse cases; --tool retry), internal/provider/signin_claude_wrapper_test.go (the full Claude sign-in through the wrapper with a fake mise that really recurses: link shown, account added; with no `mise which`, the sign-in fails in linkWait naming the wrapper). - Break checks: with find.go put back, TestFindToolUnwrapsMiseWrapper and TestFindToolAsksWithWrappersTool FAIL (FindTool = the wrapper), and TestClaudeSignInThroughMiseWrapper FAILs with "claude auth login gave no link to open: .../local-bin/claude printed nothing in 5s". With the old error string, TestClaudeSignInWrapperThatNeverStarts FAILs. - gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; GOOS=linux go build -tags nogui; GOOS=windows go build. - go test -tags nogui ./...: every package ok except internal/agent and internal/gateway, which hit the default 10m timeout with the machine at load ~45 (different tests each run, none in the new code). Those two were rerun with -timeout 40m; origin/main 217d2f8f2's internal/agent alone took 2094s under the same load. - Rebased on 9964535ad, -timeout 40m: internal/agent ok (1689s), internal/proc ok, internal/provider ok (681s), internal/claudecode ok; internal/gateway FAIL in one test, TestCodexHeardWithinItsIdleTimeout (3.78s against its 3s wall-clock bound, body right, no retry taken). Alone with -count=5 it passes 5 of 5. Filed as #1800; unrelated to binary lookup. Not verified: no real mise or the reporter's Omarchy machine; the fake mise stands in for mise's which/x. The wrapper fixture is the line the reporter quoted, not their whole file. * gateway: a Claude Code turn after its prompt suggestion goes on in its run, taken back from the suggestion; a turn that finds no run says why (#1638, chicring) Cause (case 2: 41 messages told to a new Claude Code at 02:40:00, minutes after the last reply at 02:37:13, no stop log). Claude Code 2.1.290 asks its prompt suggestion after each turn: the conversation so far, with the turn's system prompt, tools and thinking, and one more user message, "[SUGGESTION MODE: ...", with no system message after it. That request goes on from the turn's reply, so resume handed it the conversation's run, and ended kept the run waiting at the suggestion's reply. The user's real next turn didn't follow the suggestion, found no run under its key, and was told the whole conversation in a new run (88k tokens written to the cache again). Nothing was logged because nothing ended. Fix. ended keeps, beside the run's new key, the key it went on from (behindKey) and the turn's uuid (behindTurn). resume, finding no run under a turn's key, takes one whose behindKey is that key, rewinds it to behindTurn (rewind_conversation, as letGo does), marks it rewound so it isn't shelved, and tells it only the turn's messages. A run that can't be rewound is let go and the turn told whole to a new run, as before. Logging. A turn after a reply that starts a new run logs "claude: no run waits for this turn: " (whyNoRun): it went on with a turn this one doesn't follow, waits under another key (model, settings, system prompt or tools differ), waits at an earlier turn, is busy, ended (how long ago and why: abortFor's reason, or how Claude Code exited), or no run here had the conversation. "tool results no run waiting" now adds "the run that made the calls ended Xs ago: " (whyCallsLost). Case 1 (499 mid-reply, then "tool results no run waiting" and 17 messages told) is not fixed. The run that answered had been started anew for that turn, so letGo has no earlier user message to rewind to, and its results were already handed to it over MCP. Keeping its cache would mean rewinding to Claude Code's own tool_result message and telling the results again as text, or interrupting instead of ending the run; neither can be checked without the reporter's request shapes, and a fork that took the lead's calls (claimResume) looks the same from here. The new log line says which run ended and why, so the next report can tell. Tests (claude_side_question_test.go), with 2.1.290's request shapes (billing line with changing cch, 1h cache_control, adaptive thinking, output_config effort, context_management, system messages, signed thinking sent back): - TestClaudeSideQuestionKeepsTheConversationsRun: turn, turn, suggestion, real turn go to one Claude Code (turn 4), rewound to the suggestion's uuid, told only the new message; twice. Red with the take-back disabled ("went to another Claude Code: pid ... turn 1"). - TestClaudeSideQuestionNotRewound: a run refusing the rewind is let go, the turn goes to a new run, 1 run left. Red with the fix disabled (2 runs). - TestClaudeNoRunSaysWhy (gone / another key) and TestClaudeToolResultsNoRunSaysWhy: red with the log line, or the lostCalls record, removed by hand. Run: - the new tests -race -count=5: ok - real e2e: the real 2.1.290 client in -p --prompt-suggestions against the bridge, whose Claude Code was the real 2.1.290 too, both against a local mock of Anthropic: one bridge run for the whole session, "taken back from the side question" logged after each suggestion, 0 runs told the whole conversation; the real turn's request to the mock went on from the reply before the suggestion, without it. - gofmt -l .: clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok - set -o pipefail; go test -tags nogui ./... at load average ~45-53: every package ok but agent, gateway, library, plugin and provider, which hit go test's 10m default. Rerun with -timeout 40m -p 2: agent, library, plugin ok; gateway red only in TestOTelWaterfallIncludesUnbilledFallback and TestOTelWaterfallFailureAndCancellation (#1794, already filed: they read only the first OTel export; -count=10 alone passes); provider red only in TestCopilotSecretToolUsername (#1627, already filed; red 1 of 5 alone under load, then 5 of 5 green). Neither touches this change. - the new tests with the bridge's neighbours (LetGo, TurnGivenUpOn, ToolResultsGivenUpOn, Idle, EndedRunSaysWhy, ForksAnswering) -race -count=5: ok Not tried: the real Claude subscription upstream, the interactive TUI (the -p flag turns on the same suggestion), other side requests (extract_memories, away_summary, /btw), case 1's actual requests. * provider: a third-party Anthropic API that refuses x-api-key and Authorization together is sent one, picked in the editor or learned from its 401 (Aloha on Discord) magpie sends a user's own Anthropic-compatible provider its key in both x-api-key and Authorization: Bearer. Some relays answer 401 "鉴权 header, x-api-key 和 Authorization 不可以同时存在", so every request failed. - Provider.AuthHeader ("" both, "x-api-key", "bearer") picks which AuthHeaders sends on the Anthropic protocol. Anthropic's own API, Bedrock, Azure, Vertex and subscription accounts are untouched: they send x-api-key alone (or their own) whatever it says, and BothAuth() is false for them. - Left at both, a 401 whose body catalog.BothAuthRefused tells as that refusal (names both headers and says they can't be together, Chinese or English) is asked once more with x-api-key alone, then Bearer alone (RetryOneAuth, in the gateway's forwardOnce and the provider test's probe; the model-list fetch through catalog.fetchOne too). The first not answered 401/403 is saved (LearnAuthHeader), never over a pick the user made. A request carrying the user's own Authorization/x-api-key header is never retried; any other 401 is passed on as it came, asked once. - The editor has a "Key header" row (Both / x-api-key / Authorization: Bearer, the app's segmented control) while the provider has a third-party Anthropic URL; strings in zh, zh-TW, ja, de. - docs/subsystems/providers-accounts.md: an "Anthropic key header" row. Run (sandbox HOME, GOCACHE/GOMODCACHE pinned, set -o pipefail): - gofmt -l; go vet ./...; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet ./...; GOOS=linux/windows go build. - go test -tags nogui ./...: 47 packages ok; agent and gateway timed out at 10m under load average ~50-98 (other sessions' test runs), so rerun with -p 1 -timeout 60m: agent ok; gateway ok but for TestOTelWaterfallIncludesUnbilledFallback, a load flake unrelated to this (it reads only the first 200ms OTel export; passes 5/5 alone), filed as #1794. - New tests: internal/provider/authheader_test.go (official Anthropic and Bedrock unchanged for every pick; Aloha's 401 body retried with x-api-key and kept; Bearer-only relay learns bearer; the model list learns; another 401 and the user's own header aren't retried; a user's pick isn't overwritten), internal/gateway/authheader_test.go (a /v1/messages turn through the gateway to such a relay succeeds and the next Chat Completions turn goes with one header first). - Broken by hand: RetryOneAuth returning at once and AuthHeaders ignoring the pick -> TestAuthHeaderChoice, TestRetryOneAuthLearns, TestRetryOneAuthBearer, TestOneAuthHeaderRelay FAIL; the list retry off in live.go -> TestListLearnsOneAuth FAIL. - GUI: provider-auth-header.test.cjs 20/20 in chromium and webkit, en and zh, 390px wide; the editor's other tests (provider-*, nokey-editor, editor-short-window, segs-*, vertex-editor) 439/440, the one (provider-discovery, chromium zh) passing 26/26 alone. Not tried: a real relay of Aloha's; the retry is built from the body the user quoted. * provider: moved WorkBuddy users get plugin 0.1.15 and Command Code users 0.1.11 (magpie-community/plugins#96, #91) WorkBuddy 0.1.15 (wowyuarm's plugins#96): a system prompt sent as a developer message no longer fails the channel check with 400, an object tool_choice is sent the way WorkBuddy takes it, and max_completion_tokens goes as max_tokens so the output cap holds. Command Code 0.1.11 (plugins#91): a streamed Go reply the upstream cuts off after it has said something ends cut short with a note instead of losing the turn. Only the movers' min strings and their notes change. Both versions were checked on npm with npm view. The plugins session ran #96 against the real WorkBuddy AI endpoint before and after the change. Ran: gofmt -l, and go vet ./internal/provider on darwin and windows. go test ./internal/provider -run 'Mov|Migrat|Plugin|HandOver|Adopt' passed in 129s. The full suite was not run, because this is a two-string change. * cli: magpie's commands move from the root into internal/cli; the root keeps only main.go The root held 89 .go files (30 commands, 59 tests). They move as they are to internal/cli (package cli), with git mv so history follows them. The only code change is main() becoming cli.Main(version): the root's new main.go keeps `var version` in package main, so -ldflags "-X main.version=…" in the Makefile, the Dockerfile and magpie-releases, and every workflow, work unchanged. go-winres's rsrc_windows_*.syso still land next to package main in the root. Tests that read testdata by a root-relative path now go up one level (../plugin/testdata/fake, ../sessions/testdata). Five subsystem doc links point at internal/cli/. Run: - go build ./..., gofmt -l, go vet on darwin, linux and windows (nogui) - builds with tags production, dev, "production nogui"; windows -H windowsgui; linux CGO_ENABLED=0 - make release-cli TARGETS="darwin/arm64 linux/amd64 windows/amd64 android/arm64" VERSION=9.9.9-tidy: all four built, binary prints "magpie 9.9.9-tidy" - docker build --build-arg VERSION=7.7.7-tidy: container prints "magpie 7.7.7-tidy" - go test ./internal/cli (default and nogui): 152 tests, the same count as the root on main - go test ./...: all packages pass (agent, gateway, library, provider timed out at 10m under other sessions' load and passed rerun alone with -timeout 40m; none of them changed) - the built binary in a sandbox HOME: version, help, ls, providers, claude, and an unknown command's error * tui, provider, serve: a signed-in account's models are fetched at start, so Routing offers Cursor's whole list without m (#1789, reyoung) The terminal and `magpie serve` never called provider.FetchNew, which the window calls at start: a signed-in Cursor account's list exists only at Cursor, so the TUI's Routing pickers (and a headless gateway's /v1/models) offered the fallback cursor/auto alone until the list was fetched by hand with m on the Providers page. - tui: Init fetches the new lists (fetchModelsCmd, alongside the catalog sync). A model picker open when they arrive (Routing members, the classifier, a provider's models, an agent's model field) is filled in place through its relist, keeping its filter and the model under the cursor. A list left missing (no network) is asked for again a minute later (modelsRetry). Built on reyoung's branch and test. - serve: FetchNew at start, again each minute while a list is missing. - provider: FetchNew reports whether a list is missing, and waits for a CLI asked who is signed in for the first time (awaitIdentities), then lists the accounts again. With the real Cursor account in a fresh sandbox, `cursor-agent about` answered after a look's 3s firstAsk, so FetchNew saw no Cursor account and `magpie serve` still listed 1 model with the TUI fix alone. The window's startBackend gets the same wait. - docs: providers-accounts.md says who fetches the lists and when. Run: - internal/tui TestTUIFetchesSubscriptionModels (6 views) and TestTUIAsksAgainForAMissingList, -race x3; red with the Init fetch, the relist, the cursor restore or the retry tick each removed by hand. A first `about` slowed to 12s injected: passes (the test re-asks). - internal/provider TestFetchNewWaitsForASlowSignIn: red without awaitIdentities (no provider "cursor"); TestFetchNewAccount covers the missing result. - Real Cursor account, sandbox HOME with a keychain holding only Cursor's two items: TUI on main showed cursor/auto only in Routing; the fix shows the full list and "24 models" on Providers. `magpie serve`: main 1 Cursor model at /v1/models, the fix 24 within 5s. - gofmt -l, go vet (darwin, GOOS=linux, GOOS=windows), go test ./... in a sandbox HOME. Not tried: Linux and Windows real Cursor CLIs (the fake CLI tests skip on Windows); Devin's CLI identity goes through the same wait but wasn't tried with a real account. * gateway: the waterfall OTel tests read every export, not only the first (#1794) A request that outlasts one export interval (200ms in tests, a busy machine) has its attempt spans sent in one export and its root in the next, so TestOTelWaterfallIncludesUnbilledFallback and TestOTelWaterfallFailureAndCancellation, which read only the first, went red under load: on macOS CI for 23e764d0e and five times locally. They now take every export once stop() has flushed (otelExports), split traces from metrics by resourceMetrics, and check the spans of all of them. Run, with the export interval injected down to 1ms so the split always happens: the old tests failed 15 of 15 (-count=5) with CI's messages, the new ones pass 5 of 5; at 200ms 5 of 5. All TestOTel tests pass -count=2 except TestOTelSessionDiscoveredDuringFirstRequest, red 3 of 10 under load average ~90 on its 50ms session-cache window, untouched here and filed as #1811. go vet, gofmt. * agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X) 1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through (e8cd4bac8, 8c21a4184). This commit doesn't change them. serverReview now uses the shared AutoModeReviewed rule (adding the subscription account, which never reaches serverReview). - Codex/OpenAI and every other non-Claude model: magpie can't answer honestly. A verdict would be made up, and "unsupported" still shows the notice. So magpie answers nothing on Anthropic's behalf. Instead the Claude Code wiring writes env.CLAUDE_CODE_AUTO_MODE_SERVER="0" to settings.json. It does this only while Claude Code is routed through magpie and no model it can reach there is reviewed. That means checking the models shown to Claude Code (and Claude Desktop's while Desktop is on magpie), a shown group's members, those providers' fallbacks, and the models it is set to (claudeReviewed). If any one is reviewed, the variable stays unset, because /model can move the session onto it (the reason 8c21a4184 didn't write it at all). The value is rewritten on every model set and Sync, so adding a Claude provider turns the review back on. It is stash-tracked (claude.auto_mode_server): a user's own value is left alone, and magpie's goes on Disconnect, reset or a move off magpie. - T3 Code (sibling): its magpie instance runs Claude Code on the gateway through its own environment, so it gets the same "0" by the models it lists. Not covered: Claude Desktop's Code tab while Claude Code itself isn't routed through magpie. Desktop users are on Pro/Max/Team, which never see the notice. Tests (each fails with its part of the change broken by hand): - TestClaudeAutoModeReview: off on a non-Claude model; on with a Claude model shown, in a group or as a fallback; the user's "1" and "0" kept; dropped on reset and on a move to Claude Code's own model. A group that keeps its models out of the lists (#1783, Unlists) still routes to them, so its Claude member counts: members come from what is served, not from the catalog. - TestT3CodeAutoModeReview. - TestAutoModeReviewedRoutes: subscription, api.anthropic.com, relay, Bedrock and Vertex spellings yes; Codex, DeepSeek's Anthropic API, openai/gpt-6 and claudette no. Mutations that went red: skipping group members, skipping fallbacks, skipping an unlisting group, overwriting the user's value, not dropping it off magpie, always writing it, the T3 env always or never, and the subscription not counted. Real Claude Code 2.1.296, sandbox HOME/CLAUDE_CONFIG_DIR, magpie serve on 127.0.0.1:3591 under a scratch HOME, fake upstreams on 3593 (OpenAI Chat) and 3594 (Anthropic): - Before, on fakeai/fake-gpt, -p --permission-mode auto: the notice is on stderr (2 of 2 fresh config dirs). With the env in settings: none. - With this build, `magpie claude fakeai/fake-gpt` wrote the "0", and a fresh run shows no notice. The same settings without it show the notice. - `magpie provider add fakeanth anthropic=... models=claude-sonnet-5`: Sync took the "0" out. `magpie claude fakeanth/claude-sonnet-5` and a run in auto mode: the upstream got the dangerous-tool-use beta and `safeguards` on both turns, answered not_flagged in message_delta, and there was no notice. Not tried: the Claude subscription bridge with a real account (its plans don't see the notice), and a real Codex account (a fake Chat upstream stood in for it). Run: gofmt -l; go vet -tags nogui ./... for darwin, linux and windows; go test -tags nogui ./... in a scratch HOME with the Go caches pinned. The only red was TestOTelWaterfallIncludesUnbilledFallback, whose first export was cut before the root span under load. That is #1794, filed earlier today; this run is noted there. This change doesn't touch OTel. internal/agent was timed against the unchanged base under the same load and ran at the same pace. * provider: a Claude sign-in test's `claude auth login` run ends with the test, however it ends, and the mise-wrapper test waits the sign-in's own 30s for a link (#1802) #1802: TestClaudeSignInThroughMiseWrapper failed once at load 80-89 in 1.45s, and every provider test after it failed in 0.00s. The run's messages weren't kept. What was found, by forcing each failure by hand rather than rerunning: - The sign-in's run of `claude auth login` outlived the test that started it. A sign-in that gives up (no link in linkWait), or a test that fails between StartSignIn and the sign-in's end, leaves the run's goroutine letting go after the test: it reads claudeKeychain, removes its folder, forgets the account caches and, had the callback gone in, adds the account into whatever home is set by then. Under -race, TestClaudeSignInWrapperThatNeverStarts fails on main with that race (clearClaudeDir reading claudeKeychain while isolate's cleanup puts it back). - TestClaudeSignInThroughMiseWrapper shortened linkWait to 5s, so a busy machine starting sh, the fake mise and sh again could miss it. - miseWrapped set claudeExecutable and relied on fakeClaudeLogin's cleanup to put it back. - The cascade itself didn't come back. Forced failures with the sign-in waiting (A), finishing (E) and failed early (D, the CLI exiting at once, ~1.9s like the report), on the old code and the whole package for D: only the forced test failed, the ~100 after it ran and passed. Nothing found in the test explains every later test failing in 0.00s. One unproven candidate: this machine's disk is at 99% (9.9-12 GiB free today), and a full disk fails every test that writes a file at once. #1802 stays open for a run that keeps -v output. What changed: - claude_signin.go: claudeLogins, a WaitGroup of the `claude auth login` runs still going on, to the end of their goroutine. - signin_claude_test.go: fakeClaudeLogin, which every Claude sign-in test uses, registers endClaudeSignIns: when the test ends it cancels every Claude sign-in still listed (killing the CLI's process group) and waits for claudeLogins, failing the test if a run is still going after signInDeadline. It runs before the test's home and fakes are put back. - signin_claude_wrapper_test.go: miseWrapped puts claudeExecutable back itself; the through-the-wrapper test keeps linkWait's own 30s (the link comes as soon as it is printed); the never-starts test checks it gives up no sooner than linkWait and no later than linkWait + 1m. What was run (macOS, sandbox HOME, GOMODCACHE pinned, a private GOCACHE since the shared one was being emptied): - Old code (1bf722e28's tests), -race, -run 'TestClaude|TestCodexSignIn|SignIn': TestClaudeSignInWrapperThatNeverStarts FAILs "race detected". With this change: 181 pass, no race. - This change with a forced t.Fatal in TestClaudeSignInThroughMiseWrapper, with the sign-in waiting (A) and finishing (E), -race, the Claude, sign-in, Vertex, WorkBuddy-add, store-error and key-allowance tests: only the forced test fails, 306 pass each time. - gofmt -l clean; go vet ./... on darwin, GOOS=linux (-tags nogui) and GOOS=windows. - go test -tags nogui -timeout 40m ./internal/provider ./internal/proc: provider ok (774s), proc ok (26s), at load 75-90. * gui: on Linux the tray panel is a solid window with an opaque page, as the main window is, so scrolling it leaves no ghost of the old position (#1803) MizuIro-H (Bazzite / Fedora 44, KDE Plasma 6, Wayland) saw the panel's Allowances tab leave a fainter copy of what it showed at the old scroll position, on Wayland and under GDK_BACKEND=x11, with WEBKIT_DISABLE_COMPOSITING_MODE=1 (which magpie already sets under Wayland, so that try changed nothing), at scale 1, and without KWin's corner effect. The main window, with the same page, never did. The panel was the one window with per-pixel alpha: Wails' BackgroundTypeTranslucent on Linux makes it an app-paintable GTK window on the screen's RGBA visual under a 0-alpha webview, and body.panel painted --bg at 93% over it. Paint not cleared before a scroll repaint shows through 93%, which is the fainter copy. The main window is a plain solid window painting --bg whole. On Linux only, panelOptions now makes the panel BackgroundTypeSolid, and body.linux.panel paints --panel-tint as --bg (no alpha). The Mac (tinted by tintPanel) and Windows keep the translucent panel. The corners are square on Linux now (the body's paint fills the canvas). Run: gofmt -l internal/gui (clean); go vet darwin ./internal/gui, GOOS=linux -tags nogui ./..., GOOS=windows ./... (clean); go test ./internal/gui under a sandbox HOME (ok); node --test internal/gui/tests/panel-*.test.cjs, chromium and webkit (74 pass), the new panel-linux-opaque test across en/zh/zh-TW/ja/de and light/dark. Broken by hand: TestPanelSolidOnLinux fails without the panelOptions change, and panel-linux-opaque fails without the CSS rule (the Linux body read color(srgb ... / 0.93)). Not tried on the reporter's setup. A repro of the panel's window (GTK3 + WebKit2 4.1, RGBA visual, 0-alpha webview, 93% page) under Xvfb with picom, on Ubuntu and on Fedora 44 (WebKitGTK 2.54), scrolled by JS and by a real X wheel, with compositing mode on and off, showed no ghost either way: software rendering there doesn't reproduce it, so whether the opaque panel ends it rests on the reporter's KDE/GPU machine. No real Linux magpie build was run. * gateway: a request asks only the resting member back soonest, not every resting one, so a failing member isn't hammered by each request (#1799, dbydd) dbydd: a group's routing still goes over its members in order however they have been failing, and with providers magpie can't read a quota from, that is close to a DDoS of the ones that are down. What was there: a failure rests the member (credit 30m, quota till its reset, rate by Retry-After, anything else 1m doubling to 10m), and one answer clears it. But restLast only moved resting candidates behind the ready ones. Once the ready ones failed, every request went on to ask each resting member in turn, so the rest kept nobody back: in an outage of the whole group each request went to all N members, and the last one again on its retries. Now (probeOne, fallback.go): of the candidates resting, a request asks only the one whose rest ends soonest (the first in order on a tie), at its place. Every ready candidate is still asked in the user's order. A lone candidate is always asked. A group that is down whole takes one upstream request per request, and the backoff grows with each real probe instead of each request. The trace still lists every member, the resting ones with their rest. The same is applied where the other paths go over candidates: count_tokens, embeddings/rerank, image accounts (drawOnAccounts) and a group's System One decision models. Codex autoReset still looks over the whole list (all), so a week used up on every account still spends a reset. Default on, no switch: it only reads rests the user's order already demotes, and only within a rest's cooldown; once a rest ends, the member is back at its place in the user's order. Each request still makes at least one real upstream attempt and returns the vendor's own error. Scoping: only rests are read, and a failure about the request's content or its model rests no member (failShape, prompt, overflow, refused, loop, auth, proxy...; a model refusal rests only restID), so neither leaves a member out. Borrowed from AxonHub's error-aware load balancing (looplj/axonhub, docs/zh/guides/load-balance.md, ErrorAware), which dbydd pointed to: a failed channel's score drops and recovers as its penalty decays, rather than it being sent every request. magpie's rest and backoff already are that decaying penalty; asking the one back soonest is how it recovers. Not taken: a success-rate memory that keeps a member demoted after it answers. One answer means it serves now, a flaky member already rests at least a minute per failure, and holding it down past that would override the user's order beyond a cooldown. Unchanged: the last candidate still isn't rested by its own failure, and the Patience rounds (#1418) and retries on the last one re-ask only candidates already in the trimmed list. Tests (resting_probe_test.go): TestGroupAsksOneRestingMemberNotEach (three resting members, minutes apart: only the soonest is asked; with a ready member, it then the soonest), TestRetrievalGroupAsksOneRestingMember (embeddings), TestLoneRestingMemberStillAsked, TestProbeOne. With probeOne returning its input (the old behaviour), the first two fail: "resting members asked map[a:1 b:1 c:1]". TestSystemOneDecisionGroupFailsOver held the old behaviour (all failing: kb, ka1, ka2 asked, ka2's 503 back); it now wants kb then ka1, the one rested first, and ka1's 429 back. Run: gofmt -l (clean); go vet (darwin, GOOS=linux -tags nogui, GOOS=windows); GOOS=linux -tags nogui and GOOS=windows go build; go test -tags nogui ./... -timeout 40m under a sandbox HOME at load average ~100: every package ok but gateway and agent, which hit the 40m timeout mid-run (TestZenUnsupportedModelLeavesTheListAlone and TestSnowNoProfiles running, a few seconds in), and plugin, where TestNPMInfoDeadline hung on its own failed 2s check (filed #1808). Rerun alone with -timeout 80m: gateway ok (1896s), agent ok (1811s), plugin ok (746s). Not run: a real upstream outage, the Windows box; count_tokens and image accounts have no test of their own. * provider: a switch of Claude Code's sign-in takes the account's own proxy into its env, and out again for one without (#1807) kensenzhao signs Claude Code in to several accounts in direct mode and gives each its own proxy in magpie (AccountProxies). Those proxies were only ever honoured on what the gateway sends; Claude Code signed in to its own subscription asks Anthropic itself, through the proxy its env names, so a switch (by the user, or SwitchWhenSpent) left every account on one route. Decision: while the Claude subscription has a proxy for any of its accounts, settings.json's env names the proxy of the account Claude Code is signed in to: its own, else the subscription's (ProxyOfLogin, which also covers the first account whose proxy is kept as the sub's, #1663). None for "direct", and none for a SOCKS proxy, which Claude Code can't use (logged). HTTPS_PROXY and HTTP_PROXY are written, with NO_PROXY set to loopback so the gateway and local MCP servers are reached straight. With no account proxy at all nothing is written: the subscription's proxy alone was never Claude Code's, and turning it on now would change every existing user's route unasked. A proxy the user set themselves wins. magpie records the values it wrote (claude-proxy-env.json beside providers.json) and a key is its own only while it still holds that value; any proxy key that isn't (in either case) means the route is the user's, so magpie writes none beside it and takes out only its own. A NO_PROXY/no_proxy the user set stays. A settings.json or record that can't be parsed is an error, never empty: the file is left as it is. It runs on every switch (switchLogin), on Save of the Claude subscription (a proxy picked for the account it is on), and on the gateway's 5-minute KeepOnAnAccountWithRoom tick (a sign-in made in Claude Code itself). Claude Code reads its env as it starts, so running sessions keep the old route; the log says which proxy new ones take. Run: go test -tags nogui ./internal/provider (676s, ok) in a sandbox HOME. TestClaudeSwitchTakesTheAccountsProxy fails with the sync call taken out ("on b, HTTPS_PROXY = "", want b's proxy"); TestClaudeAccountProxyKeepsTheUsersOwn and ...EditedByTheUserStays fail with the user-route check forced off, and EditedByTheUserStays with ours() always true. gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows; windows and linux builds. Not tried: a real Claude Code session going through a real proxy after a switch, and a remote LAN gateway's address isn't added to NO_PROXY. * gui: Windows without the WebView2 runtime says so in a message box and offers the download page, instead of a double-click doing nothing (#1806) magpie's windows are WebView2, which Windows 10 doesn't always have. Without it Wails handed the failure to ErrorHandler and exited, and the desktop build (-H windowsgui) has no console for the log line to land in: ufec's double-click came up to nothing at all. ufec found the cause, that Wails' own Env.Info().PlatformInfo["WebView2"] answers "" then, and that a box can't come from ErrorHandler (it runs on the thread Wails makes its windows on); this takes both from their branch. Run asks webView2Check right after application.New, before any window. Missing, it logs it and shows MessageBoxW (Yes/No, error icon, topmost) in the reader's language (trayLang): the runtime is missing, Microsoft's page https://developer.microsoft.com/microsoft-edge/webview2/, that "magpie web" and "magpie tui" work without it, and whether to open the page now; Yes opens it (ShellExecute), and Run ends. A key Wails doesn't set is read as present: refusing to start a magpie that would have worked is worse than the silent exit. The tray isn't kept: its panel is a WebView2 window too. Run: TestWebView2Missing and TestWebView2Notice (all OSes); TestWebView2MissingFromWails on the Windows box (10.0.0.132, Windows with WebView2 installed): a child process with Wails pointed at a folder that isn't a runtime reads missing, the machine's own runtime reads present. TestWebView2Missing goes red with webView2Missing made to answer false. On the box, a throwaway -H windowsgui test binary calling webView2Check with that bogus runtime path, run in the desktop session: the box came up titled "magpie 需要 WebView2" with the Chinese text, the page and 是/否 buttons (read back from the dialog's controls), the log line was written, pressing 是 opened the page in Edge and the check answered false. go test -tags nogui ./internal/gui in a sandbox HOME; gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows; windows and linux builds. Not tried: a machine that really lacks the runtime (the box has it; the missing case is Wails' lookup failing on a path that isn't a runtime, the same failure), nor a real magpie.exe start through Run. * agent: dsh's web search asks the searcher picked under Settings › Web search, not the model dsh starts on (我只会玩单机 on Discord) magpie's web-search-deepseek row in dsh's cordis.patch.yml was written with the model dsh starts on (ref). The gateway then sent each search to that model, which can't search itself and asked the searcher in turn: two requests per search, and timeouts when the start model can't take concurrent calls. The user had picked "6 Luna" under Settings › Web search, and it was never written. gateway.NamedSearchModel gives the searcher Settings names as "/" (empty when none is named, search is off, the one named can't be used, or it searches with no model). dshSearchModel uses it for the row on Set and on dshRouteAgain's ~30s pass, so a change in Settings reaches dsh's file, and clearing it gives the start model back. A row the user wrote themselves (no # magpie) stays untouched. Run: go test -tags nogui ./internal/agent -run TestDsh (ok); TestDshSearchAsksNamedSearcher fails with dsh.go and dsh_search.go reverted; gofmt -l clean. Not tried with a real dsh, nor whether a real searcher model answers dsh's web_search end to end. * provider: Cursor's grok-4.7 fast ids are priced at Cursor's fast rate, so a routing group of them counts its cost (TradingLife on Discord) A group of Cursor's and Grok's Grok 4.7 fast recorded calls with no cost. Cursor's ids grok-4.7-fast, grok-4.7--fast (and at a window, @500k) had no price anywhere: no models.dev catalog lists them, and 30431e04 left fast ids unpriced on purpose rather than make one up. So every usage record on them (provider cursor, model grok-4.7-fast) was unpriced, and the group, whose price needs every member's, had none. Cursor publishes the price (https://cursor.com/docs/models, read 2026-10-12): Grok 4.7 (Fast) $4 input / $1 cache read / $12 output per million, "Fast mode for long context (>256k) is billed at 3x standard rates". Provider.ListPrice now gives a Cursor account (the built-in's or the Cursor plugin's) that price for its fast Grok 4.7 ids, with a tier above 256k at $6 / $1.5 / $18. Scoped to Cursor: elsewhere a "-fast" Grok id is a model of its own (xAI's grok-4-fast is $0.2 / $0.5), and Grok Build's grok-4.7-build-fast (Grok's own list) has no published price, so it stays unpriced, as does a fast id of a model Cursor gives no fast price for. Run: go test -tags nogui ./internal/provider ./internal/sessions ./internal/usage (ok); new TestCursorGrokFastPrice fails with the lookup switched off; gofmt -l clean. Not done: a group member sent fast through Group.Fast (the plugin's grok-4.7@256k with service_tier priority) is still recorded at the standard price, since a usage record doesn't say it went fast; not checked against the reporter's own usage log. * library, gui: a skill pack added a while ago is grouped whole, and the Skills head has Group again (White Immortal on Discord) Of mattpocock/skills' 38 skills only 20 were grouped with the repository on the Library page; the rest sat under On this computer, and nothing could trace them again. Cause: installing from a repository again (noteFrom) grouped a library skill with it only when its SKILL.md was byte for byte the repository's. A pack added a while ago is mostly older copies: of the copies at mattpocock/skills 3cca18b3 (2026-09-04), 18 of 37 match HEAD; at 8b78b531 (2026-08-13) 2 of 35. The GUI's parts draw all 38 when the data has them (checked with a Playwright run against 38 skills in the repo's real folder layout, github, lock-traced and mixed paths, both engines). noteFrom now also notes a skill traced to nowhere by a name the repository has, when the library has others from that repository (same file, or traced there already). A skill traced to another repository, and a same-named skill when the library has nothing from there, are left alone. RegroupSkills (POST /api/library/skills/regroup) fetches each GitHub repository the skills are traced to and runs the same; it fails only when no repository could be fetched. The Skills head has Group again (busy while it runs, status says how many joined), en/zh/zh-TW/ja/de. Run: TestRegroupOlderCopies (fails with the name match off: edited and later stay ungrouped), TestInstallAgainNotesFrom, TestSkillRepoTraced; skill-regroup.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de at 1100 and 440 wide (red on the old assets: no Group again); skill-parts and i18n-keys pass; go test -tags nogui ./internal/library ./internal/gui ok; gofmt, go vet. Not tried against the reporter's library or real GitHub. * provider, gateway, gui: an account whose sign-in its vendor revoked or refused reads as signed out and is passed over, not asked on every request (#1793 ysicing, echo_ts on Discord) What changed, one fix for the class: - ChatGPT and the other built-in subscriptions (#1793): ChatGPT answered 401 token_revoked on every request, request after request (~18 rows in the reporter's log), because a refused sign-in was just "other" and rested a while, then asked again. Now a 401 whose words say the sign-in is gone (provider.SignInRevoked: token_revoked, token_invalidated, invalid_grant, refresh_token_reused/invalidated/expired; never token_expired, a 403, a 5xx or a network error) marks the account for the credential it was sent with (a 12-byte hash of the header, never the credential), in logins.json as Refused "revoked:" plus Lapsed. A saved ChatGPT account is refreshed first, as Codex does on a 401; a refresh that goes through marks nothing. The routing loop fails it as failAuth (next member at once, no rest); forwardOnce answers its later requests with magpie's own 401 without asking the vendor; compaction on a magpie account (compactOn) picks a marked one last. Signed in anew (upsertLogin with another credential, addSideLogin), refreshed, or a request served, the mark is gone. Claude, Copilot and plugins keep their own marks; a key's provider answering the same words rests as before. - Copilot (echo_ts): a built-in Copilot account whose GitHub token GitHub refused (401/403 on the token exchange, the CLI stand-in or the usage read) is marked lapsed on its own account (copilot_lapsed.go), unless a working CLI stand-in serves; cleared when a token is served or it signs in again. 5xx and network errors never mark it. - GUI: such an account's row says Sign-in required with Sign in again (Copilot's on its GHE.com host) and Remove, the reason on its allowance line in the user's language (zh, zh-TW, ja, de added); the card says Signed out once every account in use is. - docs/subsystems: providers-accounts "A revoked sign-in", gateway-routing. What was run (sandbox HOME, caches pinned, worktree only): - go test -race on the new tests: provider TestSignInRevokedWords, TestRevokedSideLoginMarkedTillSignedInAgain, TestRevokedCodexRefreshedFirst, TestRevokedSignInLeavesOthersMarks, TestUpsertLoginKeepsRevokedMarkForTheSameSignIn, TestCopilot* (7); gateway TestRevokedSignInPassedOverTillSignedInAgain (fake ChatGPT backend, zstd, real routing: turn 1 asks acct-1 then acct-2, turns 2-4 and after a restart acct-2 only with no rests, after a new auth.json acct-1 again and the mark gone), TestRevokedSignInNotCompactedOnAgain, TestRevokedWordsFromAKeyRestAsBefore. - Broken by hand, each turned a test red: the forwardOnce short-circuit, the failureOf clause, noteSignIn in codexUpstreamOn, compactOn's skip, ServedSignIn, its in-memory delete, the 401-only check, refresh-first, upsertLogin's keep and its sameAuth, sideLogins' Lapsed and addSideLogin's clear; and the six Copilot breaks. GUI: the signedOut and quotaError lines each turn revoked-signin-account red. - GUI (Chromium and WebKit, 420 and 1100, en/zh/zh-TW/ja/de): revoked-signin-account (new), copilot-signed-out-account (new), and the account-*, claude-*, codex-*, plugin-*, quota-*, signin-*, routing-*, usage-accounts* suites: 1605 pass, 7 fail. Six are WebKit routing-group-fold/routing-sessions/routing-steady cases that fail the same on a clean 9964535ad run alone (#1672, #1612, #1307, #1804); one, signin-proxy Chromium de 380, timed out under load (load ~60-75) and passed 2 of 2 after, filed as #1814. - gofmt; go vet darwin, linux (nogui) and windows; linux and windows builds. go test ./...: every package ok but gateway, where TestOTelFastRequestTranscriptDiscovery and TestOTelWaterfallIncludesUnbilledFallback failed under load (#1794); both pass alone, -count=3. Not verified: no real revoked ChatGPT or Copilot account was tried; the words come from the reporter's screenshot and OpenAI's documented codes. Codex's own relayed sign-in (not one of magpie's accounts) isn't marked: Codex refreshes and signs itself in. The short-circuit in codexUpstreamOn (compaction on a marked account, reached only when every account is marked) has no test of its own; plugins are left to their plugin. * gateway: a Claude turn that calls a tool and then thinks without showing it reaches Codex whole, ending in response.completed, not cut short by a panic (#1786) The Responses encoder read the open function_call's id and name from the collector's last part. When a hidden thinking block came after a tool_use (a redacted_thinking block, or a thinking block signed with no text, from content_block_start or a signature_delta), the collector had already appended that thinking, last(ToolCall) was nil, and closing the call dereferenced it. The server recovered the panic mid-stream, so the client saw a 200 chunked body cut short ("unexpected EOF", "stream disconnected before completion") and no response.completed. The encoder now keeps the open call's id and name itself (e.call), set when the item opens, for closing it and for the custom-tool check on its argument deltas. The other stream encoders (Chat, Anthropic, Gemini) track their open tool call in their own state and never read the collector's last part, so only this one had the bug. Verified: - TestResponsesStreamToolThenHiddenThinking runs the reporter's sequence through a real gateway server (httptest) to a fake Anthropic upstream and a real HTTP client: redacted_thinking, empty thinking signed at its start, empty thinking signed in a delta, and visible thinking as the control. With the old responses.go the three hidden cases FAIL with "status 200, the stream was cut short: unexpected EOF" and the log shows the nil pointer panic; the visible case passes on both. - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go test -tags nogui ./... (see the push). Not done here: the max_tokens setting the issue also asks for is a separate feature request. * gui: the sidebar's Installed under Plugins is selected on its own row, not a third of a row up over Discover (#1787) The sidebar's list of a page's tabs (.nav-sub) unrolls from height 0 as the page opens (navSubEnter). Its rows were flex items that shrink, so while the list unrolled they were squeezed, 18px tall at 19px down instead of 26px at 27px. Plugins draws its tab strip again once /api/plugins answers ("Installed" becomes "Installed · 2"), navSubs then rebuilds the rows, and navSubMark measured the squeezed row for the selection. Nothing marked it again after the unroll, so with Installed saved as the tab the grey selection sat 8px up and 8px short, over Discover's text: the reporter's screenshot. The rows are now flex: none, so they keep their size and place while the list unrolls or folds, and offsetTop is right whenever the strip is drawn again. The other pages' lists (Library, Usage, Settings) share the rule. Run: - new internal/gui/tests/nav-sub-unroll.test.cjs: Plugins with Installed saved, /api/plugins held until the list is animating, then answered. Chromium and WebKit; en, zh, zh-TW, ja, de; 1024 and 1440 wide. - 20/20 fail on the old app.css (the selection at 444.6-462.6 against the row's 452.6-478.6). - 20/20 pass with the fix. - sidebar, side-toggle, side-width, plugin-check-updates, plugin-market, plugin-progressive and click-scroll in both engines: 82 pass. Not tried: the packaged app on the reporter's machine. The timing there is whatever /api/plugins takes; the test covers any answer that lands during the 460ms unroll. * omarchy: on Hyprland the tray panel opens under the click on a monitor that isn't at 0,0, not off the screen (#1785) PanelAt answered where the panel goes in coordinates across the whole layout (the cursor's, from hyprctl cursorpos), and PlacePanel handed them to Hyprland's move rule. Hyprland counts a move from the corner of the window's monitor (CDefaultFloatingAlgorithm::newTarget in 0.56.2: COMPUTED + MONITOR_POS), so the monitor's place was added twice. The reporter's click on the right of two 1920-wide monitors asked for 3238,40 and got 5158,40, off every screen. The monitor at 0,0 hid it, and the only setup tried before (bf25a3ae8) had one monitor. PanelAt now answers from the corner of the monitor under the cursor and names it. The rule says monitor = that name, so the move counts from the monitor clicked, not whichever one Hyprland would have opened the panel on. The panel is still kept PanelGap inside that monitor's work area, and the room below it is unchanged. ClickedOutside compares the cursor with the clients' places, both across the layout, and stays as it was. niri's placement already moves within the working area of the output and doesn't share this. The fix follows laojianzi's draft (laojianzi/magpie#1). Run: - internal/omarchy TestPanelAtMonitorOffScreenOrigin (new), with the reporter's two 1920x1080 side by side, the right edge, a monitor left of and above 0,0, and a scaled one below. It plays Hyprland's sum and checks where the panel lands and that it's inside the clicked monitor's work area. With the old sum put back by hand it goes red, landing at 5158,40 for the reporter's case. TestPanelAt's turned monitor had the old global x written into it, and now has 6. TestPanelRule checks the rule's text. - On the omarchy VM (Hyprland 0.56.2), with a headless second output at 1600,0 made for the try and removed after, the same Lua rule on a throwaway foot window titled magpie-1785-probe (not magpie's rule name): - monitor = "PROBE-1785", move = { 100, 40 } landed at 1700,40; - the old global 1700,40 landed at 3300,40, off the screen; - monitor = "Virtual-1", move = { 100, 40 } landed at 100,40. - go vet (darwin, windows; internal/omarchy for linux with nogui). gofmt is clean. Not tried: magpie itself on two real monitors under Hyprland. The Linux GUI build needs cgo and wasn't built here, so placePanel's two changed lines are covered by the darwin and windows builds (app.go has no OS tag). * agent, gateway: Claude Code on a model Anthropic doesn't review gets auto mode's server review turned off, so it no longer says magpie isn't eligible (1EFLOPS on X) 1EFLOPS runs Claude Code through magpie on Codex's gpt-6.1-sol. In auto mode, Claude Code 2.1.296 says "this session isn't eligible because your requests go through 127.0.0.1:3425 ... ask your gateway to implement https://code.claude.com/docs/en/auto-mode-classifier-billing". What the page asks of a gateway: pass the anthropic-beta header (dangerous-tool-use-2026-09-03), the request's `safeguards` field, and `safeguard_results` in the reply through unchanged, and leave tool-use ids alone. The results are verdicts from Anthropic's own safety classifier. For a gateway that can't provide them, the page's remedy is CLAUDE_CODE_AUTO_MODE_SERVER=0. Pro, Max and Team plans never see the notice. In the bundle, Claude Code falls back on server_unsupported, server_unavailable_disabled or server_no_result, and the notice shows whenever there's no real verdict. Only that variable removes it. Per route: - Claude subscription bridge, Anthropic API key, relays in front of Anthropic, Bedrock and Vertex: already pass the beta, `safeguards` and `safeguard_results` through (e8cd4bac8, 8c21a4184). This commit doesn't change them. serverReview now uses the shared AutoModeReviewed rule (adding the subscription account, which never reaches serverReview). - Codex/OpenAI and every other non-Claude model: magpie can't answer honestly. A verdict would be made up, and "unsupported" still shows the notice. So magpie answers nothing on Anthropic's behalf. Instead the Claude Code wiring writes env.CLAUDE_CODE_AUTO_MODE_SERVER="0" to settings.json. It does this only while Claude Code is routed through magpie and no model it can reach there is reviewed. That means checking the models shown to Claude Code (and Claude Desktop's while Desktop is on magpie), a shown group's members, those providers' fallbacks, and the models it is set to (claudeReviewed). If any one is reviewed, the variable stays unset, because /model can move the session onto it (the reason 8c21a4184 didn't write it at all). The value is rewritten on every model set and Sync, so adding a Claude provider turns the review back on. It is stash-tracked (claude.auto_mode_server): a user's own value is left alone, and magpie's goes on Disconnect, reset or a move off magpie. - T3 Code (sibling): its magpie instance runs Claude Code on the gateway through its own environment, so it gets the same "0" by the models it lists. Not covered: Claude Desktop's Code tab while Claude Code itself isn't routed through magpie. Desktop users are on Pro/Max/Team, which never see the notice. Tests (each fails with its part of the change broken by hand): - TestClaudeAutoModeReview: off on a non-Claude model; on with a Claude model shown, in a group or as a fallback; the user's "1" and "0" kept; dropped on reset and on a move to Claude Code's own model. A group that keeps its models out of the lists (#1783, Unlists) still routes to them, so its Claude member counts: members come from what is served, not from the catalog. - TestT3CodeAutoModeReview. - TestAutoModeReviewedRoutes: subscription, api.anthropic.com, relay, Bedrock and Vertex spellings yes; Codex, DeepSeek's Anthropic API, openai/gpt-6 and claudette no. Mutations that went red: skipping group members, skipping fallbacks, skipping an unlisting group, overwriting the user's value, not dropping it off magpie, always writing it, the T3 env always or never, and the subscription not counted. Real Claude Code 2.1.296, sandbox HOME/CLAUDE_CONFIG_DIR, magpie serve on 127.0.0.1:3591 under a scratch HOME, fake upstreams on 3593 (OpenAI Chat) and 3594 (Anthropic): - Before, on fakeai/fake-gpt, -p --permission-mode auto: the notice is on stderr (2 of 2 fresh config dirs). With the env in settings: none. - With this build, `magpie claude fakeai/fake-gpt` wrote the "0", and a fresh run shows no notice. The same settings without it show the notice. - `magpie provider add fakeanth anthropic=... models=claude-sonnet-5`: Sync took the "0" out. `magpie claude fakeanth/claude-sonnet-5` and a run in auto mode: the upstream got the dangerous-tool-use beta and `safeguards` on both turns, answered not_flagged in message_delta, and there was no notice. Not tried: the Claude subscription bridge with a real account (its plans don't see the notice), and a real Codex account (a fake Chat upstream stood in for it). Run: gofmt -l; go vet -tags nogui ./... for darwin, linux and windows; go test -tags nogui ./... in a scratch HOME with the Go caches pinned. The only red was TestOTelWaterfallIncludesUnbilledFallback, whose first export was cut before the root span under load. That is #1794, filed earlier today; this run is noted there. This change doesn't touch OTel. internal/agent was timed against the unchanged base under the same load and ran at the same pace. Re-run after rebasing on origin/main 94aa15397 (load ~100, so not the whole suite): gofmt -l on the touched files; go vet -tags nogui ./internal/agent ./internal/gateway for darwin, linux and windows; go test -tags nogui -count=1 ./internal/agent (1381s) and ./internal/gateway (939s), green. Breaking writeReview to never write the "0" turned TestClaudeAutoModeReview red, and dropping the subscription from AutoModeReviewed turned TestAutoModeReviewedRoutes red. * gui: the Agents page's hidden agents come last, behind a disclosure shut until opened (0xZaTe on Discord) 0xZaTe (#feedback): after hiding agents, they looked pinned, not hidden (看着反而像是一个置顶功能了 … 现在反而更显眼了). renderAgents put the fold's groups in the order [Hidden, Not set up], so once the fold was opened (its button then reads 「收起」, which is what they saw under Codex) the hidden rows, each with a Show pill, sat right under the agent in use, above the ones nothing is set on. What changed (internal/gui/assets/app.js, app.css, i18n.js): - In the fold, Not set up comes first. The hidden ones come last, behind a line of their own, 「已隐藏(2)」 / "Hidden (2)", with a disclosure chevron (right shut, down open), as a Finder sidebar section does. It is shut by default (showHiddenAgents), its rows inert while shut, and it unrolls on the same curve as the fold, the panel's edge moving with it (fit) and the view following (unrollInView). - The fold's button counts only the ones nothing is set on ("Show 3 more"), no longer "Show 5 more (2 hidden)". - With nothing but hidden ones folded, the fold is theirs: no second disclosure inside it, its button still reads "{n} hidden agents", and opening it leaves the hidden rows open, so Show on one of them doesn't shut the rest behind a new line once another goes under Not set up. - New strings in zh, zh-TW, ja, de; the unused "Show {n} more ({h} hidden)" is dropped. Siblings checked: the window and the tray panel draw the Agents list with the same code, so both get it. The Usage page's hidden clients are already a shut "{n} hidden" line under the list. The panel's Arrange (usage tab) is an edit mode that lists every subscription with Show/Hide in place, as iOS's edit lists do, so it is left as is. The model picker is a checklist. Tests: - new agents-hidden-last.test.cjs: the reporter's list (Codex connected, two hidden, three not set up). Order of the fold, the hidden rows out of sight and inert until their line is opened, then shown under it with Show, the button's count, no sideways scroll. Window at 420px and the tray panel at 380px, Chromium and WebKit, en/zh/zh-TW/ja/de, plus the hidden-only case. Run against the old app.js/app.css/i18n.js it fails on the order ([Hidden, agy, commandcode, Not set up, ...]). - hidden-agent-cleared and rollup-short updated for the new order and count. Run (macOS, playwright 1.62.0, both engines): agents-hidden-last, hidden-agent-cleared, rollup-short, show-unset-agent, fold-show-grip, agent-grip, grip-inset, panel-fold, panel-arrange, panel-effort, panel-profiles, click-scroll, usage-agents-hide, removed-hide, i18n-keys, gui-zh-tw, gui-ja, gui-de, lightweight and every agent-* test: all green. go test -tags nogui ./internal/gui/ ok; gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... clean. Screenshots of the window and the panel in zh checked by eye. Not run: the whole GUI suite (no shared class or API changed). * gui: a short window's sidebar has no scroll bar beside its pages, a thin one shows over them while they scroll and fades, as on a Mac (xybio and MOMO on Discord) In a window shorter than the sidebar's pages, .side-scroll (scrollbar-width: thin) and .side-foot kept a native bar and its gutter at rest on Windows and Linux. On Windows this was MOMO's report (v0.1.1207, WebView2): a classic, always-visible bar with arrows between the sidebar's items and the page, because Chromium drops every ::-webkit-scrollbar rule on a box with scrollbar-width set and draws the system bar. Both boxes now hide their native bars (scrollbar-width: none and ::-webkit-scrollbar display:none, which Chromium/WebView2, WebKit and WebKitGTK each honour), and app.js sideBars lays a thin overlay bar inside, shown on scroll, faded ~900ms after, kept while hovered or dragged, the thumb draggable with pointer capture, a click off it pages the box, hidden when the box fits. ResizeObserver/MutationObserver keep it placed as the nav's sub-tabs open and fold. gui-shell.md describes it. Run: new sidebar-overlay-scrollbar.test.cjs (chromium with native bars on, webkit; en, zh, zh-TW, ja, de at 1100x320 and a tall window) 14/14; it fails without the change (no bar shown while scrolling, 5/5 languages both engines). Its drag step first measured the thumb before the scroll event had moved it, pressed the bar below the thumb and paged the box (3 of 6 webkit runs red, "162 of 191"); it now waits for that scroll, and 8 webkit and 5 chromium runs in a row pass. sidebar, side-width, side-toggle, strip-scrollbar, view-scrollbar, view-scrollbar-drag, click-scroll all pass in both engines. Screenshots at rest and mid-scroll in both engines checked by eye. Windows: on the Windows 11 box, headless Edge 155 (WebView2's engine) rendered a sidebar box with origin/main's app.css and with this one. Old: 10px gutter and the classic bar with arrows, as in MOMO's screenshot. New: 0px gutter and no bar, with an unstyled overflow box beside it still drawing its 10px bar, so system bars were on. Not tried: the overlay bar's JS inside a real WebView2 or WebKitGTK window (it ran in Playwright's Chromium and WebKit only). * gui: Routing, Usage and Sessions keep to the width the other pages do on a large screen, centred (面条 on Discord) What changed: the window's page-width rule (#860), padding each view to max(16px, calc(50% - 600px)), now names #view-routing, #view-usage and to edge while Agents, Providers, Library, Gateway, Plugins and Settings sat in a 1200px column in the middle. A narrow window keeps the 16px gutter it had. Routing's two columns, the Usage cards' packing and the requests ledger lay out by the room they get (byWidth, packUsage), so they follow the narrower box: at 1920 Routing still gets its two columns (min1150) and the ledger fits 1200 without a sideways scroll. sess-agent-strip.test.cjs asserted that eleven long agent names fit a 1600px window's Usage page in one row. With the page kept to 1200px they were 8px too wide in WebKit zh (its scroll bar takes width), which is the strip's designed overflow; the first two names are shortened so the "fits" case is still one that fits, and the narrow case still overflows. One word off the first name left it 0.34px of room (1159.66 in 1160), which went red once in WebKit en under load; two names shorter leave 135px, and it passed 3 runs in a row in each engine. sessions-toolbar.test.cjs asserted that ten agents' tabs fit an 1800px window; in a 1200px page they need 1115px of 912, so the page shows the compact agent menu (its designed overflow). The fixture now has eight agents (829px), so the wide case still tests tabs that fit. Run: - new page-width.test.cjs: every view's content width 1150..1200 and centred at en 1920, zh 2560, zh-TW 1920, ja 2560, de 1920; 16px at en 900; every view's left edge and padding equal Agents'; chromium and webkit, 14/14. Without the CSS change it fails ("sessions: 1676 wide at 1920"). - before/after screenshots of Routing, Usage cards, the ledger, Sessions and Providers at 1920, 2560, 1100 and 800 (chromium). - GUI regression set, both engines: click-scroll, editor-short-window, ledger-*, panel-usage, quota-*, routing-*, usage-*, sessions-*, sess-agent-strip and sessions-toolbar (after the fixture changes). routing-group-fold (webkit en/ja/de) and routing-sessions (webkit en) fail the same with origin/main 17c12621b's own assets, run alone: already filed as #1612 and #1672. usage-ledger's webkit "dark, and narrow" failed once in the full run; it fails the same with 48e59c5b8's assets (the view left scrolled 32px after the resize, the tab under the header), noted on #1671. - Go: gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the builds: clean. go test -tags nogui ./... at load ~25-60 (other sessions' runs): every package passed but internal/agent and internal/gateway, which hit the 30m timeout; run again alone, agent passed and gateway's only red was TestOTelWaterfallIncludesUnbilledFallback, filed as #1794 (passes alone, -count=3). Not verified: real WebView2 or WebKitGTK windows; layouts were checked in Playwright's chromium and webkit only. * sessions: the Sessions page's search finds a session by what was said in it, and a gateway session is titled by what it was first asked (YOU on Discord) Why: the filter matched only titles, folders, ids and models, and a session the gateway recorded was listed under its bare ses_… id, so one couldn't be found by anything a person remembers about it. What changed: - sessions.GatewayTitle: the first user text of a recorded session (not a <…> context tag, # AGENTS.md or an image), made one line. It reads at most 8 complete turns of the oldest file of it, caches a finished file's answer by path, and costs one stat when nothing is recorded. gatewayListed applies it in every list (/api/sessions, /manage, /one, the stats summaries); ExternalSession gained Title. - GET /api/sessions/search?agent=&q= (searchSessions): an agent's sessions, newest first, read by up to 4 workers, each only to its first match. Native files go through a byte prefilter (mayHold: the query's longest word, ASCII case folded without a copy, 1 MiB chunks, skipped for zstd and for queries JSON may escape), and of a Claude or Codex file only the lines holding every word are decoded (readTranscriptOf; claudeContentOf/codexContentOf take an optional line test, nil for every other caller); gateway sessions, and an unreadable agent's sessions (unread: true), through their recorded transcript. System prompts, tool definitions and images never match. It stops at 200 hits or 8s (cut, searched of total) and when the request's context ends. Each hit carries the match with 36 runes before and 120 after. - sessions.js: the field says "Search sessions"; title/folder/id/model matches show at once, the server is asked 300ms after the last keystroke, a new query aborts the request in flight and its answer is dropped, under 2 letters asks nothing. A session found shows a line of the words round its match with the match in (text nodes, no innerHTML). A note says when it is searching, cut short, failed, or limited to recorded text. New strings in zh, zh-TW, ja and de. - docs/subsystems/gateway-sessions.md describes both. Run: - Go: TestSearchSession* (snippet, case and line breaks, said text preferred over a tool call, cut ends, cancelled context, a Codex file, only matching lines decoded: 1 part of 3), TestContainsFold, TestMayHoldSkipsAFileWithoutTheWords (incl. a match across chunks), TestGatewayTitleAndSearch (context tag and system prompt skipped), TestSessionsSearchFindsGatewaySessionsByWhatWasSaid (endpoint + manage titles), TestSessionsSearchStopsWhenItsRequestEnds. Without the endpoint/title they fail (404, id as title). - GUI: new sessions-search.test.cjs in chromium and webkit, en/zh at 1100, zh-TW/ja at 560, de at 420: title shown, one letter no request, one debounced request, snippet mark, cancelled earlier request never shown, cut note, empty state, Escape, every language's strings, no overflow; 12/12, and 0/12 with the old sessions.js. The sessions-*, sess-*, session-* and i18n-keys tests pass in both engines (sessions-manage's placeholder updated to "Search sessions"). - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., the builds: clean. go test -tags nogui ./... at load ~25-60 (other sessions' runs): every package passed but internal/agent and internal/gateway, which hit the 30m timeout; run again alone, agent passed and gateway's only red was TestOTelWaterfallIncludesUnbilledFallback, filed as #1794 (passes alone, -count=3). - Real data, read-only (a temporary probe, not committed, pointed at the owner's ~/.claude and ~/.codex; one worker, 8s, load ~50): Claude, 58 sessions / 3 GB: before the line filter one 1.3 GB session took the whole 8s ("redis": 1 of 58); after, all 58 in 4.7s ("redis", 13 hits), 7.4s ("gateway session"), 2.8s (no match). Codex, 11534 sessions / 65 GB: 245-656 sessions in 8s either way, which is what the cut note ("latest n of total") is for. Not verified: the endpoint and page against a real recorded gateway store (only fixtures and temp homes); the timings above were taken on a machine at load ~50 and vary run to run. * gateway: an account out of credits on a model that costs them still serves its subscription's free models (Creat.wu on Discord) Creat.wu (WorkBuddy AI) spent the credits on glm-5.3-flash, switched to a free model, and magpie skipped the account. An out-of-credit refusal rested the whole account (restKey) for 30 minutes: through the WorkBuddy plugin, whose `explained` passes 14018 on as insufficient_quota, and on the built-in, whose raw 429 {"error":{"data":{"code":14018,"msg":"Credits exhausted…"}}} matched no credit word and was read as a rate limit, the account benched a minute and longer on repeats. - provider.PaidBesideFree: the model costs credits while the subscription lists others Free (catalog.Model.Free: WorkBuddy's x0.00, Qoder's is_free, Cline's free models, Command Code's). - restAfterMarked: out of credit or quota on such a model rests that model alone (restID). A free model the vendor still refuses (WorkBuddy refuses 0-rate models to an account with no package) rests the account on its own refusal, as before. - brokeWords takes "credits exhausted", so the built-in's 429 is out of credit, not a rate limit. A rate limit naming credits in passing stays one. - The fix is in the gateway, which both moved (plugin) and built-in users go through, so no plugin release or mover min is needed. - docs/subsystems/gateway-routing.md says so, with the tests to run. Tests: TestCreditsExhaustedIsOutOfCredit (literal 14018 body, raw and as the plugin passes it) and TestOutOfCreditLeavesFreeModels (fake plugin, two keys, deepseek-v4-pro answered 429 with the plugin's body, then fake-1 must go to the first key). With the restAfterMarked change taken out the second fails (fakeco@api key rested 30m for credit); with brokeWords back as before the first fails (rate, want credit). Both pass with the fix. Not done: credit windows still count free models in Smart/Pace order and the 98% affinity stop; the account isn't held out there (Credits has no reset, so Full is 0), only ordered later. Not tried with a real WorkBuddy AI account. gofmt, vet and the full suite: see the next commit's body. * provider, catalog: a model listed with a 512-token window is told to agents at models.dev's window, or none, never 512 (H20 on Discord) H20 and others saw free models (hy3, Cline's free ones) at a 512-token context window, and Claude Code and Codex then treated them as unusable: they compact at once. Every agent and the gateway read a model's window from its catalog entry (Entry.Context, from WindowOf and ListedWindow), which took any positive window the vendor's or plugin's list gave as said. Where the 512 itself comes from isn't seen here: models.dev's cache (2026-10-12), Cline's live /ai/cline/models and recommended feed, the WorkBuddy and Cline plugins' static lists and magpie's own code give no window under 4095 for any of these models. It is in a vendor's live list read at run time (WorkBuddy's /v3/config maxInputTokens or a plugin's list); so the floor is where every listed window is read: - catalog.LeastWindow (2048) and catalog.Window: a window under it is not known. The smallest real chat windows are about 4096 (gpt-3.5-turbo-instruct's 4095, mythomax's 4096) and stand. - mdModel.window: a models.dev limit under it doesn't vote, so the other limit, or nothing, answers. - ListedWindow: a vendor's window under it falls back to models.dev's for the model, else 0 (the agent's default). - pluginCatalog: a plugin's input or context under it is none, so a 512 prompt cap under a 192K window leaves 192K. - planModels (Cline): a free model's 512 takes models.dev's too. - A window the user sets (Contexts) is theirs, however small. Tests, with the literal 512: TestTinyListedWindowIsUnknown (a Cline plugin listing cline-free/mimo-v2.6-flash and cline-free/hy3 at 512 is served at models.dev's 1048576 and 192000; one nothing knows at 0; a real 4096 stands; ListedWindow on a built-in's hy3 at 512 gives 192000; a user-set 1024 stands) and four new cases in TestWindowClampsInputAboveContext. Both fail on the code before (512, want 1048576 / 192000 / 0) and pass with it. Not verified: the reporter's own list, so which vendor sent 512 is inferred, not seen; not tried in a real Claude Code or Codex. Run for both commits, on origin/main 94aa15397, sandbox HOME, private GOCACHE (the shared one was being emptied under the build), load average 70-86: gofmt -l clean; go vet ./... (darwin) and go vet -tags nogui ./... with GOOS=linux and GOOS=windows pass; go build -tags nogui ./... passes. go test -tags nogui: catalog, agent, plugin, library pass; provider -run 'Window|Listed|Plugin|Cline|Free|Catalog|Models' passes, and the whole of provider passed before the rebase (794s) but for TestCopilotSecretToolUsername, which fails only inside the command sandbox (its secret-tool script can't run there) and passes outside it; gateway -run 'TestVertex|Credit|Rest|Quota|Rate|Free|Plugin' passes. The whole gateway and provider packages hit their 25m and 9m timeouts on this machine's load, with stacks in tests still running (vertex, signin_proxy), not stuck; those two packages weren't run whole at this head. Rebased again onto 24350a372 (the doc's Verification list took both lines): go vet -tags nogui ./internal/... and go test -tags nogui -run 'Credit|Rest|Quota|Rate|Free|Group|Window|Listed|AutoMode|Codex' on gateway, catalog and provider pass. * agent: Codex's proxy is worked out from the login shell's NO_PROXY and HTTP_PROXY and macOS' HTTP entry alone, as its reqwest reads them, so "Codex 经代理连 magpie" no longer shows while Codex goes direct (liu_dyj on X) liu_dyj: with the VPN on, magpie said Codex reached magpie through a proxy that didn't pass its requests on; versions before f156d9046 had no such check, which is why upgrading brought it. Cause: codexProxyFor didn't read the proxy the way Codex does. - It read magpie's own environment. Codex in a terminal has the login shell's, and the ChatGPT app's Codex too (ChatGPT.app 26.1007 runs $SHELL -ilc at start and Object.assign()s its env into process.env). magpie opened from the Dock has neither, so a NO_PROXY=127.0.0.1 in .zshrc, which keeps Codex direct, wasn't seen, and magpie probed the system proxy and warned. - For the system proxy it took netproxy's one URL (HTTPS over HTTP over SOCKS). hyper-util 0.1.20's Matcher::from_system, which reqwest 0.12.28 uses for Codex, takes only macOS' HTTP entry for an http:// URL; with only the HTTPS or SOCKS entry set (ShadowsocksX-NG's global mode is SOCKS only) Codex goes direct and magpie warned. On Windows it takes ProxyServer as one address, which a per-protocol list ("http=..;https=..") isn't (http's Authority::parse refuses two colons), so Codex goes direct there too. - With respect_system_proxy on macOS, CFNetwork's SOCKS entry is UnsupportedProxyScheme, and Codex falls back to HTTP_PROXY/ALL_PROXY with NO_PROXY (codex-rs outbound_proxy.rs resolve_env_proxy_route); magpie used the SOCKS URL. - The probe spoke real SOCKS5 to a socks5:// proxy. Codex's reqwest is built without SOCKS (no tokio-socks in codex-rs Cargo.lock) and sends an absolute-URI HTTP request to it, so the probe now does the same: it passes a Clash mixed port as Codex does and fails a SOCKS-only port as Codex does. So netproxy.Proxy carries the HTTP and SOCKS entries alone beside URL (parseScutil, parseWindows), proc asks the login shell for the *_PROXY variables with agentenv.Vars in the same probe and only reads them (proc.LoginEnv; never set in magpie's env, whose requests use netproxy), and codexProxyFor uses both. Failover's gate (codexProxyOK) and the drift share codexProxyFor and proxyProbe, so both follow. The pill's How to fix now names the shell profile for NO_PROXY. Clash/mihomo rule mode with a 127.0.0.0/8 DIRECT rule never warned and still doesn't; global mode or a rule set without it still warns, rightly (real codex 502s there). TUN mode sets no proxy and never warned. Run: - real codex-cli 0.162.1 in a sandbox HOME/CODEX_HOME against a fake gateway and mihomo v1.19.32 (rule, no-LAN-rule, global ports): direct, rule, and ALL_PROXY=socks5:// on the rule port reach the gateway; no-LAN-rule and global 502; global with NO_PROXY=127.0.0.1 reaches it. The Go probe agrees on every one. - go test -tags nogui ./internal/agent, ./internal/netproxy, ./internal/proc; gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on the three packages. - Broke each part by hand: sys.URL back in codexProxyFor (Windows per protocol, macOS HTTPS/SOCKS alone red), the probe's socks->http (TestRealProxyProbe red), codexEnv without the login shell (TestCodexEnvTakesLoginShell red), the respect-path SOCKS fallback (three respect cases red), setUnset of every shell var and the probe without ProxyVars (TestLoginEnvProxyVarsNotSet red). Not tried: the macOS system proxy cases with real Codex (changing the system's proxy settings is off limits here; read from hyper-util, reqwest and codex-rs sources), the Windows per-protocol ProxyServer with real Codex (from the http crate's source; no Windows run), and the reporter's own app and mode, which are asked on X. * gateway: an MCP request longer than its route takes is refused whole with 413, not run as the part that fit (#1766) What changed: serveMCP (magpie's own web-search and vision MCP servers) and the signed-in MCP proxy (/mcp/{name}) read the body through readMCPBody, which reads one byte past the limit and answers 413 when the body is longer, or when Content-Length already says so. Before, a plain io.LimitReader ended at the limit as if the body had, so a valid JSON-RPC message padded with whitespace past the limit, or followed there by a second message, was parsed as its prefix and run: an analyze_image call reached the image model, and the proxy sent the cut body on to the signed-in server with the user's token. A body exactly at the limit still works. Why: #1766 (ggbdpq) reported it for the two own MCP routes with a patch; the proxy's read was the same shape and is fixed beside them. Run: TestOwnMCPRejectsOversizedBody (the reporter's test, extended to a known Content-Length too) and the new TestMCPProxyRejectsOversizedBody fail on the old search_mcp.go/mcp.go with HTTP 200 instead of 413, the image model called 1 -> 5 times, and the proxied server seeing the cut "tools/call"; they pass with the change. TestMCPProxy*, TestVisionMCP*, TestSearchMCP* pass. Full suite and vets are recorded on the push. Not done: the GUI's local /api handlers decode JSON through LimitReader too; they take only the first JSON value whatever the length and are not reachable by another machine, so they are left as they are. Co-authored-by: ggbdpq * gateway: another model's reasoning_details goes to Kimi as reasoning_content, so a conversation MiMo began is no longer refused 400 on every turn (#1765) What changed: a Chat request to Kimi (isKimi: the Kimi platform's or a Kimi Code membership's host or preset) has each message's reasoning_details left out, its thinking put in reasoning_content when the message has none (reasoningDetailsAsContent). refusedInMessages also reads Kimi's own wording, "the at position N", so another upstream that refuses the field that way (a relay in front of Kimi) is asked once more without it and marked; the retry and the remembered mark keep reasoning_details' thinking as reasoning_content too (withoutMessageReasoning). Why: Leo-origin's session was answered by MiMo through Command Code, whose reasoning_details entries carry a stream's index; pi sends them back, and Kimi Code answered 400 "the reasoning_details at position 2 entry 0 must not contain streaming index" on every turn. Probed against the real api.kimi.com/coding/v1 on 2026-10-12: Kimi refuses reasoning_details in every shape tried (with index: "must not contain streaming index"; reasoning.text, reasoning.summary, reasoning.encrypted, text, thinking without it: "has an invalid type"), and passes reasoning_content, reasoning and an empty list through validation. Run: TestKimiGetsReasoningDetailsAsContent and TestReasoningDetailsRefusedAtPosition (fake Kimi answering with the probed bytes) fail on the old gateway.go/chattidy.go: 400 "Kimi Code (China): the reasoning_details at position 1 entry 0 must not contain streaming index" after 1 call, the reporter's message, and "400 after 1 calls (want 2)". They pass with the change, as do TestMistral*, TestMessageReasoning* and the other *Reasoning* tests. Not verified: a real k3 reply through magpie; the owner's Kimi Code subscription has lapsed, so the real probe reached only validation (a valid request got 403 "does not have access"). A 400 magpie doesn't recognize still ends the request rather than failing over; that is unchanged. * gateway: keys all out of their allowance are answered from their rests with a Retry-After, not asked again on every request, and a key listed twice is asked once (#1772) A fleet on four Ollama Cloud keys, every one out of its weekly allowance: each new request asked every key again (the first twice) and answered 429 with no Retry-After, so an agent that waits as told asked again at once, and the vendor saw four refused requests a turn. What changed: - The first key twice: the reporter's providers.json named the first key in "keys" as well as "key". KeysOn now lists a key once. - When every key left for a request rests out of its allowance (a 429 or 402 that failure() calls quota or credit, keys only), the request is answered from the rest without asking: the vendor's own words, "not asked again before HH:MM", and Retry-After until the first of them is back (quotaHeld, soonestBack). Accounts are left out, so autoReset can still spend a reset for them; a 403 or 400 worded as quota is asked as before. - The last key out of its allowance now rests as the ones before it do (before, the last one left was never rested), and a 429 the vendor gave no Retry-After for gets the soonest rest's end as one. - A provider can set how long its keys rest when the vendor says nothing of when the allowance is back: quotaRest (minutes) in providers.json, or `magpie provider quota-rest 7d`; default stays 15 minutes, at most 8 days. A time the vendor names (resets_at, Retry-After, a window) still wins. A GUI save keeps it. What was run: - TestAllRestingAnswersFromRest, TestFirstKeyListedTwiceAskedOnce and TestOwnQuotaRest fail on the old code (no Retry-After, keys re-asked; "dead-1 dead-1 dead-2 ok-3", the reporter's log); they pass now, with TestQuotaHeldOnlyForKeysOutOfAllowance, TestDeadChainWalksEachOnce and TestRestMinutes. The mock answers with the reporter's literal 429 body. - go test -tags nogui ./internal/provider ./internal/gui pass. A gateway package run at load ~60 hit its 20m timeout mid-suite with only TestMaxRPM* red; those pass 8/8 alone here and on origin/main 17c12621b (timing under load, filed as #1791). Not verified: no run against real Ollama Cloud keys; quotaRest has no field in the provider editor (CLI and providers.json only). * gateway: a refusal's note keeps Anthropic's stop_details category and explanation, on the Routing page's try and in the agent's error (#1768) jingchangshi's sessions got "claude-opus-5-5 refused this request (safety filter: refusal) via Claude Code" 19 times, with nothing to say which of Anthropic's classifier categories (cyber, bio, frontier_llm, reasoning_extraction, general_harms…) it was. Anthropic sends that in stop_details beside stop_reason "refusal"; magpie read only stop_reason. Rather than the separate opt-in JSONL sink the issue proposes, the category goes where every refused attempt is already recorded: the note of that try on the Routing page, including a try a later key or group member answered after, and the error the agent gets when nobody is left. It is the vendor's own words, so nothing of the user's request is stored anywhere new. What changed: - refusedDetail: "safety filter: refusal (category cyber: )", the explanation whitespace-folded and cut at 200 characters; a null or missing category or explanation adds nothing, an unknown category is kept as given. Used for a streamed message_delta and a whole reply. - stop_details is carried through the IR (Event.StopDetails, Result.StopDetails) from an Anthropic upstream's stream and from the claude CLI's stream-json (a Claude subscription), and written back into an Anthropic client's message_delta or whole reply, as safeguard_results already is. What was run: - TestRefusalKeepsStopDetails (stream, whole, nulls, absent, unknown category, long explanation), TestRefusalCategoryOnTheTry (refused key then an answering one: the refused try says "category cyber") and TestClaudeSubscriptionRefusalMovesToNextAccount (now with stop_details in the CLI's refusal) fail on the old code and pass now; the refusal, safeguard and Anthropic tests pass. Not verified: no real Anthropic refusal with stop_details seen (the bytes follow Anthropic's documented shape); a Codex or Chat client served by Claude gets the category on the try only when the hold writer sees it in its own protocol, which Responses and Chat have no field for, so their try notes stay "safety filter: …" as before. * gateway: a Responses provider set codex=as-sent gets Codex's requests as Codex sent them, for a relay that checks they are Codex's own (#1758) A relay that checks a request is Codex's own answered magpie 400 "Codex 客户端请求特征无效" (10014). magpie fits every Codex request for a Responses backend that isn't OpenAI's: Responses Lite's additional_tools item is lifted into tools (#350), the tool search goes as a function, and OpenAI-only fields such as stream_options.reasoning_summary_delivery are left out. The reporter found that the relay takes the request when additional_tools is left as an input item, and that the lifted shape is what it refuses. The lifting stays the default, because backends that aren't OpenAI's refuse additional_tools or silently drop it (#350). A provider can now opt out: `magpie provider set codex=as-sent` (`codexAsSent` in providers.json; `codex=default` turns it back off). With it on, a request from Codex (fromCodex: Codex's User-Agent or originator) goes as Codex sent it, with only its model name swapped. Codex's own headers go with it as before. A subscription account is never sent this way, and the GUI's provider save keeps the setting. What was run: - TestCodexAsSent: by default the request is still fitted; with codexAsSent the upstream gets exactly what Codex sent, with model m1, X-Codex-Turn-Metadata and the Responses Lite header. It fails on the old gateway.go and passes now. TestAdditionalTools and the gateway's Codex tests pass. Not verified: not tried against the reporter's relay. Their check was made by hand outside magpie, so which other fields that relay looks at is not known. There is no GUI control for the setting (CLI or providers.json only). * gateway: a provider that refuses auto mode's safeguards is asked again without them and not sent them again, so Copilot's claude-opus-5.5 answers Claude Code (#1756) Pylogmon's Claude Code on Copilot's claude-opus-5.5 got 400 invalid_request_error "Copilot: safeguards: Extra inputs are not permitted" on every turn, which magpie labels "request format not accepted". Their Sonnet worked. Claude Code's auto mode adds a top-level `safeguards` field for the API's review of its actions. magpie passes it on to any Claude model (automode.go), and Copilot's Messages API checks its fields strictly and turns the field away. The fix uses the existing class for Claude Code's newer fields that a relay refuses (anthropic_shapes.go: thinking.display, a turn's output_config). On a 400 naming `safeguards` with "Extra inputs are not permitted", forward asks again at once without the field and remembers that the provider refuses it (shapeSafeguards), so later requests leave it out the first time. Claude Code, finding no safeguard_results, reviews its actions locally, as it does for every non-Claude model. The fix sits in forward/forwardOnce, so it reaches every route to an Anthropic endpoint: relayed and translated (buildAnthropic), any provider, not only Copilot. What was run: - TestSafeguardsRefusedLeftOut (refusal text as the reporter quoted it): on the old anthropic_shapes.go the agent gets the same "Cop: safeguards: Extra inputs are not permitted" 400; now it gets 200, asked twice the first time and once after that. - TestSafeguardsKeptWhereTaken: a provider that takes the field still gets it. - The shapes, system-message and auto mode tests pass. Not verified: no Copilot account with claude-opus-5.5 was available, so Copilot's raw error body is assumed. The match is on the words the reporter quoted, which magpie shows after "Copilot: ". * gateway: a turn that names no reply limit is sent the model's own as max_tokens on Anthropic's API, not a flat 16384 (#1792, tensornull) Anthropic's Messages API needs max_tokens. A request that names none (Codex's Responses turns, a Chat client's) was always sent 16384, so a long thinking and tool turn on a Claude-shaped relay hit the limit, and Codex showed "Incomplete response returned, reason: max_output_tokens". Now such a request is sent askedOutput(p, model). That is the plain Served entry's PublishedOutput(), the same number the agents are told: the user's Max output first, else the vendor's list or models.dev, within the window. 16384 (defaultMaxTokens) is used only when nobody knows the limit. A limit the client names still goes as it is. The thinking budget is still fitted under max_tokens (anthropicBody), whatever the limit is. Both places that build an Anthropic body are covered: forwardTranslated, for every translated route, and serveZed for a Zed subscription's Claude models. The provider editor's Max output hint now says this number is also sent as max_tokens (en, zh, zh-TW, ja, de). docs/reference.md and docs/subsystems/gateway-routing.md no longer say the gateway never uses the limit. Run: - TestAnthropicMaxTokensIsTheModels covers: the user's 65536 (Responses plain and streamed, and Chat), models.dev's 64000, a 500000 limit held to the 100000 window, an unknown model at 16384, the client's own 1000, and thinking under 8192. - TestZedClaudeMaxTokensIsTheModels expects 40000 when the client names no limit and 1000 when it does. - Both tests fail on the old code: 16384 where the model's number was expected. - go test ./internal/gateway/ passed (1270s, under load). - provider-max-output.test.cjs passes 28/28 in chromium and webkit: 5 languages at 900 and 420px. The hint names max_tokens and Anthropic, is translated, and doesn't overflow. - gofmt -l is clean. go vet passes on darwin, on linux with -tags nogui, and on windows. Not tried against a real Anthropic-compatible relay with a real Codex session. * library, gui: Hooks are a fifth Library category, kept once and written into each ticked agent's own hooks file (#1790, AllenReder) What: the Library page has a Hooks tab beside Instructions, MCP, Skills and RTK. A hook is a command, an event, an optional tool filter, a timeout and the agents ticked for it. magpie writes it into each agent in that agent's own file and shape: Claude Code /settings.json hooks.[{matcher, hooks[]}] Codex /hooks.json same shape Gemini CLI ~/.gemini/settings.json same shape, timeout in ms Cursor ~/.cursor/hooks.json flat entries, version 1 Portable events (turn end, after a tool, before a tool, prompt sent, session start) map to each agent's own name; "shell"/"edit" map to each agent's own tool names. An agent's own event (codex:PermissionRequest, cursor:afterFileEdit, ...) is offered too and given to that agent only. Rows have agent chips (All first), Select + bar, and Remove all, like skills and servers. An agent that can't take a hook has its chip greyed with the reason: every agent but those four ("has no hooks magpie can write"), an agent in WSL (not yet), and another agent for a native event. The page also says when an agent has all hooks turned off (disableAllHooks, hooksConfig.enabled=false, [features] hooks=false). Why these choices (product call delegated to us): the four agents are the ones with a documented, file-based command-hook API whose events line up; others (OpenCode's JS plugins, dsh, ...) have no comparable file, so they're named as unavailable rather than half-supported. Removal is exact: Applied.Hooks records each entry as written (canonical JSON), and only an entry still exactly as written is taken out; one the user edited is theirs, and their own hooks beside it are never touched. A hooks file that doesn't parse is a problem, never treated as empty or written over. Codex keeps trust per hook in config.toml keyed by group position, so taking a group out re-keys the user's trust for the groups after it (codexRekey) instead of silently untrusting them. Carried bundles (backup/WebDAV/S3) don't carry hooks in this first version. Run: - go test ./internal/library ./internal/gui (sandbox HOME): pass. New hooks_test.go: each agent's shape; the user's edited entry stays and is no longer recorded; an unparseable file is left alone and reported; Codex trust moves with its groups; native events/unavailable agents; hooks-off reported. - library-hooks.test.cjs: 12/12 in chromium and webkit, at 440px, in en, zh, zh-TW, ja, de; against the old library.js it fails (timeouts on the missing tab). All 52 new strings translated in the 4 languages. - library-loading.test.cjs expects the Hooks tab in its tab lists (it failed on this change before; 6/6 now). - Every library-*/skill-* GUI test in chromium and webkit: all pass but WebKit timeouts in library-mcp-tool-switch/library-mcp-tools, which fail the same on origin/main b0a904bd9 under load (#1609, commented). - gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: clean. Full go test ./... at the pre-rebase head c1c1a730f: 49 packages ok. After rebasing onto 86b2f4d05: library, gui and gateway's Anthropic/Zed tests ok. Not tried: real Claude Code / Codex / Gemini / Cursor runs firing the written hooks; the shapes were checked against each agent's source and docs, not executed. * gui: Settings › General says each setting's name alone where it says enough, and Language is one menu (1ooogle on X) 1ooogle's mockup on X redrew Settings › General the way macOS System Settings reads it. The owner approved, and this follows it. Rows that now show only their name: - Appearance, Text size, Interface and Code font, the tray click, Provider in model names, the Codex titles, auto-review and memories model rows, Open at login and Show in Dock. - A font row's line shows only while its fonts are loading or have failed. - The text size keys (⌘0 / Ctrl+0) move into the choices' tooltip. Rows that keep one short line, because the name alone doesn't explain the setting or what it costs: - Codex subagents, Long conversations, Lightweight mode, Prevent sleep and Session terminal. Renames: - "Tray icon" becomes "Click the tray icon to", with the choices "Open the quick panel" and "Open the main window" (点击托盘图标: 打开快捷面板 / 打开主窗口). - "Keep awake while agents work" becomes "Prevent sleep" (防止休眠: 在 magpie 运行任务时,让电脑保持唤醒状态). - "Dock" becomes "Show in Dock" (显示程序坞). Language is one button showing the language picked (renderLangPick). It opens in the app's own menu (openProtoMenu, styled like Session terminal's sess-pick), not a native