Commit Graph
8293 Commits
Author SHA1 Message Date
yetone da29171a4e library: a plugin hook that reads CLAUDE_PLUGIN_ROOT itself gets the folder
@AXmake110 on X: with the Claude Code plugin ponytail installed for an
agent, every start of the agent printed a red error. ponytail's hooks
read the folder in Node, not through the shell:

  node -e "require(require('path').join(process.env.CLAUDE_PLUGIN_ROOT.split(String.fromCharCode(92)).join('/'), 'hooks/ponytail-activate.js'))"

magpie replaced only ${CLAUDE_PLUGIN_ROOT} and $CLAUDE_PLUGIN_ROOT, so
the command went into Claude Code's settings.json (and, for the
UserPromptSubmit hook, Codex's hooks.json) as written. Outside Claude
Code's plugin runtime nothing sets the variable, and Node threw
"Cannot read properties of undefined (reading 'split')".

Fixed for the class (plugin_env.go):
- a hook program's own read of CLAUDE_PLUGIN_ROOT or CLAUDE_PLUGIN_DATA
  becomes a quoted string literal of the folder, with forward slashes:
  process.env.X, process.env['X'], Bun.env, Deno.env.get, Python's
  os.environ[...]/.get/os.getenv, Ruby's ENV[...]/ENV.fetch. The quote
  is chosen so it doesn't end the sh quoting around it. PowerShell's
  $env:X / ${env:X} and cmd's %X% become the folder.
- a plugin's command MCP server gets both variables in its env, as
  Claude Code gives them, unless the plugin set them.
- ${CLAUDE_PLUGIN_ROOT}/DATA in a subagent's prompt and in a copied
  SKILL.md are resolved, as Claude Code resolves them in Markdown.
- every agent gets the same text: the parts are library items, so
  Claude Code, Codex, Gemini, Cursor and Grok are all written from them.
- existing installs: load() heals the hooks, servers and subagent
  prompts of an installed plugin that still name the variables, and the
  next sync (the app's startup sync) writes them out again; the old
  entry is replaced, not duplicated. A SKILL.md copied before is fixed
  by the plugin's Update or a reinstall.

Not carried yet, filed as #6682: exec-form hooks (command + args, whose
args are dropped today) and CLAUDE_PLUGIN_OPTION_<KEY>.

The fixture is ponytail's published hooks files, byte for byte
(DietrichGebert/ponytail 96608e07, testdata/ponytail/README.md).

Run (mote; full suite at 901b56c80 on origin/main 221c91fae, then
rebased on 411769e9c and internal/library + internal/tui run again: ok):
- go test ./internal/library -run TestPlugin: ok.
- New tests: TestPluginHookReadsRootFromItsProgram (installs ponytail for
  Claude and Codex, then runs the SessionStart command under sh with
  node and no CLAUDE_PLUGIN_ROOT), TestPluginHookWrittenBeforeIsResolved
  (old library.json + settings.json, then Sync), TestPluginEnvRefsEachSpelling,
  TestPluginPartsGetItsFolders.
- Broken by hand: with the hook rewrite and the heal off, the first two
  go red and node prints the reporter's TypeError; with only the heal
  off, TestPluginHookWrittenBeforeIsResolved alone goes red; with the
  server env, prompt and skill changes off, TestPluginPartsGetItsFolders
  goes red (the written .claude/agents/helper.md too).
- Real use in a sandbox HOME: installed the real ponytail 5.3.3 from
  github.com/DietrichGebert/ponytail for Claude Code and Codex; the
  three hooks landed with the folder as a literal, and each ran under
  sh with node and printed ponytail's context, no error.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.
