Commit Graph
2493 Commits
Author SHA1 Message Date
yetone 3d25679154 accounts: a setup-token pasted into the Claude import is added as one, not taken for a refresh token
liukaybee on X asked whether the token `claude setup-token` prints can be
pasted into Providers > Claude > Import accounts. It couldn't: the paste
box read every bare line as a refresh token, and a Claude one with no
email failed with "the file doesn't say which Claude account this is".

parseLoginImport now reads each bare line (and a JSON string) through
bareImport. A line that is a setup-token (sk-ant-oat..., bare, as
CLAUDE_CODE_OAUTH_TOKEN=... or export CLAUDE_CODE_OAUTH_TOKEN="...") is
checked by checkClaudeSetupToken and added by AddClaudeSetupToken, the
same path as "Add an account by setup-token...": kept in logins.json,
named by its hash, nothing asked of Anthropic. One magpie already has is
"exists", twice in one paste is "in the files twice", an sk-ant-api key
pasted there is refused as an API key. In the ChatGPT import a setup-token
is refused as Claude's and never sent to ChatGPT's token endpoint.
Refresh-token lines and JSON files in the same import work as before. No
result row carries the token; nothing here logs.

Run (mica, mica-run):
- TestImportClaudeSetupToken red on origin/main's login_import.go
  (#2..#5 failed, setup-token lines "doesn't say which Claude account"),
  green with the fix.
- go test ./internal/provider -run 'Import|SetupToken|Login': ok
- go vet ./internal/provider: ok
- go test -timeout 45m ./internal/provider ./internal/cli: ok, ok
- gofmt -l internal/provider: clean

Not tried: a real setup-token pasted in the real app (the add path it
calls is the existing one, itself not tried with a real token).
2026-11-16 15:58:58 +08:00
yetone 56c988cb5e gateway: /v1/realtime passes a Realtime API session on to its provider (Qwen Token Plan's realtime voice)
gaubeebangeel (X) set up Qwen's Token Plan in magpie and couldn't use its
realtime voice: magpie had no /v1/realtime, so the WebSocket upgrade got a
404. Token Plan does cover realtime: qwen-audio-3.0-realtime-plus at
wss://<plan host>/api-ws/v1/realtime?model=… with the plan's sk-sp- key,
OpenAI Realtime events
(platform.qianwenai.com/docs/token-plan/best-practices/realtime-voice).

GET /v1/realtime and /realtime upgrade to a WebSocket after the same Front
guards as every route (lanGuard, corsGuard, keys, the rebinding check),
plus a same-origin check on the socket's Origin. The model resolves as on
the other routes (a bare id unlisted anywhere goes to the one DashScope
provider that is on), with key, model and account holds, and each try is
dialled in turn with the account's key. A DashScope base ending
/compatible-mode/v1 dials /api-ws/v1/realtime; any other base dials
base+/realtime (OpenAI). Frames go both ways as they are; a close goes on
with its code and reason. Text frames are masked going up and restored
coming down (audio appends and deltas are not), failing closed. Each
response.done's usage is recorded as a "realtime" call (cached input as
cache read). openai-insecure-api-key / organization / project
subprotocols never go upstream. Shutdown ends open sessions with 1001.
/realtime is a client route on magpie web's port (and in the LazyCat
manifest), and a read-only key is refused it.

Run (mote, at this tree):
- TestRealtime* (fake upstream WebSocket, no network): Token Plan path,
  echo, binary, close both ways, usage 60 in / 40 cache read / 20 out,
  OpenAI-style path, subprotocol filter, masking; guards: 426, 400, 404,
  Origin evil/null/localhost subdomain 403, rebound host, remote without
  key 401, key held to another provider 403, vendor 401 passed on.
- Broken by hand, each went red: subprotocol filter removed, masking off,
  cached tokens not subtracted.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: clean.
- go test -count=1 -timeout 45m ./internal/gateway ./internal/masking
  ./internal/gui: the first run found TestClientPathCoversHandler,
  TestReadOnlyKeyEveryRoute and then TestLazyCatManifestListsTheClientRoutes
  red, all fixed here and rerun green. Otherwise ok. The log has one
  recovered "close of closed channel" in continuation_test.go:781's
  doneHold fake upstream (a test fake this change doesn't touch; in both
  runs), already filed as #6505 (and its duplicate #6690).
- Rebased on origin/main 6dbd6e5b1 and rerun at the rebased head: the
  TestRealtime* tests, the three route-list guard tests, gofmt -l, and
  GOOS=linux / GOOS=windows go vet ./internal/gateway.

