Commit Graph
7089 Commits
Author SHA1 Message Date
yetone 5214d5114f claude: a run on a new account's first turn keeps its tool results
On the first request on a newly seen Claude sign-in, claude auth status
has no email yet, so the account is named from its plan ("Claude Max").
The bridged run's Claude Code then writes the profile, the account is
named by its email, and the turn's tool results came under another owner:
"tool results account changed", the run let go, and a new one told the
whole conversation (~8k more cache writes). Seen in a real run as
"claude\x00Claude Max\x00own" -> "claude\x00<email>\x00own".

- provider: Account.Unnamed marks the placeholder name;
  ClaudeOwnName gives the own sign-in's name once it has one.
- gateway: the run's owner is an atomic pointer (owned()); an own,
  unnamed owner ends in "\x00unnamed". takeNamedOwner lets such a run go
  on as the same provider's own sign-in, named; every other owner change
  still lets the run go. A turn that ends without a tool call takes the
  name before its keys are made (nameOwner), so the next turn finds the
  idle run.
- docs/subsystems/claude-subscription-bridge.md says so.

Run:
- TestClaudeToolResultsKeepTheSelectedAccount gains "named since" (kept)
  and "unnamed, another account" (let go);
  TestClaudeRunTakesOnlyItsOwnSignInsName; TestClaudeIdleRunKeptUnder-
  ItsOwnSignInsName (named since / still unnamed); provider asserts
  Unnamed on the plan-named account and not on an email-named one.
  Broken by hand: without takeNamedOwner in serveSubscription "named
  since" goes red (a new run replies); renaming any own owner goes red
  (a@ -> b@ taken); without nameOwner the idle case goes red; with
  unnamed never set the provider test goes red.
- Real run: sandbox HOME, dev build of this tree on 127.0.0.1:3741, the
  owner's Claude Max sign-in with .claude.json and logins.json removed
  first (auth status: no email), a real Claude Code 2.1.310 client in a
  sandbox config asked to write, wc and read pelican.html. One Claude
  Code pid for the whole turn, the log says the run "goes on as" the
  email, no "account changed" line. Before this change the same setup
  logged the owner change and "tool results account changed".
- gofmt; go vet darwin, linux -tags nogui, windows for gateway and
  provider; go test ./internal/gateway ok 392.7s; go test
  ./internal/provider ok 89.3s with -skip TestUnreadLoginsWriteErrors-
  KeepCredentials, which crashes the package on main alone (#3632,
  filememo synctest, not this change).
- Full suite at this tree (3ea0dd908, committed first as 3a201180b on 42ec2700b): go test
  -tags nogui -count=1 -timeout 45m ./... -skip TestUnreadLoginsWrite-
  ErrorsKeepCredentials (#3632): exit 0, 71 packages ok, no FAIL in the
  kept log. No other suite ran on the machine (no suite-lock script
  here; ps checked before the start).
Not tried: a sign-in switch mid-turn from one named account to another
(still lets the run go, by the test).
2026-10-26 01:59:38 +08:00
yetone 680b505687 claude: a run works in the caller's own folder, not magpie's temp folder
The bridged Claude Code told its model "Primary working directory:
<tmp>/magpie-claude-work-501", against the folder the client's own prompt
names. Under a real Claude Code client the model wrote pelican.html into
magpie's temp folder, through the client's tools, which run in the
client's folder.

startRun now runs Claude Code in the folder the caller names
(clientWorkDir): the last one in the system prompt or a non-assistant
message, as Claude Code ("Primary working directory:"), Codex (<cwd>),
OpenCode ("Working directory:") and pi ("Current working directory:")
write it, when it is an absolute path to a folder here. Otherwise (a caller
elsewhere, a WSL Claude Code, no folder named) the shared folder as before.
The caller's project's sessions are never swept; a run's session is still
removed by its id. CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 keeps the
repository's status out of the prompt (setting sources and auto memory
were off already). The text sent upstream is unchanged apart from the
folder Claude Code reports itself.

Run:
- TestClaudeRunsInTheCallersWorkDir (Claude Code, Codex, OpenCode, pi,
  named twice) and TestClaudeCallersWorkDirElsewhereIsNotUsed (missing,
  relative, Windows path, none): red on the old code (the runs used the
  shared folder). Broken by hand: sweeping the caller's folder goes red
  ("were swept"); dropping the env var goes red ("repository's status").