- Windows (xiaomi-gpu): go test ./internal/library -run TestPlugin ok
  (the node run is skipped there).
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...): 98
  packages ok; every red is already on main and none is in the library:
  TestNoEagerPackageRegexps (chatpage.go, #6689), cli's
  TestEveryRouteHasACommandOrIsNamed (#6677), gateway's
  TestKeySlotEveryRoute and TestLazyCatManifestListsTheClientRoutes
  (#6688), and a doneHold panic in a gateway test helper (#6690). The
  tui red (TestEveryWordHasZh) is fixed in the next commit.

Not tried: a real Claude Code or Codex session starting with the hooks
(the commands were run as they run them, with sh -c); a hook run
  on Windows.
2026-11-15 00:28:51 +08:00
yetone 411769e9c7 library: GitHub Copilot gets the Library's instructions with VS Code or JetBrains alone
@codealc on X (0.1.3827, Windows, Codex with Copilot as the provider):
资源库 › 指令 has no way to give GitHub Copilot instructions. The only
Copilot row was Copilot CLI's, listed only when the CLI was detected
(settings.json or the copilot command) and not uninstalled, so a user of
Copilot in VS Code or JetBrains saw none.

Which file Copilot reads, from each surface's own source:
- Copilot CLI 1.0.95: $COPILOT_HOME/copilot-instructions.md, else
  ~/.copilot/copilot-instructions.md (run for real, below).
- VS Code (microsoft/vscode d95071e96, promptsServiceImpl /
  computeAutomaticInstructions): ~/.copilot/copilot-instructions.md, plus
  ~/.copilot/instructions/**/*.instructions.md; its docs' reference table
  gives the same for the Copilot harness's user scope.
- GitHub Copilot for JetBrains 1.21.0 (javap of the plugin's classes):
  getCopilotCliHomePath() (COPILOT_HOME, else ~/.copilot) +
  copilot-instructions.md.

So Copilot CLI's agent now has shared "GitHub Copilot" (as Cursor CLI's
~/.cursor is the Cursor editor's) and a sharedApp check: VS Code, VS Code
Insiders, or the JetBrains plugin is here. agent.SharedRead says so;
SharedHere is true with it even before ~/.copilot exists, and
targetsAsleep keeps a CLIMissing agent whose folder such an app still
reads. The Library's row is named GitHub Copilot; the agent stays Copilot
CLI on the Agents page. SharedName also names Copilot CLI's chats in
Sessions, which are now "GitHub Copilot" as Cursor CLI's are "Cursor".
The user's own text in copilot-instructions.md stays outside magpie's
block, and comes back whole when magpie's instructions are emptied.

Tests (internal/library/copilot_shared_test.go): row named GitHub
Copilot; VS Code alone (no ~/.copilot) gets the row and the file written
without making Copilot CLI detected; JetBrains plugin alone; the user's
own file kept; CLI uninstalled with VS Code still here keeps the row,
with nothing reading it drops it; COPILOT_HOME followed.
TestCursorIsCursorCLI and TestCursorFolderFromTheEditorIsNotTheCLI now
allow Copilot beside Cursor.

Run:
- The six new tests on the old code (source files checked out from
  aa358555f, new test kept): all six red. Broken by hand: the
  targetsAsleep `&& !a.SharedRead()` taken out turns
  TestCopilotCLIGoneVSCodeKeepsTheRow red.
- go test ./internal/library -run Copilot on win-run (Windows 11) and
  wsl-run (Ubuntu 24.04): ok.
- Real Copilot CLI 1.0.95 with COPILOT_HOME at a scratch folder (signed-in
  config copied there, cwd an empty folder), copilot-instructions.md
  holding a user section and magpie's block with a codeword: copilot -p
  answered the codeword; without the file it answered NONE.
- gofmt -l internal: nothing. go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... (mica): ok.
- Full go test -timeout 45m ./... on mote at f32bdee76 (rebased on
  0b8c4bfc3): 99 ok, red only TestEveryRouteHasACommandOrIsNamed
  (#6677, POST /api/providers/delete) and TestEveryWordHasZh (#6686, "permission
  mode"), both red alone on a fresh origin/main 221c91fae.
- Rebased on 221c91fae (6 commits, none in internal/library or the
  agent files here): library, agent, cli, tui and gui packages again at
  6946baa72: library, agent, gui ok; cli and tui red only on #6677 and #6686.
- Rebased on a4dd893af (5 commits in gui/admin, gateway, docs; none in
  library or agent): library, agent and gui again at the pushed head: ok.

Not changed: no GUI file; the row's name comes from the server.
Not tried: VS Code and JetBrains reading the file for real (read from
their source only).
2026-11-15 00:23:13 +08:00
yetone a4dd893af4 gateway: test that a classifier group keeps its member's pinned account
@AWilsonPeng on X (v0.1.4178, OMP, ChatGPT with two accounts) picked the
found group GPT-6-luna as a routing group's intent model, pinned one of
its accounts, and saw intent decisions still choose between both. Not
reproduced: on main every case below asks the pinned account only. The
tests stay as a guard for the path.

A fake ChatGPT backend records the chatgpt-account-id of each request,
with two Codex accounts signed in:
- TestClassifierGroupKeepsItsMembersAccount: the group asked as a
  classifier, own and found group, member pinned (provider/model#id) or
  the group held (Group.Accounts), ordered and default routing.
- TestClassifierGroupPinnedAccountRefusing: the pinned account answers
  429 usage_limit_reached; the other is never asked.
- TestClassifierGroupPinnedThroughATurn: POST /v1/chat/completions to a
  routing group whose Classifier is the group, effort auto, 4 turns.
- TestClassifierGroupManualPickedAccount: a Manual group, the pinned
  member picked.
- TestClassifierGroupPinnedEveryRouting: every routing, pinned and held.

The Routing log lists the other account under the classifier call's
left-out accounts, "another account is named for this model in {group}";
that may be what the reporter read as both being used.

Run at origin/main 221c91fae; committed on 217e933dd, with no
gateway or provider change between:
- gofmt -l: clean.
- mote-run go test ./internal/gateway -count=1 -timeout 45m: every test ok but
  TestKeySlotEveryRoute and TestLazyCatManifestListsTheClientRoutes,
  red on origin/main 3ffac6048 too, from 6bdeedc6f's /deepseek-chat
  routes (#6688).

Broken by hand (restored after):
- memberHeld always "": every member-pinned case on the non-default
  account red (own/found spare, refusing, through a turn, manual spare,
  all 12 routings).
- heldByGroup returning r unchanged: every held case red. groupHeld
  alone made false stays green, as the request is held by heldByGroup
  first; groupHeld and heldByGroup together: the same held cases red.

Not tried: count_tokens, title generation and other internal requests
with a pinned member; the reporter's own saved group.
2026-11-15 00:17:59 +08:00
yetone 217e933dd9 LESSONS: 11-14 afternoon, 14 tags with no green CI run behind them
After 1ab2c3984 only two Test runs finished, both red on the hub
pruner race (fixed in 49f49c41c); the rest were cancelled by the next
push. Docs only; nothing run.
2026-11-15 00:17:14 +08:00
yetone 3ffac60480 docs: the management API's routing groups and the app's switch for it (#6307)
docs/reference.md's Management API lists the routing-groups routes
(list, get, create, update and the Routing page's actions), says they are
checked as the app checks them and that found/skip are not served, names
the key menu's Advanced switch beside `magpie gateway-key admin`, and
drops "this first part leaves out Routing Groups": what is left out on
purpose is the export of sign-ins, which would hand out every account's
secrets. docs/subsystems/gateway-routing.md says how the routes reach
/api/groups (adminGroupActions, adminGroupWrite over provider.SaveGroup)
and names the tests. The site's remote page says the same in en, zh and
ja, and public/llms-full.txt is built again from it (node llms-full.mjs,
on mica).

Run: site's worker.test.mjs (llms-full current) in the full run before
the push; no code changes here.

Run for the three #6307 commits (mica, at 4eafd9963 on 90efddaba's
successor, then the touched tests again after rebasing onto 221c91fae):
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. Builds (darwin, linux nogui, windows): ok.
- site worker.test.mjs: 41/41 (llms-full.txt current).
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  two, both red on origin/main and filed: internal/cli
  TestEveryRouteHasACommandOrIsNamed (POST /api/providers/delete, #6677)
  and internal/tui TestEveryWordHasZh ("permission mode", #6686).
- At 221c91fae + these: go test -run 'Admin|Group' ./internal/gui ok;
  gateway-card, gateway-key-admin, gateway-chat-page in both engines
  62/62; i18n-keys, i18n-en-no-cjk 8/8.
2026-11-15 00:16:11 +08:00
yetone 1cfa53b678 gui: a gateway key's management level is switched from its menu, under Advanced (#6307)
ljayic on X asked to give a key the management API without curl. A
key's … menu has Advanced (after Rotate key) for keys that can hold
the level: not the sharing key, a browser or read-only key, an issued
or expiring key (the same set access.Update and adminOf accept). It
opens the app's menu headed "Management API" with Off, From this
computer and From any computer, ticked at the key's level, and posts
/api/caller-keys/admin-key. A key that has a level says "Manages
magpie" in its row, its title saying from where. Strings in zh,
zh-TW, ja and de.

gateway-card's menu list now names Model names (on main since before
#6029) and Advanced, 8 items.

Run (GUI, Playwright 1.62.0, both engines, en/zh/zh-TW/ja/de, 1100
and 420px):
- gateway-key-admin (new), gateway-card, gateway-key-readonly,
  gateway-caller-keys: pass (mica).
- key-page, i18n-keys, i18n-en-no-cjk: pass (mote, repo root).
- gateway-key-admin with keys.js and i18n.js from HEAD: red 0/10
  (waits for .key-admin on ops).
- Whole gateway-*.test.cjs set, key-page, phone-connect-menu: the
  reds left are gateway-key-arrange at 420px, which is red without
  this change too (#6268), and gateway-card's 7 !== 6 on main (#6029),
  fixed here.

Not tried: the real app with a second computer calling the API.
2026-11-15 00:13:05 +08:00
yetone 261b84ba38 gui: the management API serves the Routing page's groups (#6307, ljayic on X)
ljayic asked again for routing groups through /v1/magpie/admin/. They are
served now as the other routes are, by the app's own handlers behind the
same guard (gateway/admin.go, by path prefix, nothing new there):

- GET routing-groups: the Routing page's /api/groups answer.
- GET routing-groups/{id}: one group as that list has it, by its id or the
  ref agents pick it by (group/<id>, auto/<model>); 404 for none.
- POST routing-groups/create: the page's save, refused with 409 when the
  id is a group's already (save would write over it).
- POST routing-groups/update: the page's save over the group as it is,
  the fields sent put over its own, so one field changes alone; 404 for no
  such group; "from" renames, as the page's editor does.
- POST routing-groups/{save,delete,copy,switch,arrange,pick,defaults,
  template,share,import,show}: the page's actions as they are.

Members, combos (a group in a group) and each member's account
("provider/model#<account>") go through provider.SaveGroup, so what the
page refuses the API refuses: an account the provider has none of, an
account on a group, an empty group, a bad id, deleting a group a combo
holds. Not served: "found" and "skip" (the found-groups switches, which
move the agents set to a found group, rewriting this computer's agents).

Run (mica; mote was at load 62 with a GUI suite): go test -count=1
-run 'TestAdmin|Group' ./internal/gui ok; go vet ./internal/gui and
GOOS=windows go vet ./internal/gui ok; gofmt -l empty.
Red on the old admin.go (origin/main's, with the new tests): both new
tests 404. Broken by hand, each red in TestAdminAPIRoutingGroups: create's
409 check off (create over team served), update's merge off (a name-only
update refused as an empty group), "found" added to the actions (served).
Tests: TestAdminAPIRoutingGroups (create, combo, 409, four refusals the
page makes, get by id and ref, update keeps fields, member change, rename
carried into the combo, switch, arrange, found/skip 404, delete refused in
a combo then both at once, no provider key told);
TestAdminAPIRoutingGroupsGuarded (through gateway.New().Front(): no key
401 from loopback and the network, a key that may not manage 403 from
both, a local key from the network and through a proxy 403, Origin 403,
five routes each, nothing made; then local from loopback and any from the
network 200).
Not tried: the full suite (both boxes had a GUI suite running; it runs
before the push), a Linux vet of gui (needs WebKitGTK; wsl-run before
the push), a real request from a second computer.
2026-11-15 00:13:05 +08:00
yetone 221c91fae3 gui: the gateway card opens the chat page
The gateway card gets a "Chat page" button beside Restart gateway while
the gateway runs. It opens <gateway>/deepseek-chat/ in the browser, or,
in web mode, the public URL's chat page. Both buttons sit in one
.gw-acts group, so a narrow card wraps them together, and Restart keeps
its .gw-fix class (the takeover, pause and port-holder tests read the
first .gw-fix). The label is translated in zh, zh-TW, ja and de.

Run: gateway-chat-page.test.cjs in Chromium and WebKit, every language,
at 1100 and 420 wide, on mica: ok. It is red without this change (no
button). At 058119705 + this change, on mica, every gateway-*.test.cjs,
i18n-keys and i18n-en-no-cjk in both engines: 328 of 343 pass in
Chromium. The reds are gateway-card's "7 !== 6" (#6029) and
gateway-key-arrange at 420px (#6268), and in WebKit gateway-pause's
"click moved the row" in one language (#6684). All of them are red the
same on an origin/main 3f09b9ffc copy. go test ./internal/gui (budgets): ok.
Go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and gofmt: clean.
2026-11-14 23:56:19 +08:00
yetone 6bdeedc6fb gateway: serve DeepSeek's chat page with magpie's models
@yanghonghang asked on X for DeepSeek's open-source web chat page
(deepseek-ai/chat-demo) to run on magpie, with its search and link
reading served by magpie's own. magpie now serves it at
<gateway>/deepseek-chat/, with no setup:

- The page is the v0.1.1 release (MIT, LICENSE kept in the zip),
  embedded and served from memory. Its API origin is rewritten to
  location.origin+"/deepseek-chat", and magpie.js adds a model picker:
  any magpie model answers, sent as the magpie_chat_model cookie.
- On this computer the page needs no key of the user's. Another
  computer types a gateway key, as for every other route.
- POST anthropic/v1/messages maps deepseek_web_search to magpie's
  web_search_20250305 and deepseek_read_url to a read_url tool magpie
  runs itself with fetchPage between rounds. Each round goes through the
  gateway's own Messages route, so routing, keys, limits and usage are
  the same as an agent's.
- Files (images, PDFs, text) are kept in memory until a restart; Word,
  PowerPoint and EPUB are refused with 415. ASR and TTS go to the speech
  models set in magpie.
- Only the page's GET/HEAD static files are keyless (readOnlyRoutes and
  lanGuard's chatPageOpen), served under a strict CSP. Its models, chat,
  files and speech routes need a key from another computer, and a
  read-only key is refused on each (readOnlyRefused).

Docs: docs/subsystems/gateway-routing.md, "DeepSeek's chat page".

Real use: a sandbox magpie (sandbox HOME, port 3486 on mote) served the
page in Chromium; a Claude answer with web search showed citations and
source chips, a DeepSeek link read answered from the page, and the
picker was checked in light and dark.

Run: go test -tags nogui -run 'TestChatPage|TestReadOnlyKeyEveryRoute'
./internal/gateway on mica, ok. Without this change every TestChatPage*
is red (the routes 404), and TestReadOnlyKeyEveryRoute is red with the
chat routes missing from readOnlyRefused.
2026-11-14 23:50:45 +08:00
yetone cd75e3ca80 gateway: a held text block's citations go after its start
With function tools in a request, anthropicTextCalls holds an empty text
block's content_block_start until its first text_delta, in case the text
turns out to be a written call. A cited line streams its citations_delta
before its text, and those went out at once: before the block they
belong to had started. A client that keeps blocks by their start
(DeepSeek's chat page, the Anthropic SDKs) dropped or choked on them, so
web search answers relayed with tools lost every source. Seen live: a
remote magpie's Claude answer had 19 citations_delta with the start
first, and the sandbox's relay put all 19 before it.

Now a delta other than text on the held block lets the start go first.

Run: go test -tags nogui -run 'TestTextCallsCitationAfterItsBlock|TestChatPage'
./internal/gateway on mica, ok. TestTextCallsCitationAfterItsBlock is red
on the old textcalls_anthropic.go (citations_delta before
content_block_start).
2026-11-14 23:50:45 +08:00
yetone 0581197059 usage: a table's account cell has its name above its address
normalcoder_ on X (tweet 2121623100425134513): in Usage > Overview's
table, the account cell put the name and the address side by side, so a
long one was cut. The name is now on the first line and the address, the
key plan it stands in for and shared keys each on a line below it, with
the cell's whole width; a masked page's eye stays on the name's line.

Run (mote): usage-table-acct-lines.test.cjs, chromium + webkit, en zh
zh-TW ja de, 1100 and 420px: 20/20 here, 20/20 red on origin/main
0b8c4bfc3 ("the address is under the name"). With the other two new
files: 60/60.

Not run: the whole GUI suite before the push; the real Linux app.

After the rebase on cfd70c60c, at this tree (mote): go test ./internal/gui -run 'Budget|I18n' ok; the three new files and i18n-keys 64/64.
2026-11-14 23:50:37 +08:00
yetone 47684ef176 usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.

columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.

Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
0b8c4bfc3. It covers the previous commit's sub-cards as well. The usage
GUI reds are those named in the previous commit, the same on main.

Not run: the whole GUI suite before the push.
2026-11-14 23:49:02 +08:00
yetone 2a6ab83d8a usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).

- renderQuotas puts each account of a card with several into a
  .subscription-acct box (a provider's keys, a balance a line, stay
  lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
  hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
  so there is no page to move it to.

Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
  0b8c4bfc3. usage-account-subcards.test.cjs (next commit) guards the
  sub-cards; red on origin/main too.
- go test ./internal/gui -run Budget: ok.
- ~110 usage/quota/i18n GUI files: every red is the same on origin/main
  0b8c4bfc3 and filed: usage-agents-hide (#3414), usage-cards-hide de 560
  (#6294), usage-fold webkit (#6003, #3415), usage-hidden-way-back (#6295),
  usage-ledger Requests (#5048), usage-range-times (#6499),
  usage-speed-all-models (#5834).
- usage-fold "most on one screen" is red on main (#4790, 12 chromium of
  15 wanted); with the boxes it is 11, one account fewer.

Not run: the whole GUI suite before the push; the real Linux app.
2026-11-14 23:49:01 +08:00
yetone cfd70c60c2 update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before 3f09b9ffc landed, so they still hold the pill for 3 days. No code changed; nothing run beyond gofmt -l (clean).
2026-11-14 23:48:04 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

Now being behind holds nothing: ready, found and available light the
pill at once. Only the pill's x (or right-click) holds it, for
update.Quiet across the releases out meanwhile (Behind.Hushed), which
keeps 36eebea13's answer to "always lit" (the x used to hold only until
the next release, minutes later). An urgent release still lights it
through that. The old notes' "since" is never read as a dismissal.
Settings > Update button says "Hidden for 3 days" whenever the x holds
(it said "Hidden for <v> until a newer version is out" only while that
exact version was latest), and Show again lifts the hold
(update.Unhush, an empty update-skip). The x's label and toast say
3 days instead of "until the next version" (en, zh, zh-TW, ja, de).

Users on 0.1.3879 to 0.1.4179 get it with their next update: Settings >
About > Restart to update, the tray's Restart to update, or quitting.
0.1.4079 still checks, downloads and verifies the newest release: its
updater code (LatestEvery + Stage, sandbox HOME on mica) fetched
0.1.4178, passed download, verify (SHA256SUMS signature, attestation)
and unpack, and stopped only at the Team ID check because the probe
binary is unsigned.

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00
yetone 1106a33a89 routing: every account row in Accounts and keys shows all its windows
zwm_vincent on X: with two subscription accounts, Accounts and keys
showed one window per row, 5H on one and 7D on the other, so neither
row said what was left in the other window or when it reset.

A subscription account's row now has one line per window Usage read:
the short name (5h, 7d), a small bar, what is used or left, and when
it resets. Each part's column is as wide as the widest down the list
(in ch, CJK counted double), so the names, bars, values and resets
start at the same place on every row. Where a row is too narrow (the
list in columns at a phone's width, under 215px) the bar is left out
and the reset wraps under, alike on every row. The hover still has
each window in full with the day and time it resets and when it was
read. The single-figure status, the windows line and the bottom bar
are not drawn for such a row; wallets and accounts with no windows
keep their one line.

Tests: routing-account-windows.test.cjs adds a second account whose
binding window is the week and checks both rows show both windows with
their bars (40%/12%), the hover text, every column's left (and the
reset's right) equal across lines and rows, nothing cut, no sideways
scroll; en, zh, zh-TW, ja, de at 1100px and 420px, Chromium and WebKit.
routing-pooled-card and routing-read-allowances read the new lines.

Run at this head, rebased on origin/main aa358555f, on mote:
- The 7 routing GUI files (routing-answer-figures, routing-account-windows,
  routing-pooled-card, routing-read-allowances and the routing files they
  share helpers with): 108/108 ok, Chromium and WebKit, en/zh/zh-TW/ja/de,
  1100px and 420px.
- Both new tests on the old code: 86 fail, 2 pass.
- Every GUI file that loads routing or app.css (313 files): chromium 51
  and webkit 50 reds, each red on origin/main aa358555f too (#5872,
  #5262 zero-priced-free, #6561 text-size webkit, red 3 of 3 on main
  on mica). ctx-route-align was red here only, from a fractional
  min-height; fixed (54px) and green.
- go vet ./internal/gui, go test ./internal/gui: ok (160.8s).
Rebased on origin/main 171fce511 (app.js, i18n.js changed): ctx-route-align,
  i18n-keys, quota-credits and the 4 routing files above, 108/108 ok,
  Chromium and WebKit, on mote.
Broken by hand: the old client.js/routing.css under the new tests (above).
Not run: the whole GUI suite, the Go suite (no Go change), the real app
with a real account's windows (fixtures carry the reporters' figures).
2026-11-14 23:45:23 +08:00
yetone af62d3d646 routing: a try's answer in the caption is figures in fixed places
Puremilk_chun on X: the caption over the Routing stage told an answer
as one sentence ("Codex's own sign-in (gpt-6.1-sol) 以 high 推理强度
用 41 秒 完成回答 · 197.5k token · 35 秒 后出首字 · 40 token/秒 ·
请求缓存命中率 98%"). Its length and line breaks moved with every
value, so the reader had to find each one again.

The caption now lays the answer out as a grid: who answered, its model
and effort on top; under them the duration, tokens, first token, speed
and cache hit rate, each a value over its existing label ("Duration",
"Tokens", "First token", "Speed", "Cache"; no new strings). Five to a
line; three to a line where the stage is 720px or narrower (a byWidth
class, no container query, WebKit #1249). A figure the try doesn't tell
is a dash in its place, so the others keep theirs. The sentence stays
on hover and in the steps list below. The caption's min-height grew so
the next answer doesn't move the page.

Test: routing-answer-figures.test.cjs plays the reporter's request
(41 s, 197.5k, 35 s first token, 40 tok/s, 98%) then a shorter one
with no first token and no cache figure, and checks every part keeps
its x, its line and the caption its height, nothing is cut, the effort
sits on the account's line, no sideways scroll; en, zh, zh-TW, ja, de at
1100px and 420px, Chromium and WebKit.

Run at this head, rebased on origin/main aa358555f, on mote:
- The 7 routing GUI files (routing-answer-figures, routing-account-windows,
  routing-pooled-card, routing-read-allowances and the routing files they
  share helpers with): 108/108 ok, Chromium and WebKit, en/zh/zh-TW/ja/de,
  1100px and 420px.
- Both new tests on the old code: 86 fail, 2 pass.
- Every GUI file that loads routing or app.css (313 files): chromium 51
  and webkit 50 reds, each red on origin/main aa358555f too (#5872,
  #5262 zero-priced-free, #6561 text-size webkit, red 3 of 3 on main
  on mica). ctx-route-align was red here only, from a fractional
  min-height; fixed (54px) and green.
- go vet ./internal/gui, go test ./internal/gui: ok (160.8s).
Rebased on origin/main 171fce511 (app.js, i18n.js changed): ctx-route-align,
  i18n-keys, quota-credits and the 4 routing files above, 108/108 ok,
  Chromium and WebKit, on mote.
Broken by hand: the old client.js/routing.css under the new tests (above).
Not run: the whole GUI suite, the Go suite (no Go change), the real app
with a real account's windows (fixtures carry the reporters' figures).
2026-11-14 23:45:23 +08:00
yetone 171fce511a gateway: Google's suspension of an Antigravity or agy-cli plugin account rests it as restricted (plugins#1148)
googleSuspended read Google's 403 "disabled in this account for violation
of Terms of Service" only for an account whose Agent is antigravity or
gemini, the built-ins. An account of the community Antigravity plugin, or
of agy-cli, has Agent "plugin", so its suspension was an unknown failure:
a minute's rest, doubling to ten, and asked (and refused) again every few
minutes for good. plugins#1148's reporters saw a 403 followed by a dozen
more tries. googleSignIn now also takes a plugin account whose plugin
provider is antigravity or agy-cli; such an account rests two hours as
restricted, and the last one left is answered by magpie without asking
Google, as the built-in's is.

Run (mote, base 0b8c4bfc3): go test -run TestAntigravitySuspended
./internal/gateway ok. Broken by hand: with routing.go from origin/main,
TestAntigravitySuspendedIsGooglesAlone is red on both plugin cases
("other, want restricted"). Another plugin's same words (kiro), another
403 and a 400 from the plugin stay failOther.

Not run: the whole gateway package (mote load 31, mica 111 at the time);
it runs after the push. Not tried with a real suspended account.
Not changed: antigravityTurnedAway, antigravityForeseen and
antigravityRound still check Account.Agent only; filed separately.
2026-11-14 23:42:28 +08:00
yetone 0b8c4bfc34 agent: Claude Code's permission mode is set in magpie and kept (EricChenChannel on X)
The report: "every time I configure settings.json it is overwritten and
reset" for permissions.defaultMode = bypassPermissions.

Cause, reproduced in a sandbox HOME with Claude Code 2.1.316: magpie's
writes to ~/.claude/settings.json are key-level and kept the user's
permissions block. Claude Code itself drops the mode: it ignores
bypassPermissions at launch unless skipDangerousModePermissionPrompt is
true, and its auto-mode nudge and /config write defaultMode over it.

Change:
- agent.Field gets Own: the user's own setting of the agent. Apply does
  not record it, Disconnect neither clears nor restores it, Pick never
  connects the agent for it, magpieValueIn is false for it, and profiles
  (Fields, ApplyFields, InUse) and the WSL copy leave it alone. So the
  mode outlives disconnecting magpie and switching profiles.
- Claude Code's permission_mode field (default, acceptEdits, plan, auto,
  dontAsk, bypassPermissions; "" removes the key) writes
  permissions.defaultMode, and bypassPermissions also writes
  skipDangerousModePermissionPrompt: true so Claude Code honours it.
- GUI: own fields go in agentJSON.own, apart from fields, and
  agentcompact.js draws them in an Advanced fold (collapsed) under the
  agent's settings, with the app menu (no <select>). app.js unchanged.
  Labels in en, zh, zh-TW, ja, de (zh: 高级 › 权限模式 › 跳过权限确认).
- docs/subsystems/agent-wiring.md: Fields and options row.

Run at this tree (base aa358555f, origin/main at commit time), on mote/mica:
- go test ./internal/agent -run 'Permission|Profile' ; ./internal/profile ;
  ./internal/gui -run 'Budget|PermissionMode|AgentOwn|AgentModels': ok
- GUI claude-permission-mode.test.cjs in chromium and webkit, en and zh:
  4/4; i18n-keys, i18n-en-no-cjk: ok
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok

Broken by hand:
- Own: false on the field: TestClaudePermissionModeOutlivesMagpie
  ("disconnecting took the mode to \"\"") and TestProfileLeavesPermissionMode
  ("a profile wrote the permission mode") went red.
- Without the GUI own/fields split, the "not a picker on the row" check in
  claude-permission-mode.test.cjs went red.

Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).
2026-11-14 23:11:16 +08:00
yetone aa358555ff LESSONS: 11-14, two sessions fixed TestInfoSaysMCPHub at once
The review loop and another session each wrote the hub pruner fix;
49f49c41c landed and the loop dropped its copy (b24f03965, unpushed).
Docs only; nothing run.
2026-11-14 22:41:55 +08:00
yetone 49f49c41c1 gateway: its end waits for the MCP hub's pruner, which reads MCPHub
keepHubPruned ran on its own goroutine with nothing waiting for it, so
ListenAndServe could return while the pruner was still between ticks or
in Prune. It reads MCPHub, which tests swap with withHub, so a test that
waited for one gateway's end and then swapped the hub raced the old
gateway's pruner: TestInfoSaysMCPHub, ubuntu Race on CI at 3dbbb173e
(write at hub_mcp_test.go:76, previous read at hub_mcp.go:910 from a
ListenAndServe started at handover_test.go:28). The gateway's end now
cancels the pruner's context and waits for it to return, so once
ListenAndServe returns nothing it started still looks at MCPHub. In
the app this adds the wait for a Prune already running at shutdown,
which ends the servers the library no longer gives (the same b.stop
StopHub does).

TestGatewayEndEndsHubPruner holds a Prune mid-call and checks the
gateway's end waits for it.

Run on mica (macOS, Go 1.26.8), at 90efddaba plus this change:
- go test -race -count=3 -run 'TestGatewayEndEndsHubPruner|
  TestInfoSaysMCPHub|TestHandedOver|TestEnding|TestListening'
  ./internal/gateway: ok.
- Broken by hand: with origin/main's gateway.go the new test fails 2 of
  2 ("the gateway ended while its pruner was still in Prune") with a
  DATA RACE report.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok.
2026-11-14 22:29:07 +08:00
yetone 90efddabae gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.

The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.

Run (rebased on origin/main e6e0585bd, on mica; mote was over its 18
cores):
- go test -tags nogui ./internal/gui/ ./internal/provider/: ok
  (TestProvidersDeleteSeveral new; TestCoreScriptBudget ok after the raise).
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; go build: ok.
- GUI, chromium + webkit: provider-bulk-remove (new: en, zh, zh-TW, ja,
  de at 420 and 1100px), provider-remove, provider-find, provider-order,
  providers-off-fold, provider-search, provider-list-off,
  group-bulk-remove, library-pick-remove, i18n-keys, i18n-en-no-cjk: ok.
  found-skill-pick-remove's ja/de 420px subtests are red, and red the
  same at origin/main e6e0585bd in a clean worktree (#5013).
Broken by hand: the handler deleting only ids[:1] turns
TestProvidersDeleteSeveral red ("listed after: [b c d]"); the page
posting only the first id turns provider-bulk-remove red in every
language. Restored, green.
Not run: the full Go suite and the full GUI suite (mote overloaded,
mica running another session's GUI suite); not tried in the real app
with real providers.
2026-11-14 22:18:09 +08:00
yetone e6e0585bd3 antigravity: reword Hermes', OpenCode's, Codex CLI's and pi's identity lines, which Google refuses since 11-14 evening
Since about 18:43 on 11-14 Antigravity answers 429 "Resource has been
exhausted" to a system instruction holding "You are Hermes Agent"
(Hermes' current persona), "You are OpenCode", Codex CLI's "You are a
coding agent running in the Codex CLI" or pi's "a coding assistant
running inside pi", whatever quota is left (@ZhouYimingsjtu,
@Lmohn39 on X). Hermes' earlier persona is still refused as "You're …
created by", so it keeps its "built by". Tried on a real account
(gemini-3-flash), each alone: Codex GPT-6's prompt, Claude Code,
Gemini CLI, Qwen Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider and
Cursor pass as written.

agTurnedAway gains the four lines; agSaidAs rewords them "You're …" and
"running within pi", the smallest change that passed 5/5 on the real
account (gemini-3-flash: pi 1.5.0's full default prompt, both Hermes
personas, OpenCode's first lines, Codex CLI's prompt; claude-sonnet-4-6:
pi 5/5), through the antigravity plugin's cloak, which has the same
lines (plugins a617ecfd, antigravity 0.1.16, agy-cli 0.1.48,
antigravity-cloak 0.1.9). The refusal's hint names the agent: new
OpenCode, Codex CLI and pi hints, Hermes' covers both personas, word
for word the plugins' and the Routing page's (client.js HINTS, i18n
zh/zh-TW/ja/de).

Run (mica; mote was over its 18 cores):
- go test ./internal/gateway -run 'Antigravity|Cloak|CodeAssist': ok
- go test ./internal/gui: ok
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway
  ./internal/gui: ok
- node --test i18n-keys, i18n-en-no-cjk, routing-ag-turned-away
  (both engines): 38 pass
- gofmt -l: clean

Broken by hand: with the pi and OpenCode lines out of agTurnedAway,
TestAntigravityCloakRewordsEveryLineItTurnsAway and
TestAntigravityHermesHint go red.

Not run: the full go test ./... (mica had another session's full suite
running, mote over load) and the whole GUI suite; the change is
strings in four tables plus the hint switch.
2026-11-14 21:49:30 +08:00
yetone e0ed2c4d81 gateway: model ids without the provider can be listed alone, in place of provider/model
qQianye on X (v0.1.4094 in Docker, several WorkBuddy accounts): the
client on their computer lists every model as provider/model and they
want those hidden. The advice was the Agents page's model list, but
gateway mode (what the Docker image's web page runs as) has no Agents
page. Settings › Network and sharing › Model ids without the provider
was drawn there already, but only added bare ids beside the prefixed
ones, so the list got longer, not shorter.

The row is now Off / On / Only. Only (settings.BareModelIDsOnly,
POST /api/settings/bare-ids {"on":true,"only":true}) lists each bare id
in place of the first row it stands for (provider.OnlyBare) and leaves
the other rows it stands for out: the found group it reaches
(auto/glm-5.3) and every provider's row of that model it reaches. A row
the bare id doesn't reach (b/vendor/m9, whose bare id names provider
vendor), a held key's row whose bare id isn't listed for it, and other
groups keep their ids, so no model leaves the list. Requests by
provider/model are served as before; only /v1/models changes. Another
magpie's list is unchanged. Claude Code's discovery, which drops a bare
row it wouldn't keep because the full row is there, lists it by its
alias with Only (there is no full row). Off clears Only.

Run, at this commit (base 3dbbb173e, origin/main unchanged at push):
- go test -count=1 -timeout 45m ./... on mica: 101 packages ok, no FAIL
  (log kept whole at mica:~/runs/qq-sb/suite.log). gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... clean.
- GUI (Chromium + WebKit, 420 and 900, all five languages) on mica:
  bare-ids, i18n-keys, i18n-en-no-cjk, gateway-mode, settings-tabs-stick:
  66/66 pass. Not the whole GUI suite: mote was over its load and mica
  holds another session's GUI run.
- Broken by hand: with Only ignored in listModels, TestBareModelIDsOnly
  is red (every provider row listed); with Claude Code's bare rule left
  as before it is red (1 of 5 models listed to discovery).
- Docker-style run on mica: the built binary as `magpie serve
  --web` with the image's env (HOME/XDG under a sandbox, MAGPIE_ADDR,
  MAGPIE_WEB_KEY), two custom providers serving kimi-k3 and glm-5.3; the
  page boots with gateway:true and draws #bareIdsRow. /v1/models:
  Off  auto/kimi-k3 auto/glm-5.3 wb1/kimi-k3 wb1/glm-5.3 wb2/kimi-k3 wb2/glm-5.3
  On   the same, then kimi-k3 glm-5.3
  Only kimi-k3 glm-5.3
  kimi-k3 answered by wb1, wb2/kimi-k3 still by wb2.
Not tried: a real WorkBuddy plugin account, and a client reaching it
through another magpie (whose list never takes bare ids).
2026-11-14 21:05:50 +08:00
yetone 3dbbb173ed gateway: spawn_agent names every model for a Codex an app-server host runs under its own name
@m0eaki on X (magpie 0.1.4159, Codex 0.169.0 through LobeHub's
app-server, /v1/responses): the lead saw only Codex's first five of a
local catalog of 13. `codex app-server` makes the host's
clientInfo.name its originator and the head of its User-Agent (codex-rs
initialize_processor.rs, set_default_originator), so LobeHub's turns say
"lobehub-desktop/0.169.0 (…) (lobehub-desktop; …)", and the gate before
spawnAgentModels took only Codex's own names (fromCodex) or the codex
token.

The class: any host may name Codex's turns after itself (Zed, LobeHub,
other IDEs). Every Responses turn Codex sends, to any provider, carries
x-codex-window-id (and x-codex-turn-metadata): core/src/
responses_metadata.rs compatibility_headers. codexRuns takes those as
Codex's too, beside fromCodex and the codex token, for spawnAgentModels
alone. spawnAgentModels still widens only a body with Codex's own
spawn_agent signature or <model_catalog>, and its added text is the
same neutral line (nothing naming magpie or Codex). spawnChoices at /v1
reads the codex catalog and the key's list, not agentOf, so a host's
lead gets the catalog magpie wrote for Codex. codexForClaudeCode reads
the same headers through codexTurnHeaders now.

codexTiered stays on the old gate (split out of the same if).
Gates that send a request upstream as Codex's own, to a relay that
checks it (codexAsSent, codexNamed's header forwarding, keepTurnAsks),
stay on Codex's own names. The other gates on fromCodex (subagent pick,
resume and follow, hookKind, codexOwnOffMagpie, codexTiered, the events
only Codex reads) are left as they are, filed as #6653.

Test: TestSpawnAgentNamesEveryModelForAnAppServerHost posts at
/v1/responses with the headers Codex 0.169.0 sends under LobeHub
(User-Agent lobehub-desktop/0.169.0 (Mac OS 26.5.0; arm64) unknown
(lobehub-desktop; 2.1.40), originator lobehub-desktop, x-codex-window-id),
a lead on magpie's model, in four shapes (tools, V2 additional_tools,
model_catalog_in_context, tool search; the real 0.162.0 and 0.169.0
fixtures), and checks that the same app name without Codex's turn
headers is left as sent.

Run (on mica, mote's load was 100):
- Broken by hand: the old gate back in place, the four LobeHub
  subtests go red, the four without-headers ones pass. Restored, green.
- gofmt -l clean; go vet ./internal/gateway, GOOS=windows and GOOS=linux
  go vet ./internal/gateway: clean.
- go test ./internal/gateway -run SpawnAgent -count=1: ok.
- go test ./... -count=1 -timeout 45m at base bc9ea912a: every package
  ok (101), internal/gateway 937s, exit 0.
2026-11-14 20:23:28 +08:00
yetone bc9ea912a5 contributors: 11-14 two of ggbdpq's patches needed the review again (#5452, #5197)
From the review of fee33668d, 7a9c40413 and 131037e2b. Docs only; nothing run.
2026-11-14 20:00:56 +08:00
yetone 7a9c40413b gateway: only a PDF goes as a translated file, with a filename (#5452)
Review of the commit before. It wrote a Messages `document` and a
Responses `input_file` for a file of any type. Anthropic's base64
document takes only a PDF, so a .docx or .csv that used to go as the
"[attachment …]" note would now get a 400 for the whole turn, the #934
risk. Both encoders now write the file only for application/pdf with
data. Any other file is still described in the note.

- The Responses input_file carries "filename": "document.pdf" beside
  file_data, as OpenAI's shape has it. Part has no field of its own for
  a file name: Name is a tool's, and is read in many places.
- A Messages document by URL is described in the note, not sent as a
  url source. A file reference from another vendor (Gemini's fileUri is
  an https Files-API link) is not something Anthropic should fetch.
- On the read side, a `document` with a text source carries the
  document's words, so it becomes a text part rather than base64 inline
  data. A base64 source is a file. A url source is a file reference.
  Anything else (a file_id source) is left out, as before.

Run on mica: TestOnlyAPDFGoesAsAFile, TestResponsesFileHasAFilename and
TestAnthropicDocumentTextAndURLSources fail at the commit before (a csv
sent as input_file, no filename, the text source not carried as text)
and pass here. The patch's own tests (pdf_translation_test.go,
image_input_test.go) fail with the product files at origin/main
d987cc7d5 (input_file and document dropped, the Chat file became the
note) and pass here.
Not tried: a real PDF through a ChatGPT API account or Anthropic
upstream.

Batch record (#5205, #5197, #5452), all on mote:
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) at the
  same four changes on d987cc7d5: every package ok except two.
  internal/cli's TestEveryRouteHasACommandOrIsNamed (POST
  /api/page-away) was fixed on main by 69946f43c. internal/plugin's
  TestGatewayHookSlowRecallUsesConfiguredBudget is #6019.
- Rebased on a63923e3d: go vet -tags nogui ./... on darwin, linux and
  windows ok. internal/gateway, claudetui, cli and plugin all ok.
- Rebased on 8769a5819, the pushed base: vet
  of gateway and claudetui on the three OSes ok, and the gateway
  -run 'Codex|PDF|Document|InputFile|ChatFile|Image|…' tests ok. That
  run was on a mote busy with other sessions' work (load ~120).
- Windows (xiaomi-gpu): see #5205's commit.
2026-11-14 19:46:12 +08:00
ggbdpq fee33668db gateway: a PDF survives translation (#5452)
A PDF reached the model only when the request was relayed as sent; the
moment magpie translated it, the file was lost — the Responses
input_file and the Messages document were dropped whole, and the Chat
file became the placeholder text "[attachment application/pdf]"
(#5452, NemoAir: three paths located line by line; a ChatGPT API
account speaks only Responses and only streams, so a Chat request to it
always translated and its file always became the note, and a
non-streaming Responses request to a stream-only account lost its
input_file while the same request streamed arrived whole).

The parts parse into file parts now — the Responses input_file (a
standalone item, its file_data and filename flat on the item, and a
message block, flat as the OpenAI shape has it or nested as a Chat
client sends) and the Messages document — and the Responses and
Messages encoders write inline data in their own tongue (input_file /
document), where Gemini's inline data already rode. A file only
referenced — a Gemini fileUri on the vendor's storage, or another
host's file id — is still told of: Responses' file_id is OpenAI's own,
Anthropic's url source takes http(s) and not a cloud-storage scheme,
and the Chat encoder keeps telling of the file rather than carrying it,
Chat upstreams' file support being uneven and a 400 there losing the
whole turn (#934). The Claude subscription line renders text to its
CLI, which carries no PDF either way.

Rebased onto the video work (#6135), which reads an input_file of a
video alone and left this face standing: a video rides the video
machinery still, and every other file — a PDF, say — is a file part.

Generated-by: GLM-5.3-Flash (ZCode)

Landed from @ggbdpq's patch on #5452, reported by NemoAir. The commit
after it scopes the change to PDFs.
2026-11-14 19:46:12 +08:00
NightGlowww 131037e2ba gateway: preserve Codex model-list OAuth alongside gateway keys
A managed x-api-key made identifyCaller overwrite Codex's valid ChatGPT
bearer with the internal token. /models then forwarded that token and
returned 401, losing the configured model metadata (#5197).

Keep the bearer privately only for the native model-list GET after key
validation. Restore it on a request copy used by both the model-list
cache and its upstream ask, removing gateway authentication fields.
Key-only requests remain refused; other routes keep normalization.

Verification on Go 1.27.3, macOS arm64, based on 17154e165:
- TestCodexModelsKeepOAuthBesideGatewayKey fails on the unmodified base
  with 401 invalid client sign-in, then passes with this fix.
- Four new test groups pass, including -race -count=20.
- Full nogui suite completed: 84 packages passed, 3 packages failed.
  Existing gateway JSONv2 parity (#3547, including a separate invalid
  UTF-8 sizing difference) and WSL probe (#3680) failures reproduced
  on unmodified base. GUI: core budget (#5139, reproduced on base),
  lane-test isolation (#5150), system-proxy isolation (#2562).
  Plugin git-update tests failed with PATH Bun 1.3.14 on base and patch,
  then passed with bundled Bun 1.4.4. Existing issue patches reviewed;
  separate fixes are not bundled into this OAuth change.
  TestRemoveServerDropsItsIcon skipped: user forbids Playwright setup.
  The full suite is not claimed green.
- gofmt -l and git diff --check are clean.
- macOS, Linux (nogui), Windows: go vet ./... and go build pass.
- Isolated patched Server.Front plus a real OAuth and fresh gateway key:
  GET /models returns 200 and Astra's native 272000/max 872000 entry.
  The explicit 872000 override is checked by the regression fixture.

Tests isolate HOME and pin Go caches. No production replacement or
inference probe; no Linux/Windows runtime or GUI/Playwright run.

Landed from @ggbdpq's verification on #5197. The review dropped the
patch's change to the Codex model-list bullet in gateway-routing.md: it
put back an older text (provider.CodexListed, without CodexListedBeside
and keyListed/GroupStandIns). main's bullet is kept as it is, and only
the new paragraph is added.

Run at this commit's tree on mica: with codex_backend.go and lan.go at
origin/main d987cc7d5 and the new test file kept, all four tests fail
(TestCodexModelsKeepOAuthBesideGatewayKey: 401 "invalid client sign-in";
TestCodexModelsGatewayKeyIsNotOAuth: 200 where a local 401 is wanted;
TestCodexModelsOAuthStillNeedsAnEnabledGatewayKey;
TestCodexModelsCacheUsesClientOAuth). With the change they pass. Full
suite: see the batch's last commit.
Not tried: a real Codex app beside a gateway key.
2026-11-14 19:46:12 +08:00
SkyJiashu a49f3745eb claudetui: use a conpty folder beside the executable before Windows' own ConPTY
Windows 10's conhost (10.0.19041) drops bracketed paste marks, so Claude Code
takes a long message as many pastes and submits only part of it (#5205).
Windows Terminal's conpty.dll with its OpenConsole.exe keeps them. When
<exe dir>/conpty holds both, CreatePseudoConsole and ClosePseudoConsole come
from it; otherwise from kernel32 as before, so nothing changes for anyone who
does not add the folder.

Landed from @ggbdpq's verification on #5205. It's opt-in: without
<exe dir>\conpty\{conpty.dll,OpenConsole.exe}, both calls still come
from kernel32. The red/green evidence is the thread's: two Windows 10
machines (19044, 19045) with Terminal's ConPTY 1.24/1.25 passed 1 to
217 KB pastes intact, and lost them with conhost 10.0.19041.

Run on xiaomi-gpu (Windows 11, no conpty folder, so the kernel32 path):
go vet ./internal/claudetui ok, go build -tags nogui ok, go test
./internal/claudetui: every test passes except
TestShimFirstMessageWaitsForTools, which fails the same way at
origin/main d987cc7d5 (-count=2, "the shim wrote 0 lines of 3 in
30s") and is #4810.
Not tried: Windows 10, and the conpty folder on this machine. Shipping
the pair with magpie so Windows 10 users need no setup is left for a
later change.
2026-11-14 19:46:12 +08:00
yetone 8769a5819a gateway: a rest ends at the time it shows, after the Mac slept (plugins#1126)
A rest's end came from time.Now().Add(d), which carries Go's monotonic
reading, and restOf and Retry-After compared by it. On macOS that clock
stops while the computer sleeps, so a WorkBuddy AI rest to 00:40 still
held at 09:57 the next day: 17h22m past its end, against 17h26m of
sleep in pmset's log over the same span (Xiang-Player's measurements).

onWall drops the monotonic reading. It is applied where magpie keeps a
deadline for minutes to days: the three places a rest's end is set
(restAfterMarked, restSlow, restDrawer), Codex's held refusal, Claude's
quota shelf, a Codex window's reset and a search key's rest. Shorter
waits (a request's patience, ten-minute shuns) are left as they are; a
sleep can only stretch them by their own length.

TestRestsKeepTheWallClock records a rest through the quota and 500
paths, a slow start and a search key, and checks none counts on the
monotonic clock.

Run on mica at this tree: go vet ./internal/gateway (darwin, linux,
windows); go test ./internal/gateway -count=1 -timeout 45m: ok (883s).
Broken by hand: onWall returning t unchanged turns the test red on all
four paths.
Not tried: a real Mac sleeping past a rest; a test can't sleep the
machine.

At the pushed head (rebased on 42cc55701, which adds internal/provider/quota_shown.go): go vet ./internal/gateway ./internal/provider and go test ./internal/gateway -run "Rest|TestOneRequestDoesNotClimbTheBackoff": ok.
2026-11-14 19:44:23 +08:00
yetone 42cc557015 library: an agent's profile id (claude#magpie-desktop) is an agent's id on every route
@AXmake110 on X: on Library > Claude plugins, clicking the chip of a
Claude Code config folder (claude#magpie-desktop) answered
`agent "claude#magpie-desktop": not an agent's id`, so the plugin
couldn't be turned off for it. The page draws a chip for each profile
agent (claude#, hermes#, omp#), and the library already writes skills,
MCP servers and instructions to them (targets.go), but checkAgent took
only name or name@wsl:distro.

checkAgent is the one place an agent id is validated in the library.
It now takes name[#profile][@wsl:distro], the profile a plain file name
like a distro's. That fixes each route through it: plugins/agents
(PluginAgents), an agent's own instructions (SaveInstructions Extra,
setup.go's extras), skills/how (SetSkillHow) and carry.go's import.
The other chip routes (skills, servers, hooks, env, subagents agents)
never called it and already took profile ids. No GUI change.

Run on mica (mote at load ~130):
- TestLibraryTakesAProfilesAgentID (new): with origin/main's
  library.go put back it FAILs at the plugin's off for the profile with
  `agent "claude#magpie-desktop": not an agent's id`; passes with the
  change. It also checks bad ids (claude#, #work, claude#../x,
  claude#a/b, claude#a#b, claude#.x) are still refused.
- gofmt -l internal/library: nothing; go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: ok.
- go test -tags nogui ./internal/library ./internal/gui -count=1: ok.

Not run: the full go test ./... (mica had another session's gateway
run and GUI suite going), the GUI suite (no GUI file changed), a real
Claude Desktop profile.

Run at base 534b1a334, then rebased onto 1ab2c3984 (tray/usage files only, nothing in internal/library).
2026-11-14 19:41:53 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

- The menu bar's cells, its tooltip and Windows' tray figure still showed a
  hidden card and its hidden rows. trayUsageCards now goes through
  trayShown: a cell naming an account takes the card the Overview still
  shows (its balance with its plan hidden), a cell following the account
  in use (`|*`) picks that account among every card as before and is left
  empty while its card is hidden, never moved to another account. Hidden
  rows are left out, a card never left with none. settings.TrayUsages is
  untouched, so the cell comes back with the card.
- POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when
  cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at
  once rather than at the next tick (3 minutes by default).
- The panel hid a card after keyCards had put a key's balance on its plan's
  card, so "Hide its balance from Overview" left the balance on the panel's
  plan card, and a hidden plan took its unhidden balance with it.
  panelPageCut now takes the quotas as read and leaves the hidden out before
  keyCards, as overviewCards does; gone counts a merged card hidden only
  when its plan and balance both are.

The Go hide rule (cardHideKey/usageShown) moved from internal/tui to
internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown,
QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's
daily push still warns about a near-limit hidden card (an alert, not a
display). Docs: settings.go comments, docs/subsystems/gui-shell.md.

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 534b1a334e lessons: 11-14 two changes pushed before their own suite, at a coordinator's ask
Recorded from the review of 32c830fc1 and 106a24b95. Docs only; nothing run.
2026-11-14 19:29:46 +08:00
yetone 61e2035d39 gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed
windows-check (amd64 and arm64) at "Launch magpie": the exe logged
"magpie 0.1.4166 started (app, ...)" and the gateway never answered, so
none of those versions has assets.

Cause: 14807bcf2 made a copy still named as the site's download
(magpie-windows-amd64.exe) a download wherever it is kept, asked about
through the install dialog. The release check starts
dist\magpie-windows-amd64.exe, so update.Settle now put up the task
dialog. The question comes before anything starts in gui.Run, the
gateway included (Install opens the installed copy in this one's place),
and on the runner no one answers it, so the app waited on it forever.

Now askInstallFolder leaves update.AskFolder unset when no one can
answer (unanswerable): CI set, as every CI service sets it (GitHub's
CI=true), or a window station no one sees (a service, a start over
SSH; GetUserObjectInformation UOI_FLAGS without WSF_VISIBLE). Unasked,
a copy kept outside Downloads runs where it is with nothing recorded
(isDownload's existing ask=false rule), and one in Downloads installs
to the default as it did with no dialog. A person's start on their own
desktop is asked as 14807bcf2 has it. The gateway can't start before
the answer instead: Install forwards to the installed copy and this one
quits, so its gateway would have to be handed over first.

Also fixes #6648: TestSettleAsksAboutADownloadKeptElsewhere expected
forwards() true on every OS, but forwarding is Windows' alone (as its
sibling checks at install_test.go:382/452 already say), so it was red
on Linux and macOS since 14807bcf2.

Tests: TestNoInstallQuestionOnCI (Windows: CI=true leaves AskFolder
nil) and TestInstallQuestionNeedsSomeoneToAnswer (any OS).

Run:
- Reproduced on xiaomi-gpu (Windows 11) as the CI step does it: the exe
  built with go-winres's manifest (so the task dialog exists), named
  dist\magpie-windows-amd64.exe, started `app` with CI=true in the
  logged-in console session (session 1, through a schtasks /it task),
  sandbox USERPROFILE/LOCALAPPDATA/APPDATA/TEMP, MAGPIE_ADDR on a port
  of its own, polling /v1/models 30x2s. At ee6352b63: RED, "the gateway
  never answered", nothing after the start line. With this change:
  GREEN, "install: not asking where to install: CI=true", gateway
  answered, still up 5s later, nothing installed.
- Over SSH (session 0) with CI unset: the question is skipped ("no one
  sees this desktop"); the app then exits on WebView2's controller
  there (no desktop), which is that session's, not this change's.
- Broken by hand: askInstallFolder reading another variable ->
  TestNoInstallQuestionOnCI red ("asks where to install with CI=true").
- win-run go test -count=1 -run 'TestNoInstallQuestionOnCI|
  TestInstallQuestionNeedsSomeoneToAnswer|TestInstallWords' -v
  ./internal/gui/: ok.
- wsl-run go test -tags nogui -count=1 ./internal/update/ (magpie-desktop,
  Ubuntu 24.04): ok (#6648's red gone).
- mica-run: gofmt -l internal/ clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui ./internal/update/ ./internal/gui/ clean; darwin go
  vet clean.
- win-run go test -count=1 ./internal/update/: ok except
  TestPackagedByDpkg (#4603, open, untouched).
- mica-run go test -count=1 ./internal/update/ (macOS): ok.

Not run before the push: the full suite (mote at load 144) and the
whole ./internal/gui package (running on xiaomi-gpu and mica at push;
the release blocker didn't wait for it). Not tried: a real person's double-click from D:\下载 after this
change (the dialog path itself is unchanged).
2026-11-14 19:28:21 +08:00
yetone ee6352b638 gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme:
「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of
the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots:
black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29),
card (31,30,36), the grey of Graphite's.

Why (appearance.go ground()):
- the dark grounds went down by the same amount on every channel, so
  app.css's cool grey cast stayed: black's page was #000003, its card
  #08080c, a blue-black next to Chrome's #000000;
- how dark a pick is was its mean channel against the page's. #191047's
  mean (37) is above the page's (27), so a deep navy counted as light
  and only got a breath of hue (0.08): the same grey page as Graphite.

What changes:
- darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is
  0.44, every preset 0.51 or more) is how far the dark grounds go
  toward black; 1 for black. #191047 is 0.23, so 0.43.
- as a ground goes down it loses the grey's cool cast by as much, and
  takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page
  is #000000 with neutral steps above it (card #090909); navy's page is
  a near-black navy.
- Graphite, the presets, colours lighter than 0.4 and the light theme
  are unchanged; lifted() (where the ink starts) is unchanged.

Measured (Settings > General zh, dark, 1200px; screenshot pixels, the
same in Chromium and WebKit), before -> after:
- black: page #000003 -> #000000, card #08080c -> #090909
- #191047: page #191821 -> #0c0b17, card #22212a -> #151420
- #130830: page #17161e -> #0b0813, card #201f27 -> #14111c
- Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged

Tests:
- TestDarkPickDarkensPage: black's grounds are neutral greys; three
  dark blues draw a darker, blue page with text >= 7:1 and the accent
  >= 4.4:1; Graphite and the presets have darkness 0.
- TestBlackIsBlack: black's page is #000000 exactly.
- appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a
  dark navy page with Settings' list on its card (dark), and keeps the
  light page's lightness (light). Fixture gains #191047.

Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB
free), at this change on origin/main dbac411b2:
- gofmt -l internal/gui clean; go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gui: ok (112s).
- Whole GUI suite (node --test internal/gui/tests/*.test.cjs, both
  engines, every language): cut short at 8650 of ~8700 results to push
  (coordinator); 8279 ok, 371 not ok. appearance-look 20/20 here and
  every accent, look and Settings case ok. Reds outside this change
  (accounts, keys, Check in, quick panel shortcut, gateway card, under
  the box's load); api-key-theme (#6444) and omarchy (#6027) are the
  reds named on origin/main by 90ad90646. Not rerun on a base copy.
- Broken by hand: with the old ground(), TestBlackIsBlack and
  TestDarkPickDarkensPage are red (#000003, blue-grey grounds), and
  appearance-look's dark case is red in both engines ("black's page is
  black").

Not tried: the real macOS app, WebView2, WebKitGTK; the full Go suite;
the GUI reds' base comparison.
2026-11-14 19:10:06 +08:00
yetone 106a24b95e library: skills from GitHub and git update by themselves when switched on
0xYaCo on X: "skill 能自动化升级吗?". magpie already checked for skill
updates by itself (every 12h, as the Skills tab opens), but each update
waited for a click on Update. A new switch, Update by themselves, sits
under the Skills list while a skill comes from GitHub or git
(POST /api/library/skills/auto-update; `magpie library skill auto-update
on|off`; library.json's autoUpdateSkills, this computer's own). It is off
by default. When it is on, KeepSkillsCurrent (a gateway.WhileServing loop)
runs AutoUpdateTick 2 minutes after start and then hourly. Every 12h that
runs CheckSkills, then UpdateSomeSkills on the skills found at "update".
So a skill changed here stays in Unupdated with its Update button, one
removed upstream is only marked, and a replaced edited version goes to the
backups, as with an update by hand. Updated names and a new error are
logged.

Run (WSL2 magpie-desktop, Go 1.26.8; mote was at load 167, mica's disk full),
at ab637d3c4 (this change on 14807bcf2):
- TestAutoUpdateSkills (local git repo fixture, no network) ok.
  Broken by hand (switch and due checks removed): FAIL
  "off: ... Updated:[pdf] ... notes "two"". Restored: ok.
- -race -count=5 TestAutoUpdateSkills|TestInstallFromGitRepo: ok
- gofmt -l: clean; go vet -tags nogui ./... ok; GOOS=windows go vet ./...
  ok; go build -tags nogui, GOOS=windows go build ok
- go test -tags nogui -timeout 45m ./... under a temp HOME: every
  package ok except two reds in untouched packages, each also red alone
  at origin/main 659ca3f02: internal/update
  TestSettleAsksAboutADownloadKeptElsewhere (filed #6648) and
  internal/usage TestRequestStateKeptAcrossACatalogFetchedAgain (#6572).
- GUI: skill-auto-update.test.cjs (en, zh, zh-TW, ja, de; 400px wide;
  Chromium and WebKit), i18n-keys, i18n-en-no-cjk, skill-update-feedback
  and skill-update-edited: 36/36 pass.
Not run: the whole GUI suite had started but not finished at push
(pushed at the coordinator's ask), and nothing was run at the rebased head
e0e8f34a7 (its parents touch lessons/update only). No darwin vet: the
cgo-off cross vet fails in gui's traywindows_darwin_test.go on main too.
Not tried with a real GitHub skill in a live magpie.
2026-11-14 19:09:55 +08:00
yetone 32c830fc16 tui: speaks the language picked in Settings, Simplified Chinese first
zaidu259434 on X asked why magpie's CLI/TUI pages don't support Chinese.
The GUI had en/zh/zh-TW/ja/de; the TUI had English only.

- internal/uilang: the language pick the tray already made (the
  setting, else the system's: zh-Hant regions to zh-TW, other zh to zh,
  ja, de) moved out of internal/gui so the TUI asks the same function.
  The tray calls it unchanged; its tests moved with it.
- internal/tui/i18n.go: tr/trf look a string up by its English text in
  a zh table (464 entries), falling back to the English. zh-TW reads
  Simplified for now; ja and de stay English. Terms come from the GUI's
  i18n.js where the same word is there (供应商, 路由, 用量, 会话, 资源库,
  分组, 方案 …).
- Every user-visible string in the TUI goes through tr/trf; widths that
  counted runes (Library's name column, sessions' columns) use
  lipgloss.Width, so 共享指令 is no longer cut to 共….
- Names stay names: agent and model ids, flags, commands, and the field
  labels magpie/ultracode/harness/opus/sonnet/haiku/fable.

TestEveryWordHasZh reads the TUI's source (every tr/trf literal, every
hints label, the tables shown through tr, agent field labels) and fails
on a word with no zh, on a zh format that takes the English one's
arguments badly, and on a zh entry no longer shown.

Not changed: the CLI's own output is still English (#6649).

Run:
- mica (macOS): go vet ./internal/uilang ./internal/gui ./internal/tui;
  go test -count=1 -timeout 45m ./... was still running when this
  was pushed (pushed on the coordinator's ask); its result goes on #6649.
- wsl-run (Linux): go vet + go test ./internal/tui ./internal/uilang ok;
  GOOS=windows go vet ./internal/uilang ./internal/gui ./internal/tui ok;
  GOOS=darwin CGO_ENABLED=0 go vet ./internal/uilang ./internal/tui ok.
- Real TUI (go build -tags nogui) in WSL magpie-desktop, sandbox HOME
  with settings.json {"lang":"zh"}, tmux 150x40: every page (Agents,
  Providers, Routing, Usage, Sessions, Library), the add-provider
  picker, sessions stats, the gateway line and footers read in Chinese.
  The Library row showed 共… before the lipgloss.Width fix, 共享指令 after.
- Broken by hand: an added tr("zzz untranslated") and a zh format with
  its %s dropped each turned TestEveryWordHasZh red.

Not tried: zh-TW, ja and de wording (they fall back as above); the TUI
on Windows' console.
2026-11-14 19:09:43 +08:00
yetone 21f8ef61c4 provider: a complete Qwen AI platform sign-in is taken, and no sign-in error quotes a token (@imthe99galaxy on X)
On v0.1.4159 the Qwen AI platform's sign-in (qwen-token-plan) was
approved, and magpie failed it with "the Qwen AI platform answered in a
form magpie doesn't know: {"Data":{"Status":"complete","Credentials":
{"User":{"Id":"…"},"ExpireTime":"…","AccessToken":"RACv…"…". Two bugs:

1. qianwenWait decoded the device/token reply into a struct.
   encoding/json matches a name whatever its case and fails the whole
   reply on a value of another type (a number Id, an accessToken or user
   field beside AccessToken/User, a BOM), where the QianWen CLI 1.10.0
   (ul and ll in @qianwenai/qianwen-cli's dist/bin/qianwen.js, read from
   the npm tarball) looks up the names it wants and ignores the rest.
   readQianwenReply now reads it as the CLI does: Data.Status ?? status
   ?? authorization_pending; Data.Credentials.AccessToken ??
   credentials.access_token; ExpireTime ?? expire_time; User{Id, Email}
   ?? user{id, email}; by exact name, a value of a type it doesn't expect
   taken as absent. A RefreshToken is ignored, present or not: the CLI
   has no refresh, the user signs in again when the token runs out.
   The reporter's reply was quoted only to its first 300 characters, so
   which field failed it is not known; every type and case mismatch
   that could is covered, and the CLI's other (lowercase) form is read.

2. The error quoted the reply, live access token included, and the user
   posted it publicly. QuotedReply (quoted_reply.go) scrubs a reply
   before it is quoted (redact.ScrubJSON: a field named for a secret
   wholly, a key-shaped value anywhere). The class:
   - volcHead, every Volcengine / Alibaba Cloud / Tencent Cloud / Qwen
     AI platform error that quotes a reply, the Qwen sign-in's and its
     console token mint's ("gave no token") among them;
   - apiError's fallback for a body of no known shape (APIError, every
     upstream refusal and token endpoint that uses it);
   - Copilot Auto's "picked no model" (its reply carries session_token);
   - mcpauth's dynamic client registration failure (may carry a
     client_secret; it was quoted whole and unbounded, now cut at 300);
   - signInFlow.finish, where every built-in and plugin sign-in ends:
     its Error goes through redact.Scrub, so a plugin's or vendor's
     error text quoting a token leaves it there; the Qwen flow's own
     failure likewise.

Tests (internal/provider/qianwen_plan_test.go):
- TestQianwenSignInReadsEveryCompleteForm: the reporter's head with and
  without a RefreshToken, a number Id/ExpireTime, a like-named field of
  another type, the CLI's lowercase form, a BOM. Red on the old code
  (3 forms failed with the reporter's message, the lowercase one never
  ended), green now.
- TestQianwenErrorsQuoteNoToken: unreadable replies' errors, volcHead,
  APIError and QuotedReply never hold the token, and still say the
  words of a plain error (Throttling, RequestId). Red on the old code
  (sign-in errors and 8 quotes held it).
- TestSignInFailureQuotesNoToken: finish's Error. Red with the Scrub
  line taken out by hand, green with it.

Run:
- on magpie-desktop (WSL, mote's load was over 40 to 135) at this tree:
  gofmt -l clean; go vet -tags nogui and GOOS=windows go vet on
  internal/provider and internal/mcpauth ok;
  go test -run 'Qianwen|SignInFailure|SignIn|APIError|Volc|Alibaba|
  Tencent|CopilotAuto' ./internal/provider ./internal/mcpauth: ok.
- Full go test -tags nogui -timeout 45m ./... was started there at this
  tree and was still running at push (pushed on the coordinator's ask);
  its result goes in a follow-up note.

Not tried: a real sign-in to the Qwen AI platform. The owner's browser
has no platform session (it asks for a phone sign-in), so the complete
reply's tail past the reporter's 300 characters was not seen; a live
device/code + device/token poll answered as the fake does
({"Data":{"Status":"authorization_pending"},"RequestId":…,"Success":true}).
darwin go vet: mote's load was over 100 for the whole run; the files
have no darwin-only code, and linux and windows vet are ok.
2026-11-14 19:09:35 +08:00
yetone 7a69f455cb lessons: 11-14 the updater shipped on chosen packages while both run boxes were busy 2026-11-14 18:56:57 +08:00
yetone 39e33f46f7 provider: ZCode's mover min is 0.1.66, which keeps a gift-only account's requests on its free quota (bg5eau on X)
bg5eau saw ZCode's free grant stay unspent while pay-as-you-go was
charged. Two routes in the plugin could do that for an account with no
GLM Coding Plan: a model the Start Plan balance doesn't name was still
sent on the Start Plan, where it is metered, and a plan-list read that
failed sent the key to the coding plan's /api/anthropic host, which bills
a key with no plan pay-as-you-go. 0.1.66 (plugins 87a8cf03) refuses the
first with a 400 that names the models the gift serves, and keeps such
an account on the Start Plan when the plan list doesn't read. It also
carries 0.1.65 (plugins 1dbbc1fb): a -Trial pick with no gift names the
weekend plan ZCode holds unclaimed, which only ZCode's app can claim
behind its captcha (heduian, bg5eau on X). The min makes
keepMovedCurrent update every moved user.

Run: npm view --prefer-online shows 0.1.66; on mote (load ~150; mica's
disk is full), go test -tags nogui -run 'Moved|Mover|Migrat|ZCode'
./internal/provider ok; gofmt clean. Plugin at 87a8cf03: packages/zcode
bun test 271 pass, 0 fail; bun scripts/check.mjs zcode ok; the
unnamed-model test red with the guard off, the stays-on-Start-Plan test
red with the catch change off.
Not tried: a real gift-only account, a real pay-as-you-go charge, a real
weekend plan claim, Windows and Linux, a full go test ./... before the
tag. Which of the two routes bg5eau hit is unknown (no request log).
2026-11-14 18:55:44 +08:00
yetone ed82d8fab1 agent: a plugin's connect is given magpie's decision models as decisionModels
An agent plugin's connect() got only chat models in `models`, and
/v1/models leaves decision models out too, so a plugin had no way to
learn magpie's Jev, Clef or plugin `decides` models, though
/v1/systemone and /v1/decisions answer them (baranwang on X,
tweet 2121551068022915149).

connect's input now has `decisionModels`, apart from `models`:
provider.OfferedDeciders (what /v1/models lists under
X-Magpie-Deciders), then the decision routing groups, each
{ id, name, provider | group: true,
  endpoints: ["/v1/systemone", "/v1/decisions"] }, [] for none.
`models` and /v1/models are unchanged. Docs: reference.md,
agent-wiring.md, site plugins page (en, zh, ja) and llms-full.txt.

Run at 87f358b70's tree rebased on 659ca3f02 (a gateway-only parent; the
plugged tests re-run there: ok), on wsl-run, magpie-desktop; mote was at load 75-150, mica's disk full):
- go test -tags nogui -count=1 ./internal/agent ./internal/agentplug: ok
  (agent 191s)
- go vet (linux), GOOS=windows and GOOS=darwin go vet of both: ok
- site: node --test worker.test.mjs -n llms-full: ok
- gofmt -l: clean
Broken by hand: connect given decisionModels [] makes
TestPluggedConnectSeesDecisionModels red (jev and the group missing).
Not run: the full go test ./... before the tag (another session's full
suite held the WSL box, mote over its load); run after, recorded on
the issue/next commit. No real third-party agent plugin tried with it.
2026-11-14 18:55:12 +08:00
yetone 659ca3f026 gateway: through a Remote magpie the log records the tier the other magpie sent (JackyFill on X)
Codex -> magpie1 -> (Remote magpie) -> magpie2 -> a ChatGPT account, with
Fast on in magpie2 alone: magpie2 sent service_tier priority and logged
the served tier unknown (the ChatGPT backend says "auto"/"default"
whether priority ran or not, servedTierAt). magpie1 only saw that
"default" in the relayed body, from a host that isn't chatgpt.com, and
logged tier_sent "" and tier_served "default".

A try asked by another magpie (magpieAsks) now says on its reply's
header the tier it sent its vendor (X-Magpie-Tier-Sent, "none" for
none) and, when that vendor's "auto"/"default" tell nothing,
X-Magpie-Tier-Unsaid: 1 (stampTier, from holdWriter.writeHeader). The
asking magpie takes them from a Remote magpie's reply alone (tierThere
in heardReply; a vendor's X-Magpie- headers are still never passed) and
records them as the try's tier_sent and an unknown tier_served, in the
usage log and on the route. A chain passes the farthest magpie's on.
docs/subsystems/gateway-routing.md says so.

Run (wsl-run, Linux, at this head): new TestRemoteMagpieTierRecorded
(one server as both magpies, its key's tier fast then standard, the
backend answering auto/default) green; broken by hand: with the four
source files at origin/main it fails with exactly the report, "sent ''
served 'default', want sent 'priority'"; the whole internal/gateway package ok (932s, -timeout 45m) at
5a28b17c6 (on origin/main 943404477); go vet ./internal/gateway for
linux, windows and darwin clean; gofmt clean.
Rebased after onto 9f4e1120f (agent, provider, gui only; no internal/gateway
file) and run again there: the new test, the tier and remote-group tests
and vet of internal/gateway ok.

Not covered: a reply whose headers a keepalive sent before the try
answered carries neither header, and magpie1 keeps its own record.
Not tried: two real computers or a real ChatGPT account; the full
./... suite; the Windows box.
2026-11-14 18:47:33 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

Cause: Sync's `failover` in codex.go wrote
`openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash
codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the
gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with
another of its accounts on (#1385), on every start and Sync, unless the
user had disconnected Codex or turned on "Only switch Codex's sign-in".
The row said not connected while every request went through magpie.

Fix: failover writes nothing any more. A Codex that isn't wired or
using magpie as its provider gets what failover wrote before taken out
by Sync: the marked base URL, or the mirror's base_url. A base URL the
user wrote by hand has no mark and stays (#856). Failover between Codex
accounts comes with connecting Codex. modelOptions no longer counts
failover as through magpie, so a pick of Codex's own model on the
Agents page doesn't go via magpie. codexProxyOK (the proxy probe only
failover waited for) is gone. The CLI's and GUI's switch-only lines,
reference.md and the subsystem pages say failover is for a connected
Codex.

Users already affected: the first Sync after updating (magpie's start)
removes the marked openai_base_url or mirror base_url, and the route
change restarts Codex's app-server; Codex then goes straight to OpenAI
on its own sign-in. A thread opened while it was on magpie keeps its
provider until reopened, as after Disconnect.

Tests:
- TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex
  not connected; SyncCatalog, Sync twice and a model pick leave no
  base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly.
- TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked
  mirror base_url from before are taken out, bytes restored exactly.
- TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror,
  disconnect-stays and proxy/EndFailover tests reworked to seed the
  old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn
  deleted with codexProxyOK.

Red on the old code (old codex.go + codex_proxy.go, new tests, mote):
TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut
and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's
line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`;
TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at
magpie.

Run (mote; mica's disk is full, 100% with other sessions' runs, and
mote's load was ~17-25 of 18):
- At base b592c1fde: go vet ./... (darwin, GOOS=linux, GOOS=windows)
  ok; go test -timeout 45m ./... 98 ok, two reds:
  TestEveryRouteHasACommandOrIsNamed (fixed on main by 69946f43c) and
  TestCoreScriptBudget, mine (+24 bytes) - the GUI string was shortened
  to fit, no raise.
- Rebased on a63923e3d (what main changed since the base: agent, cli,
  gateway, gui, provider, sessions): gofmt -l clean; go test
  ./internal/agent ./internal/cli ./internal/gui ./internal/provider
  ./internal/sessions all ok. Then rebased on 943404477 (GUI tests
  only below run there).
- GUI (chromium + webkit, every language, both widths): switch-only,
  agent-failover, i18n-keys, i18n-en-no-cjk, claude-switch-only,
  panel-switch-accounts: 115 of 116; the red is claude-switch-only
  chromium 1100 en "the page doesn't move" (scrollTop 3), 4 of 12
  alone here, 0 of 9 on origin/main 943404477, on a path this change
  doesn't touch; filed as #6645 with its output. agent-switch-accounts is 20 of 24
  red the same on a fresh origin/main 69946f43c (#5925, Claude Code
  path, untouched here).

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone fc7941ca60 antigravity: Gemini 4's late INVALID_ARGUMENT is asked again, and says it isn't a region block; min 0.1.14 (Lawson0112 on X)
Lawson0112 (v0.1.4152, Windows, Codex) saw every request to
antigravity/gemini-4-hydrogen end "400 · failed, 2 tries" after 20-38s
and asked whether it was a region block. It isn't: Google refuses a
region at once with FAILED_PRECONDITION "User location is not
supported..." (regionWords). A 400 after the model has thought is Gemini
4's late INVALID_ARGUMENT, which Code Assist writes as a bare JSON line
with no "data:" (sse_bare.go). The plugin's quiet retry read only data
lines, so it never ran for the real reply.

Antigravity 0.1.14 (plugins 2596d259) reads the bare line, asks again
as it meant to, and words an INVALID_ARGUMENT that stays as "<model>
turned down a call it built while thinking, asked N times (Google: ...).
Not a region or account refusal". The mover's min goes to 0.1.14 so
every moved user gets it (dist index: 0.1.14 latest, 10:34:14Z).

Run: go test ./internal/provider in WSL (magpie-desktop) at this tree:
ok 125s. gofmt -l clean. mote was at load 150-180 and mica's disk full.
Not tried: Gemini 4 itself; no account here is served it (gemini-4-*
listed -disabled, 404). See the plugins commit for the rest.
2026-11-14 18:34:44 +08:00
yetone 9434044773 update: Restart to update puts in the version already downloaded, with downloads on a click too
sakamotokurome on X: "重启能不能跟更新分开,我本来下载一个新版本了,点击restart,
结果它又跑去下载了". With Settings' "Download updates automatically" off, a
version downloaded on a click (Download update) was not what Restart to
update put in: the click's recheck asked the feed first and, magpie having
released again since, downloaded the newer version whole while the user
waited (keepsStaged kept the one waiting only with downloads automatic,
b05a525a3, or for 5 minutes after a restart's own download, elis_pina).
The same held for the tray's Restart to Update and a click's restart that
waited for the gateway to be idle. It is the same code on macOS, Windows
and Linux (internal/gui/update.go); only the install step differs by OS.

Now a version downloaded and waiting is what every restart goes into, as
it is, however it was downloaded, and the feed isn't asked: keepsStaged is
"ready with something staged". The new version's first check, seconds
after it starts, finds whatever is newer, as with downloads automatic.
The feed is still asked first when nothing is staged (another magpie put
the update in), and a click on Download update (state found) still checks
and downloads the newest, so coeo91's "the click takes the newest, not the
last check's" holds for the download; it no longer replaces a download
already made. The notes dialog's freshen keeps the one waiting in both
modes, so it names the version the restart goes into. restartStaged and
forRestart are gone with the 5-minute rule they served.

Tests (internal/gui, fake feed, sandbox HOME, no network):
- new TestRestartPutsInTheClickedDownload: the reporter's sequence (downloads
  on a click, Download update, 0.1.12 released, Restart): the page's click,
  the tray's, a click's idle wait and the dialog all go into 0.1.11, one
  download, the feed not asked. Red on origin/main dbac411b2: "the page's
  click: {State:ready ... Latest:0.1.12}".
- changed to the new rule: TestRestartClickTakesTheNewest (now the found ->
  Download click takes the newest, then Restart downloads nothing),
  TestRestartWaitsForTheFeed (nothing staged), TestRestartAfterItsDownload
  DoesNotAskAgain (no restart asks), TestUpdateStagedGivesWayToNewer (a
  restart's recheck keeps it; Settings' Check takes the newer),
  TestRestartWhenIdleIntoTheNewest -> TestRestartWhenIdleIntoTheWaiting.
  TestTrayRestartTakesTheNewest is removed: its case is the opposite of
  this fix, and the tray is covered by the new test.

Run at this tree:
- mote (macOS 27): go test ./internal/gui -count=1 (whole package) ok at
  this commit rebased on a63923e3d; the update tests -count=3 ok; go vet ./internal/gui,
  GOOS=linux go vet -tags nogui ./internal/gui, GOOS=windows go vet
  ./internal/gui ok; gofmt -l internal/gui empty.
- xiaomi-gpu (Windows 11, win-run) and magpie-desktop (WSL Ubuntu, wsl-run,
  -tags nogui): the update/restart tests ok.

Not run: the full go test ./... suite (mote was at load 142 with another
session's suite running, mica's disk full). Not tried: a real restart of a
real build into a downloaded update; the restart path after keepsStaged is
unchanged.
2026-11-14 18:23:16 +08:00
yetone 14807bcf20 update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.

Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).

Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.

The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.

Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.

Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
  ./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
  uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
  gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
  untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
  TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
  (settle = "" want the installed; declined ""); the decline record
  ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
  and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
  (magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
  root guards, the new pattern included): ok.

Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.
2026-11-14 18:20:53 +08:00
yetone a63923e3dd lessons: 11-14 a third guard left red by chosen packages (80a315a70, route parity) 2026-11-14 18:11:31 +08:00
yetone dbac411b2e gui: TestRestartedWindowIsDrawn puts the other app in front as the user would
The behind and cover cases start a WinForms window as "the app the user
is in" and wait 20 s for it to hold the foreground. Windows lets it take
the front only while the test's old magpie may give it away, and that
depends on what held the foreground before it: run alone on the Windows
box at d987cc7d5, quiet-behind failed with "old: the other app never
came to the front" after the asked case's window had the front, and in
a whole-package run three other behind/cover cases did. The restart
under test never ran in them.

Now, from a second on, the old process presses F15 (a key nothing
answers) and brings the form to the front, as the user's own press and
click would; input this process sent is what lets it give the
foreground away.

Run on the Windows box, interactive session: the whole test (13 cases)
at d987cc7d5 with this change, 13 of 13 green (1 red without it); at
this tree with the no-attention change below it, 13 of 13 green, twice (4 red
without it: quiet-behind, quiet-behind-max, quiet-cover,
quiet-cover-max, all at the same setup step).
2026-11-14 18:02:33 +08:00
yetone ffb14c8260 gui: a restart by itself asks Windows for no attention (shangyuan0818 on X)
shangyuan0818 on X (Windows, AutoRestart and auto-update on, lightweight
mode off): magpie's window turned up on the taskbar by itself, its
button flashing orange, while they were in another app.

The cause: Wails (v3.0.0-beta.24) activates every window as it makes
it, hidden ones too. The panel's frame change (Frameless, run() in
webview_window_windows.go) and the main window's centring
(CenterWindow) are SetWindowPos calls without SWP_NOACTIVATE. The new
magpie a restart by itself starts runs in the background and may not
take the foreground, and Windows answers that ask by flashing the
window's taskbar button (HSHELL_FLASH) until it is clicked. Where it
may (nobody at the keyboard for a while), a hidden magpie window took
the keyboard from the app in front instead. The main window was then
shown with SW_SHOW, which activates it again, and a minimised one with
SetWindowPlacement(SW_SHOWMINNOACTIVE), which activates it all the
same.

Now a WH_CBT hook on Wails' main thread (noactivate_windows.go, put on
from appWndProc, which every WailsWebviewWindow message passes) turns
down HCBT_ACTIVATE for a magpie window that isn't shown, and for one
being shown quietly: showHere without focus (showQuietly) and
showMinimised. The tray's message-only window and Wails' disabled
main-thread window share the class and are left alone. A window the
user opens is shown and focused as before. Adding SWP_NOACTIVATE to the
moves' WINDOWPOS in WM_WINDOWPOSCHANGING doesn't stop the activation
(tried on the box).

TestRestartBySelfAsksNoAttention (new) plays the restart in a child
process, window and tray modes, another window in front: it records
the shell hook's notes for magpie's windows and the foreground, needs
none of either, the page drawn and visible, then that a user's
ShowMain brings the window to the front.
TestRestartMinimisedComesBackMinimised now makes its app with
windowsOptions(), as the real app does; without them its window kept
the foreground it took at creation and it was red on main and on this
change alike.

Run, on the Windows box (xiaomi-gpu, Windows 11, interactive session):
- TestRestartBySelfAsksNoAttention: red on the old code, green both
  modes with this change, green again at the pushed tree.
- TestRestartMinimisedComesBackMinimised: red on the old code ("the
  window minimised took the foreground"), green with this change,
  restore and draw included.
- TestRestartedWindowIsDrawn (13 cases, the behind/cover cases shown
  quietly under another app): 13 of 13 at the pushed tree, with the
  setup fix in the commit after this one.
- The whole internal/gui package, old code and this change, compared:
  the same reds both sides apart from the two tests above (plugin-page,
  import-row, container and client-cert tests red on the box on main
  as well) and TestRestartedWindowIsDrawn's setup flake, fixed after.
- Broken by hand: the hook not put on, red (window 0x4 activation,
  tray took the foreground); showingQuietly never set, red (window:
  0x4).
Full suite on mica at 31a08ce8c (this change on 8334f1e6e), -timeout
45m: every package ok, internal/gui included, but internal/cli
(TestEveryRouteHasACommandOrIsNamed: 80a315a70's /api/page-away, since
named on main in 69946f43c; internal/cli green with that line) and internal/gateway, whose reds
are mica's disk filling up ("no space left on device", 2261 lines);
gateway doesn't import internal/gui, and it is ok at the pushed tree in
WSL (Ubuntu 24.04, 868s; mote was busy with another suite). go vet ./... (darwin) ok; Windows
vet and test compile on mote, Linux nogui vet on mote and gtk3 vet in
WSL ok at the pushed tree; gofmt clean.

Not tried: the grey, blank window they also saw was not reproduced; the
page was drawn on every activation tried. Linux (gtk_window_present
asks for focus the same way) is #6634. macOS needs no change:
makeKeyAndOrderFront doesn't activate a background app, and
requestUserAttention is called only by Flash, which magpie doesn't use;
not tried on a real Mac.
2026-11-14 18:02:33 +08:00