Commit Graph
3181 Commits
Author SHA1 Message Date
yetone 746cfbdecc provider: moved Qoder takes qoder-auth 0.2.9, whose international check-in lists the daily 100 credits (#1268)
Without Qoder's native device identity (Cosy-MachineToken and
Cosy-MachineType from its own runtime-info helper), openapi.qoder.sh
answers the campaigns list with VIEW_DETAILS only, so check-in found
nothing to claim. qoder-auth 0.2.9 (magpie-community/plugins#49) sends
it the way Qoder.app 0.4.3 does. The mover's min names 0.2.9, so
keepMovedCurrent updates every moved user. That also brings them 0.2.8's
CN enterprise VPC sign-in.

Verified: the owner's real international account through 0.2.9's fetch
(GET only) lists CLAIM_BENEFIT/CLAIMABLE/100, and VIEW_DETAILS only
without the identity. npm view shows 0.2.9 as latest. go test -tags
nogui ./internal/provider under a temp HOME passes, and go vet passes
for darwin, linux and windows.
2026-10-08 16:56:16 +08:00
yetone 4a8338cced codex: Codex's Ultrafast (service_tier "ultrafast") reaches the ChatGPT backend when magpie's pool of Codex accounts serves the turn, as it does on Codex's own sign-in; it was dropped for anything but Fast's "priority", and OpenAI's API still gets it as Fast (yxinyu715 on X: two Pro accounts, Ultrafast does nothing through magpie)
Run: TestCodexPoolKeepsUltrafast fails on the old code (backend asked for <nil>) and passes now; go test ./internal/gateway ./internal/provider ./internal/codexcat pass; go vet clean. Not tried with a real account offering Ultrafast: the owner's accounts don't list it.
2026-10-08 16:53:56 +08:00
yetone b5c83420d0 provider: moved WorkBuddy users get plugin 0.1.11, where one user send is one request in WorkBuddy's usage list and both builds name the client (使用端) (magpie-community/plugins#48)
Every step of one send (a tool result sent back, a retry) carries one
X-Conversation-Request-ID, the user's next message another, under one
X-Conversation-ID, as WorkBuddy 5.5.6's own client does (read in its
codebuddy.js). The China build now sends the client's attribution headers.

