Commit Graph
5040 Commits
Author SHA1 Message Date
yetone 2ff85f8a2b gui: a page's bar room comes out of its right padding, so both sides match
v0.1.1904 had every page keep its scrollbar's room, so nothing moves
when a page grows past the window. The owner asked whether the clear
bar now makes the sides uneven: it did, by the bar's width (8px on the
Mac, 10px on Windows and Linux), and the centred pages sat 4px to the
left.

layout.js measures the bar of a .view into --bar (again on resize, so
a text-size zoom is followed), and app.css takes it from each page's
right padding: the panel's 12px, the window's 16px, the centred pages'
max(16px, 50% - 600px) and the phone web's safe-area right. The heads
and strips that reach over the padding (Library's and Settings' sticky
heads, Providers' after-list fade, the masking record's bar) reach that
much less on the right, or they would run the page sideways. A plugin's
page, whose frame scrolls itself, shows a bar only when it needs one.

layout.js's measuring adds 254 bytes to the core's scripts; the budget is
raised by exactly that, with no room added.

page-width-steady.test.cjs now checks every page's left gap against its
right gap with the bar (chromium and webkit, the Mac's 8px bar and the
10px one, 1100 and 1600 wide) and that no page scrolls sideways; that
check found Providers' after-list fade running 4px past the page. With
v0.1.1904's CSS it is red ("agents: 16px on the left, 24px on the
right (bar 8px)", 26px with the 10px bar, 94/102 centred). page-width's
"centred" check compared paddings only, and now counts the bar too.

