Commit Graph
7552 Commits
Author SHA1 Message Date
yetone 72facf72e2 memory: a search or save can name its project, and every answer says whose and where (Norethcy on X, #6392)
The memory tools had no target-project argument and no way to see the
caller context they resolved, so a scoped migration run from one project
couldn't keep memories for another or check where they went.

- memory_search and memory_save take `project`: a folder on this
  computer (absolute, or relative to the caller's own folder), or the key
  of a project memory knows (github.com/owner/repo, with or without
  project:, or a project's one name). A project named goes with scope
  project (a save's default then) or a search's all; global or agent with
  a project is refused, and an unknown project says which ones memory
  knows.
- Answers name what was used: a memory reads "this project (<key>)" and
  "only for you (<agent>)", and a search ends "(looked in: everywhere,
  project <key>, agent <id>)".
- New read-only memory_context: the agent the server takes the caller
  for and how it was found (router _meta, magpie mcp memory's initialize,
  key/User-Agent, the session's initialize), the project with its folder
  and source, the scopes a search looks in and the server version, as
  text and structuredContent. Given `project`, it shows that one.
- HTTP and stdio are the same server (magpie mcp memory relays), and
  OwnMCPTools lists memory_context with the others.

Run (mote, -tags nogui unless noted):
- TestMemoryMCPProjectArgumentAndContext (new): folder, key and relative
  folder; the caller's own project untouched; refusals; memory_context's
  text and structuredContent; tools/list. Red with the project argument
  ignored by hand.
- TestMemoryBridgeContextAndProject (new): the real gateway behind
  magpie mcp memory over stdio, initialized as codex as in the report.
- go test ./internal/browsermcp ./internal/cli ./internal/library: ok;
  go test -run 'Memory|OwnMCP|Hub|RootDirs|Tool' ./internal/gateway: ok.
- Windows (xiaomi-gpu, win-run): the new gateway, browsermcp and cli
  tests ok (a test's own unquoted Windows path was fixed on the way).
- go vet darwin, linux nogui, windows for the four packages; gofmt.
Not tried: Codex desktop itself over /mcp/run/magpie-memory; the full
suite runs after the tag.
2026-11-13 12:29:04 +08:00
yetone e39b9d5df7 cli: magpie tool reads an event-stream answer and names its folder (Norethcy on X, #6049, #6392)
`magpie tool memory_search --scope project --json` exited 1 with "isn't
JSON-RPC: is it magpie? (invalid character 'e' ...)", and memory_save said
the same after it had saved. The CLI sent no X-Magpie-Cwd, so the memory
server asked it roots/list on the call's own event stream (it accepts
text/event-stream), waited 3s for an answer that never came, and sent the
result as a second SSE event; rpc() then read the whole stream as one JSON
body.

Now magpie tool sends the folder it runs in (X-Magpie-Cwd), as `magpie mcp
memory` does, so --scope project is that folder's project and no roots are
asked. rpc() also reads a text/event-stream answer: it takes the data event
whose id is the call's, answers a server's roots/list with its folder and
refuses any other ask at once, so no server's question breaks the CLI or
makes it wait.

Run (mote, -tags nogui):
- TestToolMemoryThroughTheGateway (real gateway, sandbox HOME, a git repo
  as cwd): red on the old code with the reporter's exact error; green now,
  both calls under 2.5s.
- TestToolReadsAnEventStreamAndAnswersTheServer: red on the old code.
- go test ./internal/cli: ok.
Broken by hand: without the header, the event-stream test is red (no
folder named); with stream reading off, it is red with the reporter's
error.
Not tried: the reporter's macOS app build itself; Windows.
2026-11-13 12:29:04 +08:00
yetone e630c003cd usage: Devin CLI's own calls are read from its sessions (aohan0905 on X)
Usage counted none of Devin CLI's requests. Devin's CLI (3000.11.234,
run for real in a sandbox HOME) keeps its sessions in
<data>/devin/cli: sessions.db (SQLite: sessions, and message_nodes with
each chat_message), or with DEVIN_SESSION_STORE=files a folder per
session (log.jsonl + meta.json), whose first run copies the database's
sessions in and leaves the database. Each assistant message names its
call: request_id, generation_model (swe-2-high, effort and all),
created_at and metrics (input/output/cache read/cache write tokens,
ttft_ms, total_time_ms), written as two nodes per reply.

- sessions: calls_devin.go lists both stores (a session in both once,
  from the store written last), reads each session whole, one call per
  request_id (Msg devin:<id>), with the cwd. Registered in callSources
  and wholeCallReaders; Found lists "devin" for the consent page.
- provider: DevinModelEffort splits a variant id into model and effort
  (claude-haiku-5-5-low -> claude-haiku-5-5, low), so the catalog prices
  it. swe-2 has no catalog price and shows as unpriced.
- agentenv clears DEVIN_SESSIONS_DIR in test sandboxes.

Fixtures are the real runs' files: 3 sessions in sessions.sql (schema
verbatim, triggers dropped, assistant and user rows only), one session
only in the folder store and one in both, project folder renamed.

Run (mica): go test ./internal/sessions ./internal/provider
./internal/agentenv ./internal/usage ./internal/usageapi ./internal/cli
./internal/gui ok; go vet darwin, linux -tags nogui, windows on the
touched packages ok; gofmt clean. win-run: the Devin tests ok. A built
binary's `magpie usage all` / `--csv all` in a sandbox HOME holding the
real Devin data: 5 calls under Devin, the two claude-haiku-5-5 calls
priced from the catalog ($0.000277, $0.000986), swe-2 unpriced.

Broken by hand: devinCallFiles out of callSources (TestDevinCalls and
TestDevinDBReadAgain red, 0 calls); a session in both stores listed
twice (TestDevinSessionListedOnce red, 9 calls); the per-request dedupe
off (red, a request counted twice); DevinModelEffort returning the id
whole (TestDevinCalls and TestDevinModelEffort red).

Not tried: Devin's folder on Windows (taken as %APPDATA%\devin\cli, as
its credentials.toml; not seen on a real Windows install); a long real
session or subagents; DEVIN_SESSIONS_DIR set (read from the CLI's
behaviour in the sandbox, not from a GUI-started magpie's environment).
2026-11-13 12:26:43 +08:00
yetone 54b6d4d397 gui tests: editor-thumbs-batched checks the thumbs shown, then Advanced opened (#5886)
editor-thumbs-batched went red on main from b03a37476 on (found by
bisecting 117f56c70..2abfe2b64 with the chromium half of the test):
three controls, off|on and off|week|all, with a thumb of width 0 two
pixels left of the option. b03a37476 moved Claude's warm-up and lean
lists into the provider editor's Advanced, which is closed when the
editor opens. Chromium answers offsetWidth inside a closed <details>
(its content is content-visibility: hidden and the read lays it out),
so the test's `on.offsetWidth` took those controls for shown ones,
while their ResizeObserver, rightly, had nothing to report yet.

Nothing is wrong in the page: the thumbs are put when Advanced opens.
The test now checks the thumbs whose option checkVisibility() says is
shown, then opens every closed <details> in the editor, waits two
frames, and checks every thumb again. That second check is what a user
opening Advanced sees.

WebKit's slow-read count was red too, on main as well (origin/main
70f4593e6: 208 at 40 accounts, 244 at 160; this branch 188/213). The
reads that differ were all holdModal's few a frame and the frames' own:
the open at 40 sometimes ends ~5 frames sooner. That is frame jitter,
not a read an account (+120 here), so the room for slow reads is 60,
not 24; the forced-layout room stays 24.

Run (mote, at the pushed base): editor-thumbs-batched, Chromium and
WebKit, en/zh/zh-TW/ja/de, 10/10 green three times in a row.

Broken by hand: thumbFit's callback made a no-op (the thumbs put only
when drawn) is red 5/5 in Chromium, on "opened off|on: option
655.8+38.0, thumb 653.8+0.0" and "opened off|week|all", the controls
in Advanced; the "shown" check stays green there, as it should.

Broken by hand: an offsetTop read for every account a frame after the
list is drawn is red in WebKit en and zh (278 at 40, 538 at 160).

Not tried: the WebKit half of the broken-by-hand run.
2026-11-13 12:20:29 +08:00
yetone 6bba0572d6 gui: an open editor's readings redraw its accounts list, not the page (#5310)
When a provider editor opens, its accounts' readings load after it
(loginUsageOf), and their arrival called renderProviders(true): every
Providers row and the whole editor drawn again. With 600 accounts that
was a second full draw of the editor. redrawAccounts now draws only the
editor's accounts list again and puts it where the old one was. A full
draw is kept for the cases it was there for: another provider being
edited, a rename or a focused field (left alone, as before), and an
arrangement in progress or no open list (drawn in full).

What a full draw did, the in-place redraw does too:
- the list's inputs are named and described as field() names them;
  that part of field() is now fieldInputs(label, control), shared;
- the focus goes back to the same control of the same account, matched
  by tag and first class (a pressed refresh is "busy", so the whole
  className is not the same after), not its index in the list, which
  the readings' new controls move;
- that focus is given back, not pressed (modalRefocus), so the dialog
  keeps holding the pressed element where it was;
- the body's scroll is put back after the swap: the focused element
  taken out moved it by scroll anchoring (120 to 124 in
  editor-quota-quiet).

The full draw also hid a gap it no longer covers: the provider editor's
folds learn the labels' column from their own size (edAlign's
ResizeObserver), and the prefs fields (Resets, Warm up, Check in,
Claude Code) shown after the prefs load widen that column without
changing a fold's size. The readings' full draw made new folds that
measured it again. mountProvPrefs now aligns the editor's folds after
showing its fields (edAlignAt, the observer's body made a function).

Measured before (mote, 600 Claude accounts): the in-place redraw saves
~45ms in WebKit and ~30ms in Chromium of the editor's open. The rest
of the ~1s is the first layout of 600 rows.

Tests:
- editor-readings-in-place (new): 12 accounts, readings held until the
  editor is open and the 3rd account's first button focused. After
  they arrive the Providers row and the editor's head are the nodes
  drawn before, the focus is that same button, and the list's labels
  match a full renderProviders(true). Chromium and WebKit,
  en/zh/zh-TW/ja/de: 10/10 green.
- editor-quota-quiet's "redrawn" watch also counts the accounts list
  replaced alone; before, it waited for a new .ebody and failed
  "never came, so this tested nothing".

Broken by hand:
- the readings back to renderProviders(true): editor-readings-in-place
  10/10 red on "the provider's row is the one drawn before".
- the focus matched by the whole className: account-refresh-holds
  red in Chromium, "the focus stays on the pressed refresh" (null).
- the refocus without modalRefocus: account-refresh-holds red, "the
  pressed refresh moved 186.875px".
- without the scroll put back: editor-quota-quiet red 8/8, "the body
  keeps its scroll" (124, 120).
- without mountProvPrefs' edAlignAt: editor-advanced-align red in
  Chromium, "en 1000: Advanced starts at 284.765625, its fields at
  349.265625".

Run (mote, load 25-45, other sessions' runs beside):
- account-refresh-holds, claude-quota-onboarding, editor-advanced-align,
  editor-hints, editor-quota-quiet, editor-thumbs-batched, one at a
  time, on this change and on origin/main 2abfe2b64: the same reds on
  both but those this commit fixes, and editor-thumbs-batched (red on
  main, #5886, the next commit). The shared reds are filed:
  account-refresh-holds' rising sheet (#5814), account-arrange (#6010),
  claude-quota-onboarding (#6179), editor-hints in WebKit (#6156).
- the 149 GUI files this reaches, on mote: 2601 pass, 124 fail of 2725.
  Every red is in 16 files, and the same 16 run alone at origin/main
  2abfe2b64 on mote fail the same tests (126 there, the two more being
  signin-proxy at 380px, #5866). Filed: provider-many-keys and
  provider-max-output #6209, key-switch #5835, plugin-signin-no-url #5938,
  plugin-signed-out-account #5998, reset-providers #6196, old-webkit
  #6030/#5919, mobile-web #3952, plugin-move-unserved #4392, key-import
  #6416, account-refresh-holds #5814, account-arrange #6010,
  claude-quota-onboarding #6179, editor-hints #6156. restart-app's
  chromium 420 zh was 1px off once in the full run and green alone on
  both trees (#6417).
- go test ./internal/gui -run 'Budget|I18n|Keys|Words' on mica: ok
  (TestCoreScriptBudget with the previous commit: -89 code bytes over
  both).

At origin/main 70f4593e6 (rebased over 27 commits,
several in app.js): go test ./internal/gui -run
'Budget|I18n|Keys|Words' ok on mote; editor-readings-in-place,
editor-quota-quiet, editor-thumbs-batched, editor-advanced-align,
account-refresh-holds, claude-quota-onboarding, i18n-keys,
signin-proxy, reset-providers and key-import: every red one that is
red on origin/main too, but editor-thumbs-batched's WebKit read
count, which the next commit gives room (red on main as well).
editor-advanced-align was red once in both engines in that set at
--test-concurrency=2 under load, then green alone on this head and on
main, and 58/58 green in the same set again (#6421).

Not tried: the real app with 600 real accounts; Linux WebKitGTK.
2026-11-13 12:20:29 +08:00
yetone 468102b721 gui: a move's done line, a sign-in page's open and the other-ways row each written once
Three pieces of app.js were written out more than once, word for word:

- movedSay(p): "{name} now runs on its plugin — {accounts}, {models}."
  and the state read after it, in unmovedLine and renderMove.
- signInPage(url, id): open the sign-in page, and on a failure keep its
  message on the sign-in still shown, in startSignIn, followSignIn and
  startPluginSignIn.
- acts(): the sign-in's row of other ways, made when the first goes in,
  five times in one function.

No behaviour changes. This pays TestCoreScriptBudget for the next
commit, the readings redrawing an open editor's accounts in place
(#5310); main was at the budget to the byte. Code bytes, as the budget
counts them: -1043.

Run: see the next commit, whose runs include this one.
2026-11-13 12:20:29 +08:00
yetone c2fd48782b Put back what 1f05c311d took out of main by mistake
1f05c311d was committed with its worktree's older tree on top of a
fresh origin/main (git reset --soft), so beside the memory fix it
undid every file 610ae1f54..c1312ac15 changed (45 files: key balance,
import links, project subagents, uninstall, site, LESSONS.md and
more). This commit restores each of them to c1312ac15 byte for byte;
the tree is now c1312ac15 plus the memory fix alone
(git diff --stat c1312ac15 HEAD: the 4 files of the fix).
2026-11-13 12:18:23 +08:00
yetone 1f05c311d9 library: an open memory holds still while the Memory tab polls (Nietzsche_Li on X)
"资源库-记忆中,被展开的记忆的表单会定时抖动". While search by meaning
still has memories to read (read < of, which can last up to a minute
between memembed.Keep's reads) or a learn-from-conversations run goes,
the Memory tab reads its row again every 2s, and each read drew the
whole page anew. The open editor was a new .lib-detail each time and
played its content-in entrance (opacity .5, 2px slide) every 2s.

- semWatch/distWatch draw nothing when the read changed nothing, and
  redraw only their own row (redrawRow) when it did; the whole tab only
  when the memories changed.
- render() marks a .lib-detail open before it (same data-detail) as kept,
  so it doesn't replay its entrance. This covers every render of an
  open editor in the Library: memories, instruction sets and agents'
  files (the siblings; no other Library tab polls into render()).
- A new memory's text no longer takes the focus back on every render.

Run (mote): library-memory-steady.test.cjs, all 5 languages, 980/420,
chromium + webkit: green 4 of 4 whole-file runs after the last change
(webkit alone 2 of 2 before it). Broken by hand: the same test against
origin/main's client.js and library.css: 22 of 22 red ("the editor
played its entrance again"). One webkit de 420 red was the test's own
first row click intercepted by the header at 420px while the page
settled; the test now opens rows with a DOM click.
Also run, both engines, every language, 980/420: library-memory, library-memory-select, library-memory-suggest, memory-icon, library-instr-busy, library-instr-sets, library-linked-set, library-follow-server: all green. No Go code changed, so no go test or vet.
Not tried: the real app on a real memory store mid-read.
2026-11-13 12:17:43 +08:00
yetone 6a506e2834 agent: pi-magpie's source pattern compiles on first use (TestNoEagerPackageRegexps)
d52e2feaf added piMagpieExt as a package-level regexp.MustCompile, so
TestNoEagerPackageRegexps in the root package was red on main
("internal/agent/pimagpie.go:13:19: a package-level regexp is compiled
at launch; use lazyre.New"). It is lazyre.New now, as the rest of
internal/agent's patterns are.

Run on mica: go test -run TestNoEagerPackageRegexps . ok (red before,
in the full suite at 70f4593e6); go test -run Pi ./internal/agent ok;
go vet ./internal/agent ok; gofmt clean.
2026-11-13 12:10:08 +08:00
yetone 70f4593e62 provider: a key's typed balance can refill each day (Kelen_Yc on X)
A key's balance typed by hand refilled each month or each week. A relay
key with a daily allowance had no way to say so. Now it can refill each
day, at local midnight, like the others:

- provider: Refill{Every: "day", Day: 0} (RefillDay). Last is today's
  midnight in now's location, Next tomorrow's. check takes it with day 0
  only; ParseRefill reads daily/day/d (daily:1 refused); String is
  "daily". A magpie before this drops such a refill on read, as one
  written by hand that isn't one, and counts from when it was typed.
- CLI: `magpie provider key-balance <id> <key> --refill daily`; usage
  lines updated.
- GUI: the pill's menu has "Refills each day" after "Refills each
  week…", posting {every: day, day: 0} at once (no day to pick, so no
  ellipsis), with its toast; en, zh, zh-TW, ja, de.
- docs/subsystems/providers-accounts.md names it.

Tests: TestRefillDays gains daily rows (midday, exactly midnight, a
month's and a year's end, Asia/Shanghai). New
TestTypedBalanceRefillsDaily holds the clock in Pacific/Kiritimati
(UTC+14), Pacific/Pago_Pago (UTC-11) and UTC: a minute before local
midnight the spend counts from when it was typed, a minute after it
counts from local midnight and the next refill is the following one.
TestOwnBalanceParsedInYuanAndRefill and TestTypedBalanceRefills cover
parsing, the bad {day, 1}, and read-back; TestKeyBalanceCmd sets
--refill daily. key-own-balance.test.cjs picks Refills each day in
every language, both engines, 900 and 400px, checks the post and that
the menu then shows it picked.

Run on mica at 889758605 + this: go test -count=1
./internal/provider ./internal/cli ./internal/gui ok; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows ok; gofmt clean; GUI
key-own-balance, i18n-keys, i18n-en-no-cjk, key-balance-expiring in
chromium and webkit ok (48/48). Rebased on c5adcbaab (library, site;
nothing of this change's files), then at the pushed head: go test
./internal/gui, ./internal/provider -run Refill|TypedBalance|OwnBalance|
KeyOwnBalance|Budget ok, i18n-keys and i18n-en-no-cjk ok. key-balance-card is red in de at 560px
(view-usage 635>560) in both engines on the clean base 889758605 too:
#6414.

Broken by hand: daily Last taken from UTC's midnight instead of local:
TestRefillDays and TestTypedBalanceRefillsDaily (Kiritimati) red.

Not tried: the real app with a real relay key; the full suite (started
after the tag).
2026-11-13 11:59:54 +08:00
yetone a095e40279 usage: a start doesn't hash every session file's rows again for the heatmap's key (#2278)
The heatmap's settled days are named by a digest of each session file's
chunk of rows (sourceDigest). The digests were kept in memory only, so
every start unpacked and hashed every chunk again: 0.14-0.16 s of CPU in
the first 40 s of a start on a real history (startpg profile, w50v).

A chunk's serial names its file as read under one root and meta
(sourceSerial: root, meta, path, size, mtime), the same in every run, so
the digests are now kept in heat-digests.bin next to heat-v1.json, by
serial, under requestDiskBinary()'s key of the code that makes the rows:
another build's rows are hashed again. A file that can't be read, was
cut short or names other code is nothing kept. It is written as
heat-v1.json is (temp file renamed over it), only when a digest was made,
with this run's digests first and then those kept it hasn't met, at most
two turns' worth (2 x 65536 x 40 bytes), sorted by serial. The file is
kept as read and searched in place: a map of its 17k entries beside
sourceDigests' own cost 1.4 MB of live heap in a first try (w51v).

Measured on mote with the real-account sandbox (acctp, 17k chunks), a
start with the page opened, second start of each build:
- CPU profile, first 40 s: 2.00 s (w50v, v0.1.3978) -> 1.54 s (w52v);
  sourceDigest/heatSettledKey 0.12-0.13 s -> gone
- pageheap at the mark: CPU 2.48 s -> 2.12 s, Footprint 134 -> 131 MB,
  liveHeap 79.1 -> 79.4 MB

Run (mote, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/usage: ok
- GOOS=windows and GOOS=linux go vet ./internal/usage: ok; gofmt clean
- TestSourceDigestsKeptAcrossStarts (new): a second start hashes 0 of 2
  chunks with the same key; a start of one file keeps the other's; a new
  file hashes 1; other row code hashes again; a cut file hashes again.
- Broken by hand (the disk lookup ignored): the new test goes red,
  "started again, hashed 2 chunks".
2026-11-13 11:57:46 +08:00
yetone 4431e31f7c library: a project gets subagents of its own, per agent (jinpwng on X)
The Subagents tab now lists the projects as Skills and MCP do. Opening
a project shows each library subagent with chips for the agents that
read a project's own subagent folder: Claude Code (.claude/agents),
Codex (.codex/agents, TOML), OpenCode, Gemini CLI, Qwen Code, Droid
(.factory/droids), Cursor and Copilot (.github/agents/*.agent.md). A
tick writes the subagent into that project only, in the agent's own
format; the agent's global folder and other projects are untouched.

Each file is recorded by its hash and rewritten or removed only while
it is exactly as magpie wrote it, so a same-name file of the user's is
left alone. A rename in the library follows into each project. The
files are kept out of git by the project's info/exclude block, and
follow the repository's other worktrees (syncTrees now copies
Subagents, and clears it for a worktree let go).

POST /api/library/projects/subagents {dir, name|names, agents}. No CLI
yet, like project servers. Hooks, instructions and Claude plugins have
no project scope yet (filed separately).

Run (mica / mote via mica-run, mote-run):
- go test -count=1 ./internal/library ./internal/gui: ok
- node --test, chromium + webkit: project-subagents, project-scope,
  project-servers, project-skills-pick, project-skills-groups,
  project-remove-keep, library-subagents, library-all, library-items,
  i18n-keys, i18n-en-no-cjk, claude-subagents-pick,
  codex-subagents-lead, subagent-effort: 150/150 pass
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on
  internal/library and internal/gui: ok

Broken by hand: dropping Subagents from syncTrees' copy made
TestProjectSubagentsFollowWorktrees red ("the worktree hasn't the
project's subagent"); the earlier session broke the fix by hand and
saw the new library tests go red.

Not tried: a real Claude Code/Codex session picking up the project
subagent; the full go suite (started after the tag); Windows/Linux
runs of the GUI.
2026-11-13 11:51:50 +08:00
yetone 889758605f import: open CC Switch's ccswitch:// provider links (coder_shaun on X)
A relay's one-click ccswitch://v1/import?resource=provider&app=…&name=…
&endpoint=…&apiKey=… link now opens magpie's own import confirmation. The
format is read from CC Switch's source (src-tauri/src/deeplink/parser.rs and
provider.rs at 3c76d3b): host v1, path /import, resource=provider only,
app, name, endpoint, apiKey, apiFormat, model/haiku/sonnet/opusModel,
homepage, iconUrl, and the base64 config (claude env, codex auth + config.toml
provider table, gemini env) filling what the URL leaves out. The link is
translated into a magpie://import's parameters and goes through the same
checks (https only, key shape, id rules, balance host) and the same
confirmation; usage scripts, configUrl, enabled and notes are never taken, a
codex env_key is refused.

Registration, so as not to take CC Switch's links: Linux writes a separate
magpie-ccswitch.desktop and sets the default only when `xdg-mime query
default` is empty or already it; Windows writes HKCU ccswitch only when
HKCR has no live handler of another program; uninstall and install.sh remove
them only while they are ours. macOS declares the scheme in Info.plist
(static), so with CC Switch installed too the system picks.

Run: provider, gui (macOS mote; Linux gtk3 on WSL for the scheme tests),
uninstall, cli, update packages; vet darwin, windows, linux nogui. The test
parses CC Switch's own 11 provider examples (testdata/ccswitch_links.txt,
copied from its repo) and refuses the other resources. Broken by hand: claude's
default endpoint kind (4 reds) and the Linux "another app has it" check
(TestRegisterSchemeLeavesCCSwitchItsLinks red).
Not tried: Windows registry (vet only), a real CC Switch installed beside
magpie, a browser click on a real relay's button.

Rebased on 610ae1f54 and run again there (mica): provider, gui, uninstall,
cli, update ok; GUI import-link-balance, import-link-gemini,
import-collision, import-opencode 80/80 in chromium and webkit; vet darwin,
linux nogui, windows ok; gofmt clean. Reviewed against CC Switch db7a0e7
(no deeplink change since 3c76d3b). Broken by hand again: the config's key
no longer filling an empty apiKey (TestCCSwitchOwnExamples, 3 reds).
Pushed on 48afb27b0, which adds only the library plugins GUI files
(client.js, library.css, library-plugins.test.cjs) to that base.
Not tried either: macOS with CC Switch installed too, where Launch Services
picks which app opens ccswitch:// links.
2026-11-13 11:46:50 +08:00
yetone 48afb27b0f library: Claude plugin rows show counts, the dialog keeps its width and folds the parts (jinpwng on X, #6309)
The plugin dialog's description, part lists and source line sat in the
editor grid's 132px label column, so even Plannotator (3 hooks) read as a
narrow column: the Hooks heading landed in the right column, the names
under it on the left and the GitHub line in the middle. Description, parts
and hints now span the grid. The list row showed every skill name (PStack
lists a hundred); it shows "Skills 12 · Hooks 3", and the dialog lists each
part's names in a fold, closed by default.

Run at this head (rebased on 610ae1f54), on mica, Chromium and WebKit, en,
zh, zh-TW, ja, de, 420 and 1100: library-plugins, library-subagents,
library-all, library-row-open-scroll, library-open-again, i18n-keys,
i18n-en-no-cjk: 82 of 82 pass. gui-zh-tw passes; gui-de and gui-ja's
"has every zh string" are red on main already ({agent} placeholder, #6234).

Broken by hand: with the span rule cut back to the <p> only, the test fails
with "a part or the source is squeezed" (parts 116/433 of 600px, source
116px), the reporter's alternating layout. With the old CSS it fails "the
description is squeezed: {p:132,d:600}".

No Go files changed, so no gofmt/vet. Not tried: the real app with a real
PStack or Plannotator.
2026-11-13 11:43:59 +08:00
yetone 610ae1f541 library: handing skills over turns off the all-in-~/.agents/skills setting and takes magpie's links out (ConatusMoon2222 on X)
Put skills in "~/.agents/skills" (SharedSkills) gives every agent that reads
that folder every skill, so it cannot go with choosing agents per skill,
which is what "Manage in magpie" (HandOverSkills) is for. With the setting
on, a handed-over skill's entry was taken away and the next sync linked it
back there, so the link stayed (reproduced in a sandbox HOME). Handing over
now turns the setting off in the same write; the sync then removes magpie's
own links there (sweepShared: only ours, never the user's entries). The
confirm sheet says so, only while the setting is on. The Put skills in note
says the skill router lists nothing while every skill is in
~/.agents/skills (the "none" the reporter met), only when both are on.
Strings in zh, zh-TW, ja, de.

Run (on mote, at this tree):
- TestHandOverWithSharedSetting: red with the l.SharedSkills = false line
  commented out ("a link is left in ~/.agents/skills"), green with it.
- go test ./internal/library ok; go vet darwin, GOOS=windows, linux nogui
  on internal/library ok; gofmt -l clean.
- GUI: skill-handover, shared-skills, i18n-keys, i18n-en-no-cjk in chromium
  and webkit, 23/23 each.
Not run: the full GUI suite and go test ./... before the tag; a real
account's Library; WebKitGTK.
2026-11-13 11:28:51 +08:00
yetone e979553ba1 sessions: a start doesn't read Claude Code forks' uuids again to judge them (#2278)
Each start judged every group of Claude Code files that start alike
(ccFamily), then read what each copy or branch holds that its keeper
doesn't (ccRest). Both read every file's message uuids through
scanThin, and what they found was kept in memory only: ~0.2-0.25 s of
CPU on each start for a real history with forks, and a uuid set held
for each file.

What a group came to depends only on its files, so it is kept in
cc-families.json next to sessions.json, by a hash of each member's key,
path, size, change time, first and last message and start; a group none
of whose files changed is not read. A copy's or branch's rest is kept
in cc-rest.json by both files' path, size and change time, encoded the
way the parses are (encodeCache), so another time zone, cache version
or parser version reads it again. Both are written behind mu through a
temp file renamed over the last, in order; Saved and Reset wait for
them. Groups unused for 30 days are dropped.

Run (mote, at this tree):
- go test ./internal/sessions ./internal/usage ./internal/gui: ok
  (128 s, 64 s, 151 s); GOOS=windows and linux go vet
  ./internal/sessions: ok; gofmt clean.
- New TestClaudeFamilyKeptAcrossStarts: a start after one that judged
  the group reads no file's uuids, and a copy that went on with a turn
  is judged again (a branch). TestClaudeBranchRestKeptAcrossStarts: two
  starts count the same 80 tokens in and read no uuids.
- Broken by hand: ccFamilyKept always nil -> the first test red ("read
  the uuids of 3 files"); ccRestLoad never reading -> the second red
  ("start 0 read the uuids of 1 files"). Dropping size and mod from the
  group's hash left the first test green: the changed copy's last
  message changes the hash anyway; size and mod are there for a file
  rewritten in the middle.
- Real accounts (acctp sandbox, pprof of the first 40 s of a start with
  the page open): sessions.Warm 0.78/0.79 s -> 0.52/0.57 s, statsKept
  0.39/0.43 -> 0.18/0.21 s, ccFamily/ccUUIDsOf gone from the profile;
  pageheap: CPU at mark 2.84 -> 2.65 s, Footprint 132 -> 127 MB,
  liveHeap 80.2 -> 78.4 MB. The first start of the new build reads and
  writes them once (2.70 s at 40 s, as before).

Not tried: Windows and Linux real starts; the files are plain JSON in
the cache folder.
2026-11-13 11:18:30 +08:00
yetone dc356402ab memory: Codex's earlier agent memories (kept as codex-mcp-client) are still found (#6392)
Follows c9c10b960: Codex's MCP client name now reads as codex, so a search as Codex also looks in agent:codex-mcp-client. TestMemoryMCPSharedAcrossAgents now expects codex. Ran on mica: -run 'TestMemory|TestRun' ./internal/gateway ok; gateway+library+browsermcp full run: library and browsermcp ok, gateway cut at the 10m default timeout under load (suite follows the tag). Windows/linux-nogui/darwin vet clean on gateway and library.
2026-11-13 11:11:33 +08:00
yetone 8f82e08b4f memory: Codex over HTTP is known as Codex (Norethcy on X, #6392)
Codex reaches Magpie Memory at /mcp/run/magpie-memory, which starts `magpie mcp memory` per Codex session. A session magpie never saw start (Codex keeps its session id across a magpie restart) started the server with the default initialize, client "magpie", so memory_save scope=agent said it couldn't tell which agent called. Now: such a session (and an initialize naming no client) is started as the request's agent, Codex on this route; the direct HTTP route keeps the client an initialize named under its Mcp-Session-Id; every codex* client name (codex-mcp-client, codex-tui) is Codex.

Ran on mica: new tests (red on the old code with the reporter's error text), internal/gateway, internal/library, internal/browsermcp (see below). Not tried: a real Codex Desktop.
2026-11-13 11:11:33 +08:00
yetone 4f72725e39 gateway: a drawn SVG is served under a CSP that runs nothing
The image server's files (b2ccfe25d keeps them an hour, behind a link
with a token) were served with the vendor's type and nosniff only. A
Recraft SVG opened from its link is a document on the gateway's own
origin, and a page there is same-origin to the gateway, which a local
request reaches without a key: script in the SVG could have asked
/v1/chat/completions on the user's subscriptions. An SVG is now served
with "default-src 'none'; style-src 'unsafe-inline'; sandbox", as the
GUI's SVG icons already are (library.go, providers.go). Other types
are unchanged, so a video still plays in its own page.

Run: go test -run TestImageMCP ./internal/gateway ok (mote).
Broken by hand: with the header line removed,
TestImageMCPSVGRunsNothing is red (mica).
Not tried: a real Recraft SVG in a browser.
2026-11-13 11:08:44 +08:00
yetone dd9b2bcef5 gui: the new sign-in row and sentences within the core script budget, +296 (Wing8Aqua on X)
No page left to move them to; the row is packed to its shortest form.
Budget raised by exactly the 296 bytes over.

Record for this stack (Wing8Aqua's three reports: cap toggle wording,
Smart is not load balancing, Sign in on another computer), run on mica at
this head's content (rebased on 861a0442c):
- go test ./internal/gui: ok; gofmt clean; go vet darwin, windows,
  linux nogui: clean.
- GUI: pool-ends, signin-another-computer (new), signin-link-only,
  i18n-keys, routing-save: 122 pass, 0 fail, chromium and webkit, en zh
  zh-TW ja de where the file has them. Earlier wider run (signin-*,
  i18n, routing-save/advanced/smart-intent/manual/mode-goes, account-cap):
  418 of 425; the 7 reds were the Japanese 420px cap label wrapping a
  line (fixed, shorter label), one load timeout each in signin-again and
  signin-codex-device (green on rerun) and signin-proxy 380px, which is
  red on origin/main too (#5866).
- Broke by hand: without the linkOnly post the new test is 0 of 16.
Not tried: a real Claude sign-in from another machine; Windows and Linux
webviews; plugin sign-ins and the Routing page's own Smart tooltip
(plugins/routing/client.js) keep their old text.
2026-11-13 11:07:02 +08:00
yetone 4b34020354 gui: shorter Japanese cap toggle label, so it stays on its line at 420px (Wing8Aqua on X) 2026-11-13 11:02:15 +08:00
yetone 2f34649a6e gui: Claude and Codex accounts get "Sign in on another computer…", the link alone (Wing8Aqua on X)
Adding an account opened the local browser, the only way not to being a
Privacy setting nobody finds. The ideal sign-in is often another machine
(another region). Under Claude's and Codex's accounts a row starts the
sign-in kept to its link: /api/signin takes linkOnly, opens nothing here
and the window shows the link with Copy and Open in browser (f4f104d1c)
and the paste-back field for the address the other browser ends on. The
setting and the default are unchanged; other subscriptions are not given
the row (plugin sign-ins are not touched).

Run: see push notes.
2026-11-13 11:02:15 +08:00
yetone de0a237693 gui: Smart routing says it is not load balancing and where to pick it (Wing8Aqua on X)
Smart sends requests to one account at a time (the soonest to renew) and moves on at 90% or on failure, by design: spending what would be lost and keeping the prompt cache. The hint now says so and names In turn and Least used first for an even spread, in en, zh, zh-TW, ja, de.
2026-11-13 11:02:15 +08:00
yetone 0ae77bad59 gui: the cap toggle says what it does: off, fallbacks take over at the cap (Wing8Aqua on X)
"Stop when every account is at its cap" read as if off meant not stopping
at all. Off, requests go on to the provider's fallbacks; on, they get 429.
Renamed "Don't go to fallbacks when every account is at its cap", with a
tooltip naming both states, in en, zh, zh-TW, ja and de. The field
(capStop) and its behaviour are unchanged.

Run: pool-ends GUI test updated to the new labels (see push notes).
2026-11-13 11:02:15 +08:00
yetone 861a0442c1 agent: Codex in a running WSL distro is connected once Codex on Windows is (@not_4O4 on X)
The Codex app's work mode on a project whose run environment is WSL starts
its app-server inside the distro, on the distro's ~/.codex (the app resolves
CODEX_HOME there with `bash -lc 'printf %s "${CODEX_HOME:-$HOME/.codex}"'`).
magpie wired Codex on Windows and, as a separate Agents row, the distro's
twin (codex@wsl:<distro>) only when the user connected that too, so the
picker listed OpenAI's models alone there.

ConnectCodexTwins, run at the start of each SyncCatalog, connects the twin
of each running distro once while Windows' Codex is connected. It leaves a
twin alone that is connected or disconnected already, whose config names a
provider or base URL of the user's own, or whose distro is stopped (asking
one starts it). A stash mark (<id>.autoconnected) keeps it to once, so a
later Disconnect stands. docs/subsystems/agent-wiring.md says so.

Run: TestConnectCodexTwins and TestConnectCodexTwinsKeepsOwnProvider; go
test ./internal/agent on mote (ok, 305s); TestWSL* and the new tests on the
Windows box (ok); gofmt; go vet darwin, linux and windows (nogui).
Broken by hand: Windows-connected check removed (red), own-provider check
removed (red). The Disconnected check is covered by the mark alone.
Not tried: the Codex app itself with a WSL project (read its bundle for the
CODEX_HOME resolution only); the reporter's distro and networking.
2026-11-13 11:01:27 +08:00
yetone 092a86ad22 gateway: Mistral's API gets a stable per-session x-affinity (daoche_wuzui on X)
Mistral routes a conversation to the server holding its KV cache by the
x-affinity header. Checked against the sources: mistral-vibe's CHANGELOG
("KV cache warming via x-affinity in count tokens"), its
_runtime_config.py request_headers (sets x-affinity every turn), and
pi-ai's buildMistralHeaders (earendil-works/pi, mistral-conversations.ts:
sessionId unless the model's or call's headers name one).

forwardOnce now sets x-affinity for a Mistral API key provider
(mistralAffinity): the client's own value as sent, else a hash of the
session or conversation, never the id itself, the same every turn. Other
vendors, accounts and plugins get none; the user's own provider headers
are put on after it. Every route (relayed, translated, count_tokens)
goes through forwardOnce.

Run: go vet on darwin, linux nogui and windows for internal/gateway, and
go test -count=1 ./internal/gateway at the branch head via mote-run, ok
(1370s). New: TestMistralAffinityHeader.
Broken by hand: header setter off, red ("affinity \"\" \"\" \"\""); the
isMistral scope removed, red ("another vendor got x-affinity").
Not tried: a real Mistral key, so whether Mistral's cache hit rate
changes is unmeasured. Full ./... not run.
2026-11-13 10:54:56 +08:00
yetone cba704d5f0 library: with the skill router on, the page says when no skill is listed for an agent and when its own skills stay in its prompt (ConatusMoon2222 on X)
ConatusMoon2222 turned the Skill router on and reported it "does not take
effect". Reproduced in a sandbox HOME: the router lists only the library's
skills ticked for an agent. An agent with nothing ticked, or each skill kept
direct, got no magpie-skills, yet its row said "on"; and skills in an
agent's own folder that the library lacks stay in its prompt with no word
on the page.

AgentView.SkillRouter is now "none" for an agent whose folder takes the
router but has nothing listed (Applied.Router false), and the Skills tab
names those agents, and the agents that have skills of their own the
library lacks, under the switch (.lib-hub-why data-why none / found). Four
languages (zh, zh-TW, ja, de). docs/subsystems/skill-router.md updated.

Run on mote: go test -tags nogui ./internal/library (ok, 260s);
skill-router.test.cjs in chromium and webkit, all four languages, narrow
and wide (22 pass, with the new found line asserted); go test ./internal/gui
Asset/Budget/Script ok; gofmt clean; go vet nogui darwin/linux/windows clean.
Broken by hand: sync.go back to the parent, TestSkillRouterLastSkillUnticked
goes red ("nothing listed, the view says on").
GUI i18n-*, library-*, skill-* files: all green except skill-fold-all and
skill-manual, red on origin/main from the window's /api/update/using POST
(#5982, not this change).
Not tried: a real agent on Windows; the reporter gave no agent, OS or
version, so the cause for their machine is inferred, not confirmed.
2026-11-13 10:53:40 +08:00
yetone 5d93f6b3d9 gateway: a day's history is gzipped a route at a time and capped in size (tsingchao on X)
gzipFile read the day's whole file (and its .gz) into memory, so a 7.25 GB
day took a 1.6 GiB host down in a restart loop. It now streams: the file's
routes are remembered by an 8-byte hash, the new .gz goes to a temp file
beside the old one (the old .gz copied raw, the new routes a gzip member
after it) and is renamed over it; any failure leaves the file and the .gz
as they were.

Nothing bounded a plain day either. A day now goes on in a numbered file
(DAY.1.jsonl) past 256 MB, and today's files past 1 GiB in all lose their
oldest. History, HistoryRoute and the Context tab's stamp read the numbered
files too.

Run (mote): gofmt, go vet gateway+gui on darwin, windows, linux nogui;
gateway and gui packages. TestGzipFileHoldsNoWholeDay (64 MB day, with a
.gz to dedupe against) allocated 149 MB on the old code, now under 24 MB.
Broke dayAppendPath by hand: TestDayGoesOnInANumberedFile went red.
Not tried: a real 7 GB file; full ./... suite (run after the tag).
2026-11-13 10:48:07 +08:00
yinwu01 ff865b47a1 gateway: the TTFT and reasoning speed tests wait until the agent has each event (#5948)
TestGroupFailoverTimesEachTry went red on a loaded box with TTFT equal
to FirstText: "ttft_test.go:260: the answering try: {... Millis:304
TTFT:233 FirstText:233 ...}". The paced vendor kept its reasoning and
its text 80ms apart on the wire, and a gateway that read late got both
in one read and timed them as one. TestUsageKeepsTimeToFirstToken had
the same gap and was fixed for #2575 with paced's heard hook: the gap
before each marked event starts only once the agent has been sent the
one before. The failover test now posts with that hearing agent and
gives the answering vendor its heard, so the text comes a gap after the
agent had the reasoning, and the end a gap after it had the text.

The same gap stands under four more tests, which get the same hook.
TestCodexBackendTimesFirstToken, in the same file, checks u.Millis >
u.FirstText across the text and the end (its request is now built by
codexServe, which codexPost uses too). In reasoning_speed_test.go,
TestReasoningSpeedThroughGateway and TestSpeedEndsWithTheReply need
their thoughts read apart, 100ms at least (TestReasoningPacingEdges),
for a speed; the fixture's gap is 150ms. TestSpeedEndsWithTheReply's
first thought is now marked too, so the gap after it is guarded as
well (a first marked event is sent at once). In
reasoning_uncounted_test.go, TestStreamedReasoningWithoutCount's Chat
cases, paced 80ms apart, get it for their three thoughts; its
Anthropic cases replay DeepSeek's 33 deltas and are left as they were.

What was run (tree d6c1100b, on origin/main db0f2f20, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077 (these packages
don't run Bun; Bun 1.4.2 on PATH for the final runs, 1.3.11 for some
old-code runs):
- The five tests with the change, -count=5: ok. None waited out
  heard's 10s.
- With 240ms slept by hand in holdWriter.Write on the vendor's first
  event (fallback.go, a gateway passing it on late): the old failover
  test red 3 of 3 at :260, "TTFT:242 FirstText:242".
- With 240ms slept by hand in the Codex backend's read loop once the
  reasoning came (codex_backend.go): the old Codex test red 3 of 3 at
  :337, "Millis:322 TTFT:322 FirstText:322". The new one: ok 3 of 3.
- With 400ms slept by hand in holdWriter.Write on the first thought:
  the old TestReasoningSpeedThroughGateway red 2 of 2 at :76 on each of
  its paths ("streamed reasoning missing"), and the old
  TestSpeedEndsWithTheReply 2 of 2 at :133 ("a reply that came at its
  pace tells no speed: 0/0").
- With 400ms slept by hand in holdWriter.Write on the first thought
  ("We..."): the old TestStreamedReasoningWithoutCount red 2 of 2 in
  its "chat tool, counted" case at :94 ("speed 0/0 ms; want
  told=true"), its other cases ok. With the same holds, the new
  failover, the two reasoning speed tests and this one: ok 2 of 2 each.
  None of these reds was reproduced without an injected delay.
- go test -count=1 -timeout 45m -v ./internal/gateway: 4009 tests ok
  (15664 with subtests), 14 skipped, red in two,
  TestClientPathCoversHandler and TestReadOnlyKeyEveryRoute (the CA
  route /magpie-ca.crt in neither route list), red on origin/main
  db0f2f20 too (#5993).
- gofmt -l clean. go vet -tags nogui for linux and windows, go vet for
  windows, go build -tags nogui for linux and darwin and go build for
  windows: exit 0 each. GOOS=darwin go vet -tags nogui: exit 1 at
  internal/gui/traywindows_darwin_test.go, as on origin/main (#5263).
  go vet and go build without the tag on linux: exit 1 (no libsoup-3.0
  or gio-unix-2.0 pkg-config here).
- The full suite: see the comment on the issue.

Not changed: TestResponsesToolWithoutReasoningStillTimed, whose old
version stayed ok 2 of 2 with a 400ms hold on its first piece in
holdWriter.Write.

Not tried: a Mac or Windows, or the red under real load.

(cherry picked from commit 86e12bbdeb466a2cc4e3f8718c23d7a1236d77b2)

Landed for #5948 after it came back on CI at dbb2e5dd2 (run 43342362373,
macos-latest) as a second shape of the same gap: ttft_test.go:264, usage
Millis:450 == FirstText:450, the text and the end read at once.
Run at this commit on 422f90e80 (mica, macOS, load ~19):
- the six TTFT and reasoning speed tests, -count=5: ok.
- Broken by hand: a 240ms hold in holdWriter.Write after the reasoning;
  the old TestGroupFailoverTimesEachTry red 3 of 3 at :264, as on CI, the
  new one ok 3 of 3 with the same hold.
- go test -count=1 -timeout 45m ./internal/gateway: ok 854s.
- gofmt -l internal/gateway: clean.
Not tried: Windows; the full ./... suite (test-only change in one package).
2026-11-13 10:47:17 +08:00
yetone 46e338923b copilot gemini: unions fold to one object, $ref branches resolve, a nullable keeps no type, a bare array gets items (Novello42 on X)
DaVinci42's four cases on #4374 (v0.1.3925), fixed in the Copilot Gemini
tool-schema translation only:

- copilotGeminiToolUnions renamed a disjoint object anyOf to oneOf, which
  Copilot's Gemini takes with 200 but strips of its branches, so the model
  sent a string. The rename is gone; copilotGeminiToolShapes folds the
  branches into the one object (same-named properties join their enums, so
  a discriminator keeps "project" and "none").
- a union of local $ref branches is resolved against $defs/definitions
  (a copy; a target that refers on is not followed) before it is judged,
  instead of being dropped to an untyped string.
- a type written beside a nullable single-branch anyOf is removed (400).
- an array with no items gets items {} (typed after by geminiTypes) (400).

Run (mote, -tags nogui): TestCopilotGeminiFoldsCodexUnions,
TestCopilotGeminiReporterSchemas (the reporter's four schemas verbatim),
TestCopilotGeminiShapesLeaveOthersAlone (claude / no agent: body unchanged),
and the TestCopilot*/TestGeminiTypes*/TestAntigravity* set pass. With the
three changed non-test files put back to origin/main the first two go red
(all four reporter subtests). gofmt clean; go vet darwin/linux/windows and
the gateway package run: see the next commit/tag notes.
Not tried: a live Copilot account (the fake refuses by the reporter's
recorded rules).
2026-11-13 10:40:26 +08:00
yetone d52e2feaff pi: with the pi-magpie extension installed, magpie's models.json block goes (KenyonCode on X)
pi-magpie (npm, tinysnake) serves provider "magpie" from the live catalog
and warns at every start while models.json still names providers.magpie
(one baseUrl for every model, a frozen list). magpie wrote that block
itself, so the user was told to delete it by hand.

When Pi's settings.json "packages" lists pi-magpie, Pi's Sync and model
pick now drop magpie's own block (only one pointing at this gateway with
magpie's key; a block the user wrote stays) after keeping
models.json.before-pi-magpie, through the atomic JSON delete, the rest of
the file untouched. Check no longer calls the missing block a broken
wiring. Without the extension nothing changes.

Run: TestPiMagpieExtensionTakesOverTheBlock (sandbox HOME) and ./internal/agent
on mote, vet darwin/linux nogui/windows. Broken by hand: viaExt forced false
-> the test goes red with the block still there.
Not tried: a real Pi with the extension installed.
2026-11-13 10:37:44 +08:00
yetone b2ccfe25dd gateway: a drawn image is kept on disk for its hour, and the reply it came in is let go (tnt12231 on X)
The image MCP server kept every drawing, and every video, in memory for an
hour (up to 256 MB), and swept them only when another image arrived. A
drawing also held its reply, the base64 strings parsed from it and the decoded
bytes at once. Now:
- imageMCPKeepFile writes the image to <config>/image-mcp (emptied at the
  first use in a run) and the file URL serves it from there; only the
  metadata is in memory. A timer removes it at its hour. If it can't be
  written the bytes stay in memory, as before.
- imageMCPDrawn drops the recorded reply and each b64 string as it is decoded;
  the stdio server (internal/imagemcp) clears each b64 once decoded.
- both hand the heap back (debug.FreeOSMemory) when a drawing is done: the
  Go scavenger gives it back slowly, and Task Manager showed it as
  magpie's.

The foreground/background numbers in the report (WebView2 processes a few MB
when hidden) are WebView2 suspending, not a leak.

Run: TestImageMCPKeepsDrawingsOffTheHeap (new; 6 x 12 MB drawings kept):
heap +71 MB on the old code, +0 after. internal/imagemcp and the gateway's
Image/Video/MCP/Browser/Record tests, gofmt, and vet for darwin, linux
and windows on mote. Broke it by hand: the old image_mcp.go with the new
test is red. Not run: the full suite, a real vendor's drawing, Windows.
2026-11-13 10:36:05 +08:00
yetone 2abfe2b644 codex: the editor extension's bundled Codex version is read, so the threshold is written (HermanHongbb on X)
The background-compaction table is written only when every Codex that
reads the config is known to be new enough. The openai.chatgpt extension's
reader was always made with no version, so any machine with the extension
installed counted as "unknown" and the table, with the threshold, was
held out: Codex compacted at its own 65%.

The extension ships bin/<target>/codex-package.json beside its codex
(checked in the real Open VSX packages of chatgpt 26.51111.21308, Linux
x64 and Windows x64: "version": "0.169.0-alpha.11.1"). It is read now, one
reader per installed copy, in every dot folder's extensions (VS Code,
VS Code Server, Cursor, Windsurf, VSCodium, ...); copies in .obsolete are
skipped. A version that can't be read stays unknown, not old. Settings'
existing note (codexAsyncHeld) names the editor extension and its version
when it is what holds the threshold back.

Run: TestExtensionCodexVersionRead (new; red with the version read turned
off by hand: got map[:4]), go vet darwin/linux/windows, gofmt, and go test
./internal/agent on mote, ok.
Not tried: a live VS Code with the extension; the full suite before the tag.
The macOS extension layout is the same package (darwin vsix not unpacked).
2026-11-13 10:29:39 +08:00
yetone 382c8c0bdf proc: magpie serve reaps the processes it adopts (Kling__Lab on X)
254 <defunct> children of `magpie serve` after 7 days, growing ~9 an hour
(magpie, uv, node, npm, magpie-bun, code-review-graph), only a restart
cleared them. Every command magpie starts is waited for (the AST guard
TestEveryStartedCommandIsWaited holds, and I read each Start site and
Output/StartTree/StartReaped by hand: none is missed). The zombies are the
grandchildren: an agent CLI's MCP servers whose parent ended are adopted by
magpie where it is PID 1 (a container) or a child subreaper, and nothing
waits for a process it never started.

proc.KeepReaping (Linux, from serve) does nothing unless magpie adopts
(PID 1 or PR_GET_CHILD_SUBREAPER), and then reaps a child of its own that
was a zombie at two looks 5s apart. Not tried: the reporter's container;
the cause (PID 1 / subreaper) is inferred from the report, not seen.

Run: TestAdoptedOrphansAreReaped (subreaper test process, 6 orphans) and
the proc package through wsl-run on magpie-desktop: ok. Broken by hand
(KeepReaping returning at once): 6 adopted zombies left, red.
2026-11-13 10:29:07 +08:00
yetone 422f90e80b davsync: WebDAV answers a Digest challenge, MD5 and SHA-256 (caelum1990 on X)
Sync signed in with Basic only, so a server that takes Digest only (Apache
mod_auth_digest, some NAS and nginx setups) answered 401 and magpie said
the password was wrong. digestTransport (RFC 7616, qop=auth, -sess too)
wraps the dav client: a 401 with a Digest challenge is sent again with a
Digest header made from the same user name and password, SHA-256 chosen
over MD5 when both are offered, and the challenge is kept, so the
requests after it carry Digest with a rising nc and Basic is not sent to
that server again. A PUT's body is made again from GetBody. A Basic
server is untouched.

Run: go test ./internal/davsync under mote-run, ok; vet darwin, linux
nogui and windows on the package. New: TestDAVDigest (MD5, SHA-256 against
a fake Digest-only server that checks response, nc replay, opaque, uri and
the PUT body), TestDAVDigestWrongPassword (still reads as a wrong
password; a Basic server is left alone).
Broken by hand: newDAV without the transport, TestDAVDigest red with
"refused the user name or password (HTTP 401)".
Not tried: a real Digest server (only the fake, built from the RFC's
formula); auth-int and SHA-512-256 are not answered. The first request of
a connection still carries Basic, as before, so a Digest-only server over
plain http sees the password once; nothing else was changed in that path.
2026-11-13 10:23:47 +08:00
yetone efc3e1e56b remote quotas: a Remote with no picks tells every card, a usage-only provider's included (fcooji on X)
On 0.1.3959 Claude Code set to usage only on the remote magpie showed no
usage on the local magpie that added it as a Remote. A usage-only provider
lists no model there, so a Remote with nothing picked here exposes only
what the remote lists, and cfd49e36a/93b855d90's filter by enabled models
dropped the Claude card. Only the user's own picks (Provider.Models) narrow
cards now; no picks, or Select none, tells all of them.

Run (mote): TestRemoteUsageOnlyProviderStillShowsItsCard is red with the
new rule turned off by hand (map[office/codex:true]), green with it;
-run 'Remote|Quota|Card' in internal/provider and internal/gateway ok; go vet
darwin/linux/windows of internal/provider ok; gofmt clean.
Not tried: two real magpies in sandbox HOMEs (a fake peer and list server in
the test), the GUI suite (Go only), the full Go suite (started after the tag).
2026-11-13 10:22:01 +08:00
yetone 2ae8e61a4f usage: an upgrade reads session files again only when the code of their rows changed (#2278)
requests-v1.bin and log-v1.bin were keyed on a hash of every .go file in
internal/usage, so nearly every release that touched the package threw
both away. The first start after such an upgrade read all ~24k call
shards again: on the owner's real accounts (mote, acctp sandbox) that is
13.8s of CPU and ~3.4GB allocated before the page settles, against 2.4s
warm.

Each file now keys on the source its rows are made, written and read
through: rowSource (15 files) and logSource (23 files), embedded by name.
The row pricer and a file's chunk builder are lifted out of
readRequestBlocks (sessionRowPricer, sessionChunk) so they can be roots.
TestRequestDiskNamesTheCodeOfItsRows type-checks the package and walks
every declaration reached from those roots (uses, package vars assigned
elsewhere, interface calls, encoding/String/sort methods); it fails when
a reached file is not embedded or an embedded one is not reached.
Of the last six usage-changing releases, four (3962, 3958, 3941, 3908)
would have kept the cache.

Run:
- go test -count=1 ./internal/usage on mote: ok 51.9s.
- go vet ./internal/usage for darwin, windows, linux on mica: ok.
- Broken by hand: session_provider.go left out of rowSource's embed ->
  "rowSource: session_provider.go is reached but isn't in its go:embed",
  FAIL; restored.
- Real accounts on mote (pageheap.sh, page open, CPU at mark):
  w47v first start after an older binary 13.80s, numGC 217 (rebuild,
  expected); w47v again 2.45s; w48v (w47v plus a live init() in
  effort_split.go, a different binary) 2.59s, numGC 56; back to w47v
  2.43s. Before, the same swap cost ~14s.
Not tried: Windows or Linux real start.
2026-11-13 10:09:27 +08:00
yetoneandvincent 363adb3528 plugin: the auth-lock test checks the loop ran while the lock was held, not how often a timer ticked (#5271)
TestAuthLockWaitDoesNotFreezeTheHost counted a 20ms setInterval over a
300ms sleep and wanted 8 ticks. A loaded runner fires the timer late and
counts fewer while the loop is free all the same: 7 of 8 on mote (#5271),
6 on ubuntu CI at f28787b39 (run 43328831902). It measured the scheduler,
not the freeze it is named for.

Ported from skygunner's fork commit 94d8550c8 (on #5271): a setImmediate
registered before changeAuth checks, from the event loop itself, that the
other host's lock is still there and the change not yet written, then lets
the lock go; the test awaits that and the change. A host that waits with
Atomics.wait (#5112) never reaches the check while the lock is held. The
300/600ms sleeps, the tick count and the 5s bound go; the 20 concurrent
changes and the stale-lock takeover are kept as they were.

Run at this tree (origin/main 1e2ce2463 plus this):
- Linux (wsl-run): go vet ./internal/plugin; -count=20 -run of the test: ok.
- macOS (mote-run): the same, ok.
- gofmt -l: nothing.

Broken by hand on Linux: host.js's sleep made a blocking Atomics.wait. The
test went red at 10.1s, "the event loop ran while the other host still
held the lock"; host.js put back.

Not run: the full suite, and Windows.

Co-authored-by: vincent <webmaster@palmit.com.au>
2026-11-13 08:52:12 +08:00
yetone 6af6ae9885 usage: a log of MCP calls and probes keeps its blocks on disk too (#2278)
log-v1.bin was written only once a gateway block had filled. A log of
MCP tool calls and probes has none (the real-account sandbox's 8.3 MB
log is 25,223 MCP lines and 2,539 probes, 54 probe blocks, 0 gateway
blocks), so full.n stayed 0, the file was never written, and every
start parsed all 27k lines again: readLogSnapshot took 60 MB of the
start's allocations. The probes that were kept went as JSON and were
parsed back a record at a time.

A full point is now marked too when a probe block fills while no
gateway row stands after the full blocks, and it records how many probe
blocks were full there (logFull.probes). Those go to the file as binary
entries, as the gateway blocks do, read from its mapped pages; only the
probes after them, up to the full point, still go as records. The file
is written again when its full point reaches further (by offset, not
the gateway block count). The magic is magpie-log-v2, so a v1 file is
parsed over once.

Run:
- go vet ./internal/usage; go test ./internal/usage ./internal/gateway
  (mica, -timeout 45m): ok usage 31s, ok gateway 859s.
- TestStartReadsKeptProbeBlocks (new): an MCP-only log of 3 blocks + 100
  is kept, a start reads 3 blocks from the file, and reads as a whole
  parse. Broken by hand (no probe full point): red, "a log of probes
  wasn't kept".
- Real-account sandbox on mote (acctp, page open 2.5 min, version
  0.1.3961 builds): log-v1.bin written on the first start (645 KB);
  warm starts, w45v (v0.1.3961) against this:
    CPU at mark  3.21s, 3.00s  ->  2.50s, 2.39s
    allocated    701 MB        ->  646 MB, 629 MB
    readLogSnapshot cum 60 MB  ->  2.6 MB
    numGC        66            ->  56
  Footprint 128-133 MB -> 132-135 MB, liveHeap ~80 MB both: the same
  within noise.

Not tried: a log with both gateway and probe blocks across a v1 -> v2
start on a real account (the unit test's mixed log covers the format).
2026-11-13 08:51:24 +08:00
yetone 5a44051eb5 gui: Discover's long-list hook moves into plugingrid.js, and the core budget carries the rest
TestCoreScriptBudget has been red on main since 5a0e0378c (06:00): the
core's scripts were 1,265,848 bytes against 1,265,544. 5a0e0378c added
344 bytes of code to plugins.js, and its body says the budget passed at
7583ed65c, but at 7583ed65c the core had only 40 bytes of room. CI's
first full run after it (e9e63c6d7, run 43323956017) went red on ubuntu
and macOS with those numbers.

The redraw that followed the import, and the threshold, now live in
plugingrid.js: pmVirtualGrids(page, card, body, draw) draws Discover's
body again from a microtask, once plugins.js holds what it returned, when
a list of VMIN cards or more was drawn whole before the import came. It
returns min, so plugins.js reads the threshold from it. plugins.js keeps
only the import, cardGrid and the three now() calls: 136 bytes out. The
budget carries the other 168, with why in its comment. The comment also
had ee1553913's "+1,112 for Codex's Open button" twice; the budget was
raised by 1,112 once (1,264,432 to 1,265,544), so one copy goes.

Run on mote at this tree (origin/main 390dd407b plus this), mote-run:
- go vet ./internal/gui; go test -run 'TestCoreScriptBudget|TestAppScript'
  ./internal/gui: ok. gofmt -l: nothing. node --check on both files.
- plugin-discover-virtual 22 of 22, plugin-market 6, plugin-kinds-discover
  22, plugins-more-discover 6, plugin-progressive 6, i18n-keys 4: all pass.
- old-webkit: 2 reds, the known ones (headerpresets.js #6030, :has()
  #5919), as 5a0e0378c recorded.
- Recomputed the budget's measure at 7583ed65c, 5a0e0378c and this tree
  with a copy of codeBytes: 1,265,504, 1,265,848, 1,265,712.

Broken by hand: with the microtask redraw taken out,
plugin-discover-virtual still passes 22 of 22, so the "drawn whole before
the import" redraw has no test, before this change and after it.

Not tried: the real app; a long list drawn before plugingrid.js arrives.
2026-11-13 08:18:10 +08:00
yetone abacab7207 provider: a model's listing providers share one copy of each provider
listedBy, the providers listing each model (for a model no catalog entry
has), appended a copy of the whole Provider (1.3KB) for every model of
every provider. It now keeps one copy per provider and every model points
at it; the one caller copies the provider it returns, as before.

Measured on mote with a real-account sandbox HOME (network blocked),
2.5 min with the usage page open, alloc_space of listedBy:
  w44 (5a0e0378c) 29.56 MB, w45 (this) 10.81 MB; total 809.5 -> 790.3 MB.
liveHeap 81.2 -> 81.0 MB (the map is rebuilt, not held long).

Run at this tree on mote: go vet ./internal/provider; go test
./internal/provider (ok 138.6s) ./internal/gateway/... (ok 906.9s);
gofmt -l clean. Not added: a test for the sharing itself.
2026-11-13 07:52:48 +08:00
yetone 61be687ffa claudetui: /usage's saved figures are not told when the refreshed panel's redraw stalls (#6376)
TestShimWaitsPastSavedUsage/refreshed went red on macOS CI at 7583ed65c
(run 43313397426): the shim told the figures of the "Refreshing…"
screen, the ones Claude Code saved, as today's.

The look of the panel kept while "Refreshing…" was on screen stayed
kept after Claude Code cleared the screen to draw the refreshed panel.
When that redraw stalled a second after its clear, as on a loaded
runner or a busy machine, the screen no longer said "Refreshing…", the
kept look counted as figures, the screen had stood still for
commandSettle, and the saved figures were told.

Now a look saying "Refreshing…" is not kept, the looks kept before it
are dropped once it is drawn, and after it only the screen as it is now
(or a look kept since) counts as figures or as the panel drawn.

Run on mote:
- the new subtest "refreshed after a stall" (the fake clears the screen,
  then waits 2s before the figures) on the old tui.go: red with CI's
  exact output (8% / Nov 8 told as today's)
- with the fix: go test -count=3 -run 'TestShimWaitsPastSavedUsage|
  TestShim.*Usage' ./internal/claudetui ok; go test ./internal/claudetui
  ok; go vet for darwin, windows and linux ok; gofmt -l clean

Not tried: a real Claude Code /usage that refreshes; Windows' pseudo
console run of the package.

Fixes #6376
2026-11-13 07:15:55 +08:00
yetone 482653868b gui: a provider row's read-once test measures the row's own work apart (#6375)
TestProviderInfoReadsTheListOnce was red on main since e6184b368 on
ubuntu and macOS CI (10367939 bytes against a list of 1015856, bound
5 lists). The row still reads the list once. e6184b368 made p.Available()
8x cheaper (8572862 to 1015856 bytes on mote) while each model's own
price, window and protocol look-ups stayed at ~5.4 MB, so a bar of
"5 lists" stopped meaning anything.

The test now measures three things: the list (p.Available()), the
listing a row is built from (p.Listing()), and the row's own work with
the listing handed in (providerInfoWith). A row reading the list once
takes listing + rest; the bound leaves half a list of room, so one more
read of the list is red.

Run on mote at origin/main e9e63c6d7 + this:
- go test -run TestProviderInfoReadsTheListOnce -count=5 ./internal/gui:
  ok, a row 10358027..10447395 bytes against listing + rest
  10400727..10417507.
- Broken by hand: an extra p.Available() in providerInfo makes it red
  (11411529 against a bound of 10947066). The old bound let that pass.
- Bisected at 66f98d9d6 and ac15036ab (green, list 8.57 MB) against
  e6184b368 (red, list 1.02 MB).
- go vet ./internal/gui ok, gofmt -l clean.

Not tried: Linux. The WSL box has no gtk4/webkitgtk-6.0 dev packages,
so internal/gui doesn't build there; ubuntu CI ran the same numbers as
mote before this. Not run: the rest of internal/gui (test-only change
to this one file). TestShimWaitsPastSavedUsage/refreshed, red on macOS
CI in the same run, is a separate test and not touched here.

Fixes #6375
2026-11-13 07:05:00 +08:00
yetone 5a0e0378c0 plugins: Discover draws only the cards near the view in a long list
The owner, 11-13: "这个页面有点卡,记得做列表虚拟化" (Plugins › Discover with
Subscriptions picked, 369 cards). Every redraw of Discover's body (npm's
numbers coming in, a count changing) made all of them again.

A grid of 48 cards or more (a kind picked, a search that matches hundreds,
npm's hits) now draws only its rows near the view, 700px past each edge,
and keeps the whole list's height in its padding above and below. The rows
follow the scroll and the width (a ResizeObserver on the page): columns are
read from the grid's own computed columns, so narrow widths and every
language lay out as before. Row heights are measured as they are drawn. A
card with focus stays in the page, held where it would be, so keys go on
from it. Cards are made once per list and kept, so a click lands on the
same node. A list shorter than 48 is drawn whole, as before.

The code is in plugingrid.js, imported when Plugins first draws, so the
core doesn't grow: TestCoreScriptBudget was 3,299 bytes over with it in
plugins.js. Until the import lands, a long list is drawn whole, and the
body is drawn again once it has.

Measured with plugin-discover-virtual.test.cjs's PERF=1 on mote (load
~25 to 55, so the times are high). The time is from the Subscriptions
click to the cards drawn, with a market of 503 plugins (370 subscriptions).
- Before (origin/main): chromium 69.0ms at 1180px and 56.5ms at 420px,
  webkit 77ms and 74ms. 370 cards and 9,312 nodes in #view-plugins.
- After: chromium 6.2 to 9.7ms, webkit 10 to 13ms. 30 cards and 810 nodes
  at 1180px, 10 cards and 312 nodes at 420px (de: 9 and 285).

Guard: plugin-discover-virtual.test.cjs (new), in chromium and webkit, in
en, zh, zh-TW, ja and de, at 1180px and 420px. It checks:
- at most 72 cards are drawn, and the list keeps its whole height;
- wheeling to the middle never shows an empty stretch, and the focused
  card is kept;
- at the bottom pv-369 is in view and its Install posts its spec;
- "pv-12" lists all 11 matches, and "pv" draws at most 72;
- nothing scrolls sideways, and there are no page errors.

Broken by hand: VMIN at 1e9 (every list drawn whole) turned it 22 of 22 red.

Run on mote at this tree, before the rebase (mote-run):
- go test ./internal/gui: ok (the budget too). gofmt -l: nothing.
- plugin-discover-virtual: 22 of 22.
- Every GUI file that draws plugin cards or Plugins (the 54 that grep finds
  pm-card, view=plugins or pluginAgentsTo), with i18n-keys and
  i18n-en-no-cjk: all pass, except the reds below.
Reds, the same at origin/main be8e352a2:
- settings-lines-wrap: chromium de 440px (#6353).
- old-webkit: headerpresets.js isn't in the list (#6030), and app.css
  uses :has() (#5919). Its plugingrid.js entry is added here.
- title-bar-tools: webkit ja went red once in the first run, then passed
  10 of 10 when run again (#2740, #4716).

Run again at this commit, rebased on origin/main 7583ed65c (mote-run).
plugin-discover-virtual 22 of 22. plugin-market, plugin-kinds-discover,
plugins-more-discover, plugin-progressive, i18n-keys and i18n-en-no-cjk
all pass. TestCoreScriptBudget passes. Reds, the same at 7583ed65c run
alone:
- TestProviderInfoReadsTheListOnce: a row is ~10 lists against a bound of
  5 (#6375, filed now).
- plugin-card-update: webkit red 1 of 2 on both trees (#3079).
- old-webkit: as above (#6030, #5919).

Not tried: the real app on Linux WebKitGTK, and the real market from
usemagpie.ai.
2026-11-13 06:08:46 +08:00
yetone aa84b568d6 claudetui: the undrawn-Claude test leaves its fake room to start
TestShimSaysWhatAnUndrawnClaudeWaitsOn/keychain went red on macOS CI
at fa7e466ac: "showed no prompt in the 100ms its caller waits for it
... it runs no command". The test fixes the shim's deadline 3s out
before the shim and its fake start; the loaded runner spent all but
100ms of it there, and the fake had not started its Keychain read when
the shim looked. The window is now 10s for each case.

Run (wsl-run, magpie-desktop; mote and mica were over their cores):
- broken by hand: a 2.9s sleep after the deadline is set and a 300ms
  sleep before the fake starts `security`. Old 3s window: red with
  CI's own message ("in the 100ms ... it runs no command, 8 MiB
  resident"). New 10s window, same injection: ok.
- injections removed: go vet and go test -count=1 ./internal/claudetui/
  ok (133s); gofmt -l clean.
Not tried: macOS (the fake and the shim are the same on darwin; the
Keychain clause is what the injected run checks).
2026-11-13 05:37:07 +08:00
yetone 5f5307ab6d gui: each embedded file is hashed once, not on every load
revalidated read each embedded file again on every request to make its
ETag, and the page "/" read and hashed every file it names to version
their URLs. A release's files never change, so each one's sum (and the
versioned page) is now kept in a sync.Map after its first read. A dev
build (-tags dev) reads from disk and keeps nothing.

Measured: TestStaticFilesHashedOnce, 20 loads each, on mote:
  with the memo   green (app.js under 1x its size, page under 6x its)
  memo off by hand  app.js 26,516,856 B; page 165,916,424 B (~8 MB a
                    page load) - red
Run on mote: go vet ./internal/gui and -tags dev; go test -run
"StaticFilesHashedOnce|VersionedFilesKept|WebCompresses|PageFilesRevalidate|Revalidat"
./internal/gui ok.
Not tried: the full GUI suite (no change to what is served).
2026-11-13 05:31:22 +08:00
yetone a8b0e80f65 usage: the request page's probes are made into a chunk once per change
readRequestBlocks made probeChunk again on every poll of the Requests
and Usage pages: a rowChunk holding every probe since the period's
start minus a day, interned again each time. On the real-account
sandbox it was ~45 MB of 952 MB allocated in two and a half minutes
(rowChunk.add under probeChunk, #2278).

probeChunk now keeps the last chunk it made, with the probe blocks,
since, renames and hosts it was made from. A frozen block is never
written again (a new probe reopens the tail as a copy), UsageRenames
hands back the same maps while providers.json is unchanged
(Renames.Same compares them by identity), and hosts are compared by
content, so the same inputs make the same chunk, which no reader
writes. Any of them changing makes it again.

TestProbeChunkMadeOncePerChange: the same inputs give the same chunk;
a later since, a changed host and a new probe each make a new one.


Measured on mote with the real-account sandbox (pageheap.sh, the
request page polled to the mark): probeChunk allocated 43.81 MB at the
base (w42) and 24.54 / 24.10 MB with this (w43, two runs). It is not
zero there because the sandbox's network is blocked, so every probe
fails and logs a new row, which makes the chunk again.
Run on mote: go test ./internal/usage ok (33.9s); the test is red with
the memo turned off by hand.
2026-11-13 05:31:22 +08:00
yetone e6184b368a provider: a provider's models.dev models are read, not copied three times
Provider.available, the base of every Available and Exposed, made three
copies of a provider's catalog models on each call: catalog.Provider
cloned the built list, available appended it into a list of its own to
drop an id two catalogs share, and the list without experiments and
previews was grown from nothing again. On a page open with the owner's
accounts that was 74 MB of 952 MB allocated in 2m32s, the largest flat
allocator of all.

catalog.ProviderShared is the built list itself, for a reader
(catalog.Provider still hands out a copy). available reads it through
catalogsOf, which copies only when two catalogs are joined, and sizes
the released list before filling it. The shared list is never returned:
every way out of available returns Decorate's list, the released copy
or the signed-in account's own. The built list is clipped, so an append
to it reallocates.

Run: go test ./internal/provider ./internal/catalog on mote (ok,
provider 135s). Measured on mote's real-account sandbox (acctp, the
Usage and Providers pages polled for 2m32s, pageheap.sh), w41 = the
parent, w42 = this commit: allocations 993 -> 858 MB, available's
cumulative 144.5 -> 52.3 MB, CPU at the settle mark 3.32 -> 3.18 s;
footprint 130 MB and live heap ~76.7 MB both unchanged. The parent's
full suite at d1e823d5f (same Go tree) was 99 ok, 0 FAIL; this
commit's provider and catalog packages ran again, not the full suite.
2026-11-13 05:15:44 +08:00
yetone ac15036ab4 provider: a catalog entry points at its provider instead of copying it
Entry.Provider was a Provider value, 1,328 of an Entry's 1,760 bytes,
copied into every model of every provider each time a catalog, an
agent's list or a routing group's entries were built. It is now a
*Provider: entriesOf and decide's list give every model of one provider
the same one (sharedEntry), and a group's entry points at its first
member's. It is read only; every place that hands it on as a value
(Resolve, CanFast, ownAgent, modelAllowed, …) dereferences it, so what
they get is a copy as before. entryFor keeps its signature for the one
model ServedEntryOf builds; offEntries' entries now carry their provider
too.

Measured on mote with the owner's real accounts (acctp sandbox, page
open for 2m32s, w40 = before, w41 = this, alternating):
- catalogOf's allocations 106 MB -> 67 MB, providerEntries' 88 -> 78 MB
- CPU at the page's settle mark 3.42/3.33 s -> 3.18/3.30 s
- live heap unchanged (76.3/76.1 -> 76.7/75.9 MB): the lists are
  rebuilt, not kept, so the copies were churn for the GC, not held

Run: go build and go vet ./... and the tests compiled (go test -run ^$)
on mote; the full suite at this tree (d1e823d5f) on mica: 99 packages ok, 0 FAIL (agent 317s, gateway 972s, gui 188s, provider 220s, usage 56s).
2026-11-13 05:12:30 +08:00
yetone 66f98d9d65 gui: the add sheet's tools show in the title bar once scrolled out of sight
The owner, 11-12, on the Providers page's Add sheet: 向上滑动,然后这些区域
不在可视区域的时候,这些区域应该自动浮现在Header处. Beside the sidebar
(side-nav, a window 1024px wide or more), the sheet's search, Custom
provider and Import… now show in the title bar's empty right, left of its
buttons, once the sheet's head row has scrolled out of sight. They are put
there the way Library's, Plugins' and Settings' tools are: position: fixed
inside --tools-l/--tools-r/--top-h, which app.js tools() keeps out of the
crumb's way (its head query now includes #addSheet .add-tools.afloat).
Scrolled back up, they are in their row again. Close stays in the sheet;
the screenshot's box didn't cover it.

The group is pinned, never copied, so there is one search: the words typed
and the focus stay with it both ways. Each change is a 180ms fade in going
into the bar and 140ms coming back, cubic-bezier(.23, 1, .32, 1), opacity
only, so reduced motion keeps it. Nothing moves in the sheet: the head row
keeps its height while its tools are up.

Narrow (no sidebar, which covers 420px and the panel): the bar has no free
room, so the sheet's whole head (label, tools, Close) is held at the top of
the page while the sheet is under it, the way Settings' head is in a narrow
window. It has the same blur strip and a hairline once stuck. At 760px and
under, the tools take a line of their own under the label.

The code is in a new addfloat.js, which renderAdd imports the first time the
sheet opens. In app.js it took TestCoreScriptBudget 487 bytes over
(1266031 > 1265544); with the move the budget passes and isn't raised.
old-webkit's list of scripts loaded on demand names it.

Run at 39ac4fafe (on origin/main 2d2333cfa), then again after rebasing on be8e352a2:
- New add-sheet-float.test.cjs: 22/22 (chromium and webkit; en, zh, zh-TW,
  ja, de; 1100px and 420px). It scrolls with the real wheel. In the bar,
  it checks the search is in the title bar left of its buttons and right
  of the crumb, with Custom provider and Import… there too; narrow, that
  the head is held at the top. Then: the search is clear to press, a click
  scrolls nothing and takes the focus, typing "Relay 2" filters the tiles
  with one search kept, and scrolling back puts it in its row with the
  words and focus.
- Red on the old code (git archive of the base's internal/gui): 0/22, on
  "in the bar once out of sight" (wide) and "the head held at the page's
  top" (narrow).
- go test ./internal/gui -run Budget: ok (mica).
- Related GUI files on mote, both engines, 380 tests, 376 pass: add-sheet,
  add-sheet-custom, add-button, add-partners-shine, add-sponsor-me, the six
  providers-*, i18n-keys, provider-detect-draft, provider-env-paste,
  provider-add-gemini, provider-retrieval-only, provider-url-each-api,
  modal-title-drag, model-id-space, builtins, old-webkit. The four reds are
  filed and come from other changes:
  - add-sheet "quiet rows" chromium en: tlscerts.js reads a null draft's
    serverPin (#6216). It was red in en, and in zh after the rebase, both times
    beside other files. Alone, chromium, 2/2 green on origin/main and 2/2 here;
  - old-webkit: headerpresets.js isn't in its list (#6030);
  - old-webkit: .side-foot:has() in app.css (#5919).
- After rebasing on be8e352a2: Budget ok; add-sheet-float, add-sheet,
  old-webkit and i18n-keys 34/38, the same three filed reds.
- i18n-keys first ran out of memory under mote-run -C internal/gui: it
  walks ../../.., which there is all of ~/runs. Run from the tree's root:
  4/4.

Not tried: the real app (Wails on macOS, WebKitGTK on Linux, WebView2 on
Windows). Only Playwright's engines were run, so the title bar's dragging
around the pinned tools (--wails-draggable) wasn't checked in a real
window.
2026-11-13 05:08:10 +08:00