Commit Graph
7187 Commits
Author SHA1 Message Date
yetone 1ccacad632 agent: Obsidian is listed only when a vault has Copilot (iEthan333 on X)
detect was "obsidian's config folder exists", so every Obsidian user got a
row whose provider field could only fail ("no Obsidian vault here has
Copilot"). It now needs a vault in obsidian.json with Copilot installed
(.obsidian/plugins/copilot/manifest.json) or magpie's provider already in
its data.json, so a wired vault can still be disconnected. Every OS's config
folder (mac, Windows, Linux, Flatpak, Snap) is already read by obsidianDirs.

Siblings checked: Zoo Code and Copilot (JetBrains) already require the
plugin installed; VS Code forks and Raycast are the apps that hold the
setting themselves. None changed.

Run: go test ./internal/agent -run Obsidian (wsl-run); the new no-Copilot
vault assertion is red on the old detect (checked by hand). Full agent
package, gofmt, linux and windows vet: see push notes. Not tried: a real
Obsidian install.
2026-11-11 14:34:37 +08:00
yetone e1a2226405 library: EverMe Memory and Nowledge Mem are offered in the market as memory sources, added in one step (OipsAnthony on X)
Both publish an MCP server: EverMe's @everme/memory-mcp (stdio, agent id and evt_ token, managed backend preset) and Nowledge Mem's Streamable HTTP endpoint at 127.0.0.1:14242/mcp (optional Bearer key for a Mem reached over Access Anywhere). Added beside Magpie Memory; their memories stay in their service, and magpie's digest and Memory tab don't read them (docs/subsystems/memory.md).

Run (wsl-run, magpie-wt/memprov at origin/main 032340056): go test -count=1 ./internal/library ok, GOOS=windows go vet ./internal/library, go vet -tags nogui ./internal/library, gofmt -l clean. TestThirdPartyMemoryServers is red without the two entries (the market has no such server). Not tried: a real EverMe token or a running Nowledge Mem; GUI market tests (the page lists servers from the API, no GUI file changed); mote was out of disk, so nothing ran there; full suite not run.
2026-11-11 14:34:30 +08:00
yetone d62220d43e gui: a proxy's web page regexps compile when first used (TestNoEagerPackageRegexps)
059d995d5 added webPageStart and webPageTitle as package-level
regexp.MustCompile, which TestNoEagerPackageRegexps refuses: every
package regexp goes through lazyre so start-up doesn't compile them.
CI at 61a04f42a was red on ubuntu and macOS for it.

Run (Windows box, win-run; mote is out of disk and refuses ssh):
- go test -run TestNoEagerPackageRegexps . : ok (red on CI before)
- go test -run 'TestFailSaysAProxyPage|WebPage' -v ./internal/gui:
  TestFailSaysAProxyPageByItsTitle, TestWebPageHandlerEveryWhere pass
- go vet ./internal/gui, gofmt -l: clean
2026-11-11 14:33:37 +08:00
yetone f5e1b10913 settings: longest context can hold a model's own window too (WJaunita45604 on X)
v0.1.3681's Longest context left a window the user set for a model, or "*"
on its provider, alone even when longer. Settings > Models > Routing now has
a menu beside the field: "Models without their own" (the default, as before)
or "Every model". In both modes the shorter of the cap and the user's own
window is told; they differ only when the user's own is longer (own keeps it,
every model brings it down). Settings.ContextCapAll, Settings.CappedOwn,
POST /api/settings/context-cap-mode {all}, magpie model context-cap all|own.
Applied in provider.windowIn (so /v1/models, catalogs, compaction), Codex's
CodexNativeWindow/CodexWindow (the list's ETag tag carries the mode) and the
gateway fallback window. i18n in zh, zh-TW, ja, de.

Run (wsl-run, mote's disk was full): provider (full), settings, settingsapi,
codexcat packages; cli -run ContextCap; gateway -run ContextCap|ModelsList;
GUI context-cap, i18n-keys, model-load, settings-places, settings-general in
chromium and webkit; TestCoreScriptBudget; gofmt; go vet nogui and
GOOS=windows vet. Broken by hand: windowIn's CappedOwn removed turns
TestContextCapAllHoldsTheUsersOwnWindowsToo red.
Not tried: the whole Go and GUI suites, a real Codex reading the list, macOS
or Windows runs, GUI in zh-TW/ja/de beyond the i18n-keys check.
2026-11-11 14:28:17 +08:00
yetone 032340056e gateway: a context kept after its handler returns no longer reaches the request's body (#5250)
TestSocketTurnBodiesFreed went red on ubuntu CI at a3d2a85dd ("turn
bodies [8] of 12 still kept"), after a268aadc4 had let the unrouted
watch's own timers go. Two more paths kept a turn's request, and with
it the whole conversation it was sent with:

- A context timer. Any WithTimeout under the request's context, stopped
  as its call ended, is kept with its context in the timer heap of the
  P that set it until that P tidies its heap, and an idle P never does.
  Through the context's values it reached the watch twice: the
  unroutedKey value held the watch itself, and inflightOf's value held
  the inflight, whose f.unrouted is the watch. The watch holds the
  request (u.r), and the request's Body and GetBody the bytes.
  The unroutedKey value is now the watch's held pointer, as its timers
  already were (unroutedOf), let go as the handler returns; done clears
  f.unrouted too. Its readers (noteRoute, showRedacting, notDescribed)
  run inside the handler, before done.
- An asynchronous release. holdBody and the body room let go of a body
  in a context.AfterFunc, which runs in a goroutine of its own once the
  turn's context ends, so under load the test's one collection could
  come first. The test now collects until every body is gone, within
  10s: far under unroutedShow (15s) and unroutedMost (2m), the times a
  real holder kept one for.

Run (the Linux box, wsl-run, since mote is out of disk):
- origin/main 4ddc150c6, TestSocketTurnBodiesFreed -race -cpu 1,2:
  1 red in 80. With a probe, the red was a body still held after 10s,
  and in 9 of 300 runs bodies were freed only 30-120ms after the first
  collection (the async release).
- With the context-value half only: 3 red in 200, each held over 10s.
  With holdBody's sharing turned off: still 1 red in 200, so it isn't
  a decoded string sharing the body. A goroutine dump at the red had 7
  goroutines, none of the gateway's: a heap reference, not a runner.
- With both halves and the new test: 300 of 300 green (-race,
  -count=150, -cpu 1,2).
- TestUnroutedContextLetsGoOfRequest, new, holds the request's context
  past its handler: red 5 of 5 on the old code, red 5 of 5 with only
  the context-value half, red 3 of 3 with only the f.unrouted half,
  green with both. TestUnroutedTimersLetGoOfRequest still passes.
- go vet ./internal/gateway on Linux: ok. gofmt -l: clean.
- The whole internal/gateway package runs next on the Linux box; its
  result goes on #5250.

Not tried: macOS and Windows runs (mote is out of disk and refuses
ssh); other context values that might hold a request are not audited.
2026-11-11 14:24:25 +08:00
yetone a46c90e7c3 providers: a key's usage cap is set from its row, as an account's is (@wanggenjidev on X)
GUI half of the previous commit; same pill and words as the account cap. key-usage-cap.test.cjs passes in chromium and webkit, en zh zh-TW ja de, 900 and 400px.
2026-11-11 14:18:11 +08:00
yetone 4a7d222dc8 providers: an OpenCode Go key takes the usage cap an account does (@wanggenjidev on X)
Backend only; GUI follows. Tests: provider TestKeyTakesUsageCap, gateway TestKeyUsageCapPassesTheKeyOver (red with the hold removed by hand).
2026-11-11 14:18:10 +08:00
yetone 08a852a369 provider: a model off for an agent stays off while the vendor's list lacks it; zcode min 0.1.59 (WJaunita45604 on X)
ZCode's GLM-5.3-Flash-Trial is listed only from about 23:00. SetHiddenModels
rebuilt the agent's off list from the models listed right now, so an off
choice for an absent model was dropped on the next Save, and the model came
back on at 23:00. It now keeps hidden ids that ListedFor no longer lists.
(Provider picks and per-agent PickedModels already survive a relist; a
3-day flip test with an editor Save in between guards that.)

The display half is in the plugin, zcode 0.1.59 (npm checked): a reply the
gift answered names the -Trial entry, so Usage, sessions and the request log
show the model served. The mover min is raised to 0.1.59.

Run: go test ./internal/provider (wsl, ok); gateway zcode/trial tests ok;
gofmt clean; go vet linux, windows, darwin ok. Plugin: bun test in
packages/zcode 243 pass.
Broken by hand: SetHiddenModels reverted -> TestHiddenModelAbsentStaysHidden
red ("an unlisted model's off choice lost"); plugin trialNamed removed -> the
2 new gift tests red.
Not tried: a real Start Plan reply or live account; mote was out of disk, so
tests ran on wsl. GUI not touched.
2026-11-11 14:13:01 +08:00
yetone d936be7639 usage: Claude's card shows the extra-usage cap and its spend (Shinji_Zl on X)
Claude Code's `claude -p /usage` text omits extra usage, but with
`--output-format json --verbose` a message carries
usage_report.rate_limits.extra_usage (cap and spend in cents). The gateway
adds it as a line; parseClaudeUsage reads it as an Aside "Usage credits"
window (n / cap USD), so a spent cap never marks the account used up.
magpie asks Anthropic nothing itself, and cannot make a request spend
credits: Anthropic decides. The prepaid balance is a separate endpoint and
is not shown.

Run (wsl-run, linux): TestClaudeUsage*/TestClaudeOverage in provider and
gateway, go vet linux/windows/darwin, i18n-keys, i18n-en-no-cjk and
claude-overages GUI files (chromium + webkit).
Broken by hand: Aside false -> TestClaudeUsageCredits red.
Not tried: a real account with extra usage on (the owner's is off); full
suite after the tag; Windows run.
2026-11-11 14:08:18 +08:00
yetone 0052c860e0 library: billion-context installed with bun is found on Windows (Zerenjie on X)
biliPath looked for bili.cmd on PATH and in %APPDATA%\npm only. bun add -g
puts bili.exe (with a bili.bunx) in the bin of BUN_INSTALL or ~\.bun\bin,
so a bun install was never found. It now asks proc.FindTool, which tries
.exe and .cmd in every folder a user's tools are installed in. proc's
UserBinDirs also takes BUN_INSTALL's bin (Windows and elsewhere), and
Kiro Crew's adapter search gets ~/.bun/bin, BUN_INSTALL's bin and, on
Windows, %APPDATA%\npm, its siblings that had the same hole.

Run: on xiaomi-gpu (Windows 11) really `bun add -g billion-context` into a
sandbox BUN_INSTALL with PATH holding no bun bin. Before the fix biliPath
was "" ; after, it was bili.exe and `bili --version` answered 0.1.213. go
vet and go test -run Bili|KiroCrew|ToolIn|UserPath for library, agent and
proc passed on Windows and in WSL (magpie-desktop). The three new tests
fail on the old code in WSL (broken by hand with the sources stashed).
Not run: the full suite, a darwin vet and a mote run (mote's disk was
full, 226Mi free), the GUI suites (no GUI file touched).
2026-11-11 14:04:37 +08:00
yetone 465e9f721f gui: library-bili waits for the sidebar's sections before it picks a tab by place
The sidebar list is drawn once in the strip's order and again in sections
once navicons.js is loaded; Pi packages then sits before RTK, so a click by
an index read before the redraw landed on another tab.

Run: library-bili and library-groups on Windows (xiaomi-gpu), Chromium and
WebKit: 100 of 100. Red before this wait in WebKit on mote, 2 of 4 cases.
2026-11-11 13:53:34 +08:00
yetone 29d37b4a6c gui: Library's sidebar list is in sections: every agent, one agent, magpie (@ConatusMoon2222 on X)
The list under Library in the sidebar was one flat column mixing what every
agent shares, what one agent has and magpie's own add-ons. It now has three
quiet section names, as a Mac source list's: "Every agent" (Instructions,
Memory, MCP servers, Skills, Hooks, Subagents), "One agent" (Claude plugins,
Pi packages) and "magpie" (RTK, billion-context). Same pages, same strip,
same routes; the page's own strip is unchanged. A section with no tab showing
has no name, and a list of one section (agentless) has none at all. The names
are said in zh, zh-TW, ja and de ("One agent" is new; "Every agent" was
already there); no colour, no gradient, no border.

The grouping and the sort live in navicons.js (loaded with the first list,
which then draws again), so the core script budget holds; a few navSubs
comments were cut for the bytes.

Run:
- library-groups.test.cjs (new): the three names and the rows' order in en
  zh zh-TW ja de, no names in the strip, a name is no tab, quiet style, a tab
  still opens, hidden-only section loses its name, one section none, 420px and
  dark: Chromium and WebKit, 16 of 16 on mote before the rebase, 100 of 100
  with library-bili on Windows (xiaomi-gpu) after it, and with sidebar.test.cjs
  on WSL.
- Broken by hand: names always shown made the hidden-section case red in both
  engines.
- go test -run Budget ./internal/gui: ok before the rebase.
- Screenshots zh light/dark at 900 and 420, before and after, in
  magpie-wt/library-groups-scratch/shots.
- Wider sidebar and library set on mote: 302 of 304; the 2 reds were
  library-bili in WebKit, a click by an index read before the redraw
  (fixed in the next commit). mote could not launch browsers afterwards.

Not tried: the whole GUI suite (mote refused connections and then browser
launches for hours; run after the tag), the real Linux WebKitGTK app.
2026-11-11 13:53:34 +08:00
yetone ce0cbff616 netproxy: an IPv6-only host is not stuck on IPv4 after one IPv6 failure (ZeHeaton23141 on X)
A remote magpie on an IPv6-only address worked, then stopped until magpie
restarted. v4Fallback marks a host:port whose IPv6 connection ended before a
byte came back and dials it over tcp4 for 30 minutes; for a host with no IPv4
that dial can only fail, so every request failed for the whole window. Now a
failed tcp4 dial clears the mark and goes on over tcp at once, and an IPv6
literal address is never marked.

Run (wsl-run, magpie-desktop; mote's disk was full): go test ./internal/netproxy,
go vet for linux, windows and darwin, gofmt. TestIPv6OnlyHostRecovers (an A
record that fails, an AAAA that serves on [::1], a prior mark) fails on the old
code and with clearV4 commented out (mark kept). Not tried: a real IPv6-only
remote magpie, the full suite, GUI tests (no GUI change). No per-remote
"IPv6 only" setting: the cause is fixed instead.
2026-11-11 13:50:15 +08:00
yetone 61a04f42a2 library: a project's Skills menu groups the skills by source, a heading ticks the whole group (Elorynth on X)
The project card's Skills menu listed every library skill flat. It now
lists them as the Library does (skillGroups(true): by repository or the
user's own group, this computer's last, whatever sort the list has), with
a heading over each group. Pressing a heading ticks all of the group's
skills, or unticks them when all are in; it is half-ticked while some are.
A typed filter keeps a group's heading over the skills it finds, and
matches a skill by its group's name. One group only stays the flat list.
openProtoMenu takes a `group` option (the values it ticks) for this.
Paid for in app.js by five comments cut, no budget raise.

Run on the Windows box (mote's Chromium launch hung, SSH refused at
times): project-skills-groups.test.cjs, new, in chromium and webkit,
en/zh/zh-TW/ja/de at 400px wide: red on the old code (6 of 6), green
after. With project-*, i18n-*, menu-*, proto-menu-overflow and
skill-group* GUI files in both engines: all green except
menu-input-scroll and menu-scroll (14 chromium, 13 webkit), which are
red the same at origin/main aa2ea5c90 on the Windows box (commented on
#3402). TestCoreScriptBudget ok at the rebased head.
Not tried: the full suite, the real Linux app (WebKitGTK). Part 2 of the
report (instruction presets bundled into a toolkit) is not built: a
project has no instructions of its own yet.
2026-11-11 13:31:23 +08:00
yetone aa2ea5c906 agent: Claude's main model is written as a tier alias, so Claude Desktop on a subscription no longer sends magpie's prefixed id (iryan_sun on X)
Claude Desktop's Code tab sets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST=1. Claude
Code then ignores the env block of settings.json (base URL, token, tier model
vars) but still honours the top-level `model`. magpie wrote `model` as the
provider-prefixed id (anth/claude-opus-4-7), so the official API rejected it
and WebFetch failed.

writeTiers now writes `model` as the tier alias (opus/sonnet/haiku/fable, with
[1m]) whose ANTHROPIC_DEFAULT_<TIER>_MODEL already maps to the main model, on
this machine's ~/.claude only. A distro file, the claude-magpie launch file and
a main with no tier keep the id. The model field reads the alias back through
the tier env, also while the gateway is unreachable (drift). Unwire drops
`model` when magpie wrote the alias.

What happens to old values: a settings.json an older magpie wrote with the
prefixed id (model "up/big-x") is rewritten to the alias at the next catalog
sync, for every user, with no step on their side; the tier env already maps it
to the same model. A prefixed id picked from the modelPicker rows is brought to
the alias the same way. A model the user set themselves (claude-haiku-9,
own/xyz, opusplan) is never rewritten.

Ran:
- Real Claude Code CLI (~/.local/bin/claude) in a sandbox HOME and
  CLAUDE_CONFIG_DIR, wired by a magpie built from this tree (gateway :38760)
  to a scripted upstream that logs each request's model: main -> big-x,
  `--model haiku` -> fast-x, a subagent (Agent tool) -> sub-x, WebFetch's
  extraction of https://example.com -> fast-x (haiku's). Old prefixed file
  migrated to "sonnet" by a catalog sync; the three user models above stayed.
- TestClaudeMainModelIsAnAlias: red on the old code, red again with mainWord
  broken by hand, green with the fix; it also covers the user's own models.
- 11 existing tests read the raw `model` as an id; they read it through
  writtenModel now. TestWSLClaudePick compares the distro's file with the
  native one after normalising `model` (the distro keeps the id by design).
- go test ./internal/agent ok at the pushed head; gofmt; go vet darwin, linux
  nogui, windows for internal/agent.
- internal/cli: TestGatewayKeyLimitCLI is red on origin/main b39a793c9 too,
  untouched here: #6082.
Not tried: the real Claude Desktop UI (only Claude Code with the
host-managed flag, 2.1.312/.314/.316); a user whose Claude runs in a WSL
distro is not covered; the full suite is run after the tag.
2026-11-11 13:28:02 +08:00
yetone b39a793c98 codex: the Codex app, left showing fewer projects after a switch while it ran, says to quit and reopen it (linsm66 on X)
"为什么codex在触发自动更换账号后侧边栏已有的项目文件夹会消失呢".

v0.1.3600 (10bef5fe0) shares every account's projects while the Codex app
is closed. A switch while the app runs can't be helped by a file: the
app (ChatGPT.app 26.1103, early-bootstrap-133 selectRendererOwner, run on
every principal change) parks the old identity's projects and loads the
new one's from memory, and writes its memory over the file. An app open
since before the sharing, or a project added since it was last closed,
shows the new account's empty list. magpie does not quit the app unasked
(15acba534, 248268ce4); the owner chose a hint instead.

codexProjectsLook, from codexProjectsStep's loop while the app is open,
reads the state file: the owner's local projects' folders against those
parked under the other identities. When the owner changed since the last
look and the owner lacks a folder, /api/providers says codexProjects, and
Codex's accounts show "The Codex app shows fewer projects than you have:
quit and open it again" (Got it hushes it; dismiss-projects). A project
removed on the account the user is on is no switch and says nothing. A
closed app clears it: the share runs and the app loads every list as it
opens. The notice is in codexprojects.js, loaded when the state says so,
so the core's budget is unchanged. i18n in zh, zh-TW, ja, de.

Run (mote refused ssh all session; so wsl-run on the Linux box):
- go test -tags nogui -run 'TestCodexApp|TestCodexProjects' ./internal/provider: ok.
  TestCodexAppProjectsShortAfterALiveSwitch drives the repo's app
  simulator through a live switch to an unshared account and, after
  shareCodexProjects, to a shared one. Broken by hand (every look counts as
  a switch) TestCodexAppProjectsRemovedByHandIsNoHint went red.
- node --test codex-app-projects-short.test.cjs (new), codex-app-stale,
  i18n-keys, i18n-en-no-cjk: all pass, chromium and webkit, 5 languages,
  900 and 480px (70 tests for the first two).
- TestCoreScriptBudget ok; gofmt clean; go vet -tags nogui and GOOS=windows
  of internal/provider and internal/gui ok.
- old-webkit.test.cjs: "compat.js is the first of the page's own scripts"
  and "the styles hold up in Safari 15.0" are red on origin/main
  4ddc150c6 too, same names. GOOS=darwin vet of internal/gui fails at
  traywindows_darwin_test.go:30 (trayImagePNG) on origin/main too, from
  WSL without cgo.

Not tried: the real Codex app switching live (the simulator follows the
bundle's selectRendererOwner, not a launched app); the whole GUI suite
before the push (started after the tag); mote.
2026-11-11 13:26:49 +08:00
yetone 4ddc150c66 gui: a hover hint beside the account switch says how it works and why it is the agent's own use
The owner (11-11): "在这个切换开关旁边有一个 hover 的提示,提示这个原理是啥,
以及它为什么不会让你的账号被封禁". Beside Switch {agent}'s account
automatically, an ⓘ mark; resting on the row (or a key reaching the
switch) shows settingshints.js's card with three lines:

- how: the next account's sign-in is written where the agent keeps its
  own, as /login or codex login does; what is left is read by Claude
  Code's own /usage, or where Codex's /status reads it; sessions already
  open keep their account until restarted;
- why it is the agent's own use: Claude Code still sends every request
  itself, straight to Anthropic, unchanged, and magpie sends none (an
  account's own proxy kept); for Codex, only which of your own accounts
  it is signed in to changes;
- the limit: the same as switching by hand; use only your own accounts,
  sharing one is against the vendor's terms. It promises nothing about
  bans: that is the vendor's call.

Only where the switch moves the sign-in. Under the gateway it moves
Claude Code's requests instead, and the "straight to Anthropic" line
would be false, so SignInMovesOf now says `routed` on a kept Claude
whose requests go through the gateway, and the hint shows for `moves`
and for `kept` without it.

The lines and mark are in autoswitchtip.js, imported when the switch is
drawn; app.js gets the one import line, paid for by cutting this branch's
own two comments: the core is 1,533,771, under 1,533,802, no raise.
Strings in zh, zh-TW, ja and de.

Run (xiaomi-gpu, Windows 11, win-run; mote refuses ssh):
- node --test sign-in-moves, keep-login, pool-ends, old-webkit, i18n-keys,
  i18n-en-no-cjk, settings-hints, editor-hints: 148/152. The 4 reds are
  the same at the base 156861b3a: old-webkit's headerpresets.js (#6030)
  and Safari 15.0 :has() (#5919), and settings-hints webkit de at 420px,
  filed as #6073.
- the new test (Chromium and WebKit, en and zh): the mark sits beside
  the switch on its line, the lines rest out of sight, hovering shows the
  card with the three lines beside the row, a press on the mark posts
  nothing; no mark for kept+routed or gateway.
- Broken by hand, each red: the mark's preventDefault removed (a press
  turned the switch off); the routed check dropped (kept+routed showed
  it); Routed not set in SignInMovesOf (TestSignInMovesSaysWhatSwitchDoes).
- go test -run "SignInMoves|ClaudeRoutedSignIn|KeepLogin|SwitchOnly"
  ./internal/provider ok; go vet ./internal/provider ok;
  TestCoreScriptBudget ok; gofmt -l clean.
- A Chromium screenshot of the card in zh looked at.

Not tried: the Codex variant's card in a browser (its strings pass
i18n-keys); the real app; macOS and Linux.
2026-11-11 13:05:16 +08:00
yetone e31625f641 gui: one helper builds a lib-switch button, one a button that opens a menu
origin/main's core scripts were 1,533,806 bytes, 4 over their budget
(TestCoreScriptBudget red), and the accounts list's automatic-switching
switch (the previous two commits) added 2,248 more. Ten places built the
same lib-switch button by hand (type, role, aria-checked, aria-label,
the knob); libSwitch(cls, on, label) builds it. Five set aria-haspopup
and aria-expanded=false in a row; menuOf(b) does. The switch's own
comments are cut to a line each, and the routing note's gateway sentence
comes from signInMovesLine instead of a second copy. The core is
1,533,756 after, under its budget with no raise; the budget's history
says so.

What each switch does is unchanged: same classes, role, aria-checked and
label. Two differences: providerSwitch's button now has type="button"
like the rest, and Only models I pick's aria-checked is "false" rather
than "undefined" when the setting is unset.

Run (Windows box, win-run): node --check app.js; TestCoreScriptBudget
ok. The whole GUI suite: see the push record.
2026-11-11 13:05:16 +08:00
yetone fc24a89183 gui: switching the agent's account is a switch of its own
The owner (11-11): "这个轮换做成一个开关". The used-up switch was off
behind a "Keep Claude Code signed in to" tick box, and the tick box read
as something else. Under the accounts of a Claude Code or Codex with
more than one account there is now a "Switch Claude Code's account
automatically" switch:

- on: the line from the previous commit sits under it, saying when the
  sign-in moves and whether it comes back;
- off: "Keep Claude Code signed in to [account]", the picker that was
  the tick box's (first account, or the one picked);
- switch-only: held on and disabled, with a title saying why, since
  switch-only always moves the sign-in.

The switch posts provider/keeplogin as the tick box did (keepLogin is
the switch off), so nothing on the server changes and a user's saved
keepLogin reads as the switch off. The name is a label for the switch:
clicking it flips it too. `.editor label`'s text-align: right is undone
for it, so its words start at the left. The two "Automatic switching is
off" strings give way to the switch's name and title in zh, zh-TW, ja
and de. docs/subsystems/providers-accounts.md says it under "Used-up
switch".

Run (Windows box, win-run; mote refused ssh and WSL's GUI runs failed
with E_UNEXPECTED):
- sign-in-moves, keep-login, pool-ends, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit, en and zh:
  100 pass
- after the alignment fix: sign-in-moves, keep-login, pool-ends: 72 pass
- TestCoreScriptBudget (wsl-run): PASS
- screenshots, chromium en and zh, on and off: name at the left, switch
  at the right, line or picker under it
- after rebasing on origin/main: see the push

Broken by hand:
- posting !on from the switch: sign-in-moves red 4 of 16;
- dropping the text-align fix: the "words start at the left" check red
  (160 to 224px in), where the old box check had passed.

Not run: the whole GUI suite with the switch (mote and WSL down). At the
previous commit it was cut short on mote with load timeouts; the account
reds there (account-arrange, agent-switch-accounts, claude-switch-only's
"page doesn't move") also fail on origin/main d1b4eff5a and are #6010,
#5925 and #4344. Not tried in the real app with the owner's accounts;
their keepLogin (the switch off) is left as it is.
2026-11-11 13:05:16 +08:00
yetone 8a3dbf0232 gui: the accounts list says what magpie does with the agent's sign-in
A user with two Claude accounts read the used-up switch as gone. Their
"Keep Claude Code signed in to" box was ticked, which turns the switch
off, and nothing on the page said so. Under the accounts of a Claude Code
or Codex with more than one account, a line now says what the switch
does, as NextLogin decides it:

- kept: switching is off, the agent stays on the first account (or the
  one picked) even once it runs out;
- gateway: Claude Code's requests go through magpie, which picks an
  account per request; its own sign-in stays put;
- moves: the share it moves at (98%, or used up for In order / Until
  used up), and whether it comes back to the first (returnsToFirst).

provider.SignInMovesOf gives the mode from the same checks NextLogin
makes (leftAlone, keep, ClaudeThroughMagpie && !SwitchOnly, SpentShareOf,
returnsToFirst). /api/providers carries it as signInMoves on the agent's
own provider row. The Routing tab's sign-in note says the gateway case
too. Strings in zh, zh-TW, ja and de.

Run (mote, through mote-run):
- go test -run 'TestSignInMoves|TestClaudeRouted|TestKeepLogin|
  TestClaudeSwitched|TestNextLogin|TestCodexLogin' ./internal/provider: ok
- go test -timeout 45m ./internal/gui ./internal/provider: ok (script
  size budgets included)
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  provider and gui: ok
- GUI: sign-in-moves, keep-login, i18n-keys, i18n-en-no-cjk,
  routing-signin, account-return in chromium and webkit: 60 pass
- whole GUI suite (make test-ui): see below
- screenshots in WebKit, en and zh: the line sits inside the list at the
  rows' inset; zh sentences join with no space

Broken by hand: dropping NextLogin's keep case from SignInMovesOf turns
TestSignInMovesSaysWhatSwitchDoes red; not appending the line turns
sign-in-moves.test.cjs red 4 of 4.

Not tried: the real app with the owner's accounts; the user's own
keepLogin is left as it is.
2026-11-11 13:05:16 +08:00
yetone 1315ac7d99 update: the first update finds a magpie without gateway.json, and a restart waits a bounded time (ljlwlcz on X)
Two edges of v0.1.3687's gateway.json:

1. The first update from a magpie older than the record found no gateway.json,
   asked 3425, said "isn't running" and left a service on MAGPIE_ADDR=0.0.0.0:10100
   on the old version. With no record, no MAGPIE_ADDR and no answer at the usual
   address, `magpie update` now tries the installed service's MAGPIE_ADDR (read
   from its unit or launch agent, daemon.Addr), the port in Settings and 3425,
   and takes the first that answers as magpie. --addr and MAGPIE_ADDR stay the
   user's word.
2. A restart asked by `magpie update` waited on "N requests" with no end (Windows
   hands nothing over, long streams never finish). The app and magpie serve now
   wait at most 10 minutes for that ask, then restart; the output says so
   ("or in 10 min at the latest, which cuts what is still running"). `magpie
   update --force` restarts at once (gateway.SetForceRestarter), and says if the
   running magpie is too old to know --force. The app's own look at the disk
   (followReplaced) and autonomous serve follow still never cut a request.

Run (mote refused SSH; win-run on xiaomi-gpu): go vet cli/gui/gateway/daemon
(windows), linux nogui vet; go test -run TestUpdate|TestServeFollow|
TestTerminalUpdate|TestRestart over cli, gui, gateway, daemon: ok except
TestUpdateThatWontStart, red on origin/main on the same box too (#6059).
Broken by hand: drain bound off, record fallback off, serve bound off: the new
tests TestTerminalUpdateWaitIsBoundedAndCanBeForced, TestUpdateFindsAMagpieThatWroteNoRecord,
TestServeFollowDrainIsBounded go red.
Not tried: a real systemd service upgrade; darwin cross vet (cgo) and the full
suite (started after the tag if mote is back).
2026-11-11 13:01:11 +08:00
yetone 059d995d56 gateway keys: the list reads the ledger once for all keys, and a proxy's web page is said by its title (aiandcloud on X)
aiandcloud (2.98B tokens, 12,654 requests a day, server mode behind a
proxy) saw Gateway keys draw a Cloudflare 524 page as raw HTML.

Slow list: every poll of /api/caller-keys read up to a month of ledger
rows once per window per key. budget.AllOf now reads each distinct window
once for all keys, and keeps the settled blocks' sums with a cursor
(usage.VisitFrom), so a poll only reads what was appended since; the
unfinished tail block is always read again. A rewritten or shorter log
resets the cursor. All(k) is AllOf of one key.
Numbers (BenchmarkAll vs BenchmarkReadEach, 8 keys x day/week/month,
31 days x 12000 rows/day = 372k rows, warm): 211-228 ms before, 23.5 ms
after.

Raw HTML: fail() now turns an error string holding a web page (a remote
magpie's or a vendor's 524/502 page inside the JSON error) into a short
said/what pair, "A proxy in front of magpie answered, not magpie ({what})"
with the page's title, translated in all 5 languages (key already in
i18n.js). The browser already handled non-JSON bodies (notJSON, #2032).

Run (Windows box, mote ssh was down earlier): go test budget, usage, gui
(AllOf, Budget, FailSays, I18n, Keys); gateway-keys-proxy-page and
gateway-key-limit GUI files in chromium and webkit, 5 languages: 24/24;
gofmt; vet windows, linux nogui, darwin (mote, only a clang deprecation
warning). Broken by hand: with the old fail() TestFailSaysAProxyPageByItsTitle
is red; with VisitFrom's reset() removed TestAllOfIsWhatEachWindowRead is red.
Not tried: a user-scale cold ledger, a server behind a real Cloudflare,
the full suite before the tag (started after).
2026-11-11 13:00:54 +08:00
yetone 1ae2241538 gateway keys: the model picker offers image and video models (aipha2025 on X)
/api/caller-keys/models listed provider.Catalog() only, which leaves out
image and video models (Codex's gpt-image, a catalog's drawers, ...). The
gateway already holds a key to them on /v1/images and /v1/videos
(keyHolds + modelAllowed in draw.go, video.go), so a key held to some models
could not be let draw. Each provider's Drawers and Videomakers now follow its
chat models in the picker.

Run: TestCallerKeyModelsOfferImageAndVideoModels red on old code (pix/gpt-image-2
offered 0 times), green now; gofmt; vet darwin/windows/linux-nogui on mote.
Not tried: GUI suites (no JS change); full ./internal/gui run timed out at
600s on loaded mote.
2026-11-11 12:58:36 +08:00
yetone dd3c9042c5 tests: the saved proxies' routes and settings are named in the guards
58fb07095 (named proxies) added POST /api/proxies/save, /delete and /test
and settings.Proxies and ProxyNames with no line in either guard, so
TestEveryRouteHasACommandOrIsNamed and
TestSettingsSaveKeepsWhatItDoesNotSend went red again a minute after
c1a072636 mended them for context-cap.

The three routes are a setting saved by its own route (stage 2), beside
POST /api/proxy/check. The settings-keep test sets a saved proxy and its
name, and a Settings save keeps both (KeepOwn already carries them; no
code change).

Run on mote at origin/main 61a93b531 plus this: both guards red at
61a93b531, naming these five; ok with this, with TestCoreScriptBudget and
the gui, cli and settings packages' Proxy tests.
2026-11-11 12:28:15 +08:00
yetone 61a93b531f gui: the core's scripts back under their budget, by a comment cut
Main at 245f07b19 had the core's scripts at 1,533,806 bytes, 4 over
TestCoreScriptBudget's 1,533,802. Each of eb56de0b5, 914fcf59b and
4df5256db fit at its own base; together they don't. The comment eb56de0b5
put over its modelSamePick call, which names the file the line imports, is
cut. No raise.

Run on mote: go test -run TestCoreScriptBudget ./internal/gui red at
245f07b19 (1,533,806 > 1,533,802), ok with this.
2026-11-11 12:26:53 +08:00
yetone c1a0726369 tests: context-cap and the catalog's model list are named in the route and settings guards
747632890 added POST /api/settings/context-cap and settings.ContextCap,
and eb56de0b5 added GET /api/catalog/models, with no line in either guard,
so TestEveryRouteHasACommandOrIsNamed and
TestSettingsSaveKeepsWhatItDoesNotSend were red on CI from 8aae124b0 on
(run 42954436265, ubuntu and macOS).

context-cap has its command, magpie model context-cap; the catalog list
is the model editor's Same as picker, with no command yet (stage 2). The
settings-keep test now sets ContextCap, which has its own route, and checks
a Settings save keeps it (it does: the test passes with no code change).

Run on mote at origin/main 245f07b19 plus this: go test -count=1
./internal/cli ok (42s). ./internal/gui: both guards ok; the package's red
tests there were TestCoreScriptBudget (next commit) and eight AppKit window
tests that wait 30s for a window over ssh (TestPanelCloseHidesIt,
TestMainWindowCorners and the like), which this change doesn't reach.
Red before: both guards on CI at 8aae124b0, naming these three.
2026-11-11 12:26:53 +08:00
yetone 58fb070953 settings: named proxies, chosen as inherit, direct or a saved one anywhere a proxy is (@tsingchao on X)
Settings > Network keeps named proxies (name, address, optional login)
with a Test that says reachable and the latency. Everywhere a proxy can be
chosen (global, plugin downloads, a provider, a key, a Claude account) now
has a Saved mode beside the others; the value is "@<id>". Addresses typed
before are read exactly as before, nothing is migrated or overridden.
netproxy.Parse/Resolve/Redact/EnvWith/Dispatch resolve a reference at the
lowest layer, so a proxy edited once reaches the gateway, usage reads,
sign-ins and the plugin host at the next request; Claude Code's
settings.json env (a snapshot) is rewritten by provider.ProxyEdited.
A reference this computer lacks fails closed (DeadProxy), says the proxy's
name in the request error and as "Proxy missing: {name}" on the provider
row, and never goes direct. The password lives in settings.json (0600), is
never read back by the page, logged, or put in Settings sync. The list
rides with the providers part of a sync (Bundle.Proxies, MergeProxies by
id, passwords only with keys). A proxy in use can't be deleted (409).
The saved list's page code is in proxies.js, loaded when Settings draws it;
app.js grew by Saved-mode helpers only, paid for by 16 long comments cut
(core budget unchanged, no raise).

Run (mote refused ssh all session, so Go and GUI went through win-run on
xiaomi-gpu, Windows 11; gofmt and darwin/linux-nogui/windows go vet were
clean on mote before it went down, at the pre-sync tree):
- go test settings, netproxy, backup, settingsapi, davsync: ok on Windows
  (earlier on mote: also gui, provider, plugin with real Bun, gateway).
- saved-proxies.test.cjs 20 of 20 (chromium+webkit, en zh zh-TW ja de,
  420px) twice more on Windows; provider-proxy-missing.test.cjs 20 of 20.
  One webkit de 420px run of saved-proxies failed once under 4-way
  concurrency and passed 3 of 3 alone; not reproduced.
- TestCoreScriptBudget ok after the move (it was 3.4KB over before).
Red on this tree and on origin/main alike (Windows run, not mine):
settings TestSharedCheckedReadsOnceAndKnowsUnknown; provider
Codex keychain/Git tests; plugin TestHostRunsAsMagpieBun, TestPiPackage;
gui TestGatewayHeldByAContainer and others; old-webkit "compat.js is the
first" (headerpresets.js) and ":has() (Safari 15.4)" on origin/main 245f07b19.
Broken by hand: restore skipping Proxies (TestSavedProxiesTravelWithProviders
red), Parse returning nil for a dangling ref (netproxy tests red), the
Proxy-missing badge disabled (provider-proxy-missing 0 of 20), and the Claude
env snapshot failing open (found by reading, test added).
Not tried: real vendors, the real Claude Code, a real two-computer sync, the
macOS suite and the whole GUI suite on this final tree (mote down; the whole
suite ran to test ~3700 on the earlier tree with reds owned by others).
A proxy missing whose sender never had it is named by its id.
2026-11-11 12:26:43 +08:00
yetone d7978141bb sessions: WSL sessions go when the last agent in a distro is uninstalled (_SekiBetu_ on X)
wslList kept every distro's listing, cold, whenever WSLHomes named no
distro. That is also what it names once the last agent in WSL is taken away,
so the sessions of a removed agent stayed listed for good, unopenable and
undeletable. internal/agent now says whether wsl.exe answered the list of
distros (sessions.WSLListed); an answer with no distro an agent is in drops
the listings, no answer keeps them as before.

Run (win-run, xiaomi-gpu; mote refused SSH all session): the new
TestWSLAgentsGoneListingDrops and TestGoneAgentLeavesNoSession (native
Claude and Codex folders deleted: nothing listed, no parse kept; green on
the old code, so macOS/Linux/Windows native lists were already right),
go test ./internal/sessions ./internal/agent, go vet on both.
Broken by hand: with the WSLListed check turned off the new test is red
(7 sessions listed after the agents were taken away).
Not tried: a real WSL distro with a real uninstall; GUI; full suite.
2026-11-11 12:22:45 +08:00
yetone 245f07b19e agent: the pages that poll name rows from a list built once a while
The Sessions page polls its list and its stats every 15s, the Usage
page its clients, and each asked agent.Clients() only for each agent's
id, name and icon. Clients() builds every agent (30+ constructors):
2.5 ms, 378 KB and 3411 allocations a call on the Windows box with
discovery's real 2s look window, mostly os.Stat, filepath.Join and
Getenv. On the real-account run (t69, 4 min) agent.All under the
sessions handler was 22 MB of 210 MB allocated.

agent.Looks keeps that id/name/shared-name/icon list for 30s, built
again at once when the plugins' agents change (agentplug's set) or the
Agents page's refresh (Rescan). A new omp or QwenPaw profile shows by
its id for up to 30s. Nothing is kept in a test binary unless a test
says, so tests that add an agent read it at once. The GUI's sessions
list, stats, one session, markdown export, trash, manage and reads
views, and usageapi.Clients, read Looks.

Tests: TestLooksBuiltOnceAWhile — six asks build once, the list equals
Clients(), a plugin agent switched on and off shows at once, Rescan
builds again. Broken by hand (memo check made false): "six asks built
the agents 6 times; want once".

Run on the Windows box: go test ./internal/agent ./internal/gui
./internal/usageapi at the pre-rebase base 0cc91af3d: usageapi ok, agent
and gui with 38 reds. Those tests, run at 8aae124b0 with and without this
change: the same 37 fail on both (#6068). TestLooks/TestPlugged/TestRescan
ok and go vet ok at 8aae124b0. mote (macOS) refused ssh all session, so no
macOS run and no real-account measurement yet.

Rebased on 156861b3a after the runs; its new commits touch library,
plugin and site only.
2026-11-11 12:02:52 +08:00
yetone 5399c33728 healthcheck, update and status find the running gateway by its own record (ljlwlcz on X)
The gateway now writes gateway.json (addr, pid, role, version) in magpie's
config folder while it serves; healthcheck, update, status and the other
CLI clients read it when MAGPIE_ADDR is unset, trusting it only if the pid
on GET / matches. --addr overrides. New: magpie status [--json] for
watchdogs (role, pid, listen address).

Run: new gateway and cli tests on Windows via win-run (pass); broken by
hand (record disabled): they go red; gofmt; vet windows and linux nogui.
Not run: mote/Linux (SSH down, WSL broken), darwin vet, a real systemd
service. TestEveryRouteHasACommandOrIsNamed is red on the base for two
GUI routes, unrelated to this change.
2026-11-11 12:00:19 +08:00
yetone cc659c7559 library: Instructions reach MiniMax Code and WorkBuddy (lysyscy8 on X)
MiniMax Code reads AGENTS.md in its data folder ($MINIMAX_DATA_DIR, else
~/.minimax) before every conversation (readGlobalInstructions in
@minimax-ai/code 0.7.6's chunks), so its target now names that file.

WorkBuddy and WorkBuddy AI keep their instructions as the string
personalization.customPrompt in app/app-config.json of their folder
(PersonalizationCollector and AppConfigService in 5.5.6's app.asar, both
builds). Target.Field says the instructions are a JSON string rather than a
file; instrRead/instrSave read and write it through edit.SetJSON/DelJSON, so
every other key, its order and indentation stay, the user's own prompt stays
in the field around magpie's marker part, and taking the part back leaves
the file byte for byte as it was (an empty personalization object magpie
made goes too). A file that is not JSON, or a field that is not text, is
unknown: reported, never written over. Import takes the user's prompt into
the library the same way.

Run: TestMiniMaxCodeInstructions, TestWorkBuddyInstructionsAreAJSONField,
TestWorkBuddyInstructionsFromNothing, TestWorkBuddyInstructionsUnreadFileIsLeftAlone,
TestWorkBuddyInstructionsImport and TestWorkBuddyAIInstructions, in a sandbox
HOME, on Linux (wsl-run) and Windows (win-run); all fail with the two target
assignments taken out (broken by hand), and pass with them. internal/library
whole on Linux (ok) and Windows: 3 reds, TestGoneAgentListedToTakeOut,
TestCheckMixedServerEachSide (both #4115) and TestPluginImportCarryOnOffRemove
(#6065), all three red the same on origin/main d1b4eff5a on Windows.
Not tried: a running WorkBuddy or mcode reading the written values (the apps'
sources were read; WorkBuddy loads its config as it starts, so a running one
may need a restart); WORKBUDDY_USER_DATA_DIR is not followed.
2026-11-11 11:54:21 +08:00
yetone a982f34130 plugins: async gateway hooks get the request's kind, subagent or not (ahwulv on X, #4655)
GatewayContext had no subagent marker, so OpenViking could not skip memory
recall for Claude Code's subagents. It now carries kind: "subagent" when the
client says so on that request, "" otherwise (main conversation, or a client
that doesn't say). hookKind (internal/gateway/middleware.go) reuses the
gateway's own readings: Claude Code's x-claude-code-agent-id (subOf), and
Codex's x-openai-subagent collab_spawn (callKind + usage.PurposeOf, so a
Codex review or compaction is not a subagent). Headers from #4655's real
Claude Code 2.1.312 capture. It is read per request, so onRequest and that
request's onResponse see the same value and the main turn after a subagent
in the same session is "". Never guessed from the prompt or Agent tool
history. Documented in docs/subsystems/gateway-request-hooks.md.

Before/after: a hook's ctx had no kind; ctx.kind is now "subagent" for such
requests (the OV plugin already reads ctx.kind === "subagent").

Run: TestHookKindFromClientHeaders (claude subagent, claude main in the same
session, codex collab_spawn, codex review, none) and
TestAsyncGatewayHookKindReachesPlugin (real gateway + Bun: main, subagent,
main again; onRequest and onResponse) on mote at the commit before the final
rebase and on a WSL box; with Kind dropped from the context the e2e test
goes red (saw "" want "subagent"). go vet darwin green. Not tried: the real
OpenViking plugin; Claude Code itself against this build; linux/windows vet
was still queued on mote when this was pushed.
2026-11-11 11:50:13 +08:00
yetone 4df5256db8 plugins: a plugin's page shows its README in the UI's language (ahwulv on X)
A plugin that ships README.zh-CN.md still showed README.md on its details
page with magpie in Chinese. GET /api/plugins/page now takes ?lang= (the
page's document language) and plugin.ReadmeIn picks the README named for it:
README.zh-CN.md, README_zh.md, README-zh.md, README.zh-Hans.md, README.CN.md
and the like, any case (readmeTag/pickReadme). Order: the language's own tag,
then its base (zh-TW takes a simplified README over English), then the plain
README.md as before.

Where it reads from: an installed plugin's folder; an npm package not
installed from its files through jsDelivr's file list (the registry entry
holds README.md only), public registry only, never a user's private one;
a GitHub repository not installed from its contents list. Any failure keeps
the old README.md path. The page cache in plugins.js is keyed by package and
language. A package only on the community dist branch still shows the
README its index carries (English).

Before/after: zh UI + a package with README.zh-CN.md showed README.md; now
shows the Chinese one. en UI, no such file, or jsDelivr down: unchanged.

Run: TestPickReadmeByLanguage, TestReadmeInUILanguage (fake npm, jsDelivr,
GitHub, installed folder) on mote at the commit before the final rebase and
on a WSL box; broken by hand (lang forced to "" in ReadmeIn) the test goes
red. GUI plugin-readme-lang (new, chromium + webkit, en and zh) green, red
when &lang= is dropped from the request; plugin-detail-escape green. go vet
darwin green. Not tried: a real npm package with a localized README against
the live jsDelivr; the other plugin GUI files and linux/windows vet were
still queued on mote when this was pushed.
2026-11-11 11:50:13 +08:00
yetone 8aae124b02 gateway: Claude Code's tool-list notices after a result are not the user's message, so a steer sent with them reaches the model (magicalaciw18 on X)
Claude Code's deferred-tools and MCP-server notices ("The following deferred
tools are now available via ToolSearch…", "…are no longer available…",
"# MCP Server Instructions", "The following MCP servers have disconnected /
failed to connect / are still connecting…", literal strings from its own
transcripts) were not in `injected`, so agentNotice passed them to the run as
the user's words. The model read a new "user message" that was only the notice
(and a steer sent beside it arrived with the notice glued on its front).

Run on the Windows box (xiaomi-gpu, win-run; mote and WSL refused every
connection), at the pushed head (rebased on 914fcf59b):
- Old prompt.go: TestClaudeToolListNoticesAreNotTheUsersMessage (7 subtests)
  and TestClaudeSteerBesideToolListNoticeGoesOnAlone red; the lone-steer
  tests pass on old and new code (they guard that a steer alone still goes
  through, as a text after the result and as 2.1.296's system message).
- Fix: the new tests, TestClaudeHook*, TestAgentNotice*, TestUserWords green.
- go vet ./internal/gateway on Windows: clean. gofmt clean.
- -run 'Prompt|Classify|Turn|UserWords|Reminder|Notice|Claude' on the package:
  only TestClaudeAsRootEnv red, a known Windows red (#2425), untouched here.
Not run: mote (down), darwin/linux vet, the full suite, a real Claude Code.
The first quote of the report (a steer read as command output) is #1878,
fixed in v0.1.1220; not reproduced here.
2026-11-11 11:41:40 +08:00
yetone 914fcf59b0 gui: Sessions' Settings › no longer scrolls the whole window (kalicyh on X)
Settings' explanation lines are held out of sight with position:absolute
(hover mice), but their row had no positioned ancestor, so each sat at the
window's top-left corner, below the fold for the rows far down a page. The
document (body is overflow:hidden, still scrollable by script) then had
~870px of scroll, and Sessions' Settings › (openSettingsAt ->
scrollIntoView on the Privacy session-history rows) scrolled the window as
well as the page: Settings' top, the header, was pushed off the screen.

The row's .who is now the line's box (position:relative), in Settings and
in the provider editor's prefs (same rule, same hole). Every other
openSettingsAt link (Privacy rows, General's name row) shared it.

Run (win-run xiaomi-gpu; mote refused SSH all session, WSL tar errors):
- sessions-to-settings, all 5 languages x 1100/420 x chromium+webkit:
  20 of 20 ok. The new check (window scrollTop 0, Settings top >= 0,
  document no taller than the window) is red on the old CSS, 4 of 4 in zh
  (both engines, both widths).
- settings-hints/-lines-wrap/-places/-back/-search/-tabs-stick,
  editor-hints/-roomy, provider-prefs: 15 failures on this change against
  18 on the old CSS, the same names minus three the fix cleared (webkit de
  440 line-wrap, webkit hover hints); the remaining 15 (chromium de 440
  line-wrap, Settings' search, both engines) fail the same on the old CSS
  on the Windows box.
Not run: the full GUI suite, go test, macOS/Linux WebKitGTK.
2026-11-11 11:40:24 +08:00
yetone d1b4eff5aa agent: version detection and updates for agents installed in WSL distros (mewcoder on X)
A WSL twin row (<kind>@wsl:<distro>) showed no CLI version and no Update
button; the host path's cliupdate machinery only knew host binaries.

Now a twin in a running distro is read and updated inside the distro, for
every cliSpecs kind that has a command (cliupdate_wsl.go):
- one `wsl.exe -d <distro> -e sh` probe prints the command's real path,
  --version and exit code, with its own folder, npm prefix, ~/.local/bin and
  ~/.bun/bin first on PATH (wsl.exe -e has no login PATH, node CLIs exit 127);
  kept 10 min in wslProbes, dropped by Rescan and after an update.
- wslHowInstalled applies the host rules to the Linux path: own updater
  (spec.self), Homebrew, npm, bun, pnpm; volta, yarn and unwritable prefixes
  are left alone.
- the update runs in the distro through wsl.exe (wslRunUpdate); a Linux
  brew's newest is asked in the distro too.
- a stopped distro is never started: no version, and an update says to
  start it. CLIs() lists twins, so Update all takes them in.
No GUI change: the Agents row is keyed by agent id.

Run: gofmt clean; go vet darwin, linux, windows on internal/agent;
go test ./internal/agent ok on mote. TestWSLAgentCLIVersionAndUpdate (fake
registry + fakeWSL distro with an nvm prefix) goes red with the CLI hook
removed from CLI(). Real: win-run on xiaomi-gpu, magpie-desktop's own codex
read 0.162.1, Update true, updated to 0.167.1.
internal/gui on mote: only TestPanelHiddenByWailsMarksPageOutOfSight failed
(AppKit test killed at 120s, mote load ~80; no GUI file touched).

Not tried: real brew in a distro, proxy env inside the distro, sudo-owned npm
folders, kinds without a bin (Goose, mu), starting a stopped distro. Host's
proxy settings are not carried into the distro.
2026-11-11 11:35:41 +08:00
yetone 7476328901 settings: one longest context for every model (WJaunita45604 on X)
Settings > Models > Routing has a Longest context field (magpie model
context-cap [<size>|off], POST /api/settings/context-cap). It lowers every
model's window to it, so a user need not set each model. A window the user
set on a model, or on its provider with "*", wins and is not capped; a model
whose window is unknown stays unknown.

It is applied where the window is derived, provider.windowIn, so /v1/models,
every agent's catalog, group windows and the compaction thresholds that
follow the window all agree. Codex's own models take it through
CodexNativeWindow, CodexWindow and codexcat.Cap on the list the gateway
serves; the list's ETag carries the cap so Codex asks again. The provider
editor's Listed value stays the vendor's.

Run (mote): provider, codexcat, cli, settings, settingsapi, gateway tests;
GUI context-cap, model-load, settings-places, i18n-keys, settings-general in
chromium and webkit (en, zh); TestCoreScriptBudget; gofmt; vet on darwin,
linux nogui and windows. Broken by hand: windowIn without the cap turns
TestContextCapHoldsEveryModelButTheOnesTheUserSet and TestModelsListContextCap
red.
Not tried: the whole GUI suite (one row added to an existing list, no new API
read on page load), a real Codex reading the capped list, Windows run.
Not covered: Claude Code's own [1m] choice (claudeRunName) and agent/claude.go's
fallback when a ref has no window.
2026-11-11 11:07:57 +08:00
yetone eb56de0b59 gui: a model's Same as can be picked from models.dev's list, filtered (timfang4162 on X)
In Model settings the Same as box, which binds a provider's model to
another model's metadata (window, reply limit, levels, images, list
price), was a bare text field. A button beside it now opens the app's own
menu (not a <select>) with the models of the models.dev catalog magpie has
already synced: id, name, window and price on each line, a Filter… box over
id, name and maker, the current one ticked. A pick fills the box, so it is
staged and saved with the editor's Save like a typed id, and a value typed
afterwards still wins; nothing about how Same as is read changed.

GET /api/catalog/models lists the cache with one entry per model
(catalog.SameModel), taken from the provider that lists its window and
price. It fetches nothing. The picker lives in modellimits.js, loaded with
the model rows, so the core script budget is not raised (five comments in
renderModels cut to pay for the strings, 613 bytes of room before).

Run on mote at this tree:
- TestCatalogModelsListsTheSyncedCatalogOnce; broken by hand (last
  provider wins instead of the one with window and price) it fails with
  "kimi-k3 = {ID: ... }; want the provider that lists its window and
  price".
- model-same-pick.test.cjs, 22 cases (chromium and webkit, en zh zh-TW ja
  de, 400 and 900px): filter by maker, name and id, Enter picks, the
  current one ticked, one catalog read, no scroll, no <select>, saved as
  modelPrefs same; a failed read says so. With the filter argument taken
  out of openProtoMenu it fails. provider-same-as.test.cjs still passes.
- gofmt, go vet (darwin, linux nogui, windows) on internal/gui,
  TestCoreScriptBudget.
Full GUI suite at this tree (rebased on 5c05ac41b): the only reds are not this change's, each also red or flaky at origin/main 1f99f6f0b run alone, and filed: account-arrange #6010, account-eye #5052, account-refresh-holds #5814, accounts-own-signin's Antigravity test #6038 (a webkit access-control flake that moves between languages).
Not tried: the real app's WebKitGTK; the full suite is started after the
push.
2026-11-11 10:56:41 +08:00
yetoneandvincent 855b97a407 library: an MCP call's stream is open before its request reaches the server (#5433)
ServeRun sent a call to the child server and only then opened the call's
SSE stream. A server that asks roots/list at once could have the ask
land before that stream existed: it went to an older session stream, or
nowhere, and the call's own reply came first. That is #5433's red,
TestRunServerAsks seeing "roots " with nothing after it, which came back
on ubuntu CI at 296a9292c. The stream is now opened before the send and
closed on every return, a failed send included.

This is skygunner's patch (5acae7bee on their fork, posted on #5433 on
11-08), applied to main unchanged.

Run on mote at origin/main 0cc91af3d plus this change: TestRun* -race
-count=10 ok; ./internal/library ok (190s); go vet ok, and GOOS=windows
and GOOS=linux -tags nogui vet ok; gofmt clean.
Red on the old code: the new TestRunServerAsksOnCallStreamBeforeSendReturns,
with main's mcp_run.go, fails 3 of 3: "roots/list delivered to session
stream instead of call stream".
Not tried: Windows and Linux runs (the WSL box answered
Wsl/Service/E_UNEXPECTED), and the full suite.

Co-authored-by: vincent <vincent@users.noreply.github.com>
2026-11-11 10:49:46 +08:00
yetone 1f99f6f0b5 provider, gateway: a backend that only streams is tested and served (Cyrus_4433 on X: claude-relay-service "400 · Stream must be set to true")
A CRS Responses endpoint, like Codex's own backend, turns away a request that
doesn't ask for stream:true. The editor's Test models and protocol detection
send one small body, so every model of such a relay was red; an agent that sent
stream:false got the same 400 through the gateway.

Probe: probeAt asks once more with stream:true when a 400/422 says the stream
must be set (provider.StreamRequired, WithStream). Chosen over streaming every
probe so a vendor that takes one body keeps being asked for one; every probe
(model test, per-model check, detect, key check) goes through probeAt.
Gateway: passthrough marks the model stream-only on that 400 for a request
asking one body and returns done=false; attempt then translates on the same
API (always streamed upstream, whole reply to the client), and asks so at once
from then on, as a refused custom tool is.

Run (mote): new tests built from the reporter's literal error, red on the old
code (TestProbeStreamsWhereTheBackendOnlyStreams, TestDetectFindsAStreamOnlyBackend,
TestWholeReplyFromAStreamOnlyBackend), green on the new; go vet darwin, windows,
linux nogui; go test ./internal/provider ./internal/gateway ok. Each fix broken
by hand (probe retry stashed, gateway hook stashed): red. Not tried: a real CRS
relay; the rest of ./... (started after the tag).
2026-11-11 10:37:13 +08:00
yetone 0cc91af3db agy: magpie's models go in a settings file of its own, so agy's remote control works (baysonfox on X)
magpie wrote modelProvider gemini, the model and its custom models into
agy's settings.json. That made every agy an API-key session: no Google
account, so no remote control (needs the sign-in plus Google's server-side
flag), and a plain agy asked for GEMINI_API_KEY too.

Now they go in ~/.gemini/antigravity-cli/magpie-settings.json, handed to agy
as --settings for the one session (the launch command, magpie agy run, and
the function in a shell or a WSL distro). settings.json stays the user's.
An older wiring is given back (stashed model and provider) at the next Sync
or pick. agy remote-control and --remote-control run plain, on the sign-in.

Run (mote): go vet, GOOS=windows and linux nogui vet, agent/cli/sessions/update
packages (see push note). Real agy 1.5.3 in a sandbox HOME: plain agy with
the user's untouched settings.json now asks for sign-in (no GEMINI_API_KEY
error); the new launch reached a stub gateway at /v1beta/models/<m>:streamGenerateContent.
Broken by hand: remote-control bypass removed, TestAgyRun red; TestAgy red
on the old code (settings.json written).
Not tried: real remote control (needs a Google sign-in, none in the sandbox);
signed-in BYOM custom models; Windows PowerShell function run.
2026-11-11 10:31:52 +08:00
yetone 9cdeb485bb gateway: a limit that names one model rests that model, not the whole key (WJaunita45604 on X)
A 429 or quota refusal whose body names the model asked (Groq's per-model
TPD, OpenAI's per-model TPM, Gemini's QuotaFailure, any vendor's "limit for
model X") used to rest the account's key, so every other model of the
provider waited. modelNamed (routing.go) now sends such a refusal down the
same path as modelCooledDown: it rests restID (key/model). Readers of rest
state (restingOf, sink, GUI badges via Rest.Model) already understood those.
Account-wide refusals (no model named, another model named, credit, auth)
still rest the key. The id match is on whole ids (gpt-4o is not gpt-4o-mini).

Cline's and ZCode's guard tests expected another vendor's words to rest the
key even when they named the very model; they now expect the model alone.
The "not a trial" ZCode row moved to the new test.

Run (mote): the new TestModelNamedLimitRestsTheModelNotTheKey,
TestLimitNamingNoModelRestsTheKey and TestModelNamedReads, red on the old
code (mr-red.log); gateway tests matching Rest|Rate|Quota|Fallback|Limit|
Cooled|Pool|Overload|Sink|Credit|ZCode|Cline; gofmt; darwin, linux and
windows go vet of internal/gateway.
Broken by hand: modelLimited back to modelCooledDown only, the new tests go red.
Not tried: a real vendor account; the full suite (started after the tag).
2026-11-11 10:31:29 +08:00
yetone 89f66966d9 release builds: the UI's files are packed into one zip, ~5.7 MB off each binary (@ZhangXiaof48473 on X)
The Windows and Linux downloads (and the CLI builds) are the raw binary, so
what is embedded counts in full. 8.2 MB of the 12 MB under internal/gui/assets
is scripts, styles and svgs. `make assets-pack` (build/assetpack) writes them
to internal/gui/assets.zip (deflate; png/jpg/webm stored), and the release
targets and `make app` build with -tags packedassets, which embeds that zip
instead of the tree (assets_packed.go: a file is unpacked once, on first use,
and served seekable with no modification time, as an embedded one is). Plain
`go build`, `make build`, `make cli` and every test still embed the tree.
The zip is git-ignored and made before every release build.

Sizes (go build -trimpath -ldflags="-s -w", on mote, at e430e2750):
  linux/amd64 nogui   73,203,874 -> 67,502,242  (-5,701,632)
  windows/amd64 app   88,401,408 -> 82,755,584  (-5,645,824)
The macOS zip/dmg compress the binary already, so they gain nothing.

Run: assetpack, then `go test -tags packedassets -run TestPacked ./internal/gui`
(passes: every file byte for byte and no other; / and a range of the webm served;
no Last-Modified). The first try failed it with "packed has 0 files, the tree
301" (zip entries lacked the assets/ prefix), so it does go red on a bad pack.
go vet ./internal/gui on darwin, linux nogui, windows and -tags packedassets:
clean. gofmt clean.

Not run: the full suite and the GUI suite (default builds embed the tree as
before; api.go only lost the embed line), a real release through
magpie-releases (its release.yml calls these make targets), the Linux GTK
build (cgo).
2026-11-11 10:28:05 +08:00
yetone 90a028d2c1 air: JetBrains IDEs get a Magpie agent for each running WSL distro (yanghonghang on X)
IDEA 2026.3 starts a WSL project's ACP agent inside the distro through EEL.
An absolute Windows command whose environment differs from the project's is
refused ("ACP executable belongs to a different environment"), which the AI
Assistant shows as "Magpie does not run". The host entry in ~/.jetbrains/acp.json
therefore never worked for a WSL project.

Now each running distro that has opencode gets its own "Magpie (WSL <distro>)"
entry: command is the distro's opencode as a \\wsl.localhost UNC path (the
WSL descriptor, accepted), env OPENCODE_CONFIG points at a magpie-opencode.json
written in the distro's ~/.jetbrains. Set, Sync, Check and the uninstall path
all reach the entries; a stopped distro is never started. The probe now
records the binary paths (distro.Paths).

Ran: mote-run go test -run 'TestAir|TestWSLProbeKeepsPaths' ./internal/agent
(ok), the same on win-run and wsl-run (ok), gofmt, GOOS darwin/linux/windows
go vet ./internal/agent. Broke by hand: turning the WSL branch off in airAt
turns TestAirIDEAddsMagpieAgentForWSLProjects red.
Not tried: a real JetBrains IDE (none on the Windows box); the EEL rule was
read from the IDE's bytecode.
2026-11-11 10:27:44 +08:00
yetoneandRainier 5c05ac41b9 web: a LazyCat sign-in takes no peer on a public address; the manifest lists /magpie-ca.crt (forgetable024 on X, #5987)
Follows Rainier's two commits (cherry-picked with authorship, #5987).

What LazyCat's own docs say (developer.lazycat.cloud/en/http-request-headers.html,
read today): lzc-ingress authenticates a request, and after a success sets
X-HC-User-ID, -User-Role (NORMAL or ADMIN), -Device-*, -Login-Time; "if
authentication fails, it will clear the above X-HC-XX headers", and "lzcapp
developers ... can directly trust X-HC-User-ID". X-HC-User-Groups is said to
have the caller's own removed. X-HC-Source is in no page of the docs; the
sign-in's use of it only narrows who gets in. The docs name no address for
the ingress, so the peer can't be named; a TCP ingress or port forward passes
headers as sent (the docs for it say no authentication), which the manifest
section already says to keep off the page's port.

This commit: lazyCatSignIn turns away a peer that isn't on a private,
loopback or link-local address (or isn't an address), whatever headers it
sends. The client-routes list gains /magpie-ca.crt, which main added after
the branch's base (TestLazyCatManifestListsTheClientRoutes was red on it).
TestTranslatedRoutesDropProxyIdentity adds the chat and messages routes to
the vendor-leak tests (native, Codex relay and MCP were covered).

Run (mote, go1.26.8): gofmt clean; go vet on gui, gateway and cli for darwin,
linux nogui and windows; LazyCat, ProxyIdentity, OnePort and Web tests in
internal/gui and internal/gateway ok.
Broken by hand: with the peer check off, TestLazyCatSignInIgnoresAPublicPeer
is red; with X-Hc- out of proxyIdentity, TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity are red.
Not tried: a real LazyCat box (none here); the plugin fetch route builds its
headers from the request magpie made, read, not run. Full suite and GUI
tests follow the tag.

Co-Authored-By: Rainier <74943233+Rmosser@users.noreply.github.com>
2026-11-11 10:15:40 +08:00
RainierandClaude Opus 5.5 4d9b798d50 web: a LazyCat box's administrators open the page with the box's sign-in (MAGPIE_WEB_SIGN_IN=lazycat) (#5987)
magpie in a LazyCat app (懒猫微服) is opened from the box's app list by
someone signed in to the box already, and asks for a key they never
saw: it is in the container's log. A package can only hand the key to
every browser that reaches the app, or put a proxy in front that adds
the key's cookie to what the box signed in.

The box's ingress, lzc-ingress, sends a browser that isn't signed in to
the box's login page, and puts on every request it passes the app the
box account (X-HC-User-ID), its role (X-HC-User-Role, ADMIN or NORMAL)
and what sent it (X-HC-Source, client for a browser), in place of what
the caller sent. With MAGPIE_WEB_SIGN_IN=lazycat webGuard takes that
sign-in besides the key: lazyCatSignIn lets in an ADMIN account sent by
a browser, each of the three named once, and tells anyone else the box's
reason.

The box's sign-in is a cookie of the box's, and the box's apps are one
site, so a browser sends it with another app's page's requests too: an
earlier build of this change let another app's page on the box include
/boot.js and read window.bootPrefs. So it is taken only for what the
page itself or the user asked for (boxFetched, the Fetch Metadata:
Sec-Fetch-Site same-origin or none, or a GET or HEAD navigation to a
document from another page), never for another page's script, frame,
fetch or form POST, nor from a browser that sends no Fetch Metadata.

It sets no cookie of the page's own, so signing out of the box signs out
of the page. The key's link and cookie work as before, /api still
answers the page alone (webOwnPage), and the gateway's client routes on
the page's port go to the gateway first (onePort), which asks for a
gateway key. StartWeb refuses another value, and lazycat where
LAZYCAT_APP_DOMAIN, which LazyCat sets in an app's containers, isn't
set: all magpie can check, so the setting is the package's word that the
box's ingress is the only way to the page's port. magpie web prints the
box's address beside the link.

Docs: reference.md's new LazyCat section, with a manifest and what must
never reach the page's port, and gui-shell.md's Browser mode row.

On a box (lzcos 1.6.2+fix.4), a probe app that echoes its request
headers: a signed-in browser's request carries X-HC-User-ID,
X-HC-User-Role ADMIN and X-HC-Source client, forged ones replaced; not
signed in, / goes to the login page and a public path gets none of the
three (forged ones taken off, repeated or in lower case too), while
X-HC-User-Groups passes on as the caller wrote it, so it is never read;
a TCP ingress passes every header as sent. Another app's container
reaches the app through the ingress alone (straight to the app's
container it times out); the box itself, and a container in its network
(network_mode: host, which a manifest may set), reach the port.

A test app made from the docs' manifest, running a build of this change
on 68cb92e8e in the image's place as its user (uid 65532): the box's
administrator opens the console with no key, and no cookie is set;
/v1/models still asks for a gateway key; from another app's page a
navigation opens the console, while a script include of /boot.js and a
frame are turned away; in the container, past the ingress, a request
with no Fetch Metadata, no X-HC-Source, NORMAL or a header twice gets a
401. Bound to /lzcapp/var/config, which the box makes as root's, magpie
couldn't write /config; bound to /lzcapp/var it can, and a gateway key
outlived the container.

Tests, through webServed with the headers the probe saw:
TestLazyCatSignInOpensThePage, TurnsAway, AsksWhereFrom, IsAskedEachTime
and IsNoGatewayKey (the client routes, with each sign-in that opens the
page), and TestWebBoxSignInChecksItsValue.
TestRemoteOpensTheOtherMagpie, new on main, gives webHandler no box
sign-in.

Run, at this tree, on 6c3f113ce: Docker golang:1.26.8 (linux/arm64):
gofmt clean; go vet -tags gtk3 ./... (with the GTK and WebKitGTK
headers, as CI), -tags nogui and GOOS=windows clean; both builds ok.
macOS 27.2 (go1.26.8, not root, a temporary HOME): go vet ./... and the
two cross vets clean, the three builds ok; go test -tags nogui ./...,
TestScriptFindsClaudeMoved skipped (it runs the real
/Applications/Claude.app, #5989): 92 packages ok; red outside
this change, each red the same at 6c3f113ce:
TestBunProxyLoginWithReservedCharacters (#3397),
TestGitUpdateInstallsTheBranchsCommitNow and
TestGitUpdateKeepsACommitPin (#5988), on this Mac's bun 1.3.11,
older than MinBun; TestEveryRouteHasACommandOrIsNamed: POST
/api/settings/join, new with e053c337a, has no command. /join, new
with it too, is a client route, so the docs' manifest lists it.

Broken by hand, each red, all green again put back; a break that lets in
what must be turned away was seen to reach the page: TurnsAway with the
once-each check out, no sender taken, the role in any case, the role or
the sender check out (IsAskedEachTime too), app:… and system alone
turned away, or the key's "open the link" kept in the box's 401;
AsksWhereFrom with boxFetched out, no Fetch Metadata taken, another
page's navigation taken of any method or into a frame, an object or an
embed (or anything but an iframe), its request for a document that isn't
a navigation, or another app's page's script (same-site, no-cors);
OpensThePage with another page's navigation taken by GET alone, or none
taken (IsNoGatewayKey too), a cookie set, or webOwnPage out;
IsAskedEachTime with the first sign-in kept; ChecksItsValue with lazycat
taken outside LazyCat or StartWeb not asking webBoxSignIn's error;
IsNoGatewayKey with the client routes behind the box's sign-in, or one
the box signs in on, or a HEAD to one, given to the page;
TestLazyCatManifestListsTheClientRoutes with /me out of the docs.

Not tried: a NORMAL account in a real browser (the box has one
account); signing out of the box in a browser; the box's own client
apps opening the page; a browser without Fetch Metadata; a header named
twice on a signed-in request through the ingress (a browser can't send
one); a multi-instance app; another lzcos version; a community plugin's
page on the box; a real vendor call through the box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
RainierandClaude Opus 5.5 db4da33bc6 gateway: a LazyCat box's X-HC-* headers go on only to a provider whose PassHeaders names them (#5987)
On a LazyCat box (懒猫微服) every app sits behind the box's ingress,
lzc-ingress, which puts on each request it passes the app who sent it:
the box account (X-HC-User-ID), its role (X-HC-User-Role), what sent it
(X-HC-Source), the device (X-HC-Device-ID, -PeerID and -Version) and
when it signed in (X-HC-Login-Time); the box's docs name
X-HC-User-Groups and X-HC-User-Ticket too. A request signed in to the
box gets them on the app's public paths as well, where a package serves
the gateway's client routes. The native route, the Codex passthrough and
relay to the ChatGPT backend (copyHeaders) and /mcp/<server> passed them
all on, so a vendor, the ChatGPT backend or a remote MCP server was told
the box account's name and role and the device's ids.

proxyIdentity takes any X-Hc-* as what a proxy says of the caller, as
it takes Tailscale-*, so nativeHeaderDropped, copyHeaders and the MCP
proxy's header loop skip them. lzc-ingress's X-Forwarded-By was dropped
already (X-Forwarded-*). What 7d196b679 checked and left stays as it
is: a provider's PassHeaders passes on the names it lists, these too, as
the user chose them (gateway-routing.md now says so); Codex's
allow-listed codexHeader, the Codex websocket's headers (taken from a
request magpie built) and passOnCaller are as they were.

What the ingress puts there was read off a probe app on a box (lzcos
1.6.2+fix.4) that echoes its request headers: a browser signed in to
the box got X-HC-User-ID, X-HC-User-Role ADMIN, X-HC-Source client,
X-HC-Device-ID, -PeerID, -Version and X-HC-Login-Time, on a public path
the same as on /.

Tests: TestNativeAnyDropsProxyIdentity and
TestPassthroughDropsProxyIdentity send ten X-HC-* headers and
X-Forwarded-By beside the twelve they sent, and check that none arrive
and X-Custom still does.

Run (macOS 27.2, go1.26.8 darwin/arm64), at this tree, on 6c3f113ce:
gofmt clean; go vet, GOOS=linux -tags nogui go vet and GOOS=windows go
vet of internal/gateway clean; go build -tags nogui ok; both tests ok.
The next commit adds a test to internal/gateway and changes nothing else
of it; the whole package ran there: ok.

Broken by hand: with the X-Hc- prefix out of proxyIdentity, both are
red: the native vendor, the ChatGPT backend and the MCP server were each
told all ten X-HC-* headers.

Not tried: a real vendor call through a box; a provider whose
PassHeaders names an X-HC-* header.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 10:15:40 +08:00
yetone 88c417392e usage: a sortable model speed ranking on the Requests tab (@flying_crp on X)
Usage's Requests tab gets a "Model speed" card: per model, the median output tokens/s, the median wait for the first token and the request count, over the selected range, sortable by every column (aria-sort header buttons, quiet table, no gradients). A request counts when it was answered (not rejected, handed on, failed or canceled), its first token was timed and it wrote 100 tokens or more (usage.MinRankTokens; the tooltip says so). Computed locally: each chunk keeps a 2% log-bin histogram per model beside its cells (speed_rank.go, chunkPart.speeds), a page merges the chunks' histograms, so there is no per-request sort and medians are within ~1%. The settled chunks' histograms are in the page file; its key salt is now page-v2, so the first load after upgrade recounts settled history once. /api/ledger sends speeds and speed_min.

Run (mote): gofmt clean; go vet darwin, linux nogui, windows for the touched packages and ./... earlier; go test internal/usage, internal/usageapi, internal/gui ok at this head; usage-model-speed.test.cjs 12 of 12 (chromium and webkit, en/zh/zh-TW/ja/de, 400px: order, sort by every column, aria-sort, focus kept, no horizontal overflow, ellipsis, hidden when empty); with i18n-keys and i18n-en-no-cjk 20 of 20; the whole GUI suite once on the branch before the rebase: every red is in a file unrelated to this change (account-arrange #6010, account-refresh-holds #5814, account-eye #5052, agent-switch-accounts #5925, bulk visibility and disconnect previews #5982 fixed in e430e2750, accounts-own-signin #6038), each red alone on origin/main 71a68639b or load-only.
Timing: 1M requests added to a chunk in ~185ms (TestModelSpeedRankAtTheLargestLedger).
Broken by hand: dropping the Failed/Canceled exclusion (gpt: 5 requests, 59.7 tok/s) and dropping the page's merge of chunk speeds (ranking empty) each turned the new tests red; restored.
Not tried: the real Linux app (WebKitGTK), a real ledger of hundreds of thousands of rows through the page-v2 file, a Windows run (win-run).
2026-11-11 10:12:23 +08:00
yetone bd60473c52 gateway: the MCP relay gives up a request body that stops moving over HTTP/2
The relay to a remote MCP server (mcpClient) is a Go http.Transport with
HTTP/2 on and carried request bodies, so a server that answers pings but
never opens its flow-control window held the call as long as the caller
waited (the same hang as f6c24c680's, @imty42 on X). It goes through
stallGuard now.

Audit of every Go sender a plugin-served request can pass: the gateway's
call to a plugin is pluginFetch -> plugin.Fetch, a JSON line on the host's
stdin to Bun's fetch, no Go HTTP client. The netproxy bridge relays a
CONNECT as a raw tunnel (Bun does the TLS and h2) and a plain-http request
over an HTTP/1.1 Transport with no TLS. internal/plugin's own Go clients
fetch the plugin market with GETs. None sends an h2 body. image_fetch_guard
and wbConfigClient only GET; codexrelay is HTTP/1.1 with keep-alives off.

Run (mote-run): TestMCPRelayBodyStalledIsGivenUp red 60s on the old code
(guard taken off by hand), green 2.9s with it; TestBodyStalled*, TestMCP*
ok; go vet linux, windows, darwin clean; gofmt clean.
Not tried: a real remote MCP server; the full suite after this commit.
2026-11-11 10:10:12 +08:00
yetone e430e27500 gui tests: agent-bulk-visibility and agent-disconnect-preview leave the window's in-use signal out of the writes they count (#5982)
10c4dc109 posts /api/update/using on the window's first pointer or key event. Both files record every POST and count or compare them, so bulk visibility (10 cases: 4 posts, not 2) and disconnect previews (4 cases: the two /api/update/using posts) were red on origin/main 71a68639b, run alone on mote. The recorders now leave that path out, as provider-find's did in b96847c3d.

Run: both files on mote, chromium and webkit, 5 and 2 languages: 14 of 14 ok (before, at 71a68639b: all 14 red). Not tried: the rest of the ~250 files with a strict POST recorder (#5982's open part).
2026-11-11 10:07:19 +08:00