Run on mote at this head (f70cb6825's tree, on origin/main 174250b27):
page-width-steady, page-width, inner-scroll-contain, settings-tabs-stick,
library-all, agent-layout, i18n-keys, text-size, view-scrollbar: 168 of
168 pass; go test ./internal/gui -run Budget ok. Before the last rebase,
209 GUI files that reach pages, heads, panels, providers, masking,
library, settings and the gateway (3087 tests) had 29 reds; the same
files on origin/main d4f1d6480 had the same ones, apart from flakes:
gateway-key-limit and gateway-key-cycle (#4072, from f835bd713),
gateway-older (waits for #gateway .dot, which f835bd713 replaced; filed
with #4072's fix next), menu-input-scroll (#3402), header-centre webkit
(a ResizeObserver loop message, red on main too), account-mask chromium
zh, and gateway-caller-keys / gateway-key-models reading the page right
after a resize to 560 (#3523, #3797).
Not tried: the real Windows and Linux apps.
2026-10-28 22:44:22 +08:00
yetone 3f87493fc3 gateway: a masked value's snip is copied, not cut from the request it kept whole (#2278)
snipsOf cuts the text around each masked value out of the request as
sent. When the value is a whole JSON string, "api_key":"{{API_KEY_x}}"
and the like, the snip is neither shortened nor unescaped, so it was
a substring of the body: a Go substring keeps the whole string. Each
of the 400 records memory keeps (keepSnips) then held its request
whole, up to SentMax (4 MiB), whatever keepSent and sentBudget said.
apple-ouyang's heap on #2278 had 64 MB at gateway.sentOf, the
allocation of those bodies.

The snip is now copied, so a record holds the few bytes it shows.

Measured on mote with a throwaway test (not committed): 400 masked
1 MB requests through snipsOf and maskrec.Add, live heap after a GC:
406 MB with the snip as it was, 3 MB with the copy.

Run on mote at this tree, rebased on origin/main c4972b36e (its new
masking commit, 174250b27, changes comments only):
- go vet -tags nogui ./internal/gateway for linux, windows, darwin: ok
- go test -race -run 'Mask|Snip|Sent|Redact|Privacy|Restor'
  ./internal/gateway ./internal/maskrec: ok

Broken by hand: without the copy, TestSnipsHoldNoneOfTheBody fails
"the snip is a window into the request body, which it keeps whole".

Not run: the whole gateway package (its race run at 6104e88aa had one
red, TestTailOfReadsInPlace, since fixed on main in 4ca64c21b).

Reported-by: apple-ouyang
2026-10-28 22:42:34 +08:00
yetone c4972b36e1 LESSONS: a new reader of a live object reads each field the way its writer writes it (983fff23d) 2026-10-28 22:40:30 +08:00
yetone 983fff23d0 claude: a run's pid is read once its tree is set, not while cmd.Start writes it
TestClaudeRunsNamesEachProcess was red under -race on ubuntu CI at
6104e88aa (run 40698575099): /v1/magpie/claude-runs (7f827b3b0) listed a
run whose launch was still in cmd.Start, and pid() read cmd.Process
while Start wrote it. A real race, not only the test's: the Claude runs
list can be asked for at any time. pid() now reads tree under mu first;
tree is set under mu after Start returns, so cmd.Process is read after
it is written. No pid() caller holds r.mu (claude_rss.go oversized and
letGoOversized, claude_runs.go, the park path, launch's own logs).

Run on mote (M5 Pro):
- old code, -race -count=30: no race (the window is narrow)
- old code with a 50ms sleep injected at the top of launch, -race
  -count=5: DATA RACE, FAIL
- this change with the same sleep, -count=5: ok
- without the sleep: go test -race -run Claude ./internal/gateway ok
  (84s); go test -run Claude -count=2 ok (79s)
- go vet ./internal/gateway for darwin, linux, windows: ok
Not run: the full suite (one function changed, every Claude test above).
2026-10-28 22:39:56 +08:00
yetone 174250b277 masking: comments no longer quote Routing's "masking…" (#4053)
i18n-keys' "a plugin's words are its own" was red on main: masking.go's
and masking_test.go's comments quoted the Requests page's word "masking…",
which plugins/routing/i18n.js owns, so the test took it for a shared word.
Both comments now say it unquoted, without the ellipsis.

Run (on mote): node --test i18n-keys.test.cjs: 4/4 (3/4 before, red with
masking.go's then masking_test.go's line); gofmt -l internal/masking: none.
Comments only.
2026-10-28 22:34:52 +08:00
yetone e8e9245ecf agents: Install another agent says Plugins has more agents, and opens them
The owner, on the Agents page: 因为我们支持Agent插件了,这里是不是也应该
显示插件中有更多? Install another agent listed only the agents magpie has
an install command for; the agents a plugin adds were nowhere on that page.

- GET /api/plugins/agents names the suggested agent plugins (the market's
  kind "agent") not installed here. One installed but turned off, or
  pinned to a version, counts as installed: Plugins turns it on.
- Install another agent counts them in its header and ends with one row,
  "More in Plugins" with their names, as the Providers add sheet does for
  subscriptions. The row opens Plugins › Discover scrolled to its Agents,
  only while the click is fresh (scrollOnPurpose), on the section drawn
  last, since npm's answers draw it again.
- The list is fetched beside the install commands, not before them, so a
  slow market never holds the commands back. With no install command left,
  the section shows the plugins' row alone and no install note.
- Budgets: app.js 1,311,681 and the core 1,530,449 (+1,430 / +2,408 over main),
  the Agents page and Plugins page are the core's own, no room added.

Run at this tree, rebased on e2efbd357 (on mote):
- go test -tags nogui ./internal/gui -count=1: ok (budgets included);
  GOOS=linux and GOOS=windows go vet ./internal/gui: ok; gofmt -l: none.
- TestPluginAgentsNotInstalled: a fake registry with every kind, installed,
  turned-off and pinned agents; all installed gives [], never null.
- agent-plugin-agents.test.cjs: chromium and webkit, en zh zh-TW ja de,
  1100 and 420px: count, row order, words, tooltip, one line, name not cut,
  no sideways scroll, the click landing Agents at the top and staying.
- 69 GUI files that reach this (install section, Plugins Discover, strict
  fixtures, i18n), 1044 tests: 1033 pass. The reds were i18n-keys' #4053
  (fixed in the next commit) and mobile-web, whose copy had no .git for
  origin/main; run again with one fetched (d4f1d64): 30/30.

Broken by hand: main's assets under the new GUI test, 11/11 red; the
scroll line taken out, 11/11 red (webkit); the Go installed filter taken
out, TestPluginAgentsNotInstalled red.

Not run: the whole GUI suite (mote was busy with other sessions' suites),
and the real app with the live market.
2026-10-28 22:34:52 +08:00
yetone 36d1541c6e provider: WorkBuddy's mover min is 0.1.43, the default effort and gzipped chats
troilus1011 on X: WorkBuddy's DeepSeek in OpenCode thought only at low or
high. OpenCode's default names no reasoning_effort and WorkBuddy doesn't
think without one (0 reasoning tokens, measured on www.workbuddy.ai);
WorkBuddy's client sends the model's reasoning.defaultEffort ("high").
workbuddy 0.1.43 (plugins f4d48ac) sends that default when a chat names
none; a named effort, none too, goes as it came.

runmiNeverstop on X: 2.89 GB up to copilot.tencent.com. WorkBuddy's client
gzips model-request bodies (RequestBodyGzip in both builds' product.json);
the plugin sent plain JSON. 0.1.43 gzips chat-completions bodies on both
builds.

keepMovedCurrent brings every moved user to 0.1.43.

Run (on mote, at this tree): go vet ./internal/provider, go test
-timeout 45m ./internal/provider: ok. npm view
@magpie-community/opencode-workbuddy-auth@0.1.43 --prefer-online: 0.1.43
(latest). The plugin's own record (197 pass, broken by hand, live runs on
www.workbuddy.ai) is in plugins f4d48ac.
Not tried: a live chat on the China build (401 to every token here), the
reporters' own OpenCode sessions, a moved account updated end to end.
2026-10-28 22:34:02 +08:00
yetone e2efbd3571 gui: a plugin page's host start reads its starter before it goes off on its own
pageHost starts the plugin host in a goroutine that can outlive the
page's wait, and that goroutine read the package's warmHost when it
ran. TestPluginPageStartsItsHost puts warmHost back in its cleanup,
so under -race the late read raced the write (seen in a whole race
run of internal/gui on mote). pageHost now reads it before the
goroutine starts.

Run on mote, at this tree (on origin/main 97b6a36c5 plus the maskrec
commit before it):
- go test -race -count=40 -run 'TestPluginPageStartsItsHost$'
  ./internal/gui: ok. With pageHost as it was: 1 DATA RACE in 40.
- go vet -tags nogui ./internal/gui for linux, windows, darwin: ok

Not changed: TestPluginPageReadsWhatItDeclared fails on its second
run in one binary (-count=2: "pageSetAllowed"); with -count=1 it
passes. Filed as #4076.
2026-10-28 22:32:07 +08:00
yetone b904cc22bf maskrec: the latest requests' bodies are kept zstd in memory, in 32 MiB (#2278)
The 脱敏 page shows a recent request as the vendor got it, so memory
kept the latest 100 bodies whole, up to 64 MiB. apple-ouyang's heap
profile on #2278 had gateway.sentOf holding 64 MB of them, a sixth of
the live heap, kept for a page that is rarely open.

Each body is now compressed (zstd, fastest, outside the store's lock)
as Hold takes it, held apart from the record, and decoded only when
SentOf asks. The budget counts stored bytes and is halved to 32 MiB:
a request carrying a screenshot's base64 hardly compresses. On real
local session files zstd -1 makes Claude Code's text 4 to 5 times
smaller, and a Codex rollout with screenshots 1.4 times.

Records in memory no longer hold a body at all, so Get has nothing
to clear.

Run at this tree (rebased on origin/main 97b6a36c5), on mote:
- go vet -tags nogui for linux, windows, darwin: ok (maskrec, gateway)
- go test -race ./internal/maskrec: ok
- go test -race -run 'Mask|Sent|Redact|Privacy|Tail' ./internal/gateway: ok
Before the rebase (at 6104e88aa), vet of ./... on three OSes was ok,
and the whole race run of internal/gateway and internal/gui had three
reds not of this change: TestTailOfReadsInPlace (fixed on main since,
4ca64c21b), TestMainWindowCorners (#3949), and a race in
TestPluginPageStartsItsHost (fixed in the next commit).

Broken by hand: keeping as many bytes as the body (the encoded body
padded to its size) turns TestSentKeptCompressed red: "a 1048712-byte
request is kept in 1069709 bytes".

Not tried: the footprint of a live gateway under real masked traffic.

Reported-by: apple-ouyang
2026-10-28 22:29:10 +08:00
yetone 97b6a36c5b gui: the sidebar's gateway names the LAN address while it is shared
coeo91 on Discord: with "Share on local network" on, the sidebar's line
still said "Gateway 127.0.0.1:3425". Shared, it now names where other
machines reach it: MAGPIE_PUBLIC_URL if set, else the address picked in
Settings (magpie.lanAddress), else the first LAN address. Its tooltip
names that and this computer's url. Not shared, it is unchanged.

- api.go: boot.js's sideGateway carries lan and lanURLs when shared, so
  the first paint is right.
- plugins/gateway/settings.js: sideLAN() picks the address and redraws
  the boot line once loaded (it loads after app.js); turning sharing
  on/off re-reads /api/providers and redraws, and picking an address
  redraws. The choice lives in the plugin so app.js and the core script
  budget stay under their limits (TestCoreScriptBudget passes); no budget
  raised, no new strings.
- app.js renderSideGw: uses self.sideLAN?.(g), tooltip adds " · " + url.

Run at this commit's tree, rebased on d4f1d6480 (after 581d64b7d's
lanPublic and the Gateway card; conflicts in settings.js and
public-url-default kept both sides), on mote (macOS 27, Playwright 1.62,
Chromium + WebKit, 5 languages):
- side-gateway-lan, public-url-default, public-url, sidebar,
  gateway-port, connect-address-kept, lan-public, lan-docker,
  gateway-card, browser-access, plugin-gateway, gateway-connect-keys,
  gateway-keys-empty, gateway-caller-keys, i18n-keys: 195 pass, 1 fail
  (i18n-keys "a plugin's words are its own", #4053, red on main).
- go test -timeout 45m ./internal/gui/...: only TestMainWindowCorners
  (#3949); budgets pass. gofmt -l clean; go vet ./internal/gui darwin,
  GOOS=windows, GOOS=linux -tags nogui ok.

Before the rebase (base 51e3169fb):
- side-gateway-lan (new), public-url-default, sidebar, gateway-port,
  connect-address-kept: 82 pass, 0 fail.
- gateway-caller-keys, i18n-keys, plugin-gateway, gateway-connect-keys,
  gateway-keys-empty: 47 pass, 1 fail (i18n-keys "a plugin's words are
  its own", red on origin/main 6104e88aa, #4053). gateway-caller-keys
  chromium en failed once at :137 in an earlier run and passed on the
  next; base 6104e88aa is red at the same line in webkit (#3797).
- go test -timeout 45m ./internal/gui/...: only TestMainWindowCorners
  fails, red on base too (#3949). TestCoreScriptBudget and
  TestBootSaysWhereItsGatewayListens pass.
- gofmt -l clean; go vet darwin, GOOS=windows ./..., GOOS=linux -tags
  nogui ./... ok (Go unchanged since).
- Full GUI suite: stopped at ~8,400 results under load 25-105 from other
  sessions (20 not ok). Each red file was rerun on base 6104e88aa; red
  there: gateway-key-models (#2648), header-centre (#3479), i18n-keys
  (#4053), key-replace webkit (#3476), menu-input-scroll (#3402),
  mobile-web (#3952), models-fold webkit (#4071, filed), quota-count-wrap
  webkit (#3404). credit-days, library-row-remove and plugin-github
  passed on rerun.

Broken by hand: origin/main's app.js -> side-gateway-lan red 10/10 at the
first-paint check (:35); without settings.js's /api/providers refresh ->
red 10/10 at the sharing-off check (:57); without the load-time redraw ->
red 10/10 at :35.

Not tried: the real app on a real LAN, the Linux and Windows GUIs, and
the rest of the full GUI suite past where it was stopped.
2026-10-28 22:26:02 +08:00
yetone d4f1d6480c plugin: a program a plugin starts with no folder runs in plugin-work, not beside magpie's settings
jiakun_zhao on X asked whose page_<hash>.html, magpie_home.html,
magpie_install.sh and magpie_*.md files they had found after using the
chat page plugin (Magiczerowxy/magpie-chat). That plugin starts the
user's MCP servers from the plugin host with node:child_process spawn
and no cwd, and runs their tools for a model. The host runs in magpie's
config folder (~/.config/magpie), so every file such a tool saved by a
relative name went beside settings.json and providers.json, and a tool
told to write "providers.json" would have written over magpie's.

host.js's spawn wrapper (which already hands on the proxy and keeps
programs off the host's stdio) now starts a program that names no
folder of its own in <config>/plugin-work, created on first use, with
PWD to match outside Windows. A folder the plugin gives is kept.

Not the cause of files in the user's home folder: magpie's host never
runs in ~, and no magpie code names a file page_<hash>.html or calls a
user's MCP tool itself. Files in ~ come from a process whose folder was
~: the chat's server started by hand (node serve.mjs) from ~, or
another agent run there. Filed on magpie-chat for the plugin to give
its MCP servers a workspace of its own and tell the model where it is.

Run (mote, macOS):
- TestPluginProgramsRunInTheirOwnFolder (new; testdata/clicwd checks
  child_process spawn, spawn with env, execSync and Bun.spawn, plus an
  own cwd kept): ok. Red with origin/main's host.js put back by hand
  (plugin-work not made; programs ran in the config folder).
- go test ./internal/plugin ./internal/agentplug ./internal/pluginrt
  -count=1: ok (plugin 261s).
- go test ./internal/gateway -run Plugin -count=1 at 581d64b7d: ok.
- Windows (xiaomi-gpu, win-run): TestPluginProgramsRunInTheirOwnFolder,
  TestPluginCLIHasTheProxy, TestFakePlugin: ok.
- gofmt -l: clean.
Not tried: the full go test ./... suite, the real magpie-chat plugin
with a real MCP server and model, Linux.
2026-10-28 22:20:56 +08:00
yetone 581d64b7d0 gateway: sharing lists this network's addresses first, and names one on the internet
The user whose network card holds a static public address (203.236.50.70,
27bf14790) asked on Discord, on the latest version, whether "Share on
local network" should be exposed at a public address. LANHosts kept the
interfaces' order, so the public address came first: Settings offered it
as the share address by default, and the Gateway page listed it under
"Local network". The gateway does answer there while shared (it listens
on every address), behind a gateway key, and nothing said so.

- LANHosts puts private addresses first (RFC 1918, 100.64/10 for
  Tailscale, 198.18/15 for proxy TUNs), the public ones after in the
  interfaces' order; LANURLs, magpie web's links and the CLI follow.
- gateway.PublicIP / PublicURLs name the internet ones; /api/settings
  and /api/providers' gateway give them as lanPublic.
- Settings marks such an address "On the internet" in the picker, and
  picked, the row says anyone online can reach magpie there with a key
  and to list the network's range under Allowed addresses (or, with a
  list, that only it gets in). The Gateway page lists it under "On the
  internet", not "Local network". zh, zh-TW, ja, de.
- Not changed: with no allow list every address is still let in.
  Refusing internet peers by default would shut out networks whose
  computers all hold public addresses (campus networks, this user's ISP
  setup), so the address is named and the allow list pointed to instead.

Run on mote at 4ca64c21b plus this change: gofmt; go vet ./internal/gateway
./internal/gui; GOOS=windows go vet ./internal/gateway ./internal/gui;
GOOS=linux go vet ./internal/gateway; go test ./internal/gateway -run
'LAN|Lan|URL|TLS|Public|Network|Share|Allow|Container' ok; go test -tags
nogui ./internal/gui ./internal/cli ok; node --test lan-public (new),
lan-docker, gateway-card, gateway-connect-keys, public-url,
browser-access, i18n-keys: 73/74, the red is i18n-keys' "a plugin's
words are its own" on routing's "masking…", #4053, red on main. Every
file using the caller-keys fixture (changed: lanPublic) at a8c71f198:
the reds are gateway-key-cycle, gateway-key-limit and a flaky
connect-snippet-shell, the same on untouched a8c71f198, filed as #4072.
Broken by hand: public-first order turns TestLANHostsKeepAPublicAddress
red; no Settings note, or no Gateway-page split, turns lan-public red
(3/3 chromium).
Not tried: a real machine with a public address on its card.
2026-10-28 22:15:00 +08:00
yetone 4ca64c21b2 gateway: a conversation's tail is made in a slice of its size, so -race counts one copy (#4004)
TestTailOfReadsInPlace was red in both Race jobs at ca499953e (run
40696645744): 2686576 bytes allocated for a 1314661 byte tail, over its
want+body/4 budget. Under -race bytes.Buffer.Grow's append-make pattern
allocates the slice twice (a -memprofilerate 1 profile on mote:
bytes.growSlice 2576kB, two copies of the tail); without -race it is one
(1367680 bytes). tailOf now appends into make([]byte, 0, n), one
allocation either way. Same bytes out.

Run on mote (M5 Pro) at this tree:
- old code, -race -count=8: red 8 of 8, 2686576 bytes each time
- go test -race -count=5 of tool_loop_test.go's six tests: ok
- the same without -race, -count=5: ok
- go vet ./internal/gateway for darwin, linux, windows: ok
Not run: the full suite (one function body changed, its tests above).
2026-10-28 22:09:53 +08:00
yetone a8c71f1987 library: an opaque logo has no white corners
The user's MCP servers page drew Linear's, Context7's and GitHub's
logos (GitHub avatars, opaque) with a white fringe at each of the four
corners. The tile (.mk-icon) had a white background under the picture,
and its rounded clip's soft edge let that white through. The white now
sits on a plate 1px inside the tile (::before, border-radius inherit),
which the clip never reaches, so an opaque logo meets the row's own
background at its corners. A logo with see-through parts (an .svg) still
sits on white, an initial keeps its grey (no plate), and the skeleton
looks as before. The same tile is the library rows' 26px/24px logo, the
market cards' 36px and the market sheet's 44px.

Tried first in a page of the three real avatars at 2x in WebKit and
Chromium: background:none removed the fringe, clip-path inset(round)
beside or instead of overflow:hidden did not.

New: internal/gui/tests/market-icon-corners.test.cjs, dark theme, 2x,
every language, both engines. It reads the tile's own pixels: no corner
of an opaque black logo is brighter than the card plus 30, an svg tile
is white along its edges, and an initial's tile is not white.

Run (mote, at this commit's tree on origin/main ca499953e):
- market-icon-corners: 8/8 ok.
- Broken by hand: the old library.css with the new test, 8/8 red
  ("corner at 0,0: 76 against the card's 35" in Chromium, 75 in WebKit).
- Every GUI file that loads the library page, its market or MCP views,
  plus i18n and the font files: 60 files, 1018 tests, 1017 ok. The one
  red, i18n-keys "a plugin's words are its own", is red the same at a
  fresh origin/main 6104e88aa (#4053, a masking.go comment).
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, the
  same at origin/main 6104e88aa (#3949, macOS 27); everything else ok.

Rebased after the run onto 6104e88aa, which changes internal/usage only.

Not run: the whole GUI suite (the change is one plugin's stylesheet;
the files above are every one that loads it or reads .mk-icon); the
real app on Linux WebKitGTK.
2026-10-28 22:00:25 +08:00
yetone 6104e88aa9 usage: a session file two queries read at once is made once (#2278)
At a cold start with the app open, the warm-up's request page and the
GUI's heatmap each read every session file at the same time. Each one
decoded and priced its own chunk of each file. That is twice the CPU,
and the GUI's requests queued behind it. sharedBuild keys a build by
the request state (root and meta, hashed) and by the file's path, size
and time. A query that finds the same file already being made waits
for that build, then takes its own shallow copy, because a query writes
its chunk's serial, use and archive place. The rows and the archive are
shared and only read. If the build panics, the waiter builds its own.
Only QueryPage and the effort index share builds; queryPage's other
callers build as before. blockPricer.share now takes the hashed state
directly.

Measured on mote with synthetic history at #2278's scale (25k Codex
rollouts, 9k Claude sessions, a 115 MB usage.jsonl), with a cold
`magpie web` and 10 GUI endpoints polled every 5 s for 150 s. Built on
v0.1.1903 before the rebase:
- slowest GUI response: 61 s on v0.1.1903, 15.3 s with this change
- footprint peak: 591 MB on v0.1.1903, 609 MB with this change, so no
  memory gain; the peak is a transient spread over the page, heatmap,
  effort index and session stats (heap profile at 15 s: QueryPage
  145 MB, HeatmapOf 87 MB, buildEffort 51 MB, StatsAndNative 43 MB)

TestSharedBuildMakesAFileOnce checks several things:
- a second query waits for the first one's build
- each query gets its own copy, and the copies share one archive
- a change to one copy doesn't show in the other
- the map is empty afterwards
- after a panicked build, the waiter builds its own
With the join broken by hand (the lookup disabled), it failed with "a
file made again while another query was making it".

Run at the pushed tree (rebased onto ca499953e, after b7b817116 and
84a6a2c42 changed request_page.go), on mote:
- go test -race -tags nogui ./internal/usage ./internal/sessions: ok
- go vet -tags nogui ./internal/usage for linux, windows and darwin: ok
Not run: the full suite, and the footprint run at the rebased tree.
2026-10-28 21:40:12 +08:00
yetone ca499953e7 gui: a plugin page with a host part starts the host when it opens
guesssssssswhat on X: the Magiczerowxy/magpie-chat page ("对话") sits
on its loading text and never opens. The page says hello and then
navigates its frame to http://127.0.0.1:3477, a server the plugin's
index.mjs starts inside the Bun host. The host was started only by a
call: at launch while providers are first read, and after a Restart
(a plugin installed, updated or set, a Bun update) or a crash only once
something asked a plugin again. With the host down, WebKit (the macOS
window's WKWebView, WebKitGTK) leaves a frame whose navigation is
refused on its old document with no error, and the hello had already
cleared the 10s broken timer, so the page waits forever. Chromium shows
chrome-error instead.

Now serving the entry HTML of a page or panel whose plugin is not
page-only starts the host if none is up (plugin.Warm), waiting at most
7s, then serves the page. Page-only plugins, and the page's other files
and the bridge, don't touch the host.

Reproduced on mote (sandbox HOME, magpie web on a free port, plugin
0.1.16 from GitHub): with its 3477 listener killed, old main's page
stays on "正在连接到本地对话服务…" in Playwright WebKit (chrome-error
in Chromium); the fixed build restarts the host on open and the chat UI
loads in both engines. In the real macOS app (wails://) the frame
reaches 127.0.0.1 (seen by a logging server). TestPluginPageStartsItsHost
is red with the pageHost call removed by hand.

Run at this head (84a6a2c42 + this), on mote: gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build; go test ./...
-timeout 45m: every package ok except internal/gui's
TestMainWindowCorners/macOS_26_SDK, red on macOS 27 and filed as #3949
(titlebar, untouched here). plugin-page.test.cjs and
plugin-kinds-discover.test.cjs, Chromium and WebKit, 14/14 each.
Rebased on 29181eb78 (usage, gateway; no file here), then go vet and
go test ./internal/gui/ ./internal/plugin/ again: same, only #3949 red.
Pushed on b586fdf1e, whose two commits (app.css, usage pricing) weren't run with this.
win-run: go test -run 'TestPluginPage|TestWindowPage' ./internal/gui/
./internal/plugin/ ok.

Not tried: the reporter's OS and magpie version; the real Windows and
Linux app windows (wsl-run can't build internal/gui: no gtk4 or
webkitgtk-6.0 dev packages in magpie-desktop, internal/plugin ok); a
real Restart in the background (simulated by killing the host); the
full GUI suite (no asset changed). magpie-chat 0.1.9 to 0.1.13 had no
main or exports, so they are page-only and no host ever starts them;
0.1.14 restored main, and that's for the plugin to tell its users.
2026-10-28 21:27:47 +08:00
yetone b586fdf1eb gui: every page keeps its scrollbar's room, so nothing opening in it narrows the page
The owner, on Agents: opening an agent's details ran the page past the
window, the scrollbar appeared, and the whole page went 8px narrower in
one frame (and back when it closed). Every page had this; only Usage
and Routing kept the bar's room (87d83e7ab).

- .view is overflow-y: scroll everywhere, so the bar's room is always
  kept. Its track is transparent (the app's own thin bar, 8px on the
  Mac, 10px on Windows and Linux), so a page that fits shows nothing
  there. The Usage/Routing rule it replaces is gone.
- A framed dialog's fields did the same on Windows and Linux; they keep
  the 10px too, out of their right padding, as the Mac's already did.
- Between 601 and 640px the agent row's start-model picker is 184px,
  not 196px, so the name keeps the 150px agent-layout holds it to.

Test: page-width-steady, both engines, Mac's bar and Windows' bar:
every page this fixture opens (>= 8) grown past the window keeps its
width, and so does a framed dialog's body; an agent's details opened
past the window move its row by 0px, in all five languages.

Run on mote at this head (29181eb78 + this): page-width-steady,
agent-layout, heatmap-scrollbar, routing-ctx-still 40 of 40; go test
-run Budget ./internal/gui ok. Before the last rebase, 49 GUI files
that measure widths or scrollbars (panel-*, gui-* languages and
others), both engines: 593 of 600; the reds were agent-layout webkit
en at 601px (fixed above, then 24 of 24) and usage-ledger's "newest
live route" in both engines, red the same on the base (#3104).

Broken by hand: the old app.css with the new test is red in all 16
(8px narrower on the Mac, 10px with Windows' bar); without only the
dialog rule, the two Windows cases are red (fields 10px narrower).

Not tried: the whole GUI suite (mote is running another session's;
it runs after this push), and the real Windows and Linux apps.
2026-10-28 21:26:37 +08:00
yetone aafbe575ce usage: queries reading at once share one priced copy of a gateway block (#2278)
A query over the gateway's history decodes and prices every block it
reads and holds them until it is done. At a cold start with the GUI
open, the warm-up's page, the heatmap and Codex's model/effort each ran
such a query at the same time, and each held its own copy: 105 MB of
pooled rows between them at the peak, and the app's footprint went to
737-760 MB where it is 388 MB with nothing asking.

A priced block is now kept in sharedPriced, by the frozen block and a
hash of what prices and names a call (requestState.meta and root), while
any query holds it; the last release hands its rows back to the pool.
A block is never changed once frozen, and a priced copy is only read:
pairing clones a chunk before it writes a row's thread. A pricer that
was not given a meta (the tests' own) keeps its blocks to itself, as
before. Both callers release on a panic too (defer), so a block is never
held for good.

Run on mote (M5 Pro), rebased onto 012c584cc, then 29181eb78 (a gateway
test only), and run again after each:
- go test -race -count=1 -timeout 45m ./internal/usage: ok (38s at the
  pushed head, 42s and 70s before). ./internal/gui: TestMainWindowCorners/macOS_26_SDK
  red only, #3949 (macOS 27, untouched here).
- TestPricedBlocksSharedWhileHeld (new): ok. Broken by hand (block()
  never sharing): red, "two queries of one meta priced 0x...080 and
  0x...380".
- GOOS=linux/windows/darwin go vet -tags nogui ./internal/usage: ok;
  gofmt -l clean.
- #2278's reproduction: a synthetic HOME of 25k Codex rollouts (40 of
  them ~120 MB), 9k Claude sessions and a 115 MB usage.jsonl; cold
  `magpie web` for 150s with every GUI usage/sessions endpoint polled
  every 5s from 2s on:
    before (v0.1.1900 tree): footprint peak 760.4 MB, RSS peak 1018 MiB,
      heap before GC peak 663 MB
    after:                   footprint peak 591.1 MB, RSS peak 867 MiB,
      heap before GC peak 513 MB
  The pool's live rows at 33s: 104.7 MB before, 49.5 MB after.

Not tried: the reporter's own history; a Windows or Linux run (no
OS-specific code).
2026-10-28 21:25:04 +08:00
yetone 29181eb78e gateway: the 64MB body tests get room before routing under -race only (#3957)
TestLargeRequestEndpoints and TestRequestTailAfterOldLimit went red on
main's Race jobs (macOS at ec6c2de52 and 56602426d, ubuntu at
874b86653): the Codex backend subtest's oldBodyLimit body was answered
magpie's own 504, "held this request for 30s without routing it".

Profiled on mote (M5 Pro): the subtest takes 0.89s without -race and
22.4s with it. 62% of the CPU is the race runtime itself and the rest is
the body's scans before routing (skipJSONSpace, decodeJSONIn, trimJSON,
bodyEffort, metadataOf), each instrumented per read. CI runners are
slower and share the shard, so 50 to 58s. A user's machine sees the
0.89s, far inside the 30s cut, so the cut is right and the test's
clock under -race is what's wrong.

largeBodyRoom lifts unroutedUnknown and unroutedMost to 10 minutes when
raceOn, for the three tests that serve such a body through the handler
(TestLargeRequestEndpoints, TestRequestTailAfterOldLimit,
TestCodexCompressedTailError). Without -race the 30s cut stays, so a
scan made 30x slower still fails them.

Run at this tree (origin/main 0dc4cec85..):
- Reproduced: with no room and a 10s cut under -race, the Codex subtest
  gives CI's message word for word ("held this request for 10s").
- With the room, -race: the three tests and TestUnrouted* ok (179s).
  Without -race: those three and TestCodexBodyReadsPastOldLimit ok (10s).
- go vet ./internal/gateway, with -tags race, GOOS=linux, GOOS=windows ok;
  gofmt -l clean.
Not run: the full ./... suite; the shard's 20m budget on CI (the next
Race run shows it).
2026-10-28 21:19:08 +08:00
yetone 012c584cc1 usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one
model's, to measure a local model fresh after deploying it.

The Usage page's Models list has a "…" on each row (and a right-click
menu) with "Clear usage…", and "Clear all usage…" sits under the lists
below the "Counted from…" note. Each asks first, in a confirmation that
says what is deleted, that it can't be undone, and that key spending
limits and allowances still count the calls.

A clear is a mark in settings (usageCleared: provider, model, unix ms),
read at read time; usage.jsonl is never rewritten. The Overview hides
calls up to the mark in summarizeFrom; the Requests page, heatmap and
ledger/CSV hide them in Filter.keepsRow, their one choke point, and the
request index's meta carries the marks so its cache is dropped. Key
budgets, window holds and Codex reads go through usage.Visit and the raw
log, so a clear never resets a key's spending limit or a quota. A later
clear of the same model or of everything takes the place of an earlier
one. The marks ride the settings part of a sync (sync-backup.md) and a
save of the Settings page keeps them (api.go's keep list; the guard
test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing).
gateway-sessions.md and sync-backup.md say so.

Run on mote (mote-run) at this tree, rebased on origin/main c26b2992e
(the Go packages and usage-clear.test.cjs; vet and the 68 GUI files
ran at the earlier base f835bd713, four commits behind):
- go test -tags nogui -timeout 45m ./internal/usage ./internal/settings
  ./internal/usageapi ./internal/gui: all ok after the
  keep-list fix (before it, TestSettingsSaveKeepsWhatItDoesNotSend red).
- gofmt -l: clean. GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: exit 0. (Linux vet without nogui fails in
  wails' cgo, as on main.)
- usage-clear.test.cjs: 32/32 in Chromium and WebKit, en/zh/zh-TW/ja/de,
  at 1200, 560 and 390 (web). With the old page.js/client.js/i18n.js it
  fails (TimeoutError).
- 68 GUI files the change can reach (every usage-*, gui-de/ja/zh-tw,
  i18n-keys, click-scroll, idle-ticks, mobile-web, panel-usage,
  sessions-purge): 941/980. The reds are filed and red on main
  (usage-ledger run alone at origin/main 84a6a2c42 too): i18n-keys "masking…" (#4053), mobile-web
  (#3952), usage-agents-hide (#2276, #3414), usage-ledger "newest live
  route needs no return-to-live button" (#3104, run alone at main too).
  i18n-keys first also named "Clear usage…" in Go comments of this
  change; reworded.
Broken by hand, each red: hides() always false (usage and gui tests),
keepsRow's clear check removed ("Requests after the clear: 5 rows"),
clearedKey out of the request meta ("after clearing everything: 3"),
the api.go keep line removed (UsageCleared [] after a save).

Not tried: the full go ./... suite and the whole GUI suite (mote was
busy with other sessions' full suites), the real app, a sync between
two computers. usage.jsonl doesn't shrink, and the Sessions tab's
figures are not cleared.
2026-10-28 21:13:09 +08:00
yetone c26b2992e8 gateway: a handed-off gateway waits for a connection still answering its request, not only new and idle ones (#3451)
68ab4c06d made the end of a handed-off gateway wait for idle kept-alive
connections, so their next request is answered here instead of cut by
Shutdown. Its test went red on main's ubuntu CI at 56602426d (run
40682193794): `"" unexpected EOF`. net/http notes a connection idle
only once the goroutine that wrote its reply returns from the write,
and the agent can read that reply and the end can begin first. Then the
wait saw the connection as neither new nor idle, Shutdown began, and
closed the connection as idle once net/http noted it, cutting the
agent's next request: the same #3451 cut, on a busy machine.

unreadConns now keeps a connection from StateActive until it is closed
or hijacked (kept), and the wait counts those too. A connection never
used again still ends the wait at unreadWait (5s), as before.

TestHandedOffGatewayAnswersAConnectionStillAnswering holds the gateway's
write of the chunked reply's end for a second (lagConn), and hands off
while it sits there, for both a handover and `make dev`.

Run at this tree (origin/main f835bd713 + this):
- Reproduced first: a 300ms sleep injected before note's StateIdle gave
  CI's error in the existing kept-alive test, both subtests; green with
  the fix under the same injection.
- The new test on the old handover.go: red, `"" unexpected EOF`, both
  subtests. A first version lagged the first write, which wasn't the
  reply's end, and passed on the old code; it now lags the end.
- mote: TestHandedOffGateway* -race -count=3 ok; go vet
  ./internal/gateway for darwin, GOOS=linux, GOOS=windows ok;
  go test ./internal/gateway ok (481s); ./internal/gui red only on
  TestMainWindowCorners/macOS_26_SDK, #3949 (mote's macOS 27).
- WSL magpie-desktop: TestHandedOffGateway* -count=3 ok.
- gofmt -l clean.
Not run: the full ./... suite; a real update restart under a busy agent.
2026-10-28 21:08:02 +08:00
yetone 84a6a2c420 sessions: a range's session list is made to its size (#2278)
statsRead grew out.Sessions by append, so 34k sessions' list (Summary
is ~480 bytes) held up to a quarter more than its rows, 19.4 MB in the
heap after a cold start at #2278's scale, and copied itself through
every size on the way. Each range statsFor keeps holds its list. It is
now made with room for the range's sessions (shares holds only those
with a day in range), and Keys with room for the list.

TestStatsHoursAndSessions checks the list and keys hold their rows and
no more. Broken by hand (the make removed) it failed with "3 sessions
held in 4".

Run at this change (mote): go vet -tags nogui of internal/usage and
internal/sessions for linux, windows and darwin ok; go test -tags nogui
./internal/usage ./internal/sessions ok.
Rebased onto 60561129f and run again at the pushed tree: the same
three packages (usage, sessions, codexcat) ok.
2026-10-28 20:53:36 +08:00
yetone b7b8171165 usage: a source's chunk is kept once, the index's and the page's both (#2278)
readRequestBlocks copied every source's chunk twice, one for the index
and one for the page, on every read: 13.5 MB of the 176 MB live heap
after 34k sessions' cold start (synthetic history at #2278's scale on
mote, 240k gateway records in usage.jsonl). Nothing writes a published
chunk in place (pairRows and pairMemo.apply clone, keep copies, the
spill gives an archive back before the read returns), so both now take
one chunk. A chunk this read built or read from disk is its own and is
not copied at all; one an earlier read published is copied once, for
its Used, since that read's page may still hold it. The other
computers' days are kept the same way.

TestRequestBlocksKeepOneChunkASource: a built chunk is the map's and
the page's one pointer, with this read's tick; read again after keep, it
is one new copy and the published one is unchanged. Broken by hand
(the index given its own copy again) it failed with "a built chunk is
copied".

Run at this change on 0dc4cec85 (mote): go vet -tags nogui of
internal/usage and internal/sessions for linux, windows and darwin ok;
go test -tags nogui ./internal/usage ./internal/sessions ok. Rebased
onto 60561129f (GUI and codexcat changes), then go test -tags nogui
./internal/usage ./internal/sessions ./internal/codexcat ok again at
the pushed tree.
Not measured apart: the cold-start footprint run on mote ran beside a
full suite (load ~40) and isn't comparable; the heap line above is from
the profile before this change.
2026-10-28 20:53:36 +08:00
yetone 60561129f8 codexcat: two entries Codex's picker would name the same are told apart by their provider's id (nb5p on Discord)
nb5p had GPT-6.1-Sol from two providers both called Codex, and Codex's
model picker showed two identical entries, the hover text identical too.
Now, only when two listed entries would have the same display_name,
each gets its provider's id after it ("GPT-6.1-Sol · Codex · codex-b"),
or its own model id where the provider's doesn't tell them apart (a
routing group, two of one provider). Every other entry is unchanged.

Only display_name changes. The description and catalog Model.Name are
as on main. Codex puts each of the first five catalog models'
description into spawn_agent's "Available model overrides" (codex-rs
multi_agents_spec.rs spawn_agent_models_description, and
context/world_state/model_catalog.rs with model_catalog_in_context),
which goes upstream on every request; the real Codex 0.162.1 bytes in
internal/redact/testdata/codex-0.162.1-request.json show "- `fake/m1`:
m1 · fake via magpie". magpie's own spawnChoices sends Name. So the
first try (provider/account in the description) was dropped: it would
have sent the account's email upstream. display_name: read in codex-rs
at 5d5e5c5 (cloned on mote), core builds no prompt or tool text from a
model's display_name (model_catalog.rs and spawn_agent_models_description
use slug + description + efforts + tiers only); in the captured Codex
requests the name appears only inside the description. The id is in the
slug already, which is sent anyway. Apart is in the Model's JSON, so it
is in the list's tag and Codex asks for the list again when it changes.

Run (mote, at the rebased head):
- TestCodexPickerNamesSameNamesApart (internal/provider) and
  TestCodexApartInDisplayNameOnly (internal/codexcat): pass.
- Broken by hand: codexApart never marking a pair, and shownName
  ignoring Apart (the old behaviour): both tests FAIL, e.g.
  codex-b/gpt-6.1-sol shown as "GPT-6.1-Sol · Codex", want
  "GPT-6.1-Sol · Codex · codex-b".
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: all ok (at base 7e58591dc + this change)
- go test -tags nogui -timeout 45m internal/codexcat internal/catalog
  internal/provider internal/agent internal/gateway: all ok (provider 111s, agent 177s, gateway 559s)

Not tried: a real Codex picker with two same-named providers (no
second Codex-named provider in a sandbox here); the full ./... suite.
2026-10-28 20:50:15 +08:00
yetone f835bd713d gui: the Gateway page is one compact card, shares on the network from itself, and a key's copy sits by the key
The owner on the Gateway page: "一点都不精致、优雅", the key row's copy
button "很奇怪的位置,太突兀了", the gateway icon ugly, Connect should
start folded, and "Share on local network" should be picked on this page
with the LAN addresses shown. Agreed on a canvas first.

- The status row has the sidebar's server glyph in a 28px tile with two
  lights (green running, amber not), the state beside it and the fix
  button at the right. The address pill left the row.
- Under it, in the same card: Share on local network as This computer /
  Local network segments (settings/lan, as Settings does), and every
  address the gateway answers on, each with its own copy: this computer
  (or the public address on the web), then the LAN addresses, or a line
  saying there are none. Settings' container note comes from the same
  lanShown(). The "open LAN settings" button is gone.
- A key's row: its copy right after the masked key; Rotate key and
  Remove moved into a "…" (Key actions) row menu at the end.
- Connect starts folded; opening it is remembered
  (magpie.gwConnectFolded).
- At narrow widths the status row wraps and the address list is a
  label/value grid, so no language overflows at 420px.

Tests: new gateway-card (5 languages x 1100/420 x chromium/webkit): the
lights, Connect folded, sharing from the card with every address and a
copy of a LAN one, no scroll, the copy within 6px of the key, the … last
with its menu, nothing overflowing, no left borders. Tests that used
Connect open now open it; Rotate/Remove go through the menu
(fixtures' keyAction).

Run on mote, at the tree before the last rebase (51e3169fb + this):
gateway-card 52 of 52 over both engines; every GUI file this touches
in both engines green except gateway-caller-keys' webkit en 560px
overflow, red 3 of 3 at the base too (#3797). go test ./internal/gui:
budgets ok; TestMainWindowCorners/macOS_26_SDK red on mote's macOS 27
alone (#3949). At this head (0dc4cec85 + this; main touched no GUI
file since): gateway-card, gateway-fold, gateway-caller-keys 26 of 26,
go test -run Budget ./internal/gui ok.

Broken by hand: the copy moved after the spacer -> "the copy follows
the masked key" red; the fold default put back -> gateway-card and
gateway-fold red; the LAN addresses not rendered -> gateway-card times
out.

Screenshots looked at: zh 1100 and de 420, shared.

Not tried yet: the whole GUI suite (mote was busy with another
session's; it runs after this push), and the real Linux/Windows apps;
the change is CSS and DOM in a page the GUI suite loads as the app does.
2026-10-28 20:46:38 +08:00
yetone 0dc4cec85d usage: a row's Codex thread is kept as a 4-byte place, not a string (#2278)
Every row of a chunk had a 16-byte string header for its Codex
thread. A day's rows are a few hundred threads, one after another. At
the scale of #2278 (34k session files, 1M Codex rows), these headers
were the largest single holder in the heap, 24.5 MB of 184 MB live.
codexActors now keeps a []uint32 into the chunk's thread names. The
row before's thread is checked first, then the names. A clone shares
the names clipped, so adding a name to one never writes into the
other. The disk format is unchanged: each row's thread is still
written as a string.

Measured on mote, at 7e58591dc's parent with this change. The history
is synthetic: 25,000 Codex rollouts and 9,000 Claude Code sessions, 40
turns each (13 GB), plus a 115 MB usage.jsonl of 240k gateway calls on
the newest 3,000 of each. Cold `magpie web --no-open` in a sandbox
HOME, with `magpie heap` taken at 130 s:
- main: live heap 195.2 MB (both runs), physical footprint peak 389 to
  417 MB.
- this change: live heap 175.6 MB, physical footprint peak 366 MB.
The reporter's 0.1.1318 peaked at 2.85 GB RSS on such a history.

Run at the pushed head (rebased onto 7e58591dc, rerun after):
- GOOS=linux, windows and darwin go vet -tags nogui ./internal/usage/...
  ./internal/sessions/... ./internal/gateway ./internal/cli: ok.
- go test ./internal/usage/... ./internal/sessions/...: ok.
TestCodexActorsTakeFourBytesARow: 100k rows of 200 threads hold at
most 5 bytes a row, read back, and a clone keeps its own rows. Broken
by hand (no lookup of a name already held) it goes red.
Not run before the push: the full suite. It runs next.
2026-10-28 20:43:10 +08:00
yetone 7e58591dcf sessions: Grok Build's tool calls and skills are counted (MaxMooreMy on X)
MaxMooreMy on X, after v0.1.1870 counted Codex's skills: "grok build 好像
也不支持。grok build 的工具调用啥的也没采集到". Usage > Sessions showed no
tool use and no skills for Grok Build.

Cause: parseGrok only ever read the first prompt and "turn_completed"
usage from updates.jsonl; nothing counted a tool call or a skill.

What Grok Build writes (grok 1.0.67, run headless in a sandbox
HOME/GROK_HOME, never the live ~/.grok): each call is one
"sessionUpdate":"tool_call" line, its name in _meta["x.ai/tool"].name
(also the line's title), followed by "tool_call_update" lines for its
progress. Grok has no skill tool: its prompt lists every SKILL.md by
absolute path, and the model calls one up with read_file (rawInput
.target_file) or a run_terminal_command, as Codex does. A user's
/<name> prompt is written to updates.jsonl as typed; the skill's text is
put into the prompt only in chat_history.jsonl (<skills_referenced>).
An unknown /nonexistentzz is written the same way, and Grok's own
commands (/compact) carry _meta.hostTurn.

Fix: a tool_call line counts its tool, and the skills its read_file path
or command reads (skillReadsIn, the loop cxSkillReads already had, now
shared). A non-hostTurn /<name> prompt in the main session counts skill
<name> when a skill or command of that name exists where Grok finds them:
.grok/.agents/.claude/.cursor skills/<name>/SKILL.md or commands/<name>.md
from the session's cwd up and in the home folder, $GROK_HOME/skills and
commands, and $GROK_HOME/bundled/skills. cacheVersion 26 so kept parses
are read again.

Tests: TestGrokToolsAndSkills runs on four real sessions captured from
grok 1.0.67, updates.jsonl and summary.json byte for byte (only the
encoded cwd folder name shortened): a cat + a read of greet-user's
SKILL.md (2 tools, 1 skill), /greet-user (1 skill), /nonexistentzz and
/compact (none, with a "compact" skill present). TestGrokSlashSkill
covers repo-level .claude/skills, cwd .grok/commands, bundled skills,
~/.agents/skills, paths, "..", and mid-text slashes.

Run (on mote, through mote-run, at this tree on origin/main 27bf14790):
- new tests at the old grok.go/codex.go/sessions.go: red ("tools 0 []")
- hostTurn guard broken by hand: red (/compact counted as "compact")
- go test -count=1 -timeout 45m ./...: 76 packages ok; one red,
  internal/gui TestMainWindowCorners/macOS_26_SDK on mote's macOS 27,
  already filed as #3949 and unrelated (sessions isn't in its path)
- go vet, GOOS=linux go vet, GOOS=windows go vet ./internal/sessions: ok
- gofmt -l internal/: clean

Not tried: skills from Grok plugins/marketplace (installed-plugins was
empty here, layout unknown), so a /<plugin skill> isn't counted; a /name
skill whose folder was deleted since isn't counted when the file is read
again; the TUI (only headless grok -p sessions were captured); Windows
and Linux runs of the Grok CLI.
2026-10-28 20:28:27 +08:00
yetone 4cc331bab4 gateway: a Chat relay's text-part contents go as a string (Atria on Discord)
tim072844 on Discord: a custom provider on OpenAI compatible (Atria,
Shanghai AI Lab's Intern discovery API, model Atria-Dawn) answered
DeepSeek Harness with 238 validation errors saying `input` must be a
string. That "input" is pydantic's wording for the value it rejected,
not a Responses field: DeepSeek Harness (pi-ai's openai-completions)
sends every user message's content as a list of text parts, the gateway
relays a Chat client's body as it came, and that server's Chat schema
takes content as a string alone.

passthrough's Chat case now runs textPartsAsString: a content list made
only of {"type":"text","text":...} parts goes as their text joined by a
newline (as vLLM renders such a list). A list with an image, a file, a
thinking part, cache_control or any other key stays as it is. Every
other byte of the body stays as sent, and a body with no such list
comes back byte for byte. This covers every Chat-protocol upstream, not
Atria alone; buildChat's translated requests already sent strings.

TestChatRelayLeavesOutEmptyAssistant's "blank parts" case now expects
the joined user text as a string, since the parts are flattened before
silentAssistantsOut joins the two user turns.

Run (on mote, worktree at this commit's tree):
- go test -run 'TestChatRelayTextPartsAsString|TestTextPartsAsStringOnlyPlainText|TestChatRelayLeavesOutEmptyAssistant' ./internal/gateway: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (553.6s); again after rebasing on 56d26f0bb, ok (603.4s)
- gofmt -l: clean; go vet darwin, linux (nogui), windows: ok

Broken by hand: with the textPartsAsString call commented out,
TestChatRelayTextPartsAsString is red (422 from the fake, the same
"Input should be a valid string" per list); green with it back.

Not tried: no Atria key, so no real request. The vendor answers 401
before validating a request without one, so its exact schema is
inferred from the reported error wording and pi-ai's source, not seen.
2026-10-28 20:24:00 +08:00
yetone c2aad3db02 redact: a wallet address goes as written, and an IP as a documentation address the agent can use
0x0_air on X (10-28): with masking on, the agent stopped and asked again.
Their EVM address (0x89dfBD9b…, public) went as a secret placeholder and
the vendor's model told them to rotate it in case it was a private key;
the server IP they typed went as {{IP_…}} and the model refused to ssh
to it and asked for the real host.

- model.go: the local model's SECRET/ACCOUNT span on 0x and 40 hex
  digits (evmRe) is left as written; no rule matched it, the model's
  label did (the 0x prefix and mixed case got past hexRe). A 64-hex
  private key is masked still, and so is a 40-hex value called a key
  (secretCued).
- shape.go: an IP the IP rule masks goes as an address from the
  documentation ranges (192.0.2/198.51.100/203.0.113 .101-.254, IPv6
  2001:db8::/32), stable for the value, never shared by two values
  (falls back to {{IP_…}} past 462 IPv4 ones), and put back only as a
  whole address in replies and streamed tool calls (restoreAddr).
  Preview shows the same stand-in.
- docs: gateway-routing.md, and masking.html in en/zh/ja.

Run:
- Real models through the local gateway, the screenshot's ssh prompt
  with the placeholder vs a documentation address: with
  {{IP_k3v9x2mq}}, deepseek-v4-pro, glm-5.3, kimi-k3 and
  claude-sonnet-5-5 mostly searched ~/.ssh or asked for the real IP;
  with 203.0.113.147 or 192.0.2.183 all 20 runs over 5 models ran ssh
  at once.
- New tests (internal/redact/standin_ip_test.go): the screenshot's
  message, the tool call restored whole and streamed cut at every byte,
  boundary cases, IPv6, 472 addresses never sharing, the screenshot's
  address under labels secret and account_number with every category
  on, and a 64-hex key still masked. gateway TestRedactedKinds now
  wants a documentation address upstream.
- Broken by hand: without the evmRe check TestEVMAddressGoesAsWritten
  is red for every text and label; without restoreAddr the boundary
  cases are red; without the IP stand-in all three IP tests and
  gateway TestRedactedKinds are red.
- On mote at this head (rebased on 27bf14790): gofmt -l, go vet
  ./... for darwin, linux (-tags nogui) and windows, go test -count=1 -timeout 45m
  -tags nogui ./... (and go build for
  darwin, linux -tags nogui and windows): every package ok, exit 0.
  The run before at 56602426d had TestMoreKinds red, which wanted
  {{IP_…}}; it now wants the documentation address.
- Rebased again on 56d26f0bb (two gateway commits, #4004): go vet
  and go test -tags nogui of internal/redact, internal/gateway and
  internal/maskrec on mote at this head: ok.

Not tried:
- the real AstrLink model on an EVM address (the fake model gives it
  the labels it can give);
- a host name (user@host) still goes as {{HOSTNAME_…}};
- a documentation address the user writes themselves can match a
  stand-in in a reply and be put back as the real one;
- stand-ins are not kept across a restart or once their slot is
  evicted, like every placeholder.
2026-10-28 20:23:38 +08:00
yetone 04749d926d LESSONS: a release published after a newer one takes Latest and the tap (seen 10-15, 10-28)
Records the second day of the Latest mark going to an older release,
and that magpie-releases ee73d7a fixes it in the publish step. Docs
only; nothing run.
2026-10-28 20:20:50 +08:00
yetone 56d26f0bba gateway: a conversation's list is looked at where it sits in the body, not copied (#4004)
gjson.GetBytes copies the value it finds. For "input" or "messages"
that is the conversation, so tailOf, the effort, deferred-tools and
refs-only checks, Cline's images, Codex's images, the compaction
lookups and the title digest each copied a 44 MiB Codex turn once
per request to look at it. getIn reads it in place (gjson.Get over
the body's bytes). None of the nine sites changes the body while a
result is held, and none keeps a string past the request: Codex's
image jobs read url.Str and write a new buffer, the compaction encs
are lookups, the title keeps a digest.

Together with the masked-record copy, a 44 MiB Responses turn sent
on as Chat allocates ~89 MB less (1,068 to 1,005 MB over the turn)
and runs fewer GCs. Peak live heap is unchanged (282 MB at GOGC=10
with gctrace, before and after): the body, the parsed request and
the outgoing Chat body are what is held at the peak. This is less
allocation and GC CPU, not a lower RSS peak.

TestTailOfReadsInPlace: a 4 MiB conversation's last 64 items come back
right, allocating under the tail plus a quarter of the body. Red with
GetBytes put back (5,480,048 bytes for a 1.3 MB tail of a 4.1 MB body).

Run (mote-run at aa8ded04e, both commits, on 56602426d):
- gofmt -l clean; go vet ./internal/gateway ./internal/maskrec for
  linux, windows and darwin: ok.
- go test -count=1 -timeout 45m ./internal/gateway ./internal/maskrec:
  ok (gateway 533s).
- The new test red with the old code put back (above), green with it.
- The allocation and peak numbers: a scratch test of one 44 MiB
  Responses turn sent on as Chat (not committed), GOGC=10 gctrace for
  the peak.
- Rebased onto 27bf14790 (lan.go changed in the gateway): the same vet
  and go test -timeout 45m ./internal/gateway ./internal/maskrec again
  at this head: ok (gateway 549s).

Reported-by: jihuayu
2026-10-28 20:11:57 +08:00
yetone f76e4d1f5c gateway: a chat body is copied for its masked record only when the record keeps it (#4004)
Every route that masks a body passed string(body) to noteMasked, which
copied the whole request though noteMasked keeps nothing when nothing
was masked, and only the first 4 MiB-or-less body otherwise
(maskrec's sentMax). A 44 MiB Codex turn with nothing to mask was
copied whole on every request for nothing.

sentOf copies only for a record that keeps it. maskrec.SentMax exports
the bound it checks.

TestMaskedBodyCopiedOnlyWhenKept: with nothing masked, and over
SentMax, nothing is allocated; under it the body is kept. Red with
sentOf returning string(body) always (2,097,152 bytes allocated for a
2 MiB body).

Run (mote-run at aa8ded04e, both commits, on 56602426d):
- gofmt -l clean; go vet ./internal/gateway ./internal/maskrec for
  linux, windows and darwin: ok.
- go test -count=1 -timeout 45m ./internal/gateway ./internal/maskrec:
  ok (gateway 533s).
- The new test red with the old code put back (above), green with it.
- The allocation and peak numbers: a scratch test of one 44 MiB
  Responses turn sent on as Chat (not committed), GOGC=10 gctrace for
  the peak.

Reported-by: jihuayu
2026-10-28 20:00:08 +08:00
yetone 27bf14790f gui: the page's links for other computers are at the gateway's addresses
A user's computer has a static public address from its ISP on the
network card itself (203.236.50.70) as well as a private one
(10.77.70.2). Settings › Network & sharing listed 203.236.50.70 as the
gateway's address but only 10.77.70.2 under "Open magpie in a browser",
and they asked why the two differ. The gateway's list
(gateway.LANURLs) took every IPv4 address on an interface that is up;
the page's (gui.LANAddrs) took private ones only, through
net.InterfaceAddrs, down interfaces included. The page server in LAN
mode listens on 0.0.0.0, so the public address serves it too.

Now one list makes both: gateway.LANHosts, every interface that is up,
IPv4, not loopback or link-local, in the interfaces' order.
gui.LANAddrs (and so NetworkLinks, the CLI's `magpie web` and daemon
links) returns it, MAGPIE_PUBLIC_URL's host still first when set.
The page's links now also show a CGNAT/Tailscale 100.64.x address, as
the gateway's already did.

Run, on mote: go vet ./internal/gateway ./internal/gui ./internal/cli;
GOOS=windows go vet ./internal/gateway ./internal/gui; GOOS=linux go vet
./internal/gateway; go test -run
"LAN|Lan|URL|TLS|Public|Network|Share|Allow|Container"
./internal/gateway ok; go test ./internal/gui ./internal/cli: cli ok,
gui ok but for TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27,
not about addresses). On xiaomi-gpu (Windows): the gateway's LANHosts,
PublicURL and TLS address tests ok.
New: TestLANHostsKeepAPublicAddress (a stubbed public, private, CGNAT,
link-local, loopback and IPv6 address) and
TestNetworkLinksAtTheGatewaysHosts.
Broken by hand: LANHosts keeping private addresses only, as the page's
list did, turns TestLANHostsKeepAPublicAddress red (got [10.77.70.2]).
Not run: GOOS=linux vet of internal/gui (needs cgo; the WSL box lacks
gtk4 and webkitgtk-6.0 headers); not tried on the reporter's machine.
2026-10-28 19:54:53 +08:00
yetone 6a074fc132 pii: the default's local model reads what a request adds first, a backlog 4 KB a request, on 4 cores at most
shensmart and xinvxueyuan on Discord (10-28): with the local model on by
default, a long history kept the CPU high; the model off, 5-15%.

What was heavy (measured, TestLiveHistoryCost below): not re-reading.
A text read once is kept by hash (cache, on disk too), and a warm turn
costs what the rules alone do. The heavy case is a history the model
hasn't read (a resumed session, or one from before the model was on),
on the CPU path (Linux, Windows, Docker). Each request's 2 s wait was
spent reading that history oldest first on every core (threads =
GOMAXPROCS-1, windows at once = GOMAXPROCS), the newest turn last, and
the 12 KB chunk in flight was finished past the wait. A 32-core Linux
box spent 33-60 CPU seconds a request, 13 cores busy for as long as
requests came, and the backlog was still unread after 30 requests.
Nothing ran on after the last request (1 ms CPU in the 20 s after).

Now:
- guard.Cores: AstrLink Guard reads on half of GOMAXPROCS, 4 at most.
- backend.missing reads a request's unread texts newest first (the last
  text, a long one's last piece, first).
- AstrLink Guard's chunk is 4 KB (backend.chunk), not 12 KB, so what a
  request leaves the model finishing past its wait is about a second.
- pii.Bounded (masking's default, not a model the user turned on):
  what a request went without reading is remembered by hash
  (backend.sent); a request after it reads what it adds first, and that
  backlog backlogCap (4 KB) at most, nothing found for the rest (the
  rules mask it, as past the 2 s wait). The answer past the wait with
  what was read is 874b86653's (pii.Partial), unchanged.
- A model the user turned on (strict) still reads everything, within
  874b86653's strictWait.
- Not done: OS priority (nice) for the model's threads; the core cap
  is the bound.

Measured, TestLiveHistoryCost (internal/masking, gated on
MAGPIE_GUARD_FILES, no network): a 2,041,658-byte Codex Responses
body (2,032,267 bytes at the rebased tree), 200 turns (repo files as tool output, doc paragraphs as answers,
Chinese names and an email every 10 turns), 30 requests 3 s apart, a
turn more each, model never having read it, then 20 s idle.

WSL2 Ubuntu 24.04 on xiaomi-gpu (32 cores, CPU path):
  before: 33-60 CPU-s a request (44.0, 38.3, 50.4, 42.8, 54.3 ...),
          session 23m16.8s CPU over 1m48s (1293% of a core),
          wall median 2.759s, max 3.07s; 20 s after: 1 ms
  after:  6.3-9.2 CPU-s a request, session 4m1.5s over 1m30s (268%),
          wall median 2.389s, max 2.438s; 20 s after: 1 ms
  warm turn after a full read: 876ms wall / 5.284s CPU before; after
          the rebase the "full read" is strict and stops at 874b86653's
          15 s, so that line is not a warm turn (2.41s / 7.9s); before
          the rebase, at a full read, 1.28s / 3.04s (4 cores, not 31)
  rules alone: 394 / 384 ms CPU
mote (M5 Pro, CoreML):
  before: requests 1-3 2.2 CPU-s each, then ~0.45; session 18.7s CPU
          over 1m30s (21%); warm 396ms / 380ms
  after:  request 1 2.12 CPU-s, then 0.44-0.62; session 17.2s CPU
          (19%); wall median 562ms; warm 476ms / 465ms

On the CPU path a turn adds about 15 KB here, more than 4 cores read
in 2 s, so each request still spends its wait (now on 4 cores, newest
text first) and the backlog isn't reached until turns get shorter;
on CoreML the backlog is gone after the first request.

Tests, each red with its part of the change undone by hand:
- TestNewestTextReadFirst (pii): red on the old code as it stands
  ("read first: a a a ..."); red again with the last piece not first.
- TestBoundedReadsTheBacklogALittleARequest: backlog cap removed, the
  second request read 75169 bytes.
- TestGuardReadsShortChunks: red with guard's chunk unset (12288).
- TestReadsOnFewCores (guard): Cores at 32 and 1 procs.
- TestDefaultModelIsBounded (masking): red with the default's ctx not
  Bounded ("on by default, the model wasn't asked Bounded").
- TestJoinSplitsAtChunkSize now expects the newest-first order.

Rebased onto 874b86653 (strictWait, pii.Partial), which made the
same partial-answer change; mine was dropped for its. Everything below
was run again at the rebased tree.

Run at this tree: gofmt -l clean; go vet darwin, GOOS=linux and
GOOS=windows -tags nogui on internal/pii/..., internal/masking,
internal/redact; go test -count=1 -timeout 45m of those on mote,
wsl-run (magpie-desktop) and win-run (xiaomi-gpu), all ok; internal/gwmw ok;
-race -count=5 of the pii/masking turn, wait, partial and bounded tests
on mote ok; internal/gateway, internal/gui -run
'Mask|Redact|Privacy|PII' ok; TestLiveHistoryCost on mote and WSL. Not run: the full ./... suite.
Not tried: a real Codex session through a live gateway.
2026-10-28 19:53:35 +08:00
yetone 56602426d3 ci: Test gives the packages 30m, where internal/gateway ran into go test's default 10m on macOS (#2108)
The Test step ran `go test ./...` at the default -timeout 10m. On the
last 8 finished main runs internal/gateway took 448-600s on
macos-latest (375-450s on ubuntu), and timed out at 600s in 3 of them
(40676722560 at b3edcabf2, 40655569734, 40654333385), a red that names
no failing test. LESSONS' "A full run gives the slow packages room"
asks for a longer timeout on full runs already.

This is room, not the fix: the gateway package's run time stays open as
#2108. No app change; nothing run locally for a workflow edit. The next
main run's macOS job shows it.
2026-10-28 19:43:39 +08:00
yetone 68ab4c06da gateway: a handed-off gateway answers a kept-alive connection's next request rather than closing it under the agent (#3451)
TestRestartHandsTheGatewayOver went red on ubuntu CI at b3edcabf2 (run
40676722560: "4 of 5 requests during the restart answered", connection
reset by peer), and three times under load since 10-25 with no owner.
It is a real gap a user meets on an update: once the gateway is handed
to the new magpie, the old one's end calls Shutdown, which closes every
idle kept-alive connection at once. An agent that has just sent its next
request on one (Go's transport, Node's agent and curl reuse them) gets
the connection reset, and a POST is not retried. #3568 made the end wait
only for connections taken whose first request was unread.

Now:
- unreadConns also counts kept-alive connections idle between requests
  (StateIdle until the next state), and a handover's end waits for them
  as for new ones, unreadWait (5s) at most, before Shutdown;
- once the gateway takes no connection (stopAccepting), each reply it
  gives says Connection: close (closesWhenHandedOff), so the agent's
  next request dials the magpie serving the port after it;
- the SSE writer keeps a Connection value already set, where it wrote
  keep-alive over the close.
A connection its agent leaves idle the whole 5s is closed by Shutdown,
as its idle timeout would close it. `make dev`'s ending backend
(Handover) takes the same path.

Run on mote (macOS 27, arm64) at this tree on 51e3169fb:
- new TestHandedOffGatewayAnswersAKeptAliveConnection (handed off and
  make dev): a request on a connection answered before the handover,
  sent 100ms after the end began, is answered "quick" with the
  connection closed, and the old one ends within 3s. Red on the old code
  with this test, both subtests: "" unexpected EOF, as #3451 reads.
- go test -count=3 -run 'TestHandedOff|TestHandedOver|TestInherited|
  TestToolCallOfTheMagpieBefore' ./internal/gateway: ok; the same
  handover tests -race -count=3: ok.
- go test -count=8 -run '^TestRestartHandsTheGatewayOver$'
  ./internal/gui: ok.
- go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/handoff: gateway ok (459s), handoff ok; gui red only on
  TestMainWindowCorners/macOS_26_SDK, mote's macOS 27, filed as #3949.
- gofmt -l clean; go vet ./internal/gateway ./internal/gui;
  GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway ok.
Not broken by hand separately: the Connection: close alone (the test's
r.Close check guards it) and the SSE writer's keep, which no test
streams through after a handover.
Not run: the full ./... suite; Linux (the CI red's OS) only through CI.
2026-10-28 19:43:39 +08:00
yetone 0c17aac2d7 gateway: large request bodies wait their turn for a share of memory (#4004)
One request's limit (512 MB decoded) bounded no sum. Each body is held
while its request is served, with what is made from it (the model
rewritten, a translation to Chat, a plugin's base64 line), and on
jihuayu's 2 GiB server Codex turns of ~45 MiB side by side held the Go
heap at ~500 MiB and the plugin host at ~500 MiB, into swap.

bodyRoom now holds a request body of 1 MiB or more to a share of the
memory magpie may use: a thirty-second of memLimit on Linux (the
cgroup's limit, else MemTotal), of the computer's memory elsewhere, 64
MiB at least; no bound where memory isn't known. A request takes room on
its Content-Length before its body is read, so the ones waiting don't
hold theirs, and on the body read (a compressed one is bigger than it
said). It waits first come first served, a body bigger than the room
runs alone, the room is given back when the request ends, and a body
that waits 100s is answered 503 saying what is held and that the
provider was not asked. The wait is a known one to the pre-routing watch
(noteWait), which otherwise answered it 504 at 30s. Small bodies, an
agent's ordinary turns, pass without counting. On jihuayu's 1,670 MiB
server that is one ~45 MiB body at a time.

Measured on mote, 8 concurrent 44 MiB Responses turns to a Chat-only
fake provider (largeConversation, 1s upstream), peak Go HeapInuse
sampled every 5ms: no room 2,166-2,396 MiB, all 8 in ~2.1s; a 64 MiB
room 459 MiB, all 8 answered 200 in 13.5s. One such turn alone peaks at
337 MiB (the translation's own copies, next).

Run first at efb55b5c9 + this:
  mote: go vet ./internal/gateway/ (darwin, linux, windows): ok
  mote: go test -count=1 -timeout 45m ./internal/gateway/: ok 501s
  mote: go test -race -count=3 -run BodyRoom ./internal/gateway/: ok
  wsl-run (magpie-desktop) and win-run: -run BodyRoom: ok
Broken by hand: letIn ignoring the room turns all six queue tests and
the 503 test red.
Not tried: a real 2 GiB Linux host under Codex traffic; the peak was
measured with a fake provider, not a plugin's host.

Reported-by: jihuayu (#4004)

Rebased onto 874b86653 (7 commits, none in internal/gateway's body
path); again at 874b86653 + this on mote: go vet ./internal/gateway/
for darwin, linux and windows ok; go test -count=1 -timeout 45m
./internal/gateway/ ok 469s; -race -count=3 -run BodyRoom ok.
Rebased again onto 51e3169fb (library, GUI and the Qoder mover only);
at 51e3169fb + this on mote: go vet for the three systems ok, -race
-run "BodyRoom|RequestBody|BodyLimit" ./internal/gateway/ ok.
2026-10-28 19:31:56 +08:00
yetone 51e3169fb7 qoder: the plugin's min is 0.2.46, so used-up credits leave the free models served (coeo91 on Discord)
coeo91: Qoder (and WorkBuddy) still serve free models once the paid
credits run out, but magpie treated such an account as spent for every
model. Qoder's docs say it: "When Credits run out, you can continue using
free basic models, subject to daily and monthly limits"
(docs.qoder.com/Credits; zh: "Credits 用尽后,仍可使用免费基础模型").

The cause was the plugin's usage: every credit window ("Total credits",
"Credits", "Add-on credits", and since 0.2.45 a free account's "0 credits
left") counted every model, so a window at 100% put the account last or
out for qfmodel / dfmodel too. The refusal side was already per model
(PaidBesideFree, 974aaf7e2). Plugins b7bbc9d (record in 1f015f1; the code
went out under a stale subject) makes each credit window name the free
models it doesn't count (notModels: the account's own listing, price_factor
0 and not a promotion's), as WorkBuddy's has since 0.1.23. magpie's
quotaOfPlugin already scopes a window by notModels. npm view --prefer-online
shows @magpie-community/opencode-qoder-auth 0.2.46.

WorkBuddy needs nothing: its usage already leaves free models out
(0.1.23, plugins#138), and its free-only switch (#430) shipped in 0.1.38.

Run at this tree on mote: gofmt -l clean; go vet ./internal/provider/ for
darwin, GOOS=linux and GOOS=windows ok; go test -timeout 45m
./internal/provider/ ok (91s). Plugin: HOME=$(mktemp -d) bun test in
packages/qoder ok, with spare-free.test.mjs (free account, spent plan +
add-on, unreadable listing, no free model, listing not asked twice).
Not broken by hand: no test reads the min itself; keepMovedCurrent updates
moved users to it.

Not tried: a real Qoder account with its credits used up (the owner's has
add-on credits left). Not changed: a free model's own daily or monthly
limit refusal still rests the whole account, as before; nothing from Qoder
says which codes that limit answers with.
2026-10-28 19:29:39 +08:00
yetone 053d0d37f8 library: Install RTK uses brew only when Homebrew has rtk's bottle, and keeps why it failed on the card (Scott__D on X)
Scott__D on X: "Magpie 里的这个 RTK 安装一直都不成功". The RTK card sat on
"Installing RTK… this can take a minute." over `brew install rtk`.

Cause: Homebrew bottles rtk only for Apple silicon on the newest macOS
(arm64_sequoia, arm64_tahoe, arm64_golden_gate, and Linux). On an Intel Mac
or macOS 14 and older, `brew install rtk` builds rtk from source, and first
the 19 formulae it builds with, rust, llvm and python among them: hours.
InstallRTK gives the installer five minutes, so each try was ended, said so
in a status line gone after ten seconds, and the next try started over.
Reproduced on mote with a sandbox Homebrew (HOME and prefix of its own)
and HOMEBREW_FAKE_MACOS=14.7: brew info rtk says "stable 1.1.0, HEAD" with
no "(bottled)", brew install rtk lists 19 dependencies to build, and
magpie's InstallRTK spent 3m43s in it before failing.

Fix:
- rtkInstaller asks `brew info rtk` and uses brew only when it says
  "(bottled)", brew's own word for pouring the bottle here. Otherwise, and
  when brew fails or doesn't answer in 30s, it is rtk's own script
  (install.sh from rtk-ai/rtk's README, which downloads rtk's release for
  darwin x86_64/aarch64 and Linux). The answer is kept an hour per brew,
  since ReadRTK asks on every read while rtk isn't installed.
- A failed brew says Homebrew's first Error: line and what it says to do,
  not the support-tier notice its output ends with.
- The card keeps "The install failed: {why}" beside Get RTK until the
  next try (as the upgrade's error already did), in every language.
- The five-minute bound on the installer was already there and stays.

Run on mote (macOS 27.2, arm64):
- real InstallRTK, sandbox HOME, sandbox Homebrew, HOMEBREW_FAKE_MACOS=14.7:
  chose rtk's script, installed rtk 1.1.0 into the sandbox ~/.local/bin in
  12.2s (`rtk --version`: rtk 1.1.0); the card then offers Put RTK on PATH.
- real InstallRTK, same sandbox, macOS 27 as it is: chose brew (bottled),
  installed rtk 1.1.0 in 10.7s.
- go test ./internal/library (TestRTK*): ok. New tests:
  TestRTKInstallsWithBrewOnlyFromItsBottle (brew info output read from the
  real brew, bottled and not), TestRTKBrewInfoThatHangs,
  TestRTKBrewInstallSaysBrewsError (brew's real output on mote).
- GUI: library-rtk-install.test.cjs, 5 languages x 1100/420, Chromium and
  WebKit: 22/22. All library-*, gui-de/ja/zh-tw and i18n-keys files: 770 of
  771; the one red is i18n-keys "a plugin's words are its own" on
  plugins/routing "masking…", red on origin/main too (#4053).
- gofmt -l: nothing. go vet ./internal/library ./internal/gui;
  GOOS=linux and GOOS=windows go vet ./internal/library: ok.
- Full suite on mote, go test -tags nogui -count=1 -timeout 45m ./...
  at base df9376592: 77 packages ok, exit 0. Rebased on 874b86653 (no
  change under internal/library or the library plugin); at the pushed
  tree: go test ./internal/library ok, GOOS=linux go vet -tags nogui ./...
  ok, library-rtk-install + i18n-keys 25 of 26 (the one red is #4053).

Broken by hand: rtkInstaller back to "brew when there is one": all four
bottle cases, the hang test and (with brewError off) the error test red.
The kept answer dropped: "brew asked 2 times". The card's error line
dropped: library-rtk-install red in every language.

Not tried: a real Intel Mac or a real macOS 14 (simulated with
HOMEBREW_FAKE_MACOS); Scott__D's own Mac, macOS version and network; a
network where GitHub downloads fail (the script's error then shows on the
card).
2026-10-28 19:28:44 +08:00
yetone 874b86653d masking: the model the user turned on is waited 15s at most, and what it read is kept (xRayySummers on X)
xRayySummers on X (0.1.1877, Linux, AstrLink Guard turned on in
Settings -> Privacy): in one minute masking took 1.2s to 290s, and each
request whose wait ended was "gateway: masking failed, so nothing was
sent".

Cause: the model reads on the CPU one chunk at a time on one turn,
about 6 KB a second on 8 Linux cores. A burst of requests with text it
hadn't read (new tool results, subagents at once) queued behind each
other, and the turn goes round between chunks, so all of them finished
near the end of the burst. Turned on by the user, the wait had no
bound, and when anything ended it (the client, a deadline) masking.model
panicked: the request was held back whole, and even the finds already
cached for its history were thrown away (backend.find returned nil).
Not a reload (60-90ms) and not a lock in redact.

Now:
- pii.FindContext, when the wait ends, answers with what was known of
  the texts (its cache: earlier turns' history, chunks read meanwhile)
  and a *pii.Partial saying how many it hadn't read.
- masking.model waits at most strictWait (15s) for the user's model,
  defaultWait (2s) for the default's as before. Past it, the model's
  finds mask what it read and the rules mask the rest alone; the request
  goes. Nothing the rules mask goes as written. Logged once a minute.
- A model that fails (not on disk, didn't load, held back after a
  failure) still holds the user's requests back, as before: broken, not
  busy.
- masking.find gives a model that doesn't stop for ctx 100ms (handBack)
  to hand back what it knew, so a partial answer racing ctx.Done isn't
  dropped.
- docs/subsystems/gateway-routing.md says so, with the numbers below.

Run:
- Reproduced with the real AstrLink Guard (guard-7216b6a3) on Linux
  (wsl-run, magpie-desktop, GOMAXPROCS=8), a throwaway test not
  committed: load 63-87ms, reload on a request 57ms, a 125 KB history
  20.8s first read and 66us cached; six requests at once with 67-145 KB
  of new text each took 62, 91, 92, 108, 108 and 110s on the old code.
  With this change each went at 15.0s with the history's 14 finds and
  the model's finds for 1 to 4 of its 9 texts.
- mote-run at df9376592 plus this change: gofmt -l clean; go vet of
  internal/pii, masking, gateway for darwin, GOOS=linux and
  GOOS=windows ok; go test -timeout 45m ./internal/pii/...
  ./internal/masking/... ./internal/redact/... ./internal/gwmw/...
  ./internal/gateway/ all ok (gateway 459s).
- wsl-run and win-run: go test ./internal/pii/... ./internal/masking/...
  ok.
- After the rebase onto origin/main (no overlap in these files): the
  same pii and masking tests again through mote-run, ok.

Broken by hand, each red:
- backend.partial back to `return nil, waitErr(ctx)`:
  TestStoppedRequestKeepsWhatWasRead fails (no Partial).
- strict mode waiting with no deadline:
  TestStrictModelStalledIsTheRulesForWhatItDidntRead fails at its bound
  ("held the request with no bound").
- strict mode panicking on a Partial as the old code did: the same test
  fails ("held back").

Not tried: the reporter's machine, and a real Claude Code burst through
the gateway with the model on; the reproduction called the model's
backend directly.
2026-10-28 19:17:41 +08:00
yetone 7c900f468f antigravity: a tier Google refuses in fetchAvailableModels is asked once a day and is no "Model list" row (ferock4669)
ferock4669 on Discord: with an Antigravity subscription, the Requests
page filled with "Model list" (模型列表) rows for
/v1internal:fetchAvailableModels, each answered 400.

Cause. For an account loadCodeAssist gives a paid or non-free tier,
magpie asks fetchAvailableModels first with entitlement.userTier named
(7806395c7: the paid tier, then the current tier) and, on a refusal,
again without one. The only real paid account seen (#1553, AnxForever's
log: free-tier, paid g1-pro-tier, aicode-consumers) gets 400
INVALID_ARGUMENT "Request contains an invalid argument." for the named
tier and its list from {project} alone. magpie remembered nothing, so
every list (start-up's FetchNew, the hourly relist, Refresh, sync) and
every quota reading sent that 400 first, and each list ran under a
probelog KindList mark, so the refused request was written down as a
failed model_list row (quietProbe hides only answered lists). The list
itself came from the second request. The request without a tier is
what CLIProxyAPI, sub2api and Antigravity-Manager send; the value the
official client puts in userTier for a paid account is still not known
(Antigravity isn't installed on any box here, nothing captured in the
repo), so the request isn't changed beyond not repeating the refusal.

Now:
- a tier Google answers 400 is left out of that account's
  fetchAvailableModels (lists and quota readings) for tierRefusedFor
  (24h), keyed by refresh token, project and tier, so a tier the account
  newly has is still asked; a 503 or other failure doesn't rest it;
- a request with a tier named is sent under probelog.Taken: a step
  towards the list, no row of its own; the request without one is
  written down as any list, so a list that really fails is still one
  400 row under Failed;
- googleAccount.call returns codeAssistError carrying the status, with
  the same message text as before.
Retries: FetchNew asks an account with no list at most every
newFetchRetry (1 min) while a page is open, the relist hourly; with this
a refused tier adds no extra request to either.

Docs: gateway-sessions.md (a list's step is no row) and
providers-accounts.md (askTiers, tierRefusedFor).

Tests: TestAntigravityRefusedTierAskedOnceAndNoRow (#1553's replies:
three Fetches and a quota reading name the tier once, 5 requests, no 400
row; a day later it is named again; a list refused without a tier too is
one row "400 model_list /daily/v1internal:fetchAvailableModels") and
TestAntigravityTierNotRestedForOtherFailures (a tier answered 503 is
named again). Broken by hand on mote:
- without probelog.Taken: FAIL "a refused tier written down:
  {... Kind:model_list ... Endpoint:/daily/v1internal:fetchAvailableModels
  Status:400 ...}";
- without tierRefused: FAIL "asked 8 times, 4 with the refused tier
  named; want 5 and 1".
Both pass with the change, as do the existing tier tests
(TestAntigravityTierRefusedFallsBack, ...ProInvalidTierAsksWithoutOne,
...TierFreeAndKeptProject, ...ProAccountNamesItsTier).

Run on mote (mote-run), at efb55b5c9 + this change: gofmt -l on the
changed Go files prints nothing; go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./... exit 0; go build, GOOS=linux go
build -tags nogui, GOOS=windows go build exit 0; go test -count=1 -tags
nogui -timeout 45m ./... under a sandbox HOME with pinned caches: exit
0, 77 packages ok, no FAIL. Rebased on origin/main b3edcabf2 (no change
to google.go, probelog or usage's probes) and ran internal/provider,
internal/probelog and internal/usage again at the pushed head: ok.
GUI suite not run: no file under internal/gui changes.

Not tried: a real Google AI Pro/Ultra account (none here), so the 400
in ferock4669's rows is matched to #1553's by shape, not by their log;
the official Antigravity client's userTier value for a paid account.
2026-10-28 19:07:21 +08:00
yetone b3edcabf29 sessions: a Claude copy's subagents and what only it holds count in the usage stats
beautiful2674 (Discord): after updating from a 0.1.17xx to a 0.1.18xx,
Usage's total over All was ~200M tokens lower, with the same filters.

Since f4762e921 (v0.1.1803) a Claude Code file whose last message
another file holds is a copy, and statsRead left every file of the copy's
key out. Claude Code 2.1.312's `--resume --fork-session` (and /branch)
copies only the conversation along its last message, so that dropped
spent tokens no other file holds:
- the subagents the first session ran: their files stay in the first
  session's subagents folder only (a sandbox run of 2.1.312 against a
  fake API: the fork's folder has none);
- what came before a compaction, when the branch was made after /compact
  (it starts from the summary) and went on while the session didn't:
  the session is then the copy, and its whole pre-compaction history was
  dropped;
- messages /rewind left on another branch, and sidechain messages an
  older Claude Code wrote into the session's file.
Part of the drop is right: before 1803 the copied messages were counted
in both files.

A copy now adds to the session it is kept in: its subagents' files whole,
and its own file read for the user and assistant messages the keeper's
file doesn't hold (ccRest, kept while neither file changes). A copy that
is a copy through and through adds nothing, as before.

Fixtures: testdata/claude-forks/subagent*.jsonl are Claude Code 2.1.312's
own files from a sandbox HOME with a fake API (a session whose first
prompt ran a subagent, and a --fork-session of it with a prompt of its
own), cut to user and assistant lines, paths rewritten to /w/proj. The
compaction case cuts compacted.jsonl before "rw prompt eight", as it was
when compacted-branch-on.jsonl's branch was made.

Run (mote) at this tree on efb55b5c9; rebased on 96d4715c6 (routing groups in
gateway, provider, cli and the GUI between; nothing in internal/sessions
or its callers' stats paths), internal/sessions ran again there: ok.
gofmt -l clean; GOOS=darwin, linux and windows go vet -tags nogui
./internal/sessions ./internal/gui ./internal/cli ./internal/tui ok;
go test -tags nogui -count=1 -timeout 45m ./internal/sessions
./internal/gui ./internal/cli ./internal/tui ./internal/usage all ok.
Broken by hand, each red: stats.go as on origin/main (4000 in, want
5000; 20 in, want 80); the copy's subagent files and its rest left out
(the same two).

Not changed: the Sessions row of the session a copy is kept in still
leaves out the copy's subagents and its pre-compaction messages (#4054).
Not tried: the reporter's own files; how much of their 200M was double
counting before 1803 and how much this gives back is not known.
2026-10-28 19:01:27 +08:00
yetone 96d4715c61 LESSONS: a cancelled run hides a Race-job red; a pool or allocation bound checks raceOn (10-28)
0b99b8fbe's TestMarshalBodyAllocatesTwoBodies went red in macOS CI's
Race job at 25df3187b, the first Test run after it that finished: 49 of
main's last 58 Test runs were cancelled by the next push. Fixed in
d3f3f3381. Docs only.
2026-10-28 18:58:38 +08:00
yetone d3f3f33811 gateway tests: TestMarshalBodyAllocatesTwoBodies skips under -race, where sync.Pool lets go
0b99b8fbe (#4004) added a bound of 2.5x the body on what marshalBody
allocates. Under -race, sync.Pool drops a quarter of what is put in it,
so json.Marshal's encodeState isn't reused across marshalItems' items
and each one allocates afresh. CI's Race job on macOS went red at
25df3187b ("marshalBody allocated 184 MiB for a 47 MiB body, want at
most 2.5x"), the first Test run after 0b99b8fbe that wasn't cancelled.
The test now skips under raceOn, as parse_memo_test.go's two pool
bounds already do (race_on_test.go).

Run on mote at origin/main df9376592:
- before: go test -race -run TestMarshalBody ./internal/gateway: FAIL,
  176 MiB for 47 MiB.
- after: the same, ok (AllocatesTwoBodies SKIP, IsJSONMarshal PASS);
  without -race: ok, marshalBody 98 MiB for 47 MiB (bound 117), against
  json.Marshal's 205 MiB, so the bound still fails if marshalBody
  falls back to json.Marshal's growth. go vet ./internal/gateway ok,
  gofmt clean.
Not run: the full suite (test file only, one test).
2026-10-28 18:58:14 +08:00
yetone df9376592d routing: a group's member may offer several reasoning levels for the agent to pick among
Garydesu on X: "能不能让路由组里的模型设置多个可选推理强度,现在只能选一个或者整个
路由组的". A member was one fixed `:effort` or followed the group's levels.

A member's suffix may now join several levels with "+",
`provider/model:low+xhigh`, kept lowest first, each once. provider.MemberLevels
splits it into Member.Levels and leaves Effort empty, so the member isn't
fixed; one level is a fixed effort as before. The whole stays the member's
id, so rules, fast, off, weights, share and the CLI key it as any member.
The gateway fits the agent's ask to the member's own levels (groupLevels
returns the candidate's levels first; ofMember, the quiet check and the
trace see them), and the group lists them to agents (buildGroupEntries),
intersected with the other members' as usual. In the Routing page's group
editor the member's reasoning menu has "Several levels…", a menu that stays
open with each level ticked or not; a fixed level picked from the first menu
replaces the old one as before. i18n in zh, zh-TW, ja, de; CLI help and
docs/subsystems/gateway-routing.md say it.

Run on mote (mote-run). Rebased on efb55b5c9 (past e1721d640, which
changed the group editor) and run again there: provider, gateway, cli ok;
gofmt clean; GUI group-member-levels, group-member-fast,
group-member-weight, group-from-model-add and i18n-keys 53 of 54, the red
being i18n-keys' "masking…" from e296211b8, red on main (#4053). Linux
and Windows vet were clean at 7fe98c2af. Earlier, at the first base:
- go test -tags nogui -timeout 45m ./internal/provider ./internal/gateway
  ./internal/cli ./internal/tui ./internal/gui: all ok (gateway 525s).
  internal/cli again after the help wording below: ok.
- gofmt -l: nothing.
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go vet
  ./...: clean (darwin prints cgo warnings only).
- Whole GUI suite (node --test "internal/gui/tests/*.test.cjs", both
  engines, load 140 at its peak): 13,931 tests, 119 red in 31 files. One
  was this change: i18n-keys' "a plugin's words are its own", because the
  CLI help said "the agent picks among them" too; reworded the help, and
  i18n-keys passes. The other 30 files, run alone at --test-concurrency=4
  at this tree and at its parent e8c7dddcb: the same files red on both
  (97 and 100 cases, the routing-rule ones a random subset each run, all
  waiting on clicks), each with an open issue (#3527 lists the pattern;
  segs-press-redraw #3922, routing-story-shrinks #3954).
  group-from-model-add, account-*, login-import and signin-* pass alone.
- group-member-levels.test.cjs: 30 of 30 (5 languages, both engines,
  1100px and 420px); group-member-fast.test.cjs 4 of 4.

Broken by hand:
- groupLevels without the member's levels: TestMemberSeveralLevelsFollowAgent
  red (asked high, sent high, not xhigh).
- buildGroupEntries without the member's levels: TestMemberSeveralLevels red
  (offered all four, not low and xhigh).
- main's routing client.js: group-member-levels red 3 of 3 (chromium en).

Not tried: a real agent picking among a member's levels against a real
vendor; the TUI (its reasoning toggle cycles a "low+high" member back to
following the group, unchanged code).
2026-10-28 18:52:39 +08:00
yetone 48ae0884b6 provider: WorkBuddy's mover min is 0.1.42, a chat parsed once (plugins#461)
workbuddy 0.1.42 parses a chat once on its way to WorkBuddy instead of
once a step (system, tools, tool_choice, headers, model, system key),
and sends the bytes it got when nothing changed them. On jihuayu's
45 MiB chat that is 7 parses down to 2 and the plugin host's peak RSS
from about 1 GB to about 680 MiB, with the bytes sent the same
(plugins f2b0dac, its oneparse.test.mjs). keepMovedCurrent brings every
moved user up to it.

Run at this head (efb55b5c9 + this), on mote:
  go vet ./internal/provider/ (darwin, linux, windows): ok
  go test -timeout 45m ./internal/provider/ -run 'Moved|Mover|WorkBuddy|Plugin': ok 14.7s
npm view --prefer-online: 0.1.42 before the push.
Real account: the plugin's loader on a WorkBuddy AI account returned
200 with 0.1.42's code (plugins f2b0dac's record).

Reported-by: jihuayu (plugins#461, #4004)
2026-10-28 18:48:10 +08:00
yetone efb55b5c92 gateway: a schema's own type and properties beside a oneOf reach Antigravity (#4046)
Cause: plainSchema, which cuts a tool's schema down to the subset
Antigravity's function declarations take, read any node with an anyOf or
oneOf as its first branch that isn't null, and threw away everything the
node said itself. Philo's rg tool is an object with pattern and cursor
and a root oneOf of presence rules ({"required":["pattern"],"not":
{"required":["cursor"]}}, …). That first branch has no type, so the tool
went out as {"type":"string"} with no properties, and Claude on
Antigravity answered 400 "tools.4.custom.input_schema.type: Input should
be 'object'". The same held for such a node under a property, and allOf
lost a member's required when it had no properties of its own, or when
the node had a required list already.

Fix: a node that has its own type (other than only null), properties or
items beside an anyOf/oneOf keeps them, and the union is folded in
(foldUnion): a null branch makes it nullable; on an object, a field only
branches declare joins its properties, and a field every non-null branch
requires is required. The rest of a branch (which fields go together, a
"not") is dropped: Antigravity's subset has no union or not, Claude
there refuses a union at the root, and the client still checks a call
against its own schema. So rg goes as an object with pattern and cursor
and no required, which every valid call satisfies. A union with nothing
of its own beside it is still its first non-null branch, as before.
allOf now keeps every member's required (read before the member is
walked) beside the node's own.

Siblings: plainSchema is the only converter that flattens a union to one
branch. buildCodeAssist calls it for Antigravity only; Gemini API and
Code Assist get parametersJsonSchema as it came. provider.ObjectRoot
(objectSchema for Anthropic, the fold for xAI and the upstreams that
refuse a root union) already keeps the root's properties and passes over
constraint-only branches; TestObjectSchemaRootOneOfKeepsObject pins that
for this schema. geminiToolTypes and the Kimi/DeepSeek walkers only add
types or rewrite patterns. The community plugins have no schema
converter.

Tests: TestAntigravityRootOneOfKeepsObject is the issue's own test, and
TestAntigravityChatToolRootOneOfKeepsObject takes the reporter's route
(parseChat -> buildCodeAssist(..., "antigravity")). Both were red on
origin/main 7fe98c2af with {"type":"string"}. TestPlainSchemaUnionKeepsOwnShape
covers root and nested oneOf, anyOf and allOf, allOf beside oneOf,
fields from branches, required from every branch, a typed scalar, and a
bare union still read as its first branch.

Run on mote, at the tree origin/main 7fe98c2af plus this change:
- gofmt -l: clean
- go vet ./... for darwin, GOOS=linux and GOOS=windows: ok (darwin, linux, windows)
- go test -tags nogui -timeout 45m -count=1 ./internal/gateway: ok, 480.6s

Broken by hand, each red and then restored: the fold turned off (the
two #4046 tests and 8 table cases red, back to {"type":"string"}); the
required every branch shares ignored (3 cases red); allOf members'
required not read (2 cases red).

Rebased onto 44e1fec3a afterwards (two commits: a gateway upload test
and Routing GUI files, nothing this change touches); gofmt and the
tests above ran again at the rebased head.

Not tried: a live Antigravity request with a real account; the
reporter's failing request wasn't captured, so this is checked against
the converter, not the upstream. Not run: the full ./... suite or the
GUI suite (no GUI change).

Reported by imuxin (牧心), who found the cause and wrote the
reproduction test.
2026-10-28 18:41:18 +08:00
yetone 44e1fec3a6 gateway: the try a lost ping cut doesn't fail the upload test (#4033)
TestUploadStillUnderwayIsNotCutByHealthPing was red 3 of 3 on WSL
(magpie-desktop) at 7fe98c2af with "the vendor reading the body: client
disconnected", while the gateway got the vendor's right reply in 4.7s.

Cause: the #3909 fix lets the first try be cut by the lost ping, then
sends the body again. Both tries reach the vendor (counted on WSL and
mote: tries=2 each run). The cut try's handler stays blocked reading,
since the paced path never closes its vendor side, until the test's
cleanup closes the path. On Linux that read then fails, and the handler's
t.Errorf turned the test red. On macOS the abandoned try ends without an
error. The test asserted something the fix doesn't promise. The reply's
byte count still proves one try read the whole body.

What was run at this change on origin/main 7fe98c2af:
- gofmt -l internal/gateway: nothing; go vet ./internal/gateway/ (mote): ok.
- WSL: TestUploadStillUnderwayIsNotCutByHealthPing,
  TestSlowUplinkSkipsTheLostTry, TestLargeBodyOnSilentConnectionIsSentAgain
  -count=5: ok (70.6s). Before the change the first was red 3 of 3.
- mote: the same three, -race -count=3: ok. Windows (xiaomi-gpu): -count=3: ok.
- Broken by hand (the lostPing retry turned off), WSL: the test FAILs in
  0.56s with "http2: client connection lost; want the vendor's reply".

Rebased onto e1721d640 (a GUI routing change only): the three tests
again on WSL -count=3 and mote -count=2: ok.
2026-10-28 18:39:29 +08:00
yetone e1721d6404 routing: a weighted group's editor sorts its members by weight once (Norcleeh)
Norcleeh (Discord #general) asked for a way to order a By weight
group's members by weight. The order matters there: it is the
fallback's when a model fails.

Now the group editor has a "Sort by weight" text button beside Add
another model. It shows while the group routes By weight and the order
would change. A press puts the named members heaviest first (no weight
counts as 1, equal weights keep their order, one switched off is
sorted too; a pattern's members stay after them) and draw()s. The
button then goes. It is a one-off reorder of the draft, saved with the
group's Save; no mode is stored. Its title says the order is the
fallback's. Strings in zh, zh-TW, ja and de. The routing plugin's
client.js isn't a core script; no budget changed.

Run (mote-run, at this head on a1f06bd78):
- group-member-weight.test.cjs, Chromium and WebKit, en/zh 1100px and
  en/de 420px: In order offers no sort. By weight it does and fits.
  The press orders glm-5 (6), gpt (3), kimi (2, off), o4-mini (1),
  each keeps its weight, the button goes, and Save sends that member
  order. Every new string has its four translations. 8/8.
- Red on origin/main's client.js: 8/8 fail (no button). Broken by hand,
  the button kept while sorted: 4/4 Chromium red at "sorted, it has
  nothing to do".
- The routing GUI files (group-*, routing-*, panel-routing*), i18n-keys and
  gui-de/ja/zh-tw, both engines, at load ~230: 1879 of 1913 passed.
  Adding the button into .rt-gadds made routing-intent-entry count 3
  buttons, so the row has its own class, rt-madds; that file passes.
  The reds left are in routing-flood, -levels, -row-swap, -rule-drag,
  -rule-remove, -rules-line, -steady and -story-shrinks. The same 27
  fail at a1f06bd78 without this change, and rule-drag, row-swap and
  steady fail 7/7 at 7fcf642ee. Each has an open issue: #2215, #3620,
  #3799, #3789, #3096/#3094, #3593, #3412/#1804 and #3954.
- go test -tags nogui ./internal/gui: ok. gofmt -l: clean.
- Again after the rebase onto 7fe98c2af: go build ./..., go test
  ./internal/gui ok; group-member-weight 8/8, routing-intent-entry 8/8,
  group-context 4/4. i18n-keys is 3/4: its "a plugin's words are its
  own" is red on main, from a masking.go comment that quotes "masking…"
  (e296211b8), not from these strings. Filed as #4053.

Not tried: the real desktop app, and a group with members by pattern
(those aren't sorted, by the code).
2026-10-28 18:33:46 +08:00
yetone 7fe98c2afd proc: the /bin/sh tests of CombinedOutputOwn skip on Windows
TestCombinedOutputOwnRuns and TestCombinedOutputOwnContext (531b44a9a)
run /bin/sh, which Windows lacks, so internal/proc was red on the
Windows box at origin/main (exec: "/bin/sh": executable file not found
in %PATH%). Windows CI only compiles tests, so nothing showed it. They
skip there now, as TestCombinedOutputOwnAnswersForItself already does
off macOS.

What was run (this tree):
- win-run go test -count=1 ./internal/proc/: ok 8.6s (red at
  origin/main with the two tests above).
- mote: go test -run 'TestCombinedOutputOwn|TestTreeRSS' -v
  ./internal/proc/: all four pass, none skipped.
2026-10-28 18:26:59 +08:00