Verified: 0.1.11 resolves with npm view (latest). go test -tags nogui
./internal/provider under a temp HOME passes; go vet passes for darwin,
linux and windows. The plugin was tried at review against the real China
build and WorkBuddy AI, using credential copies in a sandbox HOME: 200
on every request, the same turn id across one send's steps and a new one
for the next message.
2026-10-08 16:51:58 +08:00
yetone 2ab69d0f87 gateway: MiniMax's thinking reaches Codex as reasoning, folded, not as the answer's text (#1267, pluo)
MiniMax's own Chat API (api.minimax.io, api.minimaxi.com), which Codex's
Responses requests to a MiniMax key are translated onto, gives a model's
thinking at the head of the text between <think>…</think>. The Chat decoder
only knew Gemini's leading <thought>…</thought>, so the thinking went to
Codex as message text. A leading <think> block is now thinking too, however
its tags fall across chunks; a tag later in the text stays text.

MiniMax asks for that thinking back in the assistant's text on later turns
(interleaved thinking), which it got before only because it was taken for
text. On MiniMax's own hosts it now goes back between <think> tags; a relay
serving MiniMax's models, and every other Chat upstream, is sent what it was
before.

Verified: TestMiniMaxThinkTagsReachCodexAsReasoning (Codex /v1/responses
through the gateway to a fake Chat upstream with MiniMax-shaped chunks),
TestMiniMaxThinkingGoesBackInTags and TestChatThinkTags fail on the old
chat.go (message text "<think>\nThe user greets me…</think>\n\nHello!",
items [message]; assistant content "Hello!" without the thinking) and pass
with it. The chunk shape is from MiniMax's OpenAI-compatible docs; no real
MiniMax key was tried.
2026-10-08 16:51:47 +08:00
yetone 7067fce5ec gateway: a turn's parallel tool calls split over two assistant messages keep their results on Chat, Cursor and Devin (#1275)
An Anthropic request may send one turn's tool_use blocks in consecutive
assistant messages, answered by one user message. buildChat's
pairToolMessages, cursorMessages and buildDevin each closed the first
message's calls at the second one: the calls were answered "interrupted"
and the real results went out as a stray user message (Chat) or were
dropped (Cursor, Devin). joinSplitCalls now joins an assistant message
onto an assistant message before it that made tool calls, as Anthropic
reads them, so the calls are pending together. Responses, Messages,
Kiro and Gemini/Code Assist already kept the results.

Tests (split_calls_test.go): Chat, Cursor and Devin split cases fail on
main and pass now; a truly unanswered call of a split turn still gets
the synthetic result; text after a call in its own message; two text-only
assistant messages unchanged; Responses guard.
2026-10-08 16:47:52 +08:00
yetone 7d8cda18aa gateway: a magpie-model compaction the ChatGPT backend breaks off after the reply began, HTTP 200 and an error event "response protection is unavailable", is asked again as text and else compacted locally, as the 502 is; the error nested in an error event is read, not "the model failed" (#1270)
Ran: go test -tags nogui ./internal/gateway (green; an earlier full run had TestOTelExportsWholeBodiesWhenOn panic once under load, passes alone -count=3 and in the rerun); GOOS=linux/windows go vet ./internal/gateway. The new tests failed before the fix with the reporter's "502 compaction: the model failed". Not tried with the real backend or Lody.
2026-10-08 16:47:24 +08:00
Timon Wong dc08da834c test(gui): hover a context cell only once it stops moving (#1263)
context-window.test.cjs failed about half its Chromium cases on macOS
(6-7 of 11 per run, on main too) at the cell hover: the tip stayed
hidden. A window's cells scale in one after another (ctx-cell), and
wheelTo only waited for the view's scroll to settle. Hovered while the
cell was still scaling, Chromium scrolled the view by 77px to reach it,
the app put that scroll back 9ms later, and the pointer left the cell,
closing its tip. A longer timeout didn't help; hovering again did.

wheelTo now waits until the target's own rect stops moving, which
covers both the eased wheel scroll and the cells' animation.

On an M3 Mac: main 7, 6, 6 of 11 in Chromium; with this change 11/11
in 5 Chromium and 5 WebKit runs, and in 3 Chromium runs beside gui-ja.
2026-10-08 16:43:03 +08:00
yetone 31b903fed2 gui: a Dock click goes to the main window on its own Space, not pulls it to the current one (#1252)
The window has MoveToActiveSpace so that a first show, or an Open from
the menu bar, puts it on the Space the user is on (a window first shown
while another app was full screen belonged to that Space from then on).
The Dock's reopen also went through openMain's Show and Focus, so with
the window open on another Space a Dock click pulled it over instead of
switching to it, as other Mac apps do.

The window now carries MoveToActiveSpace only while it is shown
(showHere: set, Show, Focus, cleared 500ms later, since clearing it at
once loses the move). The Dock's reopen (reopenMain) activates the app
and leaves an open window where it is, so macOS switches to its Space; a
closed, hidden or minimised window, or one still loading, is shown on the
current Space as before. The menu bar panel and its Open are unchanged.

TestDockReopenKeepsTheWindowsSpace (darwin, cgo) runs a real Wails app:
open, reopen while open (the flag is never set, the window stays open),
hidden then reopened, and minimised then reopened. With the old reopen
it fails ("the shown window stays on its Space").

Tried for real on this Mac (macOS 26.2), on sandbox .app builds of the
old and new code under a sandbox HOME, with a second Space added and
removed afterwards. Old build: window open on Space 1, Dock reopen from
Space 2 left the user on Space 2 and moved the window there. New build:
the same reopen switched to Space 1 and the window stayed there. A
minimised or closed window was shown on Space 2, the current one. The
menu bar panel opened and closed on both Spaces. go test -tags nogui
./internal/gui/... and go test ./internal/gui (cgo) pass under a temp
HOME; go vet, and GOOS=linux / GOOS=windows go vet -tags nogui pass.
Not tried on a full-screen Space or with several displays.
2026-10-08 16:38:14 +08:00
yetone e52d1cb820 docs: README rewritten for what magpie does now — stat line, flow diagram, warm-up, context, image MCP, keep awake, agent updates, all 47 agents; "coding agent" is now just "agent"; per-agent notes moved to the reference 2026-10-08 16:36:33 +08:00
yetone 1bc18b2f4d gateway: a history that opens with the model's turn reaches Gemini and Code Assist after a user turn, so Gemini no longer answers 400 (magpie-community/plugins#45)
An agent's compaction or a cut-down context can leave a history whose
first turn is the assistant's (text, or a tool call). Gemini turns that
away: "Please ensure that function call turn comes immediately after a
user turn or after a function response turn." buildCodeAssistSent, which
Gemini CLI and Antigravity accounts, Factory's generateContent route
(buildGemini) and Zed's Google models all build their contents with, now
puts the user turn "[Continuing from previous AI thoughts...]" before such
a history, as Gemini CLI's own hardenHistory (packages/core/src/utils/
historyHardening.ts, enforceRoleConstraints) does. Histories that open
with the user, and parallel calls split over two assistant messages, go
as before. Chat, Responses and Anthropic upstreams are unchanged.

Verified: TestGeminiHistoryOpeningWithModel fails without the change
(roles model,user, want user,model,user, for codeassist/gemini,
codeassist/antigravity and gemini, with model text and with a model
functionCall first). TestGeminiHistoryOpeningWithUserUnchanged and
TestNonGeminiHistoryOpeningWithModelUntouched pass before and after.
go test -tags nogui ./internal/gateway/... ./internal/zed/... under a temp
HOME with pinned caches; go vet -tags nogui for darwin, linux, windows.
Not tried against a real Gemini or Antigravity account.
2026-10-08 16:24:07 +08:00
yetone 927da8c41a provider: moved ZCode users get plugin 0.1.14, which lists a gift-only account's GLM-5.3 as GLM-5.3 (#1261)
sun1090's ZCode account has no GLM Coding Plan, only the Start Plan, whose
buckets serve GLM-5.3 and GLM-5.3-Flash. The card counted GLM-5.3, but the
plugin listed the Start Plan's config models (GLM-5.3-Flash, GLM-5.2,
GLM-5-Turbo) and GLM-5.3 only as GLM-5.3-Trial. ZCode itself lists a Start
Plan account's models as its balance's buckets name them, so 0.1.14
(magpie-community/plugins aca7c59) lists them by their own names too, and
keeps the -Trial entries. keepMovedCurrent updates every moved ZCode user.
The builtin check's note says the plugin now lists GLM-5.3 while a gift
bucket serves it; the check itself is unchanged.

0.1.14 resolves with npm view and its publish run passed. The plugin's
bun test (75) passes and its new test fails on 0.1.13. go test -tags nogui
./internal/provider under a temp HOME passes; GOOS=linux and GOOS=windows
go vet pass. Not tried with a real Start Plan account here.
2026-10-08 16:23:52 +08:00
yetone b6d88ce66e provider, gui: each of a provider's keys can go through a proxy of its own, as a subscription's accounts can (Beyfish_Wang on X: 不同 key 走不同的代理)
A provider of keys kept one proxy for all of them: Save dropped
AccountProxies for it. Now AccountProxies holds a key's proxy by its
KeyID, ProxyChoice reads it for the key a try uses (WithKey), and Save
keeps only the keys the provider still holds. The key editor's Proxy
row has a line per key (Provider's proxy | Direct | Custom), named as
the Accounts list names it, when the provider has two or more.

Run:
- go test ./internal/provider ./internal/gui ./internal/gateway: ok;
  TestKeyProxy fails without the provider change ("kept map[]").
- account-proxy.test.cjs, Chromium + WebKit, en + zh: 16/16; the new
  key cases fail without the app.js change. Also at 440px: 16/16.
- gui-ja, gui-de, i18n-keys, account-models, provider-many-keys,
  provider-typed, provider-proxy: all pass.
- Built binary, `magpie serve` in a sandbox HOME, three keys, four
  local proxies: k-1 (429) through its own proxy, k-2 (429) through its
  own, k-3 through the provider's; the global proxy got nothing.
2026-10-08 16:17:23 +08:00
yetone 15afd98891 provider: marshalling Claude credentials no longer writes into the cached sign-in, so two requests reading it at once don't race (main's Race red since 01e66e0f)
claudeCredential hands out its cached credentials by value, but their
raw blob is one map, and marshal wrote the token fields into it. 01e66e0f
calls ClaudeCodeMovedOff from limitHeaders beside a run's own read, so two
goroutines marshalled the same map: CI run 37744825866 (52ad2d98) failed
Race on ubuntu and macOS in six TestClaude* gateway tests with "DATA RACE"
in claudeCredentials.marshal (account.go) and "http: panic ... invalid
concurrent Body.Read call". marshal now writes into clones of the blob and
of claudeAiOauth.

TestClaudeCredentialsMarshalLeavesTheBlob marshals one credential from 8
goroutines and checks the blob is unchanged: on the old marshal it reports
WARNING: DATA RACE under -race; passes with the fix (-race -count=5).

Run at f00ed290 under a temp HOME with pinned caches: the six gateway
tests with -race -count=3 FAIL on the old marshal and pass with the fix;
go test -race ./internal/provider ok; go vet (darwin, GOOS=linux) and
GOOS=windows go build ./... pass; gofmt clean.
2026-10-08 16:07:55 +08:00
yetone 0506ea396f provider, settings, gui: Daily warm-up takes several times a day, each starting the 5-hour windows once (#1260)
Sinnhu asked for more than one daily warm-up time (e.g. 09:00, 15:05,
19:10). Settings has codexWarmAts / claudeWarmAts beside the old single
keys: the list wins when set (an empty one is off), a file from before
it reads its one time as a list of one, and the first time is written
back to codexWarmAt / claudeWarmAt so an older magpie still reads one.
Times are kept as HH:MM, sorted, once each; a bad one is refused.

The scheduler (dayStart, nextDayStart, dailyDue, heldForDay,
dayStartPassed, warmLook) takes the list: the start due is the latest
of any time that has passed, and the day kept per window is now that
start ("2026-09-28 15:05"), so each time sends once a day. A day kept by
an older magpie ("2026-09-28") counts as every start of that day had,
so nothing is sent twice on the day of the update. An account's own
time (codexWarmAtOf) stays one time.

Settings › Allowances › Daily warm-up: each time is a time field with ×
beside it while another is left, + adds one a window after the last,
Off/On as before. The times wrap in a group of their own beside + and
Off/On, so adding or removing one never moves the button pressed. New
strings in zh, en, zh-TW, ja, de.

Verified:
- go test -tags nogui ./internal/provider ./internal/settings
  ./internal/gui (temp HOME, pinned caches, pipefail): ok. go build and
  go vet -tags nogui ./...; GOOS=linux and GOOS=windows go vet -tags
  nogui on the three packages: clean.
- Fails without the change: TestWarmAtSeveralTimes (dayStart looking at
  the first time only, or a day-only key: "sent at 06:00"),
  TestWarmLookAndHoldAtSeveralTimes ("15:05 not looked at"),
  TestWarmAtKeptDayFromBefore and TestDailyDue (an old day-only record
  not honoured: "sent again"), TestWarmAtsMigrate (old key not read:
  "old file: [] ..."; first time not written back: "old file:
  ["06:00"] "" ...").
- GUI: warm-at-times.test.cjs, Chromium and WebKit, en/zh/ja/de, 900
  and 440px: 16/16; with warm-at-own, settings-groups, gui-ja, gui-de,
  gui-zh-tw, i18n-keys: 36/36 in each engine.
  Whole GUI suite (node --test, concurrency 4): 3716/3724; the 8 red
  (agent-models-redraw, azure-endpoint, context-window,
  gateway-key-limit, login-import, member-model-setting, search-api)
  each pass run alone with this change, and none reaches the warm-up
  row.

Not tried with real accounts or a live day of the scheduler.
2026-10-08 16:05:15 +08:00
Zhu Wang f00ed2901c routing: filter by several purposes with checkboxes (#1247)
* routing: filter by several purposes with checkboxes

Ticking a purpose immediately shows the union of the selected purposes while keeping the menu open. All purposes, Clear filter and removing the last selection restore every purpose. Counts, the story and history follow the same list.

Live menus ignore renderer-induced scrolling while deliberate outside scrolling still dismisses them. Update the GUI shell reference and browser coverage for multi-purpose counts, keyboard toggling, history, aliases and narrow windows in five languages.

Verified 115 isolated Playwright checks in Chromium and WebKit, JavaScript syntax and git diff --check. The new checkbox case fails against the old assets with 0 checkbox choices instead of 5; restoring the old menu scroll handler separately detaches the menu during selection in WebKit.

* routing: All purposes returns keyboard focus to its button

Address the keyboard-focus regression reported in PR #1247. Choosing All
purposes closes its menu and focuses the purpose button without scrolling.
Unticking the last purpose keeps the live menu and its checkbox focused.

The expanded checkbox test fails without the focus restoration in Chromium
and WebKit: All purposes returns keyboard focus to the purpose button
(false !== true). With the fix, 162 isolated Playwright checks pass across
both engines, including five locales, narrow widths, purpose state,
history, request/session grouping, Usage and scroll/menu regressions.
JavaScript syntax and git diff --check pass. The full GUI/Go suites and the
packaged desktop app were not run.
2026-10-08 16:02:17 +08:00
yetone 6485f5ecb5 gui: the Routing page, and Usage's Context tab with a session open, scroll to their end in WebKit: their narrow and wide layouts go by classes set from each box's width, not container queries (#1249)
In WebKit (the macOS app's WKWebView, and Playwright's WebKit) the Routing
page stopped well short of its bottom (wizzy-yang on #1213). Each time the
page was drawn again while it was scrolled near its end, WebKit cut its
scrollTop back to a shorter range. The page has query containers in it
(.rt, .rt-accts, .rt-more, .rt-col), and the cut happens during a redraw.
Seen at 440x620: 575 of 585, and up to a whole screen short when a part
was redrawn. Chromium is unaffected. With container-type set to normal on
those boxes the page reaches its end, and the cut goes away. Replacing a
container with its clone at the end reproduces it in WKWebView too.

Each box's width now sets a class, the same way container queries would
have chosen a layout:
- routing.js sets the classes from a ResizeObserver: max560 on .rt and
  .rt-accts, max460 on .rt-accts, max520/min1150 on .rt-more, and
  max440/max760 on each .rt-col.
- context.js does the same for each .ctx-card: max520 and max420.
- A rule that names the box goes through :where(), so it keeps the
  specificity it had inside its query.
- The class is set on the next frame, as quotaFit does: set in the
  observer's own call, it changes the box's height, and WebKit reports
  that as a ResizeObserver loop.
- A redrawn ctx-card starts with the width the last card in its place had
  (routing or session). It doesn't lay out wide for a frame and then
  narrow, which would itself pull the page up.
- The Safari 15 @supports fallbacks are dropped. They chose a layout by the
  window's width, and ResizeObserver covers that Safari.

Sibling: Usage → Context, with a session open, has the same bug. Each
timed read redraws the card, and WebKit pulled the page up by up to 946px
at 420 wide (682px at 1100). It is fixed the same way. The other query
containers were checked at their end with a synthetic redraw and were not
affected: Library's .lib-row.with-agents and Agents' .row.agent .who.
Sessions (.sess-pane) also jumps in WebKit as it refreshes, but it still
does with its container removed, so the cause is something else. It is
left alone here.

Run:
- routing-scroll-end.test.cjs (new): 440x620, 600x700, 900x500, 1200x600
  and 1400x700, en and zh, Chromium and WebKit, with the trace redrawing
  the page. It also checks the stage, request and column layouts. On the
  old CSS all 10 WebKit cases fail (twice); with the fix it passes 22/22
  (four runs).
- context-scroll-end.test.cjs (new): 420, 700 and 1100 wide, en and zh,
  across a timed read. On the old CSS the WebKit cases fail ("958 of
  1891"…); with the fix it passes 14/14.
- Layout compared with the old CSS: every element's rect on the Routing
  page (group editor closed and open) and in the Context card. Widths
  360–1700, en/zh/zh-TW/ja/de, Chromium and WebKit: 220 + 100
  configurations, none differ, and there are no page errors.
- The macOS WKWebView: a part redrawn at the end left the page 200–238px
  short before the fix and 0 after, at 440 and 1100.
- gui-ja, gui-de, gui-zh-tw and i18n-keys pass.
- Full GUI suite (concurrency 4): 3719/3733.
  - Pass alone: azure-endpoint, remote-magpie, signin-again and
    routing-sessions.
  - mobile-web compares with origin/main, which had moved on; against
    this commit's parent it passes.
  - panel-arrange fails the same way on the parent.
  - context-window's chromium 1100px hover flakes under load on the parent
    too: 5 of 16 parallel runs, against 1 of 16 here.
- go test ./internal/gui; GOOS=linux and GOOS=windows go vet
  ./internal/gui.

Not run: the reporter's own machine, or an old Safari 15 WebKit.
2026-10-08 15:57:08 +08:00
yetone 7e2fc88260 gui: Codex's panel says when the Codex app's model menu can't reach every model: the app asks for 100 and never the next page, so with more the last ones can't be picked there; it points to Pick and Order (#1262)
magpie writes every model to Codex. ChatGPT.app 26.930 asks Codex's
app-server for model/list with limit 100 and doesn't follow nextCursor;
the Codex CLI's /model asks with no limit. Checked with the real codex
0.160.1 app-server in a sandbox CODEX_HOME holding 150 models: limit 100
gave 100 and nextCursor "100", no limit gave all 150.

Run: codex-app-menu-cap.test.cjs (Chromium and WebKit, en and zh, 1000 and
560px; 8/8 fail on the old app.js), gui-ja, gui-de, gui-zh-tw, i18n-keys;
full GUI suite 3708/3715, the failures (azure-endpoint, mobile-web,
routing-kind) pass alone and touch nothing changed here.
Not run: the real ChatGPT.app.
2026-10-08 15:53:30 +08:00
如是 52ad2d9845 gui: a ZCode account with nothing left to spend says so, and says what to do (#1245)
A ZCode account whose free Start Plan (体验套餐) has run out and which has
no GLM Coding Plan of its own reads as "Allowance unavailable" on the
Usage page's card, which is the words for a reading that failed — the
account's real state is that it has nothing to spend. The built-in already
names it (zcodeStartQuota, internal/provider/zcode_start.go: "this account
has no GLM Coding Plan, and ZCode's Start Plan has ended or was never
started") and the plugin's usage error is that same string byte for byte
(NO_START, magpie-community/plugins packages/zcode); quotaError matched
neither, so both fell through to the fallback.

The card now says it, and says the action on the card itself: the
"subscribe at …" wording is in the sign-in errors (zcodeSignedIn /
signedIn), which never reach this card, so there was nothing to hover for
(yetone on #1001). "has ended" would also be wrong for an account that
never started one, hence "no free Start Plan".

The match is anchored on the whole card sentence, so the sign-in errors —
which name the address themselves — and the sibling "…Start Plan could not
be read: <err>" (a reading that failed) are both left alone.

zh, zh-TW, ja and de get the new string. balance-fix.test.cjs gains both
card errors, the sign-in error and the could-not-be-read one, asserting
the first two get the card's words and the last two do not; the new string
joins its list of those needing a Chinese. Red/green: the two card
assertions fail with the mapping taken out of app.js, and the
could-not-be-read and sign-in ones fail if the match is loosened to
"Start Plan has ended" anywhere in the string. 108 tests pass across
balance-fix, gui-de, gui-ja, gui-zh-tw and i18n-keys.
2026-10-08 15:39:50 +08:00
yetone 01e66e0f4a gateway: a reply a Claude subscription account answered carries its anthropic-ratelimit-unified-5h/7d headers, so a Claude Code signed in to claude.ai shows the 5-hour and weekly limits in its status line (claude-hud, #1257)
Claude Code tells the allowance in its rate_limit_event, not as headers, so
magpie says what it keeps of the account again as Anthropic does: a share
0-1 and a Unix-seconds reset per window, set as the request comes in and
again as the reply begins, after the turn's own event.

Claude Code 2.1.293 reads them only when it is signed in to claude.ai (the
sign-in field's claudeai); with magpie's key it ignores them.

Run: go test -tags nogui ./... (temp HOME); the two new tests fail without
limitHeaders; GOOS=linux/windows go vet of gateway and provider; real
Claude Code 2.1.293 in a sandbox HOME against a fake server sending these
headers: its statusline stdin had rate_limits.five_hour/seven_day with
used_percentage 42/17 when OAuth-signed in, none with ANTHROPIC_AUTH_TOKEN.
Not run: a real Claude account through a running magpie.
2026-10-08 15:28:52 +08:00
yetone b2432754e5 usage, gateway: Antigravity's gemini-3.8-flash answered as gemini-3.8-flash-n is no longer marked as another model (dumplings on Discord)
Google's Code Assist backend names the deployment serving Gemini 3.8 Flash
"gemini-3.8-flash-n" in modelVersion, for every level it is asked at. On the
owner's real Antigravity account (daily-cloudcode-pa, 2026-10-08)
gemini-3.8-flash-low, -medium and -high all answered gemini-3.8-flash-n, with
or without a thinking level. gemini-3.8-flash-n itself is a 404 and
fetchAvailableModels doesn't list it. 3.7/3.6 Flash's levels answer the bare
family name, which #462 already allowed. So the requests log's amber "actual
model" and its "probably swapped" note were a false flag.

usage.GeminiServing accepts the sent Gemini model's own name plus "-n".
Swapped and the readers for kept rows and routes (request_page row(),
history routedAgain) all use it, so rows already logged read correctly
too. It covers Gemini only. gpt-5 -> gpt-5-mini, gpt-5 -> gpt-5-n,
claude-sonnet-4-5 -> -n, gemini-3.8-flash -> -lite, -> gemini-3.7-flash-n,
-> -nano and -high -> -low are still swaps.

Verified: TestSwappedGeminiServingName, TestLedgerGeminiServingNameIsNoSwap,
TestKeptRowGeminiServingNameNotSwapped and
TestRouteKeptGeminiServingNameNotSwapped fail on the old code ("gemini-3.8-flash
answered as gemini-3.8-flash-n is the model asked for", "still swapped") and
pass with it. Sandbox magpie on a copy of the real Antigravity login: before,
the routing log had swapped:true on every gemini-3.8-flash-n try. After, chat
completions at none/low/medium/high and /v1/responses are not swapped, and
the ledger reads the earlier rows as not swapped. go test -tags nogui ./...
passed under a temp HOME. go vet ran for darwin/linux/windows, and the
linux/windows builds passed.
2026-10-08 15:15:37 +08:00
yetone 9fcd332b6c proc: a .cmd or .bat is run through cmd.exe with each argument quoted for it, so npm.cmd under C:\Program Files\nodejs (nvm-windows) no longer runs "C:\Program" when magpie updates Claude Code (wztlink1013 on Discord)
Windows starts a batch file as `cmd.exe /c <line>`, and Go builds that
line for a program's parser: with more than two quotes cmd.exe drops the
first and last, so `"C:\Program Files\nodejs\npm.cmd" install -g --prefix
"C:\Program Files\nodejs" …` ran C:\Program. An argument with & or | was
also left unquoted and split into a second command. Every command magpie
runs is made by proc.Command/CommandContext, so the fix is there:
cmd.exe /d /e:ON /v:OFF /s /c "<script> <args>", each argument quoted as
Rust's std does for batch files (doubled ", % broken up).

TestBatchFileInFolderWithSpace (windows) runs npm.cmd, a .bat and npm via
PATH under "Program Files" with the reporter's arguments plus & | % ^ and
trailing-\ cases, through a script that hands %* to a real program. On the
old code it fails on the Windows box with "'…\Program' 不是内部或外部命令".
On the Windows box (Windows 11, zh-CN) magpie's own updater
(howInstalled + runUpdate) on a real npm install of Claude Code 2.0.50
under "…\Program Files\nodejs": old code failed with the reporter's error,
new code updated it to 2.1.293.
2026-10-08 15:04:24 +08:00
yetone 811681bc72 agent: on a Claude model that is no Fable, Claude Code's fable tier is left unset instead of following the main model, so Opus is no longer taken for Fable (Zhenzhen on Discord)
`magpie claude claude/claude-opus-5-5` wrote ANTHROPIC_DEFAULT_FABLE_MODEL=
claude/claude-opus-5-5[1m]. Claude Code 2.1.293 takes a model id equal to
that variable for a Fable model (Sye/Vle in its bundle), so on a Claude Pro
sign-in without Fable it asked for usage credits and fell back to Haiku.

follow() now gives the fable tier no model on a Claude model that isn't a
Fable; writeTiers leaves such a tier out of the env. On a Fable main model,
and on another vendor's model (Claude Code knows nothing of it), the fable
tier follows as before. Claude Code's own /model fable still runs on the
main model at the gateway (claudeStandInAt, asserted in the test).

Kept for the user: a fable pick of their own (even the main model) stays;
a fable effort they set keeps the tier on the main model at that effort;
a non-magpie value they wrote while routed stays as written; their own
pre-magpie value is still stashed and given back on `model default`.
Follow takes out a fable tier an older magpie wrote on a Claude model.

Verified: TestClaudeFableTierOnClaude fails on the old claude.go with
"on Opus: fable tier written as \"anth/claude-opus-5-5\", want it left
out"; breaking the Follow migration, the user-value keep and the effort
fallback each fails it too. go test -tags nogui ./... green under a temp
HOME with pinned caches; go vet + GOOS=linux/windows go vet of
internal/agent; go build, GOOS=linux -tags nogui and GOOS=windows builds.
Not tried with a real Claude Pro account.
2026-10-08 14:55:56 +08:00
yetone 10f7b4aa3f davsync, gui: a WebDAV server whose HEAD says Content-Length: 0 no longer fails every shared usage day as "kept 0 of 6869 bytes", and a usage share that failed is its own red line under the sync status (#1259, mzcinf on 坚果云)
After each PUT, check read the file's size from a HEAD and called anything
shorter a cut write. On 坚果云 every usage write failed that way with 0
bytes kept, three tries each; the 0 can only have come from the HEAD's
Content-Length, since a 6869-byte body that the PUT sends with its
Content-Length (not chunked) isn't cut by a dropping network three times
running. A HEAD that says short is now asked again of PROPFIND (Depth 0)
getcontentlength, the size WebDAV clients of 坚果云 read. The write counts
as kept when that size is whole. When PROPFIND gives no size, the HEAD's
stands. A real cut write is still told as cut, with the bytes PROPFIND
says were kept. The extra request is made only after a short HEAD, so
坚果云's request limit isn't spent on servers whose HEAD is right. The
backup's own PUT goes through the same check, so a 坚果云 user whose
setup changes would have hit the same error on the main sync.

Settings > Sync put "Couldn't share usage: …" in the same grey line as
"Synced · host", so it read as part of a sync that went fine. It is now a
line of its own under the status, in red, wrapped whole at 440px. The CLI
already printed it on its own line.

Verified: TestNutstoreHeadSaysNoLength and TestNutstoreBackupWrite use a
fake 坚果云: HEAD Content-Length: 0, real getcontentlength on PROPFIND,
409 for a read in a missing folder, a chunked PUT refused. Whole writes
sync with no usage error, and each write goes once with one HEAD and one
PROPFIND. A tunnel that keeps half is still told as cut, with the half it kept.
On the old dav.go all three fail ("the WebDAV server kept 0 of 536 bytes
of magpie.magpie-backup", "kept 0 of 6869"). TestDAVShortWrite and
TestUsageSharedShortWrite/TestUsageSyncShortWrite pass unchanged.
sync-usage-error.test.cjs runs in Chromium and WebKit, en/zh/ja/de, at
900 and 440px, and fails on the old app.js ("the status line carries no
usage error: 14:46 已同步 · dav.jianguoyun.com · 用量未能共享:…"). The
sync-*, s3-sync, usage-computers, gui-ja, gui-de, gui-zh-tw, i18n-keys
and click-scroll tests pass, 78/78. go test -tags nogui -count=1
./internal/davsync ./internal/gui pass under a temp HOME. go vet passes
on darwin, GOOS=linux and GOOS=windows. Not tried against a real 坚果云
account: that its HEAD answers 0 is inferred from the error, and that its
PROPFIND gives the real size is how its other WebDAV clients read sizes,
neither seen here.
2026-10-08 14:52:11 +08:00
yetone e90f30d99c provider: a built-in account signed in again is read afresh, not answered by the reading kept from the refused sign-in (8c0ffcc6's siblings)
8c0ffcc6 dropped a plugin account's kept usage reading when it signs in
again. The built-ins had the same bug: every sign-in and import keeps its
account through addLogin (Claude, Codex), addSideLogin (Copilot,
Gemini/Antigravity, Kiro, Devin, Grok, ZCode, Zed, Factory, MiMo, Command
Code, ChatGPT API), wbKeepSignIn (WorkBuddy, WorkBuddy AI) or qoderSave
(Qoder, Qoder CN), and none of them touched loginUsageCache.
forgetAccountCaches drops only the Usage page's cards, which are read
again through the same per-account cache, so for up to a minute both
LoginUsage and the Usage page showed the old sign-in's refusal for the
renewed account.

Those four store points now call StaleAllowance for the account under the
name it is kept by (codexName's, WorkBuddy's uid-suffixed name), after
loginsMu is let go, so every sign-in path and import is covered.

Tests, each red on origin/main and each red again with only its own store
point reverted:
- TestCodexSignInAgainReadsUsageAfresh: the browser sign-in twice,
  /wham/usage 401 then 200 ("signed in again, but the usage is the old
  sign-in's: ... Error:Unauthorized")
- TestFactoryKeyAgainReadsUsageAfresh: a key import, then a new key for
  the same account ("... Error:Factory: Invalid API key")
- TestOwnStoreSignInAgainDropsTheReading/{workbuddy,qoder}

Run: the new tests at -count=3 and -race -count=3; go test -tags nogui
./... under a temp HOME with pinned caches, all ok; go vet and
GOOS=linux/windows go vet -tags nogui ./internal/provider.
2026-10-08 14:11:24 +08:00
yetone db0feb3615 library, gui: a remote MCP server's headers and a command's env can name ${NAME}: the library keeps the placeholder and each agent gets its own syntax, so the token is never written into an agent's settings (#1250)
The library keeps `${NAME}` as typed. refsOf (internal/library/envref.go)
gives each MCP format the agent's own syntax, with the source beside each:
${NAME} for Claude Code, Droid, Grok, Gemini, Crush, Copilot, Pi, OmO, omp,
Qoder, AtomCode, Hermes and Command Code; {env:NAME} for OpenCode and MiMo;
${env:NAME} for Cursor; Codex's bearer_token_env_var, env_http_headers and
env_vars; Goose's ${NAME} plus env_keys. An agent with no syntax (Claude
Desktop, Antigravity, Kimi, Cline, ZCode, dsh, Devin, Pi with
pi-mcp-extension) is never given such a server: supports() refuses it with
the reason, an entry magpie wrote before is taken out, and its chip is
greyed with the reason on the row and in the editor. Codex's and Goose's
extra keys are magpie's only while the server names a variable, so the
user's own env_vars / env_keys stay. The editor says how to write one under
Headers and Environment; a check whose variable isn't set where magpie runs
says which one ("GH_TOKEN not set").

Verified:
- go test -tags nogui ./... (sandbox HOME): all ok.
- New TestEnvRefs* (per-agent encode/read-back, left-out agents, library
  keeps the placeholder, user values kept, health check novar) fail with
  the behaviour turned off (refsOf -> ${NAME} for all, no refsProblem /
  refKeys, no expansion).
- library-env-refs.test.cjs (Chromium + WebKit, en/zh/ja/de at 440px)
  fails on the old library.js (4/4 subtests); gui-ja, gui-de, i18n-keys,
  library-servers-bulk, library-all, by-agent, project-servers,
  library-mcp-health, library-null-agents, library-items: 109/109 pass.
- Real: magpie built from this tree synced a library server with
  Authorization: Bearer ${FAKE_MCP_TOKEN} and X-Api-Key: ${FAKE_KEY} into a
  sandbox HOME, then against a fake MCP on 127.0.0.1:3561 that answers only
  the right bearer: Claude Code 2.1.293 `mcp list` Connected, Gemini CLI
  0.62.0 Connected, Codex 0.160.1 app-server listed the tool (authStatus
  bearerToken), cursor-agent sent both headers expanded; no agent file held
  the token. Antigravity got the Problem and no entry. Not run for real:
  OpenCode (its mcp list goes through the user's background service),
  Goose, Crush, Copilot and the rest; their syntax is from their source.
- go vet (darwin, GOOS=linux, GOOS=windows) for internal/library and
  internal/gui.
2026-10-08 14:04:21 +08:00
yetone 173ab71e8b gateway: a Gemini client's thinkingConfig no longer reaches a quiet group member as reasoning_effort (#1253)
withoutReasoningAsk (#950) took the reasoning ask off Chat, Responses and
Anthropic bodies sent to a group member known not to think, and passed a
Gemini-protocol body through as it was. parseGemini then read
generationConfig.thinkingConfig into the request's effort, and the quiet
member was sent reasoning_effort.

It now drops generationConfig.thinkingConfig when it asks to think, by
the same reading parseGemini uses (gThinking.effort: a level, a budget,
-1 as medium), keeping the rest of generationConfig. A budget of 0 is no
ask and stays. A member the user fixed at an effort isn't quiet and is
sent the ask as before.

TestGroupQuietMemberGeminiThinking sends generateContent through
lanGuard(s.Handler()) to a group whose thinking member fails over to a
quiet one, for thinkingLevel, a budget and -1. Without the change it
fails: "the quiet member was sent map[... reasoning_effort:high ...]";
TestWithoutReasoningAsk's new Gemini cases fail too. With it both pass,
and the thinking member and a fixed quiet member still get
reasoning_effort. go test -tags nogui ./internal/gateway passes under a
temp HOME with pinned caches; the three group tests pass with -race
-count=5; go vet and GOOS=linux/windows go vet -tags nogui pass.
2026-10-08 13:58:58 +08:00
yetone 8c0ffcc640 provider: a plugin account signed in again is read afresh, not answered by the reading kept from the refused sign-in (TestPluginLoginTakesTheLapseOff red after its first run in a process)
clearPluginLapse took the lapsed mark off a plugin account signed in
again, but its usage reading from before stayed in loginUsageCache for a
minute. The next LoginUsage was answered from it: the old sign-in's
"expired" shown for the renewed account, and no plugin asked, so nothing
marked or cleared. TestPluginLoginTakesTheLapseOff hit it from its second
run in one process (-count=3: pass, fail, fail): the run before's last
reading, still under a minute old, answered the "gone" account's read
under the new HOME, and the vendor's refusal never marked it.

A sign-in now drops the account's kept reading (StaleAllowance), on both
paths that finish one (pluginDone and PluginSignedIn).

TestPluginLoginReadsUsageAfresh fails without the change at -count=1
("signed in again, but the usage is the old sign-in's: ... Error:the
FakeCo sign-in has expired"). With it, -run TestPluginLogin passes at
-count=5 and with -race -count=5; go test -tags nogui . ./internal/provider
./internal/plugin pass under a temp HOME with pinned caches; go vet and
GOOS=linux/windows go vet -tags nogui pass on the two packages.
2026-10-08 13:52:50 +08:00
如是 1b8c33b5e2 provider: a routing group reasons when any member does, not only when all of them do (#950)
* provider: a routing group reasons when any member does, not only when all of them do

groupEntries started a group at Reasoning: true and intersected it with
each member's (e.Reasoning = e.Reasoning && thinks), so one member that
doesn't think made the whole group 不支持推理. Pi reads that off /v1/models
and turns /thinking off for the model: a routing group of
deepseek-v4-flash-0731-max (a Trae plugin model magpie read as one that
doesn't reason) with a DeepSeek that does lost reasoning for both.

The group now reasons when any member does. Images already worked this way
(#756: a text-only member doesn't turn every image away), and the gateway
fits a request's effort to the member that gets it (fitFor), failing over
when a member refuses the level (failEffort). What the group offers as
levels is not changed: a member known to take none still leaves the group
none (#597), so such a group is Levelless — a shape magpie serves — rather
than one that doesn't reason.

group_reasoning_test.go (6 tests) fails without the change:
TestGroupReasoningFromAMemberThatThinks, TestGroupReasoningLevels and
TestGroupReasoningQuietMemberKeepsTheRest report reasoning off.
TestModelsListReasoning, the /v1/models contract test, fails the same way
and is updated to the new semantics. go vet, go build, GOOS=linux
GOARCH=amd64 go build -tags nogui and GOOS=windows go build pass; go test
-tags nogui ./internal/provider ./internal/plugin pass under a temp HOME.
internal/gateway passes except TestPluginStreamStalledClientKeepsOther
RequestsMoving, which fails on this machine with and without the change.

* gateway, provider: a group's member that can't think is sent no reasoning, rather than a 400

A routing group reasons when any member does (#950, 533887c2), so an agent
asks a group for reasoning that a member of it may not think at all. The
effort reached every member, and some vendors turn a reasoning ask away
with a 400 on a model that can't think — the review's second point: the
comment said the gateway routes a reasoning request to the members that
take it, and nothing did.

The gateway now sends such a member no reasoning ask, in the agent's own
protocol: Chat's reasoning_effort and reasoning, Responses' reasoning (with
reasoning_effort, which some relays take), Anthropic's thinking when it
asks to think — thinking disabled is no ask and stays — and output_config's
effort alone, the rest kept. Everything else goes as the agent sent it, the
Responses effort-update history is skipped for it, and the trace's Effort is
"" (nothing was sent) with Fixed kept, so the user's own pin is still read.
Which member goes first is unchanged: the group routes as it did, and only
the body changes.

provider.Entry.Quiet is the judgment: magpie has a word on the model — its
vendor's or its maker's list, or its provider's own account list — and that
word says no reasoning. A model nothing speaks for isn't quiet: it is sent
the effort the agent asked for, as #597 leaves it. Nor is one that takes
levels, which includes a model the user gave levels of their own: those
take the effort the gateway fits to them. Direct requests outside a group
are untouched, as TestPluginThinkingOff pins.

TestModelsReasoningWithoutLevels (thinks_test.go) still expected
group/mixed false; the review's first point. It is updated with a comment
saying why the #402 expectation changes, and a group of two quiet members
keeps the "none of them thinks" case.

TestGroupNonThinkingMemberNoEffort (group_reasoning_test.go) fails without
the change: with the withoutReasoningAsk call disabled it reports "B: the
quiet member was sent map[... reasoning_effort:high]". TestEntryQuiet
(provider) pins the judgment, and TestWithoutReasoningAsk the field set per
protocol.

go vet ./..., go build ./..., GOOS=linux go build -tags nogui ./... and
GOOS=windows go build ./... pass. go test ./internal/provider,
./internal/catalog and ./internal/plugin pass whole; internal/gateway
passes in three chunks covering every test (TestGroup|TestFixed|TestFast|
TestModels|TestPluginThink|TestWithout|TestMember, TestEffort|TestResponse|
TestReasoning|TestQuiet|TestTrace|TestRoute|TestRules|TestRule, and the
rest), 43s + 36s + 790s. The whole suite in one process times out on this
machine in an unrelated test (TestRuleDecidesAtTurnStartAndHolds here,
TestRequestBodyProgressRenewsIdleDeadline on another run) — the base commit
533887c2 times out the same way, at 800s — so the chunks are what was run.
The GUI is untouched, so no Playwright run.

* gateway, provider: a member the user fixed at an effort keeps it, quiet or not

The review's remaining point: Quiet() rests on magpie's catalog or an
account's own model list, and what this PR is about is that word being
wrong — the Trae plugin gave no capabilities, and magpie read a thinking
model as one that doesn't. A member the user fixed at an effort
("provider/model:high", #189) is the user saying this model does think, so
magpie's word doesn't override theirs: the gateway sends the fixed member
its effort and strips the reasoning ask from the others as before.

quiet := isGroup && c.effort == "" && quietTo(c.p.ID, c.model). c.effort is
only ever the member's own fixed effort (Member.Effort, planLevel), never
the agent's, a group's Group.Levels, the turn's pick or the Settings' — so
those are stripped as they were.

TestGroupNonThinkingMemberNoEffort's E is now the other way: the fixed quiet
member is sent reasoning_effort "high", and the trace's Effort is "high"
with Fixed "high". Dropping the c.effort == "" guard makes it fail with
"E: the fixed member was sent map[... model:plain]". quiet.go and
Entry.Quiet say why.

gofmt, go vet ./..., go build ./..., GOOS=linux go build -tags nogui ./...
and GOOS=windows go build ./... pass. The review's own set passes —
go test -count=1 -run 'TestGroup|TestWithoutReasoningAsk|TestEntryQuiet|
TestModelsReasoning|TestModelsListReasoning|Thinks|TestPluginThinking'
./internal/provider ./internal/gateway — and so does internal/provider whole
(208s). internal/gateway passes in chunks (Test[A-D] 340s, Test[S-Z] 216s,
Test[^A-DS-Z] split over TestEffort|TestResponse|TestReasoning|TestQuiet|
TestTrace|TestRoute|TestRules|TestRule|TestFixed|TestFast 38s and the rest
earlier): the whole suite in one process still hangs here on an unrelated
test (TestCodexBodyReadsPastOldLimit this time, TestRuleDecidesAtTurnStart
AndHolds and TestRequestBodyProgressRenewsIdleDeadline before), which the
base commit does too and which passes alone in 0.9s.
2026-10-08 13:47:13 +08:00
wizzy-yangandwizzy-yang 6a8095421e sessions tests: TestCursor expects the resume command Windows gives it (red on Windows in main since 585f7f7d) (#1248)
585f7f7d made resumeCommand put a `Set-Location -LiteralPath '<cwd>'; ` in front of a session's command on Windows, and updated the tests that assert one: TestCarryPiToOmp (transcript_test.go:168) expects the Set-Location form there. TestCursor's own assertion was left behind. It builds `want` for a Cursor chat run under /work/cur, and its Windows branch only skips the `cd` prefix rather than taking the one Windows uses, so on Windows the test asserts the bare `cursor-agent --resume <id>` while the code returns the prefixed one:

    cursor_test.go:254: resume "Set-Location -LiteralPath '/work/cur'; cursor-agent --resume 6f0c…", want "cursor-agent --resume 6f0c…"

Nothing about Cursor is wrong: the Sessions page copies that command for the user to paste into their shell (sessions.js's copy of `s.resume`), and on Windows `Set-Location` is the right form for it, as wslResume's comment already says of the distro variant ("the PowerShell line that resumes a session"). The test was simply not carried over with the rest, and CI never sees it — test.yml runs `go test` only where `runner.os != 'Windows'` (test.yml:67), Windows gets `go test -run '^$'` to compile.

The assertion now takes the Set-Location prefix on Windows, as TestCarryPiToOmp does. No production change.

TestCursor passes on Windows here and the whole internal/sessions package is ok (20.5s). It is a real check, not a mirror of the code: with resumeCommand's Windows branch made to return the bare command, the test goes red naming the missing prefix, and green again when restored. go vet and gofmt (on LF content; this clone has core.autocrlf=true and no .gitattributes, so gofmt -l flags every file) are clean. Not run on Linux or macOS, where the branch is the `cd … && …` form already covered.

Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com>
2026-10-08 13:34:23 +08:00
yetone 1ab6228b22 provider: moved Factory users get plugin 0.1.20, whose Claude Code compaction context quotes summaries like tool output and no longer lets a hook notification stop it early (plugins #42) 2026-10-08 12:54:55 +08:00
yetone 52e27881ac gui tests: panel-arrange's Usage window reads the saved order from its fixture, not set into state by hand, where the page's own load could answer after and put the first order back (red on Chromium en, zh, de) 2026-10-08 12:53:27 +08:00
yetone 5318231938 gui tests: usage-ledger expects the Usage page's Context tab (red since 586f2bce added it) 2026-10-08 12:53:27 +08:00
yetone fd29653d4e context: a window opened on the Context tab loads it at once, not at the refresh's first tick five seconds on
context.js comes after app.js, and app.js shows ?view=usage and reads the
state before context.js is there: when /api/state answered first, both
paths called window.loadContext while it was undefined, the TypeError went
to the status line, and the tab stayed empty until the 5s refresh (found
as context-window's webkit de 1100px flake, 2 of 6 runs). The calls are
optional now, and context.js loads the tab itself when the page opened on
it, as plugins.js and library.js do. The new test holds context.js until
the state has answered: it fails on both engines without the fix and
passes with it; context-window passes 22/22, the case that flaked 10/10.
2026-10-08 12:53:27 +08:00
yetone b5a7d3999b gui: the requests table's width, details and scrollbar are fitted on the next frame, not in its ResizeObserver's own call, so WebKit no longer reports a ResizeObserver loop as a page error (number-units, red on main under load)
The #ledWrap observer set --ledw (an open row's details box width) and
called ledHScroll() in its own call; each can change the table's or the
wrap's height, which the observer is owed in the same frame. A probe
wrapping ResizeObserver caught it resizing an observed element in WebKit en
under load; with the fix, number-units and the probe pass under the same
load (52/52 twice), and ledger-hscroll, usage-ledger(-fit, -detail, -chart,
-content), panel-usage and click-scroll's Requests steps pass on Chromium
and WebKit.
2026-10-08 12:53:27 +08:00
yetone 5d0c1dcad7 agent, library, sessions: a Claude Desktop installed as an MSIX package on Windows is found, wired, given MCP servers and skills, and its Cowork calls read, in the package's folders (Kilig on Discord, Windows 10 LTSC 21H2)
Desktop from its setup.exe there runs packaged, so Windows keeps what it
writes under %APPDATA% and %LOCALAPPDATA% in
%LOCALAPPDATA%\Packages\Claude_<publisher>\LocalCache\{Roaming,Local}.
Nothing was in %APPDATA%\Claude or %LOCALAPPDATA%\Claude*, so magpie didn't
recognise Desktop at all. The packaged app reads its own copy before the
real folder's, so writing the usual folders wouldn't reach it either.

New internal/desktopdir is the one resolver for Desktop's folders: Data
(its own userData: %APPDATA%\Claude, the package's LocalCache\Roaming\Claude),
Mode (the Claude folder deploymentMode goes into, %LOCALAPPDATA%\Claude as
before) and ThreeP (Claude-3p). The package is found by globbing
Packages\Claude_* (the publisher id isn't assumed) and used unless Desktop
runs in the usual folders: it has run there (Chromium's "Local State"; an
%APPDATA%\Claude holding only another tool's claude_desktop_config.json
doesn't count) and not later in the package's. Every place that built
these paths goes through it:

- agent: desktopDirs (its 3p switch's writes, DesktopConfig3p, Claude
  Code's desktop check in claude.go) and detection, which also looks at
  Data (replacing the separate %APPDATA%\Claude check). windowsDesktopDir
  moved into desktopdir unchanged.
- library: apps() (Desktop's MCP file, was os.UserConfigDir) and
  desktopSkillRoots (Cowork's skills-plugin).
- sessions: desktopDataDirs, a copy of agent's resolver, now desktopdir's
  All(); it also adds %APPDATA%\Claude on a usual Windows install, where
  Desktop keeps 1p Cowork sessions (only %LOCALAPPDATA%'s were read). usage's
  request_page and session_provider read it through sessions.DesktopDataDirs.

Tests: TestFindMSIX/TestFindWindowsClassic/TestFindOthers (desktopdir),
TestClaudeDesktopMSIX (agent: detected, switch writes LocalCache\Local\Claude
and Claude-3p, nothing in the usual folders), TestClaudeDesktopMSIXLibrary
(MCP file and skills-plugin in LocalCache\Roaming\Claude),
TestCallsCoworkMSIX (sessions). With the call sites put back to origin/main
the last three fail: "an MSIX Claude Desktop isn't detected", "no Claude
Desktop target: <nil>", "dirs: [.../Claude .../Claude-3p]".

Run: go test -tags nogui ./... under a temp HOME with pinned caches (all
ok); GOOS=darwin|linux|windows go vet -tags nogui on desktopdir, agent,
library, sessions, usage; GOOS=windows go build, GOOS=linux go build -tags
nogui. On the Windows 11 box (Squirrel install, no MSIX package): the
windows test binaries pass every Desktop/MSIX/Cowork test; the full agent
and sessions binaries fail the same 16 and 76 tests (run outside their
testdata) as origin/main's; a read-only probe of desktopdir.Here() gives
the usual %APPDATA%\Claude, %LOCALAPPDATA%\Claude and Claude-3p, Package "".
Not tried against a real MSIX Desktop: none on the box, and Claude-3p's
place in the package (LocalCache\Local, as Local\Claude is in Kilig's
listing) is inferred, not seen.
2026-10-08 12:47:48 +08:00
Strelizia 69b6772794 provider: Qoder check-ins follow the campaign window, so a campaign open past Beijing midnight is claimed and the next one isn't missed (#1173)
Qoder and Qoder CN campaigns run on [startAt, endAt) windows that cross Beijing midnight, so a campaign claimed yesterday could stand in for the whole new day and the next campaign was never claimed.

- A campaign is active by its upstream window, so one still open after Beijing midnight can be claimed.
- A saved result records the campaign's end in `until`, and is reused only on the same Beijing day, within 30 minutes and before that end; after that the list is read again (about 48 list reads per account per day, `inactive` included).
- Manual check-in always verifies upstream; failures and older records without `until` keep the old retry behaviour.
- Only Qoder sets `recheck`; WorkBuddy, Trae CN and MiniMax keep their once-a-day settlement.
2026-10-08 12:46:41 +08:00
yetone 3aeb7d1bf8 gateway: a model a key's plan doesn't serve rests that model alone, not the key (#1235)
SenseNova answers a Token Plan key asked for deepseek-v4.1-flash with
403 "model is not available in the current token plan" while the same
key serves deepseek-v4-flash. That refusal was a plain failure: it
rested the whole key, its backoff counted per key and doubling up to
10 minutes, so an agent that kept asking for the model left every key
of the provider resting for every model (Sun1090: both keys "失败 · 9
分钟后恢复").

A 400/403/404/422 whose body says the model isn't served
(unservedWords), with no quota, credit, rate-limit or channel words,
now rests only that key's or account's model (modelRefused, keyed by
restID, which is now restKey/model for every candidate), its backoff
counted by the model and cleared when the model answers. The key's
other models stay first in order, and its row shows no rest.

TestModelNotInPlanRestsTheModelNotTheKey (two keys, four requests for
the refused model, SenseNova's error shape) fails without the change:
"key One rests for a model its plan lacks: {Why:other Status:403 ...
By:backoff Failures:3}" and "deepseek-v4.1-flash doesn't rest". With
it: go test -tags nogui ./... under a temp HOME passes; -race -count=5
over TestModelNotInPlan|TestSeveralKeys|TestFallback|TestRouting|
TestPool|TestGroup passes; go vet (darwin, GOOS=linux, GOOS=windows,
nogui) passes. Not tried against a real SenseNova key: the body's
"code" field in the fixture is a guess; the message is the reporter's.
2026-10-08 12:26:53 +08:00
yetone e4c292f655 provider: moved ZCode users get plugin 0.1.13, whose claim line has one fixed name the GUI can translate (plugins #43) 2026-10-08 11:57:15 +08:00
Alex be1ce5d4d2 davsync: incomplete S3 listings keep cached usage days (#1243)
Reject truncated listings with missing or repeated tokens and listings that exceed the page limit. On the old code the regression reports successful partial listings and shareWith removes a cached day. Focused tests pass in a temporary HOME.
2026-10-08 11:52:26 +08:00
Alex 2d9db1b60d edit: malformed JSON configs stay untouched when agents connect (#1242)
Validate the complete comment-stripped document before object and array edits, including previews. Regression tests fail on the old implementation because edits and VS Code Connect succeed and alter malformed files. Targeted edit and VS Code tests pass in an isolated HOME.
2026-10-08 11:52:20 +08:00
yetone 814dca9390 gateway: the ChatGPT backend's 502 "response protection is unavailable" is the request's, not the account's: asked once, no account rests, and a magpie-model compaction refused so is asked again as text (vs on Discord)
A long Codex conversation's compaction refused so went to every ChatGPT
account in turn, each rested on a growing backoff, then the last was asked
twice more: 5 upstream tries per Codex request with 3 accounts, times
Codex's own retries. Now the provider's other accounts and models are
not asked it, nor the same one after a moment; another vendor left in a
group is asked once. A reply broken off with it rests nobody either.
codexCompact falls back to plainCompact on it, as vs's control experiment
(the same history as text) was answered.

TestProtectionRefusalAskedOnceNobodyRests fails on the old code with
"asked 5 times ([acct-1 acct-3 acct-2 acct-2 acct-2]), not once" and two
accounts resting; TestProtectionRefusedCompactionAsText with status 502.
The error body's exact bytes are not the reporter's; no real ChatGPT
account was tried.
2026-10-08 11:34:33 +08:00
yetone 3f39883204 provider: the codex provider lists every ChatGPT account's models, not only the one Codex is signed in to: a Pro 5x account beside a Free sign-in showed only the Free plan's three (Raven on Discord)
codexAccount fetched the provider's list with ~/.codex/auth.json's sign-in;
the saved accounts' own lists only lent it their reasoning levels (#520).
codexPoolModels now also adds a model only another account on lists, right
after its predecessor in that list (as mergeAntigravityModels does). The
gateway already sends each account only what its own list has.

TestCodexProviderListsEveryAccountsModels fails on the old code with
'the codex provider lists gpt-6-luna,gpt-5.6-terra,gpt-5.6-luna'.
2026-10-08 11:26:10 +08:00
Kenoia ad3b7fe5c2 agents: keep Air provider fields on sync and model picks (#1239) 2026-10-08 11:20:35 +08:00
yetone 70ec514872 provider: a Copilot editor token GitHub refuses gives way to the Copilot CLI's sign-in of the same account, and a sign-in from magpie of that account is kept (#1238, eightHundreds)
A stale oauth_token for octocat left in ~/.config/github-copilot/apps.json
was read before everything else, so its 401 Bad credentials left Copilot
with no models although the Copilot CLI was signed in to octocat and
worked; signing in again from magpie didn't help, since the new token was
let go as the editors' own account.

- copilotToken remembers an editor token whose trade GitHub refuses (401 or
  403; tried again after an hour, or as soon as one trade works).
- copilotApp.session then uses the CLI's sign-in of the same login on the
  same host, sent as the CLI sends it, and copilotLogin reads that sign-in
  for the account from then on. A CLI signed in to another account is never
  used in its place; the error names the editors' file, and that the CLI is
  another account.
- The Usage card (loginQuota) reads the CLI's sign-in the same way when the
  editor token gets 401.
- The device sign-in asks GitHub about the editors' token of the same account
  first (copilotProbeEditor); refused, addCopilotLogin keeps magpie's token,
  standing for the account. With a working editor token it is let go as
  before.
- TestMain stubs copilotCLISecret, so no test reads the runner's keychain.

Tests: copilot_stale_editor_test.go (fake exchange, user and API servers,
temp HOME). Without the fix TestCopilotStaleEditorFallsBackToCLI and
TestCopilotStaleEditorNotAnotherAccount fail "Copilot is signed out (Bad
credentials); sign in to Copilot again", TestCopilotSignInKeptOverStaleEditor
lists octocat with the editors' gho_x, TestCopilotStaleEditorUsageReadsCLI
reads "Unauthorized". Not tried with a real stale apps.json or a real
Copilot CLI login.
2026-10-08 11:17:39 +08:00
yetone 1efa4c642f gateway: a Codex lead's turn carrying its subagent's sealed reply goes back to the Responses provider that answered the lead, instead of being refused as a subagent task "sealed by the ChatGPT backend" (#1237)
SuperrNaruto (#1237), and PennyVibe on #1109 with v0.1.1108: Codex
with the lead and its subagents all on one custom Responses provider
serving gpt-6-astra. #1109's fix sends the subagent's sealed task back
to that provider, and the subagents ran. But when a subagent answers
the lead with send_message, Codex hands the lead an agent_message to
/root whose payload the provider sealed, and hasSealedAgentMessage
marks the lead's next turn as a sealed task. The lead has no parent
thread, so leadProvider found nobody, sealedReader accepted only a
ChatGPT account, and the lead was refused before anyone was asked with
"This subagent's task was sealed by the ChatGPT backend that answered
its lead ... is neither". The main conversation stopped while the
subagents finished.

The providers that can read a sealed message are now those that
answered the lead (the parent thread, as before) and the one that
answered the request's own conversation (leadProvider of its
conversationID): a subagent sent a task sealed by the lead's provider
had to be on that provider, so its reply was sealed there too. A lead
moved to another provider, one magpie never answered, and a subagent
whose lead a ChatGPT account answered are still refused before anyone
is asked, with the same messages.

Verified: TestSealedReplyGoesBackToTheProviderThatAnsweredTheLead
(lead, subagent, then the lead with the subagent's sealed FINAL_ANSWER
reply, all on third/gpt-6-astra with Codex's web_search tool) fails on
origin/main with the reporter's exact 400 and passes with the change;
the reply's ciphertext reaches the provider as it came.
TestSealedReplyRefusedWhereTheLeadWasNotAnswered and
TestSealedTaskFromChatGPTLeadStillRefused (lead on gpt-5.5 through the
ChatGPT sign-in, subagent on the custom provider) pass on both. go test
-tags nogui ./internal/gateway passes; the sealed tests pass under
-race -count=5; go vet -tags nogui ./internal/gateway passes for
darwin, linux and windows. Not tried with real Codex and a real relay
of the ChatGPT backend: the reply's item is built from the
"Message Type: FINAL_ANSWER / Task name / Sender / Payload" layout in
the codex 0.160.1 binary and PennyVibe's description, not from a
captured request.
2026-10-08 11:13:11 +08:00
yetone 6d7b574b5a agents: a Codex another app ships and runs as its app-server is named by that app, so the row says to reopen Agents Anywhere, not a terminal (miaopasi on Discord: the copy left was Agents Anywhere's connector's codex app-server) 2026-10-08 11:09:37 +08:00
yetone 2f74a963d7 agents: a Codex left on the old list is named, with how to reopen it — the Codex app (⌘Q: closing its window keeps it running on macOS), an editor's Codex, the CLI's background app-server, a terminal's codex (miaopasi on Discord: "已接入 · 重开 Codex 后生效" stayed after restarting Codex)
Agent.Stale counted every process matching (^|/)codex( |$) that started
before magpie's last change, and the row only said "reopen Codex". Several
of those don't end when Codex is "reopened": ChatGPT.app's main process
registers window-all-closed so a packaged app on darwin doesn't quit
(read from /Applications/ChatGPT.app/Contents/Resources/app.asar), so
closing the window leaves its app-server (CodexCLI.app/.../codex
app-server) running; an editor extension's codex app-server, the CLI's
--managed-daemon (ppid 1) and a codex in another terminal run on through
a reopened app. One app also counted twice: its app-server and its
`codex exec-server --remote` both match (this Mac's ps).

Agent.StaleCopies gives each copy with its kind (app / ide / daemon /
cli, from the command line) and start, one app's processes as one copy;
Stale is its length. /api/state carries staleCopies, and the opened row
under "N running Codex still have the old list" says, per copy, what it is,
when it started and how to end it: ⌘Q for the app, the editor's window
reload, `codex app-server daemon restart` for the daemon, quit for a
terminal's. Strings in zh, zh-TW, ja, de.

TestCodexStaleCopiesSayWhichIsLeft (an app with its exec-server, VS
Code's Codex, this home's daemon, an old and a new terminal codex: app,
ide, daemon, cli; Stale 4) fails on the old logic (5 copies, no kinds).
agent-stale-copies.test.cjs (Chromium and WebKit, en/zh/zh-TW/ja/de,
980 and 440px) fails on the old app.js (no such lines).

Run: go vet -tags nogui (darwin, GOOS=linux, GOOS=windows) ./internal/agent
./internal/gui; go test -tags nogui ./internal/agent ./internal/gui (temp
HOME); node --test internal/gui/tests/agent-*.test.cjs gui-ja gui-de
gui-zh-tw i18n-keys codex-model-order: 202 pass, both engines. Not tried
with the reporter's Codex: which copy is left on their Mac isn't known.
2026-10-08 10:40:45 +08:00
yetone 40c5b92a93 gateway: structured output crosses every translation: a Responses text.format or a Chat response_format reaches a Chat, Responses, Messages or Gemini upstream in its own words (frostming on Discord: responses.parse through magpie to OpenRouter came back as plain text)
The IR held a schema only from Anthropic's output_config.format, and only
Messages (and Claude Code's --json-schema) were asked for one. A Responses
request to a provider magpie speaks Chat or Messages to (OpenRouter has no
Responses URL) lost text.format; a Chat request translated to Responses or
Messages lost response_format; an Anthropic schema translated to Chat or
Responses was lost too.

Format (format.go) now carries json_schema (name, description, schema,
strict) or json_object from Responses, Chat, Anthropic and Gemini, and each
builder asks for it in its upstream's field. Where a target can't say it
(json_object on Messages or Claude Code; the vendor bridges Cursor, Devin,
Kiro, Qoder, Command Code, Zed) it is told in the system prompt. An upstream
answering 400/422 naming the field (DeepSeek's "This response_format type is
unavailable now") is asked again with it told in words, and so from then on.
Relayed requests are unchanged.
2026-10-08 10:37:02 +08:00
yetone 6d51214094 gui: a custom provider's Base URL takes a URL for each API in turn: a URL typed for OpenAI and carried to Anthropic when it was picked goes back to OpenAI once Anthropic's own URL is typed, so both are saved (#1231)
Picking an API with no URL still carries a URL typed and not saved over to
it, spelled as that API wants it (#73, #105). That move emptied the API the
URL was typed for, so typing the next API's URL over the carried one left
only one URL to save. Typed over there, the carried URL now goes back where
it was typed; left as carried, it is a move, as before. A detection taken,
or the first API's URL typed under More endpoints, ends the carry.

provider-url-each-api.test.cjs: red on the parent in all 6 cases (Chromium
and WebKit, en/zh 900px, en 440px): "OpenAI's URL is back under More
endpoints" found none; green with the change. The #73 move (URL then
Responses picked, nothing typed: only the Responses URL saved) and a saved
provider's two new URLs are checked in the same test.

Full GUI suite with both #1229 and #1231 (concurrency 4): 3644 pass, 15
fail; the failures are context-window.test.cjs, usage-ledger.test.cjs
(red on origin/main alone too) and two load-only search-api /
searcher-pick cases that pass alone. gui-zh-tw, gui-ja, gui-de pass.
2026-10-08 10:29:14 +08:00
yetone 80a4f21940 gui: an agent's current model stays listed under its provider in the picker's rail: with OpenAI picked in the rail, Codex on gpt-6.1-sol showed every OpenAI model but gpt-6.1-sol, as if magpie had dropped it (#1229)
The picker lists the current model first, out of its provider's rows; that
row had no group, so a provider picked in the rail filtered it out, and a
provider whose only model is the current one lost its rail icon. The row
now keeps its provider as `home` for the rail's filter, and the rail's
providers are taken in catalog order before the current model is lifted.

picker-rail-current.test.cjs: red on origin/main in all 8 cases (Chromium
and WebKit, 1000px and 440px, Codex connected and not), "gpt-6.1-sol under
OpenAI once" listing only gpt-6-astra and gpt-6-sol; green with the change.
2026-10-08 10:29:14 +08:00