Commit Graph
3322 Commits
Author SHA1 Message Date
yetone 8a4cfe0e4e proc: a command that isn't installed is answered from each PATH folder's listing, not a stat per extension, so a Library change after a start no longer looks for ~100 agents' commands one file at a time on Windows (#1624, Hipple)
On every Library create, switch or delete, Targets() asks agent.Detected for
about a hundred agents. Each one's command is looked up with exec.LookPath,
and on Windows with FindTool's findDirs as well. A command that isn't
installed costs a stat of name+each PATHEXT extension in every folder. The
answers are cached (looked), but that cache is empty after a start and is
dropped whenever any PATH folder's mtime changes. With an antivirus slowing
every stat, that is the slow first change Hipple sees.

Each folder's listing is now read once (lower-cased names, also each name up
to every dot) and read again only when the folder's mtime changes. A
command that no folder has a name for is not found without a stat. One a
folder may hold, and any folder that can't be read, goes to exec.LookPath
and toolIn as before. On Windows the current folder is included unless
NoDefaultCurrentDirectoryInExePath is set, as exec.LookPath does.

Measured on the Windows test box (47 PATH folders, WSL agents off,
library ops through a throwaway test in a sandbox HOME):
- the first create after a start went from 486ms to 285ms; the old CPU
  profile was mostly exec.LookPath/GetFileAttributesEx;
- warm ops ~10ms either way.
With WSL agents on, the first op costs ~3.0s on both builds, about 2.7s of
it in wsl.exe list and probe spawns. This commit doesn't change that. On the
box, wsl -l -q, wsl -l --running -q and a docker-desktop probe each take
40-75ms, so a failed-probe retry every 10 min doesn't explain the report
there. The 5-8s after 10 min idle wasn't reproduced: ops after 4, 8 and 12
min idle took ~120ms.

Run: go test ./internal/proc ./internal/agent ./internal/library (ok);
gofmt -l; GOOS=linux and GOOS=windows go vet on the three packages.
I broke the fix by hand (look.go/find.go back to exec.LookPath, mayBeIn
check off), and TestMissingCommandsReadEachFolderOnce failed: "100 missing
commands were looked for on PATH 200 times, want 0".
2026-10-14 08:08:50 +08:00
yetone f71155591e provider: a provider at a vendor's own endpoint is priced from that endpoint's models.dev catalog (#2052, mengyianx)
A custom provider added by its address alone, with no catalog named, was
priced only by the model's maker. Qwen3.8-27B, whose maker (Alibaba) sells
no such model on any of its seven models.dev catalogs, read "no price is
known for it" even at AMD's own endpoint, where models.dev's amd lists it
at $0, a price.

- catalog: models.dev's provider "api" is read; AtEndpoint names the
  catalogs at a base URL (trailing slash and case ignored).
- provider: EndpointCatalog is the one catalog models.dev lists at one of
  a key's provider's endpoints (an Anthropic base, kept as its root, also
  with /v1), used by ListPrice when the provider has no catalog of its
  own. Never for a subscription's account, never when two catalogs share
  the address (minimax / minimax-coding-plan), never a plan's catalog
  (an id with -plan, or membershipCatalogs), whose $0 is the membership's.
  A user's price and a named catalog still come first; a relay's endpoint
  matches nothing and its model stays unpriced (no reseller guess).
- cli: `magpie model price p/m` with no price gives the two commands that
  set one (p/m and */m); a price from an endpoint's catalog names it.
- gui: the Catalog field's hint says it also sets list prices (en, zh,
  zh-TW, ja, de).
- docs: reference.md's "What a model costs", providers-accounts.md row.

What was run:
- Reporter's exact case, built binary (go build -tags nogui), sandbox
  HOME with a copy of this machine's models.dev cache (2026-10-14, same
  amd entry as the report), providers 001 (relay), 002 and amd at
  https://developer.amd.com.cn/radeon/api/v1:
    001/gpt-5.5      $5/$30, tiers, as before
    001/Qwen3.8-27B  no price, now with the two commands to set one
    002/Qwen3.8-27B  $0/$0, "what models.dev's amd lists at its endpoint"
    amd/Qwen3.8-27B  $0/$0
  The two suggested commands were run and took effect.
- TestEndpointCatalogPrices / TestEndpointCatalogOnlyItsOwn, fixture
  testdata/endpoint_catalog.json trimmed from the real models.dev cache.
  Break checks, each FAILs with the case named:
    ListPrice not using EndpointCatalog -> 002/amd/001 at AMD unpriced,
      EffectivePrice(002, Qwen3.8-27B) unpriced
    plan exclusion removed -> "a plan's endpoint: EndpointCatalog() =
      alibaba-coding-plan", qwen3.5-plus at $0 instead of $0.4/$2.4
    single-match rule removed -> "an endpoint two catalogs share:
      EndpointCatalog() = minimax"
    Account check removed -> "a subscription's account ... = amd"
    Anthropic /v1 match removed -> thinkingmachines unmatched
- GUI: internal/gui/tests/catalog-hint.test.cjs, chromium and webkit, en
  zh zh-TW ja de, widths 1100 and 420: 20/20 pass, plus i18n-keys; with
  the old app.js/i18n.js it fails "one hint names list prices".
- go test -tags nogui -timeout 45m ./internal/catalog ./internal/provider
  ./internal/cli: ok (provider 244s, cli 125s, catalog 3s). gofmt -l
  clean; go vet (darwin), GOOS=linux go vet -tags nogui and GOOS=windows
  go vet -tags nogui on those packages: clean.