Not run: the full ./... suite at any head (mote at load ~22-33 of 18, mica ~66 of
12). Not tried with a real Token Plan account or a real Realtime client.
2026-11-16 15:31:53 +08:00
yetone afd2df09b9 gateway: a Copilot Gemini conversation past the model's 10 images goes on with its oldest left out (yuushabu_buyinn on X)
Copilot refuses a Gemini request whose conversation holds more images than
the model takes ("too many images: maximum allowed for model
gemini-4-carbon is 10, got 12"), and it counts every image in the
conversation, not one message's. A long chat with screenshots stopped
working for good.

Now, on that 400 from a Copilot account, the gateway learns the cap the
error states (per provider and model), replaces the oldest images outside
the latest user message with a one-line placeholder until the count fits,
and sends again once. Later turns are fitted before they are sent. A
request under the cap is never changed. If the latest user message alone
is over the cap, the refusal is passed on as it came. Other vendors are
untouched (imageCapped: Copilot accounts only).

The cap is learned from the 400, not from /models' max_prompt_images:
Copilot lists 1 for gpt-* and 5 for Claude models but took 3 images on
gpt-4.1 and 7 on claude-sonnet-5 live, so the list is enforced only for
Gemini and would strip images that are fine.

Run (suite at the pre-rebase tree 4649e2269; after rebasing on 58cf76453, internal/gateway ran again: ok, 923s; on b9c385286 the targeted gateway tests above plus Advisor: ok; and go vet ./internal/... plus linux and windows vet of gateway and provider: ok):
- Red on the old code: with the two gateway.go hooks taken out,
  TestCopilotGeminiImagesOverCap and the follow-up turn fail with 400
  "too many images"; green with them.
- go test ./internal/gateway -run 'ImageCap|CopilotGeminiImages|ByteCap|
  OverByteCap|CopilotGemini|BodyCap|Compaction': ok.
- Full suite on mote (go test ./... -timeout 45m, one suite on the box):
  101 packages ok, no FAIL (gateway 1049s, agent 447s, provider 277s).
- go vet for darwin, linux and windows: ok. gofmt -l: clean.
- Real Copilot (gh token, sandbox HOME, magpie serve -tags nogui on mote):
  gemini-4-carbon with 12 images: 200 after one refusal and a resend with
  10; the next turn with 12: 200, fitted before sending; 10 images: 200
  unchanged; claude-sonnet-5 with 12 images: 200 unchanged.

Not tried: Copilot Gemini over Responses or Anthropic routes (Copilot
serves Gemini on /chat/completions only); a GUI path (none changed).
2026-11-16 14:51:54 +08:00
yetone b9c385286b agent: the disconnect preview reads no sign-ins, so macOS never asks "Keychain Not Found"
jasonz3g on X (macOS, two Claude accounts): clicking Claude Code on the
Agents page made macOS ask "Keychain Not Found — A keychain cannot be
found to store …" (Cancel / Reset To Defaults), dozens of times.

The Agents page loads a disconnect preview each time an agent's box
shows: DisconnectPreview runs Disconnect on a copy, in a subprocess
whose HOME is a temporary folder. Claude Code's Disconnect builds the
model list (buildModels -> CatalogFor -> provider.All -> Accounts ->
rememberLogins -> liveLogin), which read the Claude sign-in with
`security find-generic-password`, and Cursor's too. On a Mac the
keychain is found through HOME, and the temporary one has none. With a
copy of real ~/.claude and ~/.config/magpie, the dry run ran security
three times under the temporary HOME, started Devin's CLI there, and
rewrote held/lapsed in the copy's logins.json.

previewEnv now sets MAGPIE_NO_ACCOUNTS=1, which every keychain read and
write, liveLogin and askClaudeStatus already honour. The dry run of
the same real copy then runs no security and no CLI, and the agent's
~/.claude files come out byte for byte the same as before (diff -r), so
the preview shows the same changes.

Run:
- TestDisconnectPreviewReadsNoSignIns (new), red on the old code
  (security find-generic-password -s Claude Code-credentials ... twice),
  green after; its second half checks the fixture does reach the
  keychain out of the dry run.
- go test ./internal/agent -count=1 -timeout 45m: ok on mica (macOS)
  and on WSL Ubuntu (magpie-desktop); GOOS=linux and GOOS=windows go
  vet ./internal/agent ok; gofmt -l clean.
- Real binary, dry run of `claude` on a copy of real ~/.claude and
  ~/.config/magpie with logging security/claude stubs: 3 security calls
  before, none after.

Not tried: the GUI dialog itself (no display over ssh); the
reporter's own accounts.
2026-11-16 14:45:15 +08:00
yetone 50f7a8e01f routing: a Smart row behind one renewing sooner says so; Smart says new conversations go there too
YsiCing on X: in Smart, every conversation went to one Codex account (pro,
74% of its week) while Business and team, both at 0%, said "已用 0% · 会话留在另一个账号" ("0% used · the conversation stays on another account").
That is what Smart is meant to do. It sends every request, new
conversations included, to the one account whose quota renews soonest, and
only Stays: Session or Strict spreads new conversations. But the row blamed
a kept conversation, and the Smart description said "one account at a time"
without saying that covers new conversations, plus "at 90%", which is wrong
for a week since d5d48f4f9.

- routing plugin client.js behindWhy: when the account in use also renews
  sooner, a row says "{n} used · one renewing sooner goes first" (and
  "renews in"/expires as before), not "kept"; "kept" is left for a row that
  would have gone first without the kept conversation. Four languages.
- The Smart description (app.js, i18n.js) now says every request, new
  conversations too, goes to the one account renewing soonest until it
  runs low. app.js is 4 bytes shorter; the budget is not raised.
- docs/reference.md: Smart is not load balancing; to spread conversations,
  set Stays to Session or pick Least used first.

Run:
- routing-behind-why.test.cjs on mote with the old client.js: 62 fail,
  40 pass (the "kept on the one renewing sooner" and "fresh" cases, both
  engines, all 5 languages). Green on the new code.
- mica-run go test -tags nogui ./internal/gui -run
  'TestCoreScriptBudget|I18n|Lang': ok. gofmt -l internal/: clean.
- GUI subset on mica at base c867a12c5: routing-*, i18n-*, account-arrange,
  account-weight, builtins, gateway-model-info, key-weight, rotate-figure
  and update-blocked (203 files). 3482 passed, 20 failed. I reran the 7
  red files at base c867a12c5 and with this change, one after the other:
  the same 17 are red at base (#6520 routing-signin, #6010 account-arrange,
  #6512 pin-away, #3799 row-swap, #3954 story-shrinks, #5647 pulse under
  load). routing-stage-routes 420px is red once in en and once in zh, on
  rows with no Smart account, a single read of the on class: #6830.

Not tried: real Codex accounts (fixtures only), and the Linux app's
WebKitGTK.
2026-11-16 14:40:53 +08:00
yetone 1aa348d145 gateway: Claude Code's /advisor works through a Claude subscription (#6804, #6813)
The Claude subscription bridge runs the real Claude Code with magpie's
tools only, so Claude Code's advisor (Anthropic's server tool
advisor_20260301) was read like a translation without one: dropped from
the request and its instructions rewritten to "The advisor tool is no
longer available". /advisor did nothing (recih on X, #6813; swordencao's
group advisor, #6804).

bridgeRequest now reads a Claude Code request whose advisor model magpie
serves (advisedInBridge: provider.Resolve takes it, groups and [1m]
included) as readAdvised does: Request.Advisor is set, the instructions
stay as Claude Code wrote them. The run is offered advisorToolDef beside
magpie's tools; mcpCall answers a call by asking the advisor model
(adviceRound, 55s), and the client is told a server_tool_use and an
advisor_tool_result as Anthropic's server tells it, max_uses_exceeded
past three a reply. Claude Desktop and an advisor magpie doesn't serve
go as before. Nothing about the request's identity changes: the run is
still the real Claude Code, and the advisor tool goes to no upstream.

