Commit Graph
8656 Commits
Author SHA1 Message Date
yetone 93fa1d661c library: a Claude plugin's parts keep their own agents through sync, and each says which plugin it came with
givePlugin gives every part of a Claude plugin (skills, MCP servers,
hooks, subagents) the plugin's agents. putPlugins' settle ran it on every
sync put, even when the plugin's own agents and switch hadn't changed.
So an agent ticked or unticked on a part's own row was put back on the
next sync without a word. Now settle gives the parts the plugin's agents
only when those agents or the switch change. A part's own edit stays
until then.

The Library never showed `bundle`, so nothing on a part's row said it
belonged to a plugin. Each such row (Skills, MCP, Hooks, Subagents) now
carries an "In {plugin}" tag. Its tooltip says that changing the
plugin's agents, or turning the plugin off and on, gives the part to the
plugin's agents again. The tag is in en, zh, zh-TW, ja and de.

Tests:
- TestPluginPartOwnAgentsKeptBySync: tdd set to claude alone survives a
  sync of the same plugin, and changing the plugin's agents gives tdd
  the plugin's agents again.
- library-plugin-parts.test.cjs (new): one bundled part and one own part
  on every tab. Each bundled part has the tag, with its text and tooltip
  in each language, and the own part has none. Nothing is wider than the
  window at 1100 and 420. Chromium and WebKit.