2026-10-14 07:51:41 +08:00
fjrtdk 8f34bbcd11 library: Grok Build and Grok App can be given hooks (#1790)
The Hooks tab said "Grok App has no hooks magpie can write" and RTK said
"No rtk hook". RTK stays correct for now (rtk init has no Grok agent), but
the hooks message was wrong: the Grok CLI keeps hooks as [[hooks.<Event>]]
array tables in its config.toml, which Grok App reads from agent-home on a
custom route. Hindsight already ships three hooks into both configs.

Add grok and grok-app to hookAgents with a TOML hook spec. A hook is written
as a [[hooks.<Event>]] table with a [[hooks.<Event>.hooks]] child, the same
find/claim/drop logic as a JSON agent's: the block text is recorded entry by
entry, so only a block still exactly as magpie wrote it is ever taken out,
and the user's own blocks around it stay as they are. Portable events map to
Stop / PostToolUse / PreToolUse / UserPromptSubmit / SessionStart; a tool
matcher uses Grok's own tool names (run_terminal_command, search_replace).
Grok Build and Grok App run the one CLI, so a grok:<Event> own event goes to
both (sameHookFamily).

edit gains WriteTOMLFile and SplitLines so the library can round-trip a
config's lines through the same validating write the other TOML editors use.

Verification (branch grokapp-hooks):
- TestHooksGrokConfigTables fails on the pre-change code with a real FAIL
  ("Grok Build has no hooks magpie can write"); passes with the change.
  Broke the matcher map, the drop and the event map by hand; each break is
  caught by the test.
- go test ./internal/library ./internal/edit: 811 passed (was 828 before the
  two new grok cases and the hookAgents additions).
- gofmt -l clean; go vet on mac, GOOS=linux -tags nogui, and GOOS=windows all
  clean; go build, GOOS=linux go build -tags nogui and GOOS=windows go build
  all succeed.
- go test -tags nogui ./... has three pre-existing failures on base cdb7b5ff
  (internal/gateway TestGrokCallsGiveCodexIntegers, internal/library
  TestRTKCheckLatestDoesNotWaitForThePackageManager, internal/proc
  TestNoCommandBypassesProc); none is in a file this change touches, and each
  reproduces without it.
- Real use: confirmed against the local Grok App 0.2.40 / grok 1.0.55 install
  that agent-home/config.toml already carries Hindsight's [[hooks.*]] tables,
  so the shape matches what magpie now writes. The GUI Hooks tab is driven by
  the backend hookAgents view, which now lists grok and grok-app; the Tauri
  window itself was not clicked through.

Reviewed before landing (fu13-pt, on e297a8ab2 + #1889/#1897/#1900/#1989):
- The shape is Grok's own: grok 1.0.50's binary carries its user guide
  (10-hooks.md), which reads hooks from ~/.grok/config.toml as
  [[hooks.<Event>]] with an optional matcher and an inner hooks array,
  the [[hooks.<Event>.hooks]] form accepted; handler fields type, command,
  url, timeout, env; run_terminal_command and search_replace are its tool
  names (Bash and Edit|Write|MultiEdit are aliases of them).
- A scratch test (not committed) on a config holding a user's inline
  `hooks = [ {...} ]` Stop block, a comment, [mcp_servers.x], a user
  PreToolUse block and [ui]: add (Stop, PreToolUse on shell), edit the
  timeout, remove both. The file parsed as TOML at each step with the
  arrays as Grok reads them, and came back byte for byte. A config with a
  plain [hooks] table (Stop = [...]) is refused as a problem ("key value
  already exists as a Stop, but should be an array table"), file unchanged.
- Drop broken by hand (never drops a block): TestHooksGrokConfigTables and
  TestHooksGrokOwnEventBoth both FAIL with the blocks left; restored, pass.
- Not tried: the Grok App window, and a running grok reading the result.
  Grok App in shared mode reads ~/.grok, not agent-home, as its MCP row
  already does.
2026-10-14 05:43:48 +08:00
ChampionTina c1e354245d agent, gui: connecting an agent whose model list holds none of magpie's models says so, in the reader's language (#1989, znuaibot)
znuaibot's case: OpenCode shown only its one picked model, whose provider
was switched off. connect() found no field to set, and since the catalog
still held models (shown 0, hidden 7) it said only "OpenCode can't be
connected to magpie", which sent the user looking at the agent rather
than at the model list that emptied it.

znuaibot's patch (74160e1f) told the case apart in connect(). Changed on
review: the plain English error would have reached the GUI untranslated
(NoModelsError beside it is said by code), so the case is a typed
AllHiddenError, fail() answers it with code all_hidden, and the GUI says
it in en/zh/zh-TW/ja/de, pointing at the agent's Model list → Pick (the
names the Agents page uses).

Run: TestConnectWithEveryModelTakenOut (agent) reproduces the case with
a provider switched off under OpenCode's picked list: on the old connect
it FAILs with "OpenCode can't be connected to magpie"; passes now, and
connects once the provider is on again. TestAgentConnectAllHidden (gui)
checks the code. agent-connect-no-models.test.cjs now runs both codes in
Chromium and WebKit, en/zh/ja/de: 16/16 pass, and with app.js's
all_hidden line removed the 8 all_hidden cases FAIL. gui-de, gui-ja,
gui-zh-tw, i18n-keys: pass. Full internal/agent and internal/gui: see
the push record on #1989.
2026-10-14 05:43:48 +08:00
youheyu c8392cf7d5 cli: a magpie model picked for an agent not connected connects it first (#1900)
GUI 的 Pick/ConnectHow 会先 connect()(把用户原有模型记进 stash),CLI 的
set 直接 Apply,绕过了 stash:magpie opencode a/m 接上后,magpie opencode
default 无从恢复用户自己的 model/small_model。CLI set 改走 a.Pick——与
Agents 页选择器同一入口,未接线时先连接,已接线与空值行为不变。

对所有以此方式接线的 agent 一致生效(issue 要求的不只 OpenCode/DevEco)。

验证:新测试 TestAgentOpenCodeDefaultPutsBackTheModel——用户自有模型 +
small_model + theme,CLI 接线再 default,旧代码 model 丢失,修复后完整
还原;其相连的 claude/snow default 测试不回归。基线(无此改动)6 个
agent 包失败(Aside×4、版本检测×2)与改动无关,在干净 worktree 同样失败。

Rebased onto main's set (which now keeps `wired` for #2000's notice);
the test now also runs DevEco Code, OpenCode's fork in its own folder,
as the issue asked for both.

Run: TestAgentOpenCodeDefaultPutsBackTheModel opencode+deveco pass;
with set put back on a.Apply both subtests FAIL (model lost). Full
internal/cli -count=1: ok. a.Pick is the GUI's picker path, so every
agent the CLI sets a magpie model on is connected (and stashed) the way
the Agents page connects it; a Native agent still goes to its Apply.
Not changed here: profile.Apply also writes a field with a.Apply.
2026-10-14 05:43:48 +08:00
youheyu 7bdd3904cd tests: the cache-fields record test starts from a log of its own (#1897)
TestRecordAlwaysCarriesCacheTokens 无自己的 config 目录,-count>1(race
job 的 -count=3 同样)第二次运行会读到上一次运行写的行,在行数断言失败。
给它自己的 XDG_CONFIG_HOME(包内兄弟测试同款),每次运行从空日志开始。

验证:-count=2 修复前 FAIL(lines 持 3+ 条),修复后 -count=3 与全包
-count=1 均通过。

Reviewed and run before landing: at origin/main the test alone with
-count=2 FAILs; with the fix -count=3 ok. Siblings: the whole
internal/usage package with -count=2, and with -count=2 -shuffle=1,2,3,
all ok, so no other test in the package reads a log another run left.
2026-10-14 05:43:47 +08:00
youheyu 3857376a2f tests: the slow-read list's immediate re-ask is asked within its own retry window (#1889)
TestTaggedReposSlowRead 在负载下(load ~28)误报一次:晚到读取的轮询上限
10s 与 taggedRetry=1s 重叠,轮询加首次调用超过 retry 窗口后,被截断的列表
被(正确地)再问,测试把它当成 bug。按 LESSONS 注入 1.2s 延迟复现
("asked again at once: 3"),随后修复并保持延迟下通过。

修法:把「不重问」断言放在它自己的 retry 窗口内——断言前将 taggedAt 移到
now,断言后(含 Fatal 分支)还原。窗口与轮询耗时不重叠,测试两边留余量
(code standards: a timing test leaves room on both sides)。「past
taggedRetry」步骤仍用还原后的真实窗口,sleep 与断言语义不变。

验证:注入延迟下旧代码 FAIL(asked again at once: 3)、新代码 PASS;
-count=3 通过;TestTaggedRepos 不受影响。

Changed on review: moving taggedAt to now made the step ask about a whole
list (held ten minutes), so a cut-short list no longer held for
taggedRetry passed the test. The step now marks the list cut short now,
as TaggedRepos does, and the hold itself is checked right after the
cut-short ask: held till between ask-start+taggedRetry and
ask-end+taggedRetry, bounds from the clock with no slack to outgrow.

Run: old test + 1.2s injected before the step: FAIL "asked again at
once: 3"; new test + the same delay: ok. Hold broken by hand
(-taggedTTL) and doubled (2*taggedRetry): both FAIL at the new bound.
-count=5 TestTaggedRepos*: ok. Full internal/plugin (-tags nogui): ok, 649s under load.
2026-10-14 05:43:47 +08:00
yetone 4fbb75c3a8 gateway: Codex's 507 "exceeded request buffer limit" is asked again and told as a 503, not relayed as it came (#2034, sparrowu93)
sparrowu93's pi, on a ChatGPT account, stopped on
"Codex: 507 Insufficient Storage: exceeded request buffer limit while
retrying upstream". That text is Envoy's (ChatGPT's front): its first
try at the backend failed, and the body was more than it buffers to
try again. It is the same backend failure as #1628's 503 "reset before
headers", which magpie already asks again for without resting anybody,
only for a body the front couldn't retry itself. magpie relayed the 507
as it came; pi's _isRetryableError (pi-coding-agent 0.73.0,
agent-session.js) matches 503 but not 507 or these words, so the turn
just ended.

codexDropped now reads that 507 (by Envoy's words alone, any size, since
the 507 itself says the body was large) the way it reads the large
request's 503: the accounts loop asks the next account and the last one
again, nobody rests, and the agent is told a 503 with Envoy's words and
what may help (/compact, fewer or smaller images). The relayed path
(codexUpstreamOn, Codex's own sign-in) asks again the same way: the two
share edgeMayDrop/edgeSaidDrop. A 507 in other words is relayed as it
came. gateway-routing.md says so.

Run:
- New TestCodexUnbufferedAskedAgain, TestCodexUnbufferedTold503,
  TestCodexUnbufferedRelayed, TestCodexOther507Stays, with the
  reporter's literal Envoy text as the fixture. On the old code the first
  three fail: "status 507, want 200 pong: {...\"message\":\"Codex: 507
  Insufficient Storage: exceeded request buffer limit while retrying
  upstream\"...}" (the reporter's message byte for byte), and
  "507 once: 507 ... tried [acct-1]". With edgeSaidDrop matching every
  507, TestCodexOther507Stays fails. Restored, all pass, with #1628's
  TestCodexReset* tests.
- go test -tags nogui ./internal/gateway/ (sandbox HOME, pinned caches),
  gofmt -l, go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet
  (with and without nogui) on internal/gateway.
Not tried: a real 507 from ChatGPT (it needs the backend to fail a
request over Envoy's buffer, which can't be made to happen on purpose).
2026-10-14 05:37:00 +08:00
yetone ea3ea11729 gateway: an image request to a routing group moves on to the next member when one answers 5xx (#2005, tianxia3111)
/v1/images/generations sent to a routing:"order" group only ever drew on
the member the model resolved to; a 502 from it went straight back to the
caller even though the group had other members that could draw.

draw.go: when the asked model names a group (group/<id>, or a bare id
whose group holds the resolved member), drawingTries lists the members in
planGroup's order and the request moves on with chat's retryable rule
(5xx, 429, auth and quota refusals). A request the caller got wrong
(plain 400) still stops at once. Pause rules and a gateway key's model
holds apply per group as in chat. Drawing still rests no account. The
recent call records the skipped members as Fallback, and the final error
says "(tried first: ...)", as embeddings do.

video.go: /v1/videos had the same single-member path. Its start logic
moved into startVideo, and videosCreate walks the same tries; a member
that can't make videos moves on too.

Run: TestImageGroupMovesOnToTheNextMember and
TestVideoGroupMovesOnToTheNextMember go red (502) with either loop forced
to stop after the first member, and the image test goes red with the
retryable check removed. go test -tags nogui ./... (full suite), gofmt -l,
go vet for darwin, GOOS=linux and GOOS=windows on internal/gateway.
Not tried against the reporter's real providers.
2026-10-14 05:32:31 +08:00
NorethSea 56fcd1dc27 usage: each account picks a recorded allowance cycle beside its curve, meters and legend following it (#2009, NorethSea)
Let each account choose completed cycles beside its allowance curve. The
meters, sampling dates, plot and legend follow that cycle. Missing readings
stay unknown, and current account actions and whole-window estimates are
not presented as historical data. Fixed-deadline refills preserve cycle
boundaries alongside natural and early resets.

Keep the upstream whole-window estimate for the current view; no separate
price endpoint or duplicate estimation is added.

Verified on the integrated tree based on origin/main a75de4c2:
- 155 allowance, translation and scroll UI tests pass in Chromium/WebKit.
- Quota history race tests pass with count=3.
- macOS/Linux/Windows vet and builds pass.
- New Go cases fail without the unchanged-deadline refill handling; the UI
  case fails against upstream assets because the picker is absent.
- Real local allowance snapshots confirm cycle and meter switching.
- Full Go suite has one failure: TestPluginModelListThroughAccountProxy
  exceeds its context deadline. Other packages, including provider, usage
  and gui, pass. No release or complete-suite pass is claimed.

Reviewed and landed by yetone's agent from NorethSea's commit 69021d2c8,
cherry-picked onto origin/main (README conflict only: both appends kept).
Run at this head: go test -tags nogui ./internal/provider -run Quota,
-race -count=3 -run QuotaHistory, gofmt, GOOS=linux/windows go vet;
TestQuotaHistoryUnscheduledResets goes red with the refill rule removed.
GUI: quota-*, usage-*, balance-*, panel-usage, tray-*, click-scroll,
i18n-keys, gui-ja/de/zh-tw in Chromium and WebKit: 923/926; the three
reds are usage-sum-whole (also red 3 of 4 runs alone on origin/main
591ed58b5, #1864) and a usage-ledger case that passes alone.
2026-10-14 05:32:03 +08:00
yetone 59a8aec5df agent: Claude Code's /model takes models added in magpie again when the picker magpie wrote has lost its mark (#2046, cjyrainbow)
cjyrainbow's WSL Claude Code (Ubuntu) kept an old /model list: a model
added in magpie was in the gateway's /v1/models but not in modelPicker.
settings.json held the picker magpie wrote (every row "… · via magpie"),
but stash.json had no claude@wsl:Ubuntu.model_picker mark for it, so
writePicker took it for the user's own and never wrote it again. An
older magpie's stash lost keys (concurrent writes / a stash that didn't
parse, fixed in 270b5257), which is the likely way the mark went.

claudeIn's pickerOurs now also counts a picker whose every row has a
model and a description ending "via magpie" (magpiesPicker) as magpie's.
That holds for native and every WSL distro, since all go through
claudeIn with their own place key. Sync rewrites it and marks it again;
Disconnect removes it, as it does a marked one. A picker with any row of
the user's own (another description) stays theirs.

docs/subsystems/agent-wiring.md says when the picker is magpie's.

Verification:
- New TestClaudePickerMagpieWroteIsKeptUpToDateWithoutItsMark, native
  and wsl subtests: the reporter's state (picker written by magpie, mark
  forgotten, a model added, Sync) and a user-written picker after it.
- Broke it by hand: with the old pickerOurs both subtests fail "a model
  added in magpie isn't in /model: [cpa/gpt-6-luna cpa/claude-sonnet-4-6]";
  with the fingerprint ignoring descriptions both fail "the user's own
  picker was written over".
- go test -tags nogui ./internal/agent/ (count=1): ok, 1412s, on
  origin/main 591ed58b5.
- gofmt -l clean; go vet ./internal/agent/ on darwin, GOOS=linux -tags
  nogui and GOOS=windows.
- Not tried against a real WSL distro or the reporter's settings.json.
2026-10-14 05:29:56 +08:00
yetone b6cf5e3eab gui: magpie web keeps its sign-in when another service on the same address fills or clears the host's cookies, and a page opened without it says why and takes the key (#2033, 321sssrt-bit)
A browser keeps cookies per host, not per port. magpie web's sign-in
cookie on http://<tailscale-ip>:3430 is the same host's as every other
service on that IP's other ports, so one of them could take it away,
and a bookmark then answered only "open the link magpie web printed
when it started".

Reproduced in Docker (linux/arm64, MAGPIE_WEB_KEY fixed, as the
reporter runs it) with Chromium and WebKit on the old binary:
- docker restart, recreate (an update), browser restart: still signed
  in (the key, its derivation and the 400-day cookie are fine);
- another port on the same host setting ~400 cookies: Chromium evicts
  the sign-in (401), WebKit keeps it;
- another port answering Clear-Site-Data: "cookies" (a sign-out often
  does): 401 in both;
- the page opened by another name for the host (localhost vs IP): 401.

Changed:
- the sign-in cookie is sent with Priority=High, so Chrome evicts it
  last when the host's cookies overflow (with it, the flood case stays
  signed in);
- every magpie_web_<port> cookie the browser sends is tried, so a stale
  one sent first no longer hides the right one;
- an HTML page opened without the sign-in gets a page that says which
  case it is (no cookie sent for this address, or a cookie holding
  another key) and a field to paste MAGPIE_WEB_KEY into; POST
  /_magpie/sign-in sets the cookie and goes back to the page asked for
  (local paths only: no scheme, host, //, /\ or the sign-in itself).
  The key is never in the page. API calls get a plain 401 that now
  says the reason too, and the turn-away is logged with it.
- docs/reference.md's Docker web section says how long a sign-in lasts
  and what can take it away.

Run:
- TestWebGuardBookmark (link cookie has Priority=High; stale cookie
  first still passes; both reasons; API 401; wrong key 401 with no
  cookie; right key 303 to /?view=usage with a 400-day cookie; external,
  //, /\, javascript:, empty, sign-in-path and CRLF back values all go
  to /). Broken by hand: the old guard fails it (link without
  Priority), dropping Priority alone fails it, reading only the first
  cookie fails it (stale cookie: 401).
- The Docker matrix above again on the new binary: the flood keeps the
  sign-in in Chromium; Clear-Site-Data and the other name get the form,
  and the form signs in (wrong key turned away, right key back to
  /?view=usage, 200) in Chromium and WebKit; the log says "turned away
  ... no cookie sent".
- go test -tags nogui ./internal/gui (ok, 173s), gofmt -l, go vet
  darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: the reporter's own browser and Tailscale address; which
service on their host takes the cookie is not known.
2026-10-14 05:29:30 +08:00
yetone 1e654d8ce7 agent: T3 Code keeps the name, auto-compact and other settings the user gave magpie's provider across a restart (#2030, Kanscape)
T3 Code's sync wrote providerInstances.magpie whole on every start, so
what the user changed on it in T3 Code (Display Name, Auto-compact
after, its switch, colour, launch args, an env var of their own) went
back to magpie's defaults when magpie restarted or updated.

Sync and the field setter now merge into what is there (t3Merged):
magpie's own parts are written as before (driver, customModels, the
gateway's ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN and the review
switch), every other key under the instance and its config is the
user's and kept (mergeTheirs), a non-empty displayName and the enabled
switch are theirs, and the environment list keeps the user's own
variables beside magpie's. T3's own claudeAgent instance is never
touched, so it and magpie's keep their settings apart.

Run:
- TestT3CodeKeepsTheUsersSettings: T3's claudeAgent instance beside
  magpie's; the user edits magpie's (name, enabled, accentColor,
  autoCompactWindow "300000", launchArgs, a stale model, a changed base
  URL, an added HTTPS_PROXY), then three syncs. Against the old
  t3code.go it fails on the name, the switch, the colour, the config
  and the env.
- go test -tags nogui ./internal/agent (whole package, ok, 1555s on
  4c746ab39; T3 tests again after rebasing on 27956002c), gofmt -l,
  go vet darwin, GOOS=linux -tags nogui, GOOS=windows.

Not tried: the real T3 Code app (not installed here); the instance
layout follows T3's settings schema from its source. A binaryPath or
homePath carried over from T3's own Claude instance stays once T3
drops it; a value the user gives magpie's review variable is put back.
2026-10-14 05:28:39 +08:00
yetone 812ca5a5c6 gateway: a video request's other fields reach a provider's own videos API as sent, so Agnes gets its mode (#1399, shen-joe)
shen-joe's request to a model marked a Video model on an Agnes provider,
{"model":"agnes-cn/agnes-video-2.5-flash","mode":"text","aspect_ratio":"16:9",
"size":"720P","seconds":"10","prompt":"…"}, came back 400 from
api.agnes-ai.cn: "mode 不能为空". remoteVideoBody sent only model, prompt,
seconds, size and the images, so every field a vendor's own videos API
needs beyond OpenAI's was dropped.

readFilming now keeps the request's other fields (JSON, or a multipart
form's text values), and the body for a provider's OpenAI-shaped videos API
or another magpie's carries them as they came, under magpie's model and
prompt. Grok's and Volcengine's bodies are unchanged. Strings in them are
masked as the prompt is (a negative_prompt is the user's text too), and the
answer is unmasked when they were.

Polling stays at GET /v1/videos/{id}: api.agnes-ai.cn answers that route 401
on a bad key where an unknown route is 404 "Invalid URL", so the route
exists; the /agnesapi?video_id= query the reporter used wasn't needed.

TestCustomProviderVideoKeepsTheCallersFields sends the reporter's body and
checks mode, aspect_ratio, size and seconds reach the upstream, then that a
redacted word in negative_prompt and a nested field doesn't. It fails on
the old video.go, and with the masking taken out by hand. go test -run
'Video|Film|Redact' ./internal/gateway passes; gofmt clean; GOOS=linux and
windows go vet -tags nogui pass. Not tried against Agnes itself (no Agnes
account here).
2026-10-14 05:27:14 +08:00
yetone 66b8999e0d dsh: Reconnect puts magpie's key over one in dsh's key store that magpie refuses, and Disconnect puts it back (#1419, DannyJRu)
DannyJRu (dsh desktop 0.2.0-rc.2 on Windows, magpie 0.1.1226): the row said
"已不经过 magpie:配置已变更", its tooltip that ~/.dsh/.credentials.yaml holds
another MAGPIE_GATEWAY_KEY; Reconnect showed its success toast and the row
stayed red. dshCreds left any value there that isn't magpie's own token or
LAN secret, so Apply again could never fix what the check reported, and the
check sent the user to dsh's Models page instead.

The store wins over .env in dsh, and MAGPIE_GATEWAY_KEY is the name only
magpie's route reads, so a value there the gateway refuses fails every turn
through magpie. Now a model picked here, which is what Reconnect (Apply
again) does, replaces such a value with magpie's key and stashes it;
Disconnect puts it back. The sync and the serving round still leave it (no
silent overwrite of a value the user set), a caller key the gateway takes
stays (#1332), and so does any key when dsh points at a magpie on another
machine, which only that one can judge. The check now says Apply again
fixes it (Disconnect puts the old one back), except for a gateway on
another machine, where the old advice stands.

TestDshApplyReplacesAKeyTheGatewayRefuses: the sync leaves a refused key and
the check reports it; a model set replaces it, keeps the store's other
refs, and the check is quiet; Disconnect puts it back; a caller key the
gateway takes isn't replaced. It fails on the old dsh.go. go test -run Dsh
./internal/agent passes; gofmt clean; GOOS=linux and windows go vet
-tags nogui pass. Not tried with the real dsh desktop app on Windows; why
the reporter's store holds a refused value isn't known (an old caller key,
or one typed in dsh's Models page), and they are asked to confirm.
2026-10-14 05:27:14 +08:00
yetoneandBussanQ 3aa22f9d9c gateway: a translated Responses reply keeps the web search that ran, with its query and sources (#2044, BussanQ)
What changed: responsesEncoder.event gets a KSearch case and
renderResponses a Search case. Both emit a completed web_search_call
item (ws_ id, action.type "search", query plus queries, and the
nonempty source URLs in action.sources) through the shared
responsesSearchItem. The stream adds the item, sends
response.web_search_call.completed {item_id, output_index} and
output_item.done, and the same item stays in the terminal response's
output, in order with text, reasoning and client tool calls.

Why: a search magpie ran for a model that can't search (searchRounds),
or one decoded from an upstream Responses or Anthropic reply, reached
the client only as answer text. Anthropic clients already got
server_tool_use / web_search_tool_result; Responses clients (bqAgent)
had no record that a search ran or what it found. No earlier progress
events or url_citation offsets are invented.

From BussanQ's reference commit b1a4e7b, reviewed line by line and
applied onto origin/main. Added on review:
TestResponsesSearchItemReplayed (the item sent back as the next input,
as Codex does, parses and leaves the turn's messages unchanged) and a
docs line saying so.

What was run (sandbox HOME, pinned caches, go1.26.8):
- go test -tags nogui -count=1 ./internal/gateway -run
  'TestResponsesSearch.*|TestWebSearchForAModelThatCannot|
  TestSearchToldAsAnthropics|TestWebSearchAskedOfEachAPI|
  TestAnthropicServerToolLeftOut|TestParallelToolCallIDs|
  TestResponsesStreamToolThenHiddenThinking': ok
- Break check: origin/main's responses.go put back with the new tests:
  TestResponsesSearchResults "search output lost or reordered: got
  [message message function_call]", TestResponsesSearchDecodedResults
  "decoded provider search missing", TestResponsesSearchFollowedByFailure
  "completed search or subsequent error lost", and
  TestWebSearchForAModelThatCannot "delegated search missing from
  Responses output" all FAIL; pass with the change restored.
- go test -tags nogui ./internal/gateway (whole package)
- gofmt -l; go vet -tags nogui for darwin, GOOS=linux, GOOS=windows
Not run: a live provider; the full repository suite.

Co-authored-by: BussanQ <bussanq@gmail.com>
2026-10-14 05:23:58 +08:00
yetone 27956002c3 agent: OmO's update runs the npm of the node it was installed with, not a system one first on magpie's PATH (#2021, ggbdpq)
OmO updates itself: magpie runs `omo update`, and omo-ai 5.1.32's
updateTarget (bin/lib/package-paths.js) then runs a bare
`npm i -g omo-ai@<v>` (or `bun add -g` for a bun install). The
updater for a self-updating CLI had no path, so that npm was whichever
came first on magpie's PATH. With OmO installed under an fnm/nvm node
and a system npm in /usr/local/bin, the update went to the system
prefix (or failed on its permissions), and the omo the agent runs
stayed old.

howInstalled's self branch now gives the updater the bin dir of the
package manager that holds the CLI (selfPath): for an npm install, the
prefix's bin that fromNodeModules already finds for npm-installed CLIs;
for bun or pnpm, the dir of that manager's binary. That dir goes first
on the update's PATH, as it does for npm updates.

Run: TestOmoUpdateTakesItsOwnNpm (new: a fake system npm that fails and
an fnm prefix's npm that records; on the old code the update ran the
system npm and failed with exit status 1), TestOmo*, TestHowInstalled*,
go test ./internal/agent (ok in 1783s at load average ~100;
a 15m timeout ran out under that load, on no failure),
gofmt -l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent.
2026-10-14 05:22:47 +08:00
yetone 45e77b61f7 library: Claude Code's hooks can go on every event it has, StopFailure, PostCompact and FileChanged among them (#2020, emo172)
The claude branch of hookSpecOf knew 12 of Claude Code's events, so a
hook on StopFailure, PostCompact, CwdChanged, WorktreeCreate and the
rest was refused ("it has no event called StopFailure") and could only
be written into settings.json by hand, outside magpie's record and
backups. The list is now claudeHookEvents: all 33 names of the
HOOK_EVENTS enum in the real claude 2.1.296 binary, read from it with
strings (read only, ~/.claude untouched). That is the 14 the issue
lists plus six it didn't (PostToolBatch, UserPromptExpansion,
PermissionDenied, Elicitation, ElicitationResult, DirectoryAdded). The
page's event picker takes the agent's list from the same table, so it
offers them too. Codex's, Gemini's and Cursor's tables are not
changed here: each of Codex's 12 names is in codex 0.162.1's strings,
but its full enum wasn't extracted.

Run: go test ./internal/library (TestHooksClaudeEventsAll new; on the
old table it fails with "it has no event called StopFailure"), gofmt
-l, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library.
2026-10-14 05:22:46 +08:00
yetone bf25842714 gateway: a provider's own cap on how long a key that keeps failing rests (#2008, Gaudi-XIX)
A key that keeps failing doubles its rest from a minute up to 10 minutes,
and one rate limited again as soon as its rest is over up to 30; both
caps were fixed, so a free key down for hours was asked again every 10
or 30 minutes all the while.

`magpie provider rest-cap <id> 4h` (Provider.RestCap, minutes, at most
MaxQuotaRest, 8 days) sets where both ladders stop for that provider's
keys and accounts (RestCapOr in restAfterMarked's default branch and in
rateRest); `default` gives back the gateway's own. A time the vendor names
still stands over it. Unset, nothing differs. It is kept by the editor's
save, the account copy and normalize.

Run: go test -tags nogui ./internal/provider ./internal/gateway
./internal/cli ./internal/gui (temp HOME). Broken by hand: both ladders
back on the fixed caps fail TestOwnRestCap (rate-long #6: 30m, want 32m);
the GUI keep removed fails TestSaveKeepsQuotaResetAt. Not tried against a
real vendor's outage.
2026-10-14 05:22:40 +08:00
yetone 064cffdbfd gateway: a key out of a daily allowance rests until the time of day it comes back (#2008, Gaudi-XIX)
A free tier's "You've reached today's free-model token quota" says
nothing of when it is back, so it rested 15 minutes (or the provider's
own quota-rest), and was asked again all day. A vendor Retry-After over
an hour was cut to the hour, and that hour then stood over the user's own
longer rest.

- Provider.QuotaResetAt: "08:00" on this computer's clock, or
  "00:00+08:00" on the vendor's. `magpie provider quota-rest <id> until
  08:00` sets it; a number of minutes set after it replaces it, and
  default clears both. normalize drops one that isn't a time of day.
  It is kept by the editor's save and the account copy.
- restAfterMarked's quota branch rests until its next occurrence
  (OwnQuotaRest). A time the vendor names, or a window's end, still
  stands over it; a Retry-After stands unless it was cut to longestWait
  while the user's own rest is longer.
- Defaults are unchanged: nothing set, nothing differs.

Run: go test -tags nogui ./internal/provider ./internal/gateway
./internal/cli ./internal/gui (temp HOME). Broken by hand, each fails:
OwnQuotaRest replaced by QuotaRestFor (TestQuotaRestsUntilTheTimeOfDaySet,
3 asserts), the Retry-After guard removed (the 7200 case), the GUI keep
removed (TestSaveKeepsQuotaResetAt), default not clearing it
(TestQuotaRestUntil). Not tried against a real free-tier vendor.
2026-10-14 05:22:39 +08:00
yetone 77f90fd84f gateway: a plugin whose config hook says searches: true is sent the client's web_search as sent (#2027, yudaleng)
A plugin in front of Anthropic's or OpenAI's own API (a CPA or sub2api
relay whose quota the plugin reads) had no way to say its upstream runs
the hosted web search tool: searchesItself returned at once for any
signed-in account, letting only Codex and Grok through, so Claude Code's
WebSearch and Codex's web_search always went through magpie's own search.

Now a plugin's config hook can set `searches: true` on its provider, as
it sets `decide` (#1514). The host passes it through
(plugin.Provider.Searches), pluginProvider sets the provider's Searches,
and searchesItself honours it for a plugin's provider only, on Anthropic
or Responses and only where the plugin has a model on that API, the same
rule a custom provider's "Searches the web by itself" has (#359). Another
sign-in's Searches is never read; Codex and Grok are unchanged. As with a
relay, searchRank leaves it out, so magpie never picks it to search for
other models; Settings can name it by hand.

Documented in docs/subsystems/provider-plugins.md and the plugin guide
(site/public/docs plugins.html, en/zh/ja).

Verified:
- TestPluginSaidToSearch (new, gateway, through the real fake plugin on
  bun and New().Handler()): with FAKE_SEARCHES the plugin's upstream gets
  web_search_20250305; without it, it gets no search tool; Chat doesn't
  search and searchRank is -1 either way.
- Broken by hand, each red: search.go reverted, plugins.go reverted,
  host.js reverted (each "searches by itself on Anthropic: false"); with
  the searchesItself assertion disabled and search.go reverted, the wire
  check fails "said to search true, the plugin was sent []".
- TestMovedGrokSearchesItself, TestGrokPluginSearchesItself,
  TestWebSearch* pass.
- go test -tags nogui ./internal/plugin ./internal/provider ok, and
  ./internal/gateway (see the run noted on #2027) under a sandbox HOME
  with pinned caches; gofmt -l clean; GOOS=linux and GOOS=windows
  go vet -tags nogui on the three packages clean.
- Not tried with a real CPA/sub2api plugin.
2026-10-14 05:17:31 +08:00
yetone 0337ce4bc7 factory: Haiku 5.5 and Mistral Large 4, in droid 0.240.0's picker, are offered, and moved users get plugin 0.1.25 (JL on Discord)
JL (Windows, droid 0.240.0, Factory desktop 0.197.1, magpie 0.1.1226,
opencode-factory-auth 0.1.24): droid and Factory desktop offer
claude-haiku-5-5; droid through magpie couldn't pick it.

droid's models are the registry bundled in its npm binary
(@factory/cli-<platform> 0.240.0, bin/droid). Against 0.233.0's registry,
0.240.0 adds claude-haiku-5-5, mistral-large-4 and gpt-6-astra-ultrafast.
The plugin (magpie-community/plugins e4023d9, published as 0.1.25, npm view
checked) now offers Haiku 5.5 (Anthropic Messages, 872000/128000, efforts
low..max) and Mistral Large 4 (chat completions, x-api-provider mistral,
Droid Core, 524288/64000, images). GPT-6 Astra Ultra Fast stays out: droid
offers it only once the user accepts Factory's high-cost terms.

- migrate_factory.go: the mover's min is 0.1.25, so keepMovedCurrent
  updates moved users (JL is on the plugin).
- factory.go: the built-in had the same gap; its table gets the same two
  rows for users who haven't moved.
- factory_pool_rest_test.go: the plugin's Core list, copied from its
  usage, gains Mistral Large 4.
- TestFactoryDroid0240Models is new; its fixture is droid 0.240.0's
  registry bytes (the same as the plugin's models.test.mjs). It fails with
  the Haiku 5.5 row removed.

Run, under a temp HOME: go test -tags nogui ./... with the machine at load
35-190 (other sessions). Every package passed except five that hit the
10m timeout mid-test (agent, gateway, library, plugin, provider, in
tests that don't touch Factory). Rerun with -timeout 40m: provider ok;
gateway still timed out at load ~130 (TestCodexHeardWithinItsIdleTimeout
failed on its timing, unrelated); -run 'Factory|Moved' on gateway ok.
agent, library and plugin were not rerun to the end; this change
doesn't touch them. gofmt -l clean; GOOS=linux and GOOS=windows go vet
-tags nogui on internal/provider and internal/gateway ok.
Not tried against Factory itself (no Factory account here); droid was read,
not run.
2026-10-14 05:11:19 +08:00
ggbdpq eb22f6355a davsync: a computer joining a sync folder keeps the gateway keys the folder's store has never seen (#1737, #1714, ggbdpq)
The gateway-key store rides the settings part, and a first sync brings
a part changed only on the server in whole. So a computer with its own
gateway keys that joined a folder another computer had set up first had
every key replaced by the folder's store (8ugMak1r on #1714 got them
back only from the -this-computer copy in the sync folder). On the first
sync, before the settings are brought in, the keys this computer holds
that the store has neither by id nor by value are added to the store
brought in; that merged store is restored here and pushed for the
others. A key the folder holds wins; the LAN default key follows the
folder's settings as before. After the join a key missing from a store
this computer has seen is a removal, as before.

ggbdpq's patch (a9605c8a), cherry-picked unchanged.

Run (reviewer): TestGatewayKeysJoinKeepsUnseenKeys fails on the old
davsync.go (the joining computer's keys are gone, the pushed store holds
only the folder's default key, computer B never gets A's key) and passes
with it, -race -count=3; TestGatewayKeysJoinWithoutStoreKeepsKeys passes
on both. go test ./internal/davsync/... ok. Not tried against a real
WebDAV server.
2026-10-14 04:59:10 +08:00
ggbdpq 94e3b3f529 sessions: a gateway-sessions-hidden.json that doesn't parse is kept aside before the next delete or Restore writes over it (#1722, ggbdpq)
readHidden read a file that didn't parse as no deletions, and the next
DeleteGateway or Restore wrote that empty list (plus the new entry)
over it, or removed it, so every earlier deletion record was gone for
good. writeHidden now copies such a file to
gateway-sessions-hidden.json.bad-<time> first, as stash.json's and
logins.json's unread files are kept, and doesn't write when the copy
can't be made.

ggbdpq's patch (1ec0def6, marked wip and unverified on its branch).
Reviewer's changes: "doesn't parse" is decided by unmarshalling into
the list (json.Valid let an object through to be written over), and a
copy that fails stops the write instead of only logging, as d40fee80
doesn't move what it couldn't back up. TestUnreadHiddenObjectKeptAside
covers the object case.

Run (reviewer): TestUnreadHiddenKeptAside fails on the old
gateway_delete.go ("written over, not kept aside");
TestUnreadHiddenObjectKeptAside fails on the old code and on the
original patch; both pass -race -count=3. go test ./internal/sessions
ok (279s).
2026-10-14 04:59:09 +08:00
ggbdpqandfactory-droid[bot] 1a7aa76b4b mcpauth: an MCP sign-in canceled while its token is being fetched no longer saves the late token or replaces the server's sign-in (#1750, ggbdpq)
Cancel set the flow canceled, but a callback already trading its code
went on to write mcp-signins.json and call Changed when the token came
back, so a sign-in the user had ended was saved, and an existing
sign-in to that server was replaced. The callback's write now happens
under the flow's lock only while the flow is live (flow.keep), so
Cancel or the timeout and the commit can't both win; a commit that wins
still tells the agents before the flow says done.

ggbdpq's patch (46440adc), cherry-picked unchanged.

Run (reviewer): TestCanceledMCPCallbackDoesNotSave (real discovery,
registration, PKCE and loopback callback against mcpauthtest, the token
reply held until Cancel) fails on the old mcpauth.go in both cases
("saved credentials", "redistributed credentials 1 times") and passes
with it, -race -count=5; go test -race ./internal/mcpauth/... ok.
Not tried with a real MCP server's OAuth.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-14 04:59:08 +08:00
ggbdpqandfactory-droid[bot] 509328ccb0 provider: a Codex reset spent while an allowance read is in flight is never undone by that read, even on Windows' coarse clock (#1754, ggbdpq)
Allowances took time.Now() when its background read began, and
forgetAllowance stamped the reset with time.Now(); a reading was dropped
only when the reset was After the start. On Windows two events in one
clock tick get the same time, so a read begun before a spent reset could
put the account's 100% back right after it. Reads and resets are now
ordered by a generation counter under usedCache's lock.

ggbdpq's patch (e07232ef), cherry-picked unchanged.

Run (reviewer): TestResetAllowanceKnownAtOnce, Windows test binary on
the Windows box (sandbox USERPROFILE/APPDATA), -count=10: old code FAIL
4 of 10 ("routing reads 100 used (known true), want 0"), this change
PASS 10 of 10. macOS -race -count=20 of the Allowance/Renewed tests ok.
Full provider package, gofmt, linux and windows vet: see the push.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-14 04:59:07 +08:00
yetone 591ed58b53 provider: Nous Portal is a vendor preset, Nous Research's API with a Portal key (#392, Vocllum, laojianzi)
Nous Research makes the Hermes models and serves them, with other makers'
models, through Nous Portal. #392 was wrongly answered as a relay. A new
preset, nous ("Nous Portal", KindVendor with Hosts, lobe-icons
nousresearch icon), points chat completions at
https://inference-api.nousresearch.com/v1. A Portal API key goes in as a
Bearer, the way Hermes Agent's own nous-api provider uses NOUS_API_KEY.
The model list is the Portal's /v1/models, which uses vendor/model ids.
An entry another app has at that URL, such as Hermes Agent's base_url,
now imports as the preset.

The preset sets no Anthropic endpoint. The Portal's /v1/messages serves
only its anthropic/* models (Hermes Agent's
test_nous_portal_anthropic_wire.py), so Claude Code's requests are
translated to chat completions for every model. It sets no Responses
endpoint either, because none is documented.

The preset is added to the README (en, zh), docs/reference.md, and the
site's import pages and icon.

Sources:
- hermes-agent docs: integrations/nous-portal, integrations/providers,
  features/subscription-proxy.
- hermes-agent source at 6e7b83a2: hermes_cli/auth_constants.py
  (DEFAULT_NOUS_INFERENCE_URL), plugins/model-providers/nous,
  cli-config.yaml.example ("nous-api - Nous Portal API key (requires:
  NOUS_API_KEY)"), agent/anthropic_endpoints.py, and
  tests/e2e/core/live/_helpers.py, whose live run calls the Portal with
  NOUS_API_KEY.

Probed without a key:
- /v1/models answers 200 with 423 models.
- /v1/chat/completions with a bad Bearer answers 401 "Your API key is
  invalid, blocked or out of funds".
- /v1/messages answers an Anthropic-shaped 401.

Not tried: a real Portal key or a real request, since no key was
available. Also not built: OAuth sign-in with the 1-hour token and its
refresh (Hermes Agent's ~/.hermes/auth.json).

Run:
- TestNousPortalPreset fails without the preset (no preset "nous") and
  with an Anthropic endpoint added (endpoints: … "https://inference-api.nousresearch.com").
- go test -tags nogui of internal/provider, internal/gui and
  internal/catalog passes.
- gofmt -l is clean.
- go vet, GOOS=linux go vet and GOOS=windows go vet -tags nogui on
  ./internal/provider pass.
- add-sheet and add-button GUI tests pass in Chromium and WebKit (6/6).
2026-10-14 04:40:21 +08:00
yetone 4c746ab390 gui: Azure OpenAI says its models are the deployments magpie lists with the key (#1995, parkavenue9639)
Adding Azure OpenAI asked only for the endpoint and key. Nothing said that,
once it is saved, magpie asks the resource for its deployments with that
key (Provider.azureModels), so people took the page for one where model ids
must be typed. A saved one whose list hadn't come back yet said "The
vendor's list is empty", the same as one asked and empty.

- The endpoint hint (presets.go) now says magpie asks the resource for its
  deployments with this key once added, and the deployments' names are the
  model ids.
- The add page has a Models row for Azure: nothing to type; a deployment's
  name is typed as a model id only if the list can't be fetched.
- A saved Azure provider with an empty list says it is asking the resource
  with this key while the background fetch runs (providers.fetching, not
  yet fetched, no list error), and after it that no deployments came back,
  with Fetch again or a deployment's name. Every other provider's empty
  text is unchanged.
- New strings in zh, zh-TW, ja and de.

azureModels itself is unchanged.

Run: azure-endpoint.test.cjs (24 pass, Chromium and WebKit, en and zh),
extended with the add page's Models row and four empty-list cases (asking,
asked and none, asked and failed, OpenRouter unchanged). With the old
app.js put back it fails 10 of 12 on Chromium (no .azure-models row, the
generic empty text). With the old i18n.js the zh cases fail (6 of 12).
gui-de, gui-ja, gui-zh-tw, i18n-keys, provider-fetch-again,
provider-picks-stay, add-sheet: 34 pass in each engine. go test -tags nogui
./internal/provider ./internal/gui ok under a sandbox HOME; gofmt -l clean;
GOOS=linux and GOOS=windows go vet -tags nogui on both packages clean.
Not tried against a real Azure resource (no account): only the text
changed, not the fetch.
2026-10-14 04:39:51 +08:00
yetone 80211e7075 provider: a balance field sums, maxes or counts a list's items, and one amount it can't read is "—" (#1993, RicardoWYP)
A relay's /api/subscription/self tells usage per subscription, a list.
A balance path could only name one index (subscriptions.0), so several
active subscriptions read as the first, ".0 + .1" failed whole when only
one existed, and a weekly cap of 0 ("divides by 0") hid every amount of
the field.

Now a path goes through a list's items with "*" (a.*.used), or those
that match with "[key=value]" / "[key!=value]" (a[status=active].used,
also on an object: a.*.subscription[status=active].used). Such a path is
several values, made one by sum(), max(), min() or count(); arithmetic
between two of them goes item by item, so max(a.*.used / a.*.cap) is the
fullest window. Several values left outside a function are an error
naming the functions, not a guessed sum. Within a list an item without
the path, or divided by 0, is left out; max/min of nothing is an error.

In a field of several ";" amounts, one that can't be read shows "—"
(BalancePart.Error says why, as the card's hover on the Usage page and
in the panel) and the others still show; the read fails only when none
can be read. A single amount alone still fails as before.

The GUI hint (zh, zh-TW, ja, de) and `magpie provider` help say the new
syntax.

Run:
- TestBalancePathLists, with the reporter's literal JSON: against the
  old balance.go it fails ("nothing at \"sum\" in the reply", and the
  "—" cases error); passes now. TestReadBalancePath's one case that
  expected a whole-field failure with one bad amount now expects it
  only when every amount fails.
- go test -tags nogui ./internal/provider ./internal/cli ./internal/gui
  under a temp HOME: ok.
- balance-parts, gui-de, gui-ja, gui-zh-tw, i18n-keys in Chromium and
  WebKit: 14 pass. With the title lines removed, balance-parts fails on
  the missing hover text.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui on
  provider and cli.
Not tried against the reporter's real relay.
2026-10-14 04:37:43 +08:00
yetone 9bfbd6e45e sessions: Sessions loads again with a large Cursor store, which every listing read whole from disk (#1988, kangxi94)
v0.1.1227 (0e39c8e7e) reads a live Cursor state.vscdb from an APFS clone
made whenever Cursor has written, which stopped the repeated copies. But
the editor's chat list was found with `key LIKE 'composerData:%'`. LIKE is
case-insensitive, so SQLite can't use the key's index and scans the whole
table: every bubble and checkpoint, often several GB. Before, the copy had
just been written and sat in the page cache; a fresh clone doesn't, so
each listing read the whole store from disk again. Cursor writes every few
seconds, so nearly every listing got a fresh clone, and /api/sessions and
/api/sessions/manage took longer than the pages' polls: Sessions and Usage >
Sessions showed skeletons for good.

The list is now read by a range on the key's index (cursorComposersQuery,
key >= 'composerData:' AND key < 'composerData;'), which reads only the
chats' rows.

Run:
- TestCursorComposersQueryUsesTheKeyIndex: Cursor's own schema, keys around
  the range's edges; the plan must be a search on the index and only
  composerData: keys come back. Red with the LIKE put back ("SCAN
  cursorDiskKV").
- sqlite3 on a fresh clone of a 2.2 GB live-written store: LIKE 3.74s cold,
  0.11s warm; the range 0.06s. A second repro (4.3 GB store, 1M small keys,
  500 chats): range 0.01s vs LIKE 3.8s; on main /api/sessions took 40-60s
  and /api/sessions/manage 86-121s every round.
- Built binaries against the 2.2 GB store with a writer every 2s, same
  sandbox, machine at load ~25 from other work: /api/sessions 17/9/3.7s and
  manage 16s with the fix, 34/26/9.4s and 31s on main. The rest is not
  the Cursor scan (a sample shows no sqlite work); not measured on an idle
  machine.
- go test ./internal/sessions ./internal/gui ok; gofmt; go vet darwin,
  linux, windows.
Not tried on the reporter's machine or a real Cursor store.
2026-10-14 04:37:37 +08:00
youheyu bede73c34d gateway: concurrent tasks of an agent that sends no session id are told apart by their conversation (#2001, CnsMaple)
Task done 通知按 agent+session 分桶,turnState.start 建桶时定死:同一
agent 不带 session 头的多个并发任务共享一个桶,先结束的任务的通知读的
是仍在跑的最长任务的时间(且 going>0 时不发通知)。convOf 生成的
Conv(首个用户轮次的摘要)已存在于 Route 且只在无 session 时填充——
sessionTurnKey 在 Session 为空时用 Conv 兜底,并发任务各归各的桶。
同一 session 的多个请求仍共享一个 turn,等待全部结束、跨度和原来一致。

验证:TestTurnDoneConcurrentTasksByTheirConversation(短任务通知读自己的
一分钟、长任务不受影响各自报自己的跨度)与
TestTurnDoneSameSessionStillOneTurn(同 session 行为不变);未修复基线
前者 FAIL(等了 10s 无通知,因 going>0 被压住)。TestTurnDone* 全组通过。

Root cause and fix by AwadYoo (comment on #2001), landed as their commit.
Reviewed on main: both routes that mark a request as a turn
(gateway.go, codex_backend.go) set Conv, convOf is "" whenever a session
header is present, and begin/end read the key off the same Route, so a
request's begin and end always meet one bucket.

Run (sandbox HOME, pinned caches, rebased on e297a8ab2):
- go test -race -run 'TestTurnDone|TestToolScan' ./internal/gateway: ok
- sessionTurnKey put back alone: TestTurnDoneConcurrentTasksByTheirConversation
  FAILs "the turn's end was never said"; restored: ok
- go test -count=1 -timeout 30m ./internal/gateway: ok (1260s; the default
  10m timed out while five other gateway suites ran on this machine)
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway: ok
Known limit: an agent with no session id whose first user turn changes
mid-task (its own compaction rewriting it) starts a new turn there.
2026-10-14 04:37:07 +08:00
yetone cc43e9893c provider: a plugin subscription put first on one computer is first on the other too, once sync has named it by both ids (#1940, Sun1090)
Sun1090, on v0.1.1225 (which had 9c922b9f7): WorkBuddy and WorkBuddy AI
put first on one computer, and on the other WorkBuddy AI still came last.
Their screenshots show why. WorkBuddy AI is moved onto its plugin on one
computer (workbuddy-ai) and signed in to the plugin under its own id on
the other (workbuddy-ai-plugin). The order synced in names
workbuddy-ai-plugin first, and MirrorOrder keeps the ids this computer
names alone after the other's, so the stored order named both:
[workbuddy-ai-plugin, ..., workbuddy-ai]. 9c922b9f7 looked up the
counterpart only when the order didn't name the provider's own id, so the
own id, put last by sync, won.

- ordered(): a provider takes the earlier of its own place and its
  counterpart's, when the counterpart isn't a provider of its own here
  (both signed in on one computer still each keep their own place).
- The same pair made sync's "Not signed in on this computer" list
  workbuddy-ai-plugin (as a raw id) on the computer where WorkBuddy AI is
  signed in as workbuddy-ai, and the other way round (both screenshots).
  NotSignedIn counts a subscription signed in under its other id as
  signed in.

Run: TestSyncedOrderKeepsAPluginsPlaceNamedBoth goes through MirrorOrder
with the reporter's ids; on the old ordered() it fails ("listed:
[zhipu deepseek workbuddy-ai]"), and with the NotSignedIn change taken out
it fails ("not signed in here: [workbuddy-ai-plugin
commandcode-plan-plugin]"). go test -tags nogui ./internal/provider
./internal/davsync ./internal/backup ok under a sandbox HOME; gofmt -l
clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider
clean. Not tried across two real computers.
2026-10-14 04:35:55 +08:00
yetone e10b7f92a1 usage: a window whose calls may have been paid from credits shows no whole (#2010, NorethSea)
Once a Codex account's window read 100% used, ChatGPT kept answering its
calls from credits; once the credits ran out the card had no Balance, so
holdsBounds let the whole-window estimate back in and counted those calls
as the subscription's. The reporter's fixture (5 hours at 100%, week at
50%, a 100k subscription call and a 900k credits call) gave routed
1000000 / whole 2000000 for the week. Claude's extra usage after a dry
window is the same case.

dryRuns builds each account's dry runs from its kept quota history plus
the card's own reading: from the last reading with some left (unknown =
zero) through the first reading of none, to the first with some again.
A window that counted a call in a run is not reckoned when the vendor
answered a call after the run's first dry reading, or when no earlier
reading with some left is known. A run where everything after the dry
reading was turned away (no credits) leaves the estimate as it was, and
a run before the window began doesn't touch it.

Run: go test -tags nogui ./internal/usage ./internal/gui (HOME sandbox),
gofmt, GOOS=linux/windows go vet. TestWindowHoldsLeavesOutCallsPaidOtherwise
goes red with the exclusion disabled (prints the reporter's 1000000 /
2000000) and with the "answered after the dry reading" condition dropped.
Not tried against a real account that spent credits.
2026-10-14 04:32:01 +08:00
yetone 916e30a4f8 docs: every file in ~/.config/magpie says what it is for (#2028, emo172)
#2028 asked to sort ~/.config/magpie into subfolders. It stays flat:
backups, sync, Docker volume mounts and older magpies all find each file
by its name there, and moving them would break each of those for a
cosmetic gain. What the report really lacked is knowing what each file
is, so the reference's Files section now lists every file magpie writes,
grouped by what it holds (what you set, accounts and sign-ins, what
magpie set on agents, the gateway and usage, the window's state, and
~/.cache/magpie), with which are written 0600 and what .lock and .bak
files are.

Each line was checked against the code that writes the file (the path
helpers and their doc comments). Docs only; nothing was run.
2026-10-14 04:27:31 +08:00
yetone 1aadd2167c gui: a proxy's own error page is said by its title, not as raw HTML (#2032, precisionz)
When an answer isn't JSON, api() showed its first 200 characters. For a
proxy's or tunnel's own HTML page that was markup, e.g. Cloudflare's 524
page as "<!DOCTYPE html> <!--[if lt IE 7]> <html class=…" in precisionz's
screenshot. An HTML answer (by Content-Type, or a body that starts as a
page) is now said as "A proxy in front of magpie answered, not magpie
(<title>)". For 504 and 524 it says that the proxy stopped waiting, magpie
may still be finishing, and to check again in a minute. The status pill
shows one line, so the words that matter come first. Plain-text errors
are shown as before. Strings in zh, zh-TW, ja and de.

Verified:
- internal/gui/tests/plugin-proxy-page.test.cjs (new). It installs from
  the Discover field at 420px, with plugins/add answering Cloudflare's
  524 page (its head as in the screenshot, the rest from Cloudflare's
  template, not captured live) and a 502 with no Content-Type, in en, zh,
  ja and de, plus a plain-text 500. Chromium and WebKit: 12 pass. With
  api()'s old line put back, every language fails on the raw markup.
- gui-ja, gui-de, gui-zh-tw, i18n-keys and every plugin-*.test.cjs, both
  engines: 396 pass, 0 fail.
2026-10-14 04:22:22 +08:00
yetone c55395df9e gui: a plugin install goes on when the proxy in front of magpie web gives up (#2032, precisionz)
precisionz installed Zed from magpie web on a phone; the page spun for a
while and then showed Cloudflare's own error page ("<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie…"). A tunnel or proxy in front of
magpie web stops waiting after its own limit (Cloudflare: 100 seconds,
then 524), closes the connection, and /api/plugins/{op} ran bun under the
request's context, so the install was cancelled halfway.

/api/plugins/{op} now runs under context.WithoutCancel(r.Context()) with
the same 5-minute cap, as moveContext already does for a move. add,
remove, update and upgrade go through test seams (addPlugin, ...).

Verified:
- TestPluginOpsOutliveRequest (new) cancels each request before serving
  it. With r.Context() put back it fails: "got [add: stopped with the
  page remove: stopped with the page update: stopped with the page
  upgrade: stopped with the page]". With the fix it passes.
- HOME=<temp> go test -tags nogui ./internal/gui/: ok (107s).
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/gui/: clean.
Not tried: a real Cloudflare tunnel in front of magpie web.
2026-10-14 04:22:19 +08:00
yetone 17d4283a5a library, gui: a hook has a description in any language, shown under its name (#2011, emo172)
A hook's name is letters, digits, - and _ (checkName), so a Chinese user
had to translate "auto-format-queue" back in their head; 编辑后格式化 was
refused. Hook now has an optional Description: one line (whitespace and
line breaks folded into single spaces) of at most 200 characters, kept
in library.json only and never written into an agent's hooks file. The
Hooks tab shows it under the name; the editor has a Description field
(maxlength 200) under Name. The library's text fields no longer save or
close on an Enter or Escape that only ends an input method's composition
(isComposing / keyCode 229), which a Chinese description would hit.
Strings in zh, zh-TW, ja and de; docs/subsystems/library.md says it.

The reporter's other option, non-ASCII names, wasn't taken: the
description says more than a name can, and names stay one rule across
servers, skills and hooks.

Run: TestHookDescription (kept through a save, an agents change and a
rename, read by the page, no agent file has it, 201 characters refused,
200 kept) fails with the folding and the length check removed.
library-hooks.test.cjs (a description under the name, none for a hook
without, the field's placeholder and hint, an IME Enter posts nothing,
Save posts the description) fails on the old library.js and with the IME
guard removed. library-*, gui-de, gui-ja, gui-zh-tw, i18n-keys and
click-scroll pass in Chromium and WebKit (263/263 each). go test -tags
nogui ./internal/library ./internal/gui under a temp HOME, gofmt -l,
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/library pass.
2026-10-14 04:18:36 +08:00
yetone c48c49488d lessons: the review of 10-11 to 10-13; failed reads, locks, another app's values, guarantee tests, network-free tests, tags and commit bodies move to the code standards
The nightly fold of the review of 10-11 05:20 to 10-14 04:00 (602
commits, tags v0.1.1173 to v0.1.1228, 54 of 56 published).

Moved to docs/code-standards.md, each seen a third day or more:
- a failed read means unknown (7d9382db2, e297a8ab2);
- nothing that can block runs under a lock its reader needs (a2afc1828,
  a75de4c21);
- another app's values come from that app (accc8c090 -> e0ecf0161);
- a test named for a guarantee fails without it (9dd5917a4, cc93b566e);
- a test never reaches the network (f230fa23b, bde11c778);
- a tag waits for a green run and is not a release (v0.1.1192/1193 on one
  commit, v0.1.1213 and v0.1.1218 unpublished, #1846);
- a large commit's body holds what was run (ea3d480ed, 1cd814004,
  3ccbe6bc1's "push notes").
Criterion 3 now names the guard tests that chosen-package runs broke on
10-13 (494609866, 24146c031, c6de0d2a5). LESSONS.md keeps pointers.

LESSONS.md: reading the report and two-sessions-one-checkout seen a
second day (def3a41e3 reverted in 2c30e5cee; 3e88fc09d). New 1x lessons:
WebKitGTK vs Playwright WebKit (f5dd4d604), per-OS paths in tests
(f38f65030), neutral text in vendor-bound prompts (3c4f8f9ae), one owner
per flag bit (8179ce768), a flag is never data to write (76db4c6c2).
contributors.md: ggbdpq's Watched row gains #1919 and #2017.

Run: every shown sha read with git log; anchors #moved-to-the-code-standards
and the code-standards.md links resolve. Docs only, no code.
2026-10-14 04:16:31 +08:00
yetoneandggbdpq e297a8ab27 provider: a codex-autoreset.json that can't be read no longer lets a Codex account's auto-use spend a second reset the same week (#2017, ggbdpq)
What changed:
- autoResets.load read a codex-autoreset.json that didn't parse (a crash
  leaving it zeroed, as #1505's files were) as "none spent this week",
  so the next week-used-up look spent another reset, and the write after
  it took the unreadable bytes with it. Now a file that can't be read or
  parsed is unknown: the bytes are copied aside as .bad-<ts> (as
  noteResetUsed keeps codex-resets-used.json's), and what was spent is
  rebuilt from codex-resets-used.json, which records every reset used
  for a week used up. When that file can't be read either, no account
  spends one by itself for a week (the longest a lost spend could still
  count), kept past restarts under a "*" entry.
- autoResets.save writes through steady.WriteFile, as every write of
  magpie's own state does since #1505, and logs a failed write.

ggbdpq's patch kept the file aside and made the write durable, but still
read the unreadable file as none spent, so its own scenario (a crash,
then a restart) still spent a second reset. This takes their patch and
fixes the read at the cause.

Run:
- TestAutoResetUnreadableKeptAside (ggbdpq's) fails on main: "the
  unreadable file was written over with nothing kept aside".
- TestAutoResetUnreadableReadsResetsUsed and
  TestAutoResetNothingKnownSpendsNone fail on main and on ggbdpq's patch
  alone: "spent 1 resets, want 0" / "spent 1 resets with nothing known
  of the week". Cases: an auto-use an hour ago holds off; one 8 days
  ago, one by hand, or another account's doesn't.
- go test -tags nogui ./internal/provider under a temp HOME passes;
  -race -count=10 -run TestAutoReset passes; gofmt -l clean; go vet,
  GOOS=linux and GOOS=windows go vet -tags nogui ./internal/provider pass.
- Not tried: a real corrupted file from a user (none reported); a real
  Codex account (checked against the fake ChatGPT server only).

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-13 23:30:32 +08:00
yetone b26c083c84 cli: setting Claude Code's sonnet/opus/haiku/fable while it is on magpie says magpie is out, and help says the aliases take it out (#2000, marshalys)
`magpie claude sonnet` sets Claude Code's model to its own alias. That
isn't a model magpie serves, so magpie steps out (unroute) and puts back
the endpoint Claude Code had before magpie. In #2000 that endpoint was
DeepSeek's, which refused Sonnet with a 400. The command printed only
"✓ Claude Code model sonnet". An agent had run it as a read-only query of
the sonnet tier, and nothing in the output said the routing had changed.

set() now checks whether the agent was wired into magpie before the
write. When a non-empty value leaves it unwired, set() prints
"disconnected from magpie: <model> is <agent>'s own, sent to the endpoint
it had before magpie; magpie <agent> <model> with one of magpie's models
connects it again". This covers every agent and field set through
`magpie <agent> …`, not only Claude's aliases. Setting a field back to
default (empty) is left as it was. `magpie <agent> default` already says
it disconnects.

The behaviour itself is unchanged. On an Anthropic sign-in or a Claude
relay the aliases are a deliberate one-word way back to Claude Code's own
models.

`magpie claude help` now has a line under the aliases: "they are Claude
Code's own models, not magpie's: setting one takes magpie out; magpie
claude alone shows each".

Verified:
- TestClaudeAliasSaysItTookMagpieOut covers opus, sonnet, haiku and
  fable. It starts from a DeepSeek-style own endpoint (.invalid host),
  wires Claude Code to group/advanced and sets the alias. It checks the
  notice, that the old endpoint is back, that nothing is printed when the
  alias is set again while off magpie, and the help line.
- With the notice disabled by hand, the test fails:
  "magpie claude opus: <nil> "✓ Claude Code model opus\n", want it to say
  magpie is out" (and the same for the other three).
- TestAgentDefaultInAnyCase first went red on "codex model DEFAULT", so
  empty values are excluded.
- HOME=<sandbox> go test -tags nogui ./internal/cli: ok.
- gofmt -l clean. go vet and GOOS=linux/windows go vet -tags nogui
  ./internal/cli: clean.
2026-10-13 23:30:17 +08:00
yetone 269fc93e8e gui tests: settings-general reads the language button's place once the page's animations end
The test compares the language button's place before and after a language
pick. The context has no reducedMotion, so the Settings page's entrance
animation could still be running when `before` was read. Under load, the
reads came out like 175.07 or 175.98 against a resting 175: 20 such reads
in 18 runs, 6 at a time. One run went red on ja at 440px, with before at
200.5 and after at 199.19 while the view had scrolled 24. It was red alone
on origin/main a75de4c21 too, 1 run of 3.

Both reads now wait for document.getAnimations() to finish.

Run: 18 runs, 6 at a time, chromium: no read taken mid-animation, fail 0.
The whole file 2× in both engines: 20/20.
2026-10-13 22:06:17 +08:00
yetone befb563e3d gui tests: copilot-signed-out-account measures the account's row once it is no longer drawn again
What comes in after the Copilot editor opens draws its accounts again.
The test read the row's, the reason's and the buttons' boxes across that
redraw, and got null ("Cannot read properties of null (reading 'x')") or
a row no longer attached. It was red alone on a75de4c21 in 2 of 82
cases, in a different language each run. It now waits until the row
element survives 250ms, then reads each box after scrolling its button
in, waiting for the boxes to lay out.

Run: copilot-signed-out-account.test.cjs (Chromium and WebKit, every
language, 420 and 1100), 5 runs, 82/82 each. Before, 2 cases were red on
3 of 4 runs.
2026-10-13 21:12:44 +08:00
yetone 3f4cec2496 gui tests: group-member-info wheels a member's switch and Remove into view before it clicks them
The group editor opens with its first member under the window's foot,
which took the click on .rt-mon. Playwright's scroll before the click is
put back (#1554). This flaked on a75de4c21 in WebKit, alone and in the
full run. Each target is now wheeled into the Routing view first, which
replaces the fixed 400px wheel before Remove.

Run: group-member-info.test.cjs, 5 runs of 8/8 (Chromium and WebKit, en
and zh).
2026-10-13 20:39:39 +08:00
yetone 2f68ede77e gui tests: session-terminal wheels the row into view instead of opening a taller window
Settings rows were added above Session terminal again, so even in a
1000px window the row sat under the window's foot. Playwright's scroll
before each click is put back (#1554), and the click waited on the foot
until it timed out: red on a75de4c21 in 4 of 8 cases. The test is back to
a 700px window and wheels the row into view as a reader would, after
each load. The Theme click that saves another setting is made on the
button itself, since it is scrolled away above.

Run: session-terminal.test.cjs, 3 runs of 8/8 (Chromium and WebKit, en
and zh).
2026-10-13 20:39:39 +08:00
yetone bb70284082 gui tests: plugin-list-error looks for the "vendor list · <when>" hint, not every "供应商列表"
1d74826b9 (#1831) added the models' Serve pick, whose "Vendor's list"
option is "供应商列表" in Chinese. The check that a plugin's fallback
models aren't called the vendor's list matched it, so the test was red
in zh in both engines on a75de4c21. It now matches the hint it guards,
"vendor list ·" / "供应商列表 ·".

Run: plugin-list-error.test.cjs, 6/6 (Chromium and WebKit). Showing the
hint despite a list error, by hand, turns en and zh red.
2026-10-13 20:39:39 +08:00
yetone ba07128884 gui tests: nav-sub-unroll and plugin-check-github-limit find Installed by name, after P0's Built-in tab
3ccbe6bc1 (P0) added Plugins › Built-in, so Plugins now has three
sidebar rows. That broke two tests, red on a75de4c21 in both engines:
- nav-sub-unroll expected two rows (22/22 red).
- plugin-check-github-limit took the second tab as Installed in German,
  and so clicked Discover.
Both now find Installed by its name ("Installiert" in German). The
nav-sub check that the selection doesn't reach into the row above holds
for whatever row that is.

Run: nav-sub-unroll 22/22, plugin-check-github-limit 18/18 (Chromium and
WebKit).
2026-10-13 20:39:39 +08:00
yetone 8dcb90873d gui tests: menu-scroll waits for the menu's opening to finish before it clicks its scrollbar
A click on the scrollbar's track while the menu was still opening landed
nowhere now and then, in both engines. It was red in 5 of 8 runs on
a75de4c21. scrollMenu now waits for the page's animations to finish
first.

Run: menu-scroll.test.cjs, 10/10 runs.
2026-10-13 20:39:39 +08:00
yetone f7a3693f78 gui tests: library-mcp-tool-switch has every switch below the stuck head before it clicks
Clicking the pill sometimes scrolled the page in WebKit (to 242, 422 or
440), which left read_text_file under the stuck .lib-head, and the click
landed on the head. It was red in 5 of the 10 WebKit cases in a full
run of the suite. The library code it clicks is unchanged since
a75de4c21. After its first wheel, the test now wheels until
all three switches sit between the head and the view's foot, and asserts
that they do.

Run: library-mcp-tool-switch.test.cjs, WebKit 10/10 three times and
Chromium 10/10.
2026-10-13 20:39:39 +08:00
yetone bf6393f9bd gui tests: allow-ips wheels Remove into view before it clicks it
In Chinese the 10.0.0.0/8 row's Remove sat at 521–544, with the view's
foot at 532. Playwright's scroll before the click is put back (a scroll
that isn't the reader's, #1554), so the window's foot (#status) took the
click. This was red every run on a75de4c21 in WebKit zh. The test now
wheels the button into view as a reader would.

Run: allow-ips.test.cjs, 7/7 in WebKit and 7/7 in Chromium.
2026-10-13 20:39:39 +08:00
yetone 4325e9970d gui tests: gateway-port lets each wheel step come to rest before it looks again
On a busy machine, wheel events still queued scrolled on past the port
row, so the field was above the view when it was typed in ("typing moved
the page 269 !== 343"). This reproduced reliably at 8 runs at once on
a75de4c21. The loop now wheels 40px at a time, waits for the scroll to
rest, and stops once the field and Apply are both inside the view. It
then asserts that they are.

Run: gateway-port.test.cjs, 24/24 at 8 at once in Chromium and 3/3 in
WebKit.
2026-10-13 20:39:39 +08:00