adviceFor, shared with the vendor route, now cuts Claude Code's advisor
instructions from what the advisor model is asked (advisorCut). With
them, or advisorGone in their place, the advisor answered as the executor
that it had no advisor; seen in the reporter's exact #6804 run.

Not changed: Claude Code's Code Mode (read in 2.1.325) needs ANTHROPIC_BASE_URL
on api.anthropic.com, first-party auth with no auth token or helper, and
a GrowthBook flag; no gateway can serve it without faking Anthropic.

Run:
- go test ./internal/gateway -run 'Advis|ClaudeTUIAdvisor|BridgeRequest'
  ok (mote). Red on the old code: TestBridgeRequestKeepsTheAdvisor
  ("the advisor is \"\""); with advisorCut a no-op,
  TestAdvisorServedForAVendorModel and TestClaudeTUIAdvisorAnsweredHere
  ("the advisor was told of itself").
- go vet ./internal/gateway on darwin, linux, windows; go test
  ./internal/gateway -timeout 45m at 7abbfac34 (rebased on origin/main
  2026-11-16): ok, 946s (mote). At d54abb292, rebased on 58cf76453:
  vet on the three OSes and -run 'Advis|ClaudeTUI|BridgeRequest|
  Subscription|Doc|Subsystem' ok.
- Real Claude Code 2.1.316, sandbox CLAUDE_CONFIG_DIR and HOME, the
  owner's real Claude subscription, magpie serve on a sandbox port,
  #6804's settings (model group/claude-opus-max, advisorModel
  group/claude-fable-high[1m], effort max), claude -p: server_tool_use plus an
  advisor_tool_result with real advice (17x19 checked two ways), the
  answer built on it. Earlier, a natural coding task got advice mid-run
  and kept going. Tokens unchanged; the sandbox keychain item deleted.