- Real run: sandbox HOME, dev build of this tree serving 127.0.0.1:3741 on
  the owner's Claude Max sign-in (keychain linked in, login copies deleted
  after), a client Claude Code 2.1.310 with its own CLAUDE_CONFIG_DIR,
  ANTHROPIC_BASE_URL at the sandbox, run in $SB/wm and asked to write
  pelican.html: it landed in $SB/wm; nothing new in magpie-claude-work-501
  (its only pelican.html is the capture's, from before).
- go test ./internal/gateway at the staged tree (checkout-index), gofmt,
  go vet; the full suite run is recorded in the next commit, at the pushed
  head.
Not tried: a Windows client (a Windows path falls back, by the test), a
Claude Code in WSL (falls back by code).
2026-10-26 01:48:52 +08:00
yetone 42ec2700bd gui: markNewPartners' comment is shorter, so app.js is in its budget again (#3367)
ef3b9f85a put app.js 20 bytes over TestCoreScriptBudget (1326125 >
1326105, core 1537036 > 1537016) and its record ran only the GUI files,
not internal/gui's Go tests. The comment it added is 33 bytes shorter
now; no code changes and the budget stays as it is.

Run at origin/main 3173440ca + this change: go test ./internal/gui/
-count=1 ok (104s), app.js 1326092 bytes; gofmt -l clean.
2026-10-26 01:20:42 +08:00
yetone 3173440ca3 routing: a row made again in the middle of the list is swapped alone, not every row after it moved (#3164)
placeRows walked the wanted rows against the list's children and put
each one out of place in front of the current child. A row going (its
request moved on, so rowOf made it again) stayed where it was as that
current child, so every wanted row after it was put in again in front
of it, one insertBefore each. On a busy gateway the request in flight is
rarely the newest, so each trace update (several a second) moved ~40
rows and laid the list out again. With two groups of hundreds of keys
open, that is the 50ms+ frames WebKit showed at each update.

Rows no longer wanted are taken out first, as replaceKeeping does; the
rows kept are not touched, so WebKit's scroll position under a picked
row (what the walk was for) holds as before.

Run at this head (rows3164 worktree on origin/main 8299409e4):
- routing-row-swap.test.cjs (new): chromium and webkit pass; on the old
  placeRows (origin/main) both fail: {added: 10, removed: 10} where
  {added: 1, removed: 1} is wanted.
- every routing*.test.cjs and panel-routing*.test.cjs (112 files,
  --test-concurrency=6): 1418 tests, 1365 pass, 53 fail. The red files,
  run alone at origin/main 8299409e4 and at this head, fail the same:
  routing-live-patch 4/6 both (filed #3637), routing-intent-entry 4/4
  vs 5/3 (#3408), routing-manual 2/2 both (#3409), routing-pause 0/14
  both (#3410), routing-rule-effort 4/14 both (#3411), routing-rule-remove
  11/9 both (#3094, #3096). routing-keys-fold's one webkit de red in the
  full run passes 32/32 alone at both trees.
- Sandbox (sbh3164: providers of 500 and 300 keys on a fake upstream, a
  request every 0.3s, both groups open, Playwright WebKit, 10s, the
  served client.js swapped old/new three times):
  frames over 50ms 25/10/14 → 3/2/3; frames 344/464/360 → 398/379/403;
  .rt-reqs childList records in 5s 1566/32/740 → 68/32/32.

Not tried: the macOS app's own WKWebView window, a real upstream.
2026-10-26 01:02:30 +08:00
yetone ef3b9f85a4 gui: a new partner puts a still dot on Providers in the sidebar
yetone: 有新的合作伙伴的时候,侧边栏这个地方是否也应该有一个精致优雅的点来提醒
用户一下呀?…就是不要太打扰用户。

markNewPartners now lights Providers in the nav (window mode) together with
the add button's dot: the same has-dot Plugins uses for an update (6px at
the sidebar row's end, 5px at a tab's corner, accent, no animation), titled
with the new partners' names. It goes out with the add button's dot, when
the add sheet has shown the partners. prefetchProviders calls it once the
background read lands, so an app opened on another page shows it too.

Run at 81a58d2f3 + this change (rebased, the pushed tree):
- partners.test.cjs, chromium + webkit: 38 of 38 (new: nav dot at 1280
  sidebar and 900 tabs, en + zh, opened on ?view=agents, gone after the
  sheet and after a reload; the add-button tests also check the nav).
  With app.js reverted: the 8 dot tests per engine red (18 fail).
- plugin-updates, provider-add-gemini, partners alone: 80 of 80.
- The 66 GUI files naming has-dot / has-new / addProvider / side-nav plus
  i18n-keys, concurrency 4 at load ~48: 877 of 894. Reds: builtins and
  sidebar (masking tab, the same on an origin/main 81a58d2f3 copy, #3498);
  plugin-updates de 1024 (#3633) and provider-add-gemini webkit 420px
  (#3634), both green alone and on the main copy.
- Screenshots of the sidebar, light and dark, at 1280: the dot sits at the
  Providers row's end like Plugins'.
Not run: the whole 893-file GUI suite (another session's GUI suite was on
the machine); the real Wails app.
2026-10-26 00:40:50 +08:00
yetone 81a58d2f35 gui tests: routing-busy-frames counts paths measured again for the same d, not lengths against frames (#3557)
The bar was path lengths < 8 × frames drawn. The lengths follow the
paths the flights and the moving rows make (~1,800 in the 3s), not the
frames, so a busy machine that drew 228 frames instead of ~300 went red
with the page doing just what it should.

What the test is about is that a path is measured once for each d it
has. The page's getTotalLength and getPointAtLength are now wrapped to
remember the d each path was last measured at: a length measured again
for the same d, or a point again at the same distance along the same d,
is counted. The bars: lengths again ≤ 1/20 of lengths, points again ≤ 2
for each d measured (a wire's two ends are asked for by its tips and
among its points). Neither depends on the frame count.

Run at this head (frames3557 worktree on origin/main 8299409e4):
- routing-busy-frames.test.cjs: 6/6 pass, chromium and webkit, en/zh/de:
  ~1,750 lengths, 0 again; ~5,800 points, ~320 again (bar ~3,500).
- Broken by hand: measure() measuring every call: 6/6 red (9,807 of
  11,574 lengths again). The point cache alone off: webkit 3/3 red
  (6,892 points again against a bar of 3,534).

Not tried: the file under the whole GUI suite at load ~40 where #3557
was seen.
2026-10-26 00:14:31 +08:00
yetone 8299409e44 site: APIKEY.FAN's in-app seat ends 11-24
APIKEY.FAN's seat runs one month from 10-24, so its partners.js entry is
listed until 2026-11-24 00:00 +08:00. Its README banner has no end date
of its own; it comes out by hand when the seat isn't renewed.

Run: node --test site/*.test.mjs (31 of 31 ok). served() over partners.js
keeps apikeyfan at 11-23 23:59:59 +08:00 and leaves it out at 11-24
00:00 +08:00.
2026-10-25 23:58:18 +08:00
yetone 8d7d46e3bd site: WandAPI's in-app seat ends 11-25
WandAPI paid for one month from 10-25, so its partners.js entry is listed
until 2026-11-25 00:00 +08:00. The README banner has no end date of its
own; it comes out by hand when the seat isn't renewed.

Run: node --test site/*.test.mjs (31 of 31 ok). served() over partners.js
keeps wandapi at 10-26 and at 11-24 23:59:59 +08:00, and leaves it out at
11-25 00:00 +08:00.
2026-10-25 23:48:24 +08:00
yetone 091153bf71 idle: the loops following magpie's files wake on its own writes, not a 1-2s poll (#3185)
An idle `magpie serve` (no providers, no requests) woke 12-13 times a
second. A runtime trace showed the wakers were polling loops: the
middleware observer's refresh every 1s, pluginrt.KeepFresh's stat of five
files every 2s, OTel's session watch every 2s and its exporter tick every
5s, all with nothing to do.

Now filememo.Forget, which every write magpie makes of settings,
providers, sign-ins and caller keys already calls, also closes a channel
(filememo.Written). The plugins.json, tools and plugins.yml saves call it
too. The middleware observer, KeepFresh and OTel's session watch wait on
it, and look every filememo.OthersEvery (5s) only for what another
process (the CLI, a second magpie) wrote. Each takes the channel before
it looks, so a write made during a look isn't missed. middleware's
current() also reloads at once when filememo's generation moved, rather
than after its 1s skip. OTel's session watch waits 5s, not 2s, while
sessions aren't exported, and its exporter's timer runs only while a
batch holds something.

Measured: sandbox HOME, MAGPIE_ADDR=127.0.0.1:3481, `magpie serve`,
proc_pid_rusage (idle + interrupt wakeups) over 30s after 40s warm-up,
old (cec54c1d0) and new builds alternated:
  old  13.2 / 13.3 / 12.2 wakeups/s, 0.40 / 0.35 / 0.42 ms CPU/s
  new   7.9 /  8.6 wakeups/s,         0.22 / 0.30 ms CPU/s
What's left is the Go runtime itself, awake.Keep's 5s tick and the 5s
looks for other processes' writes.

Tests: TestKeepFreshFollowsPluginsYml now also runs KeepFresh with a 1h
interval and needs Set to apply at once; TestStrategiesFollowOwnWrite
needs a plugin turned off through plugin.SetOff to stop being served
within 2s, with no refresh by hand; TestWritten. With the Written cases
replaced by a nil channel, both of the first two went red (applied = 1,
want 0; still served 2s after). Run at this head: go test -count=1
-timeout 45m ./internal/filememo ./internal/plugin ./internal/pluginrt
./internal/middleware ./internal/otlp ./internal/settings
./internal/access: all ok. GOOS=linux and GOOS=windows go vet -tags
nogui ./internal/...: clean. gofmt -l internal: clean.

Not run: the full suite and internal/gateway's tests (gateway.go only
changes KeepFresh's interval argument, and it compiles under vet); the
macOS app with its window open (only headless serve was measured).
2026-10-25 23:45:34 +08:00
yetone 67271e7020 site: WandAPI is a README sponsor
WandAPI took a README seat with its in-app one. README.md shows its
English banner ("Connect to global AI models"), README.zh-CN.md its
Chinese one ("畅连全球AI大模型"). Their SVGs switch colours with a
prefers-color-scheme rule inside; each is kept as a light copy (the rule
taken out) and a dark copy (the rule's colours as the only ones), shown
through <picture> like the other sponsors. All paths, no text or outside
references. Both link usemagpie.ai/go/wandapi/readme, which sponsors.js
sends to wandapi.ai/r/magpierepo, the link WandAPI gave for the README.

Run: node --test site/*.test.mjs (31 of 31 ok). The four banners rendered
with rsvg-convert on white and on GitHub's dark background and looked at.
After the deploy, /go/wandapi/readme is checked for its 302.
2026-10-25 23:44:25 +08:00
yetone 43a831981a site: WandAPI is a partner in the Add sheet
WandAPI took an in-app seat. The partner "wandapi" serves Chat
Completions and Responses at api.wandapi.ai/v1 and Anthropic Messages at
api.wandapi.ai. Its key page is its magpieapp referral link, its website
wandapi.ai. No langs were asked for, so it is listed in every language,
with the tagline it sent in en and zh and a zh-TW one made from the zh.
Listed from 10-25, no end set yet. The icon is their 512px logo at 128px
(7.1KB PNG).

Run: node --test site/*.test.mjs (31 of 31 ok). The served feed
(worker.js served() over partners.js) parsed as []Partner and passed
checkPartner and validPartners in a throwaway test in internal/provider:
all three partners kept, wandapi's links /go ones. Against the real
service with the test key it sent: /v1/models (28 models), Messages
(plain and streamed) and Responses answered "OK". Chat Completions
answered for gemini-3.5-flash and gpt-5.6-terra; for claude-haiku-5-5 and
gpt-6-sol it says the model doesn't take that protocol, so those models
go through Messages or Responses. Its Gemini endpoint (/v1beta) answered
too, but a partner entry has no Gemini base URL.
Not tried: adding it from the app's Add sheet.
2026-10-25 23:44:25 +08:00
yetoneandskygunner cec54c1d01 proc: main's two reds, the TUI's serve start through proc.Command (#3567) and an RSS read before the loader ran
Test (ubuntu, macos) on main has been red since 75e78a5a0 on two tests.

TestNoCommandBypassesProc: internal/tui/keep.go's serveInBackground
started `magpie serve` with os/exec. It is proc.Command now, the fix
skygunner gave on #3567 (64bd29fa on their fork). Off Windows
proc.Command is exec.Command, and this path runs on Linux only, so
nothing else changes.

TestTreeRSS (ubuntu only): the test read sleep's VmRSS right after
StartTree and wanted at least 64 KiB. Just after its exec a command
holds a few pages until its loader maps libc: CI read 16384 bytes. The
test now reads again until it holds 64 KiB, for up to 10s. Tree.RSS
itself is unchanged.

Run at this head:
- golang:1.26 docker (Linux, CI's Go): TestTreeRSS -count=50,
  old test red 13 of 50 ("a running sleep holds ..."), new 50 of 50 ok.
- macOS: go test -count=3 ./internal/proc ./internal/tui ok (the old
  keep.go is the guard's red on CI's runs 40199986992 and earlier).
- GOOS=linux and GOOS=windows go vet -tags nogui on both packages,
  gofmt clean.
Not run: the full suite.

Co-authored-by: skygunner <skygunner@users.noreply.github.com>
2026-10-25 23:15:45 +08:00
yetone d42d27012b routing: a long wire is drawn as pieces of its curve, which WebKit dashes cheaply (#3164)
What was left of #3164 after a3232e3e1: with a 501-key and a 301-key
fold both open, WebKit drew the Routing page at ~17 frames a second.

The cause is one wire, not the 14k nodes. Hiding the rows, the 743
resting wires, the sky, setting content-visibility on the rows, or
skipping the viewBox write each changed nothing; hiding the one live
(dashed, flowing) wire, or only its dash, brought the frames back. A
fold hundreds of rows from magpie gets its wire as one cubic from the
hub to the fold, here 18,143 px tall. WebKit dashes a cubic at a cost
that grows faster than its length: a lone dashed cubic of 2,000 px is
free, 8,000 px ~24 ms a frame, 18,000 px ~75 ms; a straight line of any
length is free, and the same 18,000 px cubic cut into 8 exact pieces
draws at 60 fps. Chromium is fine either way.

curve() now cuts a wire's cubic (de Casteljau, even steps in t) into
pieces about 1000 px tall, at most 64. A wire under 1000 px gets the
same d as before. The pieces are the same curve: points at equal arc
length agree within 0.3 px (getPointAtLength's own error), total length
within 0.01 px, and the dash runs on across pieces of one subpath. Pixel
diffs of one cubic vs pieces, dashed, at three scrolls: Chromium 1-2k
pixels differ, none by more than 64/255 (antialias); WebKit the same,
plus 4, 181 and 15 pixels by more, where the long cubic's dashes were
unevenly spaced and the pieces' are even (dash phase; the dash flows). No row, wire, fold or style changed.

Measured: sandbox HOME, magpie -tags dev on its own ports, the same fake
upstream and keys as a3232e3e1 (501 + 301 keys, a request every 0.3 s),
1280x900, frames in 10 s, old and new alternated, twice each:

  WebKit, folded        old 580 / 568        new 567 / 568
  WebKit, one open      old 269 / 254        new 497 / 450
                        jank 5.6 / 5.8 s     2.1 / 2.7 s
  WebKit, both open     old 168 / 166        new 444 / 395
                        frames >50ms 140/144 5 / 6, jank 7.3 s -> 2.7 / 3.5 s
  Chromium, all three   old 596-601          new 595-601

routing-many-keys.test.cjs now also reads every wire's path: the
tallest wire must run over 5000 px and no cubic in any wire over
2000 px. Red 6 of 6 with origin/main's client.js (a cubic 27,753 /
27,228 px tall), green 6 of 6 with this one (1,484 / 1,456).

Run at this tree (origin/main a60493ab6 plus this; a60493ab6 touches
internal/gateway only, the runs below were at a3232e3e1 plus this):
- every internal/gui/tests/*routing*.test.cjs plus i18n-keys, both
  engines: 1420 tests, 1365 pass, 55 red. The reds are the known
  intent-entry #3408, live-patch #2174, manual #3409, pause #3410,
  rule-effort #3411, rule-remove #3096 and steady #3412, plus
  keys-fold (#1612, #2658), levels (filed #3620) and mode-goes
  (#2151): each a 5 s wait timed out at load 23-34. Run alone they
  pass both at origin/main and with this: keys-fold 32/32, levels
  4/4, mode-goes 40/40.
- go test ./internal/gui -timeout 45m: red only in
  TestRestartHandsTheGatewayOver (#3451, EOF during the handover under
  load); alone -count 3, ok.
- GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean. gofmt
  -l: clean.

Not tried: the macOS app's own WKWebView window (Playwright's WebKit
here), and real upstream keys (fake upstream).
2026-10-25 23:04:58 +08:00
yetone a60493ab60 gateway: Codex run by Claude Code's Codex plugin is counted as Codex, not Claude Code
wyztony on X: "claude通过/codex skill时,用量不会记录codex的记录".
OpenAI's Codex plugin for Claude Code (codex-plugin-cc 1.0.6,
/codex:rescue and /codex:review) runs `codex app-server` with clientInfo
named "Claude Code". Codex 0.162.1 then sends "originator: Claude Code"
and "User-Agent: Claude Code/0.162.1 (...) (Claude Code; 1.0.6)", so
agentOf read every such turn as Claude Code's ("claude") and the Usage
page showed none of them under Codex.

agentOf now takes a "Claude Code" name back to Codex when the request
carries Codex's own turn headers (x-codex-window-id or
x-codex-turn-metadata), which Claude Code itself (claude-cli/...) never
sends. An app running Codex as its own engine under its own name (Lody)
keeps its name, as TestFromCodex already holds. fromCodex is unchanged,
so nothing sent upstream changes. Every path keyed on agentOf
(Codex subagent pick, spawn_agent models, drawing route, Codex backend
records, titles, search, active sessions, callerOf) follows.

Run:
- TestCodexPluginForClaudeCodeIsCodex: red on the old code with the
  check turned off by hand ("plugin task: recorded as \"Claude\", want
  \"codex\""), green with it. Cases: the plugin's captured headers,
  originator only, claude-cli, the name without Codex's turn headers,
  Lody with them.
- Real use in a sandbox HOME: codex-cli 0.162.1 wired to a sandbox
  `magpie serve` on a fake Responses upstream, driven by the plugin's own
  codex-companion.mjs (db52e28). Before: task and review rows were
  "agent":"claude". After: both "agent":"codex". Plain `codex exec` (a
  skill-folder /codex skill) was already "codex" through the gateway and
  read from its rollout when direct.
- gofmt; go vet darwin, linux, windows.
- Full suite (go test ./... -timeout 45m, one suite on the machine) was
  started at this tree and was still running at push; per the owner's
  ship-at-once rule, a red it finds goes in its own commit.

Not changed, outside magpie: with Codex not routed through magpie,
/codex:review runs an ephemeral thread and Codex writes no rollout, so
there is nothing on disk for magpie to read; /codex:rescue writes one
and was already counted as Codex. Past rows stay under Claude Code.
2026-10-25 23:02:33 +08:00
yetone a3232e3e11 routing: hundreds of keys in a group are read once, not each against all (#3164)
A group of 500 + 300 keys (the reporter's: several hundred gpt-5.6-sol
keys for load rotation) made the Routing page stutter. Every request in
the trace names each key it weighed, and the page read all of them over
and over:

- rankOf looked a key up in its provider's whole keyList for each sort
  comparison (~50k findIndex a second). It now uses an index made once
  per list (keyRank), rebuilt when the list moves under it.
- seated made each sort key once per member (decorate, sort, undecorate),
  and setOf is made once per route's order array.
- at() parsed each trace time again for every row each second (~1M
  Date parses over 3s). Each time string is parsed once (atOf).
- render() went through a route's whole order and tries for each of its
  800 rows each second. Each route is read once per pass (findings).
- renderActs filtered the whole list for each key to fold it. Each
  provider's keys are gathered once.
- rebuild looked ids up with Array.includes; it uses a Set.
- layout() read each row's box after drawing the wire above it, so an
  open fold laid the stage out once per row. Every box is read first,
  and only changed d attributes are written. The FLIP pass reads every
  row's place before moving any, and --depth is set only when it changes.

Measured with a sandbox magpie (dev build, own HOME, ports 3474-3477),
providers solpool (501 keys) and solpool2 (301 keys) in group sol, a fake
OpenAI upstream (200 after 0.2s, 429 one in five), and requests every
0.3s. Playwright, 1280x900, 10s of rAF gaps, old and new alternated
twice on the same box (load average 160-215 from other sessions):

  chromium, folds opened: 206/281 frames, 65/58 over 50ms, jank 6.8s/5.5s
                       -> 568/557 frames, 1/0 over 50ms, jank 1.0s/1.1s
  webkit, folded:        410/422 frames, 43/45 over 50ms, jank 3.8s/3.8s
                       -> 566/554 frames, 4/12 over 50ms, jank 1.3s/1.5s
  webkit, folds opened:  49/50 frames, max 310ms, jank 9.4s/9.2s
                       -> 129/134 frames, max 122ms, jank 7.9s/7.8s

CDP CPU profile, 15s under load, Chromium: folded, 27 long tasks
(1540ms) -> 1 (69ms); opened, 41 long tasks (3757ms, max 1533ms) -> 0.
Folded, first .rt-group in 305ms -> 170ms.

New internal/gui/tests/routing-many-keys.test.cjs: 800 keys, requests
coming, folded and opened, counts findIndex calls on lists of more than
100 entries, Date parses of strings, and box reads that follow a drawn
wire. On the old client.js it is red: 59094 lookups, 469919 parses, and
20885 relayouts when opened. Broken by hand, each part goes red alone:
at() without the memo gives 493972 parses, and layout() writing each
wire as it goes gives 22497 relayouts. Green in Chromium and WebKit, en,
zh and de.

Run at base 99de8e1ad: every internal/gui/tests/*routing*.test.cjs
plus i18n-keys in both engines, concurrency 6 at load 130-300: 56 reds
in six files. Each was run alone, with this client.js and with the
base's: routing-pause 13 red / 13 on the base (#3410),
routing-intent-entry 5 / 3, flaky both ways (#3408), routing-live-patch
6 / 6 (#2174), routing-keys-fold's webkit fly-to-fold 3 / 5 (#1612,
#2658); routing-log-icons and routing-manual pass alone. None is new. go test -timeout 45m
./internal/gui (ok, 206s); gofmt -l internal clean; GOOS=linux and
GOOS=windows go vet -tags nogui ./internal/gui ok.

Not tried: the macOS app's WKWebView window (Playwright WebKit only)
and a real provider's keys (the fake upstream answers). WebKit with
both 500- and 300-key folds open is still about 13 frames a second
under this load. Its script time is about 2.3s of 10s and its layout
is under 0.3s, so the rest is painting a stage of 14k nodes and 800
wires. #3164 stays open for it.

Rebased onto 4b3bdbe28 and run again there, at load 6-30:
routing-many-keys 6/6 green (6/6 red with the base's client.js); go test
./internal/gui ok; linux and windows vet -tags nogui ok; gofmt clean.
Every *routing*.test.cjs plus i18n-keys, concurrency 4: 1371/1420, 49
red in eight files. Each of the eight run alone on 4b3bdbe28 and on this
head gives the same counts: busy-frames 1 (#3557), intent-entry 3
(#3408), live-patch 6 (#2174), manual 2 (#3409), pause 14 (#3410),
rule-effort 14 (#3411), rule-remove 5 (#3096), steady 2 (#3412); the
same tests, except intent-entry and rule-remove, which flake across
languages and widths on both.

Rebased again onto 5e0d7c058 (app.js and app.css changed under it): go test
./internal/gui red once, with the log cut to its tail so the test is not
named, then green 4 of 4 with -count=1 (logs kept, load ~23);
routing-many-keys and i18n-keys 10/10.
2026-10-25 21:57:24 +08:00
yetone 5e0d7c058b agent: WorkBuddy's own save of models.json after it starts no longer keeps its row saying restart (Sac2333o on X)
Sac2333o on X: the WorkBuddy row kept saying "已连接 · 重启 WorkBuddy 后生效"
after every restart of WorkBuddy.

WorkBuddy rewrites ~/.workbuddy/models.json itself a few seconds after
each start. 5.5.6 (Mac app.asar): registerLocalModelIpc checks whether the
computer can run local models (only some NVIDIA RTX GPUs and Intel Core
Ultra chips), and on "no" purgeLocalModelsOnGateFail saves the file
through ModelsJsonStorage.update even when nothing was purged. The live Mac
log says "Hardware eligible: false ... Purge complete: 0 models removed".
5.6.2 (Windows app.asar) does the same through the daemon's
deleteLocalCustomModel. Both save it with JSON.stringify(x, null, 2), so
magpie's trailing newline is gone. 5.6.2 also writes a bare list, and its
models-json codec encrypts apiKey (WBEF1) when its credential policy says
so. On the Windows box, WorkBuddy 5.6.2 started at 17:17:09 and
models.json was last written at 17:17:13 with no trailing newline.

AppBehind put magpie's last change at the time of the last write it
hadn't seen, using a digest of the raw bytes. WorkBuddy's own save
changes those bytes, so every start put "magpie's change" 4s after
WorkBuddy started, and the row asked for a restart forever.

appReads now digests workbuddyPart: magpie's entries (vendor magpie),
each with its keys sorted and its apiKey left out. The same models
written by magpie and saved again by WorkBuddy read the same. A model
magpie adds or removes, or a changed URL, still asks for a restart.
Upgrading users: the stash still holds the old raw digest, so the first
look after the update may still say restart once. One restart of
WorkBuddy then clears it for good.

Run:
- TestWorkBuddyOwnSaveAfterStartIsNoChange (darwin and windows subtests):
  connect, WorkBuddy restarted, WorkBuddy's save 4s after its start
  (Windows: apiKey encrypted). Red on the old appReads ("WorkBuddy's own
  save after its start read as magpie's change"), green now. Broken by
  hand (apiKey kept in the digest): the windows subtest goes red.
  TestWorkBuddyRestart*, TestChangedAt* still pass.
- GUI: internal/gui/tests/agent-app-restart.test.cjs (every language,
  chromium and webkit, wide/narrow/panel), 40/40. app.js is unchanged.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/agent.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., one run
  on this machine, no other suite running): running at push. A red it
  finds gets a follow-up commit and an issue.

ZCode (the same report: "zcode接入通信失败") is not changed here. I could
not reproduce it. In a sandbox HOME on macOS, `magpie zcode provider
magpie` (a build of 4b3bdbe28; this commit doesn't touch ZCode), then ZCode 3.14.3's own app-server
(provider/testModelConnectivity, the call behind its settings' test
button) against the gateway: {"success":true}. The same on the Windows
box, with this tree's magpie.exe and ZCode 3.14.3 for Windows run with ELECTRON_RUN_AS_NODE in a
sandbox USERPROFILE/HOME: {"success":true}, and the request reached the
upstream.

Not tried: the reporter's own machine, upstream and ZCode model (ZCode's
probe streams with max_tokens 1 and the model's first reasoning level, so
an upstream that refuses that shows as 连接失败); WorkBuddy's real app
seeing a magpie sync in this build (its save was read from its code, its
log and file times, then replayed in the test).
2026-10-25 21:44:56 +08:00
yetone 39fed471cc gui: a connected agent's changes read before → now, not as disconnecting undoes them
Zhenzhen (Discord, 0.1.1521, omarchy, Pi on DeepSeek's API) opened Pi's
row: "改动了 ~/.pi/agent/settings.json · models.json", and every line
magpie had added (defaultModel/defaultProvider "magpie", the whole
"magpie" provider in models.json) was red, "−" and struck through, with
`"providers": {}` tagged "接入前的值". The row drew DisconnectPreview in
its own direction, what disconnecting does, so it read as magpie
deleting their config.

changesList now draws the forward view by default: a line magpie added
is a green "+", a value it replaced is "−" old then "+" new, nothing is
struck, and a file magpie created is tagged Created. The restore view
(↺ value before connecting, struck lines, Deleted) stays where it
belongs, in 断开并还原's dialog (askDisconnect passes back=1). Both
callers are the only ones: the row's connectPanel, which every
connected agent's row goes through, and askDisconnect. No new strings;
Created/Deleted/"value before connecting" already exist in every
language. app.js stays under its budget without a raise: eight
el+svg+append triples on the Agents page fold into one el call (same
DOM).

Test: agent-changes-before-now.test.cjs, a wired Pi with the preview
built from the real diffLines output for Pi-shaped files (captured with
a throwaway Go test). Chromium and WebKit, en/zh/zh-TW/ja/de, 890 and
420 wide: the row reads before → now, + green and − red, nothing
struck, magpie.json Created; the dialog keeps ↺, struck lines and
Deleted. Broken by hand: with origin's app.js and app.css it fails
("settings.json reads before → now"); with only the CSS reverted it
fails on the colours.

Run at 7ad6df865 (one rebase back): 128 GUI files that reach the
Agents page, the row, the diff or disconnect, plus gui-*.test.cjs and
i18n-keys, one file at a time, Chromium and WebKit: 125 green (951 +
886 tests). Red: gateway-mode (#3586), routing-steady (#3412) and
routing-live-patch's folded cases (#2174), all three red the same at
7ad6df865 without this change. Run at this head (parent 4b3bdbe28,
which changed 24 masking lines of app.js): agent-changes-before-now,
agent-disconnect-preview, agent-disconnect, agent-connected-unfolded,
i18n-keys green; go test -tags nogui ./internal/gui ok (budgets
included, app.js 1,325,719 of 1,326,105); gofmt clean.

Not tried: a real Pi connect and disconnect in a sandbox HOME, the full
go test ./..., Linux/Windows vet (no Go changed), and the whole GUI
suite at this head.
2026-10-25 21:31:23 +08:00
yetone 4b3bdbe28c masking: the flow's dots, scan and Live dot stop moving once played (#3185)
The Masking page never came to rest. Each dot in its agents-to-providers
flow was an SVG animateMotion with repeatCount "indefinite", the scan
mark on the middle line ran forever, and the Live dot pulsed forever.
The SMIL dots alone made Chromium lay the page out ~700 times a second
(6,965 layouts and 2,282 style recalcs in 10s, read with CDP
Performance.getMetrics). Removing just those 22 elements took it to 0.

Now each dot goes round twice when the flow is drawn, and the scan mark
plays twice. The flow is drawn again only when the numbers change. The
Live dot pulses once each time the list is drawn again, which happens on
each 15s read. Reduced motion is unchanged: still no motion at all.

Measured on a sandbox `magpie app` (origin/main, sandbox HOME, real
deepseek provider, the real masking log copied in: 19,657 values over
577 requests). The Masking page was loaded in Playwright 1.62.0, and only
that browser's own processes were sampled with proc_pid_rusage, 20s per
sample:
- WebKit, before: 180 wakeups/s, 2.8% CPU, 56 mW.
  After: 37/s and 9.7 mW while the motion plays out (8-28s), then
  10.8/s, 0.1% CPU, 1.4 mW.
- Chromium, before: 96-98/s, 17% CPU, 537-543 mW.
  After: 40/s, 2.0% CPU, 57 mW while the motion plays out, then
  18.5/s, 0.5% CPU, 10 mW.
- The other pages at rest: 12-30/s and 1.6-7.7 mW in WebKit.

Test: masking-records' new "the masking page's motion ends" (chromium
and webkit, 1100px and 640px). It moves the SVG clock on an hour and
asks Chromium whether any dot is still in an interval. In both engines
it checks that no SMIL element is set to repeat for good and that no
CSS animation has an infinite end. All 4 cases are red on the old
page.js/redact.css and green on the new ones.

Run at this tree:
- masking-records, held-animations and i18n-keys: 68/68.
- account-mask-sessions, account-mask, mask-actions, mask-emails,
  provider-unmasked and redact-*: 172/172.
- go test -timeout 45m ./internal/gui: ok.
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gui: ok.
- gofmt: clean.

Other states measured, with no change made:
- Go main process at rest with the window open: 25/s, 7 mW.
- Streaming 3 deepseek-flash replies (2,450 SSE events in 20s):
  275/s, 3.5% CPU, 107 mW, about 2 wakeups per event.

Not tried: the window hidden and the tray panel open; the
WKWebView in the real app window on Masking (measured in Playwright's
WebKit instead); the full GUI suite.
2026-10-25 20:33:33 +08:00
yetone 41b0445ccf provider: a local server's address is a field shown first, and address= on the command line (LM Studio on another computer)
mengxiangziyou on X: "供应商里的LM Studio只能用本地的,怎么用局域网里其他机器
上的LM Studio, baseUrl 不能改". Moving a local preset (Ollama, LM Studio,
oMLX, MLX-Serve) to another host has worked since #1165, but the window
put the Address in a "Server address" fold under the key, while the
Endpoints row showed http://localhost:1234/v1 as plain text. Reproduced
in a sandbox: Add > LM Studio shows the URL and nothing to change it
with unless the small fold is found.

- GUI: the Server address field is shown first, above the key, never
  folded, for a new provider and a saved one alike (its label and hint
  are the strings the fold used, so no new i18n keys). Saving still
  sends the URLs moved only when the address was changed.
- CLI: `magpie provider add|set <id> address=<host:port>` moves every
  URL the provider has (chat, Anthropic, Responses, decision), each
  keeping its path; from the preset's when it was saved with none, and
  `address=` alone puts a local server back at its preset's. A provider
  of the user's own moves its own URLs. Vertex refuses it as it does
  url=. Before, Ollama on another computer needed url= and anthropic=.
- TUI: unchanged (asked on adding, `w` after).
- docs/subsystems/providers-accounts.md: Local servers row.

Security: only upstream URLs move. The gateway's own loopback/origin
guards are about inbound requests and don't read them; the one rule
that looks at an upstream being on the LAN (Unredacted) stays the
user's own switch.

Run at this tree (origin/main 642180a80 + this change; rebased onto
2f44e075a, which touches none of these files, then build, the new CLI
tests and local-address.test.cjs run again there: ok):
- New TestProviderAddressMovesALocalServer and TestProviderAddressPairs
  (internal/cli): fail on the old providers_cli.go with `unknown field
  "address"`, pass with it.
- local-address.test.cjs (both engines, en/zh/zh-TW/ja/de, 900 and
  440px): with the old app.js 3 subtests fail at "shown when added,
  nothing to open"; 22/22 pass with it.
- GUI files add-sheet, decide-endpoint-label, local-address,
  nokey-editor, provider-insecure-tls, remote-magpie, provider-unmasked,
  i18n-keys, gui-de, gui-ja, gui-zh-tw: 161/161 pass.
- go test -tags nogui -timeout 45m ./internal/cli ./internal/provider
  ./internal/tui ./internal/gui in a sandbox HOME: all ok.
- gofmt -l clean; go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet on internal/cli; go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: ok.
- Real use, sandbox HOME, built binary (-tags dev): a fake LM Studio
  bound to the Mac's LAN address 10.0.0.111:41234. The window's Add >
  LM Studio showed the field; typing 10.0.0.111:41234 and Add saved
  chat http://10.0.0.111:41234/v1, listed lmstudio/lan-qwen-9b from
  that host (GET /v1/models there), and a chat completion through the
  gateway reached it. `provider set lmstudio address=` put it back at
  http://localhost:1234/v1; `address=10.0.0.111:41234` moved it again
  and the next request went there.

Not run: go test ./... over every package (other sessions' suites on
this machine, load ~60), the whole GUI suite, a real LM Studio on a
second machine, the Windows and Linux apps.
2026-10-25 20:29:22 +08:00
yetone 5be7d05d28 agent: Desktop on magpie offers its own import of the signed-in sessions (lambdua on X)
lambdua on X: "claude Code桌面端支持么? 我桌面端切换账号,对话都能全都不见".
Nothing is lost. Desktop on magpie runs in 3p mode, whose userData is
Claude-3p, a folder apart from Claude/. Desktop 2.7032 keys Code and
Cowork sessions by account and org (claude-code-sessions/<acct>/<org>):
in 1p the claude.ai login's, in 3p the install id in ant-did and a fixed
org. So the sessions made signed in stay in Claude/ untouched and show
again when Desktop is switched back; claude.ai chats are on Anthropic's
servers. magpie's on/off never writes or removes a session (desktopOff
removes only what magpie made, and only when empty).

Desktop has its own importer (Settings -> Import: the signed-in userData,
other Claude* folders, ~/.claude/projects; copies under new ids, originals
left), but in 3p only when the profile's claudeAiImport.enabled is true
(3p-only policy, default off, since 1.28929.0). magpie's profile now gets
"claudeAiImport":{"enabled":true,"bannerBehavior":"detect"} once per
folder set (desktopSeedImport, stash mark claude-desktop.import): on the
switch on, and from Sync at magpie's start for a Desktop already on
magpie. A claudeAiImport already there is kept; one the user removes is
not written back (the mark is read, never unstashed).

Run (suite at origin/main 5df62c5cd, then rebased on 2f44e075a):
- go test ./internal/agent/ -run Desktop -count=1: ok.
- go test ./... -timeout 45m -count=1 at 5df62c5cd (log kept whole):
  every package ok but two reds already on main and filed:
  TestFolderVarsAreListed (#3600, fixed in 2f44e075a) and
  TestNoCommandBypassesProc (#3567, internal/tui/keep.go, open).
- after the rebase onto 2f44e075a: go test ./internal/agent/
  ./internal/proc/ -count=1: agent ok; proc red on #3567 only.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/agent/
  ok; GOOS=windows go build ./... ok; GOOS=linux go build ./internal/agent/
  ok (the CLI and GUI need Wails' cgo, not cross-built here).
Broken by hand:
- desktopSeedImport returning at once (the old code): TestClaudeDesktopFresh,
  TestClaudeDesktopOnKeepsTheUsersOwnGatewayProfile and the new
  TestClaudeDesktopOffersItsSessionImport go red.
- the mark read with unstash (consumed on read): the new test goes red
  with "seeded again over the user's choice". My first draft had this
  bug; the test found it.
Schema checked in Desktop 2.7032's asar (read-only, extracted to a
scratchpad): claudeAiImport is a flat leaf key whose value is the object
{enabled, bannerBehavior}, gated in 3p on enabled === true.
Not tried: a real Desktop in 3p mode with the key (would mean running
Desktop against the live userData); the live Claude folders were only read.
2026-10-25 20:29:08 +08:00
yetone 07936ca890 gateway: a turn held before routing shows on Routing and is answered 504 after 2m
heyusaku6 on X: Codex desktop thought for over ten minutes on a model
served through magpie (a routing group's DeepSeek, then Qoder CN's
MiniMax, then GPT-6.1 Sol), the Routing page showed none of them, and
only restarting Codex and magpie ended it. Codex waits for a reply's
headers with no limit of its own, and a request shows on the Routing
page only once a route is begun for it, so whatever held these requests
held them before routing, in silence.

The root cause was not found. Every pre-route wait read (the classifier,
image description, plugin GatewayBegin, JS middleware, provider.Hold,
the body read, pluginrt.Refresh, the trace lock) has a bound or follows
the request's context. So this makes the stall visible and bounded
instead, and records where it was held:

- counted watches an agent's turn (Chat, Responses, Messages, Gemini
  generateContent, Codex backend /responses) while no route is begun for
  it (unrouted.go). After 15s a route of provider "magpie" shows it on
  the Routing page as routing; it gives way to the request's own route
  when one begins (noteRoute, trace.drop).
- After 2m with no route and nothing written, the client is answered
  504 in its own protocol, whole (Content-Length, Connection: close) so
  it has the error even if the handler stays stuck. The request's
  context ends with errUnrouted, its route ends with the error, and the
  log gets every goroutine's stack (at most once in 10 minutes), which
  says what held it next time.
- The handler writes through heldWriter, which drops its writes once
  magpie has answered for it.

A request waiting on another request's identical image description for
over 2m is now answered 504 too; the retry finds the description cached.

Run in the worktree at origin/main 5df62c5cd + this change:
- The stall was injected as an image description in flight that never
  ends (a never-closed s.sights entry), which holds pastedImage inside
  serve before beginFor. TestUnroutedRequestShownThenAnswered and
  TestUnroutedShownGivesWayToItsRoute are red with the watch unhooked
  from counted (the request never shows; the client waits out its 20s
  timeout) and green with it; the log's stack names describe at
  vision.go:319 under seenBody.
- go test -race -count=3 on TestUnrouted|TestVision|TestEndBroken|Busy|
  Concurrency|Trace: ok.
- gofmt -l clean; go vet ./internal/gateway on darwin, linux -tags nogui,
  windows: ok.
- go test ./internal/gateway -timeout 45m -count=1: ok (537.9s)

Rebased onto 2f44e075a (internal/agent only); at that head go build ./... and TestUnrouted: ok.

Not run: the full ./... suite (another session's full suite was running
on this machine); a real Codex desktop on Windows.
2026-10-25 20:28:36 +08:00
yetone 2f44e075a2 agent: TZ is not an agent's folder (#3600)
c888ef272 made a routing rule's hours fall back to the machine's zone,
which reads TZ in internal/provider/grouprule.go. TestFolderVarsAreListed
asks every variable those packages read to be one a sandbox clears, or to
be excused; TZ is the machine's zone, not a folder, so it is excused.

Run: go test ./internal/agent -run TestFolderVarsAreListed -count=1, ok
(red at origin/main 642d430ec per #3600, the same message).

Fixes #3600
2026-10-25 20:12:48 +08:00
yetone 5df62c5cda pii: pf-serve is pf-v2, which holds the model once on a GPU (#3590)
pf-v2 is 642d430ec's pf-serve (weights-once.patch): on Metal and
Vulkan the GGUF is read straight into the device's buffer instead of
also kept whole in a CPU copy. serveSHA pins pf-v2's five zips, each
checked against the release's SHA256SUMS.

A user who turned the model on before has pf-v1 on disk, in a folder
named for its tag. pf-v1 now still counts as installed and is run
(oldTags), and starting it fetches pf-v2 in the background (upgrade):
once fetched, the running pf-v1 is ended so the next request starts
pf-v2, and pf-v1's folder is deleted. One that can't be fetched leaves
pf-v1 running and is tried on the next start. A fresh download fetches
pf-v2 and deletes an old tag's folder.

Run:
- go test ./internal/pii ./internal/redact (ok), -run TestLoopGuard
  ./internal/gateway and -run Privacy ./internal/gui (ok, the doc and
  the settings route); go build; GOOS=linux and GOOS=windows go vet
  -tags nogui ./internal/pii; gofmt -l clean.
- TestOldServeRunsUntilUpgraded and TestUpgradeThatFailsKeepsTheOld
  are red with `go upgrade()` taken out of start (not upgraded / never
  tried) and with binDir looking at serveTag alone (the old pf-serve
  not taken for installed).
- Real: a sandbox cache with the released pf-v1 darwin-arm64 and the
  real model, pii.Find through it: pf-v1 answered, pf-v2 was fetched
  from the real release, pf-v1's folder deleted, the next request
  started pf-v2 (ps shows its path), 1664 MB phys_footprint idle.
- pf-v2's released darwin-arm64 probed alone: 1680 MB idle (pf-v1 4777
  MB), spans identical to pf-v1's; load ~1 s both, alternated 3 times.

Not tried: the upgrade on Windows, where the old folder can only be
deleted after its pf-serve ends (upgrade ends it first; a folder left
is deleted on a later start).
2026-10-25 20:03:57 +08:00
yetone 254461829b gateway: a Codex Lite request is no longer decoded whole, nor parsed twice for its facts
XiaoYin_OK on X: after a long run the app's memory climbs toward 2 GB.
The owner's own app (26h up) showed RSS 550 MB, HeapInuse 317 MB but
HeapSys 992 MB: the heap peaks while requests are in flight. Its profile
had 209 GB allocated, ~94 GB of it under codexBackend/serve, of which:
- parseResponses 24.7 GB, liftAdditionalTools 14.9 GB of it;
- factsOf 24.6 GB, reached from turnOf (13.6 GB) and dirOf (11.0 GB),
  the same conversation parsed twice per request.

Three causes, each fixed where it is:
1. liftAdditionalTools decoded the whole Lite request into maps to move
   its additional_tools item, and wrote it all again: ~7.6x the body.
   Now only that item and the tools are decoded; every other item and
   member goes byte for byte as it came, written once into one buffer.
2. affine counted the turn in the masked body while dirOf read the plain
   one, two different slices, so factsOf's memo could never serve both.
   affine now counts it in the body as the agent wrote it.
3. That body is rarely the one readRequestBody held (requestModel,
   spawnAgentModels and the lift each write a new one), so factsOf's
   memo missed for it anyway. serve now holds it (holdBody), and holdBody
   lists a body once when it is held twice.

Tests (internal/gateway/lite_lift_test.go), each red on the old code:
- TestLiteLiftMovesOnlyTheTools: same result as the old whole decode
  (liftWhole, kept in the test) on testdata/context/codex.json, the
  merged-namespace case, a 2,000-word conversation and the no-op shapes;
  an item with its keys unsorted, \u escapes and 2.50 goes as written.
  Old: the kept item came back re-sorted and re-escaped.
- TestLiteLiftAllocatesAboutTheBody: under 2x a 1.35 MB body.
  Old: 14,126,976 B (10.4x).
- TestMaskedRequestParsedOnceForItsFacts: a served masked Lite request
  is parsed once for its turn and folder (factsParsed hook in readFacts).
  Old: 2. With only change 2 it was still 2 (cause 3).

Measured (darwin/arm64, a 4,012,240 B Lite body):
- liftAdditionalTools: 30.46 MB/op, 98,560 allocs -> 5.17 MB/op, 6,609.
- readFacts of it: 54.0 MB/op -> 26.7 MB/op.
- Served through New().Handler() with masking on, 8 concurrent x 5
  rounds of a 4,010,268 B body, two runs each:
  allocated per request 215.6 / 220.7 MB -> 116.2 / 116.2 MB;
  peak HeapInuse 993 / 802 MB -> 612 / 561 MB;
  HeapSys 1001 / 892 MB -> 699 / 674 MB.
- The live app's WebKit processes were ~8-9 MB RSS each, so the webview
  is not where the memory went on macOS; the live pid sat at 476-596 MB
  RSS over a 15-minute sample.

Run at this head: gofmt -l clean; go vet ./...; GOOS=linux go vet -tags
nogui ./...; GOOS=windows go vet ./...; go build (gui and nogui);
go test -tags nogui -timeout 45m ./... in a sandbox HOME at d2e0ea393
plus this change: every package ok (internal/gateway 619s) except two
guard reds already on main and untouched here: internal/proc's
TestNoCommandBypassesProc (#3567) and internal/agent's
TestFolderVarsAreListed (TZ in grouprule.go, filed as #3600). After the
rebase onto 642d430ec (one gateway test file added upstream),
internal/gateway was run again: ok (425s), with gofmt and the three vets of it clean.
Not tried: a 26h run of the new build against real Codex traffic, and
Windows (#3383's 4.2 GB report) beyond go vet.
2026-10-25 20:02:12 +08:00
yetone 642180a809 redact: Insights › Masking and Try it mark a made-up key as a placeholder (#3599)
With "Keep a key's form" on (bea9f905d), a secret goes to the vendor as
a made-up key of its form, kept in the record as its placeholder. The
Masking page and Settings' Try it only matched {{…}}. So a request
masked that way showed no changed text: no marks, nothing side by side,
nothing lit. Try it showed the made-up key as plain text.

maskMatches (plugins/redact/page.js) matches the {{…}} placeholders and
the record's own non-{{ placeholders, longest first. A key of the same
form that the user wrote is not marked. All five page.js uses and
maskTryDraw in app.js use it. app.js grows 3 bytes.

Run at this head (origin/main 7536477c8):
- masking-records "a made-up key is marked as a placeholder is"
  (chromium/webkit, en/zh): red 4/4 on the old page.js/app.js (no
  .msk-msg drawn), green 4/4 with the fix.
- mask-actions "Try it marks a made-up key" (chromium, webkit): red 2/2
  on the old code (marks [] for [MADE, MADE]), green 2/2.
- GUI files masking-records, mask-actions, redact-*, privacy-*,
  provider-unmasked, vision-not-marked and i18n-keys, both engines,
  every language: 270 of 270 pass.
- go test ./internal/gui -run 'Budget|Assets|Script': ok.
- Rebased onto 642d430ec: six commits, and in the GUI only app.css and a
  heatmap test. Re-run at the pushed head: the budget tests ok, the six
  new GUI tests 6/6.
- Real run: a sandbox HOME with `magpie web` built from this tree,
  redact + redactShape on, a fake provider with an echo upstream, and
  "OPENAI_API_KEY=sk_w3ax…" sent through the gateway.
  - The upstream got sk_t1ns….
  - Insights › Masking marked sk_t1ns… on the vendor side and sk_w3ax…
    as written here; picking the value lit both.
  - Try it marked sk_t1ns….
  - No page errors.

Found on the way and filed: #3601. A value found by its KEY= context
is masked there only, and its other copies go as written, in either
mode.

Not tried: the old code in the real app (the GUI tests cover it), and
WebKitGTK/Windows.
2026-10-25 19:57:25 +08:00
yetone 642d430ecb native: pf-serve on a GPU reads the model once, not twice (#3590)
On a GPU (Metal, Vulkan), privacy-filter.cpp read the whole 1.6 GB
GGUF into a CPU ggml context, copied every tensor into the device's
buffer, and kept the CPU copy "as source" for as long as pf-serve ran.
#3590's Mac held 4.7 GB of physical footprint idle.

patches/weights-once.patch opens the GGUF metadata-only when the
backend isn't the CPU, and reads each tensor from the file straight
into the device's buffer through one 16 MB chunk. The CPU backend
still reads it whole and uses that buffer in place, as before.

Run: build.sh for every target on CI (privacy-filter run 40188759504,
green on all five), then a probe (start pf-serve, classify 7 texts in
en/zh/code/cards plus a 57K and a 20K text, 20 hot requests, 3 long
ones, read memory after 5 s idle) on the released pf-v1 and on this
commit's CI build, with the pinned model (sha256 80efc180…):

  Mac M4 Pro, Metal, GGML_METAL_NO_RESIDENCY=1 as magpie starts it:
    idle phys_footprint 4777 MB -> 1683 MB, RSS 4798 -> 1706 MB
    hot request median 9.0/13.8 ms -> 10.8/9.9 ms (two runs each,
    load average ~180, so noisy); long 1.5-1.9 s both
  Mac, CPU: 1852 MB both, as before
  Windows, AMD 8060S, Vulkan:
    private bytes 6629 MB -> 1968 MB, working set 3258 -> 174 MB
    hot median 4.2-4.7 ms both, long 0.79-0.85 s both, load 1.2 -> 0.8 s
  Windows, CPU: 1810 MB working set both

The spans are byte-identical before and after on each backend (Metal,
Mac CPU, Vulkan, Windows CPU; each backend's own as before).

Not tried: Linux's pf-serve-vulkan on a real GPU (the same code path
as Windows' Vulkan); linux-arm64 and darwin-amd64 run on the CPU only,
which this doesn't change, and were only built.
2026-10-25 19:52:47 +08:00
yetone 83571db8ed provider: Command Code's plugin is at least 0.1.17, its Credits bar second where magpie shows two windows (01huadalang on Discord)
01huadalang said the Command Code card has no bar for the total quota
left. The Providers account line (quotaLine) and the menu bar
(trayusage) show a provider's first two windows. A plan account's
plugin reported [5 hours, Weekly, Credits], so the dollars were only
in the tooltip. Plugin 0.1.17 (plugins 8531ccc) puts Credits second,
after the 5 hours. The min goes to 0.1.17 so keepMovedCurrent updates
every moved user.

npm view @magpie-community/opencode-commandcode-auth --prefer-online:
latest 0.1.17, published by publish.yml run 40186792179 with provenance
(its npm job is red only on think-tags 0.1.1's known E404, plugins#180).
The plugin's bun test: 65 pass. The plugin's auth.usage, against the
owner's real GOAT account: 5 hours 0.93%, Credits $0.63 / $70.00,
Weekly 1.20% (before: 5 hours, Weekly, Credits). Plugins PR #303 was
reviewed and not merged (it loses the $ on today's magpie and adds no
bar); see its comment.

At the pushed head (this and the provider commit, rebased on
origin/main 758be6d14): go test -tags nogui -count=1 ./internal/gui
./internal/provider in a sandbox HOME: ok (67.5s, 133.5s); gofmt -l
clean; go vet ./internal/gui ./internal/provider ok; go build ./...
(mac) ok; heatmap-scrollbar, usage-heatmap, view-scrollbar and
view-wheel-unheard .test.cjs at 7ad6df865: 38 pass, 0 fail. Before the rebase, at
30bd722ef on d2e0ea393: the same two packages ok (84.9s, 157.1s), and
go vet ./... for mac, GOOS=linux -tags nogui and GOOS=windows ok, with
linux nogui and windows go build ok.
Not run: the full suite (the disk was full). Not tried: a sandbox magpie
showing the bar on the account line. No test fails without a min
bump; the plugin's usage test holds the order.
2026-10-25 19:40:37 +08:00
yetone 47689f9fd9 gui: the usage heatmap scrolls under the app's thin thumb, not the system's bar (cybercaius on Discord)
cybercaius said the usage heatmap's scrollbar looked out of place beside
the rest of the window. .heat-scroll was the only scroller with
scrollbar-width: thin. In Chromium (so WebView2) a non-auto
scrollbar-width drops every ::-webkit-scrollbar rule and draws the
system's bar, gray track and all; on a Mac the WebView draws only the
overlay bar, which a mouse never shows. The line is gone, and the Mac
rules pages, dialogs and framed editors use take .heat-scroll too, so
the weeks scroll under the same 8px (Mac) or 10px thumb as the page.
No layout change.

heatmap-scrollbar.test.cjs: chromium and webkit, on and off a Mac, a
420px card of 53 weeks: the weeks overflow, scrollbar-width is auto,
and the heatmap's bar gutter equals a .view's.

What was run, at this commit's tree (base d2e0ea393):
- heatmap-scrollbar.test.cjs: red on the old app.css in all 4 cases
  ("expected 'auto', actual 'thin'"); dropping only scrollbar-width
  still fails the 2 Mac cases; 4/4 pass with the change.
- usage-heatmap.test.cjs (every language, 420 and 1100px, both
  engines): 26 pass, 0 fail.
- view-scrollbar, view-scrollbar-drag, sidebar-overlay-scrollbar,
  strip-scrollbar, ledger-hscroll, ledger-hscroll-foot, click-scroll and
  every usage-*.test.cjs: 3 reds, none from this change:
  usage-agents-hide (chromium and webkit, 10 subtests each) fails the
  same 22 of 22 on d2e0ea393's app.css (#3414, #2276);
  sidebar-overlay-scrollbar chromium fails one language per run
  ("dragged to the end: 193 of 222") on the old and new app.css alike,
  4 runs each way (#1863).
- Screenshots off and on a Mac, old and new: the system bar before, the
  page's thumb after.
- At the pushed head (this and the provider commit, rebased on
  origin/main 758be6d14): go test -tags nogui -count=1 ./internal/gui
  ./internal/provider in a sandbox HOME: ok (67.5s, 133.5s); gofmt -l
  clean; go vet ./internal/gui ./internal/provider ok; go build ./...
  (mac) ok; heatmap-scrollbar, usage-heatmap, view-scrollbar and
  view-wheel-unheard .test.cjs at 7ad6df865: 38 pass, 0 fail. Before the rebase, at
  30bd722ef on d2e0ea393: the same two packages ok (84.9s, 157.1s), and
  go vet ./... for mac, GOOS=linux -tags nogui and GOOS=windows ok, with
  linux nogui and windows go build ok.
  Not run: the full suite (the disk was full).
2026-10-25 19:40:37 +08:00
yetone 758be6d14e library: magpie-setup is first in the market's skills, so an agent can set magpie up as asked
Leyuu_5 on X: "功能越来越多,感觉可以来个skill让AI来帮设置需求了". The skill
lives in magpie-community/plugins (skills/magpie-setup, e513644) and
teaches an agent to turn a request into magpie's own commands. Listing
it in featuredSkills puts it first under Library › Market › Skills,
official, one click to add, with no setup.

What was run at this head:
- go test ./internal/library ./internal/cli: ok (library's first run
  failed only with "no space left on device" while writing testlog.txt;
  run again on its own: ok 193.7s)
- TestFeaturedSkills extended: magpie-setup first, quota second, both
  Official/Featured with a description; "setup", "routing" and
  "gateway key" find magpie-setup first, "quota" finds magpie-quota
  and not setup. Red with magpie-setup taken out of the list.
- gofmt -l internal/: empty; go vet (darwin), GOOS=linux go vet -tags
  nogui, GOOS=windows go vet on internal/library and internal/cli; go build
- library.InstallMarketSkill("magpie-community/plugins", "magpie-setup")
  in a sandbox HOME against the pushed plugins repo: Installed
  [magpie-setup], SKILL.md in library/skills/magpie-setup.
Not run: the full ./... suite (the disk had under 1GB free), the GUI
suite (no GUI asset changed; market-featured-skill.test.cjs fakes the
list).
2026-10-25 19:34:55 +08:00
yetone fba554c7f8 library: magpie library mcp add without agents= says the server went to no agent
A server added with no agents= is kept in the library and given to no
agent, but the command printed "✓ every agent already has it". It now
says "<name> is in the library, given to no agent yet" and names
`magpie library mcp agents <name> <a,b…>`. With agents=, and for
`mcp agents`, the output is as before ("written into claude").
Found while trying the magpie-setup skill's commands in a sandbox HOME.

Not changed (#3598): `library instructions set` with no agents chosen still
prints "every agent already has it" while no agent is given it.
Instructions have sets, so its check needs the active set's agents.

Run: go test ./internal/cli -run TestLibrary -count=1 ok; the new
TestLibraryMCPAddNoAgents fails on the old library_cli.go (reverted by
hand: "✓ every agent already has it") and passes with it. go vet
./internal/cli and gofmt -l clean.
2026-10-25 19:34:55 +08:00
yetone 6bffcfe178 gateway-key: a key's monthly limit can be set from the CLI again
`magpie gateway-key limit <id> month --cost 5` (and `add month`) failed
with "an N-hour cycle is a whole number of hours …: \"month\"":
parseKeyLimit cut an h off any window ending in one before it looked
for a named period, and month ends in an h. A named period (day, week,
month) is now taken as itself before the <N>d and <N>h forms are read.
Found while trying every command for the magpie-setup skill in a
sandbox HOME.

Run: go test ./internal/cli -run TestGatewayKey -count=1 ok; the new
month cases in TestGatewayKeyLimitCLI fail on the old parseKeyLimit
(reverted by hand) and pass with it. Tried the built binary in a
sandbox HOME: limit <id> month --cost 5 sets "this month".
2026-10-25 19:34:55 +08:00
yetone 7536477c8e gui: the Dock icon flaps its wing and tail as the header logo does
Clicking magpie's Dock icon plays the header logo's .logo.wag on the
tile: the same keyframes, turn points, .9s and cubic-bezier(.3, 0, .3, 1),
a frame every 30ms. The icon macOS draws (its glass tile and glossy bird)
is cut into body, tail and wing by index.html's own clip paths, the tile
under the bird filled with the tile's colour read either side of it, and
each frame turns the pieces over it, set as the Dock tile's content view.
The tile goes back to the system's icon after. It plays only when the
Dock draws icons light (no AppleIconAppearanceTheme, RegularLight, or
RegularAutomatic in light mode); a dark, clear or tinted Dock is left as
it is. A click while it plays doesn't start another.

Run:
- go test ./internal/gui/ -run TestDockFlap: TestDockFlapIsTheLogos holds
  the keyframes, origins, length and easing to app.css and parses the
  bird and clips out of the embedded index.html. Broken by hand: changing
  one keyframe in flapkeys.go turns it red.
- TestDockFlapFrames (MAGPIE_DOCK_APP=/Applications/magpie.app) wrote the
  31 frames; looked at by eye. Frame 0 against the system's own 512px
  render: inside the tile 0.03% of pixels differ by over 40/255 (the
  tile's rim resampled); the pieces' seams were visible until they
  overlapped by 1px.
- A sandbox bundle (own bundle id, sandbox HOME, ports 3446/3447) got the
  Dock's reopen event by pid: a burst of screen captures of the real Dock
  shows the tile in different poses.
- go vet ./internal/gui/, GOOS=windows go vet, GOOS=linux go vet -tags
  nogui, GOOS=linux go build -tags nogui, GOOS=windows go build, gofmt -l.

Not tried: a dark or tinted Dock (skipped by the gate, not drawn), a
real mouse click on the Dock (the same reopen event, sent by pid).
2026-10-25 19:28:05 +08:00
yetone 7ad6df865c whatsnew: many releases' notes read as one list, by kind
The owner: nine releases of a line each, in the update sheet's "What
changed since v0.1.1521", read as a scattered list. When more than one
release is shown, their notes are now merged: a line saying the range
("9 releases · v0.1.1522 – v0.1.1530"), then one heading per kind (New
features, Improvements, Performance, Bug fixes, Security, Provider
changes, Changes, Documentation, then any heading of their own) with how
many lines it has, each line with the version it came in, newest first.
A line two releases both carry is said once, at the newest; a line with
no heading goes under Changes. One release reads as before. Both the
update sheet and What's new (after an update, and Settings' range
picker) merge; the not-installed badge names its range.

Run at this tree (rebased on origin/main 2c7f0ac12):
- GUI, Chromium and WebKit: whats-new 4/4, whats-new-range 12/12 (all
  five languages), update-notes-ask 12/12, whats-new-failed 4/4,
  i18n-keys 4/4, update-release-page 22/22, update-auto 10/10.
- go test -count=1 ./internal/gui: ok. Budgets raised to the bytes:
  app.js 1,326,105, core 1,537,016, no room added.
- Broken by hand: merging a single release turns "one release is shown
  by itself" red; dropping the de-duplication turns "the sheet names a
  release out since the download" red.

Not run: the full Go suite (other sessions' suites on this machine, and
the disk filled mid-run); the GUI suite beyond these files; the real app.
2026-10-25 19:26:17 +08:00
yetone db6d1540ef redact: eval cases that reach more of modelTakes/modelFits
TestMaskEval's cases reached 5 of the 36 checks on model spans: breaking
any other one by hand left it green. This adds 21 cases (39 to 60), most
of them texts from modelfits_test.go and vendorchecks_test.go, the
places the model was seen misreading, and records the real model's spans
on them (testdata/eval-model.json).

Breaking each check by hand (breaks.py: one replacement in model.go,
TestMaskEval run, file restored) now turns 13 red (5 before):
secret-madeID, person-2runes, email-realEmail, person-zhTrim,
person-assistant, account-numberLike, account-cue, address-letter,
secret-wordstart, secret-uuid, secret-hexwords, secret-hexcue,
edge-delimiter.

Still green, because the real model gives no such span on any text tried
(24 more probed) or another check catches the same span first:
secret-namesThing, secret-len8, person-snakeWord, account-madeID,
cut-from-word, person-chars, person-filedot, person-pathpart,
person-colon, person-lowerword (person-chars keeps the same lower-case
word), account-hex, account-version, the four phone checks, secret-pattern,
secret-json, secret-link, secret-base64, email-wordstart, email-modcache,
email-userinfo. Their unit tests in modelfits_test.go still cover them
with recorded spans.

A new real miss: "hex40 ok? 1 <sha1>" is one secret span "1 <sha1>" to
the model, and the hex-words check only looks at the first field. Filed
as #3597 and marked Known.

Totals at this head (rules / model / both, masked and wrongly):
16/40 0/89, 38/40 28/89, 39/40 1/89.

Run: MAGPIE_EVAL_CACHE=$HOME/.cache go test -run TestMaskEval -v
./internal/redact (recorded, then replayed green); go test -count=1
./internal/redact ./internal/pii ok; go vet ./internal/redact for darwin,
linux and windows; gofmt -l clean; breaks.py over all 36 checks.
Not tried: the full suite (only test files changed in internal/redact).
2026-10-25 19:17:53 +08:00
yetone dc6f3d496c masking: the flow's logos sit on one disc each, before the name on both sides
Insights › Masking's flow card showed each agent's and provider's logo
bare in a 16px box. A logo's own drawing fills that box or not (Pi's
edge to edge, Codex's a small tile, Alma's a picture), so three logos
of one box read as three sizes (the owner's screenshot). And an
agent's logo came after its right-aligned name, so the logos and the
names on that side lined up with nothing.

- Every logo sits 14px on a 24px disc (card fill, hairline ring), the
  disc the app's agent stacks use.
- Both sides read logo, then name over count, left-aligned. The
  agents' nodes are one block against the lines (a grid track as wide
  as the widest), so their logos make one column and their names one
  edge, as the providers' do.

Run (rebased on origin/main of 19:00, 10-25):
- masking-records.test.cjs: 52/52, Chromium and WebKit, 5 languages,
  1100px and 640px. Its flow check now asserts logo before name on
  both sides, a 24px round disc for every logo, and one column of
  logos and one edge of names per side.
- Screenshots with the owner's case (Pi, Codex, Alma → OpenRouter,
  Codex, OpenCode Zen), dark, 1x and 2x, looked at.

Broken by hand: the agent's logo back after its name turns
masking-records red ("the logo before the name").

Not tried: the light theme by eye (the disc is drawn from theme
tokens), the real app on WebKitGTK or Windows. Budgets untouched:
plugins/redact isn't in the core.
2026-10-25 19:14:47 +08:00
yetone 30d3001a04 gui: a wheel or coast macOS 13's WebKit never tells the page of still scrolls the view (issenn on Discord)
issenn, on macOS 13.7.8 (system WebKit 18615, Safari 16.6's): no page of
the window scrolls by trackpad or mouse wheel, the bar doesn't move, a
forced trackpad scroll shakes and snaps back, and only dragging the bar
works.

Cause (hedged, not seen on a real WebKit 16.6): the view guard puts back
every .view scroll outside a window the reader's own events open (wheel,
touch, keys, scrollOnPurpose). The bar's drag goes past it (barDrag),
which is why that alone works. WebKit 16.x can scroll a view under a
wheel or a coast it never dispatches to the page (WebKit bug 256582,
Safari 16.4.1: monitorEvents(window) showed no wheel over some
elements). With no wheel heard, no window opens, and every reader scroll
is taken as code's and put back. That is the shake, and the v0.1.1488
coast chain couldn't help, since it starts from a heard wheel.

Fix, in puttingBack: three put-backs on one view in one direction within
a second, with no click holding (held), are the reader's. They are given
back, and the fling window opens. Each later put-back the same way
within a second of the last is given back at once. So a wheel turned
slowly, or one run broken on a loaded Mac, loses no step. A scroll by
code happens once and makes no run: two at rest are still put back, and
scrolls a click holds against still are. On a WebKit that does dispatch
the wheel, nothing changes: the wheel opens the window first and
nothing is put back. To stay under appScriptBudget with no raise, the
guard header's click bullet was shortened, and its detail moved to
gui-shell.md.

Test: view-wheel-unheard.test.cjs (Chromium and WebKit, en and zh). A
capture listener stops every wheel before app.js hears it. Then:
- ten fast 20px wheels must move the view 190px or more;
- five notches 400ms apart must land, down and back up;
- six wheels up must bring it back;
- two code scrolls at rest are still put back;
- after a click on an agent row, a code scroll each frame leaves the
  row in place.

Run:
- At origin/main d2e0ea393: red 6/6 ("left at 0" before the slow case
  was added, "five slow notches" after).
- With the first version of this fix (a 150ms chain): red 6/6 on the
  slow notches. On a loaded box its fast case also lost a run (left at
  160).
- Broken by hand. With the held gate removed: red 6/6 ("the row clicked
  stays: at 311.5 ..., 191.5 once at rest"). With the continuation
  removed: red ("five slow notches").
- With the fix: green 6/6.
- go test -tags nogui -run Budget ./internal/gui: ok at the rebased head
  (app.js 1,323,345 of 1,323,401).
- GUI, the 27 files a view's scroll reaches (scroll, view-*, click-*,
  old-webkit, update-auto, routing-days-fit, routing-failed-open,
  text-size, sidebar, last-page), both engines, every language, under
  the suite lock: 306 pass, 15 fail. Every red fails the same way at
  origin/main 0cba7fa68, run in a base worktree:
  - sidebar.test, the masking tab (#3498);
  - menu-input-scroll, chromium (#3402);
  - old-webkit's :has() in app.css (#3403).
  An earlier run also had sidebar-overlay-scrollbar webkit (#1863) and
  menu-input-scroll webkit red under load, on base too. Both passed on
  this run.

Not tried: a real macOS 13 / WebKit 16.6 (none runs on this macOS 26.2),
a real trackpad, the whole GUI suite. A click followed within 4s by a
wheel the page never hears still holds the click's row, since a
put-back while held is never given back.
2026-10-25 19:08:53 +08:00
yetone 2c7f0ac12c plugin: options saved from a hooks package's own page reach its hook
SetPageOptions saved without starting the host again for any package whose
page and panels looked like all it had. Window() only reads main/exports,
so a package with magpie.hooks and a page (magpie-community/plugins#117's
PowerContext) counted as page-only. The host hands each hook the options it
loaded with, so a Service URL or key saved from the page did nothing until
magpie restarted. A gateway hook now goes through SetOptions, as a
middleware and an agent already did.

Run at d2e0ea393 plus this change:
- TestGatewayHookSeesOptionsSavedFromItsPage: red on the old page.go
  ("tag=first after the page saved, want second"), green with the fix.
- go test -tags nogui ./internal/plugin: ok (118s).
- go test -tags nogui -run 'TestAsyncGateway|TestGatewayHook' ./internal/gateway: ok.
- go test -tags nogui -run 'Page|Plugin' ./internal/gui: ok.
- GOOS=linux and GOOS=windows go vet of internal/plugin and internal/gateway; gofmt -l clean.
- The real PowerContext package (PR head 3a6aa8f rebased on plugins main)
  in the real Bun host behind New().Handler(): before the fix a page save
  sent nothing to the new server; after it, the next request resolved,
  prepared and hinted against the new server with the new key.
Not run: the full go test ./... (machine at load ~340).
2026-10-25 19:06:34 +08:00
yetone d2e0ea393d pii: pf-serve starts with ggml's Metal residency heartbeat off (#3185)
macOS's Energy Impact puts magpie at the top while CPU stays at ~6%
(#3185). Energy Impact counts wakeups, and an idle pf-serve (the
privacy filter's llama.cpp child) woke 134-146 times a second: ggml's
Metal backend keeps a residency set alive with a heartbeat. pf-serve
stays up for 10 minutes after each masked request, so any masking user
pays that most of the day. GGML_METAL_NO_RESIDENCY=1 turns the residency
set off.

Measured with proc_pid_rusage (ri_interrupt_wkups, ri_energy_nj) on an
M4 Pro, idle pf-serve, 20s windows:
- before, pf-serve pf-v1 as magpie starts it today: 140.0 and 138.5
  wakeups/s, 2.67 mW; the user's live v0.1.1370 pf-serve child read
  134-142/s
- after, pf-serve started through pii.Find at this commit: 0.4, 0.3,
  0.3 wakeups/s, 0.02 mW
- GGML_METAL_RESIDENCY_KEEP_ALIVE_S=0 or 1 instead: 143-146/s, no help
- latency: hot requests 51-78ms either way; the first request after a
  5-60s idle spell 57-77ms before, 105-518ms after; 90s idle through
  pii.Find at this commit 56-183ms

Run at this commit:
- go test -count=1 ./internal/pii/ ok;
  TestServeStartsWithoutResidencyHeartbeat red with the env line put
  back to os.Environ() ("residency " on both starts), green with it
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/pii/ ok,
  gofmt -l clean

Also measured: current main in a sandbox HOME with clones of the real
Claude/Codex sessions and magpie cache (no logins), window open, after
warm-up: main process 1.1-2.2 wakeups/s, 0.9-1.9 mW; its WebContent
0.5/s and GPU 0.3/s. The app.js intervals and the Go tickers were read
and are already held while the document is hidden or cheap.

Not tried: the full suite (an env-only change to one package); a
logged-in instance. The user's live v0.1.1370 main process reads 69-217
wakeups/s and 25-120 mW, which the sandbox at main (no logins) doesn't
reproduce, so its source is still unknown; Vulkan/Linux pf-serve (the
variable is Metal's only and ignored there).
2026-10-25 18:40:25 +08:00
yetone 0cba7fa680 provider: ZCode's mover min is 0.1.30 (plugins #387)
zcode 0.1.30 (plugins 57598ad) puts metadata.user_id
{"device_id":<sign-in's device>,"account_uuid":"","session_id":""} on a
GLM Coding Plan or team Messages request when the agent sent none, as
ZCode 3.14.3's client does on every Anthropic-format request
(glm/zcode.cjs Pst/MLs, vWr); before, only the Start Plan's dressed body
carried it. A key-only account's device is hashed from the key, the same
on every start. keepMovedCurrent brings every moved user up to it.

npm view --prefer-online @magpie-community/opencode-zcode-auth version:
0.1.30 when this landed.
Run at this tree: go test ./internal/provider/ -run
'Mover|Move|Moved|Migrat|ZCode|Retir|Adopt|HandOver' -count=1 -> ok.
Not run: the full suite (a one-line min change).
2026-10-25 18:34:27 +08:00
yetone 09c0a844bd gui: the tray panel draws its last allowances at once and asks for them beside the state (#3160, #3134)
The panel's Allowances tab stood on skeletons until the whole /api/state
had been read and only then asked /api/usage/quotas: the request trace on
the old code shows the quotas GET starting after the state ends every
time (state 216+73ms, quotas at 321ms; a run whose state took 2704ms
asked at 2825ms). On a machine with many agents the state alone is
seconds, and the vendors' reads came after it.

- The panel keeps the allowances last read in its webview's storage
  (magpie.panelQuotas) and draws them at once, each card's refresh
  turning (.quota-refresh.reading) until the read lands in their place
  (yiliang114's stale-while-revalidate, #3160). Kept cards wait for a
  state, the kept ?last=1 one or the read one, to say which are hidden.
- The first load asks for the allowances beside the state, not after it
  (panelQuotasNow, the same opened/not-opened rule as before, #1588).
- The core budgets go to the new size: the tray panel's, the core's own.
  84c50f032 had left app.js 4 bytes over the budget on main
  (TestCoreScriptBudget red there); the new size counts them.

Measured (sandbox HOME, deepseek's real key and balance, dev build of
the old and new code on their own ports, playwright opening
/?mode=panel on the Allowances tab at 360px, 14 runs each, old and new
interleaved, load ~180), median ms from DOMContentLoaded to cards drawn:
  Chromium 347 -> 160, WebKit 723 -> 211
(whole open, dominated by script load at this load: Chromium 5049 ->
2646, WebKit 7282 -> 4507).

Run at this head (rebased on f1537d9f9; the budget test and
panel-quota-kept again after the rebase): panel-quota-kept 20/20 (Chromium and WebKit, en zh
zh-TW ja de, 440 and 360px); red on the old assets (TimeoutError,
nothing drawn) and red with the early ask taken out by hand (the
allowances asked before the state assertion). panel-quota-lazy and
panel-quota-refresh 40/40; every panel-* and quota-* file and
i18n-keys pass except quota-count-wrap's WebKit case, red the same on
origin/main 11907448e (#2228, #3404). go test -timeout 45m
./internal/gui ok; GOOS=linux and windows go vet -tags nogui ok;
gofmt clean.

Not tried: clicking the real tray icon (System Events scripting failed
here); the 53 other test files that open mode=panel (running after
push); a real Codex or Claude account (deepseek only); Windows and
Linux webviews.
2026-10-25 18:31:33 +08:00
yetone f1537d9f95 context: the map counts on as a live request grows, and keeps its tip
The owner asked for the rest of what flohoeller's context map on X does,
keeping the A1 colours. On a live request's redraw:

- Every token count (the big number, the short head, the legend, each
  tile's value) counts on from what it said to the new value over 620ms
  (ease-out), instead of jumping. morph rolls any element with data-n;
  a tile's value rolls as the tile glides. With motion reduced, or on a
  first draw, the value is simply set.
- A tile pointed at keeps its tip through the redraw: the tip is told
  again with what the tile holds now and kept over it while it glides
  (followTip). Before, every redraw closed it.
- A tool's gathered results say how many ("exec_command ×20"), and the
  small files gathered into one tile name the folder they share
  ("api/ · 6 files") where they share one; otherwise "N more" as before.
  "{n} files" is translated (zh, zh-TW, ja, de).

A frame's time can be before the roll's start, which made the first
frame count back (40K, 39.8K, 40.7K); the progress is clamped at 0.

coreScriptBudget: 1,530,631 to 1,533,445: 2,810 bytes of context.js
(which the Routing page draws as well as Usage) and 4 bytes 84c50f032
added to app.js without raising it, which left TestCoreScriptBudget red
on main (1,530,635 > 1,530,631). With no room added.

Run:
- New tests/context-map-live.test.cjs, chromium and webkit, en zh zh-TW
  ja de, at 1100 and 420px, plus motion reduced: 22/22. Broken by hand:
  closing the tip in fill went red ("the tip closed as the request
  grew"); rolls forced quiet went red ("the count jumped: 48K").
- Every context, routing-ctx and i18n GUI file (context-map, -picks,
  -scroll-end, -text, -tune, -window, group-context, i18n-keys,
  routing-context-fold, routing-ctx-fold, routing-ctx-still, and the new
  one): 268/268.
- go test ./internal/gui: ok (220s) before the rebase onto 84c50f032;
  at the pushed head TestCoreScriptBudget, TestAppScriptBudget and the
  TestI18n tests: ok.

Not run: the full Go suite (two other sessions' suites were running on
this machine); the rest of the GUI suite.
2026-10-25 18:28:06 +08:00
yetone b30734f964 sessions: Antigravity CLI (agy) conversations are listed, with title, folder, tokens and resume (RickyWei, #1718)
agy's conversations were on no Sessions page: internal/sessions had no
lister for them, only the calls reader of #2097. Now each
~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript_full.jsonl
is a session (agy.go). Its steps give the start and last times, the first
prompt (taken out of agy's <USER_REQUEST> wrapper), prompts, replies, tool
calls, and tokens under the model "agy", since no step names one. A step
written again replaces its tokens, read on or read whole. The title and
folder come from the conversation's conversation_summaries.db row:
title, and workspace_uris through agyFolder, which turns file:///C:/... and
file:///c%3A/... into C:\... and a host into \\host\share on Windows. agy
writes the title after the transcript, so the row is the file's rev. The
database is read again only when it or its -wal changed, and a failed read
keeps the rows read before. A row with conversations/<id>.db and no
transcript (#1718's case) is listed from the row alone, with no tokens and
no conversation to open. Resume is "agy --conversation <id>". When agy is
set to use magpie, it is the agent's launch command (gateway variables and
--model, the PowerShell form on Windows) with --conversation after it,
through sessions.AgyStart, which package agent sets. The transcript (user
text, thinking, text, tool calls, tool results) can be opened and searched.

Format read from real files: agy 1.3.5 and 1.4.7 in a sandbox HOME
against a fake Gemini endpoint, with plain replies, a read_file tool call
with thinking, invalid tool calls, and a conversation picked up again with
--conversation from another folder. testdata/agy-sessions is three of
those conversations with paths rewritten to /work.

Resume tried for real in the sandbox: `agy --conversation <id> -p again`
from another folder appended steps 2-4 to the same transcript and kept the
row's folder. Interactive `agy --conversation <id>` (in tmux) showed the
earlier turns.

Run at this tree, rebased on origin/main:
- gofmt -l internal clean
- go vet: darwin; GOOS=linux -tags nogui; GOOS=windows
- GOOS=windows go build ./...; GOOS=linux go build -tags nogui ./...
- go test -count=1 ./internal/sessions ./internal/gui ./internal/agent: ok
  before the row-only change. After it, sessions ok, and gui had one red,
  TestMainWindowCorners killed at its 40s deadline at load ~300 (#1936).
  It passes alone (47s).
- GUI (playwright 1.62.0, chromium and webkit, en and zh): i18n-keys,
  gui-de, gui-ja, gui-zh-tw, session-terminal, sessions-bar-names,
  sessions-manage, sessions-talk, sessions-toolbar: 49 of 49. No GUI asset
  changed. Tab names come from the agent registry.

Fails without the change (broken by hand, each one red):
- agyFiles out of allFiles: TestAgySessions, TestAgyTitleLater, TestAgyTranscript
- agy out of refresh's DBRevision check: TestAgyTitleLater
- no dropUse of a rewritten step: TestAgyGrows (4510 input, want 3010)
- AgyStart ignored: TestAgySessions (wired resume)
- drive letter not handled: TestAgyFolder
- agy out of HasTranscript: TestAgySessions, TestAgyTranscript
- the row-only listing off: TestAgyRowOnly; readable() off: TestAgyRowOnly

Not tried: agy on Windows. The Windows box (10.0.0.132) didn't answer
ssh, so the Windows paths are covered by unit tests only (agyFolder,
the Set-Location resume form). A wired resume through magpie's real
gateway was not tried. Not done: subagents (parent_conversation_id),
which I never saw agy write. The model name, which is only in
conversations/<id>.db's protobuf (#3147). Deleting an agy session from magpie. agy in WSL: #3595.

Side effect: agy's self-updater ran in the sandbox and replaced the
live ~/.local/bin/agy, 1.3.5 -> 1.4.7.
2026-10-25 18:24:20 +08:00
yetone 84c50f0328 update: an old "up to date" isn't said, and Settings' Version row asks again (RickyWei)
RickyWei (Discord, Windows, Chinese UI): Settings > 关于 said 版本 0.1.1402 ·
已是最新 with v0.1.1517 out on yetone/magpie-releases.

Cause, from the v0.1.1402 code (internal/gui/update.go is unchanged since):
state "latest" is set only when a check that worked found nothing newer,
and a failed read is state "error" ("Couldn't check for updates"), so the
row's claim is the answer of one check. Nothing aged it: the state stayed
"latest" until the next check, and the row only read it. v0.1.1402 was the
newest release from 13:14 to 13:37 UTC on 10-24 (v0.1.1403 at 13:37), so
a check then said up to date, and with automatic checks off (Settings'
"only when asked") or once a day that stood for the next day while ~115
releases went out. The feed itself is right: usemagpie.ai/api/latest,
with ?lang=zh too, answers 0.1.1517 (gh release list agrees), the version
order is numeric, and nothing on Windows skips the check. Hedged: the
user's settings aren't known, so the interval is inferred, not seen.

Now:
- jsonIn reports a "latest" older than freshAfter (5 min) as "" (not
  asked lately), so no surface says up to date from an old answer.
- GET /api/update?fresh=1, which only Settings' Version row sends, asks
  the feed again over a stale "latest" with automatic updates on; the row
  shows checking and reads again. With them off nothing is asked by
  itself, and the row says "Automatic updates are off" with Check.
  The header pill's reads don't ask, so the feed's cadence is unchanged
  for a window left open.
- app.js stays inside TestCoreScriptBudget: a comment word went.

Run, at this tree:
- TestStaleLatestIsNotUpToDate (new): 1402 checked while newest, then
  the feed at 1517 and the answer aged past freshAfter: the plain read
  isn't "latest" and asks nothing, the row's read finds 1517
  ("available"); with automatic updates off it is "" and asks nothing.
  Red on origin/main's update.go ("an old answer still says up to date"),
  green with it.
- update-check.test.cjs asserts the row reads with fresh=1: red on
  origin/main's app.js (4 of 4 language/engine cases), green now.
- go test -tags nogui ./internal/gui ./internal/update (sandbox HOME): ok.
- The 21 GUI files that fake /api/update plus i18n-keys, Chromium and
  WebKit, en/zh where they cover them: 299 of 300 pass. The red is
  header-centre webkit (ResizeObserver loop as a page error), red the
  same on untouched origin/main d58053720 2 of 2, filed as #3479.
- gofmt -l, go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: clean.

Rebased onto c888ef272 after that run: go test -tags nogui ./internal/gui
./internal/update (TestCoreScriptBudget in it), the Windows and Linux
vet of internal/gui and gofmt again there: ok.

Not tried: the full go test ./... and the whole GUI suite (load ~160);
a real Windows install; the clock's monotonic reading across a Mac or
Linux sleep (Windows' InterruptTime counts sleep, so it isn't this case).
A v0.1.1402 that says up to date finds the update with a click on 检查
(the click asks the feed itself); one with automatic checks off keeps
needing that click, or a download from usemagpie.ai.
2026-10-25 18:22:13 +08:00
yetone c888ef2725 routing: a rule's hours are kept in the zone they were set in (gaubeebangeel on X)
magpie on a cloud server in UTC read a routing group's rule hours on the
server's clock, so a Beijing user's 09:00-18:00 held at 17:00-02:00
Beijing time, with nothing saying so.

- provider.TimeWindow carries the IANA zone its hours were set in
  ("zone": "Asia/Shanghai", omitempty). Holds reads From, To and Days in
  that zone (time.LoadLocation, cached; Go's embedded tzdata, so Windows
  knows them too). A window with no zone, every one saved before this,
  stays on magpie's own clock (time.Local) as before. A zone magpie
  doesn't know is refused on save (clean); one in a file edited by hand
  makes the window never hold, so the rule is as if absent, never always
  on and never hours off. Text() adds " (Zone)"; Line() writes tz=.
- GUI: changing a rule's hours or days in the editor saves the browser's
  zone (Intl resolvedOptions().timeZone); hours left alone keep theirs.
  /api/groups gives magpie's clock (clock: zone, offset in seconds), and
  when its offset differs from the hours' zone the Routing page tells the
  zone beside them, on the group's rules and in the editor: "Asia/Shanghai
  time" (zh "Asia/Shanghai 时间"), or "server time, UTC+0" (zh "服务器时间
  UTC+0") for hours with no zone. Nothing is added when the clocks agree.
  zh, zh-TW, ja, de.
- CLI and TUI: time=09:00-18:00@Asia/Shanghai or tz=Asia/Shanghai; with
  none, this computer's zone ($TZ, time.Local, the /etc/localtime link)
  when it has an IANA name, otherwise none (magpie's clock). An unknown
  zone is refused with what one looks like; tz= alone needs time= or
  days=. Usage text updated.
- docs/subsystems/gateway-routing.md: the zone rules.

Older magpie reading a shared or synced group ignores zone and reads the
hours on its own clock, as before.

Run in a sandbox HOME with pinned Go caches, first at base 9277c2567,
then again after the rebase onto origin/main d58053720 (vet, builds, the five packages,
routing-time-zone and i18n-keys all ok again there; then rebased onto
11907448e, which changes migrate_side.go and sessions only, and
internal/provider ok again, 139s):
- gofmt -l on the changed files: nothing. go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: clean. go build, GOOS=linux
  go build -tags nogui, GOOS=windows go build: ok.
- go test -timeout 45m -count=1 ./internal/provider ./internal/cli
  ./internal/tui ./internal/gui ./internal/gateway: all ok (provider 170s,
  cli 64s, tui 30s, gui 192s, gateway 513s; after the rebase 180s, 62s,
  25s, 181s, 568s); logs kept whole and grepped, no FAIL.
- New tests: TestRuleTimeWindowInItsZone (window, past midnight and days
  in a zone, instants in UTC), TestRuleTimeWindowWithoutZoneIsLocal,
  TestRuleTimeWindowUnknownZone, TestParseRuleTimeZone, TestRuleInZoneHere,
  TestGroupRuleTimeZoneCmd, TestRuleTimeWindowInItsZoneAtTurnStart
  (gateway, ruleClock in UTC). Run under TZ=UTC, TZ=Asia/Shanghai and
  TZ=America/Los_Angeles: ok. The zone used is Asia/Shanghai, or
  America/New_York on a computer on Beijing's clock, so they are red on
  any machine.
- GUI (playwright 1.62.0, chromium and webkit): routing-time-zone (new:
  en, zh, zh-TW, ja, de, 420px wide, browser in Asia/Shanghai, server in
  UTC and in Asia/Shanghai) 14 of 14; routing-time with the browser in
  Asia/Shanghai, the typed rule saved with its zone; routing-time-went,
  routing-day-window, routing-save, routing-rules-line, i18n-keys: ok;
  TestCoreScriptBudget ok.

Broken by hand: Holds reading at.Local() instead of the zone made
TestRuleTimeWindowInItsZone red under TZ=UTC (Shanghai's 10:00 not held,
18:00 held) and under TZ=Asia/Shanghai (with New York), and
TestRuleTimeWindowInItsZoneAtTurnStart red (10:00 Beijing went to the
group's order). routing-time-zone.test.cjs run against origin/main's
client is red (no zone told beside the hours).

Reds not from this change, the same on an untouched origin/main 99de8e1ad
worktree: routing-pause chromium 7 of 7 (#3410); routing-time webkit "Add
a rule" outside the viewport, 1 of 3 runs on main too (#3465);
routing-rules-line webkit zh 1100 once under load, passes alone on both
(#3593, filed now).

Not tried: a real cloud server in UTC with a browser in Beijing (the GUI
test sets the browser's zone and the server's clock instead); the Windows
box; the whole GUI suite.
2026-10-25 18:18:02 +08:00
yetone 11907448e3 provider: the Cursor mover's min is 0.2.23, which sends a Team account's x-cursor-team-id (plugins#231)
npm view --prefer-online @magpie-community/opencode-cursor-auth: 0.2.23.
Ran: go test ./internal/provider -run 'Mover|Moved|Min|Cursor' (ok), gofmt -l clean.
Not run: the full suite (a one-line min change). The plugin change itself
was reviewed and run against a real Cursor account in plugins#231.
2026-10-25 18:01:37 +08:00
yetone 120264a49f sessions: a Codex line's marks are read in one pass, not one bytes.Contains each (#3493)
callHead and codexCallLine asked of every rollout line, with a
bytes.Contains each, whether it held "type":"user_message",
"role":"user", "type":"function_call_output" and nine more: up to twelve
passes over the line in each, a line of megabytes of tool output
included. A CPU profile of a cold usage read on Windows (20,807 Codex
rollouts, 44GB, magpie web in a sandbox home on the Windows box) put 37%
of its 270s of samples in that bytes.Contains (indexbody).

cxMarksOf reads them all in one pass: it walks each `":"` that ends a key
(in a JSON string the quotes are escaped, so never one inside a string),
and records the "type" values and the user's role it finds. It finds
what each value's own pass found: the same line, anywhere in it.

Run:
- TestCxMarksAsContains: twelve lines (long escaped strings holding the
  values, a nested value past a long string, "subtype"/"xtype" keys,
  "role":"users", empty and cut lines) give the same marks as a
  bytes.Contains of each. Red when the role is not recorded (3 lines).
- Every line of the owner's real ~/.codex/sessions, read only: 619
  files, 20,059 lines, 4.3GB, 0 lines whose marks differ.
- BenchmarkCxMarks, a 1MB exec_command_end line: 0.36ms a line, from
  11.2ms.
- Windows box, cold (.cache\magpie removed), magpie web, 3 rounds each,
  alternating, origin/main 552e974f2 against this change:
    CPU in the first 70s:  214.3 / 214.1 / 216.0s  ->  127.2 / 123.4 / 124.5s
    peak working set:      318 / 297 / 311MB       ->  344 / 342 / 325MB
  The peak is ~25MB higher: the same work is done in less time. Not
  changed here.
- go test ./internal/sessions/ ./internal/usage/ ./internal/gui/: ok.
  gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui
  ./internal/sessions/ clean.

Not changed: codexBody (codex.go) asks the same values with
bytes.Contains, but only of lines codexHead let through by their head
(1% of the profile's bytes.Contains was there, under 1s).
2026-10-25 17:57:52 +08:00
yetone d580537201 provider: the ZCode mover's min is 0.1.29, a sign-in keeping the account's user id
zcode 0.1.29 (plugins 5c9b7a4) gives each sign-in uid: ZCode's user_id,
so the plugin host tells two ZCode accounts of one name apart (wakkana
on Discord reported it for WorkBuddy), and the app's entry follows ZCode
only while it is signed in to that user id. keepMovedCurrent brings moved
users up to it.

npm view --prefer-online @magpie-community/opencode-zcode-auth version:
0.1.29 at landing. go test -run 'Mover|Movers|Notice|Migrat'
./internal/provider: ok.
2026-10-25 17:45:01 +08:00
yetone 552cdf8071 redact: a value the model spans from the delimiter before it is masked (#3591)
The model's span may start at the token before a value: the `":"` of
a JSON field, a CSV row's comma. A phone number in
{"phone":"+86 139 1234 5678"} came as `":"+86 139 1234 5678`, and in a
CSV row as `,+81 90-1234-5678`, which the PHONE check took for no
number, and it went as written. A name came as `"Wei Zhang"` and was
masked with its quotes, so the JSON lost them. modelSpans now trims
spaces and `"',;:` from both ends of a name's, a phone's, an
address's, an account's and an email's span; a secret's only spaces,
since a password may start or end with a quote.

Found by TestMaskEval: its 3 #3591 phones are no longer Known, and
"both" reads 33/34 masked, 0/40 wrongly (from 30/34).

Run: go test ./internal/redact and ./internal/pii ok; -run
'Mask|Redact|Privacy' ./internal/gui ./internal/gateway ok; go vet
darwin, linux, windows; gofmt -l clean.
Broken by hand: edge = isSpace for every kind: TestModelSpanLeavesDelimiters
red (both phones as written, the name's quotes gone) and TestMaskEval
red on the 3 phones.
Not tried: the full suite (internal/proc's #3567 is red on main), a
real request through the gateway with the model on.
2026-10-25 17:44:52 +08:00
yetone 033990e642 redact: the masking evaluation starts with nothing known
A value Mask masks is known from then on, and masked wherever it is
again (known.go), Preview's too. TestMaskEval ran after the tests that
masked hunter2pass, rina.k@fastmail.com and the like, so in the
package's full run what they masked was masked in its cases too, and
the rules' column was not the rules': with one test before it that
masked the eval's phones, rules read 19/34 for 16/34. Forget
(export_test.go) lets every value go before the cases.

180cfb565's body says 38 cases; there are 39.

Run: go test ./internal/redact (TestMaskEval in the full run and
alone: 16/34 rules either way) and ./internal/pii ok; go vet darwin,
linux, windows; gofmt -l clean.
Broken by hand: without Forget and with a test before it that masks
the eval's phones, rules read 19/34.
2026-10-25 17:44:52 +08:00
yetone a30aed0162 provider: the WorkBuddy mover tells two accounts of one nickname apart by uid
wakkana on Discord: WorkBuddy accounts with one display name collapse
into one, deduped by name (wbWho's nickname, addSideLogin's EqualFold).

Where that runs today: WorkBuddy's built-in sign-in is gone, so
addSideLogin no longer writes WorkBuddy accounts. A sign-in through the
plugin goes to the plugin host, whose settle already keeps two accounts
of one name with different uids apart and lets the same uid replace
itself (#413, TestPluginSameNameOtherUID, passes at this head). What was
left by name is the mover, for accounts not moved yet:
- wbLogins dropped WorkBuddy desktop's account when an account magpie
  signed in had the same nickname, whatever its uid (the generic "one of
  magpie's stands for the agent's own" rule). Now it stands for it only
  when the uid matches; one removed in magpie stays out.
- renewedSince matched by name, so the desktop's marker read as the
  other "Me" renewed and the move would never commit. Moving and
  movedAccount carry the vendor's id (WorkBuddy's uid), matched by it
  where both have one; the agent's own is never compared; putBack skips
  by plugin key, not name.
Other movers have no id set, so they match by name as before; their
built-ins name accounts by email or login. The live addSideLogin callers
(Copilot, Google, ChatGPT API) name accounts by login or email too.
Sibling plugin: zcode 0.1.29 (plugins 5c9b7a4) now gives a uid, its
min is raised in a separate commit.

Run on origin/main 1dfa28484 plus this change; rebased onto 180cfb565,
whose two commits touch only internal/redact and the GUI:
go test -timeout 45m -count=1 ./internal/provider ./internal/plugin: ok.
GOOS=linux and GOOS=windows go vet ./internal/provider, gofmt -l: clean.
Broken by hand: TestWorkBuddyMoverSameNameOtherUID is red with
workbuddy.go from HEAD (one account moved) and, separately, with
same() by name only (the other account read as renewed).
Not tried: a real move with two same-name WorkBuddy accounts. Accounts
the old built-in already collapsed are gone; nothing brings them back.
Not run: the whole suite.
2026-10-25 17:42:37 +08:00