Run (mica, at this tree on 32a181868):
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.
- go test ./internal/library: ok.
- every library-*.test.cjs plus i18n-keys, both engines: 1900 pass,
  10 red.
  - library-open-again's 1100px cases are red on origin/main 98355866f
    too, run alone (#6751).
  - library-commands' WebKit de case (#7035) and library-pi-market's
    Chromium case (#7036) were red under load 110. Run again alone,
    they pass on this tree and on origin/main.

Broken by hand, each red, then put back:
- settle giving the parts on every put (`if moved || true`):
  TestPluginPartOwnAgentsKeptBySync red ("tdd's agents: claude,codex,
  want its own claude").
- withPlugin never tagging (`if (false && x.bundle)`):
  library-plugin-parts 82 red of 82.

Not tried: the real app window, or a real Claude plugin's sync between
two computers.

Run again after a rebase on 888d4eba5 (mica): the go test guards and ./internal/library ok; library-plugin-parts, library-plugins, agent-disconnect, agent-bulk-visibility, agent-visibility-saving, plugin-tools, i18n-keys, gui-de, gui-ja and gui-zh-tw, both engines: 155 pass, 0 fail.

At the pushed head, on cb1fe6d5d (mica): the go test guards, ./internal/library -run TestPlugin, i18n-keys and agent-disconnect ok.
2026-11-18 13:52:12 +08:00
yetone cb1fe6d5d9 gui: Get started put away comes back from Settings › General
Once the Agents page's Get started card was hidden (POST
/api/settings/guide {hidden:true}) nothing in the app brought it back.
Hiding it now says where it comes back ("Get started hidden; Settings ›
General brings it back"), and General has a Get started row with Show,
only while the card is hidden and would otherwise show (setup not done,
not gateway mode). Show posts {hidden:false}, redraws the Agents page and
says so; the row goes. The row lives in guideback.js, imported by
navpages.js beside the sidebar's pages, so the core grows by one status
line. Settings' search finds it by its name.

Run (mote, at this tree):
- getting-started, nav-pages-hidden, nav-pages-order, settings-general,
  settings-search, i18n-keys, gui-de, Chromium and WebKit, every
  language: 117 tests, all pass after the fake server answered
  /api/settings with the guide flag as the real one does.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, each red, then put back:
- renderNavPages not calling guideBack: getting-started 20 of 60 red
  (the row never shows).
- the hide's status line removed: getting-started 30 of 60 red.

Not tried: the real app window.
2026-11-18 13:46:51 +08:00
yetone 36d784da4b gui: the check-in time reads as the one time for every vendor
settings.checkinAt is one time that every daily check-in waits for. Its
row is drawn under each vendor's check-in, in WorkBuddy's, Trae's,
MiniMax's, Qoder's and each plugin's editor, and its picks said Off and
On. Under one vendor that read as turning that vendor's check-in off,
while it set every vendor's time. The row is now "Check-in time for every
vendor", with "Day start" and "Set time". The backend keeps one time, so
the row stays one shared setting rather than one per vendor. Same
settings, same saves. Translated in zh, zh-TW, ja and de.

Run (mote, at this tree):
- checkin-at.test.cjs (Chromium and WebKit, 1100 and 420, en zh zh-TW ja
  de) and i18n-keys.test.cjs: 44 pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand: checkin-at against the old checkinnow.js, 20 of 40 red
(the name and the Off/On picks), every engine, width and language.

Not tried: the real app window.
2026-11-18 13:44:53 +08:00
yetone afabb7f90f library: a skill the router lists stays a /name of Claude Code's
RoyShen on X (yuushabu_buyinn): with the skill router on, / in the agent
no longer picks a skill. A listed skill has no link of its own in the
skills folder, so Claude Code had no /name for it.

For each skill the router lists for Claude Code (any profile; not a
plugin agent or WSL), routerCommands writes <claude dir>/commands/
<name>.md: the skill's description, disable-model-invocation: true, and
a body that has the agent read the skill's SKILL.md at the router's path
and follow it, with $ARGUMENTS. The flag keeps the description out of
the model's prompt, so the router still saves what it saved. The stubs
go in the commands folder, not the skills folder, because Crush, DevEco
Code and Kimi Code read ~/.claude/skills too and ignore the flag.

Applied.RouterCommands records the files with their hash (syncOwnFiles):
one the user changed is theirs. A user's own command file by that name,
or a Library command of that name given to Claude Code, means no stub;
syncCommands takes a stub's file over when such a command is added. The
command import leaves the stubs out. Router off, or the skill kept
direct: the stub goes.

Run:
- mica-run go test -tags nogui ./internal/library -count=1 -timeout 45m: ok
  (277s); GOOS=linux and GOOS=windows go vet ./internal/library: ok;
  gofmt -l clean. Base 18fe1e2dc (fetch failed at commit time).
- Broken by hand: routerCommandsDir returning "" (the old behaviour)
  turns TestSkillRouterKeepsSlashCommands red.
- Real Claude Code 2.1.316 in a sandbox HOME, magpie built from this
  tree placing two skills (okapi, zebu) with the router on, through a
  recording proxy to the gateway (auto/claude-haiku-5-5): the / menu
  lists /okapi and /zebu with their descriptions; "/okapi" answered the
  codeword from okapi's SKILL.md; "Use my zebu skill." went through
  magpie-skills and answered zebu's; every run's first request has each
  description once, in the router's own line, none from a stub. Router
  off: both stubs gone, links back, settings.json's rules gone.

Not tried: Windows and Linux Claude Code (the path is the same
filepath.Join; Windows rules use claudePath already). The Library's
"keep direct" tooltip still says "to type it as /name", which stays
true for the other agents.
2026-11-18 13:43:49 +08:00
yetone 888d4eba52 library: the MCP market puts the most used servers first, counted from the day's report
gugediyige666 and freedomf26 on X asked for an MCP list ranked by
downloads, searchable and installable. Search and install from the list
were already there; skills were already ranked by skills.sh's install
counts. What was missing was a count of who uses each MCP server.

- internal/library/market_public.go: PublicServers names the Library's
  servers that an agent is given and that the market lists from what
  ships with magpie (featured, or the registry snapshot), by market id
  only, matched by serverKey. A bare command names no package and is
  never matched; a server of the user's own, one found only by a
  search, and its address, command or keys never go.
- internal/stats/plugins.go: the day's plugin report carries them as
  "servers" (at most 50), and goes when either list has something.
  PluginCounts returns a Board with plugins and servers.
- site/pluginstats.js: servers are kept as mcp:<id> beside the plugins,
  pruned apart (D1 binds at most 100 values a statement; the test's
  stand-in now enforces that), never liked, and /api/plugins/stats
  returns them under servers.
- GUI: with nothing searched, a server with 20 or more users comes
  first, most used first, with a person chip of its count; the rest
  keep the curated order. Counts are waited for at most a second, so a
  drawn list never reorders; a search keeps the registry's ranking; a
  failed ask is tried again after a minute, not with every search.
- Privacy text: READMEs (en, zh), site privacy and start pages (en, zh,
  ja), reference.md, the Settings privacy row (zh, zh-TW, ja, de),
  llms-full.txt and search indexes rebuilt; docs/subsystems/library.md.

Run (mote, rebased on 18fe1e2dc; budget, TestI18n*, i18n-keys, market-used and privacy-usage-stats again at b53e23ba3, ok):
- go test ./internal/library ./internal/stats ./internal/gui (TestPublicServers,
  TestPublicServerIDsAreCatalogIDs, TestSendPlugins, TestPluginCounts,
  TestCoreScriptBudget, TestI18n*): ok. gofmt -l clean; go vet darwin ok,
  GOOS=linux/windows CGO_ENABLED=0 vet of library and stats ok.
- node --test site/pluginstats.test.mjs: 8 of 8.
- GUI, chromium and webkit, en/zh/zh-TW/ja/de: market-used (new, 30 of
  30), i18n-keys, i18n-en-no-cjk, market-*, plugin-market, privacy-*,
  library-pi-market: 284 of 284.
- Broken by hand: matching a bare command made TestPublicServers name
  "bare-one"; turning byUse off made market-used red. The old single
  DELETE of 100+ bound values made the new site test red.

Not run before the push: the full Go suite and the whole GUI suite.
mote and mica were both running other sessions' full and GUI suites
(load 45 to 270); they run after, on mote. Not tried: a real day's
report reaching usemagpie.ai from a live install (the worker is
checked with curl after deploy).
2026-11-18 13:39:27 +08:00
yetone b53e23ba3e gui: a provider's editor says Close while nothing waits for its Save
The provider editor mixes two kinds of control. An account's auto-switch,
a key's concurrency and spend pills and the Claude Code rows act at once
and say so in the status pill, while the rest waits for Save. Its Cancel
said Cancel either way, so after a switch that had already been made, it
read as if Cancel would take it back. The button now says Close while
the draft matches what is saved (providerDirty, the same check Cancel's
discard question asks), and Cancel once a field waits for Save. It is
read again after each input, change and click in the editor. A new
provider's editor keeps Cancel. Escape and the backdrop are unchanged.

Tests: six files that pressed the editor's Cancel on a clean editor press
its .ed-cancel now. lane-limit's draft-pill test brings the pill into
sight before opening its menu: under four files at once a scroll landing
after the click closed it (Chromium, 2 of 4).

Run (mote, at this tree):
- lane-limit.test.cjs: 24 pass.
- the 29 GUI files that press an editor's Cancel, Chromium and WebKit, four
  at a time: 491 pass, 13 red. 12 are red on 68dd531c6 the same way
  ("Working only unpicks", "Try again takes the models unticked", #4392,
  #4410). The other is login-import, Chromium en, once per run under the
  four-way run, at a different line each time. It passed 3 of 3 alone, and
  at 6x and 12x CPU throttling, here and on 68dd531c6. Already filed under
  load: #5035, #5597.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand: lane-limit against the old app.js, 8 of 24 red (no
Close, in the Relay and the Codex editor, both engines, en and zh).

Not tried: the real app window, and the whole GUI suite.
2026-11-18 13:35:20 +08:00
yetone 98c487d096 gui: Turn off telemetry for all agents says it takes effect when each agent next starts
The switch in Settings › Privacy rewrites each agent's config
(agent.SetTelemetryAll). An agent reads its config when it starts, so one
running now keeps sending until it is restarted. An agent's own Telemetry
switch has always said "Takes effect when {agent} next starts". The
switch for all agents said nothing, unless an agent refused. Now it says
"Takes effect when each agent next starts", in every language. A refusal
is still shown as the error.

Tests: privacy-agent-telemetry checks the status after the switch, in
every language, at 1100 and 640, in both engines.

Run (mote, at this tree):
- privacy-agent-telemetry, i18n-keys, gui-de and settings-search,
  Chromium and WebKit: 47 pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, then put back: with the old status line,
privacy-agent-telemetry was 20 of 22 red.

Not tried: the real app with a running agent.
2026-11-18 13:31:27 +08:00
yetone 18fe1e2dc3 gui: Mask personal data says it turns on Hide accounts too
Turning on Mask personal data in Settings › Privacy also turns on Hide
accounts (window.hideAccounts.set), and Hide accounts follows it until it
is chosen by hand. That has been so since inaction's report on Discord,
but nothing said it, so the accounts blurred on every page with no word
why. The row's description now ends "Turning it on turns on Hide accounts
as well", in every language.

Tests: privacy-hides-accounts now runs in every language (before, en and
zh only) and checks the description before the click.

Run (mote, at this tree):
- privacy-hides-accounts, privacy-model, redact-kinds, provider-mask,
  settings-search, i18n-keys, gui-de and gui-ja, Chromium and WebKit:
  303 pass, 1 red. The red is provider-mask "Hide accounts is one switch
  on every page", Chromium en 1000, a timeout under the parallel run. It
  passed 140 of 140 alone, and is filed as #5109.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, then put back: with the old description in app.js,
privacy-hides-accounts was 10 of 10 red.

Not tried: the real app.
2026-11-18 13:24:31 +08:00
yetone de321cc92e gui: Settings' search finds by a part's name, unfolds an Advanced around a hit, and reaches the settings sheets build
Three gaps in Settings' search (the UI/UX scan's item 12):
- every part matched its tab's id too, so "usage" brought all of
  Allowances (id usage), rows that never say it included. A part is now
  found by its name; Observability still answers to "otel".
- a hit under a folded Advanced (Network and sharing's Name) stayed
  folded, so the part showed with nothing in it to see. It is unfolded
  while the search lasts and folded again when it ends (setFolds, in the
  lazy provlinks.js, so the core grows by two calls).
- what an agent's sheet or the Claude editor draws only when opened
  wasn't in the page to be found: Claude Code's prompt cache (main and
  subagents), its commit signature (Co-Authored-By), an agent's own
  fields (permission mode) and the Claude editor's run mode (claude -p).
  Each has a link row now, in the agent's or provider's name; Open opens
  the sheet or editor and lights the row, again if the editor draws it
  anew once the provider list is in (lightWhen).

docs/subsystems/gui-shell.md says so.

Run (mote, at this tree, rebased on origin/main 98355866f):
- settings-search-reach (new), settings-search, provider-prefs,
  provider-prefs-layout, settings-groups, settings-back,
  settings-tabs-stick, settings-hints, i18n-keys, gui-de, claude-mode,
  claude-cache, claude-attribution, claude-permission-mode,
  claude-lean-prompt-setting, claude-extra-usage-setting, agent-prefs,
  sync-own-fields, update-row-steady, win-caption; Chromium and WebKit,
  every language: 349 of 355 pass. The 6 red are settings-groups' "warm-ups
  and check-in" (an extra "Spend extra usage" row), red the same on
  origin/main 98355866f and filed as #6597.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS':
  ok, no budget raised.

Broken by hand, each red in both engines and every language (12 of 12),
then put back:
- the old code (origin/main): "usage" brings Menu bar cost.
- the tab's id put back in a part's words: the same.
- setFolds' unfold removed: "its Advanced unfolded".
- the fold-back on clear removed: "folded again after the search".
- sheetLinks not called: "Co-Authored" finds nothing.
- the run mode's link left out: "claude -p" finds nothing.
- lightWhen lighting only its first find: the editor's run-mode row is
  never lit (the editor draws it anew).

Not tried: the real app window; agents other than Claude Code with own
fields (the rows come from the same a.own list).
2026-11-18 13:16:18 +08:00
yetone fefab53d22 gui: TestGitHubTokenRefusedShown refuses a token of its own each run
ghtoken keeps the tokens GitHub answered 401 for as long as the process
runs, keyed by the token. The test refused one constant token, so a
second run in the same process (-count=2) found it refused before GitHub
was asked: red every time. Each run now builds its own token, ending in
4567 so the mask it checks is the same.

Run on mote at this head:
- go test ./internal/gui -run ^TestGitHubTokenRefusedShown$ -count=2 on
  the old test: FAIL "refused before GitHub was asked", 2 of 2 tries.
- go test ./internal/gui -run ^TestGitHubToken -count=5: ok.
- gofmt -l: clean. Test-only; no other file changed.
2026-11-18 13:09:42 +08:00
yetone 16c3abd623 gui: Settings › Usage says the tray on Windows and Linux, and hides Menu bar refresh when allowances are read only when asked
A menu bar is the Mac's. On Windows and Linux the Usage part said "Menu
bar windows", "Menu bar cost" and so on, about a tray. There it now says
"Allowances in the tray", "Tray windows", "Tray refresh", "Tray Claude
logo", "Tray pace", "Tray cost" and "Tray currency". The descriptions of
cost, Allowance display and Allowance reads say the tray too, and so does
the windows picker's title. This is in every language. The relabel lives
in traywindows.js, which is imported lazily, so the core budget doesn't
grow.

"Menu bar refresh" is hidden when allowances are read only when asked
and only cards are shown. In that case the cards keep the last reading,
so how often the icon redraws changes nothing. With a total picked, the
row stays, because the total is still counted again.

Currency's three rows are left as they are: tightening them is more than
trivial (currencyprefs.js).

Tests: tray-words.test.cjs. It covers MacIntel, Win32 and Linux x86_64
(navigator.platform forced), Chromium and WebKit, and every language. It
checks:
- the row names;
- that no name or description in Settings › Usage says the menu bar off
  a Mac (the Mac-only rows excluded);
- that the names survive a redraw;
- that the refresh row hides and comes back with When I ask, and stays
  for a total at 420 wide.

Run (mote, at this tree; mote at load ~26 and mica at ~110, so the
lighter one):
- tray-words: 50 pass.
- Nearby files (allowance-open-read, currency*, gui-de, gui-ja,
  i18n-keys, quota-reads, settings-groups, settings-search, tray-*), both
  engines: 342 pass, 8 red, each red on origin/main too and filed:
  - settings-groups "warm-ups and check-in", en and zh (#6597);
  - tray-cell-click "a menu-bar cell's click", Chromium en and zh (#5215,
    red the same on an origin/main 4dd1810ce copy).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, then put back: with the relabel turned off and the
refresh rule reverted, tray-words was 40 of 50 red.

Not tried: the real app on Windows or Linux.
2026-11-18 13:08:15 +08:00
yetone 98355866fd gui: the speed card's Check… brightens on focus in Safari 15.0 too
495ada49a put `:focus-visible` in a selector list with the row's hover,
and Safari before 15.4 drops the whole rule over it, hover included.
old-webkit.test.cjs's "the styles hold up in Safari 15.0" has been red
on main since. The two selectors now have a rule each.

Ran (mica, at this commit): node --test old-webkit.test.cjs
usage-model-speed.test.cjs, 18 of 18 ok (old-webkit was 5 of 6 before,
the Safari 15.0 styles test red on this rule).
2026-11-18 12:58:38 +08:00
yetone 74bba1fa67 gui: Settings › Version and the tray restart magpie with no update (yansheng1003 on X)
yansheng1003 asked for a Restart beside Check: "每次改了需要重新magpie,
都要自己退出再启动麻烦". The Version row now has Restart after Check
while no update is on offer (found, downloading, downloaded, blocked, a
newer version named or a failed download each have their own buttons,
which restart through the update and fill a 420px row), and the tray's
Restart magpie is always shown:
with an update ready it installs it as before, with none it starts this
magpie again as it is.

Both go through restartSelfNow (restart.go), the updater's own way of
starting again: on macOS and Linux the gateway's socket is handed over
(beginHandover), so requests in flight carry on; otherwise the bundle or
binary is started again (update.Relaunch, relaunchBinary), and on
Windows requests in flight are cut. magpie web runs itself again in
place. POST /api/restart answers 204 and then quits, or 400 "magpie
couldn't start again: quit it and open it again", and the row says
Couldn't restart magpie with the reason and gives its buttons back.
/api/update now says its run (the time this process started), so a
browser's page reloads once another run answers.

The click, its error and the reload are in versionrow.js, imported when
Restart is pressed. The mirror's Download from GitHub click moved there
too, so app.js stays under its budget with no raise (TestCoreScriptBudget
at 1,088,248 and 1,272,581, as they were). The route is named in the
CLI's notYet list. Words in en, zh, zh-TW, ja and de.

What needed a restart before, besides an edited path plugin (the commit
before): most settings already applied live (proxies, OTel, HTTPS/mTLS,
LAN from the GUI, allow-lists, CORS, shortcuts, tray, language, name,
fonts, port, hand-edited caller-keys, oidc-rules and library.json).
Still start-only: LAN switched by hand in settings.json, environment
variables, and in-memory routing state such as a rate-limited account's
order; Restart is for those.

Run:
- Full Go suite (mote, -timeout 45m) at the head before the rebase and
  before versionrow.js: 101 packages ok; the reds were
  TestEveryRouteHasACommandOrIsNamed, TestEveryRouteIsNamedForTheCLI
  (the route unnamed) and TestCoreScriptBudget, all fixed here.
- At this head (mote): go test ./internal/gui -run
  'TestCoreScriptBudget|TestEveryRouteIsNamedForTheCLI|TestRestart|
  TestUpdateSaysItsRun|TestTrayMenu' ok; ./internal/cli -run
  TestEveryRouteHasACommandOrIsNamed ok. go build, go vet, GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./... ok; gofmt -l
  clean.
- GUI (mote, both engines, at this tree): update-*.test.cjs,
  version-restart, settings-update-source, refresh-page, old-webkit,
  i18n-keys and i18n-en-no-cjk: 628 pass, then 6 red in update-check
  (Restart not dimmed while a check runs), fixed here (Restart dims
  with Check); update-check, version-restart and old-webkit again: 90
  pass, 0 fail.
- Real restart (mote, sandbox HOME): a built magpie web with
  MAGPIE_WEB_KEY, signed in through ?k=; POST /api/restart answered 204,
  the same pid ran again with a new run, and the cookie still signed in.
- Broken by hand: restartAppFrom returning true on an error, and
  TestRestartStartsMagpieAgain is red; version-restart.test.cjs on the
  old app.js is red (21 on chromium); with Restart shown beside an
  update on offer again, "no Restart beside an update on offer" is red
  in all 5 languages and both engines (12 fails).
- The whole GUI suite is still running on mica at push time; its reds
  are compared against origin/main and fixed or filed after.

Not tried: the tray item and a restart in the real macOS, Windows and
Linux apps (only magpie web was restarted for real).
2026-11-18 12:58:38 +08:00
yetone 95a7c70a63 docs: a plugin added by its path is loaded again when its files change
The design reference for the commit before this one: seenStamp, pathsStamp, what is left
out and how often it is walked.
2026-11-18 12:58:38 +08:00
yetone ceeae93e67 plugin: a plugin added by its path is loaded again when its files change
A plugin added by its path (the user's own folder or file, as its author
has it while writing it) was loaded by the host as it was when the host
started, and an edit reached it only once magpie was quit and opened
again (yansheng1003 on X: "每次改了需要重新magpie"). checkList, which
runs on every call to a plugin, now compares the files of every enabled
path plugin too (names, times, sizes; node_modules and dot folders left
out, 2000 files at most, walked at most once a second), and a change
starts the host again as a plugins.json change already did. The
middleware already reloaded its own files this way.

Run (mote): go test ./internal/plugin -run
'TestPathPluginEdit|TestPathsLookedAt|TestTerminalUpdateRestarts' ok.
Broken by hand: checkList back on listStamp alone, and
TestPathPluginEditRestartsTheHost is red at "the plugin's own code was
edited". The full suite runs with the restart change that follows.
2026-11-18 12:58:37 +08:00
yetone 68dd531c62 gui: a key's concurrency pill shows the provider's limit as typed in the editor
An account or key that takes the provider's limit showed the saved
Concurrency on its pill and in its menu's "Provider's" line while the
editor's Concurrency box, a few rows up, said another number. Both now
read the draft while the editor is open on that provider: a whole
number as typed, empty as the plugin's (or no limit), and the saved one
while the box holds something out of range. The pills are drawn again
on each keystroke in the box. Save and Cancel are unchanged.

Run (mote, at this tree):
- lane-limit.test.cjs, Chromium and WebKit, en and zh: 20 pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand: the new test against the old app.js, 4 of 20 red (the
pill kept "2 at once" after 5 was typed), both engines and languages.

Not tried: the real app window.
2026-11-18 12:57:16 +08:00
yetone 4dd1810ce6 lessons: 11-18 a tag on a suite still running at push
f4b202030 recorded its full suite as "running on mica at push time" and
v0.1.4408 was tagged on it; the result, 40 minutes later, had
internal/dirent (#7031) and an internal/gui test (#7032) red. Added as
evidence under "A record is written once its run has ended".

Docs only; nothing run.
2026-11-18 12:55:49 +08:00
yetone 5e850855b8 gui: the menu bar's total says it counts as Usage › Requests does
The menu bar's Tokens and cost picks said "Every agent's, as the Usage
page counts them", but the Usage page has two counts: the Overview sums
gateway calls only (its own line says so, #usageScope), while Requests,
the panel's Usage tab, the menu bar and Bark's daily line add the calls
the agents' session logs record (trayTotalSum is Requests' sum). So on
a day with session-log calls the Overview's total was lower than the
menu bar's claim of the same count. The pick's note now says what it
sums and which tab it matches: "Gateway and session-log calls, as Usage
› Requests counts them", in every language.

Run (mica, at this tree):
- tray-totals (Chromium and WebKit, every language) and i18n-keys:
  54 pass.
- go test ./internal/gui -run
  'TestCoreScriptBudget|TestI18n|TestCSS|TestTray': ok.

Broken by hand: the old note put back in app.js: tray-totals 15 of 25
red (Chromium), then put back.

Not tried: the real app window; the Overview's own sum is unchanged.
2026-11-18 12:48:43 +08:00
yetone e5c0c23de0 gui: Duplicate and Add another ask before they drop a provider's typed edits
In a provider's editor, Duplicate and "Add another {name}" open a new
draft in its place. Each dropped what was typed without a word, while
Cancel, Escape, the scrim and a row click ask "Discard unsaved changes?".
Both now ask the same way: Cancel keeps the edit as typed, Discard goes
on; an untouched editor asks nothing. Duplicate still copies the saved
provider, not the unsaved edit.

The scan also named Add provider, the add sheet's tiles and a plugin's
sign-in. The editor is a modal over them, so none can be reached while a
draft is open; they are left alone.

Paid for in the core budget, no raise: the five "providerDirty() &&
confirmDiscard()" checks are one leaveDraft(), and the eight "editing =
x; draft = null; renderProviders()" are one reEdit(x).

Run (mote, at this tree on origin/main e1e454398):
- provider-unsaved-paths (new), ux-safety, add-sheet, add-sheet-custom,
  group-duplicate, plugin-signin, account-cap, signin-again,
  zen-anon-key, Chromium and WebKit: 154 pass, 0 fail.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.
- duplicate-pause, key-import, provider-typed and vertex-editor: 12 of
  64 red, the same 12 on origin/main e1e454398 without this change, each
  filed: #6424, #6416, #4673, #4720.

Broken by hand: app.js put back to its base, provider-unsaved-paths 4 of
4 red (no question asked, the edit gone).

Not tried: the real app window.
2026-11-18 12:44:01 +08:00
yetone f17300d9c1 gui: Download source says what Update source picked
Settings › About's Download source said "from usemagpie.ai, and from
GitHub when that fails" whatever Update source said, right above it: with
usemagpie.ai only it still offered a GitHub mirror that is never used
(the site alone never asks GitHub), and with GitHub only it still named
usemagpie.ai as the source and the checksum's home. Its line, its
tooltip and its host now follow Update source: site says no mirror is
used, GitHub only says updates come from GitHub (or through the mirror)
and are checked against the release's signed checksums.

The row's drawing (renderUpdateMirror, setUpdateMirror, editMirror) moved
into updatesource.js, which About already imports for Update source, so
the core's script shrinks rather than grows; no budget raise.

Run (mica, at this tree):
- settings-update-source (Chromium and WebKit, every language, 1100 and
  420 wide), update-mirror, i18n-keys: 56 pass.
- the 18 GUI files that open Settings › About or search Settings
  (update-*, whats-new*, segs-glide, uninstall-settings,
  settings-search, settings-groups, gui-de): 409 pass, 6 red, all in
  settings-groups' "warm-ups and check-in" (an extra "Spend extra usage"
  row), red the same on origin/main 265217bf4 and filed as #6597.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand: Download source reading "" for the source:
settings-update-source 10 of 10 red (Chromium), then put back.

Not tried: the real app window.
2026-11-18 12:42:07 +08:00
yetone a10ac7bb02 gui: a Vertex AI provider with two keys or more keeps its project's fields
The editor drew Project ID, Location, Credentials file, Service account
and Base URL in an else after "two keys ticked or more: Routing's
spread", so a second ticked key took them away and they could no longer
be changed. They are the project's, not a key's: drawn either way now.

Run (mote, at this tree):
- vertex-two-keys.test.cjs (new), Chromium and WebKit, en zh zh-TW ja de,
  one key and two: 22 pass.
- vertex-editor.test.cjs: 52 pass, 2 red ("is added with its project,
  not a key", WebKit en and zh: the Add moved the editor's scroll to 0).
  Red the same on origin/main cf20df721, WebKit, 2 of 16.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok

Broken by hand: the else put back, vertex-two-keys 12 of 22 red (every
two-key case), then put back.

Not tried: the real app window; a real Vertex AI project with two keys.
2026-11-18 12:41:27 +08:00
yetone eca40383f7 routing: a group's routing and window read as a provider's do
The same setting had two names. The Routing page called the "usage"
routing "Least used", while the provider editor, Smart's own hint ("pick
In turn or Least used first"), Built-in plugins and the account reasons
call it "Least used first". A group's Advanced named the window agents
are told "Context", where a provider's Advanced, Agents and the context
card say "Context window". Both now use the provider editor's word
(translations already there in zh, zh-TW, ja and de). Stays, Rate
limited and Compact at already read the same on both pages and are left.

Run (mote, at this tree; load 27 on 18 cores, mica 26 on 12):
- group-context, routing-group-strategy, account-arrange, routing-save,
  routing-key-windows, i18n-keys, group-compact and settings-search,
  Chromium and WebKit: 118 pass, 2 red: account-arrange in both engines
  (53 !== 52), red the same on origin/main 265217bf4 run alone, #6010.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS|Budget': ok.

Broken by hand: group-context and routing-group-strategy on the old
client.js, 8 of 22 red (the old labels).

Not tried: the real app window.
2026-11-18 12:38:45 +08:00
yetone cf20df7211 library: the Pi market searches the npm registry in use
The Library's Pi market asked registry.npmjs.org for every search, even
when the user's setup names another registry (magpie's own setting, an
.npmrc or bunfig, NPM_CONFIG_REGISTRY) or the 「国内镜像」 switch puts
npmmirror in front: Plugins installs from that registry, and the Pi
market alone went around it. It now asks plugin.Registry() first and
npm's own search only when that registry can't search (a private
registry without /-/v1/search).

TestPiSearchAsksTheRegistryInUse: the registry in use answers and npm
isn't asked; it answers 404 and npm is. The old tests now fix the
registry to none, so none of them reaches a real registry.

Run (mica, at this tree):
- go vet ./internal/library: ok
- go test ./internal/library -run Pi -count=1: ok

Broken by hand: the registry never asked: TestPiSearchAsksTheRegistryInUse
red ("npm asked 1 times"), then put back.
Not tried: a real private registry or npmmirror's search.
2026-11-18 12:36:25 +08:00
yetone 265217bf4c gui: a model disabled in Settings → Models says so in its provider's editor
A model disabled for every request (#1867) still drew in its provider's
editor as an ordinary chip, ticked or served, so it read as one agents
get while the gateway refused it. /api/providers now gives each model
the pattern that turns it off (provider.DisabledPattern, the list read
once per provider), and its chip is dimmed with a "disabled" badge and a
title naming the pattern and where it is set. Every language.

Paid for in the core budget by moving six trailing comments onto lines
of their own (whole-line comments aren't counted), no raise.

Run (mote, at this tree):
- go test ./internal/gui -run 'TestProviderInfoSaysADisabledModel|TestCoreScriptBudget|TestI18n|TestCSS': ok
- go test ./internal/provider -run TestDisabled: ok
- disabled-model-chips.test.cjs, Chromium and WebKit, en zh zh-TW ja de: 12 pass

Broken by hand, each red, then put back:
- providers.go not setting Disabled: TestProviderInfoSaysADisabledModel red.
- the chip not reading m.disabled: disabled-model-chips 12 of 12 red.

Not tried: the real app window; the rest of the GUI suite.
2026-11-18 12:35:06 +08:00
yetone b0c2b5e261 gui: a page left out of the sidebar still opens from a link, ?view= or a search hit
Settings › General › Sidebar pages (magpie.navHidden) took a page out of
the sidebar, and offView then sent every way to it (a link, ?view=, a
Settings search hit, a plugin's show()) to Agents or Providers with
nothing said, so the page was unreachable. offView now redirects only a
page gateway mode or a switched-off built-in plugin leaves out. Hiding
stays a sidebar choice: the window's own kept page (magpie.lastView)
isn't reopened when it is hidden, so a fresh window still opens on the
first page, or Providers when Agents is hidden too (keptView in
start.js).

nav-pages-hidden: with Library hidden, show("library") and ?view=library
open Library; a kept lastView of library opens Providers.

Run (mica, at this tree; mote at load 27):
- nav-pages-hidden, nav-pages-order, last-page, gateway-mode, Chromium
  and WebKit: 19 pass, 1 red, last-page WebKit, red the same on
  origin/main and filed (#7033).
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS': ok.

Broken by hand, each red, then put back:
- the new test on origin/main's app.js and start.js: 2 of 2 red (line
  69, Library not opened), both engines.
- keptView without the navMine check: Chromium red at line 76 (the
  window reopened the hidden page).

Not tried: the real app window, the full GUI suite.
2026-11-18 12:31:23 +08:00
yetone 3c44ed92bb routing: a group's Save refuses a Slow to start, Context or Compact at that doesn't read
Typing "abc" into a group's Context, Slow to start minutes or Compact at
marked the box, but Save went on and sent the last good value (or the
one the editor opened with), so the user saw "Sol saved" for a number
they never typed. Save now stops on the first such box: Advanced opens,
the box takes focus, and the status line says what is wrong with it.
Compact at, which only set aria-invalid, now says it under the box too
("abc is not a length of tokens like 200k or 1m", the string Context
already has in every language); an empty box is none, not an error.

Run (mote, at this tree; mote's load was 27 on 18 cores, mica's 26 on
12, so neither had room and mote took it):
- group-compact, group-context and group-first-token, Chromium and
  WebKit, every language each covers: 34 of 34 pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS|Budget': ok.

Broken by hand: the three tests on the old client.js are 34 of 34 red
("a bad time is not saved", "a bad context is not saved", "a bad
length is said, not only marked").

Not tried: the real app window.
2026-11-18 12:29:31 +08:00
yetone e1e454398e agent, gateway: the web search path is Settings › Models › Web search
dsh's and DS Bot's "nothing to search with" notices, and the gateway's
"searcher picked in Settings" errors, sent people to Settings › Web
search. There is no such tab: Web search is a section of Settings ›
Models. The notices in every language, the gateway errors, the DS Bot
docs page (en, ja; zh says no path) and the subsystem docs now name the
real path. llms-full.txt, the search indexes and docs-index.sums are
rebuilt with `node docs-index.mjs`.

Run (mica, at this tree):
- go test ./internal/agent -run 'Dsh|Dsbot|Notice': ok
- go test ./internal/gateway -run Search: ok
- go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS|Search': ok
- site: node --test search.test.mjs: 6 pass
- GUI: i18n-keys.test.cjs: 4 pass

Not broken by hand: a text change, with no test that names the path.
Not tried: the real app window.
2026-11-18 12:28:47 +08:00
yetone 32a1818681 provider: an AI Studio key decides with Google's gemini-decision-1 (WangYeruo on X)
WangYeruo (v0.1.4401) has a Google AI Studio key's provider, the google
preset. magpie's System One asked for google/gemini-decision-1 fell to
OpenRouter's decision list, because the google provider had no decision
API, and the user's own attempt got Google's 400 "type parameter is
required at input[0]" for an object input.

Google's Decisions API (launched 11-11, aistudio.google.com/docs/
decisions-api, api-reference/decisions/create-decision) serves
gemini-decision-1 at POST generativelanguage.googleapis.com/v1beta/
decisions on any AI Studio key, free tier included, with the key as
x-goog-api-key. It takes System One's questions (noul, choice, score),
an input of text or content blocks, and answers by name with usage
total_input_tokens / total_output_tokens.

- normalize gives a provider asked at the Gemini Developer API (the
  google preset's OpenAI-compatible base or a native Gemini base) its
  System One at AIStudioGemini (googleDecisions). Not Vertex, not a
  signed-in account, not another magpie, and a URL the user gave is kept.
- ViaGoogle: /decisions, signed as Gemini (x-goog-api-key, never Bearer;
  DecideProtocol), in AskSystemOne, the list and key checks, and the
  gateway's postDecideSent.
- googleAsk: the state goes as input (a string as it is, an object as
  its JSON text, never an object, which Google reads as a block), images
  as image blocks after it, a choice's null description as "".
- DecideResult: the usage comes back as System One's input_tokens /
  output_tokens; prompt_feedback.block_reason with no answers is a 400
  that says why. Every other way of asking is unchanged (tested).
- gemini-decision-1: 262,144 context, takes images, so the gateway lets
  images through to it as it does for the Clef.
- docs/subsystems/providers-accounts.md says so.

Tests, from Google's documented request and answer bytes, no network:
TestGoogleDecideWire, TestGoogleKeyDecides (with OpenRouter's live list
holding google/gemini-decision-1 seeded: it now routes to google),
TestGoogleSystemOne, TestGoogleDecisionsTakesImages.

Broken by hand, each red: the normalize fill dropped (KeyDecides,
SystemOne, TakesImages red); googleAsk skipped (Wire, KeyDecides,
SystemOne, TakesImages red); signed as Chat/Bearer (KeyDecides,
SystemOne, TakesImages red).

Run at this head:
- gofmt -l internal/: clean. go vet (provider, gateway), GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./... on mote: ok.
- Full suite on mote at 6317fd789 (this change on 7707ba9ad+f4b202030):
  go test -count=1 -timeout 45m ./...: 103 packages ok, exit 0, no FAIL.
- Rebased onto bf1b2893d (GUI and docs only since: app.js, two GUI
  tests, skill-router.md; nothing this change reads), then at this head
  on mote: go test -run 'Google|Decide|Decision|SystemOne|Ark'
  ./internal/provider ./internal/gateway: ok. The whole internal/provider
  package was also ok at 6317fd789 (155s).
- No GUI file changed, so no GUI suite.

Not tried: a real call. No AI Studio key is in magpie's accounts here.
2026-11-18 12:08:46 +08:00
yetone bf1b2893d4 usage: a "group · span" ring reads in two lines, no empty Every model (tongzhenbao on X)
agy-cli up to 0.1.91 named its windows "Gemini · 7 days", "Gemini · 5
hours", "Claude & GPT · 7 days" with no pool field. The ring label was
one line, so all three were cut to "Gemini …" / "Claude …" and two
groups' rings read the same. agy-cli 0.1.92 (plugins 207880e1, on dist)
sends the antigravity shape again: each group as a pool with its 5h and
7d windows, and each model family in it, so the Usage page's
"Every model (n)" lists the models as it did before.

- ringParts splits any "X · span" name (and a pool's window, as before)
  into the group's first word over its short span, so old plugin
  versions, MiniMax's "Video · 1 days" and agnes' "Text · 5 hours"
  read Gemini/7d, Gemini/5h, Claude/7d. Every other name stays one line.
- familyQuota shows pools alone when no window names a model, instead
  of an "Every model (0)" button that showed nothing.
- No budget raised: the change is 16 code bytes under appScriptBudget.

Run (mote/mica):
- internal/gui/tests/quota-ring-names.test.cjs (new; chromium + webkit,
  en + zh): ring labels per line, fit in their ring, reset line, tooltip,
  "Every model (3)" / 「全部模型(3)」 listing three models, one toggle.
  With quota-pools.test.cjs: 8 of 8.
- The 65 GUI files that reach the panel's quota card, plus the files a
  first full run had red: 709 of 813 pass. All 18 files with reds were run
  again at origin/main 889991b15: 17 fail the same way there (102 reds;
  agent-details-ready, api-key-theme, bark, codex-memories-settings,
  tray-cell-click and others), and panel-arrange, which failed once
  here, passed 3 of 3 alone.
- go test ./internal/gui/ ok (TestCoreScriptBudget included).
- A plugin fetchUsage against the real local agy 1.5.10 gave "Gemini 3.8
  Flash" (pool Gemini) and "GPT-OSS 120B" (pool Claude & GPT) model
  windows beside the pools' "7 days".

Broken by hand: quota-ring-names is red on the old app.js (labels on
one line), and red without the familyQuota hunk (an "Every model (0)"
toggle). A first compaction of ringParts returned false for a plain
name, and `?.join` threw on every card; the subset run caught it
(TypeError in panel-quota-kept and others) before this commit.

Not tried: the full GUI suite on this exact head (mote dropped the ssh
link after 11984 tests of an earlier version); a real magpie app with
the user's six accounts.
2026-11-18 12:01:48 +08:00
yetone 2c748531a6 docs: skill router, Alma keeps its own magpie-skills first (#5722)
Tried with a real Alma 0.4.738 (/Applications/Alma.app copied to mote,
started with a sandbox HOME, its userData under that HOME, port 23001
free there). magpie at origin/main f4b202030 set up the sandbox through
library.CreateSkill / SetSkillRouter / SkillRouterHow (a throwaway
driver, not committed): only-alma ticked for Alma, only-claude for
Claude Code, both-agents for both, router on. Alma's /api/skills:

- Router on for both: one magpie-skills, source personal, listing
  both-agents and only-alma. Claude Code's entry is dropped, so neither
  failure the issue guessed at happens.
- Alma's skills kept direct (no entry in its folder): both-agents and
  only-alma as their own skills, plus Claude Code's magpie-skills
  (source claude-code) listing only-claude. That is what Alma got before
  the router too, through Claude Code's links; Alma reads that folder
  by design (#824) and can turn it off.

This matches loadSkills in Alma's skillsManager.ts (personal >
claude-code > codex > agents). No code change. Not tried: a chat turn
(no model account on mote), Codex's folder, Windows and Linux Alma.
2026-11-18 11:41:58 +08:00
yetone 0beb5dea85 gui tests: signin-proxy opens the proxy menu once the sheet's scroll has landed
"a subscription with no proxy offers the global one" was red at 380px in
Chromium: 5 of 5 in a full GUI run on mica at ba3a25421, and 4 of 40 in
the file alone. The sheet had just scrolled to hold the pressed Add
button (top 66), and Playwright's click scrolls its target into view
first. The browser delivers that scroll event on the next frame, after
the click has opened the menu, so the menu's scroll guard took it for
the reader's and closed: "element was detached from the DOM".

Traced on mica with a per-frame log: scrollTop 66 at t=400, the menu
opened, scroll to 0 and close at t=481, no script write in between. At
c687dbdc6 (before the proxy Test) the same trace failed the same way,
so the race was there before; the editor's extra import moved its timing
so it lost every time.

openVia scrolls the button into view and waits two frames for that
scroll event before the click, for each of the file's three menu opens.

Run on mica: signin-proxy.test.cjs 40/40 twice (both engines, 5
languages, 3 widths). Without the helper at the same head: 4 to 5 of 40
red. The 1s pause it replaces was only used to confirm the cause, and is
not in the test.
2026-11-18 11:38:04 +08:00
yetoneandSuge8 f4b2020306 claude: a client's tool call is waited for however long it takes, never moved to the background at 120s (#6034, FunnyPartMent on X)
#6034 (Suge8) and FunnyPartMent on X: interactive Claude Code moves an
MCP call still running after 120s to the background (2.1.316's
getMcpAutoBackgroundMs: 120000 by default, behind
tengu_mcp_auto_background) and tells the model "It was moved to the
background as task ... You can keep working in the meantime". Every
client tool magpie hands the bridge is such a call.
- Pi's long tool runs: the model wrote its next step without the result,
  and the turn's reply was a tool_calls finish with no calls; the run
  went on calling tools no one was shown.
- Pi's ask_user_question waiting on its user: the model wrote a bash
  call past it that no client runs. The answer reached the run at once
  but the model only when that bash call was moved to the background
  too, its own 120s later (~113s after the answer).

Change (Suge8's branch fix/claude-mcp-wait, ported): claudeRunEnv sets
CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0 and CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT=0
(claudeToolWaitVars) unless magpie's environment sets them, for -p and
the interactive mode alike, and claudeEnvVars hands both to a run in WSL.
0 also turns off the move made to hand over a message that arrived
mid-call (isMcpCallMovableWithoutTimer reads the same value), and the
idle limit no longer aborts an answer that took over 30 minutes. One-off
runs (model test, warm-up, /usage) make no MCP calls and are unchanged.
The subsystem page says why, with the measurements.

Reproduced (Claude Code 2.1.316, sandbox HOME and CLAUDE_CONFIG_DIR, a
fake Anthropic API on 127.0.0.1 and a stdio MCP server whose "wait"
answers after 10s and "bash" after 100s; no real account):
- interactive mode, limit 3000: wait moved at 3s, the model called
  bash, bash moved at 3s, the result came only as a task notification.
- -p with CLAUDE_AUTO_BACKGROUND_TASKS=1, limit 8000: wait moved at
  8.0s, bash called, next model request at 16.0s, 6s after the result
  was in (the 113s, scaled).
- limit 0, both modes: the model's next request at 10.0s carried
  "late-result", no bash call made.

Run (on mica, Go 1.26.8, at this change on 53db3e389; the four tests
above again at this head, rebased on 7707ba9ad: ok):
- red on the old code: with claudeRunEnv's append taken out,
  TestClaudeRunWaitsOnToolCalls fails all four subtests (tui=false and
  tui=true, "run's environment, want \"background 0 idle 0\"");
  with the two names out of claudeEnvVars TestClaudeToolWaitVarsReachWSL
  fails ("CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS isn't in claudeEnvVars").
  Both pass with the change, beside TestClaudeRunReadsItsFlags and
  TestCleanClaudeEnvRemovesGatewayOverrides.
- gofmt -l empty; go vet, GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gateway; go build, GOOS=linux go build -tags nogui,
  GOOS=windows go build: ok.
- go vet ./... (3 OSes) and go test -tags nogui -timeout 45m ./... in a
  sandbox HOME: running on mica at push time; result goes on #6034.

Not tried: a real Claude subscription turn from Pi through a rebuilt
magpie with a tool of over 120s; the real 120s default (measured with
3s and 8s limits).

Co-authored-by: Suge8 <nnyless@foxmail.com>
2026-11-18 11:32:58 +08:00
yetone 7707ba9adb sessions: a compaction that doesn't fit its line goes as text, never as magpie's seal (hey_boyce on X)
hey_boyce on X: Codex, talking to OpenAI itself, got 400
invalid_encrypted_content "The encrypted content for item
cmp_magpie_1794916786407450000 could not be verified".

Cause: PortCodexRollouts writes magpie's compaction item (magpie1:
base64 summary) as Codex's own summary message, keeping each line's
length, since a paginated rollout keeps places by byte. A message
longer than the line (a short summary under Codex's ~400-char prefix)
was left as it was, so the magpie1: seal stayed in the rollout, Codex
replayed it to OpenAI every turn, and the thread was stuck. The
incremental pass never looked at such a rollout again.

Change:
- fitShorter: when the full message doesn't fit, the summary goes
  under a short heading, then cut to fit (rune-safe, "…"), then
  with no heading. If nothing fits, a standalone item is retired as
  {"type":"magpie_compaction"}, which Codex reads as unknown and
  never sends.
- In replacement_history an unknown item IS sent (as "other"), and
  OpenAI refuses it ("Invalid value: 'other'"; seen with real
  codex-cli 0.165.0 and 0.169.1). So a compaction or reasoning item
  retired there is left out with its metadata entry, and
  magpie_reasoning items main's PortCodexRolloutsLeft already wrote
  there are taken out (retiredInList). That was a sibling bug: those
  threads failed the same way.
- codex-portable.json gains refit: a state from before makes one
  whole pass again, so rollouts already left with the seal are fixed.
- The gateway's last line: a 400 naming an item of magpie's own
  compaction asks again with its summary message in its place
  (withoutItem), not with the summary dropped.
- codexsummary.Summary decodes the seal; Message uses it.
- docs/subsystems/gateway-routing.md says all of this.

Run (on mica, at this head rebased on a265632da):
- red on the old code, green now: TestPortCodexRolloutsLongerLine
  (short, cut), TestPortCodexRolloutsDropsRetiredFromHistory,
  TestPortCodexRolloutsRefitsOnce,
  TestPortCodexRolloutsLeftRetiresUnsealedReasoning,
  TestRefusedMagpieCompactionGoesAsText (old withoutItem: 2 items,
  the summary gone).
- broken by hand: without `&& was.Refit` RefitsOnce is red.
- real Codex, sandbox HOME with a copy of the owner's ChatGPT auth,
  codex-cli 0.169.1, gpt-6-sol, against OpenAI:
  - the reporter's item (id cmp_magpie_1794916786407450000, summary
    "ok") gave the same 400 word for word. Ported by this code, resume
    answered.
  - an id-less item plus a magpie_reasoning in replacement_history
    (as main left it) failed "Invalid value: 'other'" before. Ported,
    resume answered.
- go test -count=1 -timeout 45m ./internal/codexsummary
  ./internal/sessions ./internal/gateway ./internal/agent: all ok
  (gateway 1026s, agent 221s), log kept in enc-scratch/pkgs.log;
  TestLoopGuard* again after the doc edit: ok.
- rebased on 53db3e389 (stream keepalive; only the doc page is
  shared): the refusal, seal, compaction, LoopGuard and Quiet tests
  in internal/gateway again at this head: ok.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build ./... ok.

Not tried: a summary cut to fit with real Codex (the unit test checks
it is a plain user message, the same shape as the case that was run);
a Codex in WSL; the full ./... suite: mote was over its cores and both mote and
mica were running another session's GUI suite, so only the changed
packages and internal/agent, which ports rollouts, ran (above).
2026-11-18 11:16:54 +08:00
yetone 53db3e3891 gateway: a held or relayed stream is kept alive for 30 minutes, then ended with an error (Wing8Aqua on X)
Wing8Aqua on X (magpie 0.1.4111, Ubuntu): asking Claude Fable 5.2 ended
with "pi-ai stream idle timeout after 300000ms". A stream the gateway
passes through as it is (or holds before its headers) got a comment each
keepaliveEvery of vendor silence, but only for keepaliveLongest (5
minutes) since the vendor was last heard. After that the client got no
bytes and no error, so an agent's own idle timer ended it. A translated
stream is already kept alive for translatedQuietLongest (30 minutes), and
the Claude bridge for as long as its Claude Code works (#5043).

holdWriter.keepQuiet now keeps up its comments for translatedQuietLongest.
Past that the vendor is taken as stuck (endStuck): the client gets a 504
"<provider> sent nothing for <d>; the request was ended", as its stream's
error event once the reply has passed or as a status before it, and
serve records the try and tries nothing again after so long a wait.

Note that the reporter's message is DeepSeek Harness's (dsh-llm-pi-ai). Its
watchdog re-arms only on content events, so no keepalive reaches it, and
the 300000 is the route's streamIdleTimeoutMs. magpie writes 600000 into
the dsh routes it makes (dshIdleWait, since v0.1.2464) and keeps a value
already there. This change covers byte-counting clients (pi, Claude Code,
Codex). It does not change dsh.

Tests: TestQuietClaudeStreamKeptAlivePastFiveMinutes (Messages relay,
quiet after message_start and before its headers, keepaliveLongest at
100ms, 1.5s of silence: the client never goes 500ms without a byte, the
reply is whole, and the vendor is asked once) and
TestQuietClaudeStreamStuckEndsWithAnError (silence past
translatedQuietLongest: an error event naming the provider, no reply after
it, one request). TestQuietKeptAliveOnlySoLong now expects the error.

Run at this tree (rebased on a265632da):
- gofmt -l internal/gateway: clean.
- mote-run go vet ./internal/gateway, plus GOOS=linux and GOOS=windows: ok.
- mote-run go test ./internal/gateway -run
  'TestQuiet|TestSilentHeld|TestTranslatedStream|TestKeep|Loop|Slow|Hold': ok.
- wsl-run (Ubuntu 24.04) go test ./internal/gateway -run
  'TestQuiet|TestSilentHeld|TestTranslatedStream|TestKeep|Hold': ok.
- Broken by hand: restoring keepQuiet's keepaliveLongest bound turns
  both new tests (all four subtests) and TestQuietKeptAliveOnlySoLong red.
- Real pi 1.5.2 on mote in a sandbox HOME (httpIdleTimeoutMs 2000),
  through a test gateway to a fake Claude relay quiet for 6s after
  message_start, with keepaliveLongest at 300ms. Old bound: "terminated:
  Body Timeout Error (UND_ERR_BODY_TIMEOUT)". New: "answered". With
  translatedQuietLongest at 1s and the relay quiet 20s, pi prints "Relay
  sent nothing for 1s; the request was ended (504 ...)". This was a
  temporary test, not committed.

Not run before the push: the whole internal/gateway package and the full
suite. mote was at load 20-28 and mica had another session's full suite.
They run next, and any red gets its own issue.
Not tried: real dsh, and a real Fable 5.2 account (the route the reporter
uses is unknown).
2026-11-18 11:08:46 +08:00
yetone a265632dae routing: a model in a group at one reasoning can be added again at another (visamzh on X)
visamzh on X: in a Routing group, the same model can no longer be added a
second time at another reasoning effort (gpt-6.2-sol at xhigh and at high).
It used to work.

Cause: 74c67785c (#907, 10-05) ticked a model in the Add a model picker
when any member had its base, so sol showed ticked for sol:xhigh. A click
on sol then took sol:xhigh out instead of adding sol, so a second effort
could never be added from the GUI. Saving (SaveGroup's cleanList dedups
exact ids only), reading, the gateway's members() (each effort its own
member, internal/gateway/groupeffort_test.go) and the TUI picker were never
affected, so groups that already hold sol:xhigh and sol:high load and route
as they are.

Now a member held at a fixed reasoning or on one account is a row of its
own in the picker, ticked, its level/account in its note, and a click on
it takes that member out, as #907 asked. The model's own row under it is
unticked and adds the model again, to be set to another level in its row.

Tests:
- group-member-again.test.cjs (new): sol:xhigh in the group gives two sol
  rows (held one ticked, says "xhigh reasoning"), the plain one adds a
  third member, set to high it saves [sol:xhigh, terra:high, sol:high];
  a group already holding sol:xhigh and sol:high shows both and saves
  both. en/zh x chromium/webkit.
- group-pick-filter.test.cjs (#907) updated: the held row stays ticked and
  takes its member out; the plain row is not ticked; save keeps two:max.

Run (mote, mote-run, node --test):
- group-member-again + group-pick-filter at this head: 8/8 pass. At
  origin/main e1c186cfe with the new test: group-member-again 0/4
  ("sol at xhigh and sol itself are not two rows 1 !== 2").
- Every GUI file reaching ?view=groups or plugins/routing (104 files,
  concurrency 4): 1401/1473 pass. The 72 reds were in 10 files. The 9 files
  rerun at this head and at origin/main e1c186cfe (concurrency 2): the
  same 71 reds at both. routing-groups-page's one 420px red (quotas
  redrawn) passed in the rerun. Filed: #7016 (routing-provider-off,
  routing-rows-fit, win-fonts); the rest are in #6934
  (group-editor-selected, menu-input-scroll, mobile-web,
  name-suffix-where-named, zero-priced-free).
- Rebased onto 69233d6bc (Docker image only) after the runs.

Not tried: a click-through in the real app. No Go changed, so the Go
groupeffort tests were not run again. No new strings, so zh-TW/ja/de are
unaffected.
2026-11-18 10:42:59 +08:00
yetone 69233d6bcf docker: the image has npx, node, npm, uvx and python for the Library's MCP servers
Passings_z on X: in magpie's Docker image, adding Chrome DevTools' MCP
server from the Library said "npx not found". The runtime stage is
debian:12-slim with ca-certificates and curl only, and the Library's
servers run in the container (gateway mode keeps Library's MCP servers
and the router), so every featured entry but the remote ones failed the
same way: npx for chrome-devtools, playwright, filesystem, memory,
sequential-thinking, brave, firecrawl, tavily and everme, uvx for fetch,
git and time, and the registry's npx/uvx entries.

The image now copies in Node 24.22.3 (node, npm, npx, from the official
bookworm image, matching Debian 12's glibc) and uv 0.13.7 (uv, uvx, from
astral's image). python and python3 are a two-line shim onto uv's own
Python, which uv downloads into the volume on first use (UV_PYTHON=3.14).
UV_PYTHON_PREFERENCE=only-managed keeps uv from taking the shim as an
interpreter: without it uvx recursed and hung looking for one.

Size (docker image inspect / du -sxm / as root):
  origin/main  74,636,782 B compressed, 190 MB on disk
  this         142,667,379 B compressed, 370 MB on disk  (+68 MB, +180 MB)
node is 127 MB of it, npm 19 MB, uv and uvx 43 MB. Bun in place of npx
was weighed and left: agents in the container read PATH themselves, and
Bun's Node compatibility isn't every server's.

The image still has no browser (Chrome would be ~300 MB more for every
user). Chrome DevTools' and Playwright's servers start, list their tools,
and every tool then fails: "Could not find Google Chrome executable for
channel 'stable' at: /opt/google/chrome/chrome" (seen in the image). The
check now reports such a server, run by npx/bunx/pnpx in a container with
no /opt/google/chrome/chrome and no option pointing it at a browser
(--browserUrl/-u, --wsEndpoint, --executablePath, --channel,
--autoConnect; --cdp-endpoint, --executable-path, --browser,
--extension), as Why "nobrowser" with its tools still counted. The row
says "no Chrome here", and its tooltip points at Magpie Browser or the
server's option for a Chrome it can reach; the hub's text says the same.
Desktops, macOS and an image with Chrome are unchanged. A docker-launched
(OCI) entry still says docker not found: there is no Docker in the
container. Docs (en, zh, ja docker.html) get an "MCP servers" section;
the Docker workflow's smoke test runs node/npm/npx/uvx/uv -v and finds
python3 and python.

Run:
- Docker on xiaomi-gpu, origin/main's Dockerfile vs this one, web mode
  with a fresh volume, servers added with `magpie library mcp add` and
  checked through POST /api/library/mcp/check:
  - origin/main: chrome-devtools, memory: notfound "npx"; fetch:
    notfound "uvx" (the report).
  - this: memory ok, 9 tools; fetch (uvx mcp-server-fetch) ok, 1 tool,
    Python downloaded on first run; chrome-devtools error nobrowser
    --browserUrl, 33 tools.
  - tools/call over stdio inside the container with a small node MCP
    client: memory create_entities returned the entity; fetch fetched
    https://example.com; chrome-devtools new_page returned the Chrome
    error above.
- go test -run 'TestNoBrowser|TestCheckSaysNoBrowser|TestCheckStdio'
  ./internal/library on mote: ok. Broken by hand (the hook in
  checkServer turned off): TestCheckSaysNoBrowser red, "got {State:ok
  Tools:3 …}".
- GUI on mote, Chromium and WebKit, en zh zh-TW ja de, 1100 and 390:
  mcp-no-browser (new), mcp-home-health, library-mcp-health, i18n-keys,
  i18n-en-no-cjk: 58 of 58 pass.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... and go build ok on mote.
- go test -timeout 45m ./... on mote at this head (on e1c186cfe): 103
  packages ok, none failed (internal/gateway 1039s, internal/library
  408s).

Not tried: an arm64 build of the image (both base images are
multi-arch; CI builds it). The test box's network to npm dropped
mid-run: npx -y then timed out the 30s check step, and one npx install
cut short left ~/.npm/_npx with a missing module until it was removed;
that is npm's cache, the same on a desktop.
2026-11-18 10:02:53 +08:00
yetone e1c186cfee provider: Codex's models are asked for as npm's latest Codex, never older than 0.169.1, so GPT-6.2 shows
zzstar101 and m0eaki on X: after a refresh the GPT-6.2 models never
appeared ("magpie内置的codex cli版本过低"). The ChatGPT backend lists a
model only to a client at or past its minimal_client_version, and
GPT-6.2 Sol and Astra have 0.166.0. magpie asks /models, and signs
requests, as the newest of a fixed floor (0.159.0), models_cache.json's
client_version, the installed codex CLI and a Codex seen through the
gateway. With no Codex CLI here, or one older than 0.166 (this Mac has
0.165.0), every source was older than 0.166, so the list left 6.2 out
and a request for it was refused.

- codexClientVersion goes to 0.169.1, npm's latest @openai/codex today.
- codexPublished reads npm's latest @openai/codex (source.Do, so the
  mirrors answer when npm doesn't) in the background at most every 6h,
  and codexVersion counts it, so the floor no longer goes stale as
  Codex releases. Only an x.y.z release counts, never an alpha; a
  failed read keeps the last one or the floor. A test binary never asks
  npm unless a test points codexNpmLatest at a fake.
- codexListBehind already re-fetches a list asked at an older version,
  so a saved list from 0.159.0 is fetched again.

The reporter's follow-up, "请求头版本太低了": the request headers
carry it too. codexSign, which every ChatGPT account's request goes
through after the client's own headers are copied (gateway.go's
codexHeader copy, then Provider.Sign; codex_backend.go's passthrough),
sets the version header and User-Agent (originator codex_cli_rs or
Codex Desktop) to the newer of codexVersion and the client's own, so an
old Codex's request goes on as 0.169.1. Every caller of codexVersion
takes it: the /models fetch
(codex_models.go, CodexLiveList), codex_entries.go's client_version,
codexSign's version header and User-Agent, account.go,
codex_device_signin.go, signin.go and test_as.go. magpie bundles no
Codex CLI of its own (Docker image included); the "built-in" version
is this floor.

Real account (the owner's ChatGPT sign-in, auth.json copied to a
sandbox HOME, token not near expiry, so no refresh; compared byte for
byte after):
- GET /models at 0.159.0 and 0.165.0: no gpt-6.2-*; at 0.166.0 to
  0.171.0: gpt-6.2-sol and gpt-6.2-astra, each with
  minimal_client_version 0.166.0.
- POST /responses gpt-6.2-sol: 0.159.0 answers 400 "The 'gpt-6.2-sol'
  model is not supported when using Codex with a ChatGPT account."
  (the reported refusal); 0.169.1 answers 200, response.completed.
- A throwaway binary of this tree calling CodexLiveList under that
  HOME with no codex on PATH: old code lists no 6.2; this change lists
  both. Built with the floor at 0.150.0, it started at 0.150.0 (no
  GPT-6.x) and after the background npm read asked as 0.169.1 and
  listed 6.2: the real registry read works.

Tests (mica-run, at this tree before rebase onto 889991b15, which
touches only LESSONS.md): go test -timeout 45m ./internal/provider
./internal/agent ./internal/usage ./internal/codexcat ./internal/catalog
ok; ./internal/gateway had one red, TestCodexPoolSaysTheClientsVersion,
which used 0.161.0 as "newer than magpie's fallback"; it now uses
0.199.0, and -run 'TestCodexPool|TestCodexVersion' over gateway and
provider is ok. The gateway log also shows doneHold's "close of closed
channel" panic in a fake's handler (no test red), already #6505/#6690.
GOOS=linux and GOOS=windows go vet ./internal/provider ok; gofmt clean.
TestCodexVersionPublished is new (floor, npm read, an old Codex's
version header and User-Agent signed as the floor); TestCodexVersion
and TestCodexVersionSeen take versions past the new floor.
Not run: go test ./... over every package and the GUI suite (both
machines were over their load with other sessions' GUI suites; no GUI
or other package's code changed).

Broken by hand: floor back at 0.159.0 -> TestCodexVersionPublished
red ("older than GPT-6.2's minimal_client_version"); codexVersion not
counting codexPublished -> red ("npm's answer was never read");
codexSign taking the client's own version header over codexVersion ->
red ("an old Codex's request went as version \"0.159.0\"").

Not tried: Windows and Linux runs; the Codex app (desktop originator)
asking at the new version.
2026-11-18 09:14:17 +08:00
yetone 889991b15f lessons: a record is written once its run has ended, seen a third day (11-18)
97e0ecdaa recorded the whole GUI suite as "still running at push: 3736
tests in, 127 red" and left "the rest" of the reds to another session's
rerun. The lesson (10-17 5b12407e8, 10-28 ca9b5048e) is now seen on
three days, so it moves into docs/code-standards.md's Tests table and
LESSONS.md's "Moved to the code standards" list.

Docs only; nothing run.
2026-11-18 06:46:41 +08:00
yetone ba3a25421b gui: /api/state sends no saved proxy password, LAN key, Bark key or GitHub token
/api/settings strips these (settingsState), but /api/state, which the
window polls after nearly every click, sent settings.Shared() whole, so
every saved proxy's password and key, the old LAN key, the Bark key and
the GitHub token went with it. /api/state?last=1 (the start's read of
the last state) put settings.Load() in whole too. Both now go through
stateSettings. The page reads none of these from the state (grep of
assets: no .lanKey, .barkKey or .githubToken, and saved proxies come
from /api/settings). The kept state file never held settings
(keptFile empties them), so nothing on disk needs rewriting.

Found while writing the saved-proxy Test: a probe of /api/state carried
a saved proxy's password.

TestLastKnownState used the GitHub token as its mark of today's
settings; the theme is that mark now, and the test asks that the token
is not sent.

Run (at this head's tree):
- mote: go test ./internal/gui -count=1 -timeout 45m: ok (182.9s).
- mote: TestStateSendsNoCredentials and TestLastKnownState -race ok.
- Broken by hand: stateSettings' strip commented out, TestStateSends
  NoCredentials red on all four secrets in /api/state and ?last=1.
- mote: Linux and Windows go vet ./... ok; gofmt -l clean.
2026-11-18 06:42:01 +08:00
yetone 97e0ecdaab settings: a saved proxy's Test says its latency and exit region, from Settings and the provider editor (IcyLiqu1d on X)
IcyLiqu1d asked for sub2api-style proxy management: test each saved
proxy's region and latency, then pick a provider's proxy from the list.

- A saved proxy's row in Settings, once tested, reads "Reachable, 42 ms ·
  Japan": the exit's country from Cloudflare's trace page (the endpoint
  the quick check already uses), named in the reader's language by
  Intl.DisplayNames; the exit IP is in the tooltip. A failure says why.
- The latency is the round trip through the proxy, from the request
  written to the answer's first byte (httptrace). The whole request's
  time counted a new connection's dial, tunnel and TLS on a first Test
  and not on a second, which reuses the pooled connection.
- The provider editor's Saved mode has a Test beside the proxy picked;
  its answer is said where the picker's hint is, red on failure, until
  another proxy or mode is chosen.
- An editor opened before Settings was read drew its picker with no
  saved proxies (Saved mode missing, or "A proxy that is gone" for one
  chosen). It now reads the settings and draws the picker again.
- Nothing is tested until Test is clicked; nothing runs in the background.

Run (at this head's tree, rebased on c687dbdc6):
- mote: go test ./internal/gui -count=1 -timeout 45m: ok (182.9s);
  -run 'TestSavedProxy|TestProxyCheck' -race ok.
- mote: GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...
  ok; gofmt -l clean; TestCoreScriptBudget room 21 bytes, no raise.
- mica: provider-proxy-pick-test (new, 20 cases: chromium and webkit, en
  zh zh-TW ja de, 900 and 420px) 20/20; saved-proxies, saved-ssh-proxy,
  provider-proxy, i18n-keys, old-webkit pass.
- mica: whole GUI suite, still running at push: 3736 tests in, 127 red,
  none in a proxy or provider file. The reds are files red on
  origin/main: agent-details-ready and data-folder were run alone at
  c687dbdc6, 14 pass 42 fail (#6369, #6373, #6876); account-refresh-holds,
  account-arrange (#6003, #5814), api-key-theme (#6444) and the rest are
  the files another session is rerunning on mote as main's reds.
- Broken by hand: the round-trip branch off, TestSavedProxyLatencyIs
  TheRoundTrip went red ("took 1601 ms", the fake's 1.5s dial counted).

Tests reach no network: a local fake proxy answers the trace page, the
trace URL is .invalid, and the dial delay is injected.

Not tried: a real proxy's exit (the region comes from Cloudflare's loc=).
Not changed: the global proxy check in Settings still shows the raw
country code (ip (JP)).
2026-11-18 06:42:01 +08:00
yetone c687dbdc64 gui tests: Settings' hint cards are hovered after a reader's wheel, not a scroll by code (#6353)
settings-hints and settings-lines-wrap brought a Settings row into sight
with scrollIntoView, then hovered its name. The app puts back any scroll
the reader didn't ask for (gui-shell.md, "A click never moves"), so the
view stayed at the top. In Japanese and German at 420/440px the image
recognition MCP row starts below the 800px window (its name at y=809,
#view-settings scrollTop 0 after the scroll and after Playwright's own),
and the pointer landed on Image generation's row above: its card showed,
"the card doesn't say the row's line", or no card at all (#6073, #6156).
Both now wheel the view through reader.cjs's reach, as the other GUI
tests do. The app is unchanged.

Run on mica at this tree (origin/main 73a70275c + this change), both
engines: settings-hints and settings-lines-wrap 42/42. At origin/main
the same two files were red: settings-hints ja and de at 420px in both
engines, settings-lines-wrap "chromium de 440px" (8s wait for
.set-hint.on).
Found by logging the name's box, elementFromPoint at its centre, and
each scrolling ancestor's scrollTop around the hover.
Not run: the whole GUI suite; Windows WebKit, where #6073 was seen.
2026-11-18 05:47:40 +08:00
yetone 73a70275ce gateway: a relay check asks harder fixed-answer questions too (skingstyle48487 on X)
skingstyle48487 found the check's first questions too easy to tell
relays apart: a cut-down model gets three products and a tool call right
as often as the real one. The check now also asks five short questions
such a model tends to miss, each with one answer a program can check:
- two sums in a few steps: (37 × 43 + 1289) × 7 − 2468 and
  17 × 17 × 17 − 29 × 31;
- how many r's are in "strawberry raspberry", as a number;
- the first five primes past 50, as "53,59,61,67,71";
- five words sorted, in lower case and joined by hyphens.
Numbers are read past separators as before. The two exact-form answers
are compared as written: only quotes, a code mark or a full stop around
them are read past, so case and spacing count. That makes 11 calls, still
three at a time. No prompt names a product, a vendor or a limit, and
TestRelayPromptsNameNoOne holds that. The dialog names each new item in
the five languages ("Work out (37 × 43 + 1289) × 7 − 2468", "Sort five
words"), and its intro names the new kinds.

Run (mote):
- go test -run 'CheckRelay|RelayPrompts|ReadChatStream' -v
  ./internal/gateway: 7 pass;
- usage-model-speed.test.cjs, chromium and webkit, five languages:
  12/12;
- i18n-keys: 4/4.
Broken by hand:
- the exact answers read as numbers turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelayCountsEachAnswer red;
- the exact answers compared without case turns
  TestCheckRelayHarderAnswersApart red ("Apple-banana-…" read as right).
Not tried: a real relay or a real cut-down model; how often each item
splits real relays is not measured.
2026-11-18 05:27:43 +08:00
yetone 495ada49a7 usage: the speed card's Check… shows without hover (skingstyle48487 on X)
skingstyle48487 couldn't find Check… on the Model speed › Providers rows:
with a mouse it showed only while the row was pointed at. It now always
shows, in the muted colour, and takes the control colour when its row is
pointed at or it has focus. No new label.

Run (mote): usage-model-speed.test.cjs, chromium and webkit, five
languages: 12/12.
Broken by hand: the test with the old app.css is red in both engines
("Check… shows without hover").
2026-11-18 05:27:43 +08:00
yetone 59546ae1b7 lessons: a byte budget is never paid for with behaviour the change isn't about
286e3b6d5 fit the core budget by dropping aria-expanded from seven menu
buttons on other pages, unnamed in its body; side-effort was red for a
week until the fix before this commit.
2026-11-18 05:12:11 +08:00
yetone 3f7c782552 gui: a menu button says it is shut again, as seven lost it on 11-10 (#6353)
286e3b6d5 (the panel's Usage tab account menu) fit the core budget by
taking aria-expanded="false" off seven menu buttons on other pages: the
agent row's account switch, the sign-in proxy link, a window's cap, the
Image recognition and searcher Thinking chips, Model name in replies,
and the local model's model and threshold pickers. openProtoMenu and
closeProtoMenu change aria-expanded only where it is set, so those
buttons told a screen reader neither shut nor open, and side-effort was
red in all 10 cases since (#6353).

The two attributes every such button sets are now one helper,
menuOpener(b), used by the seven and by the panel's own count button.
It pays for itself: the budgets pass with no raise.

Run on mica at this tree (origin/main 60b10c69a + this change):
- go test ./internal/gui (the budgets included): ok; gofmt -l clean.
- GUI, both engines: side-effort, agent-switch-accounts,
  panel-switch-accounts, panel-usage-first-account, privacy-model,
  reply-model-setting, signin-proxy, window-cap, window-cap-pool,
  masking-demo, old-webkit, i18n-keys: 440 pass, 8 red. The reds are
  signin-proxy's Chromium 380 "no proxy offers the global one" (#5866)
  and panel-usage-first-account's Chromium case (#6181); at origin/main
  app.js the same two files have 9 reds, the same tests.
Broken by hand: side-effort at origin/main app.js, 10 of 10 red on
`aria-expanded` null !== 'false' (side-effort.test.cjs:132).
Not run: the whole GUI suite, the real Linux app.
2026-11-18 05:12:11 +08:00
yetone 60b10c69a7 gui: Routing's live note gives way before its buttons in a narrow window (#6669)
Since Routing groups › (11-06) and Settings › (a6e4cf763) joined Hide
accounts in Routing's head, German ran 38px past a 560px window
("Konten verbergen" to 590 in a 552px view), so view-no-sideways was red
in both engines. The head's note ("live, as the gateway decides") now
shrinks first and ends in an ellipsis, as the plugin panel's head note
does; the three buttons stay whole. The phone layout, which puts the note
on a line of its own, is unchanged.

Run on mica at this tree (origin/main 169446a1d + this change),
Playwright 1.62.0:
- view-no-sideways and phone-no-sideways: 58/58, both engines (red at
  origin/main: "routing: scrolls 38px sideways here", de window 560px).
- the 15 GUI files that touch Routing's head (account-mask, mask-emails,
  mobile-web, provider-mask, reduce-motion, routing-*, settings-back,
  settings-places, view-scrollbar-drag and others), --test-concurrency=1:
  396 pass. mobile-web's 8 "desktop matches origin/main" cases fail
  because mica-run's copy has no .git to read origin/main from, the same
  without this change. provider-mask's en 420 case timed out waiting for
  the Providers list (#5109, commented); alone it passes 140/140.
Found by measuring every element of #view-routing past its width at de
560px in Chromium: button#rtMask [458,590].
Not run: the whole GUI suite (other sessions' GUI runs on mote and mica),
the real Linux app.
2026-11-18 04:13:33 +08:00
yetone fdfa9fc72a gui: a narrow window's gateway key row holds still under the pointer, so it can be dragged (#6268)
At 420px, hovering a key row brought in its four unset badges (Quotas,
At once, Tier, Masking). Even shrunk, their padding and gaps took ~90px,
which the masked key gave up, so the key's copy button slid under the
pointer. A press meant to drag the row then landed on the button, which
dragRows leaves alone. 10 reds in gateway-key-arrange at 420px, in both
engines and every language. The flex-shrink fix for this held with three
badges; key-redact (319753d89) made four.

On a window 520px or narrower, the unset badges now keep their room
when the row isn't hovered, only faded out (the opacity rule as
before), so a hover changes no layout. The phone page (body.web)
already keeps them in place the same way.

Run on mote, at origin/main 223b900b4 + this:
- node --test gateway-key-*.test.cjs gateway-caller-keys.test.cjs
  mobile-web.test.cjs: every gateway-key and caller-keys test passes,
  arrange 420px included. mobile-web's 8 "desktop matches origin/main"
  subtests failed in mote-run's copy, which has no .git; in a git clone
  with the patch applied, mobile-web passed 30 of 30.
- Without this change, gateway-key-arrange fails the same 10 at
  origin/main 169446a1d on mica at load ~5 (#6268).

Not tried: the real app at a narrow width.
2026-11-18 04:11:06 +08:00
yetone a0993ed71d gateway keys: a key held to some models can be given a decision group (Kautism on Discord)
Kautism on Discord, after making a group of Clef and Jev models: "group
似乎不能在閘道金鑰上使用?我翻不到。" The key editor's model list comes from
GET /api/caller-keys/models, which is built from provider.Catalog, and
Catalog keeps decision groups out (no agent chats with one). The gateway
already serves a key that names one (serveDecisionGroup's groupGiven at
/v1/systemone), so a key held to some models could only reach a
decision group through All models.

Now the list puts the decision groups after the chat groups, marked
Group and Decides: only those the gateway serves (not hidden, not
switched off, found by FindGroup), and none twice.

Tests:
- TestCallerKeyModelsOfferDecisionGroups: a decision group is listed
  after the chat group; a switched-off one is not. It fails with the
  new block taken out by hand ("groups offered [group/chat], want the
  chat group and the decision group").
- TestGatewayKeyNamingADecisionGroup: a key given only the decision
  group reaches it at /v1/systemone, and a key given another model is
  refused. This is a guard on gateway behaviour that is already there;
  the gateway code is unchanged.

Run (worktree base 223b900b4, rebased onto 169446a1d, which changes
only the tray files):
- mote: go test -count=1 -timeout 45m ./internal/gui/ ./internal/gateway/
  ok (199s, 988s); go vet for darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok; gofmt clean.
- node --test internal/gui/tests/gateway-key-*.test.cjs: 363 pass,
  11 fail. 10 of the fails are gateway-key-arrange's "dragged into
  order" at 420px, both engines and every language, which are #6268.
  On mica, at load ~5, those two files fail the same 10 at this branch
  and at a fresh origin/main 169446a1d. The 11th (limit-off, chromium
  de 420) passed in the rerun of both files.

Not tried: the editor in the real app with the reporter's group.
2026-11-18 03:48:29 +08:00
yetone 169446a1d7 gui: the Mac's menu bar item takes its clicks from the start, so the first click after a restart keeps the panel open (Refeccd on Discord)
Refeccd on Discord: "每次更新后,第一次在菜单栏点击唤起主界面会出现闪退现象
(实际程序未退出,只是隐藏了)" (macOS, automatic updates).

Cause: 182803ea7 made the panel lazily, on its first open, and
trayOwnClicks (mpOwnClicks, the local monitor that sends the item's
action on mouse-down and drops the event) was installed in makePanel.
So the first click after every start went through the button's own
mouse-down tracking: the panel came up, the tracking loop took focus
back, and HideOnFocusLost hid it at once. Later clicks were fine,
because by then the monitor was in. Every update restarts magpie, so
it showed after each one.

Now trayOwnClicks runs right after the tray item is made, in app.go,
before any click can arrive; makePanel no longer installs it (the
monitor is dispatch_once, so nothing is installed twice).

Run (mica):
- go test -count=1 ./internal/gui/: ok (153.7s).
- Quick tests, go vet (darwin, GOOS=windows, GOOS=linux -tags nogui)
  on mote: ok; gofmt -l clean.
- TestTrayOwnsClicksBeforeThePanel is red with the call moved back
  into makePanel (broken by hand), green with the fix.

Not tried: a real tray click after a restart (no click can be driven
over ssh); the reporter's case is reasoned from the code path above.
2026-11-18 03:34:06 +08:00
yetone 17fe59ce35 library: a link in a project that leads out of it gets nothing of magpie's
A project is often a repository someone else wrote. A link in it was
followed wherever it pointed: CLAUDE.md linked to ~/.zshrc had the
user's project instructions (`make` in backticks included) appended to
the shell's startup file, a .mcp.json linked out had the project's
servers and their keys written where the link's author chose, and a
.claude folder linked to a shared one got the skills and settings.
Only the agents' user-wide instruction files were refused.

Project.inside now checks every file magpie writes or removes in a
project, links followed, before the write: instructions, MCP files,
Codex's per-project off list, Claude Code's settings.local.json,
subagents, the old .gitignore lines, and the folder a skill's link is
placed in (the entry itself is magpie's link to the library). A link
to nothing is refused too, since where a write through it lands can't
be told first. A link that stays inside the project (AGENTS.md to
docs/CLAUDE.md) still works. Each refusal is a problem on the project,
and what magpie wrote before is kept on record.

Run (fix worktree at origin/main 7b552eef3 plus this change):
- go test -count=1 ./internal/library/ ok on mica (macOS) and on WSL
  magpie-desktop (Linux).
- Windows (xiaomi-gpu): every test passes but TestDsbotLibraryTarget,
  TestDshNotOnDsbotHome and TestEveryAgentInLibrary, which fail the
  same at origin/main 7b552eef3 run alone there; filed as #6995.
- go vet ./internal/library/ for darwin, windows and linux; gofmt -l
  clean.
- Broken by hand: with inside() returning nil, the three new
  *StayInTheProject tests go red (the user's text lands in ~/.zshrc, a
  link to nothing is made, .claude's target gets skills/, the outside
  file gets the fs server).

Not tried: the GUI; a real repository with such links beyond the tests.
2026-11-18 03:16:45 +08:00