Commit Graph
2473 Commits
Author SHA1 Message Date
yetone 35face90f3 gateway: thinking.display goes to a Claude only (StudyingPython on X)
pi-ai, DeepSeek Harness's client, sends thinking {type, budget_tokens,
display: "summarized"} for every model it lets reason (and adaptive with
display for some). magpie passed display through to non-Claude models on
an Anthropic route, and Alibaba Cloud's Anthropic endpoint (Bailian and
its Coding Plan) answered a Qwen request with 400. The reporter saw it
around compaction, which dsh can move to another model.

withoutForeignDisplay drops thinking.display when the body's model is
not a Claude (claudeVersionOf, or "claude" in the name). It runs in
forwardOnce's Anthropic block after adaptiveThinking, so Anthropic's API,
the Claude subscription and relays serving Claude models keep display
"summarized" (#1485). The provider's own fields go on afterwards, so a
display the user forces there ("!thinking") is still sent.

Run (mote, at this commit on 28236ad2d):
- TestDisplayGoesToClaudeOnly: red on the old code (the call taken out):
  Qwen, GLM and Kimi each got the fake vendor's 400. Green with the fix;
  the Claude cases (sonnet-4-5 enabled, opus-4-7 adaptive, Responses
  summary auto to opus-5-5) keep display "summarized".
- gofmt -l: clean. go vet ./internal/gateway on darwin, linux, windows: ok.
- go test -timeout 45m ./...: every package ok (101), EXIT=0
  (gateway 964s, agent 359s, provider 230s).

Not tried: a real Alibaba Cloud account; Aliyun's real error wording is
unknown, so the fake's 400 text is a stand-in and refuseShapes was not
taught it. The reporter's dsh and magpie versions are unknown. A relay
serving Claude under a name with no "claude" and no Claude line match
loses display; it can force it back in the provider's own fields.
2026-11-16 08:58:28 +08:00
yetone ff5a7dfc03 lessons: one full suite per machine moves into the code standards
Seen a third day: 64c426158 (11-16) ran the whole GUI suite on mica
beside another session's full suite, was pushed with it still running,
and named its 90 reds by page (accounts, Details, keys, plugins,
providers) with no issue. The rule now has a row in the Tests table,
and LESSONS.md lists it under Moved to the code standards.

Docs only; nothing run.
2026-11-16 07:30:55 +08:00
yetone ada0125303 providers: Antigravity's accounts move to agy-cli in one click (@tongzhenbao on X)
@tongzhenbao asked whether accounts signed in on the old Antigravity
plugin (opencode-antigravity-auth, withdrawn since 256910f17: it
keeps serving its users, with Google's suspension risk said) can move to the
agy-cli plugin in one click. They can: both hold refresh tokens from the
same Google OAuth client (agy's own, 1071006060591-...), so the token goes
to agy, the client that issued it, and to no new place.

What the user sees: on Providers, while the old plugin still holds
accounts agy-cli doesn't have, a line over the list says Antigravity's
accounts can move to Antigravity (local agy CLI), with Move and Not now.
Move installs agy-cli (>= 0.1.68, from the plugins repo's dist branch,
as npm doesn't have it) and the agy CLI when missing, then hands the
sign-ins to agy-cli's auth.import (plugins 9907c187), which gives each
account its own agy home and keeps it only once `agy models` works with
it. Accounts that fail are named with agy's reason, Try again retries
them, and the old plugin's sign-ins are never removed. While this line
shows it stands in for the withdrawn plugin's own line (256910f17's
"can get your account suspended ... Use Antigravity (local agy CLI)"):
it opens with the same risk and carries the Move itself; after the move,
or Not now, that line is back. The "antigravity" retired-move line steps
aside too. Plugins > agy-cli > Import accounts from a file stays the
manual route.

- internal/provider/agy_move.go: AgyMoveUsers (deduped by refresh token
  and email, skipping emails agy-cli has) and MoveToAgy.
- internal/gui: /api/provider/toagy, agyMove/agyMoved in the payload.
- app.js: the agy line is the lazy agymove.js, so app.js's core bytes are
  below its base and the budget is unchanged.
- i18n in zh, zh-TW, ja, de; docs/subsystems/providers-accounts.md row.

Run at 281d6ebb6 (before the rebase onto 8f3f7a46a), on mote:
gofmt -l clean; go vet ./... (only the existing proc cgo deprecation
warning); GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet
./... clean; go build ok; go test -count=1 -timeout 45m ./... exit 0,
101 packages ok, no FAIL.
Run at a5289963f (rebased onto Qianfan), on mote: go test -count=1
-timeout 45m ./internal/gui/ ./internal/provider/ ./internal/cli/ ok.
Full GUI suite at f3e826b98 (base 52e83f7b5), both engines, every
language: 1,035 of 28,152 failed in 123 files; those 123 files rerun at
head and at base 52e83f7b5 alone: 1,038 and 1,029 failed, every red test
also red at base or flipping on both sides (key-replace, signin-proxy,
name-suffix-remote 1 of 3 at each, tray-cell-click, images-codex-one,
models-fold, rest-try-now). Filed: old-webkit #6030 and #5919,
plugin-move-unserved #4392 and #4410 (4 reds at both), video-gen-pick
#6792 (filed now); every other red file has its open gui issue.
Run at this head (ea4d55d72, rebased onto 103eff4d4, which brought
256910f17's withdrawn line and depLine), on mote: gofmt -l
clean; go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
internal/gui, internal/provider, internal/plugin ok; go test -count=1
-timeout 45m of internal/gui, provider, plugin and cli ok; node --test
agy-move, providers-withdrawn, retired-move, deprecation-notice,
plugin-move, providers-discovery-off, i18n-keys, i18n-en-no-cjk,
old-webkit and plugin-move-unserved: 92 of 98 ok; the 6 reds are
old-webkit's compat.js-first and Safari 15 styles (#6030, #5919) and
plugin-move-unserved's Try again (#4410), all red at base too.

Red by hand: dropping the email/refresh-token dedupe fails
TestAgyMoveUsersAreTheOldPluginsNotInAgyCLI (offers a2@x.com too);
dropping st.AgyMoved fails TestToAgyMovesAndSaysEachAccount;
drawing the withdrawn line beside the agy one fails agy-move.test.cjs
10 of 12 ("two lines for the same accounts"); clearing the
kept failures on a failed move turns agy-move.test.cjs not ok.

End to end, sandbox HOME on mote, no real credential: the real MoveToAgy
with a fake antigravity sign-in downloaded Bun, installed agy-cli 0.1.68
from dist, ran auth.import, and reported the account failed by name
("agy couldn't sign in with it: `agy models` says: Please sign in ...");
agy-cli kept 0 accounts and the old plugin still had its 1.

The plugins side's run had one red under load, agy-cli's
test/usage.mjs version deadline, filed as magpie-community/plugins#1191.

Not tried: a real Antigravity account moved through a running magpie,
and agy homes on Windows and Linux.
2026-11-16 07:22:47 +08:00
yetone 64c4261582 sessions: search what was said in every agent's sessions, from the page and an MCP server
cryingLiu on X asked to search the chat history of every agent magpie
reads sessions from: prompts and replies, from one place.

What the user gets:
- The Sessions page's search also lists, under the agent's own list,
  the other agents' sessions whose conversation says the words, each
  with a snippet. A hit opens the conversation in the sheet at the
  message that said it (transcript?find=), with "N earlier messages
  not shown"; the page itself never scrolls. While the index is still
  being built the head says "Indexing sessions…" or "Indexing N of M
  sessions…", and the page asks again every 3s until it is done.
- Magpie Sessions, a built-in MCP server in Library → MCP (Discover),
  opt in per agent like the other magpie servers. Its tools are
  search_sessions(query, agent?, limit) and read_session(id, around?),
  both returning text. It runs as `magpie mcp sessions` over stdio and
  reaches the gateway's /mcp/magpie/sessions, which serves only local
  callers that are not browsers.

How it works:
- internal/sessions/said_index.go keeps said-v1.db beside sessions.json:
  a contentless SQLite FTS5 index (detail=none) of the words each
  session says. It is built from the sessions list sessions already
  caches and refreshed at most every 10s: a new or rewritten file is
  read once, a grown Claude Code or Codex file only from where it ended,
  and a gone one is forgotten. A query asks the index which sessions
  have every word, then reads only those files for the snippet, for at
  most 6s. A search waits up to 2s for a refresh. While the first
  listing is still running the answer says `listing`, so an empty first
  answer is not read as "no session says it".
- Privacy: only agents sessions.Reads allows are indexed or searched;
  nothing is read until the user has answered the sessions question,
  and in gateway mode no agent's own files are read (the page doesn't
  ask). Reset forgets the index.
- /api/sessions/said for the page; the CLI parity list names it.

Run, at this tree (rebased on origin/main 256910f17):
- gofmt -l clean; go vet on mote for darwin, GOOS=linux -tags nogui
  and GOOS=windows: ok.
- go test -tags nogui ./... -timeout 45m on the WSL Linux box:
  every package ok at c8e445c4b (the tree before the one-hit wording,
  whose gateway tests ran again on mote: ok).
- GUI: the whole suite on mica at this head was still running when
  this was pushed (owner: never hold a verified change behind a full
  suite). Under mica's load, beside another session's full suite, 90
  tests had failed so far, all in files this change doesn't touch
  (accounts, Details, keys, plugins, providers); none in sessions,
  library or i18n. The files this change reaches passed on their own
  (below).
- Focused, green: internal/sessions (Said*, TranscriptAt),
  internal/gateway (SessionsMCP*, own MCP, read-only, key slots),
  internal/library (market, opt in), internal/gui (Said, Sessions,
  gateway mode); GUI sessions-said, sessions-search, library-sessions-mcp,
  vision-mcp-library, library-browser-setup and i18n-keys in chromium
  and webkit, every language, wide and narrow.
- Broken by hand, one at a time, each red and green restored: the
  index's Listing left out (TestSearchSaidWhileTheSessionsAreFound red
  in 2.5s); the page ignoring `listing` (sessions-said 6 of 7 red); the
  MCP's local/browser guard (TestSessionsMCPOnlyForAgentsHere red); the
  server's opt in (TestSessionsServerInDiscover red); every Reads check
  on the search path, the index's and SearchSession's together
  (TestSearchSaidLeavesOutAgentsNotRead red). With those gone the
  gateway-mode GUI test stays green, because the sessions listing
  leaves an unread agent out before the index sees it.
- Real use, in a sandbox HOME with GOPATH, GOMODCACHE and GOCACHE
  pinned, over the real history through symlinks (29 GB Claude Code,
  60 GB Codex, 14,102 sessions), sessions reads set to all in the
  sandbox: first listing ~60s cold (answers say still being found),
  whole index built in 9m50s while queries answered in ~6s each, index
  38 MB, a common word 4.9s and a rare word 1.0s warm, read_session at
  the words of a huge session 1.8s, peak footprint 442 MB for the whole
  process with the sessions cache. Nothing was written under the real
  ~/.claude or ~/.codex.
- The real binary end to end on mote, in a sandbox HOME: `magpie serve`
  on a free port and `magpie mcp sessions` over stdio with
  MAGPIE_GATEWAY, against a Claude Code session written there:
  initialize, tools/list, search_sessions found it with its snippet,
  read_session at the words started 3 messages before them, a word
  nowhere said "No session says", and a POST with a web page's Origin
  was refused 403. That run is how "1 sessions say" was found and
  made "1 session says" (TestSessionsMCPSearch red before, green after).

Not tried: a real agent (Claude Code, Codex) calling the server it was
given from the Library, and the page against a real backend (the GUI
tests fake the API). The index on Windows and Linux ran only through
the Go suite.
2026-11-16 07:19:18 +08:00
yetone 103eff4d44 routing: a group's model is dragged by its row, not only by its number (NovaStudiosss on X)
NovaStudiosss on X: "the models added to a routing group should be
draggable with the mouse; I move them often and Up/Down each time is
not handy enough". A member could already be dragged since 4dab45e3f,
but only by its number, whose grip shows on hover; the number reads as
a label, so the reporter only found Up and Down.

Now the whole row picks the model up too: its logo, the room around
its words and the row's own background, through the same dragRows the
number uses (one commit to moveMember, the same order saved as before,
so the gateway routes in it: members/placed in /api/groups/save as
group-member-drag already checks). The row shows a grab cursor. A press
on the model's name still selects its words, as the accounts' rows do
(the editor keeps them selectable, jiabubu), and its switch, number,
effort, weight, Up/Down and remove stay controls. The row has
touch-action pan-y, so a finger on it still scrolls the page; the
number keeps touch-action none for a finger's drag. The grip still
shows on hover only. No new strings, no new motion (the drag's lift
and shifts are dragRows', reduced motion as before).

Run (pushed tree's assets = this commit on 65e3dfa95):
- group-member-row-drag.test.cjs (new): Chromium and WebKit, en, zh,
  zh-TW, ja, de, at 1100px and 420px, 20 of 20 on mote. With
  origin/main's assets (MAGPIE_ASSETS) it is red: the cursor check,
  and with that check taken out the logo drag moves nothing
  (["one","two","three"] for ["three","one","two"]), both engines.
- group-*, routing-*, rt-*, route*, i18n*, strings*, click-scroll and
  core-* GUI files (250 files, 4008 tests) on mica under load: 18 red
  in 6 files. Rerun alone at concurrency 1, here and on an origin/main
  65e3dfa95 worktree: the same 17 red in 5 files on both, all filed:
  group-editor-selected (#5049), routing-pin-away (#6512),
  routing-row-swap (#3799), routing-signin (#6520),
  routing-story-shrinks (#3954). group-member-weight's webkit de 420
  1px red (#2387) passed alone.
- go test -tags nogui ./internal/gui/ on mote: ok.

Not tried: a real touch screen (the touch-action values are checked,
not a finger), and the Linux WebKitGTK app.
2026-11-16 06:44:38 +08:00
yetone e34228669c library: agy's GEMINI.md is no longer emptied by Antigravity's app switched off
vizmoe42 on X (v0.1.4271): Library -> Instructions had agy CLI's
GEMINI.md switched on, but ~/.gemini/config/GEMINI.md held nothing.

agy and Antigravity's app share that file (and its folder). With the
built-in agy the targets run agy first, then Antigravity; agy wrote its
part and the unticked Antigravity row, wanting nothing, took it out
again, leaving the file empty or gone. The unticked row also showed
"edited". With agy on its plugin the order is reversed, so it worked by
luck there.

syncInstructions now takes every target. A file another target reads
too belongs to the one switched on (instrOwner): the others leave it
and drop their own record. The Edited check compares against that
owner's text (wantedIn). The path itself is right: agy 1.5.9 reads
~/.gemini/GEMINI.md, ~/.gemini/AGENTS.md and their config/ copies
(binary strings and `agy changelog`, sandbox HOME). MCP and skills in
the shared folder already behaved; probed, unchanged.

Existing users: agy's record says written but the file has no block,
so the next start-up Sync writes it, without switching anything again
(covered by the test).

Run:
- TestAntigravitySharedInstructionsFile (agy and antigravity subtests),
  red on the old code (file empty after the switch; agy row Edited),
  green with the fix, on mica.
- go vet ./internal/library; go test -count=1 ./internal/library
  ./internal/gui ./internal/tui ./internal/cli: all ok on mica.
- At the pushed head (rebased on e47abdf46, no library change upstream):
  GOOS=linux and GOOS=windows go vet ./internal/library and the
  library's Antigravity and Instruction tests, ok on mote.
- gofmt -l clean.

Not tried: a real agy session reading the written file; Windows or
WSL; the GUI clicked by hand (no GUI file changed).
2026-11-16 04:50:30 +08:00
yetone 2d106b5c1a LESSONS: a gone check that looks past made-up text moves into the code standards
Seen a third day: on 11-15 TestMoreKinds' "ops" was in the made-up
user name zpxopsat (ubuntu CI at 500f39886, #4345), after 10-10's
placeholder suffix and 11-10's port and route_id. The rule is now a row
in docs/code-standards.md's Tests table, and LESSONS.md lists it under
"Moved to the code standards". Docs only; nothing run.
2026-11-16 03:38:48 +08:00
yetone dd77094ca2 gui: on Windows the header is the window's title bar (258a14 on X)
With a wallpaper, Windows' main window had a white native title bar over
the page, cut off from it ("内容区域和标题栏有割裂感"). On Windows the main
window is now frameless (mainFrameless), as the Mac's header already is
the title bar: the page and its wallpaper run to the top edge. Wails v3's
frameless window keeps WS_OVERLAPPEDWINDOW, so the shadow, Windows 11's
rounded corners, snap (Win+arrows, drag to an edge) and Wails' resize
edges stay. The header draws minimise, maximise/restore and close at its
right (#wincap, wincap.js, imported in that window alone), Windows-sized
with Segoe Fluent Icons, in the theme's colour, Close red on hover
(.1s ease); the header's refresh and pin sit left of them and stay
no-drag. A double click on what drags the window maximises or restores
it. The app tells the page when the window is (un)maximised (captionJS),
which swaps the glyph and its tooltip and keeps Wails' resize edges off
while maximised so the corner pixel is Close's. The buttons stay over a
dialog's scrim (wincap.js undoes modalBackground's inert on them). The
Mac, Linux, the tray panel and the web page are unchanged.

TestCoreScriptBudget: +27 on both budgets for the one import line in
app.js, past the 29 bytes of room there were; the rest lives in
wincap.js and app.css.

Run (mote, at this tree on origin/main 256910f17):
- gofmt -l clean; go vet ./internal/gui, GOOS=windows go vet
  ./internal/gui, go test -count=1 ./internal/gui: ok.
- Linux: go vet -tags gtk3 ./internal/gui on WSL magpie-desktop: ok
  (at the tree before the rebase).
- GUI: win-caption (new), brand, header-centre, header-zoom-fit,
  i18n-keys, modal-backdrop, providers-withdrawn, text-size,
  sidebar-overlay-scrollbar, both engines, every language: 125 ok,
  7 red, all red on origin/main too: header-centre webkit (#3479),
  modal-backdrop Linux window/panel (#6663), text-size webkit (#6561).
- A 47-file run of every GUI file the header, modal or Windows path
  reaches (mica, before the rebase): the same reds plus mobile-web
  (no .git in a run copy, #5013) and sidebar-overlay-scrollbar de
  webkit once (#1863, commented).
- Whole GUI suite (mica, load ~99): started at the pre-rebase tree and
  synced to the rebased one mid-run, so it isn't a clean record. Its
  reds in 28+ files match main's: 10 of those files alone on mote give
  the same 121 of 218 red at origin/main 256910f17 and at this tree
  (#6709, commented).
- Windows 11 on xiaomi-gpu, built from this tree, sandbox USERPROFILE,
  port 3461: screenshots light/dark with and without a wallpaper, and
  maximised; double click on the bar maximises and restores, max/restore
  and min buttons work (IsIconic true after min), Win+Left snapped to
  half the screen, Win+Up/Down maximise and restore.

Broken by hand: win-caption is red on the old assets (5 of 5 cases);
without wincap.js's MutationObserver it is red 10 of 10 ("the caption
buttons aren't" inert); #457's +0.5 in fitTop turns header-zoom-fit red.

Not tried: Windows 11's snap-layouts flyout over maximise (it needs
Wails' composition hosting, not shown); dragging the window and its
resize edges with a real mouse (a firewall prompt of another session's
magpie dims the desktop and swallows input; buttons and double click
were driven through CDP instead).
2026-11-16 03:37:02 +08:00
yetone 256910f174 plugin: Antigravity's plugin keeps serving whoever has it, and is given to nobody new
The owner (11-15): "正在使用的继续正常,加个提示,新用户不让下载". Google
suspends accounts it sees on Code Assist through Antigravity's own client,
so 9cd5f3652 retired the plugin outright (0.2.0 answered every request with
a 410). Now its users keep it working and are told the risk; nobody new
gets it.

- internal/plugin/withdrawn.go: a list of withdrawn packages (Antigravity's,
  pointing to agy-cli). plugin.Add, the one place the CLI, the GUI,
  Discover and import links install through, turns a withdrawn package
  away unless this magpie has it listed already (on or off), and says
  what to use instead. Upgrade and AddExact (backup, sync) are not gated:
  they act on a plugin the user has.
- The mover installs it for the user's own accounts (move,
  keepMovedCurrent) under plugin.KeepWithdrawn; Adopt, which brings no
  accounts, is a new user and is turned away. Antigravity's min is 0.2.1,
  plugins c0c625ac: the 0.1.18 plugin restored, out of the registry.
- /api/providers lists the withdrawn plugins kept in `withdrawn`, and the
  Providers page draws a line over the list: the risk, why, and "Use
  Antigravity (local agy CLI)", which opens Plugins on "agy". New strings
  in zh, zh-TW, ja and de. depLine() now draws all three kinds of
  Providers line (discovery off, unmoved, this one), which keeps app.js
  inside its budget without a raise.
- AGENTS.md, provider-plugins.md and the site's subscriptions docs (en,
  zh, ja, search index) say the plugin keeps working for its users and
  is withdrawn for anyone new.

Run on mote at this tree (base 52e83f7b5). After the rebase onto
500f39886 (testenv, qianfan, LESSONS upstream), again at this head: go vet
and go test -count=1 of internal/plugin, internal/provider, internal/gui,
internal/testenv and the root package, all ok. Before it:
- go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  internal/plugin, internal/provider and internal/gui: ok. gofmt -l clean.
- go test -count=1 ./internal/plugin ./internal/provider ./internal/gui
  (whole packages, TestCoreScriptBudget and the i18n guards in them): ok.
- node --test providers-withdrawn (new; chromium and webkit, en zh
  zh-TW ja de, 1100 and 420), deprecation-notice, plugin-move,
  plugin-move-overflow, retired-move, deprecated-subscriptions, i18n-keys,
  providers-discovery-off, plugin-movable-review, providers-off-fold: ok.
  plugin-move-unserved's 'Try again takes the models unticked' is red 4 of
  4, the same at origin/main 500f39886 alone: #4410.
- Broken by hand: without RefuseWithdrawn in Add,
  TestWithdrawnGivenToNobodyNew goes red (Add goes on to install); without
  KeepWithdrawn in move, TestWithdrawnPluginKeptForItsUsers goes red (the
  user's own move is turned away).
- Plugins: bun scripts/check.mjs all and bun test packages/antigravity
  packages/agy-cli scripts, 195 pass; dist index.json has 0.2.1.

Not tried: a real Antigravity account through 0.2.1 (it is 0.1.18's code,
which served until 11-15), and the CLI/TUI show no notice beyond Add's
refusal.
2026-11-16 03:00:18 +08:00
yetone 8f3f7a46af provider: Baidu Qianfan's Token Plan Personal shows its month through a console sign-in (yuushabu_buyinn on X, #5860)
A Qianfan Token Plan key tells nothing of the plan's usage: Qianfan's
OpenAPI has no read for it, and the console's own page asks
console.bce.baidu.com/api/qianfan/charge/tokenPlanPersonal/resource with
the signed-in cookie. So the plan is read as StepFun's Step Plan is: the
editor of a provider at qianfan.baidubce.com/v2/tokenplan/personal has a
"Token Plan usage" field, drawn by the same renderStepPlan (now told
whose sign-in it brings) from qianfanplan.js, imported when such an
editor opens. The bookmarklet, run on the console, checks the session
with that same request and copies the console cookie; a raw Cookie
header or a copied cURL is taken too, since document.cookie leaves out
HttpOnly cookies. The paste is checked with a real read before it is
kept, by provider id, in qianfan-auth.json (0600, lastgood-guarded,
moved and dropped with the provider). POST /api/qianfan/{id}/session and
/signout serve it.

The Usage page's card (qianfanPlanQuotas in PlanQuotas) is the running
plan's credits (billingMode credit) or tokens as one Month window up to
expiresAt, the plan's tier as its name and auto-renew beside it;
released and past plans are skipped, and routing reads the same windows
(accountPlanWindows). A redirect, 401, 403, an HTML page or a refusal
naming the login is a signed-out session: an error card saying so, never
0 left; any other failure is an error card too, the last reading kept
only on a passing network error. The per-plan apiKey in the console's
reply is never kept, logged or shown.

Not done: the Enterprise (team) plan has no card. The console has no
tokenPlanTeam/resource; it reads team plans through seat and admin APIs.

Not tried with a real account: no one here is signed in to Baidu Cloud's
console, and #5860 has no reply bytes posted. The fixtures follow the
field names in the console's own script bundle and in the
dsh-qianfan-token-plan reader (planType, resourceStatus, billingMode,
usedCredits/totalCredits, usedTokens/totalTokens as numbers or strings,
expiresAt, autoRenew), not a captured reply.

core budget +35 (app.js and core): the field moved to qianfanplan.js;
what is left in the core is the import and two quotaError lines.

Run (at the pushed tree, rebased on origin/main 8df7885d4):
- mote: go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli: ok (provider 279s, gui 209s, cli 113s)
- mote: GOOS=linux and GOOS=windows go vet of the three (linux with -tags nogui): clean
- gofmt -l internal/: empty
- mica: node --test qianfan-plan, stepfun-per-provider, qianwen-plan,
  i18n-keys, i18n-en-no-cjk, old-webkit (Chromium and WebKit, en and zh;
  i18n-keys over zh, zh-TW, ja, de): 40 of 42 pass. The two reds are
  old-webkit's headerpresets.js (#6030) and app.css :has() (#5919), the
  same on origin/main 8df7885d4, run there.
- Red before: qianfan-plan.test.cjs on origin/main 8df7885d4, 4 of 4 red
  (no field). Broken by hand on mica: with a
  redirect not read as signed out and Released not skipped,
  TestReadQianfanPlan, TestSaveQianfanPaste and TestQianfanPlanCard go red.
- Not run: the whole Go suite and the whole GUI suite.
2026-11-16 01:54:28 +08:00
yetone 261f482260 gui: Disconnect and quit puts the agents back for the next start, which connects them again (jtbbtnt54249 on X)
jtbbtnt54249, on LolingVerse's agy thread: "很多都这样,退出有时候又要重新开启".
Several agents' switches were off after quitting magpie and had to be
turned on again by hand.

Looked for a shared path that flips agents off. The row's switch is
Wired() alone, and nothing automatic disconnects an agent except a
removed plugin, the gateway pause (which reconnects on resume) and
Put agents back when quitting (which reconnects at start). The quit
question's Disconnect and quit, though, ran each row's Disconnect,
which leaves the disconnectedKey mark: every agent it listed stayed off
at every start after, and RewireOnStart skips a marked agent. Users
choose it so their agents work while magpie is closed, not to leave
magpie for good.

Now Disconnect and quit posts quit/disconnect (quitDisconnect), which
runs agent.RestoreOnQuit on the agents the question lists: their own
files back, no mark, recorded in quit.restored, so the next start's
RewireOnStart connects them again, the setting on or off. This covers
every agent the question lists: every detected agent wired to magpie,
built-in, plugin and WSL ones alike. A failure answers an error naming
the agent and magpie stays open. Its tooltip says magpie connects them
again when it opens (en, zh, zh-TW, ja, de).

Run at this tree (parent 99a54fa87, origin/main just fetched):
- TestQuitDisconnectComesBackOnStart red on the old api.go and
  restoreonquit.go (404 on POST /api/quit/disconnect), green after.
- mote: go test -count=1 ./internal/gui ok (145s).
- mica: node --test quit-ask, quit-ask-setting, restore-on-quit,
  i18n-keys, i18n-en-no-cjk: 178 of 178 pass, chromium and webkit,
  every language.
- gofmt -l clean; go vet ./internal/gui on darwin and GOOS=windows ok.
  Linux vet of internal/gui needs GTK/WebKitGTK headers, which neither
  mote nor magpie-desktop has; not run.

Not tried: a real quit of the app with real agents; the agent-level
RestoreOnQuit then RewireOnStart path is covered by
TestRestoreOnQuitAndRewireOnStart. Agents disconnected this way by an
older magpie keep their mark and stay off until switched on once.
2026-11-15 23:30:05 +08:00
yetone 99a54fa874 agent: agy's own /model pick no longer costs settings.json its model, and each thinking level is a model in agy (LolingVerse on X)
agy's /model writes its pick into settings.json ("model": "magpie/…")
even when started with --settings magpie-settings.json. The next Sync's
migrate took that for an older magpie's wiring and put back the old
stash: a stale model and "modelProvider": "gemini", or nothing, which
took the user's own model and provider out. That is the wrong restore
point the reporter saw. While magpie-settings.json is already on one of
magpie's models, such a pick is now moved into magpie's file (what agy
starts on next), and settings.json's model goes back to the one
connect.was kept when magpie was switched on, or out. The old stash is
no longer read for it.

agy 1.5.9 turns /effort away for every custom model, one with a
thinkingLevel too. A custom model's thinkingLevel takes low, medium or
high, and agy sends it as generationConfig.thinkingConfig.thinkingLevel,
which the gateway already asks over the row's effort (agyLevelAsked). A
model with two or more of those levels now has a custom model per
level, magpie/<ref>:<level>. The row's model field shows such a pick as
its model, so the switch stays on (agyLevelOf).

Run:
- TestAgyOwnPickKeepsSettings is red on the old agy.go. The levels part
  fails with "level low:". The pick part, with the levels cut out,
  fails with settings.json {"model":"stale","modelProvider":"gemini"}.
  It is green on the new code.
- go test -count=1 ./internal/agent ./internal/cli on mote: ok (agent 259s, cli 67s) at base 139a6be2b.
- GOOS=linux go vet ./internal/agent and GOOS=windows go vet of both packages (cli's Linux vet needs cgo for Wails on a Mac); gofmt -l is
  clean.
- Real agy 1.5.9 in a sandbox HOME against a fake Gemini endpoint:
  - /model lists magpie/openai/gpt-5.5:low/:medium/:high;
  - picking :high wrote settings.json "model" and sent
    thinkingLevel "HIGH" with model openai/gpt-5.5;
  - /effort still says "Effort isn't adjustable" for custom models.

Not tried: a real magpie gateway and account behind agy (the fake
endpoint stood in), and Windows or a WSL distro.

Not changed: the agent-agy plugin has the same two gaps
(magpie-community/plugins#1188). The switch turning itself off didn't
reproduce on the built-in or the plugin.
2026-11-15 23:19:21 +08:00
yetone 139a6be2bb gui: a pin in the title bar keeps the main window on top (NovaStudiosss on X)
NovaStudiosss wanted to watch Usage and Routing while working in other
apps. The main window's toolbar now has a pin between Refresh and
Settings. A click keeps the window above other apps' windows
(Wails SetAlwaysOnTop through POST /api/window/ontop?on=1|0) and saves
it as settings.json's onTop, which this computer keeps for itself
(KeepOwn, not synced). makeMain opens the window pinned on the next
start, and boot.js shows the pin pressed before the first paint.
There is no pin in the panel, in a browser's page (magpie web) or
under Wayland, where always-on-top is ignored (GDK_BACKEND=x11 keeps
it). A refused pin goes back up. Tooltips "Keep on top" and "Stop
keeping on top" are in every language. A Settings save keeps onTop
(settingsapi.Merge), which a test showed was lost before.

Run (rebased on a80a920f5):
- go test -tags nogui ./internal/gui ./internal/settings
  ./internal/settingsapi on mica: ok. TestPinKeepsWindowOnTop,
  TestPinRefusedWithoutAWindowToPin, TestSetOnTop*, TestOnTopOwn and
  the settings-save keep test.
- At the rebased head, TestPinRefused had served webHost through
  Handler and left webPage set, which turned TestSessionTitlesName-
  OtherAgents and TestCursorEditorChatsAreNotCalledCursorCLI red in a
  full package run. It now goes through webPageHandler, and the package
  is ok. TestWebPageHandlerEveryWhere misses a webHost passed in a
  variable.
- window-pin.test.cjs (chromium + webkit, en zh zh-TW ja de) and
  i18n-keys: 36 pass.
- Full GUI suite on mote (pre-rebase tree, still running at push): about
  380 reds so far, none in window-pin. Seven of the red files
  (account-arrange, agent-details-ready, api-key-theme, bark,
  agent-switch-accounts, allow-ips, agent-bulk-visibility) were run on
  origin/main 30de93e9e: 77 of the same reds, and none red only here.
- go vet for darwin, windows, linux nogui and linux gtk3. Windows
  go test ./internal/gui ./internal/settings: ok. gofmt clean.
- Broken by hand: without the route, or without renderOnTop, the Go
  and GUI tests go red. Without the Merge line the settings-save test
  goes red.
- Real app on mote: with onTop saved, the main window opens at the
  floating level (CGWindowList layer 3, 0 unpinned).

Not tried: clicking the pin in the real app (no Accessibility over
ssh), a real Windows or Linux window, Wayland (hidden by design). At
the default 660px window, the English tabs now scroll about 15px, as
Japanese and German already did on main.
2026-11-15 23:05:56 +08:00
yetone a80a920f56 gateway: a turn on a Codex WebSocket says where its time went
buhaodeshiyehao on X (Codex through Lody's ACP): the Routing page's
"Where the time went" showed only the request's masking. Codex's turns
to the ChatGPT backend, and to a Responses provider with Socket, go over
a WebSocket (codexSocket), and every turn of a conversation after its
first goes on the kept socket. No HTTP request went out that the try's
client trace saw, so TryNet was nil and the page had nothing but the
masking to show. A new socket's turn had TryNet from its handshake only:
the 101's wait read as the vendor's, and the backend's real wait went
into "First token".

codexSocket.turn now tells the request's client trace of the turn as
Go's client tells it of an HTTP request (socketTrace): on a kept socket
GetConn and GotConn (reused), on a new one GotConn once the handshake is
answered (its DNS, connect and TLS stand; its round trip is the wait for
the connection), WroteRequest once the message is written and
GotFirstResponseByte at the first frame. Both callers' traces get it
(gateway.go's routed tries and codex_backend.go's own sign-in), and so
does the usage record's sent/own split, which kept-socket turns lacked.

Test: TestSocketTurnTellsWhereItsTimeWent, Codex's own sign-in and a
Responses provider with Socket, a new socket then the kept one, a 200ms
hold before the first frame. Red on the old code (new socket: Wait 0.4ms
for the 200ms hold; kept socket: no timing), green with it (Wait ~201ms
on all four turns).

Run on mote at this tree (base 9bcdcfb7d; rebased onto 2a8e1b444, whose three commits touch LESSONS.md, internal/plugin and internal/provider only): gofmt -l; go vet
./internal/gateway on darwin, GOOS=linux and GOOS=windows; go test
-count=1 -timeout 45m ./internal/gateway: ok (984s).
No GUI change: the page already draws every part once TryNet is there.
Not tried: a real Codex turn through Lody against chatgpt.com.
2026-11-15 22:43:30 +08:00
yetone 30de93e9e9 plugins: a request whose Bun is still downloading fails at once and fails over (#6735)
hixonchan (kyrierekkok123-del on GitHub): with magpie's own Bun missing
and its download stalled, every plugin-served request hung with zero
bytes, nothing in the log, no timeout and no failover, and `magpie
plugin` hung too. The host's lock (hostMu) was held across Bun's
download, which had no bound on the whole, so every caller waited on it
whatever its context said.

Now:
- Bun is downloaded in the background, once at a time per Bun
  (bunready.go). The host waits for it up to 10s from when it began
  (bunReadyWait); then each call ends with BunNotReadyError, "Bun
  runtime not ready: downloading Bun 1.4.2 (12s so far)…" or "… failed:
  <why>", logged, and the gateway goes on to the group's next member.
- A failed download is said at once for a minute, then tried again;
  installs (plugin.Bun) still wait as long as their context lets.
- hostMu is a channel lock that a caller's context can end (LockCtx);
  the gateway's TryLock polling loops use it.
- When the download fails, a Bun on PATH or in ~/.bun/bin is taken if
  magpie would run it itself: at least BunVersion, not set aside, passing
  the try a new release gets. It is copied in as magpie-bun (#1048).
  magpie's checksummed build stays first; the user's own Bun is better
  than no plugins, and it is what the reporter fell back on by hand.
- Each stage is logged: download started, failed after N, downloaded in
  N, the PATH Bun taken or refused and why.
- Every route through the host gets it: fetch, loader options, sign-in,
  the plugin listing (CLI and GUI). `magpie plugin` prints the list and
  the not-ready reason within ~10s.

Self-restart and env (the reporter's point 4): Reexec, RelaunchBinary and
StartBeside pass os.Environ; only the Mac's bundle relaunch (open -n)
starts with LaunchServices' env. Filed as #6757, not changed here. With
this change MAGPIE_BUN isn't needed.

Tests (each red on the old code with a shim for the new test hooks, logs
kept):
- TestHostWhileBunDownloadStalls: old code, "a caller whose context
  ended still waits on the stalled Bun download"; now not-ready at 2s,
  the 100ms caller returns, then the host starts on the download, asked
  once.
- TestHostAfterBunDownloadFailedSaysWhy: old code, a plain 500 error,
  not BunNotReady; now the 500 is said twice with one ask, Bun() retries.
- TestBunOnPathAfterDownloadFailed: old code failed; now 1.4.2 taken,
  1.0.0 refused.
- TestPluginWhoseBunIsNotReadyFailsOver (gateway, real Handler): old
  code, "group/mixed still unanswered after 20s"; now 200 from the next
  member in 0.84s, and the plugin's own model answers 502 "Bun runtime
  not ready" after ~300ms.

Run on mote at 923cc8747 + this commit (rebased since onto d7cda856a,
a GUI-only library change): gofmt -l clean; go vet ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go
build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.
go test -tags nogui -count=1 -timeout 45m ./...: every package ok
(plugin 219s, gateway 1001s) except two untouched by this change:
- internal/usage TestWholeKeptAcrossReset: red on origin/main d7cda856a
  too, 4 of 5 at -count=5 (#6760).
- internal/provider TestRemoveListedAccountLeavesHiddenNamesake: red
  once in the full run, 5 of 5 alone (#6761).
The four new tests pass on Linux (WSL magpie-desktop) and, the two that
run there, on Windows (xiaomi-gpu).

Not tried: a real magpie binary with a really blocked GitHub download
(the gateway test runs the real handler with a stalled release server),
and the Mac relaunch.
2026-11-15 21:26:33 +08:00
yetone d7cda856ad library: MCP servers turned off fold away below the ones on (hzlxb on X)
hzlxb on X asked for Library -> MCP servers to keep the servers turned off
apart, folded, as Providers keeps the providers turned off. The list now
holds the servers on. The ones off sit below it, above "+ Add server",
under a "Servers turned off (N)" fold drawn with Providers' Turned off
markup (row-head off-head, .fold with the chevron, the count in .note).
It is folded at first and remembered in localStorage
magpie.offServersOpen, as magpie.offProvidersOpen is. A server switched
off moves under the fold, and one switched on comes back up. While
picking (Select) the fold is held open and disabled, so every server
picked is in sight, as Providers holds its fold open while searching.
The MCP tab has no filter of its own, so there is nothing else for it to
hide from. With every server off only the fold shows. With none off
there is no fold. Strings are in en, zh, zh-TW, ja and de.

Run:
- library-mcp-off-fold.test.cjs (new): Chromium and WebKit, 1100 and
  420 wide, en/zh/zh-TW/ja/de. It checks order, label, count, title,
  aria-expanded, that opening by a wheel-scrolled click leaves the head
  where it is and opens no editor, the reload memory, moving on a
  switch, picking, all off and none off. It is red on the old library
  files (no fold; checked on mica in chromium).
- Library/MCP/i18n/click-scroll/providers-off-fold GUI files (102 files,
  both engines) on mote at the pre-rebase head 29a5f10f9: 2304 of 2310 pass. The 6
  reds are library-open-again's 1100px cases, red the same alone on the
  old tree (filed as #6751).
- go test -count=1 ./internal/gui/ on mica at this head: ok (143s).
  gofmt clean.
- The whole GUI suite on mote at 29a5f10f9, in two parts (mote rebooted
  mid-run; the rest ran after it came back, under suite.lock). Part 1:
  411 not ok in 75 files. Part 2 (640 files): 11355 tests, 10911 pass,
  444 fail. No red is in the files this change touches except
  library-open-again (#6751). Every red file has an open issue saying it
  is red on main: skill-fold-all/skill-manual (#6667, #6668, the
  window's /api/update/using), skill-group-shared (#6687),
  view-open-wheel (#4723), view-trackpad-coast (#4724),
  view-wheel-unheard (#5158), usage-* (#6743, #4263), the rest in #6709
  or by name; icon-tile was unfiled and is now #6759 (dim-color from
  2649d5d72, not in app.css's tile rule).
- After rebasing on origin/main 923cc8747 (1f04ed219 touched
  library.css): Library/i18n/click-scroll/providers-off/gui-* files on
  mote: 1837 of 1847 pass. Reds: library-open-again's 1100px
  cases (#6751), library-env de (#6675, NO_PROXYlocalhost) and
  library-chip-fan de no-preference (#3072), both chromium only; those
  two pass 3 of 3 alone at this head and at origin/main 923cc8747; go test -count=1 ./internal/gui/ on mica: ok (154s).

Not tried: the real app, including WebKitGTK on Linux. The fold has no
motion of its own (it uses Providers' chevron rotation).
2026-11-15 21:22:45 +08:00
yetoneandliu-kan 923cc8747f routing: filtering groups reuses indexed lookups and cards (liu-kan, #6744)
Ported from liu-kan's routing_mod_filter branch at 5aca86598 (#6744).
Typing in the Routing groups filter re-ran every member's lookups as a
linear .find over all models, deciders, drawers and accounts, and redrew
the whole page each keystroke. Now a lazy index (Maps built first-match
like .find, splitMember and memberInfo cached, search text cached per
group and locale) is rebuilt whenever `groups` is reassigned (it never
is mutated in place) and dropped 5 minutes after both Routing pages are
hidden. The filter's input redraws only the group list from cached
cards, falling back to a full draw when groups or the locale changed.
No look, matching or saved config change; no new strings; app.js
untouched (client.js is outside the core budget).

Measured (mote, Playwright, 4000 models, 20 groups x 20 members, 16
keystrokes, ms per keystroke incl. layout):
  chromium: before mean 4767.6 / median 5086.3, after 0.37 / 0.2
  webkit:   before mean 4813 / median 5075,     after 0.88 / 1

Run:
- go test -count=1 ./internal/gui/ on 2bc25a2d6 (mote): ok 137.9s. Main since
  (1f04ed219) touches no routing file.
- New and touched GUI files (group-filter-render, group-index,
  group-search-cache, routing-group-plans) on 2bc25a2d6 on mote:
  54 pass, 0 fail.
- make test-ui (both engines) on mica before the rebase onto 2bc25a2d6
  (main's two routing commits since touch the stage only): the run
  stopped after 453 of 1542 files, 5788 results. Its 34 red files were
  each run on origin/main and on this branch: the same tests fail on
  both (main 2bc25a2d6: 378 pass / 204 fail; branch identical but one
  context-cap Settings flake, #6514). Each has an issue: #6010, #5814,
  #5982, #6369, #6371, #6365, #5925, #4959, #6444, #6212, #6543,
  #6029, #6179, #6658, #3293, #6372, #5972, #6514, #5801, #4870,
  #6475, #6424, #6156, #6201, #6660, #5013, #6268, #6293, #5049
  (group-editor-selected), #5594 (group-new-head), #3479, #6414, #4086.
- The other 1089 files: a run on mica went bad under another session's
  suite (load 117) and was stopped; a whole suite at 2bc25a2d6 is
  queued on mote behind the suite lock, followed up after push.

Not tried: the real app, a Linux WebKitGTK app, Windows.

Co-authored-by: liu-kan <liukan@126.com>
2026-11-15 20:25:50 +08:00
yetone 2bc25a2d6e claude: a reply's thinking is never told to a Claude Code run as words (#6623)
The subscription bridge tells a conversation to a Claude Code run as
Human:/Assistant: text (a run started anew, the messages since a reply,
the transcript a new interactive run resumes). renderCachedParts wrote
each thinking part's text into the assistant's turn, so earlier
reasoning reached the model verbatim in a user message. Anthropic
refused it as reasoning_extraction, and every run started anew after
the refusal told it again (#6623; solllin on X). Thinking and
redacted_thinking parts are now left out there. Words, tool calls and
tool results are told as before. renderCachedParts is the one place:
renderClaudePrompt (-p and interactive first message), renderClaudeTurn
(next message, typed turn) and replaySession all reach it; a grep of
every `case Thinking` in the tree finds only native structured
encodings besides it, and sessions' carry already drops thinking.

Run (mica, at 338eae3c2 plus this change):
- TestClaudeReplayLeavesThinkingOut: red on the old code (thinking text
  in the history), green with the fix. It covers renderClaudePrompt with
  and without client cache marks, renderClaudeTurn and replaySession's
  transcript, with thinking and redacted_thinking blocks, and checks the
  words, tool call and tool result are still there.
- go test ./internal/gateway ./internal/sessions -count=1 -timeout 45m: ok.
- go vet ./internal/gateway, GOOS=linux and GOOS=windows: ok. gofmt -l: clean.

After rebasing on 343920464 (routing only): go test ./internal/gateway
-run TestClaude: ok.

Not tried: a real Claude subscription conversation reproducing the
refusal before and after; no GUI change.
2026-11-15 19:23:19 +08:00
yetone 343920464f routing: Fast keeps the provider's extra-body Ultrafast; a relay's GPT model can go Ultrafast (KoiLx0 on X)
KoiLx0 on X: with Azure or another provider that takes service_tier
"ultrafast", the group's speed toggle stopped at Fast, and they asked
whether the group's Fast overwrites {"service_tier": "ultrafast"} put
in the provider's extra request body. Before this commit it did. A member
sent fast got service_tier "priority" in its body before the extra body
was merged. A non-forced extra-body field only fills in a missing value,
so "priority" went upstream. Only "!service_tier" survived.

Precedence now:
- Member not sent fast: as before. The agent's own tier is kept, and the
  extra body's service_tier fills in when the agent sends none.
- Member sent Fast: priority. If the provider's extra body asks for
  "ultrafast", it is sent ultrafast, so Fast is never sent slower than
  the user asked of the provider. A slower extra-body tier (flex) gives
  way to the toggle, which the user set on this member.
- Member sent Ultrafast: ultrafast.
- A forced "!service_tier" in the extra body still goes over all of
  these as written.
The same holds for an agent's fast pick (same member loop).

Ultrafast on a provider the user added by its address (OwnFast): the
toggle goes on to Ultrafast for a GPT model when OpenAI offers the tier
on that model. That is known when one of Codex's accounts lists it, or
when Codex's own entry in models_cache.json for the slug does
(codexcat.OwnOffers). Codex itself is already offered the tier on such a
provider from that same entry (ownTiers). Like its Fast, Ultrafast is
only asked for. A provider that turns the field away is asked again
without it. Other vendors and OpenAI's own API are unchanged. The
Ultrafast button's tooltip on such a provider says the tier is asked of
the provider (new string in zh, zh-TW, ja, de).

Tests, red on the old code:
- TestFastMemberOwnProviderExtraTier: the outgoing body for each
  combination of group speed and extra body, from Chat, Responses and
  Anthropic agents. Old code sent "priority" for "fast + extra ultrafast"
  and for "Ultrafast".
- TestCanUltraOwnProvider: old code returned false for a relay's
  gpt-6.1-sol that Codex's entry offers Ultrafast on.
- group-member-fast.test.cjs: an own provider's member steps usual,
  Fast, Ultrafast and saves ultra; one with no Ultrafast steps back to
  usual. en/zh, Chromium and WebKit.

Docs: gateway-routing.md (a group member's speed) and
providers-accounts.md (Extra body) say the precedence and the
Ultrafast rule.

Run on mote at df2652f63 (base b0d634b85), log kept whole:
- gofmt -l internal: nothing.
- go vet (darwin) provider, gateway, codexcat, gui, agent; GOOS=linux
  and GOOS=windows go vet provider, gateway, codexcat: clean.
- go test -timeout 45m -count=1 provider (176s), gateway (1017s),
  codexcat, agent (275s), settingsapi: ok. go test -tags nogui gui: ok.
- GUI on mica, Chromium and WebKit: group-member-fast, model-speed,
  routing-service-tier, i18n-keys, i18n-en-no-cjk pass. fast-ultra is
  red the same way on b0d634b85 (extra POST /api/update/using, #6201).
- Broken by hand: the new Go tests red on the old sources (above).
Rebased onto 338eae3c2 (provider/models.go, remote groups) after
4f40a1061 (sessions, agent/codex.go, app.js, i18n.js; none
of this change's files). At that head, on mica: TestLoopGuardLeavesOrdinaryRepliesAlone (reads
the two edited docs), TestFastMemberOwnProviderExtraTier,
TestGroupMemberUltrafast and TestCanUltraOwnProvider ok; at 338eae3c2
plus this, go vet and go test of provider (143s) and codexcat, and
gateway's fast, ultra, model-tier and loop-guard tests: ok.

Not tried: a real request to Azure or a relay that serves "ultrafast";
the whole GUI suite; a Linux or Windows run beyond cross-vet.
2026-11-15 19:06:45 +08:00
yetone 338eae3c20 provider: a remote magpie's new routing group is offered beside picks that left a model out (KoiLx0 on X)
A remote magpie whose picks left any of its models out served no model
listed after the Save (withNewlyListed's all-or-nothing rule), so every
routing group its user made there later, group/opus here, was missing
from the agents' pickers until ticked by hand in the editor. Deleting
and adding the remote again cleared the picks, which is why it "showed
sometimes". A group the remote lists since the picks were saved
(not in PickedFrom) is now served beside them; a new model of the
remote's providers still waits for a tick, and a group listed at Save
and left unpicked stays out.

Not changed: an agent set to show only the models picked for it
(#1337) still hides any model made later, local groups too; that is
the mode's rule.

Run:
- TestRemoteMagpieNewGroupServedBesidePicks red on the old models.go
  ("the remote's new group isn't offered: [group/smart
  fake/claude-opus-9]"), green after.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gateway
  ./internal/gui ./internal/cli on mica at 4a4424ea8 + this change:
  all ok (provider 192s, gateway 1119s, gui 227s, cli 69s).
- GOOS=linux and GOOS=windows go vet ./internal/provider; gofmt -l clean.
- Two sandbox magpies on mote (remote R with groups smart, opus,
  sonnet over a fake upstream; client C with remote "office", picks
  leaving fake/gpt-x out): the old binary listed 3 of 5 with
  office/group/sonnet left out; the fixed one, after a restart, lists
  office/group/sonnet in /v1/models and in /api/agent-models/claude
  with nothing hidden, and a group added on R while C ran
  (office/group/haiku) showed within seconds; fake/gpt-x stayed out.

Not tried: the reporter's own pair of machines, the GUI editor by hand
(it starts from Picks, which now holds the group).
2026-11-15 18:58:57 +08:00
yetone 4f40a1061e sessions: a turn of a long Claude session reads none of its copies again (shangyuan0818 on X)
Usage → Sessions took ~20s on Windows for long Claude Code sessions
(tens to ~100 MB each, few rows). A session resumed or forked into new
files leaves whole copies of it, listed as one row, and the live one is
the file they are kept in. Each turn it gained re-read every copy whole,
twice:

- ccFamily dropped the uuids read of a group whose verdict it found on
  disk, so the next change judged the group by reading every file's
  uuids from the start. It now keeps them while the files start alike,
  as ccUUIDMemo's comment says, and reads on from where it stopped.
- ccRest read each copy whole again whenever the keeper changed. It now
  keeps the uuids of a copy's own messages, and while the copy didn't
  change and the keeper only grew and holds none of them, the rest
  stands. A keeper that took one of them has the rest read again
  (TestClaudeKeeperTurnTheBranchHeldIsCountedOnce, red with that check
  turned off: 90 in, want 80).

Timings, Windows (xiaomi-gpu), a 100 MB Claude session from a real one
with its text scrambled, copied under new ids:
- in process, 4 copies, /api/sessions after a turn: 261 ms and 332 ms,
  now 26 ms and 27 ms; after a start and a turn 523 ms, now 239 ms.
- the real dev backend (magpie app, sandbox HOME), 8 copies, the page's
  three calls after a turn: 607 ms, now 31 ms. Cold start 1.9 s both.
These scale with the copies and their size; the reporter's machine is
slower than this one.

Run:
- TestClaudeKeeperTurnReadsNoCopy red on the old code (copies and
  keeper read whole each turn); red with each half undone alone.
- win-run go test ./internal/sessions ./internal/gui: 14 reds, the same
  14 on origin/main 4a4424ea8 run alone (#6071, #6068, #5324, #5928,
  #6059).
- wsl-run go test ./internal/sessions at this head (on 4a4424ea8): ok. TestCCListingKeepsItsNames
  passes on Linux at base and head.
- go vet ./internal/sessions for linux, windows, darwin; gofmt clean.

Not tried: the reporter's own files; WSL-hosted Claude sessions; mote and
mica were over load, so no macOS run. After a start, the first change to
a group still reads each file's uuids once.
2026-11-15 18:56:34 +08:00
yetone 4a4424ea84 codex: the takeover note names the phone connection the Codex app loses, beside Keep on ChatGPT (Mugenrikka on X)
Mugenrikka on X: once the Codex quota was used up, Codex opened through
magpie stopped connecting to the phone and the account's profile could
no longer be opened.

Cause. This is the used-up takeover (#540, codex.out): with the active
ChatGPT account held, magpie becomes Codex's provider without
requires_openai_auth, so the app-server's getAuthStatus/account/read
answer no account (codex-rs app-server get_account builds the account
from the provider). ChatGPT.app 26.1029's main process then takes the
host as an "execution-storage" identity, not a "chatgpt" one (its
early-bootstrap: authMethod chatgpt/chatgptAuthTokens -> chatgpt;
authMethod null and requiresOpenaiAuth false -> execution-storage), and
"Connect your phone" (remote control) and the profile go with it. magpie
never touches auth.json; the sign-in is still there.

Nothing can keep both. With requires_openai_auth = true the app reads
the account again, but its composer gate then greys Send for every
model while the account's /wham/usage says not allowed (checked in
b3a57b3d8 against the 26.1029 bundle), which is what the takeover
exists to get past; lifting that would mean faking the account's usage,
which magpie doesn't do. The owner's call (247794c61) is that sending
comes first. The way to keep the phone and the profile is already there:
Keep on ChatGPT on the takeover note (the sign-in's Always ChatGPT), or
keeping Codex signed in to that account (a5e3972a7), at the cost of a
grey Send till the reset.

What was wrong in magpie: the takeover note listed what is off (chats,
projects, browser use, cloud tasks, account, usage, Log out) but not the
phone connection, so nothing told the user why the phone stopped or that
Keep on ChatGPT has it back. The note at the reset, which says what the
app lacks until its app-server restarts, didn't name it either.

Change: both notes name the phone connection, in en, zh, zh-TW, ja, de.
codex.go's openaiAuth comment and agent-wiring.md say what the app does.

Tests: codex-app-out.test.cjs checks the hover and the opened row name
the phone connection; codex-app-back.test.cjs checks the reset note does.
Red on the old assets (new tests, HEAD's app.js and i18n.js, mote):
120 of 144 fail, "the hover says what is off, browser use and the phone
connection too" and "the row opened names the phone connection".

Run on mote at this tree (base b0d634b85): node --test of
codex-app-*, i18n-*, gui-* (de, ja, zh-tw) and codex-signin-always,
Chromium and WebKit, every language, 980 and 440px: 271 of 271 pass.
gofmt -l internal/agent clean; go vet ./internal/agent ok; go test
-tags nogui ./internal/gui ok (TestCoreScriptBudget included). The Go
change is a comment only.

Not tried: a real used-up account in the Codex app with a paired phone
(none at hand); what the app does was read from ChatGPT.app 26.1029's
bundle and codex-rs's app-server, not watched happen.
2026-11-15 18:38:00 +08:00
yetone b0d634b850 routing: Expand picks how far the stage opens, models or accounts (ipsikent on X)
ipsikent asked on X for a setting for how deep the Routing page opens:
often only which model a route uses matters, not which provider's account
it went to. Expand, at the end of the stage's top line, opens a menu
(openProtoMenu) with Automatic (as before: long lists folded, short ones
open), Models (two or more accounts or keys of one provider fold into the
row naming the model, and start folded) and Accounts (every fold starts
open). Models and Accounts open every group in the group. The pick is
kept in localStorage magpie.routingDepth; picking one forgets the stage's
remembered folds, so every row follows it at once, and a row clicked
after it is kept as before. Accounts and keys isn't changed. Display only:
the gateway's choice of seat is untouched.

It sits in the stage card's top line, not the page head: in the head it
pushed Hide accounts onto a second line at 420px in English. "Expand" is
in the core dictionary, since i18n-keys finds the word in plugged.go.

Run (mica, at this tree on 2649d5d72):
- node --test routing-depth.test.cjs: 20 of 20, Chromium and WebKit, en,
  zh, zh-TW, ja, de, at 1100 and 420. Red on origin/main's routing files
  (no #rtDepth).
- i18n-keys, i18n-en-no-cjk, routing-group-fold, routing-keys-fold,
  routing-fold-accounts-together: ok.
- Screenshots at 1100 (zh) and 420 (en, de): one-line page head, Expand
  at the card's right.
The whole GUI suite is queued on mote behind another session's (suite
lock); its reds get issues.

Not tried: the real app, WebKitGTK.
2026-11-15 17:49:41 +08:00
yetone 2649d5d727 agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).

Run:
- mica, at this tree (rebased on 574b7b96f): gofmt -l clean; go vet (darwin), GOOS=linux
  -tags nogui and GOOS=windows go vet of internal/agent, cli, agentenv;
  go test -tags nogui -count=1 -timeout 45m ./... -> ok, 101 packages. An earlier run on mote
  was red in internal/library's TestEveryAgentInLibrary (dim had no
  Library place); dim is now in noLibrary as "not looked at (#5897)".
- Broken by hand: DIM_API_FORMAT=openai-chat turns TestDim and
  TestDimRun red; dropping shell(false) turns TestDim red (function
  kept in .zshrc).
- Real dima 0.1.0-alpha.24 on mote, sandbox HOME, sandbox magpie serve
  on 127.0.0.1:38600 with a fake OpenAI upstream: `magpie dim
  magpie/fakeup/echo-1` wrote dim.json and the .zshrc function; `zsh -ic
  'dima exec -p "reply with one word"'` answered through the gateway
  (upstream got POST /v1/chat/completions, model echo-1); usage.jsonl
  recorded agent "dim"; `magpie dim default` removed the file and the
  function, and dima ran as npm installed it. Dim's home was never
  written by magpie.

Not tried: a real model provider (only the fake upstream); Windows and
WSL runs (the shell function is this machine's home only, no WSL
distro support); a Library target (skills, MCP, instructions; #5897); Dim's interactive TUI beyond
exec -p and --version.
2026-11-15 17:16:57 +08:00
yetone 993c8a7267 gateway: a group's classifier asks on the group's accounts (AWilsonPeng on X)
A ruled group whose intent classifier (意图判断模型, "Intent told by")
is a model, not a group, asked that model with a fresh request that
carried no identity, so it went out on any signed-in account of the
subscription. AWilsonPeng held the found group GPT-6 Luna to one of two
ChatGPT accounts and picked its own member GPT-6-Luna · Codex as the
classifier (a group can't classify with itself, so it isn't offered),
and the classifier's questions still went to the other account.

The classifier is now asked under the caller's identity held to the
group (classifierHeld in rules.go): the group's Accounts, a gateway
key's accounts, and, when the classifier is one of the group's members,
that member's pinned account. askChat, askDecider and
askDecisionGroup pass the identity on, so every route a classifier
takes (a single model, a decision group, the least-busy pick) keeps
to those accounts. A failed classifier rests only for those accounts.
A group-ref classifier was already held (round 1).

Tests: TestClassifierModelHeldToItsGroupsAccount (the reporter's case,
held by the group's Accounts and by the member's #account pin) and
TestClassifierModelHeldToTheKeysAccount (a key held to one Codex
account).

Run (mica):
- red on b4968d444 with the new tests: all three cases asked on acct-1;
- go test ./internal/gateway -run 'Classif|Decide|Rule|Intent|Nested'
  ok (mote, 46s);
- go test ./internal/gateway ./internal/access ./internal/provider
  -count=1 -timeout 45m: all ok (gateway 917s);
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok; gofmt clean.

Not tried: real ChatGPT accounts or the GUI; the union case where the
classifier model is a member once per account (it then keeps to the
union of those pins). The picker is unchanged: its chip already names
the model chosen.
2026-11-15 16:45:06 +08:00
yetone bf14062def plugins: a dist package Bun can't copy is unpacked from the verified tarball
CHENGJIAHEGOXIS on X, on v0.1.4241 (Windows): installing GoAnyAPI from
the Plugins page still failed with "Unexpected: failed copying files
from cache to destination for package @magpie-community/tools-goanyapi"
and "(LICENSE is missing)", at both of addDist's tries.

Cause, from Bun 1.4.4's source (src/install/PackageInstall.rs): on
Windows Bun copies each cached file by CreateHardLinkW, then CopyFileW,
with no other fallback; a Win32 error it has no errno for prints as
"Unexpected". On a machine where that copy fails (agency-agents failed
the same way there before) dropping the cache entry and trying again
can't help, which is all v0.1.4205 to v0.1.4241 did.

Now, when Bun's copy is still not whole after the second try, magpie
makes it from the tarball installDist verified against the index's
sha512 (unpackDist): the files go into a temp folder beside
node_modules/<name> with .bun-tag = the tarball's integrity, as Bun
writes it, and the folder is renamed into place. Bun takes a tarball
package whose .bun-tag matches as installed and never copies over it,
so bun add runs once more to write the dependency and bun.lock. Only a
package with no dependencies (optional, peer, bundled) whose
package.json names it is made this way; a path leaving the package is
refused. When magpie can't make it either, the add is errDistPartial as
before.

Run at c00c491bc + this change:
- mote: go test -count=1 ./internal/plugin/... ok (153s); go vet,
  GOOS=windows go vet, GOOS=linux go vet -tags nogui ./internal/plugin/
  clean; gofmt -l clean.
- xiaomi-gpu (Windows 11): go test -run
  'TestDistAdd|TestUnpackDist|Leftover|Unnamed|TestDist' ./internal/plugin/ ok.
- Red on the old code: TestDistAddBunCantCopy against origin/main's
  distcopy.go failed in both subtests with the reporter's error shape
  ("Unexpected: failed copying files … (package.json is missing)",
  "(index.js is missing)").
- Real Bun 1.4.4, throwaway tests (not committed): on mote, a copy
  unpacked with .bun-tag plus a MARK file survived bun add of another
  package, bun install, bun update, bun remove of another, and bun
  install with bun.lock deleted. On Windows, unpackDist then real
  `bun add ./dist/<tgz>` wrote the dependency and lock, kept MARK, and
  `bun install` said "no changes".

Not tried: the reporter's machine and its exact Win32 code; I could not
make real Bun's cache copy fail on Windows (a denied read is got past by
the hardlink, and across volumes Bun re-extracted its entry), so the
fallback itself ran with the fake bun only. A dist package with
dependencies is not unpacked, and the npm add is not covered.
2026-11-15 16:38:33 +08:00
yetone c00c491bca contributors: luo173176 fixed plugins#1176's cookie scan and user-text rewrite
The row now says what d4ef0e7f4 fixed. What is still held, and why, is unchanged.
Docs only; nothing run.
2026-11-15 16:32:53 +08:00
yetone b4968d4445 contributors: luo173176 reviewed with extra care (plugins#1176 reads browser cookie jars and rewrites user text to evade Perch's checks)
plugins#1176 was stopped at Look for harm first, and the author's next push
added evasion instead of answering it. The evidence is in the row. Docs only;
nothing run.
2026-11-15 16:06:07 +08:00
yetone 5bccfb4ef2 usage: a table's provider with several accounts is one folded row; an empty Account column is left out (#6740, jay68xu on X)
jay68xu on X: the Usage page gets hard to scan with many providers and
accounts. This change covers the table view only, as the issue's comment asks.

In the Allowances table (Usage > Overview, Table), a provider with
several accounts is now one row. The row shows the chevron, the
provider's icon and name, "N accounts" (a string every language already
has), and each window column's mean share over the accounts. A failed
read counts for nothing in the mean. The provider's accounts sit under
it, folded until the row (or its button, with Enter or Space) is
clicked. Each provider's open state is kept in localStorage
magpie.quotaTableOpen, the way the cards' folds are kept. A provider
with one account is one row, as before. Sorting orders accounts within
a provider, then providers by their mean (window columns) or by their
first row. The Account column is left out when no row names an account.
Window columns and Other already appear only when some row has one.
There is no motion: a toggle redraws the table, and the chevron turns.
app.js is untouched (quotatable.js loads lazily), and there are no new
strings.

Run at this tree (base origin/main d99762075):
- usage-table-groups.test.cjs (new, 40 tests: both engines x en, zh,
  zh-TW, ja, de x 1100px and 420px): all 20 chromium cases are red on
  the old quotatable.js and app.css (0 pass, 20 fail).
- The 4 table files (usage-table-groups, usage-quota-table,
  usage-table-acct-lines, usage-account-subcards), both engines, on
  mote: 102 pass, 0 fail.
- Every usage-*.test.cjs plus i18n-keys and i18n-en-no-cjk, both
  engines, on mote: 1597 pass, 106 fail. All of the reds are in 11
  files that don't touch the table. Run alone, those 11 files give the
  same not-ok list on this tree and on origin/main d99762075 (diffed).
  Their issues are #3414, #6003, #6294, #3415, #2163, #6295, #4263,
  #5048, #6499 and #5834. The three files with no issue were filed as
  #6743 (usage-chart-line, usage-upload, usage-quiet-refresh).
- go test ./internal/gui/ on mica: ok (153.8s), which includes
  TestCoreScriptBudget. The budget was not raised.
- gofmt -l: clean (no Go changed).

Not tried: the real app, WebKitGTK on Linux, Windows, real accounts.
The issue's 代理出口 and 管理页 columns aren't magpie's. No GUI table
or i18n string has them.
2026-11-15 15:54:29 +08:00
yetone bbe5c952f1 settings: Update source moves from Network to About, under Download source (WeltAn_X on X)
WeltAn_X on X: the source updates come from sits in Settings › Network and
sharing, though it is an update setting. Update source (Automatic,
usemagpie.ai only, GitHub only) is now the row right under Download source
in Settings › About, with Automatic updates, Update channel and the other
update rows. Same menu, same updateSource value, same save; the Network page
loses the row. App updates' proxy stays on Network, beside the other
proxies. No new tab, label or line.

It goes under Download source rather than above it: placed above, the
About page scrolled at update-mirror's 420px window, and Use a mirror…
then slid Download source 2-10px. That slide is on main too in a shorter
window (#6739), not fixed here.

Docs: the Mirrors page (en, zh, ja) and reference.md say About › Update
source; llms-full.txt and the search indexes are regenerated.

Run at 60ebaea03 + this change, on mica; rebased since onto 02f1cee79,
which touches only internal/plugin, internal/provider, internal/cli and a
subsystem page:
- gofmt -l internal: clean. go test -tags nogui ./internal/gui/...: ok
  (TestCoreScriptBudget included). node --test site/*.test.mjs: 132/132.
- GUI, chromium and webkit: settings-update-source (en, zh, zh-TW, ja, de at
  1100 and 420px; now opens About, the row is under Download source, none
  on Network), update-mirror, update-channel, update-auto, update-restart,
  settings-search, settings-sections, settings-places, settings-general,
  settings-update-proxy, settings-plugin-proxy, about-log, about-notices,
  about-report, about-website, cli-path, uninstall-settings, click-scroll,
  i18n-keys, i18n-en-no-cjk: all ok.
- Reds that fail the same on origin/main 2e1c0a377, run there on mote:
  old-webkit's two (#6030, #5919), settings-hints ja/de 420px (#6107),
  settings-lines-wrap chromium de 440px (#6353).
- The new settings-update-source is red 20/20 on origin/main 2e1c0a377.

Not tried: the real app; the GUI tests stand in for it.
2026-11-15 14:55:33 +08:00
yetone 02f1cee794 plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.

A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.

The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.

Run, at this head (rebased on 60ebaea03), on mica:
- go test ./internal/cli ./internal/plugin ./internal/provider ./internal/gui: ok
- GOOS=linux (-tags nogui) and GOOS=windows go vet of plugin, provider, cli: ok; gofmt clean
- TestPluginSignInInstallsItsCLI red on the old pluginSignIn (no CLI found,
  straight to waiting), green now. TestPluginInstallsItsCLI covers the host
  calls: listing, a refused install, an install given up, a good one.

Real use, magpie's Dockerfile built on xiaomi-gpu (Docker Desktop, linux
amd64), volume on /config, agy-cli loaded from its working tree:
- `magpie plugin login agy-cli 1`: "Installing it…", agy 1.5.9 downloaded
  to /config/data/magpie-agy-cli/agy, then agy's Google sign-in link.
- restart: agy still there and runs.
- `magpie web` in the container, agy removed, POST /api/plugin-signin:
  state installing ("Antigravity CLI"), then waiting with the link.
- agy.version set back to 1.5.0 and restarted: the plugin updated its copy
  a minute later.

Not tried: finishing a Google sign-in in the container (no keyring there;
agy-cli's file sign-in is the path), a real install on macOS, Windows or a
musl Linux, and the full suite.
2026-11-15 14:52:48 +08:00
yetone 60ebaea033 claude: the newest Claude Code on the machine runs, and an old one's sign-in says it is too old (zi_xiang5806 on X)
zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.

- proc.FindTools lists every `claude` (each PATH folder, then where
  installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
  bridge, bili, keep and `magpie claude-code` all get it) runs the
  newest. The first on PATH is passed over only for one whose version
  is known and newer; an unreadable version is unknown, not old.
  Versions are read first where each is installed, running nothing
  (npm package.json via proc.PackageVersion, the native installer's
  versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
  known that way is another asked --version (VersionOf, kept per file
  until it changes, an unknown for a minute). With one claude, or none
  known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
  says Claude Code is too old, with its version and path, and to run
  `claude update` (or npm install -g @anthropic-ai/claude-code@latest).

Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.

Run at base 96d1b93b2 (the 5 commits rebased over touch none of these
files): full `go test -count=1 -timeout 45m ./...` on mote, 101 ok,
exit 0 (internal/gateway ok 1036s; an earlier version that ran
--version on every candidate turned ~20 gateway Claude bridge tests red
through their fake claude, which is why nothing is run when no version
is known where it is installed). claudecode, proc and provider
TestClaudeSignIn also ok on wsl-run (Linux) and claudecode on win-run;
GOOS=linux and GOOS=windows go vet of proc, claudecode, provider ok;
gofmt clean.

Not tried: a real sign-in with a real old CLI and account; WSL's
too-old message; the Agents page still shows the first on PATH.
2026-11-15 14:30:16 +08:00
yetone 45185710e4 codex: Lite requests go without added instructions, and a turn's state stays with its account
legeling567 on X: three ChatGPT Pro accounts behind magpie, Codex on
Astra at high effort, saw frequent 529 "high load", quota spent faster,
and luna replies; CC Switch on the same accounts was fine. Diffed the
official Codex 0.165 against magpie through a recording proxy, both on
the owner's real account (sandbox HOMEs). Two differences:

- Responses Lite (an additional_tools input item, or reasoning.context
  all_turns): Codex sends no top-level instructions and no
  reasoning.summary. codexBody added Codex's full instructions (~21K
  chars) and summary "auto": about 4K input tokens a request more than
  the official client. codexLite now leaves both out; a request that
  isn't Lite still gets them.
- x-codex-turn-state, the backend's routing token for a turn: Codex
  over HTTP sends it back on the turn's next request. Through magpie it
  never was: the pool route didn't hand it to Codex, and Codex over its
  socket to magpie continues a turn by previous_response_id with no
  state. The gateway now keeps the state per account and turn
  (codex_turnstate.go) and sends it on that turn's next request to the
  same account only; a state Codex sends itself goes only to the account
  that issued it. The socket front keeps the last reply's state per turn
  and sends it as the header, and takes it out of client_metadata.

Red on the old code, green now: TestCodexBodyLiteGetsNoInstructions,
TestCodexPoolTurnStateStaysWithItsAccount, TestCodexSocketKeepsTurnState,
TestCodexSocketServed (state left in client_metadata).

Real run (Codex 0.165, gpt-6-astra high, one Pro account, sandbox
magpie built with CodexBase at the recording proxy): request 1 sent no
state and got one; request 2 sent it back and the backend issued no new
one, as with the official client. Neither had instructions or summary;
input tokens ~14.1K-15.5K against the official 15,466 (before: ~19.6K).

Run at this head (run rebased on 8bf9cb99d; pushed on 96d1b93b2, which touches only internal/plugin): go test -timeout 45m
./internal/gateway/ ./internal/provider/ on mote: ok (gateway 961s, provider 144s); gofmt -l
clean; go vet GOOS=darwin, linux, windows on both packages clean.

Not tried: the luna reroute itself (both sides were served gpt-6-astra),
Codex Desktop, three accounts at once, magpie to chatgpt.com over a real
WebSocket (the proxy forced HTTP). OpenAI-Beta: responses=experimental,
which 0.165 no longer sends, is left as is.
2026-11-15 13:56:58 +08:00
yetone 96d1b93b23 plugin: a dist add is judged by the copy Bun leaves, tried again over a broken one
CHENGJIAHEGOXIS on X (Windows, Bun 1.4.4, after v0.1.4229) still couldn't
install @magpie-community/tools-goanyapi from the dist branch: "Unexpected:
failed copying files from cache to destination for package
@magpie-community/tools-goanyapi ... installed ... Failed to install 1
package". 38a90a34c only let a failure over *another* package pass; this one
names GoAnyAPI itself, so the add was refused, and nothing magpie did made
the next try different.

What Bun 1.4.4 does (reproduced, sandbox HOME, its source read in
src/install/PackageInstall.rs):
- A local tarball is installed from its install-cache entry
  <cache>/@T@sha512-<32 hex>@@@1, trusted whole once there. An entry
  missing a file gives a copy missing it, "1 package installed", exit 0
  (macOS on mote and Windows on xiaomi-gpu). Before this, magpie recorded
  that plugin as installed with no index.mjs.
- A copy it can't make still prints "installed", writes the dependency and
  exits 1: a file of the old copy held open without delete sharing on
  Windows gives the reporter's lines with EBUSY; a read-only folder on
  macOS gives EACCES. The reporter's "Unexpected" is a Win32 code Bun has
  no errno for; which one wasn't reproduced (antivirus, a cloud
  placeholder or a transient hold are the candidates).

Now addDist checks node_modules/<name> against the tarball installDist
verified, file by file (.bun-tag and other extras ignored). A copy that
differs is taken out together with Bun's cache entry and its scope link,
and after 2s (distAgainAfter) the add is tried once more. A whole copy is
the package in. One still not whole is errDistPartial, which install never
hands to othersFailed, so the dependency is put back and the plugin isn't
listed. The npm add has no tarball in hand and isn't judged this way.

The fake bun now copies a dist tarball through a modelled cache entry
(.held / MAGPIE_FAKE_BUN_HELD for a copy it can't make, MAGPIE_FAKE_BUN_LOSE
for a file that never arrives); both sandboxes pass BUN_INSTALL_CACHE_DIR.

Run:
- New tests red on the old dist.go/store.go (mote): TestDistAddOverABroken-
  CacheEntry (no index.js), TestDistAddOverAHeldCopy (the reporter's
  error), TestDistAddNeverRecordsAPartialCopy (exit 0 one returned nil).
- go test ./internal/plugin/... on mote at the pushed head (rebased on
  8bf9cb99d): ok 155s. gofmt -l clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui of internal/plugin: ok.
- win-run go test ./internal/plugin/ (before the rebase): the new tests
  pass; TestStaleMissingIsUnknownWhileDistUnread (#5351, passes alone) and
  TestPiPackage (#4115, red alone on base dd89f1255 too) red.
- Real Bun 1.4.4, real goanyapi 0.1.1 tarball served as the dist branch,
  through AddExact (throwaway test, not committed): clean add, a cache
  entry with index.mjs taken out, and on Windows a file of the old copy
  held open for 3s (EBUSY, then the second try after the pause) each
  installed, and the plugin loaded under bun (its hooks return 37/50
  tools). A hold of 20s: add fails with Bun's EBUSY lines, GoAnyAPI not in
  package.json and not listed.
- All 105 dist packages' latest tarballs added with real Bun 1.4.4 on mote:
  every copy equals its tarball byte for byte (only .bun-tag besides), so
  the check refuses none of them.

Not tried: the reporter's own machine or its "Unexpected" code; the check
on npm adds (#6736).
2026-11-15 13:41:12 +08:00
yetone 8bf9cb99d4 codex: an account with bought credits goes on on them, heard as Codex hears them
123xtv03k on X (v0.1.4233): Codex alone goes on on an account's bought
credits once its plan is used up; through magpie the account stopped.

Codex itself sends no opt-in for credits. It reads
x-codex-credits-has-credits, -unlimited and -balance from every reply,
the 429 included, and `credits` on the codex.rate_limits event
(parse_credits_snapshot; both bools required). magpie knew of credits
only from /wham/usage, read about once a minute, so the 429 that used a
window up was taken as out, and the rest lasted till the window renewed.

- heardCodexCredits reads the headers on every Codex reply (routed and
  the relay's 429), codexEventCredits the event; an image limit's are
  left out. provider.NoteCodexCredits marks the account's windows and
  allowance on credits and clears Held, so Usage doesn't call it out.
- A rest taken for a used-up window before the credits were known is
  lifted once they are, heard or read (provider.OnCredits, creditsKnown),
  only when the account's "Use credits" is on.
- The relay's hold for an account on credits refused twice is at most
  fallbackCooldown (1 minute), like the routed path's, not till reset.
- No header or flag is sent that Codex doesn't send.

Run (mote, at this head rebased on b466aa280; 79b10c5a9 since touches only LESSONS.md): go vet for darwin, linux
and windows of internal/provider and internal/gateway; go test -count=1
-timeout 45m ./internal/provider ./internal/gateway: ok (provider 137s, gateway 907s). gofmt -l
clean.
Broken by hand: without the heardCodexCredits calls, the OnCredits
registration and the hold clamp, every new gateway subtest but "says
none" goes red.
Not tried: a real account holding credits (the owner's hold none). The
Usage card's balance text still comes from /wham/usage only.
2026-11-15 13:28:34 +08:00
yetone b466aa2803 update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.

What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
  cron) the newest tag whose commit has a successful Test run and whose
  release has all 17 assets is picked and kept in LEDGER "daily". A day
  with none keeps the day before's; a failed GitHub read writes nothing.
  /api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
  and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
  ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
  kept); the feed is asked channel=daily, never falls back to GitHub's
  latest, What's new lists every change since yours. Settings > About >
  Update channel has Every version / Daily / Stable; the version row says
  "Up to date on Daily (· {v} is out on Every version)". CLI: magpie
  update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
  for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
  420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
  Daily words, packed to one t() per choice; Settings and renderUpdate
  draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
  llms-full.txt, search indexes.

Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.

Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
  ./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
  included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
  i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
  GOOS=linux -tags nogui.

Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after 9cd5f3652, so the two site freshness tests were red.

Filed: #6730, engines.magpie is never read, so a plugin needing a newer
magpie installs on Stable (0.1.3078) and fails without saying why
(page-amp-usage >=0.1.3681, middleware-company-guard >=0.1.3841,
page-day-card >=0.1.3427).

Not tried: a real self-update on Daily, a real docker-daily workflow run,
the whole GUI suite, the worker's unauthenticated GitHub reads under a
rate limit.
2026-11-15 13:10:18 +08:00
yetone ec1a1a7a55 library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.

- Parsing: frontmatter description plus body; for TOML, description and
  prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
  $n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
  Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
  agents is one command; a name with different bodies per agent shows
  "Differs by agent" and one of them is picked; a name the library has
  with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
  each original file byte for byte (Command.Taken): sync writes the same
  bytes at the same path, so the file is never doubled or rewritten.
  After an edit the agent gets magpie's render at that path; a rename
  drops Taken. Taken never leaves the machine (Collect strips it, Put
  keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
  the library change route. internal/cli's parity test names the probe
  as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.

Run at 039e25752 (on origin/main dd89f1255), on mote:
- go test ./internal/library/ ./internal/cli/: ok. ./internal/gui/: only
  TestCoreScriptBudget red (app.js 10 bytes over), red on main, #6733;
  this commit doesn't touch app.js.
- gofmt clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...: ok
  (at fb01ae2bb, base 028b07b4b; the two later main commits are Windows
  hook code in internal/gui).
- GUI: library-commands-import (new: chromium + webkit, en/zh/zh-TW/ja/de,
  420 and 1100 wide, no sideways scroll, press stays in place),
  library-commands, library-subagents-import, i18n-keys, i18n-en-no-cjk:
  64 of 64.
Earlier, at 1a70f31b6 (base 6af327e2b):
- go test -timeout 45m ./...: every package ok except internal/cli's
  TestEveryRouteHasACommandOrIsNamed, which named the missing probe route;
  fixed here and green since.
- Whole GUI suite (--test-concurrency=8, mote at load 17 to 44 with
  another session's go suite and GUI runs): 26887 pass, 1005 fail in 109
  files, none of them library-commands. The 109 files run alone at
  99719df19 and at origin/main 5bd41301b: 1145/996 vs 1144/997, the
  same tests red apart from language/width variants that flip between
  runs. Recorded on #6709.
Tests use a sandbox HOME with real Pi prompt files from Pi's repo
(internal/library/testdata/pi-prompts). Broken by hand: with syncCommands'
Taken branch off, all four import tests go red ("has a slash command of
its own"); with Put's Taken keep off, TestCommandImportNotCarried goes red.
Not tried: a real Pi install on a live HOME (by rule), or Windows/Linux
runs of the Go tests.
2026-11-15 12:59:12 +08:00
yetone dd89f12556 gui: the no-activate hook's handle is swapped atomically, and the Windows exit doc says what the unhook leaves to endProcess (#6705)
On top of wizd's unhook (#6705, afe3b3ff7, kept as authored with its test): noActivateHook becomes an atomic.Uintptr
that unhookNoActivate swaps to 0, so the three places that unhook
(OnShutdown, the main-thread window's WM_DESTROY, Run's return) take it
off once without a racy read-then-clear. Nothing hooks it again:
hookNoActivate runs its SetWindowsHookEx under noActivateOnce, and
noActivateHooked stays true after the unhook.

07dfd0bb8's endProcess (TerminateProcess on itself) and awaitExit are
kept and the gui-shell doc says why: they still cover the other DLL
detaches, an os.Exit while the app runs (Wails' fatal error, which this
unhook doesn't reach), and an update from a version before the fix.

Exit paths reviewed: Quit (tray, page) runs Wails' cleanup, whose
shutdown tasks run on the main thread (InvokeSync), so OnShutdown
unhooks on the hook's thread before Run returns into endProcess. A
restart to update quits the same way. Wails' SingleInstance os.Exit in a
second instance comes in application.New, before any window exists, so
no hook is on. SIGINT/SIGTERM in the app go to Wails (ownSignals), so
through OnShutdown. The handover's quitBy exitNow is Mac/Linux only.

Run at this tree on base 72e06980e (the rebase onto 028b07b4b adds only
routing JS and docs), on xiaomi-gpu (Windows 11 26200,
Go 1.26.8) through win-run:
- TestUnhookNoActivatePreventsExitDeadlock -count=3: PASS 3/3.
- broken by hand (unhookNoActivate returning at once), at the tree before
  the rebase: unhook and destroy-main both FAIL "process hung in
  ExitProcess (stderr=fatal error: exitsyscall: syscall frame is no longer
  valid ...)".
- go test ./internal/gui: 11 reds. TestCoreScriptBudget (app.js 10 bytes
  over its budget) is red the same on macOS at 72e06980e with no script
  touched here; filed as #6733. The other 10 (TestGatewayHeldByAContainer,
  TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
  TestAionUiImportRow, TestCherryStudioImportRow, TestProviderSaveClientCert,
  TestPageAwayLetsStatsGo, TestPluginAgentMissingSaysSo,
  TestGatewayModeStatsNameTheGatewaySessions, TestUpdateThatWontStart) fail
  the same on origin/main 9cd5f3652 run alone there, and are filed in
  #6068 (also #5324, #5928, #6059).
- In the signed-in session (scheduled task /IT, where msctf is loaded):
  TestRestartBySelfAsksNoAttention (window, tray),
  TestRestartBySelfComesBackQuietly and TestUnhookNoActivatePreventsExitDeadlock
  pass.
- A real build (go build -tags production -H windowsgui) run as `magpie
  app` in a sandbox profile (USERPROFILE/APPDATA/LOCALAPPDATA redirected,
  MAGPIE_ADDR :3461, page on :3462) in the signed-in session, quit four
  times through POST /api/window/quit?now=1: each exited in 51-62ms. The
  magpie:// handler it registered was put back afterwards.
On mica: gofmt -l clean, go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.

Not tried: a restart to update of a real build on Windows (needs a staged
update); the wedge itself in a real app (07dfd0bb8's endProcess already
ends the normal quit without ExitProcess, so it can't be brought on at
will); Windows on arm64.
2026-11-15 12:39:32 +08:00
Wizard 7ce93508f0 gui: unhook noActivateHook before process exit on Windows (#6705)
Two full-memory dumps on Windows 11 (magpie.DMP on v0.1.4196 and magpie2.dmp on v0.1.4185) show why ExitProcess throws in exitsyscall and wedges with one thread left (#5922, #6678, #6705):

1. hookNoActivate installs a thread-local WH_CBT hook (noActivateCBT, Go callback #93) on Wails' main thread and never unhooks it.
2. When the process exits through runtime.exit(0) -> ExitProcess (for example from Wails' SingleInstance handover os.Exit, Wails' fatal os.Exit, or before 07dfd0bb8's endProcess), runtime.exit(0) acquires runtime.finlock and enters ExitProcess via runtime.stdcall with g1.syscallsp set.
3. Inside ExitProcess -> RtlExitUserProcess -> LdrShutdownProcess -> RtlpFlsDataCleanup -> msctf!CicFlsCallback -> msctf!SYSTHREAD::DestroyThreadMessageWindow -> win32u!NtUserDestroyWindow, Windows dispatches HCBT_DESTROYWND (nCode=4) to noActivateCBT on the main thread.
4. noActivateCBT calls w32.CallNextHookEx, whose nested Go syscall clears g1.syscallsp = 0 on return. When cgocallbackg then calls runtime.exitsyscall, gp.syscallsp < sp triggers 'fatal error: exitsyscall: syscall frame is no longer valid'.
5. runtime.fatalthrow.func1 calls runtime.exit(2) on the same thread (m0), which attempts to lock runtime.finlock a second time and self-deadlocks forever while still holding Wails' single-instance mutex and WebView2 profile handles.

Fix: unhook noActivateHook (w32.UnhookWindowsHookEx) when Wails' main-thread window receives WM_DESTROY in appWndProc, in OnShutdown, and when Run returns.

TestUnhookNoActivatePreventsExitDeadlock reproduces the exact FLS window-destruction callback on ExitProcess's last thread: without unhookNoActivate the child process throws 'exitsyscall: syscall frame is no longer valid' and wedges with 1 thread left; with unhookNoActivate (or WM_DESTROY on the main-thread window) it exits 0 cleanly.

Fixes #6705
2026-11-15 12:39:32 +08:00
yetone 028b07b4bd routing: a folded fold of accounts on one plan shows its bar in the app (Sdsi134a on X)
Sdsi134a on X: on the Routing stage, "Command Code Plan · 3 accounts" folded
said only "3 available", with no quota, though the accounts are on one plan.
foldQuota (ea1a8ae80, chen2652) was meant to show that figure and bar, but
it never could in the app: cardFor matched only cards whose kind is
"subscription", and /api/usage/quotas sends this computer's cards with no
kind (SubscriptionQuota.Kind is omitempty and set only on a remote magpie's
cards). The tests' fixtures carried kind: "subscription", so they passed.
cardFor now takes a card of this computer whose kind is subscription or
none. This also lets the accounts list's per-account windows (#1833) and
the failed-read line (dd9cd59a1) find their cards in the app.

The fold's figure now also says when its window starts again, the soonest
of the accounts' ("5 hours 40% used · renews in 2 h 10 min"), as an account
row does; no new strings. Hide plans on the groups page
(magpie.routingGroupPlans, f362d3b9a) folds the figure and bar away here
too (plansHidden). Mixed plans: nothing, as before.

Run (base 9cd5f3652; rebased onto 72e06980e, whose new commits touch no
routing or GUI file):
- routing-fold-accounts-together.test.cjs, its cards now in the API's shape
  (no kind), plus the reset and the Hide plans case: 22/22 on mote,
  chromium + webkit, en zh zh-TW ja de, 1100 and 420px. With the old
  client.js: 22/22 red (the figure never appears). With the plansHidden gate
  taken out by hand: 11/11 chromium red ("hidden plans").
- With it, on mica: routing-account-windows, -card-error, -group-plans,
  -free-seat, -groups-page, -pooled-card, -remote-windows, -read-allowances,
  -seat-windows, -wallet-lapse, -fold-all, -folder, i18n-keys,
  i18n-en-no-cjk: 306/306.
- go test -count=1 ./internal/gui/ on mote: ok.
Not tried: the real app with several real accounts on one plan (the owner
has none such); the whole GUI suite.

Reported-by: Sdsi134a
2026-11-15 12:35:22 +08:00
yetone 62ced98ccd gateway: a Gemini 3+ on an Anthropic or Chat relay is asked a thinking level, never a budget (Mamba_asr on X)
A relay serving Gemini under a host of its own (Mamba_asr's peta-gemini)
was sent Claude Code's thinking budget_tokens as it came on Anthropic's
Messages, the translation's budget from a Chat or Responses effort, or a
Chat client's extra_body.google.thinking_config thinking_budget. Such a
relay passes it on to Gemini as thinkingBudget, which Gemini 4 turns
away ("Thinking budget is not supported for this model. Use thinking
level instead.", #2083). AI Studio, Vertex AI and the translated Gemini
routes already sent thinkingLevel; the relay routes didn't.

geminiLevelBody (gemini_level_body.go), run in passthrough and
forwardTranslated after xaiBody, acts only for a Gemini 3 or later model
id on an Anthropic or Chat upstream:
- Anthropic: thinking enabled + budget_tokens goes as thinking adaptive
  with output_config.effort, the budget bucketed by effortOfBudget
  (<=4096 low, <=12000 medium, else high) unless the request names an
  effort.
- Chat: thinking_config's budget goes as thinking_level (-1: none, 0:
  low), and reasoning_effort is fitted.
Gemini's own OpenAI-compatible API (geminiCompat: AI Studio, or a
proxy on this computer or the LAN) is left alone: it takes a budget,
and the Chat path already fits its levels and asks again on a refused
one (TestGeminiThinkingLevelRefused and
TestPassthroughGeminiMinimalRefused went red until it was left out).
geminiLevelFor fits a level to the model: the catalog's levels where it
lists them, else nothing above high, and medium as high on a Gemini 3
Pro (which takes low and high only, per Google's model docs).

Run (mote, at this head rebased on origin/main):
- TestGeminiRelayAskedALevel: a fake relay that returns Gemini's 400
  for any budget sent to a gemini-4 model. Its 7 Gemini cases are red
  with gateway.go's old body (budget_tokens / thinking_budget / xhigh
  sent as they came); the 3 other cases (claude-sonnet-4-5 budget_tokens,
  gpt-5.5 reasoning_effort xhigh with a thinking_config budget, and
  gemini-2.5-flash budget_tokens) pass on both, unchanged.
- TestGeminiLevelFor.
- gofmt -l clean; go vet ./internal/gateway on darwin, linux, windows.
- go test -count=1 -timeout 45m ./internal/gateway: ok.
  That full run was at 862660144; rebased onto 049073c97 (the
  Antigravity retirement touched internal/gateway), go vet and
  go test -run 'Gemini|Thinking|Effort|Vertex|Anthropic|Relay'
  ./internal/gateway: ok at this head.
- docs/subsystems/gateway-routing.md names the rule.

Not tried: the reporter's real relay, or any real relay. A relay that
doesn't understand thinking "adaptive" will drop it and use the model's
default thinking, which beats a 400. Not covered: a Responses upstream,
plugin routes, and a Chat body's own "thinking" budget field.
2026-11-15 12:27:05 +08:00
yetone 9cd5f36521 antigravity: retired, the built-in and its plugin both ask Google nothing; Antigravity is served by your own agy (agy-cli)
Google bans accounts it sees on Code Assist through Antigravity's own
client. magpie offered that route twice, the built-in and
@magpie-community/opencode-antigravity-auth, and anyone who picked
Antigravity in magpie took it by default (the owner, 11-15: 全部下线,改推
agy-cli).

- retiredBuiltins has antigravity. googleLogins lists no account of a
  subscription its plugin serves, so no list, usage read, quota read or
  request goes to Google with a built-in Antigravity account (the usage
  loop in subscription_usage.go had no gate of its own). The mover reads
  googleSavedLogins, so saved accounts still move.
- The mover's min is 0.2.0 (on the plugins dist index, b8bf5a57): that
  version sends nothing, answers every request 410 ModelDeprecated
  ("model has been retired", which modelRetired reads, so a group asks its
  next member) naming Antigravity (local agy CLI) and
  `magpie plugin add @magpie-community/opencode-agy-cli-auth`, and turns
  sign-in away. It left the plugins registry (003a38ff).
- Gemini CLI's route, on the same code, is unchanged.
- The built-in's code stays for now (shared with Gemini CLI); taking it
  out is #6723. Its 123 tests serve it again for their run through
  provider.AntigravityBuiltinForTest(), a counter BuiltinRetired reads.
- README (en, zh) and site docs subscriptions (en, zh, ja) point to
  Antigravity through the user's own agy CLI. AGENTS.md and
  provider-plugins.md say why and that neither route comes back.

What users lose: Antigravity with Google accounts signed in to magpie, and
rotating several of them. agy-cli serves the one account the user's agy is
signed in to, and needs agy installed.

Tests: TestRetiredAntigravityAsksGoogleNothing saves an Antigravity
account and checks googleLogins/googleAccountOf give nothing, the mover
still carries it, usage has no Antigravity card and the fake Google was
asked nothing, and Gemini's account still lists. Broken by hand (the
PluginServes gate removed from googleLogins): red,
"googleLogins(antigravity) = 1 accounts".

Run (mote/mica, at this change on origin/main 5bd41301b): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... and go build ./... ok; go test ./internal/gateway/ (1245s),
./internal/agent/ (419s), ./internal/provider/ (253s) ok on mica;
after rebasing on origin/main f362d3b9a: go test ./internal/provider/
(160s) and ./internal/plugin/ (184s) ok on mica.
Earlier at this change minus the test opt-ins: sessions, usage, library,
gui ok (mica). internal/cli's TestEveryRouteHasACommandOrIsNamed is red at
5bd41301b itself (/api/warm-all, #6724), not from this change.
Not run: the full ./... suite (mote and mica each had another session's
full or GUI suite); the GUI suite (no app.js change); a real move of a
built-in Antigravity account onto 0.2.0.

Plugins side: magpie-community/plugins 003a38ff (antigravity 0.2.0) and
f9155256 (agy-cli 0.1.56, comments only).
2026-11-15 12:14:48 +08:00
yetone 862660144e gui: a page's tabs in the sidebar fold from its own row, with a disclosure chevron (hkwok06 on X)
Opening Settings unrolled its tabs in the window's sidebar and nothing
said they would fold again; only opening another page (the gateway)
put them away. The open page's row now carries a quiet disclosure
chevron, as a Mac sidebar's: turned to its list while the list shows
(down for the pages above, up for Settings, whose list opens above its
row), and clicking the row or the chevron again folds the list and
unfolds it, the page staying open on its tab. A list folded stays
folded, per page, until it is opened again (localStorage
magpie.navFolded). The same holds for Usage, Library and Plugins.
The chevron is muted, turns in 200ms on the strong ease-out, and
doesn't move under prefers-reduced-motion. aria-expanded says the
state; Enter on the focused row toggles it too.

The chevron and the fold live in navicons.js (navFoldRows, navFold),
imported with the first list; app.js keeps 123 bytes (navList shared
with navMine, the two rows' clicks asking navFold first), with the
budgets raised by that and the reason in core_budget_test.go.

Run (mote):
- nav-sub-fold.test.cjs (new), chromium + webkit, en zh zh-TW ja de:
  red on the old code (12 of 12, "Settings' row shows a disclosure
  chevron"), green 12 of 12 on this change.
- After rebasing on origin/main 38a90a34c: nav-sub-fold,
  nav-sub-unroll and i18n-keys: pass 38, fail 0; TestCoreScriptBudget
  ok; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet
  -tags nogui ./..., go build ./... ok; gofmt -l clean.
- 45 GUI files the change can reach (nav-*, sidebar/side-*,
  settings-*, menu-scroll, click-scroll, i18n, gui-*, text-size,
  plugin-panels, ...): all pass except menu-scroll's scrollable
  dropdowns (#6532), nav-timeout (#5425) and settings-groups'
  warm-ups and check-in (#6597), which fail the same 5 tests on clean
  origin/main 38a90a34c (pass 8 fail 31 on both).

Not tried: the whole GUI suite (mote and mica were both loaded by other
sessions' suites), and the real app on Linux WebKitGTK and Windows.
2026-11-15 12:05:32 +08:00
yetone 38a90a34ce plugins: a dist add failed by another package, unnamed in Bun's last lines, is done (CHENGJIAHEGOXIS on X)
On v0.1.4210 the reporter (Windows) still couldn't add
@magpie-community/tools-goanyapi from the dist branch:
"bun add ./dist/magpie-community-tools-goanyapi-0.1.1.tgz: exit status 1:
Saved lockfile installed @magpie-community/tools-goanyapi@./dist/... 1
package removed ... Failed to install 1 package". Bun had installed
goanyapi; another package failed, but the line naming it comes before
"Saved lockfile", and the error kept only the last six lines, so
othersFailed found no name and the add failed. The tgz is fine (sha512
matches the index, no dependencies); nothing changes in the plugins repo.

- bunSaid: every Bun error magpie shows (add, update, remove, the dist
  mend) keeps up to 8 failure lines from anywhere in the output before
  its last lines, ANSI and CRs stripped.
- bunFailed reads every way Bun 1.4.4's source (install/*.rs) names a
  failed package: failed to install/link <name>:, refusing to install
  dependency, extracting tarball from/for, downloading tarball <name>@,
  failed to download, Failed to open node_modules folder for, path for
  package.
- othersFailed: a failure naming no package is another's when the add's
  own package is in package.json and installed at the exact version asked
  for (the spec's exact version, or the one installDist read from the
  index; installDist now returns it). Its own package named still fails.
  This covers every plugin kind, provider plugins and tools alike, as all
  go through install().

Run:
- Old code (origin/main 5bd41301b with the new tests): all five new or
  changed tests red, TestUnnamedFailureDoesNotFailADistAdd with the
  reporter's message byte for byte.
- mote: go test -timeout 30m ./internal/plugin/... ok (174s);
  GOOS=windows go vet ./internal/plugin/ and GOOS=linux go vet -tags
  nogui ./internal/plugin/ ok; gofmt -l clean.
- xiaomi-gpu (Windows 11), real Bun 1.4.4, sandbox USERPROFILE/APPDATA/
  XDG_CONFIG_HOME, magpie.exe -tags nogui built from this tree:
  `magpie plugin add @magpie-community/tools-goanyapi` from a clean
  plugins folder installs 0.1.1 from dist with its 37 tools; with
  agency-agents installed and a file of it held open, the add drops
  agency-agents and installs goanyapi. That second shape passes on
  origin/main too (Bun's EBUSY line names agency-agents there).

Not tried: the reporter's exact hidden line, which their message cut
off; no shape I made on Windows hid the name. Publishing tools-goanyapi
to npm, which would skip the dist path, needs the owner.
2026-11-15 11:55:45 +08:00
yetone 5bd41301b9 warm-up: All accounts warms every account in use at one press (CoderMaurice on X)
CoderMaurice on X: with several Claude accounts, Warm up now had to be
pressed once per account. With two or more accounts, the Warm up… menu on
the Warm up now row (a Claude Code or Codex provider's editor, the warm-up
section) now starts with All accounts. It sends POST /api/warm-all, and
provider.WarmAll sends Warm up now to every account that is in use (the
one the agent is on, or one turned on beside it) and whose windows aren't
all running already, going by the cached readings the Usage page shares.
It runs three at a time. An account that is turned off or paused, or
already in its windows, is sent nothing. An account whose sign-in lapsed
is sent nothing and is listed as failed, as Warm up now treats it. The
row's line lists the accounts warmed, the ones already in a window, and
each refusal with its reason (in red).
Accounts that are turned off aren't listed. A gateway rest is not read
(the provider package can't see it). An account rested for a used-up
window is still inside that window, so it is skipped as running.

"All accounts" moves from the usage plugin's i18n.js into core i18n.js,
since the core uses it now. It and two new strings are in zh, zh-TW, ja
and de. app.js stays inside its budget: the single-account and
all-accounts results now go through one formatter.

Run at a1968a0b5 (rebased on origin/main aecf27efb), on mica:
- go test -run 'WarmAll|WarmNow|CoreScriptBudget|Budget' ./internal/provider
  ./internal/gui: ok. New: TestWarmAllWarmsEachIdleAccountInUse,
  TestWarmAllOnlyCodexAndClaude, warm-all cases in TestWarmNowAPISaysWhy.
- Broken by hand: with the "running" skip removed from warmAll,
  TestWarmAllWarmsEachIdleAccountInUse FAILs (busy@ and spent@ warmed).
  With the All accounts item removed from the menu, warm-now.test.cjs
  FAILs ("Warm up all warms every account at one press" and the menu
  list assertion).
- GUI, Chromium and WebKit, en/zh/zh-TW/ja/de, 900px and 440px:
  warm-now, i18n-keys, i18n-en-no-cjk, usage-accounts: 54/54 pass. Before
  the rebase, plan-name-fits, provider-prefs-layout and quota-warm also
  passed (54/54 with usage-accounts).
- gofmt -l: clean. go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/provider and internal/gui: ok.
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.

Not run: the full go test ./... and the full GUI suite. Both mote and
mica had other sessions' GUI suites running throughout, and this ships
now per the owner's ship-immediately rule. Both will run when a machine
is free. Not tried: a real Warm up all against several real Claude
accounts (the send per account is the unchanged WarmNow).
2026-11-15 11:00:37 +08:00
yetone 01f307091b routing: a group's routing changed counts at a conversation's next turn (#6708)
A conversation under Stays auto keeps its member while its cache holds
cacheWorth (1024) or more. That stays: routing ranking another member
first on its own merits doesn't move a warm cache (backFromStandIn's
rule), since the ranking moves with every reading and a move pays the
whole prompt again. What was missing is the user's own act: a reorder
already counts at the next turn (reorderedSince), but changing a
group's routing (manual -> pace in #6708) did not, so the conversation
stayed on the manual pick.

Group gains RoutedAt, stamped by SaveGroup when Routing changes and
kept otherwise, so it is persisted and a change from the CLI or TUI
reaches the running gateway (unlike NoteReordered, #6265). affine's
Auto branch now also lets the conversation go when its stick predates
the group's RoutedAt. Session, Strict and a turn under way keep it, as
for a reorder. The sibling for a provider's own accounts routing is
#6718.

Tests: TestReroutedGroupTakesTheConversationAtItsNextTurn (a 2.8k
cache, the reporter's size: rerouted "a a b b", a rename-only save
"a a a a", session "a a a a") and TestGroupRoutedAtFollowsTheRouting.
Broken by hand: with reroutedSince returning false the first is red
("a a a a, want a a b b"); green with it, beside TestReorderedAccounts.

Run at e8e5b9e06 (this pair on origin/main 97e6ac36c), on mica because mote's load was over its cores: gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and go vet ./... ok; HOME=sandbox go test -timeout 45m ./... ok, all 101 packages (gateway 932s, agent 337s, provider 209s), no reds. No GUI change. Not tried: a real Remote magpie on a free plan, or a real conversation through a rerouted group; both are covered by the tests above only.
2026-11-15 09:38:24 +08:00
yetone 98fb140869 routing: a Remote magpie signed in to a free plan is spent first by Free quota by expiry (#6708)
weighRouted set a seat's FreePlan only from c.p.Account, so a Remote
magpie whose card is a Free plan (Kind "subscription", Plan "Free")
was weighed as paid, and "Free quota by expiry" spent a paid remote
before it. provider.RemoteSeat now also says whether the card it chose
is a free subscription plan; RemoteAllowance wraps it unchanged, and
weighRouted keeps that bit on the member's left and ORs it into
FreePlan.

Test: TestRemoteMagpieFreePlanSpentFirst (two httptest remotes, a Pro
at 20% and a Free at 60%, FreeExpiring group): the free one goes first
and is the only one in wg.free. Broken by hand: without the
`|| ...freePlan` the test is red ("mac-paid first", free map all
false); green with it, beside TestRemoteMagpiesWeighedByTheirCards and
TestRemoteAllowance.

Run at e8e5b9e06 (this pair on origin/main 97e6ac36c), on mica because mote's load was over its cores: gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and go vet ./... ok; HOME=sandbox go test -timeout 45m ./... ok, all 101 packages (gateway 932s, agent 337s, provider 209s), no reds. No GUI change. Not tried: a real Remote magpie on a free plan, or a real conversation through a rerouted group; both are covered by the tests above only.
2026-11-15 09:38:24 +08:00
yetone 97e6ac36c9 catalog: a provider's model list names each model once (#6582)
elis_pina (LoveEcho1145) on X: some APIs list a model more than once in
their /models, and each copy was a row of its own. A provider asked at its
base already merged copies by id (Provider.fetchOne's add), but one asked at
the URL its list is at (ModelsURL), the add form's List, and every list
fetched another way (accounts, Azure, Kilo, Cline, decision lists) kept
them, in the pickers, /v1/models and the agents' lists.

catalog.Unique keeps each id once: the first copy in its place, with what
it leaves unsaid (a name other than the id, window, output, levels, price,
APIs, tiers, magpie_via, keys) taken from the copies after it, as the
lookups by id (LiveByID's callers) already took the first copy that said
it. It runs at the parse of every upstream /models (catalog.fetchOne, all
pages), at every save (saveLive: the list and each base's part, whoever
fetched it), and at every read (readLive), so a list saved before reads
each id once without waiting for a fetch. A list with no copies comes back
as it is. Plugins' lists are keyed by id in host.js already. Keyed by id
alone, as Provider.fetchOne and fetchPerKey merge already.

Tests: TestFetchedListNamesEachModelOnce, TestSavedListNamesEachModelOnce
(saved, sides, LiveByID, and a file written before with copies),
TestUniqueLeavesAListWithoutCopies, TestProviderListsEachModelOnce (at
base and at ModelsURL: Fetch, List, Available). Broken by hand: with
Unique returning its input, the first two and the ModelsURL case of the
last are red (Fetch/List/Available listed [gpt-5.6 glm-5.3 gpt-5.6
glm-5.3]); with readLive's Unique alone taken out, the saved-before case
is red.

Run on mica: gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags
nogui ./... ok; go test -timeout 45m ./... at b552edb12 (base 6af327e2b):
100 packages ok, internal/plugin red on TestCancelledSignInSavesNothing,
#5532 (filed, same tok-late output, passes -count=10 alone at this head).
Rebased on 87a0af212 (changes only gateway test files and LESSONS
since); at the pushed head internal/catalog and
internal/provider ok, linux/windows vet of both ok. No GUI file changed
and no API shape changed, so no GUI suite was run. Not tried: a real
vendor that lists copies (the reporter named none).
2026-11-15 09:02:39 +08:00
yetone a5e3972a71 agent: the Codex account the user keeps Codex on is never taken over when held, so the app shows it, not "magpie" (davezfr on X)
davezfr on X, after v0.1.4216 (369ec0418): "still shows Magpie". Account
1 has used up both its plan allowance and its credits; picked in Codex's
sign-in it shows "magpie" in the Codex app, while account 2 (room) shows
itself. When it still had credits this didn't happen.

Cause. With quota and credits both gone the account is held (codexHeld:
rate_limit.allowed false, no credits), and the agent package's out()
then makes magpie Codex's provider (codex.out takeover, #540) without
requires_openai_auth. Codex's app-server answers account/read with no
account for such a provider, so the app shows the provider's name,
"magpie", in place of the account the user picked. 369ec0418 only
ended stale holds at their window's reset; a real hold still took the
account over. The takeover is magpie's default; the account the user
keeps Codex signed in to is the user's own value, which the default
overrode (code standards: magpie's default never overrides a value the
user set).

Fix.
- provider.CodexSignInKept: Codex is on the account the user keeps it
  on (keepsLogin: KeepLoginAs names the active account, or kept on the
  first with none named). False under switch-only, keeping off, or kept
  on another account than the active one.
- agent: out() is false for such an account (codexSignInKept, a var
  for tests), so Sync leaves Codex beside its ChatGPT sign-in, a pick of
  magpie's model doesn't take it over, and a takeover made before the
  keep ends. The app shows the account and greys Send till its reset,
  as it does without magpie. Not kept, a held account is taken over as
  before (Always ChatGPT still turns the takeover off for every account).
- docs/subsystems/agent-wiring.md says so.

Users already affected: once updated, the next catalog sync puts Codex
back beside the kept account's sign-in; the Codex app shows the account
after its app-server restarts (the Agents row's Restart, or Restart the
Codex app to follow), as for the takeover's end at a reset.

Tests:
- TestCodexKeptOnAHeldAccountShowsIt (agent): held and not kept: the
  takeover; kept: beside the sign-in, no AppOut, on magpie's model and
  on Codex's own joined model; let go: taken over again.
- TestCodexSignInKept (provider): the reporter's state, two accounts,
  account 1 held (week at 100%, not allowed, no credits) and kept via
  SetKeepLoginAs: CodexUsedUpKnown true and CodexSignInKept true; kept
  on account 2 while on 1, switch-only, keeping off: false.
Broken by hand: with `&& !codexSignInKept()` taken out of out(),
TestCodexKeptOnAHeldAccountShowsIt red (model_provider = "magpie"
written); with CodexSignInKept's match turned to false,
TestCodexSignInKept red ("CodexSignInKept false").

Run: full suite `go test -count=1 -timeout 45m ./...` on mote at this
change on ca64168d3: exit 0, 101 packages ok, no FAIL (log kept whole
in magpie-wt/codex-held-account-scratch/suite.log). After rebasing on
6e6a18eda (gateway only): internal/agent ok, internal/provider ok on
mote. gofmt -l clean; on mica go vet (darwin), GOOS=linux -tags nogui
and GOOS=windows go vet ./internal/agent ./internal/provider ok.

Not tried: the real Codex app with a real held account, and the
reporter's exact setting (if account 1 was picked by a plain switch
rather than kept, magpie moves Codex off the held account to account 2
at its next look, as before, and the takeover stands meanwhile).
2026-11-15 07:39:25 +08:00
yetone ca64168d3e library: a skill beside itself folds back on read; GitHub by git address is one repo
Refeccd on X said eee217712 (v0.1.4213) didn't fix "skills from a grouped
git repository get the repository's suffix". Reproduced in a sandbox HOME
three ways the fix left open:

- Copies an earlier magpie had already suffixed (blog-team beside blog)
  were folded only by foldBeside in a change. Upgrading and opening the
  Library changed nothing; Read, CheckSkills and Read again all kept them.
  readView now folds them too, when any skill has Called and a remote
  source, saves and syncs the agents in the same read, so a folded copy's
  links don't point at a removed folder. Sync problems join the view's.
- A GitHub repository added as owner/repo and then by its git address
  (git@github.com:owner/repo.git) was two sources: sameRepo and
  fromSameSource compared Kind first, so every skill went in again as
  name-owner. Both now match github and git sources through remoteRepo.
  foldBeside folds a copy from the same folder of the same repository
  (before only one whose target was Gone and at another path).
- gitRepoOf looked at a skill's folder and three above it, while a probe
  finds skills four folders into a repository: a checkout's
  skills/team/writing/poem wasn't traced, and an edited poem went in as
  poem-sub. It now looks at the folder and four above it.

Existing suffixed copies: folded on the next read of the Library page
(or next change); the copy's files, renamed, replace the skill's, its
agents are added, and both old folders go to the backups.

Tests (skill_group_suffix_test.go), each broken by hand:
- TestSkillBesideItselfFoldsOnRead: red with the readView fold removed.
- TestGitHubRepoByGitAddressIsHad: red with sameRepo kept same-kind.
- TestGitHubCopyByGitAddressFoldsBack: red with each of the above and
  with foldBeside's old condition.
- TestCheckoutSkillFourDeepIsTraced: red with gitRepoOf at 4.

Docs: docs/subsystems/library.md's "Skills installed together" no longer
says nothing is renamed after the fact; it describes sameRepo, movedIn,
besideName, followsHere's depth and foldBeside on read.

Run on mica at 168d6fb13 (on origin/main ab7cb5537): gofmt -l internal
clean; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet -tags
nogui ./... ok; go test -timeout 45m ./... ok, 101 packages, no FAIL
(internal/library 298s). An earlier full run at 1bfdeab52 was red in two
of these new tests only: other tests mark owner/repo tooBig for the whole
run, so the fixture now uses its own repository (refeccd/grouped-skills).
No GUI file changed and no GUI test was run: the change is Go only.

Not tried: a real GitLab or intranet repository, and the reporter's own
layout (the reply gave no detail); a real GitHub repo by SSH address
(the test maps it to a local repository through git insteadOf).
2026-11-15 07:04:53 +08:00