Not tried: the interactive /advisor in the TUI client (only -p), Windows
and Linux runs of the bridge, Code Mode in a sandbox.
2026-11-16 14:35:47 +08:00
yetone b1dd96ab14 agents: a client of a Remote magpie starts its agents on the remote's models and follows them (KoiLx0 on X)
KoiLx0 runs several computers on one remote magpie and had to set every
agent's models again on each of them, and again whenever the remote
changed. Routing groups already reach a client (a group is a model of the
remote's list, TestRemoteMagpieNewGroupServedBesidePicks); the agents'
picks did not.

- The remote tells, per connected agent, each model field's catalog ref
  at GET /v1/magpie/agent-models (gateway.SharedAgentModels,
  agent.SharedModels). Guarded as the Library is: this computer, or a
  full-access key of a magpie shared on the network; a held key is
  refused (readonly_test), and another machine without a key gets 401
  (TestNetworkGatewayGuardsEveryRoute).
- An agent connected here starts on those picks where this magpie lists
  them as <remote id>/<ref> (How "remote", after "again" and "joined";
  the Agents page says "as on the remote magpie", in all five languages).
- A field taken from the remote, or found on its pick, is recorded in the
  stash and follows the remote's change every 5 minutes
  (FollowRemotePicks from library.KeepLinked). A model picked here is the
  user's: the record goes, and the field is left alone until it is on the
  remote's pick again. A pick this magpie doesn't list is skipped.
- app.js budget: no raise. The new line's 76 bytes come from same and
  alike sharing one string (CONN_WAS) and the native joined case
  returning plain instead of the same t() again.

Run at this head (rebased on c38753a7e, i18n-keys ok there; before that on b010fba05, whose budget raise left 2 bytes;
CONN_WAS's short name gives them):
- mote: go test -count=1 ./internal/agent ./internal/gui ./internal/library
  ./internal/provider: all ok.
- mica: go test ./internal/gateway (whole package, at the pre-rebase tree,
  ok 920s); at this head go build ./... and the gateway's guard, read-only
  and Library tests: ok.
- mica: GOOS=linux and GOOS=windows go vet of agent, provider, gateway,
  library: ok. gofmt -l: clean.
- mica at this head: go test ./internal/gui (budget ok), i18n-keys,
  agent-leave-magpie, agent-connect in chromium + webkit: ok.
- mica, chromium + webkit, before the last rebase: i18n-keys, i18n-en-no-cjk, agent-leave-magpie,
  agent-connect, agent-connect-no-models, agent-connected-unfolded: 0 fail.

Broken by hand: with connectRemote cut out of connect(),
TestConnectFollowsTheRemoteMagpiesPicks fails (connected on
aaa/claude-opus-5-5 (alike)); with the follow's "still the recorded value"
check made always true, it fails on the user's pick written over.

Not tried: two real computers; only a fake remote in the tests. Left for
#6824: a headless `magpie serve` client doesn't follow later changes
(the loop runs in the GUI), an empty field the remote fills later isn't
filled, and WSL / claude#name agent ids don't match across machines.
2026-11-16 14:18:47 +08:00
yetone c38753a7ee search: Settings can ask every search API at once, results merged (heyiwei5 on X)
The search APIs are asked in order: the next only when one fails or
finds nothing. Asking several together, with their pages merged and
repeats dropped, has existed since #2845 but only through
`magpie search mix`. Settings › Models › Web search now has an Advanced
fold, shown with two or more search APIs on, holding "Ask the search
APIs: In order | All at once". All at once marks every API on as mix
(POST /api/settings/search-api {"mix":[...]}, provider.MixSearchAPIs);
In order clears the marks. In order stays the default. A mix of some of
the APIs, set from the CLI, opens the fold with neither choice on and
names the APIs it asks.

Run (mote, at this tree):
- go test ./internal/gui -count=1: ok.
- TestSearchAPIsMixedFromSettings at origin/main's api.go: build fails
  (searchAPIJSON has no Mix), so it is red on the old code.
- node --test search-mix, search-count, search-api, i18n-keys:
  72/72 pass, chromium and webkit, en/zh/zh-TW/ja/de, 1100 and 560px.
- search-mix.test.cjs at origin/main's assets: 0 of 30 pass (red).
- gofmt -l: clean.
- After rebasing on b010fba05 (GUI pages): the gui Budget/I18n/mix Go
  tests and search-mix + i18n-keys GUI (34/34) pass again.

Not tried: the whole GUI suite, and a real search through mixed APIs
with real keys (the merge itself is unchanged since #2845).
2026-11-16 14:12:48 +08:00
yetone b010fba05b gui: the pages go in the reader's own order, in the sidebar and a phone's tab bar (chet030714 on X)
Settings › General › Sidebar pages, where pages are hidden, now also puts
them in order: a row is dragged by its grip (shown on hover, always on a
touch screen), or moved with Alt+↑/↓. The order is kept for this browser in
localStorage magpie.navOrder, beside magpie.navHidden. The sidebar and the
header's tabs follow it at once, and a phone's tab bar (phonetabs.js)
shows the first four with the rest under More. Providers is listed (it can
be moved, never hidden). While the order isn't the home one the sidebar's
group names (Work, Models, ...) are left out, since a reordered list breaks
the groups; Default order (shown only then) removes the key and puts the
pages and their names back. A page the kept order doesn't name (new in an
update) goes after the page it follows at home. Plugin pages keep their
place in their group. A reader who never reorders sees nothing change.

navOrder and navArrange live in the new navorder.js, imported by navHides
only once an order is kept (and by navpages.js with the menu), so what is
left in app.js is that one line: +107 on both core budgets, explained there.
old-webkit's list of on-demand scripts names navorder.js.

Built on the unpushed WIP 10b9ee22c (page-order worktree), cherry-picked
onto origin/main; the WIP test clicked the aria-disabled Providers row
without force, and its reload checks now wait for the async import.

Run:
- nav-pages-order.test.cjs (new): Chromium and WebKit, en/zh/zh-TW/ja/de,
  10/10 pass. Red on origin/main (no menu opens), 5/5 chromium.
- The whole GUI suite (make test-ui) on mote at the first, inline version
  (navArrange ran on every start; the final version runs nothing new for
  a reader with no order), stopped after 4,171 ok / 171 not ok, none in a
  nav, sidebar or phone file. Five of the red files (agent-switch-accounts,
  gateway-key-arrange, first-untick, data-folder, api-key-theme) rerun on
  mica at this tree and at origin/main c1ab9a494: 34 pass / 56 fail on both.
- At the final tree on mica: every nav*, phone*, side*, sidebar*, i18n*,
  last-page, menu-scroll*, settings-search and old-webkit file:
  377 pass / 42 fail; the reds (menu-scroll, nav-timeout,
  phone-no-sideways, side-effort, old-webkit) fail the same at origin/main
  c1ab9a494, and last-page webkit's (two requests cut off counted as page
  errors, #5972's kind) passed 3 of 3 alone; go test ./internal/gui/...: ok.
  old-webkit's two reds are #6570/#6030 (navpages.js, headerpresets.js
  missing from its list) and #5919, the same on origin/main.

Not tried: a finger drag on a real phone (the test taps the menu and
checks the grip shows; the drag is the mouse path dragRows shares), and
the real app's window (Wails); the GUI tests load the real assets.
2026-11-16 14:06:03 +08:00
yetone c1ab9a4946 gateway: an input item a Responses upstream has no type for is translated, and a compaction refused so is asked as text (cyberestro on X)
cyberestro on X: a Codex subagent on a local Qwen server's Responses API
(qwen, http://127.0.0.1:30010/v1) got "compaction: qwen (qwen, …) answered
the summary request 400 Bad Request: qwen: Unsupported input item:
agent_message". agent_message is the item Codex's MultiAgentV2 hands a
subagent its task in (author, recipient, input_text content, as #5259's
and plugins#61's requests carry it).

Two gaps, both fixed:
- The compaction's fallback for an input kind refused (inputKindRefused,
  #5181, #5259) read only "unsupported_input_item" and "unknown item
  type". inputKindWords now reads "unsupported input item" with spaces
  too, so the summary is asked again with the conversation as text, the
  agent_message as the user's turn (itemText), then compacted locally.
- The normal path relayed every subagent turn to the same server with
  the agent_message as Codex sent it, and gave the 400 back. passthrough
  now treats that refusal, on a request carrying an item other than a
  message, function call, its output or reasoning (hasOtherItem), like a
  custom tool refused (#2656): the model is marked (inputKindsRefused)
  and the turn is translated on the same API, where agent_message is the
  user's turn and a custom tool call a function call; later such turns
  go translated at once. A native compaction or sealed task still gets
  the refusal, and magpie's own summary ask (inCompaction) keeps its
  text fallback.

Run (mote, mica):
- New tests on the old code (ae0a78368), red: TestUnsupportedInputItemTranslated
  (400 "qwen: Unsupported input item: agent_message", stream and not),
  TestInputItemRefusalWordings, TestCodexCompactQwenInputItemAsksAgainAsText
  (the reporter's compaction error, word for word).
- Same tests green on the fix, with TestCodexCompact*, TestCustomTool*,
  AgentMessage, Sealed, Zed and Grok tests.
- A first version also translated the summary ask; it broke
  TestCodexCompactUnsupportedInputItem* (asked 4 times, not 2), so the
  summary ask was left to its own fallback.
- gofmt; go vet ./internal/gateway on darwin, GOOS=linux (nogui),
  GOOS=windows; go test -tags nogui -count=1 ./internal/gateway: ok (925s, this change on origin/main c867a12c5).

Not tried: a real Qwen server (the reporter's server and its exact JSON
body are unknown; the fixture uses the words magpie showed), Codex end to
end, and the full ./... suite (mote was running another session's).
2026-11-16 13:49:16 +08:00
yetone c867a12c5b claude: a client sending earlier turns' images back still goes on in its run
Yqihotaru (X) keeps a long conversation on claude-opus-5-5 through the
bridge, and their client takes the images of earlier turns out of some
requests and sends them back in others: the log's image count flips
between 2 and 4, every turn says "no run here has had this conversation",
and a new Claude Code starts from a transcript each time, so the prompt
cache is lost every turn.

lostMedia (#1382) took only images taken out, and looseTurn compared the
last turn alone with the whole history before it hashed exactly. Now
mediaMoved compares the conversation one role's run of messages at a
time, either way (images taken out, or put back where nothing or a line
of text stood). follows uses it for tool results; looseTurn keeps the
whole conversation and its settings apart, and rewrote takes a request
with the same settings whose images alone moved, in any turn. A sealed
tool result keeps the last 2KB of its words so one sent back without the
client's line is told from one changed otherwise.

Run (mica): go test ./internal/gateway (whole package, -tags nogui,
-timeout 45m) ok; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go
vet of internal/gateway ok; gofmt -l clean. Rebased on origin/main f5f27070a (only a Gemini
slash-model change in gateway since); at that head the image, lost-media,
loose-turn and Gemini slash tests run again ok on mica.
Broken by hand: on the old matching (lostMedia in follows, no put-back in
mediaMoved) TestClaudeImagesComingAndGoingInEarlierTurnsGoOnInTheRun is
red at turn 2 ("2 runs") in both subtests, with the reporter's log lines,
and the sent-back cases of TestClaudeToolResultsAfterTheImagesSentBackGoOn
and TestMediaMovedIsOnlyImagesComingAndGoing are red.
Not tried: the reporter's real client or a real Claude account; the full
./... suite (gateway package only). branch() and whyNoRun still compare
exact hashes. A run that never had an image the client sends back goes on
without it, answering from the gap or line it was told before.
2026-11-16 13:20:43 +08:00
yetone 3ad5b93d41 provider: a Gemini model id with a slash keeps it in the request path (#6695)
A custom Gemini compatible provider's namespaced model id
(example/model-demo) was asked at /models/example%2Fmodel-demo, since
GeminiPath escaped the whole id. A relay that routes by literal path
segments answered 403 Invalid URL (POPOBE97 in #6695, LuoRuiyao on X).
GeminiModelPath now escapes each segment and keeps the slashes, so the
request goes to /models/example/model-demo:streamGenerateContent. An id
with an empty, . or .. segment, which a server could clean into a path
outside models/, still goes as one escaped segment. Google's own ids
(no slash) give the same bytes as before.

Siblings made to agree: Vertex AI's VertexPath, VertexWholePath, its
model test and the Claude rawPredict path (a slash id there goes to
partner chat completions, so only the pinned test changed), the
plugin Code Assist path in plugins.go and Gemini image generation in
draw.go, both of which put the id in raw before (a ? or space broke
the URL).

Run (on mote):
- red on the old code (old provider/gateway files, a shim for the new
  helper): TestGeminiModelPathKeepsSlashes FAIL
  `GeminiModelPath("example/model-demo") = "example%2Fmodel-demo"`;
  TestGeminiNamespacedModelKeepsItsSlash FAIL `status 403, asked
  [/v1beta/models/example%2Fmodel-demo:streamGenerateContent?alt=sse]`.
  Both pass with the change.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build for darwin, linux (nogui), windows.
- go test -tags nogui -timeout 45m ./...: all 101 packages ok.

Not tried: a real relay that routes by namespaced id, or a real call to
Google's endpoint (its paths for slash-free ids are byte-identical, held
by the test).
2026-11-16 13:17:46 +08:00
yetone 13e8002641 claude-desktop: two providers' Claude model read "Opus 5.5 · agy-cli", not the id's tail (onkashiko on X)
Claude Desktop names a row listed as magpie-<n>.anthropic.claude-opus-5-5
after its own catalog ("Opus 5.5"), whatever display_name says, so
agy-cli's and another provider's claude-opus-5-5 read alike and Desktop
5.11492 told them apart by the part of the ids that differs: "Opus 5.5
(…<n>.anthropic.claude-opu…)" (xVn/wVn in its app.asar). Only an
inferenceModels entry's labelOverride comes before the catalog's name,
and Desktop never suffixes such a label (keep in xVn).

magpie now writes the profile's inferenceModels, each row's display_name
as labelOverride, while two rows are named after one Claude model of
Desktop's catalog (desktopNamesClash), not only while a tier is picked.
The ids are unchanged. As with a tier's list, Desktop reads it at start
and its menu stays as listed until the next start; the Agents row's
Restart shows.

desktopNames' own fallback for two rows display_name still leaves alike
(one provider's models named alike) is now the model's id, "Z · D (z2)",
not the whole catalog id; two providers of one name keep the catalog id.
Claude Science takes the same names.

Run (mote, at origin/main 9dcec6751 + this):
- go test ./internal/gateway ./internal/agent ./internal/gui
  ./internal/provider -count=1 -timeout 45m: all ok.
- GOOS=linux and GOOS=windows go vet ./internal/gateway ./internal/agent: ok.
- gofmt -l: clean.
Rebased on 023a56373 (Windows install dialog only); at that head
go test ./internal/gateway ./internal/agent -run 'Desktop|Science': ok.
Broken by hand: with the list written only while a tier is picked (the old
rule), TestDesktopInferenceModelsCatalogNamesClash is red ("two Opus 5.5
rows, no list").
Not tried: a real Claude Desktop 5.11492 reading the list (the labelOverride
precedence and keep are read from its app.asar), and the reporter's setup.
2026-11-16 12:05:45 +08:00
yetone 023a563735 install: the Windows install dialog says the download can be deleted
@jiangshangmuyun on X updated on Windows and found a new magpie while
"the original is still there". That is by design since 14807bcf2: a
magpie-windows-amd64.exe kept in a folder of the user's own is asked
about and installed to <folder>\magpie\magpie.exe, a copy, and the
download is left where it was. Nothing said it could go.

Now the install dialog (installDialog, Windows' task dialog) has a
footer naming the exe it was opened from: "Once magpie is installed,
you can delete D:\Tools\magpie-windows-amd64.exe." It is in each
language the dialog speaks (en, zh, zh-TW, ja, de), and stays under a
refusal too. The file is never deleted by magpie; only the words are
new. The footer is TASKDIALOGCONFIG's pszFooter (offset 132 in the
packed 64-bit layout), left empty when the exe can't be told.

Tests: TestInstallDialogSaysTheDownloadCanGo (every language names
the exe once, no format error; none without an exe). Broken by hand:
zh's text without %s goes red with %!(EXTRA ...).

Run: go test ./internal/gui/ ./internal/update/ on mote (ok) and on
the Windows box: the new and existing install tests ok; 11 reds there
(TestGatewayHeldByAContainer, the four %AppData% import rows,
TestProviderSaveClientCert, TestPageAwayLetsStatsGo,
TestPluginAgentMissingSaysSo, TestGatewayModeStatsNameTheGatewaySessions,
TestUpdateThatWontStart, TestPackagedByDpkg) fail the same at a fresh
origin/main 9dcec6751 and are open (#6068, #4603, #6810, #5928, #6059); GOOS=windows go vet (amd64, arm64) of
internal/gui and internal/update on mote; gofmt -l clean. Real dialog:
a throwaway test (not committed) opened taskDialog on xiaomi-gpu's
console session with comctl32 6 and read it back through UI
Automation, en and zh: the footer is there under the buttons, full
path included.

Not run: a Linux go vet of internal/gui (the box has no gtk4/webkit
headers; installdir.go is pure Go and compiles on darwin). Not tried:
the real installed app's first start from D:\, or a screenshot of the
dialog (the console renders black over SSH-started captures).
2026-11-16 11:51:12 +08:00
yetone 9dcec67513 archive: the request archive in an S3 bucket is kept under a GiB, oldest calls removed
An R2 user on X: the sync bucket grew by 18 GB in under a month. The
backup and usage files are small and rewritten in place; what grew was
the request archive, every call written whole (bodies up to 32 MiB) as
archive/<date>/<id>.json and never removed. The archive on this computer
is capped at a GiB; the one in the bucket had no cap.

Now the bucket's archive is held to RequestArchiveMB (a GiB unless set,
carried by sync), down to a tenth under it past the cap, oldest first:
- only keys of ArchiveName's own shape under <prefix>/magpie/archive/
  are counted or removed; the backup, usage, other prefixes and anything
  else in the bucket are never touched (a test seeds seven such keys);
- uploads are counted as they go, and the bucket is listed again only
  after a tenth of the cap more is uploaded: one LIST for ~1000 calls,
  never one per call;
- the serving magpie lists once two minutes after it starts, archive on
  or off, so a bucket grown before this update is brought under the cap
  without the user doing anything (auto-cleanup chosen over a button:
  the objects are magpie's own, already capped locally, and a removal
  is logged);
- the Usage page's switch tooltip says the size ("…in <bucket>, up to
  1.1 GB"), in every language; the core script budget is kept, not
  raised: the two tooltips share one options object and the switch's
  aria-checked is set from a boolean.

The Nov 3 rise in Class B reads has no code cause found: archive reads
are click-driven only, and the backup's conditional GET runs every 3
minutes per computer online.

Red on the old logic (bucketAdded and KeepBucketArchiveBounded made
no-ops by hand, on mica): TestRequestArchiveKeptUnderItsSize "after 200
calls the archive holds 248 calls, 7629310 bytes, over its 1048576 (48
from 2020 left); 0 LISTs, 0 DELETEs"; TestBucketArchiveBroughtUnderIts
SizeAtStart keeps 30 calls / 3000 bytes; TestBucketArchiveListedPer
TenthUploaded "0 LISTs". With the fix: "200 calls: 44 kept, 986389
bytes; 4461157 bytes uploaded, 39 LISTs, 203 DELETEs".

Run at this tree (rebased on c6a67dd41):
- mote: gofmt -l internal clean; go test -timeout 45m -count=1
  ./internal/davsync ./internal/gateway ./internal/settings
  ./internal/settingsapi ./internal/cli: all ok (gateway 897s).
- mica: go test ./internal/gui ok (TestCoreScriptBudget included);
  GOOS=windows go vet of the six touched packages ok; GOOS=linux go vet
  of davsync, gateway, settings, settingsapi ok (gui and cli need
  WebKitGTK's cgo, not vetted for Linux).
- mica GUI, Chromium and WebKit, every language: request-archive,
  request-archive-usage, i18n-keys, i18n-en-no-cjk 22/22 at this tree;
  with call-headers, context-text, routing-bodies, routing-side-calls,
  usage-ledger-search and web-page 114/114 before the tooltip's last
  wording change.

Not tried: a real R2 or S3 bucket (fake S3 only), and the reporter's
own bucket contents.
2026-11-16 11:25:30 +08:00
yetone c6a67dd412 gui: the Windows main window is resized from its edges again (Puremilk_chun on X)
Since 0.1.4274 (dd77094ca) the main window on Windows is frameless, and
Puremilk_chun on X couldn't resize it. Wails' frameless window answers
WM_NCCALCSIZE with the whole window as the page, so Windows has no
resize border left: the invisible band outside a window's edge, where
Windows 11 users grab it, answered HTNOWHERE, and only Wails' 4px band
inside the page resized, which on the right lies under the page's
10px scrollbar (.view is overflow-y: scroll) and did nothing.

mainFrameCalc (mainframe_windows.go), asked first by appWndProc for
the main window alone, lets DefWindowProc work out the frame as for a
framed window and then puts the page's top back at the window's top.
The left, right and bottom are Windows' own resize border again; the
header is still the title bar, with the caption buttons, the shadow,
the rounded corners and snap as dd77094ca made them; the top is resized
by Wails' band. Maximised or in full screen Wails sizes the window as
before. keepResizeFrame names the window on Wails' runtime ready (the
first main window is made before the main loop runs) and has Windows
work the frame out again. gui-shell.md says so.

Run (at this tree, rebased on origin/main 3b643f397):
- gofmt -l clean. mote: GOOS=windows go vet ./internal/gui, go vet
  ./internal/gui, go test -count=1 ./internal/gui: ok.
- xiaomi-gpu (win-run): go test -count=1 ./internal/gui: TestMainWindowKeepsResizeBorder
  ok; 10 reds, all red the same at origin/main 3b643f397 run by name on
  the same box: TestPageAwayLetsStatsGo (filed #6810), the other nine in
  #6068, #5324, #5928 and #6059.
  WSL magpie-desktop: go vet -tags gtk3 ./internal/gui: ok.
- TestMainWindowKeepsResizeBorder (Windows): a real window answering
  as Wails' frameless one; the main window's left, right, bottom and
  bottom-right hit HTLEFT/HTRIGHT/HTBOTTOM/HTBOTTOMRIGHT, its page
  starts at the window's top, maximised the page is the whole window,
  and another window is left alone.
- Windows 11 on xiaomi-gpu, 100% scale, sandbox USERPROFILE, port
  3481, a real mouse (mouse_event) on each edge and corner, 2px inside
  and 3px outside, the window placed at 200,133 1000x640:
  - 0.1.4281: outside every edge hits 0 and nothing moves; inside, the
    right edge and bottom-right do nothing (the scrollbar takes the
    press, no mousemove reaches drag.ts), the others resize.
  - this tree: outside, right/left/bottom/br/bl hit 11/10/15/17/16 and
    resize 60px; inside as 4281; the header drags the window; the
    maximise button maximises to the work area and restore brings back
    the same rect; a screenshot shows the header at the top edge with
    the caption buttons, the border and the shadow.

Broken by hand: with mainFrameCalc answering false,
TestMainWindowKeepsResizeBorder is red (left/right/bottom/br hit 1,
"the page starts at the window's left edge").

Not tried: 150% scale (changing the display's scale would move other
sessions' windows on that box); snap (WS_THICKFRAME and the styles are
unchanged); the inside band under the scrollbar on the right is left
as it was, the outside border now covers that edge.

Rebased on f64c7e54f (routing, provider and a gui-shell.md paragraph
elsewhere): on xiaomi-gpu TestMainWindowKeepsResizeBorder ok; on mica
gofmt, GOOS=windows go vet and go vet ./internal/gui ok.
2026-11-16 10:50:49 +08:00
yetone 2ad38c8b3e provider: Baidu Qianfan's ended console sign-in asks for a new one in the editor, and a renewed cookie is kept (yuushabu_buyinn on X, #5860)
yuushabu_buyinn asked for AccessKey + SecretKey in place of the console
cookie, which expires. Baidu has no such route. Its documented OpenAPI has
no read for a Token Plan Personal:
- the Qianfan API catalog (doc/qianfan/s/Smownk4en): 量包
  v2/charge?Action=DescribePackageResources lists token packs by series,
  with no Token Plan;
- Finance's API (doc/Finance/s/ojxecslph): bills, balance, orders,
  vouchers;
- the Token Plan Enterprise's seat APIs (tokenplan?Action=...
  DescribeTeamSeatUsageDetail), which take an API key and are for team
  seats only.
The Token Plan Personal doc (doc/qianfan/s/Dmrabu8b6) shows usage only on
the console's 我的订阅 page. So the cookie stays, and what is mended is
what happens when it ends:

- Before, a session the console refused showed "Signed out of the Baidu
  Cloud console" on the card, while the provider's editor still said
  "Signed in" with only Sign out. Now the kept sign-in is marked ended
  (qianfanSession.Ended, set the first time only, and not when a newer
  paste has replaced the cookie the read used). /api/providers says
  qianfanPlan.ended, and qianfanplan.js draws "Baidu Cloud ended this
  sign-in. Bring a new one:" above the bookmarklet and paste steps. A
  new paste, or a later read the console takes, clears the mark.
- A cookie the console sets in a reply that read the plan (on the
  resource's path) is merged into the kept Cookie header as a browser
  would: replaced in place, added, or taken out when deleted or expired
  (mergeQianfanCookies). A session Baidu renews as it is used then stays
  the one magpie holds. The paste check keeps what its reply set too.

The StepFun sibling (the same "still Signed in" gap, drawn by
renderStepPlan in app.js) is #6808. The Qianfan fix adds no app.js bytes.

Run (mote, at 3b643f397 plus this change; go test, vet, gofmt, qianfan-plan
and i18n-keys again after rebasing on f64c7e54f, all ok):
- gofmt -l, go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) for
  internal/provider and internal/gui: clean.
- go test -count=1 ./internal/provider ./internal/gui: ok.
- node --test qianfan-plan, i18n-keys, i18n-en-no-cjk: 12/12 (chromium +
  webkit, en + zh). stepfun-per-provider and qianwen-plan: all ok.
  old-webkit 4 and 5 are red the same on a clean 3b643f397 copy (#6030,
  #5919).
- Broken by hand: without the ended mark, TestQianfanSessionEnded fails
  "an ended sign-in should be kept, marked ended". Without the merge it
  fails "renewed cookie kept as ...s-1".

Not tried: no real Baidu Cloud account. How long the console's cookie
lasts was not measured (a third-party tool reports a few weeks), and
whether the console sets renewed cookies on this request is not known.
The merge does nothing if it doesn't.
2026-11-16 10:49:31 +08:00
yetone f64c7e54f1 provider: a Remote magpie's cards, limits and router go with its client certificate (#6413)
hhdaxia on X (0.1.4258), and Linsenx in #6413 with a patch: a Remote
magpie behind mTLS, with Client certificate and Server CA set on the
provider, answered model calls, but Usage → Overview's read of its
cards went without the certificate. The remote's TLS refused it, and
the 403 was then shown as "remote magpie isn't shared".

Two causes, both fixed for the class:

- magpie's own requests to a Remote magpie built their context without
  p.Via, so they missed the provider's proxy, client certificate,
  Server CA, unchecked TLS and pin. Via now goes in at the three choke
  points every such request goes through:
  - remoteBodyAs: cards, refresh, quota history, Codex reset, Library,
    version/update, the root /v1 that finds the MCP router;
  - askRemoteKeyLimit: a key's limit;
  - waitRemoteList: the model list's wait.
  The Library server for a Remote magpie's MCP router (/mcp/magpie/hub)
  is checked and called through checkTransport. That transport now goes
  through ViaRemoteMagpieAt, which applies the Remote magpie provider
  whose address matches.
- Every 403 without a key code was read as "isn't shared". remoteRefused
  now gives that only when the remote says "shared on the local
  network", which every not-shared 403 the gateway writes says. Any
  other refusal (magpie's own client-certificate 403, a proxy's page,
  an empty body) is shown with its status and the remote's own words,
  or names a client certificate check or a proxy in front.

Model calls, the connection test, sign-in and the cert peek already
carried Via; a grep of every NewRequest to a remote address found no
other route.

Tests:
- TestRemoteMagpieOwnRequestsShowClientCert: a real httptest TLS server
  with RequireAndVerifyClientCert and a cert from mtls.Store. It checks
  cards, quota history, key limit, root and list wait.
- TestRemoteForbiddenSaysWhatRefused: 403 bodies for not shared (JSON
  and lanGuard text), magpie's client-cert text, an nginx page and an
  empty body, through both remoteBody and askRemoteKeyLimit.
- TestRemoteMagpieRouterShowsClientCert (library): CheckServer on the
  router behind mTLS is refused with the CA alone and ok with the
  provider's certificate.
- fakePeer's 403 now writes the gateway's real not-shared message.

Run:
- At origin/main 3b643f397 with only the new tests (mote): all three
  are red.
  - Every provider path fails with "x509: certificate signed by unknown
    authority".
  - Every refusal reads "isn't shared".
  - The router check is "unreachable".
- At this head (mica):
  - gofmt -l is clean;
  - go vet for darwin, GOOS=linux -tags nogui and GOOS=windows
    (provider, library) passes;
  - go test -count=1 -timeout 45m ./internal/provider ./internal/library
    ./internal/gui: ok, ok, ok (135s, 124s, 142s)

Not tried:
- the reporter's real remote, or a real nginx doing mTLS;
- a full ./... suite;
- GUI tests (no GUI file changed: an error other than "isn't shared"
  was always shown as it came).
- gui/remote.go's remote-window probe and remote_moved's proves() are
  not provider requests and are unchanged.
2026-11-16 10:42:40 +08:00
yetone b34243823e routing: accounts' resets stay in their column, and resizing over many accounts is smooth (lexrus on X)
lexrus on X: on Routing's Accounts and keys, at some widths "resets in
3h" ran over the next column and the right column's words were cut, and
with many accounts dragging the window's edge was janky.

Overlap: the window parts' widths (--wk/--wv/--wr) were taken from the
widest window of the whole list, so one provider's long reset pushed
every row past its column. They are now per provider, and CSS caps each
part to its row.

Jank: the list was CSS columns, and the browser balanced every row again
on each layout. packActs (plugins/routing/client.js) places each
provider's box (and a long box's rows) itself under .rt-acts.packed with
--px/--py: down a column and on into the next, ends as level as a binary
search on the cap allows, a heading never last in a column. It runs on
the window's resize, on render, and a frame after a box's height changes.
Side mode (min1150, beside the requests) is unchanged: one scrolled
column, nothing placed. Measured on mote with a 100-row fixture, per
resize step: WebKit layout 26.6ms -> 5.9ms, frame p90 35 -> 18ms;
Chromium layout 8.24ms -> 2.86ms.

Test: routing-account-windows-fit.test.cjs, 4 and 20 Codex accounts, en
and zh, Chromium and WebKit, widths 420-1600: no window part runs past
or is cut, a provider's lines start together, the list isn't CSS
columns, boxes sit inside the list in column order without overlapping,
2+ columns at 700-1099. Broken by hand: the old assets are red on the
overlap; packing turned off is red ("the list isn't CSS columns").
gui-shell.md says how the columns are placed.

Run on mote at this change on origin/main 7bdda0450 (pushed on
3b643f397, which changes internal/provider only):
- the 209 GUI files that open Routing or read its files, plus
  i18n-keys and builtins: 3736 pass, 42 fail. Every red is red the same
  on a clean origin/main 7bdda0450 copy, or is filed: quota-bars-alike
  (#6700), ctx-session-line (#5801), quota-credits (#6807, filed now),
  routing-pin-away (#6512), routing-row-swap (#3799),
  routing-story-shrinks (#3954), mobile-web (needs .git for its
  origin/main baseline; #3952, #5013). routing-idle-frame's one WebKit
  red came under load (#3773) and passed 2 of 2 alone at this head.
- go test ./internal/gui: ok. gofmt -l: clean (no Go changed).

Not tried: the real Wails app, Linux WebKitGTK, Windows WebView2, and
lexrus's own accounts.
2026-11-16 10:42:18 +08:00
yetone 3b643f3978 provider: a Claude sign-in read mid-write on Windows is no sign-out
xbpb6 on X (0.1.4281, Windows 11, TUI mode): the account Claude Code is
signed in to said "Sign-in required" with "can't read the allowance";
signing in again fixed it for a while, then it came back.

Claude Code on Windows writes .credentials.json and .claude.json through
a temp file and a rename. Go's os.ReadFile opens without
FILE_SHARE_DELETE, so while magpie reads the file the rename gets EPERM.
Claude Code then truncates the file and writes it in place (xO in its
writer). A read in between finds the file empty or cut short.

- rememberLogins took that read as a sign-out. claudeLoggedOut marked
  the Held account lapsed with claudeLogoutLapse, which breaks the rule
  that a failed read means unknown.
- The account then read as not in use. Then claudeSavedDir, which has no
  Held check, could copy Claude Code's own sign-in into
  claude-accounts/<id> for a warm-up, a usage read or a request. Two
  Claude Codes then held one rotating refresh token, so whichever
  refreshed second signed the other out for good. That is why the
  account comes back as signed out again and again.

Now:
- claudeSignInUnsure reads the files again. The account counts as
  signed out only if the file is gone, Claude Code emptied it,
  `claude auth status` says logged out, or no account is named. A
  file that can't be read or isn't whole JSON is unknown for up to
  claudeUnsureGrace (2 minutes).
- Meanwhile, rememberLogins doesn't lapse the Held account, and
  Logins and renewLogins keep it active.
- claudeSavedDir refuses a Held account with errClaudeHeld, whose text
  is not one ClaudeSignInRequired matches.
- The Mac keychain path is unchanged.

Run:
- TestClaudeHalfWrittenSignInIsNoLogout was red on the old code on mote,
  in two ways (logs kept). An empty credentials file gave Active:false
  with claudeLogoutLapse, the screenshot's state. claudeSavedDir put the
  Held account in .config/magpie/claude-accounts/7f327d2462d8fb58 with
  no error. Green after.
- mote: go test ./internal/provider ./internal/gateway -count=1
  -timeout 45m: ok, 142s and 913s.
- win-run (xiaomi-gpu, Windows 11): TestClaudeHalfWrittenSignInIsNoLogout,
  TestClaudeAccountsOutliveLogout and TestClaudeSwitchIsNoLogout pass.
- gofmt -l is clean. GOOS=windows and GOOS=linux go vet
  ./internal/provider pass.

Not tried:
- No real Claude account on Windows. The EPERM rewrite was read from
  Claude Code 2.1.316's source, not watched.
- No full ./... suite.
- A Claude Code killed mid-refresh on Windows is not covered.
2026-11-16 10:09:47 +08:00
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