Commit Graph
6168 Commits
Author SHA1 Message Date
yetone 5daba8337b provider: zed's mover min is 0.1.15, which sends Zed compaction edits only (nllay, plugins#636)
Claude Code's clear_thinking_20251015 context edit was answered 400 by
Zed's cloud ("unknown variant ..., expected `compact_20260112`"). zed
0.1.15 (plugins 48d0cec) keeps only compact_20260112 edits and leaves
context_management out when none remain. npm has 0.1.15
(npm view --prefer-online). keepMovedCurrent brings every moved Zed
user up to it.

Run on mote at b0174e761 plus this change: gofmt -l internal/provider
(clean), go vet ./internal/provider (darwin and GOOS=windows), go test
-timeout 45m ./internal/provider ok (108s).
Not tried: a real Zed account.
2026-11-02 20:19:22 +08:00
yetone b0174e7615 usage: a ChatGPT card says why its allowance can't be read, and a ChatGPT API account says where it shows
hmy on Discord: five ChatGPT accounts each said only "暂时无法获取额度"
(Allowance unavailable). danzi002 on Discord: accounts added through the
API never show usage, ones added as ChatGPT do.

What changed:
- Codex's usage read (codexWindows) now words its failure
  (codex_usage_words.go): a Cloudflare challenge names the proxy/VPN
  address as the usual cause; any other HTTP answer names its status and
  what ChatGPT said; a network error says chatgpt.com couldn't be
  reached; a reply magpie can't decode says so. The error still unwraps
  to accountStatusError, so expiry and passing logic is unchanged.
- A ChatGPT API account (chatgpt-api) was read as a Codex account: a
  saved one said "chatgpt-api accounts can't be used side by side", the
  one in use read Codex's own sign-in ("Codex is signed out", or another
  account's allowance under its name). OpenAI's API tells no plan usage,
  so its row now says so, names chatgpt.com/settings/usage (SeeAt) and
  says the same account added as ChatGPT shows it here.
- GUI quotaError translates each of these (en, zh, zh-TW, ja, de), and
  "not read yet" (errNotAsked) gets its own words. The generic fallback
  now reads "Allowance unavailable — hover for why"; the row's tooltip
  has always been the raw error. Comments in app.js were shortened to
  stay under TestCoreScriptBudget, which is not raised.
- docs/subsystems/providers-accounts.md describes the words.

Endpoint: the real wham/usage read of the owner's accounts in a sandbox
HOME copy (read-only, ~/.codex untouched) answered 200 and parsed, so
the endpoint itself is not broken; the "error decoding response body"
work is another session's and is not touched here.

Run (on mote; provider and gui again at the pushed head, rebased on
18c69aa46; 2251ca1ce, new under it, changed app.js and the budget):
- gofmt -l clean; GOOS=linux -tags nogui and GOOS=windows go vet of
  provider and gui clean.
- go test -timeout 45m ./...: ok except TestEveryRouteHasACommandOrIsNamed
  (#4826, red on origin/main 2251ca1ce too), TestMainWindowCorners (#3949,
  red on main too) and TestCodexPoolSaysTheClientsVersion (#4807, red in
  the full run, ok alone here and on main). At the pushed head:
  provider ok, gui ok but TestMainWindowCorners (#3949), core budget ok.
- GUI: chatgpt-usage-why.test.cjs (new; chromium and webkit, 560 and
  390, en/zh/zh-TW/ja/de, each row's words, its status code, the raw
  tooltip, no overflow) and the six tests whose generic line changed.
  The whole GUI suite was not run before this push: another session's
  full suite held mote. The change adds no API call and no layout, only
  words; the whole suite runs after the push and its reds get issues.

Broken by hand:
- codexWindows returning the bare err: TestCodexUsageSaysWhy and
  TestCodexLoginUsageSaysCloudflare red.
- the GUI ChatGPT patterns removed: chatgpt-usage-why 0/2.
- the chatgpt-api branch off: TestChatGPTAPIUsageSaysWhere red, the
  row read "Codex is signed out; run codex login".

Not tried: a real Cloudflare challenge (the fixture is the start of its
page as Cloudflare serves it, not hmy's bytes, which magpie hasn't got); a real ChatGPT API account (none signed in here); making a
ChatGPT API account's usage readable, since its token is for
api.openai.com and OpenAI shows plan usage only on chatgpt.com.
2026-11-02 20:04:32 +08:00
yetone 18c69aa467 gui: Windows reads the screens with one callback, not one per display change (1111_13879)
1111_13879 on Discord: on Windows the app died after a few hours with
"fatal error: too many callback functions", taking the gateway with it
(clients got connection refused). Five dumps all ended in
w32.GetAllScreens -> syscall.NewCallback -> runtime.compileCallback,
from Wails' WM_DISPLAYCHANGE handling.

Wails (v3.0.0-beta.24 here; v3.1.0 and v3.2.0-nightly.20261101 are the
same) reads the screens again on every WM_DISPLAYCHANGE, and on
WM_SETTINGCHANGE for SPI_SETWORKAREA, through w32.GetAllScreens, which
passes a fresh closure to syscall.NewCallback each call. Go never frees
a callback and throws past about 2000, unrecoverably.

magpie now sets WndProcInterceptor (screensWndProc): on Wails' hidden
main-thread window ("__wails_hidden_mainthread") it takes those two
messages before Wails does, enumerates the monitors with one callback
made once at package level (allScreens), builds the screens exactly as
Wails' processAndCacheScreens does (wailsScreen) and hands them to
Screen.LayoutScreens, then answers as Wails would (DefWindowProc for
WM_DISPLAYCHANGE, 0 for WM_SETTINGCHANGE). Other windows and messages go
on to Wails. Wails' one read at start-up is the only per-call callback
left. No go.mod change: no newer Wails fixes it, and magpie has no fork.

Other per-call NewCallbacks in Wails' Windows code: w32.EnumChildWindows
and w32.SetWindowsHookEx, neither called by Wails or magpie. WndProc
classes are registered once; the WebView2 COM vtables are package-level.
magpie's own (internal/agent apprestart) is already made once.

Run at this tree (base e156fdd03; origin/main since adds only
2251ca1ce, providers, no shared file):
- Windows (win-run, xiaomi-gpu): the three new tests pass;
  TestScreensReadFarPastTheCallbackLimit reads 5000 times and matches
  Wails' own read field for field. go test ./internal/gui: 5 reds,
  TestGatewayHeldByAContainer, TestLodyImportHandoff,
  TestImportStatusUnreadableIsUnknown, TestAionUiImportRow,
  TestUpdateThatWontStart, the same 5 at e156fdd03 without this change
  (#4115, #2107). internal/proc, agentenv, pluginrt ok; sqlitedb's
  TestSQLiteSurvivesMalformedEnv red, the same at the base (#4115).
- mote: gofmt -l clean; go vet ./internal/gui ./internal/cli .;
  GOOS=windows go vet ./...; GOOS=linux go vet -tags nogui ./...;
  go build, GOOS=windows go build, GOOS=linux go build -tags nogui;
  go test ./internal/gui: ok but TestMainWindowCorners (#3949, macOS 27).
- Linux (wsl-run): go test -tags nogui ./... was still running at push (the nogui build leaves these files out), so it had no result to record here.

Broken by hand:
- allScreens with a NewCallback per call (as Wails does):
  TestScreensReadFarPastTheCallbackLimit dies with the reporter's
  "fatal error: too many callback functions" from
  syscall.compileCallback.
- A throwaway test calling Wails' w32.GetAllScreens 5000 times dies the
  same way at w32/screen.go:145.
- WndProcInterceptor left out of windowsOptions:
  TestAppReadsDisplayChangesItself fails.
- wailsMainThread misspelt: TestWailsScreensAreReadOnTheMainThreadWindow
  fails.

Not tried: the real app through real display changes on a desktop
session (win-run has no interactive desktop; the test creates a window
titled as Wails' own and sends it the messages); a multi-monitor or
rotated-display layout (the box has one screen). No upstream Wails issue
filed yet; text drafted.
2026-11-02 20:00:54 +08:00
yetone 2251ca1ce9 providers: a ChatGPT account's row says when its paid plan ends (danzi002)
danzi002 on Discord (#general, 11-02): 「codex 账号什么是可以加一个 plus
账号到期时间」. The Usage page, the tray panel, the TUI and `magpie
quota` have shown "Until …" for the signed-in Codex account since
d8200dfe5. The Providers → Codex editor's account rows showed only
"ChatGPT Plus", for every account, saved ones included.

Now each Codex and ChatGPT API account in /api/providers carries
`until`, from its own sign-in's id token claim
https://api.openai.com/auth → chatgpt_subscription_active_until (no new
network call). The row puts "Until Nov 19" on the line under its name,
beside its allowance, the whole date and time in its tooltip.
- Codex: the sign-in Codex holds when it holds that account (through
  readCodexLogin, which it refreshes), else logins.json's copy.
- ChatGPT API: its saved id token, then its access token.
- No claim, an unparsable one, or a date gone by: nothing shown, never
  a guess. A real Pro token issued today carried an until weeks in the
  past (its last_checked was older still): OpenAI updates the claim now
  and then, so a past date says nothing true about the plan.
- chatgptUntil is the one reader; codexUntil (the usage card) uses it.

The core scripts' budget is not raised: two account-row comments in
app.js were cut to pay for the line (1,533,739 of 1,533,802).

Checked on real tokens (key names only, read-only from
~/.config/magpie/logins.json): the auth claim's keys are
chatgpt_account_id, chatgpt_plan_type, chatgpt_subscription_active_start,
chatgpt_subscription_active_until, chatgpt_subscription_last_checked,
chatgpt_user_id, groups, localhost, organizations, user_id; the until is
RFC3339 with +00:00. The tests' claims are written in that shape.

Run at this tree on mote (macOS 27):
- gofmt -l internal: nothing.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/tui .: provider, tui and root ok; gui red only on
  TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 only, the same
  on main). TestCoreScriptBudget ok.
- go vet ./internal/provider ./internal/gui; GOOS=linux go vet -tags
  nogui; GOOS=windows go vet: ok.
- New TestCodexLoginUntil (signed-in and saved accounts, a past date, no
  claim, the JSON the GUI reads) and TestSIWCLoginUntil: ok.
- New account-plan-until.test.cjs: Chromium and WebKit, 1000, 560 and a
  390 phone browser, en zh zh-TW ja de; the date is whole, inside its
  row, translated, the first line stays one line, no sideways scroll.
- GUI files account-*, codex-*, i18n-keys, lane-limit, login-*,
  providers-*: 892 of 894 ok. The two reds are codex-auto-reset webkit
  de 1100 and 420 ("the click moved the page", Usage page), red the same
  way run alone at origin/main e156fdd03 on mote (#4790).

Rebased on origin/main e156fdd03 (three mover-min commits since the
base): ./internal/provider and TestCoreScriptBudget run again there, ok.

Broken by hand: dropping lg.Until's assignment in loginsNow turns
TestCodexLoginUntil red; dropping the line in siwcLoginList turns
TestSIWCLoginUntil red; dropping the aq.append in renderAccounts turns
account-plan-until red in both engines.

Not tried: a Codex account held in another home (codexHeldIn) has no
test; no real ChatGPT API account's token was read, so its claim is
assumed from the Codex one; no Team plan token was seen; the real app
was not opened, only Playwright's Chromium and WebKit.
2026-11-02 19:41:05 +08:00
yetone e156fdd032 usage: a model's region deployment answered under its own name is not a swap (plugins#628)
WorkBuddy AI lists DeepSeek V4.1 Flash as deepseek-v4.1-flash-sg, its
paid id for the Singapore deployment. The plugin's product config names
it paidId to the free deepseek-v4.1-flash, with one window for both.
WorkBuddy answers under the model's own name, so the Routing page tagged
each request "请求 deepseek-v4.1-flash-sg · 实际 deepseek-v4.1-flash".
Old routes and kept usage rows kept the mark, so removing the model and
setting the provider up again didn't clear it (chansee97, plugins#628).

- RegionTail (internal/usage/served.go) covers a name that is the other
  with -sg, -us, -eu, -cn, -intl or -global after it. Such a pair is the
  same model, and Swapped excludes it.
- A region in both names, or a name that differs besides the region, is
  still a swap.
- Kept rows (request_page.go) and kept routes (gateway history.go's
  routedAgain) are judged again with it, so old marks go too.

Run on mote, at 5f0a84a00 plus this change:
- gofmt -l internal plugins: clean.
- go test -count=1 -timeout 45m on ./internal/usage, ./internal/usageapi,
  ./internal/budget, ./internal/davsync, ./internal/middleware,
  ./internal/otlp, ./internal/gui/..., ./internal/cli, ./internal/tui,
  ./internal/gateway/..., ./plugins/middleware/..., ./plugins/otel/... and
  ./internal/agent (every importer of internal/usage): all ok except four
  reds that are filed and don't touch swap marking:
  - internal/gui TestMainWindowCorners (#3949)
  - internal/cli TestEveryRouteHasACommandOrIsNamed (#4826)
  - internal/gateway TestCodexPoolSaysTheClientsVersion (#4807)
  - internal/gateway TestUnroutedRequestShownThenAnswered (#4200)
- GOOS=linux and GOOS=windows go vet ./internal/usage
  ./internal/gateway/...: ok.

After the rebase onto a32588528, which changed internal/usage's
request_page.go and match_chunks.go:
- ./internal/usage and ./internal/usageapi: ok.
- go test -run "RouteKept|Swap|Served|History" ./internal/gateway: ok.
- vet: ok.

Broken by hand, each red:
- RegionTail taken out of Swapped: TestSwappedRegionTail.
- The kept-row re-judge taken out: TestKeptRowRegionTailNotSwapped.
- The routedAgain re-judge taken out: TestRouteKeptRegionTailNotSwapped.

Not tried:
- A live WorkBuddy AI request to -sg, which would spend credits. That
  WorkBuddy answers -sg under the plain name rests on the report.
- The reporter's screen. This assumes the "实际" tag they saw is the
  Routing page's swap tag (or Usage's Served column, which is fixed by
  the same rule).
2026-11-02 19:26:26 +08:00
yetone a32588528f provider: WorkBuddy's mover min is 0.2.13, whose free window reads the ledger in linear time (xmoon76)
xmoon76 on Discord: with WorkBuddy on, the bun plugin host sat at 99% CPU
and every session hung. Restarting didn't help; turning WorkBuddy off
did. The plugin's free-model daily window read magpie's usage ledger in
O(n^2), because pinned(chain) ran after every kept row. 16k rows took
10.5 s on each card refresh, all of it on the host's single JS thread, so
every plugin's chats waited behind it. workbuddy 0.2.13 (plugins
3167531) pins once per read and takes 14 ms. Raising the min makes
keepMovedCurrent bring every moved user to it.

npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-workbuddy-auth version: 0.2.13.

Run at this tree on mote (rebased onto 9c58c87e8, whose Qoder CN min touched
internal/provider, so it was run again after the rebase; c51bc9063 then landed with a
one-line ZCode min only, not run again):
- go test -count=1 -timeout 45m ./internal/provider: ok (126.5s)
- GOOS=linux and GOOS=windows go vet ./internal/provider: ok
- gofmt -l internal/provider: clean

Plugin side (plugins repo):
- The plugin's tests passed on mote and on WSL (Linux).
- Broken by hand three ways, each red.

Not tried:
- xmoon76's own ledger. The 16k-row case is built from the shape the
  plugin reads.
- A host-side guard that names the plugin holding the thread is filed as
  #4916, not built here.
2026-11-02 19:24:07 +08:00
yetone c51bc9063b provider: ZCode's mover min is 0.1.42, which spends a live gift first (sgfvdsg86265 on X)
zcode 0.1.42 (plugins b820704) makes freeFirst the default: a plain GLM
model spends the account's live ZCode gift first and falls back to the
coding plan. "freeFirst": false in the plugin's or the provider's
options keeps the plan first, as before. Raising the min updates every
moved user's plugin (keepMovedCurrent).

npm view @magpie-community/opencode-zcode-auth version --prefer-online:
0.1.42 when this landed.
Run on mote: go test ./internal/provider -run 'Mover|Moved|Min|ZCode'
ok; gofmt -l clean.
Not tried: a real account with a claimed gift.
2026-11-02 19:21:50 +08:00
yetone 9c58c87e8f provider: Qoder CN mover min 0.2.53, enterprise dedicated domain sign-in
Milktea (Discord) signs in to Qoder CN on a dedicated domain
(https://<corp>.rdc.aliyuncs.com) through the IDE's 「企业版专属域登录」;
the plugin's VPC sign-in failed for it. opencode-qoder-auth 0.2.53
(plugins 7312770) adds "Sign in with Qoder CN Enterprise dedicated
domain", read from Qoder IDE 1.38.0's bundle: it probes
<domain>/algo/api/v1/version (404 = Lingma 1.0, refused with what it
is; anything else = Qoder CN 2.0), then runs the VPC device flow
against the -openapi host with the dedicated client id, and chats on
the -gateway host (the origin when that host doesn't answer). npm
has 0.2.53. This raises the mover's min so moved users get it.

Run:
- plugins: bun test packages/qoder (355 pass, 0 fail, 10 new
  dedicated tests on a fake server), bun scripts/check.mjs ok.
- magpie: go vet + go test -count=1 ./internal/provider on mote: ok
  (125s). gofmt -l clean.

Broken by hand:
- TestQoderCNMoverHasTheDedicatedDomainSignIn red with min 0.2.52.
- plugin: disabling the dedicated branch, the 404 check and the origin
  fallback turned 4 of the 10 dedicated tests red.

Not tried: any real dedicated-domain account; the chat host
(-gateway) is inferred from the IDE's experts-center rule, not seen
in a capture. The Lingma 1.0 dedicated path (cosy's login flow) is
not implemented.

Thanks to Milktea on Discord for the report.
2026-11-02 19:10:37 +08:00
yetone 07dc0b4ec1 usage: an agy following the Antigravity app's gateway is counted once (Chamberlain_zyz on X)
An agy not connected on its own row follows the Antigravity app's
gateway, with the app's key (internal/agent/antigravity.go), so the
gateway records its calls as the app's ("antigravity"). Its transcript's
steps were matched only to records of agent "agy", so each one was
counted twice: Chamberlain_zyz's 17:00 hour showed Antigravity
39,104,506 and Antigravity CLI 38,562,861 tokens for the same calls.

agyGateway takes the app's session-less records too, at all three places
that matched agy's alone: the gateway side of the match key, the chunk
hints that pick which transcripts to open, and matchingRecords. The
match is still by exact tokens and time, so an app call of its own is
paired with an agy step only if both counted the same tokens within the
step's window. It is worked out when usage is read, so hours already
recorded are counted once too, for every user, with nothing to redo.

Run (mote, this tree):
- go test -count=1 -run Agy ./internal/usage: ok.
- Broken by hand (agyGateway back to "agy" alone):
  TestAgyStepThroughTheAppsGatewayCountedOnce and
  TestMatchOpensAgyChunksForTheApp fail; restored, ok.
- go test -count=1 ./internal/usage ./internal/sessions: both ok.
- go vet ./internal/usage, and with GOOS=linux and GOOS=windows: ok.
- The whole suite was not run: only these two packages are touched.

Not tried: a real agy through a real Antigravity app's gateway; the
reporter's case is taken from their screenshots and the app's wiring.
2026-11-02 19:08:59 +08:00
yetone 5f0a84a003 agent: Air in JetBrains IDEs gets magpie's Magpie agent in ~/.jetbrains/acp.json (Jumy on Discord)
Jumy asked for the "air-plugin" new in IntelliJ IDEA 2026.3 (Settings ›
AI › Air). magpie's air agent wrote the Air app's acp.json, in
~/Library/Application Support/JetBrains/Air, which the IDE plugin never
reads: the plugin (com.intellij.air, air-plugin-262.8665.521-mac-arm64
from JetBrains Marketplace) loads its custom ACP agents in
AcpConfigurationLoader (intellij.air.backend.acp.runtime) from
user.home/.jetbrains/acp.json on every system, the file AI Assistant's
custom agents use too; AgentServerConfig takes command, args, env,
use_idea_mcp and use_custom_mcp. The standalone app (Air-262.1037.14,
Fleet-based) reads acp.json from its own configs folder
(genericAcpConfigPath), so the two are separate files.

Air's own agents have no base URL: JetBrains AI, the agent's own login,
or an Anthropic, OpenAI, Gemini or OpenRouter key under AI › Air ›
Accounts. So the IDE gets the same route as the app: a new air-ide agent
("Air (JetBrains IDEs)", aliases air-plugin, air-in-ides) writes a
Magpie entry (opencode acp, OPENCODE_CONFIG naming magpie-opencode.json
beside acp.json) and nothing else; the user's agents and
default_mcp_settings stay, and disconnecting takes out that entry and
that file. air and air-ide share airAt. air-ide shows for an IDE config
folder of 2026.2 or later (the plugin is bundled from 2026.3), or with
its entry already in acp.json. Notice in en, zh, zh-TW, ja, de; README,
reference and agent-wiring rows.

Run at this head (rebased on ed978e560), on mote:
- go test -tags nogui ./internal/agent ./internal/gui: ok.
  ./internal/cli: TestEveryRouteHasACommandOrIsNamed red, the
  checkin-account route, #4826, not this change.
- go vet darwin, GOOS=linux, GOOS=windows (agent, gui); gofmt -l clean.
- -run Air on Windows (win-run) and Linux (wsl-run): ok.
- GUI i18n-keys, agent-notice-lang, about-notices, agents-last-known in
  chromium and webkit: all pass.
Broken by hand: air-ide on the app's folder fails
TestAirIDEAddsMagpieAgent; a version check of > in place of >= fails
TestAirIDEDetectedByIDEVersion on GoLand2026.2.
Not tried: a real IntelliJ IDEA 2026.3 with the plugin listing Magpie
(the plugin's watcher should pick up acp.json; JetBrains' docs say to
restart the IDE, which the notice says); opencode acp itself was checked
under the app's entry in 5a0559d37, the entry is the same here.
2026-11-02 19:00:29 +08:00
yetone ed978e560f gui: the Quit question's Don't ask again, and Settings › General › Ask before quitting (zhujiu on Discord)
zhujiu (Discord #feedback) asked for a 不再提示 on the question a tray
Quit asks while agents go through magpie (8826a15ea), and a switch in
Settings to turn it on and off again.

- The question (quitask.js, an in-app sheet) has a "Don't ask again"
  checkbox above its buttons, unticked each time. It goes with the Quit
  chosen: Quit and Disconnect and quit post window/quit?now=1&noAsk=1,
  which saves settings.quitNoAsk (settings.SetQuitNoAsk, under the file
  lock) before quitting; a failed save keeps magpie open. Cancel saves
  nothing.
- AskQuit quits at once when quitNoAsk is set (quitAtOnce); otherwise as
  before. The default is unchanged: it asks.
- Settings › General has "Ask before quitting" On/Off (segs, app-only),
  after Open at login. settingsapi.Keys lists quitNoAsk, and Merge carries
  it when a save doesn't send it, so the tray panel or an older page
  can't turn the question back on.
- zh, zh-TW, ja, de strings. Five app.js comments shortened to stay in
  the core script budget (no raise).

Run at the pushed head (on origin/main f95bacdfb), on mote:
- gofmt clean; go vet darwin, linux, windows (nogui too).
- go test internal/settings, internal/settingsapi ok; internal/gui
  -run "Budget|Quit" ok.
- internal/cli: TestEveryRouteHasACommandOrIsNamed red for
  POST /api/usage/checkin-account, from e87140242, filed as #4826; this
  change adds no route.
- GUI, chromium and webkit: quit-ask-setting (25: en, zh, zh-TW, ja, de
  at 1100 and 420), quit-ask (35), settings-general, settings-sections,
  settings-search, settings-tabs-stick, wsl-agents-setting, agent-prefs,
  i18n-keys, old-webkit, auto-backup, all pass.

Broken by hand, each red:
- api.go's noAsk ignored: TestQuitDontAskAgain "wasn't saved".
- quitAtOnce not reading the setting: TestQuitDontAskAgain "still asks".
- Merge carry dropped: TestQuitNoAskKeptUnlessSent.
- SetQuitNoAsk saving false: TestSetQuitNoAsk.
- quitask.js without &noAsk=1: quit-ask's two Don't ask again tests.

Not tried: a real tray Quit with the box ticked in the built app on
macOS, Windows or Linux; only the sheet in Playwright and the handler
in Go. Not the whole GUI suite.
2026-11-02 18:53:07 +08:00
yetone b58669eb09 gateway: an overload told in Codex's stream says server_is_overloaded (wjh66)
wjh66 on Discord (Windows, v0.1.2710, Codex on the ChatGPT sign-in,
gpt-6.1-sol): every turn showed "reconnecting 5/5", and app.log had the
backend's "Our servers are currently overloaded" again and again.

With one ChatGPT account, magpie asks an overloaded turn again
(lastRetries) and keeps Codex alive past keepHeldAfter with the stream's
200 and comments. When the retries ran out, the backend's busy status
(529, or a 503 saying overloaded) went to Codex in that stream as
response.failed with code server_error. Codex reads server_error as
Retryable (codex-rs codex-api sse/responses_error.rs) and sent the turn
five more times, each one asked three times by magpie: 18 asks of an
overloaded model, then the last error alone. The backend itself says
an overload in a stream as server_is_overloaded (#1418), which Codex
reads as ServerOverloaded: "Selected model is at capacity. Please try a
different model.", without the reconnects.

streamError now gives a Responses client server_is_overloaded when the
status is 529, or a 5xx whose words say overloaded (saidOverloaded).
Other failures keep server_error, which Codex retries. A routing group
or the codex subscription's fallbacks still take an overload before any
of this, as before.

This does not explain the earlier "error decoding response body".
Codex says that only when the body of a 2xx fails to read. magpie's
streams read clean over real TCP in every overload shape tried (see
07f4d46c5, which logs a reply cut early).

Ran on mote at this change rebased on 1cb4d4301: gofmt; go vet
darwin, GOOS=linux -tags nogui, GOOS=windows; go test -count=1
-timeout 45m ./internal/gateway: ok but for TestCodexPoolSaysTheClientsVersion,
the known #4807 (the machine's own Codex 0.165.0 identity reaches it).
At the pushed head (rebased on f95bacdfb, whose new commits add
hub_mcp.go to the gateway, nothing of streamError): go vet darwin,
linux, windows, and the overload, StreamError and Hub tests: ok. On Windows (win-run):
TestCodexKeptAliveOverload*, TestStreamErrorOverloadOnly,
TestCodexOneAccount*, TestCodexOwnModel*, *Overload*, *StreamError*,
TestCodexReplyBrokenOffLogged, TestCodexClientGoneLogged: ok, 50 tests.

Broken by hand: with the else-if turned off,
TestCodexKeptAliveOverloadSaysServerIsOverloaded is red in both
subtests (503 message, 529): code "server_error".

Not tried: a real ChatGPT account or the real Codex client against
this build. Whether gpt-6.1-sol is busy for this account only, or the
same request without magpie. The Windows system proxy between Codex
and 127.0.0.1 as the cause of the decode error.
2026-11-02 18:50:12 +08:00
yetoneandRick Chan f95bacdfba gui tests: agent-panel-name-width's lists tick two models, as menuSaid names them (#4203)
The fixture gave WorkBuddy's and Claude Desktop's lists `shown`/`total`,
but /api/state counts them as `listed`, and since 6915c8cde menuSaid
names a list's models only while one or two are ticked. So the rows read
"Showing 3 / undefined models", words too short to cut, and every case
failed at "workbuddy's words not cut" on macOS and Linux alike. The
reporter's two long names were never drawn, so the test no longer
checked #2447. Each list now ticks two of its `listed` 3 and 9.

Cause and patch by R1cK-ChaN on #4203 (c99d001 on their fork), ported
as written.

Run at origin/main ea51526b6 on mote (macOS 27, Playwright 1.62.0):
- agent-panel-name-width.test.cjs alone, chromium and webkit: 0/32
  before, 32/32 after.
- Broken by hand: #2447's grid put back (20px minmax(0, 1fr) auto) with
  this change, chromium: 0/16, "en 550: workbuddy's name cut to
  26.5px of 76", "en 440: ... 0px of 76".
Not run: the whole GUI suite (another session's full GUI suite was on
mote); a test fixture only, no app code changed.

Co-authored-by: Rick Chan <rick.chan.zhikun@gmail.com>
2026-11-02 18:40:31 +08:00
yetone c99901765b gui: one provider of an agent's own is said in the singular (Renzexi01 on X)
Renzexi01's screenshot of the Agents page had MiMo Code's row reading
"Not connected · now has 1 providers of its own". With one, the row now
says "now has 1 provider of its own"; with more, as before. The
singular is translated in zh, zh-TW, ja and de. Two comments in app.js
are cut so the core stays in its budget, with no raise.

Run on mote (macOS 27, Playwright 1.62.0):
- agent-own-providers.test.cjs (new): chromium and webkit, en, zh,
  zh-TW, ja, de, 980 and 420px; 20/20. On origin/main's app.js it is
  red: "Not connected · now has 1 providers of its own".
- At the pushed tree (this commit and the next, on origin/main
  58a833f25): go test -tags nogui -run 'Budget|I18n|Strings' ./internal/gui
  ok; agent-own-providers, agent-panel-name-width, i18n-keys,
  agent-failover, agent-connect: 80/80.
- Before the rebase, at origin/main ea51526b6 plus this change: every
  agent-*.test.cjs and i18n*.test.cjs file (50 files, concurrency 3):
  800 tests, 768 pass, 32 fail, all in agent-panel-name-width, which
  is red the same alone on ea51526b6 (#4203). The next commit fixes it.
Not run: the whole GUI suite (another session's full GUI suite was on
mote) and the Go suite; no Go code changed.
2026-11-02 18:40:31 +08:00
yetone 58a833f254 mcp router: initialize says what each server behind it is and does
packinggoodsllc_07668 (Discord) runs magpies that only share MCP servers,
and an agent given several routers knew each by its name alone. A
router's initialize instructions now describe what it holds, built from
what the servers themselves say; no model writes any of it.

- After the "Tools of …" first line (and the router's name sentence when
  it has one), a line per server: "- name (its serverInfo.title): what it
  is for. Tools: tool (first clause of its description), …". The tools
  the Library turned off are left out; another router's "[name] " prefix
  is dropped. A line too long for its share says tools by name, then as
  many as fit and "and N more". The whole is at most 2000 characters
  (hubSayMax), the closing text kept whole.
- What a server is for: the market's words as before, else its
  serverInfo.description, else its instructions' first line (saysOf).
  Another magpie's "Tools of a (…), b." is said with "Tools of" once.
- What a server said and listed is kept in settings.Dir()/
  mcp-hub-servers.json (not the synced library folder), keyed by name and
  a hash of hubKey, written via temp+rename only on change, pruned of
  servers gone. A router started again describes its servers without
  starting any; one added or edited since is listed by initialize, which
  waits up to 5s for it.
- Pi's hub description (hubAbouts) uses the server's own words too.

Agents, from their installed source (research, not run): Claude Code
shows instructions (4096 chars), Codex as the namespace description,
OpenCode, Gemini CLI (trusted folders only), Qwen Code, Pi (first line in
the prompt); Kimi CLI ignores them. None shows serverInfo.title.

Run at this tree (mote):
- go test -tags nogui ./internal/library: ok (116s)
- go test ./internal/gateway -run 'Hub|MCP|Roots|OversizedBody|
  ReadOnlyKeyEveryRoute|FileURI|ImageModel': ok
- GOOS=linux and GOOS=windows go vet internal/gateway internal/library;
  go vet internal/gui internal/cli; go build ./...; gofmt -l: clean
- New: TestHubInstructionsDescribeServers, TestHubDescriptionsOutlive
  ARestart (library); TestHubAboutBounded, TestHubServerLine,
  TestHubClauseBrackets, TestHubLineOfARouter (gateway).
- Red on the old code: TestHubInstructionsDescribeServers at c9af34446
  fails ("Tools of la, notes." and nothing more).
- Broken by hand, each red: noteCard not writing the file (restart test),
  the DisabledTools filter removed, saysOf returning nothing.
- Real use: two magpie serve builds of this tree in sandbox HOMEs on
  mote (127.0.0.1:3561, :3562), A serving a stdio notes server, B with A's
  /mcp/magpie/hub as server "la". B's initialize said
  "- la (Magpie MCP hub): Tools of notes (…). Tools: notes__add_note (Add
  a note to the notebook), notes__search_notes (…)."; B restarted with A
  down said the same from the file.

Not tried: a real agent reading the new text (Claude Code, Codex,
OpenCode etc. were read in source only); a router with dozens of real
servers; Windows and Linux runs (the change has no OS-specific code).
2026-11-02 18:37:57 +08:00
yetoneanderlinerd 1cb4d43013 profiles: a saved profile renames, in its details, the TUI and magpie rename (#2721, erlinerd)
erlinerd's patch on #2721 (profile.Rename, /api/state profile/rename,
a Rename button in the details), reviewed against main and adapted:

- profile.Rename trims both names, refuses an empty, taken or missing
  name and leaves profiles.json as it was, renames by case only
  (home -> Home), and keeps what the profile holds.
- GUI: Rename turns the details' name into a field. Enter renames
  through profileAction, so the chip is renamed at once, pending, and
  rolled back with the error if magpie refuses; the details stay open
  under the new name, with In use kept. Escape or a click away puts
  the name back. The field lives in profilerename.js, imported on
  press, so the core script stays under its budget (no raise; 50 bytes
  under after comments in app.js were cut). While the field is open
  In use, Apply and Rename hide so a 360px panel's field has room.
- TUI: ctrl+e on a profile renames it on the name line.
- CLI: `magpie rename <old> <new>`; a flag is never taken for a name.
- WebDAV: a rename syncs as the old name gone and the new one in
  (davsync test).

Run on mote at 47672f11c (on 70b96126e), and again after rebasing on
52195b6b0 (backup), as 3b279fdee:
- go test ./internal/profile ./internal/cli ./internal/gui ./internal/tui
  ./internal/davsync: ok except TestEveryRouteHasACommandOrIsNamed
  (#4826) and TestMainWindowCorners (#3949), both red on origin/main
  07f4d46c5 too. gofmt clean; GOOS=linux (-tags nogui) and
  GOOS=windows go vet ok.
- GUI, chromium and webkit: profile-rename (en, zh, zh-TW, ja, de;
  900x560 window and 360x420 panel), panel-profiles, profile-confirm,
  profile-in-use, profile-details, hermes-profiles,
  view-wheel-after-click, i18n-keys, gui-de, gui-ja, gui-zh-tw,
  editor-roomy: 219 pass, 0 fail. After the rebase: profile, cli,
  gui, tui and vet again (same two reds only, core budget ok), and the
  GUI files above with auto-backup in place of editor-roomy: 161 pass.
  Then rebased over ea51526b6 (gateway, plugin, provider only; no
  file of this change, no GUI asset) without another run.

Broken by hand, each red, then restored:
- Rename comparing names with EqualFold: TestRename red (case-only).
- Dropping the CLI's "-" check: TestRenameCommand red.
- Dropping `profileOpen = to`: profile-rename 22 of 22 red, both engines.

Not tried: the real app on Linux (WebKitGTK) or Windows; a rename
synced over a real WebDAV server.

Co-authored-by: erlinerd <erlinerd@outlook.com>
2026-11-02 18:37:25 +08:00
yetone ea51526b69 provider: WorkBuddy's mover min is 0.2.12, the China build's free-model window (plugins #625)
workbuddy 0.2.12 (kunghim's plugins #625, the open half of #288) shows
a WorkBuddy (China) account's free-model daily token window, about
200M tokens a day as kunghim measured on two Free-plan accounts, kept
apart from WorkBuddy AI's 100M one, and reads the China refusal's
"将在 … UTC+8 重置" as its reset. npm has 0.2.12 (npm view
--prefer-online, registry.npmjs.org). keepMovedCurrent updates every
moved user's plugin to it.

Run at origin/main 1829cd52f plus these three commits (mote, macOS):
- gofmt -l internal/gateway internal/provider internal/plugin: clean.
- GOOS=linux and GOOS=windows go vet of the three: ok.
- go test -count=1 -timeout 45m ./internal/plugin ./internal/provider
  ./internal/gateway: plugin ok, provider ok; gateway one red,
  TestCodexPoolSaysTheClientsVersion, which passes alone (-count=3)
  and is another test's Codex identity leaking into it, filed as #4807,
  untouched by this change.
- -v: TestPluginToldTheSession and TestMovedBuiltinsSayTheirPlugin pass.
- Rebased onto origin/main 52195b6b0 (it brings #3388's provider
  change): gofmt clean, linux and windows vet ok,
  internal/provider and internal/plugin ok, internal/gateway -run
  'TestPlugin|TestMoved|Devin|WorkBuddy' ok. Pushed on 9f641daea,
  whose Codex app-server change (codex_app_server.go, codex_daemon.go,
  login_usage.go) touches none of these files; not run again on it.
Not tried: a real China-build account through magpie.
2026-11-02 18:32:47 +08:00
yetone 7c2442b425 provider: Devin's mover min is 0.1.34, so pings follow their request and a grown permission check keeps one key (plugins #626, #620)
devin 0.1.34 (plugins 4c801e5, on npm) times each cache keepalive ping
from when the request before it was sent, not from when its reply ended,
so a slow reply's first ping no longer lands past the 5-minute cache
(#626), and keys a permission check by the session and subagent magpie
now tells it (#620). Both reported by zelong77. keepMovedCurrent brings
every moved user's plugin up to it.

Run at origin/main 1829cd52f plus these three commits (mote, macOS):
- gofmt -l internal/gateway internal/provider internal/plugin: clean.
- GOOS=linux and GOOS=windows go vet of the three: ok.
- go test -count=1 -timeout 45m ./internal/plugin ./internal/provider
  ./internal/gateway: plugin ok, provider ok; gateway one red,
  TestCodexPoolSaysTheClientsVersion, which passes alone (-count=3)
  and is another test's Codex identity leaking into it, filed as #4807,
  untouched by this change.
- -v: TestPluginToldTheSession and TestMovedBuiltinsSayTheirPlugin pass.
- Rebased onto origin/main 52195b6b0 (it brings #3388's provider
  change): gofmt clean, linux and windows vet ok,
  internal/provider and internal/plugin ok, internal/gateway -run
  'TestPlugin|TestMoved|Devin|WorkBuddy' ok. Pushed on 9f641daea,
  whose Codex app-server change (codex_app_server.go, codex_daemon.go,
  login_usage.go) touches none of these files; not run again on it. Not tried: a real Devin account.
2026-11-02 18:32:47 +08:00
yetone a00b53f7b1 gateway: a plugin's fetch is told the session the agent named and its Claude Code subagent (plugins#620)
magpie builds each plugin's request itself, so the agent's own headers
(x-claude-code-session-id, x-claude-code-agent-id, x-opencode-session)
never reached a plugin. Devin's cache keepalive therefore keyed Claude
Code Auto's permission check by its text alone, and on the translated
path magpie merges consecutive same-role messages, so a check whose
history grew changed its first message in the middle and got a new key:
its older pings kept running beside the new ones (zelong77, plugins#620,
still seen on devin 0.1.33).

forwardOnce now sets X-Magpie-Session (sessionOf: the caller's own
X-Magpie-Session, else the agent's session header) and
X-Magpie-Subagent (Claude Code's agent id) on a plugin's request, after
deleting any the caller sent, and host.js's MAGPIE_ONLY list strips both
from what the plugin sends on, so the vendor never gets them. A request
naming no session has neither. devin 0.1.34 keys its pings by them.
docs/subsystems/provider-plugins.md says so.

Run at origin/main 1829cd52f plus these three commits (mote, macOS):
- gofmt -l internal/gateway internal/provider internal/plugin: clean.
- GOOS=linux and GOOS=windows go vet of the three: ok.
- go test -count=1 -timeout 45m ./internal/plugin ./internal/provider
  ./internal/gateway: plugin ok, provider ok; gateway one red,
  TestCodexPoolSaysTheClientsVersion, which passes alone (-count=3)
  and is another test's Codex identity leaking into it, filed as #4807,
  untouched by this change.
- -v: TestPluginToldTheSession and TestMovedBuiltinsSayTheirPlugin pass.
- Rebased onto origin/main 52195b6b0 (it brings #3388's provider
  change): gofmt clean, linux and windows vet ok,
  internal/provider and internal/plugin ok, internal/gateway -run
  'TestPlugin|TestMoved|Devin|WorkBuddy' ok. Pushed on 9f641daea,
  whose Codex app-server change (codex_app_server.go, codex_daemon.go,
  login_usage.go) touches none of these files; not run again on it.

Broken by hand:
- without the two Set lines in forwardOnce: TestPluginToldTheSession red
  (the plugin told nothing), on relayed Anthropic and translated Chat.
- without the MAGPIE_ONLY entries in host.js: red, the vendor got
  X-Magpie-Session.

Not tried: a real Devin account and a real Claude Code Auto session.
2026-11-02 18:32:47 +08:00
yetone 9f641daeab codex: a turn stuck on a used-up account no longer holds the Codex app's Send grey after a switch by hand or magpie's takeover (xiaoq6285)
xiaoq6285 on Discord (v0.1.2700): Codex on an official ChatGPT account
ran out of quota, and after switching to another account or provider in
magpie, the Codex app's Send button stayed grey. magpie has no chat
composer of its own; the button is the Codex app's, which greys Send for
every model while the app-server it runs is on a ChatGPT account the app
holds. magpie lifts that by restarting the app's app-server
(codexAppStep), but never while a Codex turn is open in its sessions, for
up to codexTurnWindow (30m). When quota runs out mid-turn the turn is
left open, so the restart, and the grey, waited.

cc81ad4ea let a quiet stuck turn be restarted past (codexTurnStuckAfter,
2m) only after SwitchWhenSpent's own switch. Two siblings that leave the
app-server on the same used-up account still waited the 30 minutes:
- a switch by hand (Accounts, CLI) off an account last read held:
  noteCodexSwitch now marks it spent when the account's reading in hand
  says Held (codexHeldKnown: cache only, no I/O; a failed read or none
  is not held);
- magpie becoming Codex's provider for the used-up account (codex.out):
  codexAppStep marks the change into out spent. The way back at the
  reset still waits for any open turn, as a real one may run there.
A turn still writing its session or sending through magpie in the last
2 minutes holds the restart as before.

Tests, both red on the old code:
- TestCodexAppServerRestartedPastATurnStuckWhenMagpieTakesOver
- TestCodexHandSwitchOffAHeldAccountIsSpent
docs/subsystems/agent-wiring.md says so.

Run at this head on mote:
- go test -tags nogui ./internal/provider: ok (151s), at this head
  after the rebase on 52195b6b0 (it changed provider_test.go and two
  more provider files, so provider was run again).
- Before the rebase (on 07f4d46c5): provider ok, agent ok, gui ok;
  gateway red on TestCodexPoolSaysTheClientsVersion alone (#4807, red in
  a full package run, passes alone; -count=5 alone ok at this change);
  cli red on TestEveryRouteHasACommandOrIsNamed (#4826), red the same
  on origin/main 52195b6b0 just fetched.
- gofmt -l clean; GOOS=linux go vet -tags nogui, GOOS=windows go vet
  and go vet of ./internal/provider ./internal/agent ok at this head.
- Not run: the full go test ./... (agent, gateway, gui, cli and provider
  are what reach this code). No GUI change, so no GUI suite.

Broken by hand, each red, then restored:
- spent not set on the takeover (c.spent && into): the takeover test
  failed "a turn stuck on the used-up account as magpie took over:
  ended [], want [60]".
- noteCodexSwitch never marking spent: the hand-switch test failed
  "switched off out@x: switched true, spent false, want true, true".

Not tried: the real Codex app with an account actually out of quota
(no such account to hand), and Windows/Linux runs of the package (the
change is OS-independent logic; GOOS vet run). Not confirmed with the
reporter that their case is a turn left open; their screenshot wasn't
seen here.
2026-11-02 18:31:11 +08:00
yetone 52195b6b07 backup: the setup is backed up into a folder by itself, and any version put back (jwaitq)
jwaitq (Discord) nearly lost their setup on Windows and got it back only
from a Downloads\data folder they happened to have. They asked for
backups made on a schedule into a folder, with a version to go back to.

What changed

- internal/backup/auto.go: Settings › Sync › "Back up by itself". On by
  default: once every 24 hours, the last 7 kept, into
  <config dir>/auto-backups. Interval (1 hour, 6 hours, 1 day, 1 week, or Off), keep (3,
  7, 14, 30) and the folder are the user's to change. autobackup.json holds
  only what the user set; a field they never touched follows the default,
  so a later default never overrides their own value. An unreadable
  autobackup.json makes no backup and says so, never "off" or a default.
- What goes in is the export without API keys (backup.Collect(false)),
  the same bundle and the same handling of secrets as the manual no-keys
  export, with the proxy URL blanked as well (it can carry a password).
  Not sealed, so it opens without a passphrase. Files are 0600 in a 0700
  folder, written to a temp file, fsynced and renamed, and listed only
  when they parse and their sha256 matches, so a half-written file is
  never a version. A temp file over an hour old is removed.
- A backup is made only when the setup changed since the newest one, so
  a quiet week keeps a week of versions, not seven copies of one day.
  The loop runs inside the gateway (WhileServing), first 2 minutes after
  launch, then every 10 minutes it checks whether one is due by the
  newest file's time, so a restart doesn't make an extra one.
- Restore puts a version back the way Import does (additive), after
  first writing the current setup as a "-restore" backup. If that
  backup can't be written, nothing is put back. The row says when the
  undo copy was made, and restoring it undoes the restore. "-restore"
  backups are pruned past Keep like the rest.
- internal/gui/backup.go: GET /api/autobackup and POST
  /api/autobackup/{set,choose,now,reveal,restore}. internal/cli
  settings_parity_test names the two routes in notYet (S2).
- GUI: autobackup.js, imported lazily when Sync is drawn, so app.js and
  the core budget are not raised. The app's own segmented controls and
  menus (no <select>), the folder row with Change…/Show/Default, Back up
  now, and the versions list with Restore behind a confirm. Strings in
  en, zh, zh-TW, ja, de (22 keys each).
- docs/subsystems/sync-backup.md: "Backups by themselves".
- Tests touched beside it: sync-sign-in's "last row" is now the last of
  Sync's own rows (the new rows come after Import); usage-computers
  scrolls its tick to the middle, since in WebKit the sticky Settings
  tabs covered it at the page's end; agent-prefs waits for Settings'
  first draw instead of reading the static index.html's rows.

Tests

- internal/backup/auto_test.go: TestAutoBackupOnSchedule (injected
  clock, no sleeps), TestAutoBackupAfterRestartWaits,
  TestAutoBackupOffOrUnreadable, TestAutoBackupPrunes,
  TestAutoBackupHoldsNoSecrets, TestAutoRestoreRoundTripAndUndo,
  TestAutoRestoreNeedsTheBackupFirst, TestAutoHalfWrittenNeverListed.
- internal/gui/backup_test.go: TestAutoBackupRoutes.
- internal/gui/tests/auto-backup.test.cjs: chromium and webkit, 1100px
  and 420px, en/zh/zh-TW/ja/de; plus "Sync redrawn while the backups are
  being read still shows them", which found a real bug (the rows were
  dropped when Sync redrew during the first read) and is red on the old
  code.

Broken by hand, each test red, then put back: dedup off (OnSchedule),
interval check off (OnSchedule, AfterRestartWaits), keep+1
(Prunes), proxy left in (HoldsNoSecrets), no backup before a restore
(RoundTripAndUndo), restore going on after a failed backup
(NeedsTheBackupFirst), unreadable config read as default
(OffOrUnreadable), checksum not checked (HalfWrittenNeverListed),
os.Rename without the temp step (HalfWrittenNeverListed). And the
redraw fix, reverted: the redraw GUI test red in both engines.

Run on mote (macOS 27) at this change on c9af34446; rebased then onto
019b308f1 (internal/provider only) and built and vetted again, then onto
70b96126e (app.js/app.css editor sizing): TestCoreScriptBudget and
TestAutoBackupRoutes ok on mote; auto-backup, old-webkit, i18n-keys,
sync-sign-in and editor-roomy 152/152 on WSL. The earlier runs:
gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
of backup, gui, cli ok; go build ./... ok; go test -timeout 45m
./internal/backup ./internal/davsync ok, ./internal/cli and
./internal/gui red only on known reds: TestEveryRouteHasACommandOrIsNamed
for POST /api/usage/checkin-account (#4826) and
TestMainWindowCorners/macOS_26_SDK (#3949).
GUI on Linux (WSL magpie-desktop, Playwright 1.62.0, chromium and
webkit) at 0dd8901a7, whose only difference from this head is Go files
outside this change: auto-backup, gui-de, gui-ja, gui-zh-tw, i18n-keys,
old-webkit, settings-general, settings-lines-wrap, settings-search,
settings-sections, settings-tabs-stick, sync-auto-restore,
sync-not-backup, sync-note-show, sync-other-kind, sync-own-fields,
sync-sign-in, sync-spin, sync-usage-error, webdav-settings-refresh,
github-sync, s3-sync, import-row, menu-scroll, agent-prefs,
usage-computers, account-eye: green. Red the same at origin/main
1aca55909 in the same run: segs-press-redraw searchAllRow (#4566),
balance-fix Sub2API (#4683), agent-panel-name-width (#4203), click-scroll
webkit wheel (#4385), codex-auto-reset webkit de (#4790),
codex-predictions webkit (#2624), codex-credits-first webkit (#4908,
filed now).

Not tried: the whole GUI suite (on WSL at concurrency 4 it ran past 5
hours beside other sessions' runs; I stopped my own run and ran the
files a Settings/Sync change can reach, plus the ones it had shown red);
a real Windows install (jwaitq's system) or the real app with a real
HOME; a restore of a real user's backup.

Asked for by jwaitq on Discord.
2026-11-02 18:24:38 +08:00
yetone 70b96126ef gui: a provider's editor grows with a large window (5046312 on Discord)
5046312 on Discord: in a large, wide window the provider editor (Codex's,
with its accounts, meters, cap pill, switches and many option rows) stayed
a 600px box in the middle, cramped, and asked for a better layout or a
resizable sheet.

drawEditor's editor now carries `roomy`, and openModal copies it onto
#modal's dialog as it already did `wide`. `.modal .dialog.roomy` is
min(max(600px, 56vw), 880px, 100%): 600 up to a 1071px window, then 56%
of it, at most 880, as a Mac sheet takes the room its content needs. Its
height already follows the content up to the window, so no new height
rule. A question that takes the editor's place in the same dialog (Sign
out's forget-ask, Disconnect, ...) drops the class and stays 600. No
drag handle. The rows themselves are unchanged. Every provider editor
(subscriptions, keys, new providers, presets) goes through drawEditor.
The core-script budget is not raised (7 bytes under).

Sizes (chromium, en; width x height of the dialog):
  window       before        after
  2560x1440    600 x 1228    880 x 1038.5
  1440x900     600 x 810     806.4 x 810
  1100x800     600           616
  1024x768     600           600
  560x420      512           512
  390 web      374           374

Run at the pushed tree (this commit on 019b308f1; the whole-suite runs below at earlier bases, editor-roomy, i18n-keys and the budget tests again at 019b308f1):
- editor-roomy.test.cjs (new), chromium and webkit, en zh zh-TW ja de, at
  2560, 1440, 1100, 1024, 800, 560 and 390 (magpie web): the width, the
  dialog in the window, head and buttons in sight, no sideways scroll,
  nothing past its sides; and at 2560 Sign out's question is 600 and the
  editor is 880 again after Cancel. 80/80 on mote and on WSL.
- go test -tags nogui ./internal/gui on mote (TestCoreScriptBudget): ok.
- The whole GUI suite on WSL magpie-desktop (Linux, both engines) at
  ed852df10 (the same change on 838d12d6f): 18363 tests, 17874 pass, 489
  red in 100 files. The 100 files again alone at head and at origin/main
  b2f7818d2: 472 and 452 red, the same tests save flakes that change
  language between runs. editor-advanced-align, gateway-key-models,
  codex-predictions and codex-credits-first, one at a time: identical
  reds on both. Named issues: #4471 (WSL whole-suite reds, the class),
  #4203 agent-panel-name-width, #4683 balance-fix, #4908
  codex-credits-first, #2624 codex-predictions, #4616 gateway-key-models,
  #4541 page-width-steady, #3699 allow-ips.

Broken by hand: the test on origin/main's assets fails 40 of 80 (every
size from 1100 up, "dialog is 880px wide...: 600"), the narrow ones pass;
with openModal's toggle made add-only, the Sign out case fails 10/10
("the question is 600px wide").

Not tried: the real Wails app on macOS, Windows and Linux (WebKitGTK);
the whole GUI suite on mote (another session's full suite held it);
other dialogs, left at 600 on purpose.
2026-11-02 18:21:14 +08:00
yetone 019b308f1a provider: one key added again for another API of the same host is a provider of its own (#3388)
energetic_wolf_99424 (Discord #help) has one relay key that works in both
the OpenAI and the Anthropic format. They added a custom provider with it in
one format; adding a second custom provider with the same key in the other
format was refused with "<name> is already added with that key". The same
refusal blocked OpenCode Go beside OpenCode Zen with one account's key
(#3388, found by ggbdpq, verified by Edward4226).

Add's duplicate check (add in provider.go) used sameProvider, which
judges by key + host + headers only. It now also needs servesAll: the new
provider brings no API, and no address of one, that the provider already
there lacks (Chat, Responses, Anthropic and Gemini compared slot by slot
after normalize). So the same key at the same addresses is still refused
as the one already here, and another format, or another product path on
the host, is added under its own id. The GUI, the CLI (`magpie provider
add`) and the TUI all go through provider.Add, so all three are covered.
AddCopy never had the check. Two providers sharing one key already existed
(AddCopy, another host), so nothing keyed by the key (KeyID, usage by
provider id, resting) meets a new state.

Not changed: the app import still calls an entry "Already added" when the
provider there has the key at that host, even if the entry brings an API it
lacks; filed as #4904.

Run at this head (rebased on 1829cd52f), on mote:
- go test ./internal/provider -count=1: ok (191s).
- gofmt -l clean; go vet -tags nogui ./internal/provider ./internal/cli
  ./internal/tui ./internal/gui for darwin, linux and windows: ok.
- Before the rebase (base 07f4d46c5, same diff): go test ./internal/cli
  ./internal/tui ./internal/gui: tui ok; cli red only on
  TestEveryRouteHasACommandOrIsNamed (#4826, checkin-account route), gui
  red only on TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27).

Broken by hand: dropping `&& servesAll(...)` turns TestAddSameKeyOtherFormat
red with the reporter's refusal ("Relay is already added with that key
(relay); ...").

Not tried: the real GUI Add dialog, a real relay key in both formats, a
real OpenCode key.

Reported by energetic_wolf_99424; #3388 by ggbdpq.
2026-11-02 18:16:09 +08:00
yetone c9af344466 codex: the Codex app's model list follows the account Codex is signed in to
chzbz on X: a ChatGPT 20x (Pro) account added and switched to, and
GPT-6.1 Sol never showed in the Codex app's picker;
~/.codex/magpie-desktop-models.json didn't update.

The backend's list for the Codex app (CodexDesktopCatalog) was kept for
an hour whatever account Codex was signed in to, and a Pro account lists
models a Plus one doesn't. After a switch the sync wrote the other
account's list again, for up to an hour. The kept list now names its
sign-in (provider.CodexSignInWho: the account and its plan); on another
one it isn't handed out, the backend is asked at once, and the file is
written again once it answers. A switch made while an ask is under way
is told as a change, so the next look asks about the new account.

Run (mote): go test -run 'TestCodexDesktop|Revoked' ./internal/gateway
ok. Broken by hand: with the sign-in check off (mine := true),
TestCodexDesktopCatalogFollowsTheSignIn is red (the Plus list handed out
as the Pro account's). go vet of ./internal/gateway ./internal/provider
on darwin, GOOS=linux and GOOS=windows: clean. go test -count=1
./internal/provider ./internal/gateway (mote): provider ok; gateway red
only on TestCodexPoolSaysTheClientsVersion, #4807 (a newer Codex
version known on mote, 0.165.0 over the test's 0.161.0), code this
change doesn't touch.
Not tried: a real Plus to Pro switch with the Codex app open.
2026-11-02 18:11:41 +08:00
yetone 1829cd52ff sessions: a poll while a session grows makes only the rows it shows
VeryBTC on X (tweet 2117104179454091396) reported RSS that rises and
stays up while the window is open and a long-context session is active.
In that case every Sessions poll sees a changed file and rebuilds the
list. That rebuild copied every gateway-only session three times
(GatewaySessions, listedGateway, gatewayListed) and made each one a
Session row before EachMerged stopped at its 5000-row limit. It also
made every Claude Code file's path and key again.

- usage.EachGatewaySession walks the projection without copying it.
  gui's listedExternal stops at the list's limit and skips hidden
  sessions and sessions without an agent or id, as listedGateway did.
- sessions.EachMerged sorts indexes and makes a row only when the merge
  reaches it. The order is unchanged: newest first, stable on ties.
- listCCFiles reuses the last listing's path and key strings while a
  folder lists the same names. One file new or gone is stepped over.
  This holds ~32 B per file (~480 KB at 15k files), and the strings are
  shared with the listing it already held.
- page_memory.go's ~330 MB comment now has current numbers.
  gateway-sessions.md describes the lazy rows.

Per poll, on mote (go test probe through the real /api/sessions
handler, TotalAlloc):
  15k sessions x 10 turns, 400k ledger rows
    after a session file grows  150.6 MB, 201 ms -> 109.9 MB, 170 ms
    unchanged (warm)             17.2 MB         ->  12.0 MB
  3k sessions x 40 turns, 150k rows (no gateway-only rows past the cap)
    after a session file grows   31.3 MB         ->  29.6 MB
    unchanged (warm)              4.5 MB         ->   3.4 MB
  /api/usage is unchanged at 0.4 MB.

Tests:
- TestSessionsListMakesOnlyTheGatewayRowsItShows (gui) uses 3 natives,
  6000 gateway sessions in tied pairs, one hidden and one carrying a
  native's id. At limits 5, 40 and 6010, and with no limit, the rows
  equal the old pipeline's (listedGateway + gatewayListed +
  MergeExternal) after the JSON round trip. A grown native comes first
  with its new Last. The poll's allocation stays under 6000 rows' size.
- TestEachMergedMakesOnlyTheRowsItReaches (sessions): 15000 externals
  and 20 rows give MergeExternal's first 20, with allocation under a
  tenth of the rows.
- TestCCListingKeepsItsNames (sessions): a second listing of 3000 files
  is equal to the first, in at most 3n mallocs. A file added, files
  removed, and a folder gone with another new each list as a fresh
  listing does. Another agent's keys keep their own prefix.

Broken by hand, each red:
- EachMerged building every row first: 8.8 MB, the sessions test fails.
- The GUI handler back on the listedGateway(GatewaySessions) loop, with
  the lazy merge kept: 13.7 MB, the gui test fails.
- The gui test on origin/main's code: 23 MB, fails.
- The ccNames reuse turned off: 12197 mallocs, the listing test fails.

Run on mote (mote-run) at 73a1b8769, rebased on origin/main 07f4d46c5:
gofmt -l internal (empty), go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... all clean. go test -count=1 -timeout
45m ./internal/sessions ./internal/usage ./internal/gui: sessions ok,
usage ok. gui is ok except TestMainWindowCorners/macOS_26_SDK, which is
#3949 (red on mote's macOS 27, an AppKit title bar test this change
doesn't reach). It was red the same way in the run before the rebase.

Not tried:
- A real app window with RSS measured over time. The numbers are
  allocation per poll from a probe.
- The rest of a changed poll: statsKept re-sums every session (~26 MB at
  15k), listing (~24 MB) and byKey (~9 MB). None was a cheap, safe
  change.
- Windows and Linux test runs (vet only).
- A gateway title store in the fixture. GatewayTitler's ReadDirs now run
  only for the rows shown.
2026-11-02 17:19:23 +08:00
yetone 07f4d46c52 gateway: a Codex reply that ends early, and any failed call, is written to app.log
wjh66 (Discord, Windows, v0.1.2696) saw Codex on a ChatGPT sign-in with
gpt-6.1-sol show "reconnecting 5/5" and then `error decoding response
body`, and app.log around 15:27 held nothing about it. That text is
reqwest's for any read error in a body (a reset, a chunk cut short, a
timeout), so it says the connection broke mid-reply, not which side broke
it. The cause is not found; this change only makes the next report carry
evidence.

- record logs a failed call (status >= 400 or an error) when debug is off,
  once a minute per agent/provider/model/status/error, counting repeats.
- codexUpstream logs a reply that ended before its last event (or a
  non-SSE body cut by a read or write error): bytes passed on, whether
  OpenAI's stream failed or ended, and whether Codex went away, a write
  to it failed, or it was told response.failed.
- Shutdown with requests in flight says they are cut (Windows has no
  handover, so a quit or update cuts streams after shortDrain).

Run at this head (rebased on 4bd0d6f38; the new and stream-cut tests and vet run again after the rebase on mote and Windows, the full gateway run on Linux was at 4e764fc39):
- win-run: TestCodexReplyBrokenOffLogged, TestCodexClientGoneLogged,
  TestFailedCallLineOncePerMinute, TestCodexStreamCut* - ok.
- wsl-run: go test -tags nogui ./internal/gateway -timeout 45m - one red,
  TestCodexPoolSaysTheClientsVersion, which is #4807 (red on main too; the
  identity it sees is the machine's own Codex 0.165.0).
- mote-run: gofmt -l clean; go vet -tags nogui ./internal/gateway for
  darwin, GOOS=linux and GOOS=windows - ok.

Broken by hand: both new log.Print calls replaced with `_ = line`; the
two Codex tests went red ("no log line holds ...").

Not tried: a real Codex on Windows, a real cut from chatgpt.com, the
serveAgent (magpie's Codex accounts) path specifically, the full suite
on macOS or Windows.

Reported by wjh66.
2026-11-02 17:10:02 +08:00
yetone 881c9f28a4 gui: an open picker follows a resize by its button, and closes once the button is out of sight (#1134, emo172)
emo172 opened the Agents page's model picker in a full-screen window and
left full screen: the picker stayed at the coordinates it was opened at,
half of it past the window's right edge. #pop is position: fixed and
openPicker placed it once (placePop), with nothing on resize, where every
other menu either closes (closeAgentModels, closeAgentMenu, closeProtoMenu)
or is placed again (placeProfiles).

As planned on the issue: a resize places the open picker again by its
button, at the sizes it was opened with (pickSize, now shared by
openPicker), and closes it when the button is gone or out of sight. The
Agents row moves for a few frames after a resize (its wrap animates), so
placing it only at the resize event left it ~17px off the button's final
place; followPick places it again each frame the button moves, and stops
nine frames after it stays put. On a touch screen it only moves, so a
keyboard opening over the button never closes the list being typed in.
placePop has one caller, openPicker, so every picker that uses it (model,
effort, menus of a field) gets this. Four long comments in openPicker and
holdPop were cut to pay for it: app.js is 91 bytes smaller.

Test: picker-follows-resize (chromium + webkit, en + zh) opens the model
picker at 1440x800, narrows to 840 (the issue's numbers), waits for the
pop to rest by its button inside the window and to stay there after the
row's animations end, then makes the window too short for the button
and sees it close.

Run on mote at this head: picker-follows-resize 6/6; every GUI file that
opens #pop (60 files, chromium + webkit) 760 pass, 10 fail, all
mobile-web's "desktop matches origin/main", which reads its baseline
through git and mote-run's copy has no .git (page.goto fails before any
check); TestCoreScriptBudget ok.
Broken by hand: without the resize listener, red (pop left 942 in an 840
window, the issue's case); placing once at the resize without following
frames, red in zh (top 141.5 under a button whose bottom settled at 119).
Not tried: a real full-screen exit in the app's window on Windows (the
reporter's) or macOS; a phone keyboard.
2026-11-02 17:09:47 +08:00
yetone 02727188a4 gateway: a Zen free model asked on OpenCode Go is asked at Zen's free tier, else the refusal says where it is served (51bit.eth)
51bit.eth (Discord #general) ran Claude Code through magpie with
OpenCode's free models on a provider named OpenCode Go
(opencode.ai/zen/go). Every request failed "400 OpenCode Go: Upstream
request failed: Model is unavailable.", and a header of their own
(x-opencode-session) didn't help. The same models worked in OpenCode.

Cause: OpenCode's two gateways serve different free models. Zen's free
tier (/zen, the public key) serves the -free models and big-pickle; Go
(/zen/go, a Go key) serves only beam-free and iceman-contributor-free
(its /models on 2026-11-02). Go answers any model it doesn't serve 400
"Model is unavailable." before it reads the key. A user ends up with a
Zen free model under Go by typing it, or because a Go key /models
refuses makes the provider list models.dev's opencode-go catalog,
which names free models Go doesn't serve (#4900, not changed here).

What changed:
- provider.RetryOpenCodeFreeOnZen, called in forwardOnce for OpenCode
  URLs beside RetryZhipuCoding: a 400 "Model is unavailable" from Go
  for a model OpenCodeFree calls free is asked once more at Zen's free
  tier on the same API (openCodeGoToZenFree: /zen/go/v1/... and
  /inference/go/... to OpenCodeFreeURL's /inference/openai|anthropic),
  with the public key in Authorization (and x-api-key on Anthropic),
  never the user's Go key. Zen's 2xx is returned as is.
- Refused at Zen too, Go's 400 keeps its words and adds what Zen said
  and where the model is served: under the OpenCode Zen provider,
  which needs no key. A model that isn't free isn't asked at Zen; its
  400 says to pick one the OpenCode Go provider lists.
- docs/subsystems/providers-accounts.md: a row beside the GLM Coding
  Plan one.

Run (mote, through mote-run):
- go test ./internal/provider -run 'OpenCode|Zen' and
  ./internal/gateway -run 'OpenCodeGo|ZenFree': ok, at the pushed head
  after the rebase too.
- gofmt -l: clean. GOOS=linux and GOOS=windows go vet ./internal/provider
  ./internal/gateway: ok.
- go test ./internal/provider -count=1 -timeout 45m: ok (113.9s).
  go test ./internal/gateway -count=1 -timeout 45m: one red,
  TestCodexPoolSaysTheClientsVersion, which is #4807 (open, red in full
  runs on mote; this change touches no Codex path). Output added there.
- Real: a built magpie serve on mote, sandbox HOME, port 3591, an
  opencode-go provider with a made-up key, Claude Code-shaped
  /v1/messages:
  - deepseek-v4.1-flash-free (Zen's): Go 400, then asked at
    /inference/openai/v1/chat/completions with the public key; Zen
    answered 429 FreeUsageLimitError (#3491), and the message names
    both and the OpenCode Zen provider.
  - cat-jam-free (in the catalog, served by neither): Go 400, Zen 400,
    message says where.
  - glm-5.3 (Go's, paid): "Invalid credential" as before, Zen not asked.

Broken by hand:
- Retry call removed from forwardOnce: TestOpenCodeGoFreeModelAskedAtZen
  and TestOpenCodeGoUnavailableSaysWhere red (old message, one request).
- Key swap removed: TestOpenCodeGoFreeModelAskedAtZen red, Zen asked
  with "Bearer sk-go-users-own".

Not tried:
- A working Go key (the owner's is expired), so beam-free on Go
  end to end is only the fake.
- A Zen free reply end to end: from mote Zen's free tier answers 429
  FreeUsageLimitError to magpie with the built-in OpenCode Zen
  provider too (#3491).
- Gemini protocol: not asked at Zen (OpenCode has no Gemini free URL).
2026-11-02 17:08:45 +08:00
yetone 4bd0d6f389 gateway: a provider whose model asks for a tool turn's thinking back, under a name that doesn't say DeepSeek, is asked again with it and sent it from then on (qisishiqi)
qisishiqi (Discord #help): a routing group fell from a rate-limited Codex
subscription to "My Claude", an Anthropic-format endpoint, and the request
failed 400 "My Claude: The `content[].thinking` in the thinking mode must
be passed back to the API."

That is DeepSeek's model refusing a tool loop continued without the
thinking of its tool turn. magpie fills those turns (a space, or the
turn's readable reasoning) only when the host or the model names
DeepSeek (anthropicReplaysThinking, chatReplaysReasoning, #1462/#1611).
A relay serving DeepSeek under another name, or a model the user named
otherwise, got nothing, and Codex's sealed reasoning has no text to give.

Now forward reads a 400 on Messages or Chat whose words are DeepSeek's
(thinkingBackRefusal: `content[].thinking` / `reasoning_content` ... in
the thinking mode must be passed back), and when filling the tool turns
(withThinkingOnToolTurns / withReasoningOnToolTurns) changes the body,
remembers the provider's model (unfit, thinkingBackNeeded) and asks once
more; forwardOnce fills them for it from then on, every route alike. A
provider that never asked is sent the conversation as before. Scoped to
the vendor's refusal, not to every Anthropic endpoint.

Checked against api.deepseek.com with the owner's key, 2026-11-02
(deepseek-flash, Messages and Chat): a tool turn of the loop being
continued with no thinking is refused with exactly these words (the
test fixtures are those bytes); a space thinking block or
reasoning_content " " is taken; readable unsigned thinking is taken;
finished tool turns and plain replies without thinking are taken, with
or without tools; thinking disabled takes it all. So DeepSeek's docs'
"even for turns without a tool call" is not enforced today, and the
existing tool-turn rule stands.

Sibling: the Chat side had the same name-only gate, and gets the same
learned fill (TestReasoningBackLearnedBehindAnotherName). Responses
(reasoning_text) is filled by model name on any host already.

Run at this head on mote:
- go test ./internal/gateway -count=1 -timeout 45m: every test ok but
  TestCodexPoolSaysTheClientsVersion, #4807 (red in a full run, passes
  alone; passed 5 of 5 alone here). Not touched by this change.
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok. gofmt -l: clean.
- New: TestThinkingBackRefusalRead (the live bytes and qisishiqi's
  literal error read; Responses' reasoning_text and a bound-signature
  refusal not), TestThinkingBackLearnedBehindAnotherName (Codex request
  mid loop, group: 429 on the Responses member, then "My Claude" with
  claude-sonnet-4-6 and relay-model: 200 on the second ask with a space
  thinking block first, next turn 200 on the first ask, another provider
  sent no thinking), TestReasoningBackLearnedBehindAnotherName.

Broken by hand: with the retry in forward off, all three cases go red
with qisishiqi's error ("400 after 1 calls ... My Claude: The
`content[].thinking` ..."); with the learned fill in forwardOnce off,
the second turn is refused again ("400 after 2 calls").

Not tried: qisishiqi's own provider (its host and model are unknown); a
real relay in front of DeepSeek; a plugin provider's fetch path.
2026-11-02 17:03:34 +08:00
yetone 987e019d44 library: a skill off on this computer has room for its description and path (Tao)
Tao (tao0194, Discord #feedback, with a screenshot): in Library -> Skills,
handoff from mattpocock/skills showed "Off on this computer" (本机已关闭)
on a line under its name, and its description and the
mattpocock/skills/tree/HEAD... path line were cut off. grill-me beside it,
on, showed all three lines.

Cause: the windowed skill list holds each row to a fixed height (51px, or
67px with a source) and counts its room from that. fe05f0a72 put the tag
on a line of its own (a narrow row's name has no room for it beside the
name), but the row kept the old height, so the centred content spilled
~11px over the top and the bottom.

Fix: the list counts that line too. A skill off here is HERE_H (23px: the
tag's 20px and its 3px margin) taller in the list's sums (client.js,
skillH), and library.css holds such a row to 74px / 90px. The tag stays
where it was; nothing else moves.

Test: internal/gui/tests/skill-off-here-fits.test.cjs. Tao's case
(github skills from mattpocock/skills, handoff off, grill-me on; the
descriptions are stand-ins), plus an off and an on skill without a
source: every line of each row lies inside its padding, and the path
reads mattpocock/skills/tree/HEAD/skills/handoff. en, zh, zh-TW, ja, de
(every language the tag is in), 860px and 400px, Chromium and WebKit.

Run at this head (31deaac00 rebased on b2f7818d2, then the #4901 comment):
- mote (macOS): skill-off-here-fits + skill-off-here, both engines: 44
  pass, 0 fail.
- Broken by hand: the same file at origin/main b2f7818d2 on mote: 22
  fail ("handoff's name starts above the row's padding (-10.64px)"), and
  on WSL both engines red.
- WSL magpie-desktop (Linux): every GUI file that opens the Library (107
  files, both engines): 1997 pass, 35 fail. Of the reds,
  library-chip-fan (webkit), library-mcp-tools (chromium ja 420),
  mobile-web (both, page.goto ERR_HTTP_RESPONSE_CODE_FAILURE) and
  title-bar-tools (webkit) are red the same at origin/main b2f7818d2 run
  alone on WSL; list-sort, market-more and mcp-editor-cancel passed alone
  at this head (5 files, 92 pass, 0 fail), so they were the run's load.
  The new test was red in Linux ja by 0.64-1.34px on a row *without* the
  tag (a taller CJK font); filed as #4901, and the test allows 2px.
- go test ./internal/gui on mote: ok except TestMainWindowCorners/
  macOS_26_SDK, red on macOS 27 already (#3949).

Not tried: the full GUI suite (mote was running other sessions' full
suites, and mote rebooted mid-run once); the real desktop app with a
real skill turned off here; the library subset on macOS (only the two
files above); Windows.
2026-11-02 16:58:41 +08:00
yetone 4e764fc39f i18n: "Endpoint" reads 接口地址 in Chinese, not the machine-translated 终结点 (Pluviophile)
Pluviophile (Discord) said the 终结点 beside /v1/responses in a request's
details reads like machine translation. 终结点 was the zh word for the
"Endpoint" key, used by the Requests tab's details, the Azure OpenAI and
Remote magpie editors' field and the S3 sync form, and by four Azure
strings. All of them now say 接口地址 (the address a request goes to).

Not 端点, which the rest of zh uses for "Endpoints": the Azure editor
shows both labels at once, and with 端点 for both the zh editor had two
labels named the same (the Azure test counted 2). zh-TW had that clash
already ("Endpoint" and "Endpoints" both 端點), so its field is now
端點位址; zh-TW's other wording is unchanged. Azure portal's own blade name,
「密钥和终结点」, stays as Azure writes it.

Tests: azure-endpoint now runs zh-TW too, and its one-label count is what
caught the 端点 clash.

Run on mote at this head, chromium + webkit: i18n-keys, azure-endpoint
(en, zh, zh-TW), usage-ledger-detail, s3-sync, remote-magpie. 44 pass,
8 fail; the same 8 fail at origin/main b2f7818d2 run beside it:
remote-magpie (#4398, red on macOS too, en and zh) and s3-sync in WebKit
(#2448).
Broken by hand: with 端点 for "Endpoint", azure-endpoint zh was red
(label count 2 != 1).
Not tried: the real app's windows; ja and de untouched.
2026-11-02 16:52:37 +08:00
yetone b2f7818d2e proc: a probe never runs a Windows GUI program, so asking opencode's version doesn't open OpenCode there either (saint carol)
saint carol, on Windows with OpenCode's desktop app: opening magpie,
often right after an update, brings up OpenCode. af0cd09c9 covered only a
Mac's app bundles.

OpenCode's desktop app installs per user, to
%LOCALAPPDATA%\Programs\ai.opencode.desktop\OpenCode.exe (electron-builder
NSIS; @opencodedesktop before), with its CLI at
resources\opencode-cli.exe. The installer puts nothing on PATH, and
"Install CLI" is Mac-only. With that folder on PATH, `opencode` finds
OpenCode.exe, since Windows looks names up without case and PATHEXT adds
.exe. magpie's `opencode --version` at each start and after a CLI update
(proc.Version, library openCodeVersion, cliupdate runCheck) then started
the Electron app. Nothing else in magpie starts OpenCode on Windows: no
App Paths lookup, no opencode:// link, and scoop's opencode-desktop gives
a shortcut, not a shim.

ProbeContext now also refuses (cmd.Err, nothing started) a program whose
PE header names the GUI subsystem (guiExe: e_lfanew, PE signature,
optional header Subsystem == 2). Console programs run as before: CLIs,
bun's, npm's and WinGet's shims, opencode-cli.exe. Anything that isn't a
PE, or whose header can't be read, also runs as before. On the Windows
box, every program magpie probes that is installed there is console
(claude.exe, codex.exe, git.exe). The GUI ones on PATH are system32
tools, git-gui, gitk and Codex's codex-command-runner, which no probe
asks.

Tests:
- TestGuiPE: GUI PE32 and PE32+ headers are a window's program; console,
  a bad magic, a cut-short header, a script and empty bytes are not.
- TestProbeNeverOpensAWindowsApp (Windows): the install's layout is made
  from copies of the test binary, which notes that it ran (TestMain's
  MAGPIE_PROC_RAN). OpenCode.exe is patched to the GUI subsystem as
  Electron's is. With the folder on PATH, `opencode` resolves to
  OpenCode.exe and isn't run, and Version is "". opencode-cli.exe still
  answers 2.2.5.

Broken by hand on xiaomi-gpu: with guiExe out of ProbeContext,
TestProbeNeverOpensAWindowsApp goes red ("OpenCode.exe was run and said
2.2.5").

Run at 4b407bb79 plus this change (go test -count=1 -timeout 45m):
- mote (macOS): internal/proc, library, agent, provider, wslrun ok;
  GOOS=windows go vet ./... ok, GOOS=linux go vet -tags nogui ./... ok;
  gofmt -l empty.
- xiaomi-gpu (Windows, win-run): internal/proc ok. internal/library red
  on TestGoneAgentListedToTakeOut and TestCheckMixedServerEachSide, the
  same at 4b407bb79 without this change, both listed in #4115.
- magpie-desktop (Linux, wsl-run): internal/proc ok.

Not tried: the real OpenCode desktop app on Windows (not installed on the
test box; the layout is from OpenCode's electron-builder config and NSIS
include), the reporter's PATH, and a .cmd or .ps1 the user wrote that
starts OpenCode.exe (still run).
2026-11-02 16:24:51 +08:00
yetone f9595e7684 gateway: System One requests are kept in the request archive, and Routing says when the archive is on (wangb on Discord)
wangb on Discord: 「请求存档开启, 但是 systemone 的请求没有记录下来」. The
Routing page then said "magpie 只保留最近 40 个请求的请求体和响应体… 要保留
每个请求的,请在「用量 › 请求」顶部打开「请求存档」", as if the archive
were off.

Why: only serve() made an archive wire (archiving). The two System One
paths never reached it:
- /v1/systemone, which an app sends (serveDecideTries, also used for a
  decision group), opened a Route but recorded no Call. It was in
  neither Recent calls nor the archive, so the Routing page could never
  open its bodies.
- the question a routing group's Jev classifier asks for a turn
  (askJev / jevLevelled -> systemOne -> postDecide) only appended a
  usage row.

What changed:
- serveDecideTries captures its reply, makes the wire as serve does,
  names it on the Route from the start (Route.Archive), and records a
  Call (Route, status, error, fallbacks, usage, bodies) when it ends.
  So the call is in Recent calls and, with the archive on, in the
  archive. Its usage row carries Archive.
- systemOne keeps the call magpie made itself through a new
  archiveOwn. It keeps the request as it went (method, path, the headers
  magpie signed it with, the body in the provider's shape) and the
  answer, with secrets scrubbed as for any call. Its "routing" usage
  row names the archive entry. postDecide became postDecideSent, which
  also returns the request it sent. archive's queueing moved into
  queueArchive, which both share. archiveID makes the name.
- Routing's "Request and response" for a request in neither the ring
  nor the archive: with the archive on (gateway.archive.on in
  /api/providers) it says the archive is on and this request isn't in
  it (made while it was off, or not saved). It no longer says to turn
  the archive on. New string in zh, zh-TW, ja and de.
- docs/subsystems/gui-shell.md says which calls are archived and which
  still aren't.

Still not archived (unchanged): Codex's own backend (codexUpstreamOn),
draw, embeddings and video side routes, and replies magpie writes
itself (answeredHere). Masking makes no outgoing call. Chat classifiers
and Codex titles to a model already go through serve and are archived.

Run on mote at base 4b407bb79, then rebased onto 0285f572f, whose one
commit changes only internal/gui/whatsnew*.go (nothing here reads it):
- TestArchiveKeepsSystemOne and TestArchiveKeepsJevClassifier (new)
  pass. Broken by hand: with archiving(...) taken out of
  serveDecideTries, the first is red ("uploaded []"). With archiveOwn
  returning at once, the second is red (only the chat turn uploaded).
- routing-bodies.test.cjs, chromium and webkit, every language, 440px:
  the new "archive on" case passes, and the archive-off case asserts
  the old text. Against the old client.js the new case is red in all 5
  languages (chromium). i18n-keys passes.
- gofmt -l clean. go vet ./... (darwin) and GOOS=windows go vet
  ./internal/gateway ./internal/gui are clean. GOOS=linux go vet
  -tags nogui is also clean for both (without nogui, wails' linux cgo
  doesn't build in a cross vet).
- go test ./internal/gateway: ok except TestCodexPoolSaysTheClientsVersion
  (#4807: red in a whole package run on mote, passes alone).
- go test ./internal/gui (an earlier base, 834c6c7df): ok except
  TestMainWindowCorners (#3949, macOS 27).
- The other routing-* GUI files (an earlier base, 834c6c7df): the whole
  set was cut short when mote rebooted. Six files went red:
  routing-many-keys, order-unknown, row-swap, rule-drag, rule-remove
  and rules-line. Run alone they are red the same way at base
  834c6c7df without this change (filed: #4082, #4627, #3799, #3789,
  #3096, #4585).

Not tried: a real Jev or System One account. The tests use fake
System One servers. Not tried either: an S3 bucket (memBucket), the
local disk archive, or the GUI's whole suite.
2026-11-02 16:21:58 +08:00
yetone 0285f572fd gui: What's new asks again for notes that came in English while Chinese is asked for (yuu003348)
yuu003348 on Discord: every release's update notes are in English now.
The cause is upstream: magpie-releases' DeepSeek call has answered
insufficient_balance_error since v0.1.2650 (2026-11-01 22:28 UTC), so
v0.1.2650 to v0.1.2700 went out without a <!-- lang:zh --> section;
v0.1.2649 is the last with Chinese notes (#2260). The DEEPSEEK_API_KEY
account needs a top-up; notes.yml then writes the Chinese each hour.

The app's part: What's new kept the notes it got for the whole run
("they don't change while magpie runs"), so a release whose Chinese
notes.yml wrote later stayed English until a restart, in the dialog and
in Settings' "this version and n before it". Now notes asked in Chinese
of which some came without Han (untranslated) are asked of the site
again after 10 minutes (the site keeps an answer 5); a failed ask again
keeps what was had, without an error. Notes all in Chinese, or asked in
English, are kept for the run as before. Chinese is the only language
the pipeline translates into; de/ja/etc. get English, zh-TW the Chinese,
as notesLang already said.

Run at this head (mote, macOS 27):
- go test ./internal/gui/ ./internal/update/: update ok; gui ok but
  TestMainWindowCorners/macOS_26_SDK, red on macOS 27 already (#3949).
- go vet darwin, GOOS=windows; GOOS=linux -tags nogui; gofmt -l empty.
- WSL magpie-desktop: go vet -tags gtk3 ./internal/gui ./internal/update,
  and the What's new tests, ok.
Broken by hand: due() always false (the old keep-for-the-run) makes
TestWhatsNewAsksAgainForTranslation red ("zh once translated" shows the
English).
Not tried: a real app across a DeepSeek top-up; the GUI Playwright suite
(no page code changed). Releases that never get a translation are asked
again every 10 minutes while What's new is opened.
2026-11-02 16:14:22 +08:00
yetone 4b407bb79f gateway: an image Claude Code is handed in a block is fitted to 2000 px, as it fits its own (sean_80289)
sean_80289 on Discord, through DeepSeek Harness (dsh) to a Claude
subscription: "API Error: an image in the conversation could not be
processed and was removed. Double press esc to edit your message, or
re-read the file if you still need it."

Cause: magpie gives Claude Code the earlier turns' images as image blocks
in the transcript a run resumes (replaySession), and a -p run's
stream-json message carries them the same way. Claude Code sends those as
they are; it fits only an image it reads from a file (2.1.316: 2000 px a
side, 5 MiB of base64), as with the files magpie pastes for the last
turn. dsh passes an image with a long edge up to 8192 px byte for byte
(its 2048x2048 pixel budget and 8192 px edge), and the API refuses one
over 8000 px a side, which Claude Code reports with that message.

Reproduced with a real Claude Code 2.1.316 (claude-tui-helper, sandbox
HOME, a real subscription token), a 400x8192 JPEG:
- in a resumed transcript: sean's exact error, error_during_execution;
- 400x8000 and 2590x1619 in a transcript, and 400x8192 pasted: answered.

Fix: claudeImage (claude_images.go) fits each base64 image in
imageBlocks (replay, -p prompts, typed turns) and in mcpResult (a tool's
images): scaled to 2000 px a side with its shape kept, JPEG again as
JPEG at 85 and anything else as PNG, then JPEG at a lower quality if it
is still over 5 MiB of base64. An image that fits, or can't be read,
goes byte for byte as before. Decoding is bounded by codexImageMaxBytes
and imageHolds, and results are kept in the fitted cache under their own
limits key.

Run on mote at a8d6a861a, one commit (internal/proc only) before the
pushed head: go test ./internal/gateway ./internal/tui
./internal/cli: tui ok; the new tests and the existing replay and Codex
image tests pass. Two reds, both filed and red apart from this change:
gateway TestCodexPoolSaysTheClientsVersion (#4807, another test's Codex
identity in a full package run) and cli TestEveryRouteHasACommandOrIsNamed
(#4826). go vet for darwin, linux (-tags nogui) and windows; gofmt -l
clean; go build -tags nogui ok. Then a real Claude Code 2.1.316 with the
image claudeImage made of the 400x8192 JPEG (98x2000 JPEG) in a resumed
transcript answered ("Blue and red."); the raw image beside it gave the
error again.

At the pushed head after the rebase: go build ./... ok, go test
./internal/tui ./internal/proc ok, and the new and replay tests in
internal/gateway ok.

Broken by hand: with claudeImage returning its input,
TestClaudeReplayFitsATallImage (the transcript's image 400x8192) and
TestClaudeImagePNGAndToolResults (3000x1000) went red.

Not tried: dsh itself; a WebP over the side (Go can't write WebP, so no
fixture; decoding goes through x/image/webp); more than 20 images over
2000 px in one request, which the API refuses with another message and
this fit covers too.
2026-11-02 16:01:44 +08:00
yetone 5ef19d0073 tui: the Usage page reads again while a read is under way, and on each opening (sean_80289)
sean_80289 on Discord: in the TUI the remaining-usage panel didn't show
new numbers; only refreshing each account on its own page did. The page
read the quotas once per TUI start, unasked, so it showed what was kept
and never what a read under way brought.

It now does what the GUI's Usage page does (#959):
- Opening the page more than 30s after the last ask (quotasOpenGap, the
  GUI's QUOTAS_OPEN_GAP) is an asked read (provider.Asked,
  AskClaudeUsage); within 30s it reads what is kept.
- While provider.SubscriptionUsageReading() says a read is under way, it
  reads again every 1.5s, at most 20 times, as the GUI does on
  X-Magpie-Reading; it stops when the page is left.
- "r" asks again. An answer to an earlier load is dropped (qgen).

Run on mote at a8d6a861a, one commit (internal/proc only) before the
pushed head: go test ./internal/tui ok; go vet
internal/tui internal/cli for darwin, linux (-tags nogui) and windows;
gofmt -l clean. go test ./internal/cli: TestEveryRouteHasACommandOrIsNamed
is red on origin/main too (POST /api/usage/checkin-account, #4826), not
this change.

At the pushed head after the rebase: go build ./... ok, go test
./internal/tui ./internal/proc ok.

Broken by hand: with the re-read in gotQuotas taken out and goTo back
to reading only once, TestUsagePageAsksAgainWhileReading,
TestUsagePageReadsAgainOnReturn and TestUsagePageAsksAgainAtMostTries
went red.

Not tried: a real TUI session against signed-in accounts; the tests
drive the model with a fake read.
2026-11-02 16:01:44 +08:00
yetone af0cd09c9d proc: a probe never runs a macOS app's own program, so asking opencode's version doesn't open OpenCode (saint carol)
saint carol on Discord: opening magpie, often right after an update,
brings up OpenCode, which they never asked for.

magpie asks `opencode --version` at every start and after a CLI update
(proc.Version for the agents' CLI info, library/rtk.go openCodeVersion,
agent/cliupdate.go runCheck), all through proc.ProbeContext. When the
`opencode` on PATH is OpenCode.app's own program (a link to
OpenCode.app/Contents/MacOS/OpenCode, or the bundle's MacOS folder on
PATH, where a case-insensitive disk finds OpenCode as opencode), running
it with any arguments opens the app's window. A GUI app never answers
--version, and a timeout isn't cached, so it happened again at each
start. Nothing else in magpie opens OpenCode: no `open -a`, no
opencode:// URL, and the Sessions menu's Open/Terminal actions are a
user's click.

ProbeContext now refuses (cmd.Err, nothing started) a program that is
the main executable of an outermost .app bundle, after links: the
CFBundleExecutable of an XML Info.plist, or the program named as the
bundle when the plist can't be read (binary, as Kiro CLI.app's is). Every
probe goes through it: version, auth status, Grok's agentProbe. A
bundle's other programs still run (OpenCode's opencode-cli, Kiro CLI's
kiro-cli beside kiro_cli_desktop), and so does a bundle inside another
app's: ChatGPT.app's codex is CodexCLI.app's main executable (plist
checked on this Mac, ChatGPT 26.1027).

Tests (internal/proc/appmain_test.go, not on Windows): a fake
OpenCode.app whose programs record that they ran.
- TestProbeNeverOpensAnApp: a link to OpenCode is not run, Version is "",
  `opencode` found in the bundle's folder by PATH is refused, the
  bundled opencode-cli still answers.
- TestProbeUnreadPlistByName: no plist / a binary one: OpenCode is not
  run, opencode-cli is.
- TestProbeRunsANestedAppsCLI: CodexCLI.app's codex inside ChatGPT.app,
  with that app's plist keys, answers.
- TestAppMainOnlyBundles: paths that only look like a bundle.

Broken by hand: with the guard off, TestProbeNeverOpensAnApp and
TestProbeUnreadPlistByName go red (OpenCode ran); with the nested check
off, TestProbeRunsANestedAppsCLI and TestAppMainOnlyBundles go red.

Run on mote at a8d6a861a plus this change (go test -count=1 -timeout 45m):
internal/proc, library, wslrun, agent, provider ok. internal/cli red on
TestEveryRouteHasACommandOrIsNamed (POST /api/usage/checkin-account has
no command), which is #4826 from e87140242 and not touched here.
GOOS=windows go vet ./... ok; GOOS=linux go vet -tags nogui ./... ok
(wails' Linux GUI doesn't cross-vet from a Mac); gofmt -l empty.

Not tried: the real OpenCode desktop app (the cause is read from its
bundle layout and magpie's code, not reproduced), the reporter's PATH or
link, and a shell wrapper that execs the GUI program (still run).
2026-11-02 15:53:25 +08:00
yetone a8d6a861a4 agent: Pi's codemode gets magpie's decision and image models (extensions/magpie.ts)
wangbinyq on Discord (#feedback) asked for magpie's System One and image
models in Pi's config, since Pi's codemode can call classifier and image
models (models.classify, models.generateImages; Pi docs/models.md "Use
classifier models").

Pi's models.json can't hold them: its model entries have no type, so
every one is a chat model (ModelDefinitionSchema, modelFromJson in
provider-composer.ts, Pi 1.4.0 / c9f4c7b9f). A custom provider's
classifier and image models come from an extension alone
(docs/custom-provider.md, "Register mixed-operation models"). So while
models.json has providers.magpie, magpie now writes
extensions/magpie.ts in Pi's agent folder, which Pi loads by itself:

- provider magpie-systemone: provider.OfferedDeciders, labelled as
  /v1/models labels them, on Pi's own typesafe-system-one client
  (builtinProviders' typesafe .classify), which posts the TypeSafe
  System One body to the gateway's /v1/systemone. Text input only.
- provider magpie-images: gateway.ImageModels (new; mediaModels with
  labels, the Settings > Images default first, none while it is off),
  drawn by POST /v1/images/generations with the input's images as data
  URLs, b64_json back as image blocks.

Separate ids because an extension's models replace those models.json
gives the same provider id: registered as "magpie", Pi 1.4.0 listed no
chat models at all ("No models available").

The file is rewritten at each Sync and on a pick, and removed with
providers.magpie (pick of none, Disconnect, a Sync that finds it gone).
A magpie.ts whose first line isn't magpie's mark is the user's and is
never written over or removed. Pi only, not OmO or Prime Agent. On a Pi
older than its classifier models the extension returns without
registering anything. Codemode itself is not turned on: that is the
user's defaultTools.

Run at the pushed head (on mote):
- At e7185daeb plus this change: go build ./..., go vet (darwin, GOOS=linux,
  GOOS=windows) of agent and gateway, gofmt -l clean; go test -timeout 45m
  of agent, backup, cli, davsync, gateway, gui, library, profile, stats,
  tui, uninstall. All ok but three reds that are the same on origin/main
  1747559d0 and filed: cli TestEveryRouteHasACommandOrIsNamed (#4826), gui
  TestMainWindowCorners/macOS_26_SDK (#3949), gateway
  TestCodexPoolSaysTheClientsVersion (full-run only, passes alone, #4807).
- Rebased on 1aca55909: go build ./..., go vet linux/windows of agent and
  gateway, go test ./internal/agent/ ok (181s), gateway -run
  'Image|Media|Draw|Decide|SystemOne' ok.

Real Pi in a sandbox HOME on mote (npm @earendil-works/pi-coding-agent),
against a fake gateway, with the extension magpie generated
(piExtensionFor from the test fixture):
- 1.4.0: `pi -p --tools +codemode`, the script listed
  magpie-systemone/mixed/typesafe/jev and magpie-images/art/gpt-image-2
  (in=text,image); classify answered {approved: bool 0.93}; a drawing
  with an image input came back as image/png. The fake logged
  /v1/systemone {model: mixed/typesafe/jev, noul question} and
  /v1/images/generations {model: art/gpt-image-2, images: [data URL]},
  both with Bearer magpie; the chat model from models.json still ran.
- 0.87.1 and 1.0.0: start and chat with the file in place, no error.

Broken by hand: the user's-own check removed -> LeavesTheUsersOwn red
(file written over, then removed); the Pi-only gate removed ->
PiOnly red; the extension write made a no-op -> ListsDecisionAndImage
Models and FollowsSync red.

Not tried: a real magpie gateway with real decision or image vendors
behind it (the fake answers in TypeSafe's wire shape, as magpie's
/v1/systemone does); classifier image input (left off); a WSL Pi. A
change of decision or image models reaches the file at the agent's next
Sync (a catalog change) or pick; whether a Settings > Images change
alone starts a Sync was not checked.
2026-11-02 15:43:43 +08:00
yetone 1aca55909f gateway keys: a key given a model is not given a routing group of it the user never handed out (kautism)
kautism on Discord: a gateway key held to gemini 3.8 alone was shown,
and could use, a routing group the user made of gemini 3.8 alone, though
the user never gave the key that group. groupAllowed let a key use any
group whose every member it may use (the #882 rule), so the group leaked
into /v1/models and every route that asks it.

- key_models.go groupAllowed, the one check every route asks (the model
  lists' entryAllowed, serve on every API, countHeld, embeddings, images,
  videos, decision groups, a subagent's and masking's route): a group of
  the user's own is a key's only when the key names it (group/<id> or
  group/*). A group magpie found (auto/<model>, one model several
  providers serve; foundGroup) still passes when the key may use every
  member, as it is that model. A key that names accounts and no model
  (Linka, access.HeldModels gives it "<provider>/*") still may use a
  group of those providers' models alone, as it may every such model:
  access.Identity.AccountModels says so, for an issued key too.
- keyGroupFor: a bare name that is both a group of the user's the key may
  not use and a model it may use is that model for the key (a group the
  user called "Gemini 3.8", id gemini-3-8, would otherwise have turned
  the key's bare gemini-3.8 into a 403). serve's grouped and countHeld
  use it.
- Decision models (v0.1.2681) unchanged: a group the key names still
  asks its own Jev; TestGatewayKeyHeldToAGroupKeepsItsDecider passes.
- A group named inside one the key doesn't name no longer makes the outer
  one the key's (TestGatewayKeyModelsNameAGroup updated); the key names
  the outer group to use it.
- docs/reference.md and gateway-routing.md say so.

TestGatewayKeyGivenAModelIsNotGivenItsGroup is the reporter's case: a key
given google/gemini-3.8 alone, a group "Only 3.8" and one "Gemini 3.8" of
that model alone. Neither is listed in /v1/models nor found at
/v1/models/{id}; each is refused on chat completions, messages and
count_tokens, by id and by name; the model is served by id and bare;
a found group of two providers' gemini-3.8 is still listed and served to
a key given both; a key naming group/only-38 is given it.
TestGatewayKeyModelsHoldAKey, TestKeyListSeesChangesNextRequest updated
from the old rule.

Broken by hand: groupAllowed back to the old rule: the new test,
TestGatewayKeyModelsHoldAKey and TestGatewayKeyModelsNameAGroup red. The
bare-name fallback off: the new test red (chat gemini-3.8 403). The
accounts-only exception off: TestGatewayKeyAccountsOnlyHoldTheModels red.

Run on mote at this commit (rebased on origin/main 1747559d0): go build
./... ok; go vet of internal/gateway and internal/access for darwin,
linux and windows ok; gofmt -l clean; go test ./internal/access ok;
go test -run 'Key|Count|Group|Model|Identity|Issue' ./internal/gateway
ok; go test -run 'CallerKey|Key' ./internal/gui ok. Before the rebase
(at e7185daeb) the whole internal/gateway package and internal/cli ran:
red only in TestCodexPoolSaysTheClientsVersion (#4807, red in a full
package run on mote, passes alone) and TestEveryRouteHasACommandOrIsNamed
(#4826, red on main since e87140242), neither touched here.

Not tried: a real magpie with the reporter's own key and group; an issued
key under an accounts-only issuer (set in identityOf, no test of its own).
2026-11-02 15:34:08 +08:00
yetone 1747559d02 plugin pages: name the scheme in a browser's policy, and the service's 'self' (#4198)
In `magpie web`, iOS Safari (18.7) loaded none of a plugin page's
scripts: pagePolicy named the page's folder as a scheme-less host-source
(host/_magpie/plugin/<tok>/), a sandboxed frame's origin is opaque, and
that WebKit took the missing scheme from it, so the bridge never said
hello and the page was broken at 10s (orinsid; YangHonghang on v0.1.2681,
young02036 on Discord).

- pagePolicy: a browser's policy now names the folder under both
  https:// and http:// (ownSources). Behind nginx or Cloudflare TLS ends
  before magpie and nothing magpie trusts says which scheme the page came
  over, so X-Forwarded-Proto is not read; both name the same host, port
  and folder, and an https page can't load http:// files anyway. The
  desktop window keeps its own transport alone (wails://, http:// on
  Windows, #2501).
- The second layer (YangHonghang): a page's local service sends its own
  policy, `connect-src 'self'`, and what it sends runs under magpie's
  `sandbox allow-scripts`. In WebKit, 'self' there didn't match the
  service page's own fetch of api/x. servePageService now names the
  service's root (/_magpie/plugin/<tok>/_magpie/service/) under both
  schemes after each 'self' in a CSP header the service sends, plus ws://
  and wss:// in connect-src and default-src (serviceSelf). 'self' stays,
  so nothing allowed before is taken away. A <meta> policy isn't
  rewritten; the plugin docs (en, zh, ja) say to write whole sources.

Run at f0a723d4c's tree (rebased on c74b932c8), on mote:
- go test ./internal/gui/: every test ok but TestMainWindowCorners, red
  the same at an origin/main e7185daeb copy (#3949, macOS 27). The real
  WKWebView test TestPluginPageLoadsItsFilesInTheWindow (desktop
  wails:// path) passes.
- gofmt -l, go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet:
  clean.
- node --test plugin-page, plugin-panels, plugin-page-idle (chromium and
  webkit): 14/14.
- win-run: TestPluginPage*, TestServiceSelf, TestPluginPanel* ok on
  Windows 11 (the window's http:// scheme).
- A scratch test (not committed) served the real pluginPageRoutes(web)
  and a fake service with "default-src 'self'; connect-src 'self'" over
  http and https (httptest TLS), framed sandbox=allow-scripts, in
  Playwright Chromium 151 and WebKit 26.5. At origin/main WebKit refused
  the service's fetch ("Refused to connect to .../_magpie/service/api/x
  because it does not appear in the connect-src directive", the
  reporter's words); with this change it fetched, and Chromium did both
  times. The page's bridge said hello in both engines both times.

Broken by hand: ownSources back to the scheme-less source and
serviceSelf skipped: TestPluginPageWebPolicyNamesItsScheme,
TestPluginPageServedShutIn, TestPluginPanelsServedShutIn,
TestPluginPageWindowPolicy and TestPluginPageServiceProxied go red.

Not tried: a real iPhone. Playwright's WebKit is not iOS Safari, and it
loads the scheme-less source fine, so the first layer is fixed on the
reporters' evidence and the CSP rule, not seen fail and pass here. Not
tried behind a real nginx or Cloudflare, nor a service WebSocket.
2026-11-02 15:27:15 +08:00
yetone c74b932c82 gui: a one-letter account name is masked too (Shinji_Zl on X)
Shinji_Zl's WorkBuddy account is named 他. With account names hidden,
Usage → Overview and the quota cards still showed it: noteAccount and
names() kept only names of two characters or more, and mask() skipped
text nodes shorter than two.

A name of one character is now kept when it is a single letter past
ASCII (nameLike: a CJK name like 他), never one ASCII letter or digit,
which would mask every "a" or "1" on the page. Such a name is masked
only where it stands apart: next to another letter or digit of any
script it is part of a word (inWord: 其他 keeps its 他). mask() now
looks at text nodes of any length.

The core scripts' budget is kept, not raised: the new code is written
short, and three of the masking block's comments are cut to what they
say (the stand-in letters, names(), the accounts shown).

Run (mote, on e7185daeb):
- the GUI files that mask names or show account names
  (--test-concurrency=4): 674 tests, 651 pass. 22 reds are
  usage-agents-hide, which fails the same 22 alone at origin/main
  f849ccced (#2276, #3414). One is account-mask chromium zh's click on
  #usageMask timing out (#3951, same on main in a whole run); the file
  passes 5 of 5 runs alone here and 5 of 5 at origin/main.
- broken by hand: app.js as on main, account-mask 0 of 4; the inWord
  line taken out, 0 of 4 (the 他 of 其他 is masked, 4 names not 3).
- TestCoreScriptBudget (go test ./internal/gui -run Budget) and
  i18n-keys: ok.

Not tried: the whole GUI suite (14k tests, ~200 known reds), and the
reporter's real WorkBuddy account.
2026-11-02 15:21:18 +08:00
yetone 58541e5b8c gateway: a turn that ended failed, cut or canceled says no task done (#4866)
emo172 (mochi) reported that "<agent> 已完成" was shown for Codex turns
that never finished. On Codex signed in with ChatGPT
(/backend-api/codex), three cases were recorded as a clean 200 and
ended the turn: Esc or a closed window mid-reply, a response.failed
under the backend's 200, and a response.incomplete. codexUpstreamOn
looked only at the status and codexStreamCut. codexStreamCut says ""
when sniff.failed is set, when the stream is whole, or when the
context is done. trace.go:790 then ended the turn with final true.

The fix is in the one place both turn paths share, the reply scan
(toolScan) every byte to the agent goes through, and turnFinal, which
now decides `final` at trace.go:790:
- A cut mark makes a reply unfinished: an error event in each wire
  format (Anthropic/Responses "type":"error", Chat/Gemini "error":{…}),
  a Responses reply failed, incomplete or cancelled, and a reply cut
  at its length (stop_reason max_tokens or
  model_context_window_exceeded, finish_reason length, finishReason
  MAX_TOKENS). Keys are matched with their quotes, so text or tool
  arguments that mention them escaped never match. "error":null on a
  success doesn't match.
- The agent's request being done before the reply's last event
  (response.completed, message_stop, a stop reason, [DONE]) makes it
  unfinished too. A client that hangs up after the last event, as
  Codex does, still ends its turn.
- A Responses tool_search_call that Codex runs itself
  ("execution":"client") counts as a tool call. It was missing from
  toolValues.

Codex direct also records what it saw, as the routed path does: 499
canceled when Codex went away mid-reply, and the backend's
response.failed as the row's error. Covered: the Codex HTTP and
upstream-socket paths, Codex's own socket to magpie
(response.interrupt), and routed Chat, Responses and Anthropic relays,
plugins included, since they go through captureResponseWriter.

Scene A, a model ending its turn with a question for the user: no
change. Nothing in the bytes tells "asks the user" from "done" without
reading the text, and a turn's end with the agent waiting on the user
is what the alert is for. Structured asks are tool calls and don't
alert already.

Tests (turndone_unfinished_test.go), from real event shapes:
- TestReplyScanUnfinished: 14 replies, each split at six points.
- TestTurnDoneCodexBackendUnfinished: failed, incomplete and canceled
  (the agent hangs up on its first write). No end, the route says
  error or 499, and a whole reply after each ends the turn.
- TestTurnDoneCodexSocketInterrupt.
- TestTurnDoneRoutedUnfinished: Chat error and length, Responses
  failed and incomplete, Anthropic error and max_tokens.

Run on mote:
- go test -timeout 45m ./internal/gateway at c08d02adf (this change
  on f849ccced): every test ok but TestCodexPoolSaysTheClientsVersion,
  which is #4807. That test takes another test's Codex identity
  (codex_cli_rs/0.165.0) in a package run. It passes alone 3 of 3
  here and on origin/main e7185daeb.
- After rebasing on e7185daeb (its gateway changes include
  codex_backend.go), at the pushed head:
  go test -run 'TurnDone|ToolScan|ReplyScan|Codex|Socket' ./internal/gateway
  is ok but the same #4807 red. The same -run on e7185daeb alone
  fails the same way.
- go vet ./internal/gateway, also with GOOS=linux and GOOS=windows: ok
- gofmt -l: clean

Broken by hand, the -run 'TurnDone|ToolScan|ReplyScan' tests on mote:
- With turnFinal's unfinished() check dropped, Codex incomplete and
  routed Chat length, Responses incomplete and Anthropic max_tokens go
  red.
- On the old code (both trace.go and codex_backend.go reverted), every
  Codex case and the socket interrupt go red too: 200 "" and an end
  said. Routed error events and Responses failed passed on the old
  code already, since serve records sniff.failed as the call's error.

The scan's cost: TestPluginStreamLargeReplies took 22.0s with the fix
and 21.9s on the old code, at load 78.

Not tried: a real Codex session pressing Esc against the live
backend, and the GUI notification itself (TurnDone is unchanged).

Reported by emo172.
2026-11-02 15:19:38 +08:00
yetone b4a9cd8db5 codex: a tool name the ChatGPT backend refuses goes as one it takes, and comes back as the agent's
wing3556 on Discord (11-02): a compaction through a Codex account failed
400 "Codex: Invalid response.create payload: Invalid 'input[83].name':
string does not match pattern. Expected a string that matches the
pattern '^[a-zA-Z0-9_.-]+\z'." The ChatGPT backend checks every tool
name in a request, a call's in input as well as a tool's in tools, and
refuses the whole request when one fails. A conversation can hold a call
by such a name: a model another provider served wrote one with a space,
a colon or non-ASCII in it, and the agent kept it beside its "no such
tool" answer. Every request that replayed it, the compaction above all,
then failed on Codex. Nothing on the way checked: buildResponses copies a
call's name as it is, and redaction keeps names as written.

What changed:
- provider.CodexToolName: a valid name stays as it is. Otherwise each
  refused byte becomes "_", the result is cut to 55 and gets "_" plus 8
  hex of its sha256, so it is the same on every request and two names
  never meet. CodexToolNames applies it to tools (namespace children
  too), function_call/custom_tool_call items, additional_tools and
  tool_search_output items, and tool_choice. A body with no bad name goes
  byte for byte.
- It runs where every request to the ChatGPT backend passes: codexBody
  (an account's, translated or relayed) and codexUpstreamOn (Codex's
  own sign-in, /responses and /responses/compact), beside DeclareSearch.
- A tool the agent declared under such a name is called back by its own
  name: translated replies through decoderFor (now given the request's
  tools; codexNamesBack), relayed Responses replies through nsTidy's new
  back map (codexRenamedIn).
- docs/subsystems/gateway-routing.md says so beside #1270's paragraph.

Not covered: namespaces, the OpenAI API (whose pattern has no "." and a
64 limit), Azure and Copilot Responses, filed as #4875.

Run on mote at this head:
- TestCodexToolNamesTheBackendTakes and TestCodexToolNamesKeepValid
  pass. The fake backend refuses a bad name with the reporter's 400 word
  for word; the test covers Claude Code's compaction on /v1/messages with
  four bad history names (sent twice, byte-equal), Chat with a declared
  "search:web" called back by that name, Responses relayed the same, and
  Codex's own /backend-api/codex/responses.
- go test ./internal/provider ./internal/gateway (-timeout 45m): provider ok;
  gateway ok but TestCodexPoolSaysTheClientsVersion, the red already
  filed as #4807 (full package run only, another test's Codex identity
  reaches it); it passes alone at this head.
- go vet ./... (darwin) and GOOS=linux/windows CGO_ENABLED=0 go vet
  -tags nogui ./...: ok. gofmt -l: clean.

Broken by hand:
- codexBody hook off: compaction red with the reporter's 400.
- codexUpstreamOn hook off, decoder restore off, passthrough restore off
  (together): the codex, chat and responses cases each red.

Not tried: wing3556's real conversation (we don't have its bytes, and
the agent is unknown; Claude Code is likely). No real ChatGPT account
was asked with a bad name, so whether the real backend also limits
length is unknown.
2026-11-02 15:15:21 +08:00
yetone e7185daebe claude: a failed interactive read says why in app.log, and names the trust question (#4830)
mydosu (#4830) found nothing in app.log to say why every /usage read and
test of a saved account failed, and the card's reason, "showed no
prompt", said nothing of the trust question Claude Code was waiting on.

- claudetui: when the helper's deadline comes while Claude Code shows
  "trust this folder", the reason is "Claude Code asked whether to trust
  <folder>, not answered in the 16.8s its caller waits for it: <screen>".
  Any other screen keeps "showed no prompt".
- gateway: askClaudeTUI and claudeUsageTUI log a failure to app.log
  (logOneOff): "claude: a /usage read of saved account <dir> failed: ...",
  with the helper's whole reason on one line, which the card clips to 300
  bytes. The home folder and any /Users/<name>, /home/<name> or
  C:\Users\<name> become ~, secrets go through redact.Scrub, and past
  800 bytes the line keeps the first 300 and the last 500, so the end of
  the last screen stays.
- docs/subsystems/claude-subscription-bridge.md says both.

Run at this head (mote, rebased on origin/main; the gateway set re-run
with Upstream|Unsent|Routing added after the rebase): gofmt -l clean; go vet for claudetui and
gateway, and GOOS=linux and GOOS=windows go vet for claudetui, gateway
and provider: ok. go test -count=1 -timeout 45m ./internal/claudetui
./internal/provider: ok. ./internal/gateway -run
'Claude|TUI|Usage|Warm|Ask|Trust|Subscription|Bridge|OneOff': ok.
Windows (win-run): ./internal/claudetui ran with the new trust_unanswered
case passing through ConPTY; TestShimFirstMessageWaitsForTools and
TestShimReadsUsage are red there, the same at origin/main f849ccced
(#4810, #4820). TestClaudeOneOffFailureLogged skips on Windows (a shell
script helper).

Broken by hand, each red: no logOneOff call (app.log says nothing); no
home and path masking (the line has the home folder and "mydosu"); no
redact.Scrub (the token's body is in the line); no head/tail cut (1530
bytes); no trust wording in ready() (trust_unanswered says "showed no
prompt").

Not tried: a real failing read on mydosu's Windows machine; the full
internal/gateway package (another session's full suite was queued on
mote). Not changed: oneOffErr's clip() can cut a rune in two for the
card's 300 bytes; logOneOff cuts on rune starts (#4878).
2026-11-02 15:06:47 +08:00
yetone f849ccced6 provider: Devin's mover min is 0.1.33, so a grown permission check replaces its keepalive pings (plugins #620)
devin 0.1.33 (plugins 581ca13) fixes the cache keepalive for Claude Code
Auto's permission check. The check grows its first user message with the
history, so every check got a new keepalive key, and its old pings
kept running beside the new ones. zelong77 reported it with an offline
repro. The key is now the session, the agent, the instructions and the
tools. A request that names no session is still told apart by its first
message, and a first message that grew from an earlier one keeps the
earlier key. keepMovedCurrent now updates every moved Devin user to it.

npm has 0.1.33: npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-devin-auth version.
Run on mote at this tree (on aab48dea9): gofmt clean; go vet ./internal/provider
on darwin, linux (nogui) and windows; go test -count=1 ./internal/provider ok.
In the plugins repo at 581ca13: bun test packages/devin 186 pass, and the
4 new keepalive tests fail on the old index.mjs; whole repo bun test 4741
pass, 0 fail; bun scripts/check.mjs exit 0.
Not tried: a real Devin account or a real Claude Code Auto session.
2026-11-02 14:56:27 +08:00
yetone 86d8127c33 gateway: a Codex turn whose new connection a proxy closes before it's sent goes again, and rests nobody (dealyang_ on X)
dealyang_ (X, 2117137662742274246): through a TUN proxy's fake IP
(198.18.0.17) every Codex turn failed with "write tcp …: use of closed
network connection", and the Plus accounts were rested until their window
renewed. Go's transport sends a request again on its own only when the
connection it went out on was a reused one; a new connection that the far
side closes right after the TLS handshake, while the request is still
being written, fails at once and came back as a 502 the routing counted
against the account (failOther).

replayable now watches the connection each try gets (httptrace GotConn).
On a new HTTP/1.1 connection whose write failed (a write OpError, a bare
net.ErrClosed from tls.Conn, or Go's "server closed idle connection",
seen on Windows), it sends the request again on another new connection
after 250ms, then 1s. A failed write means the request never went out
whole. A connection that ends after the whole request was sent fails as
a read error and is not sent again. If every try fails this way, the error
says the network or a proxy closed the connection before the request was
sent, and points at the proxy or VPN. failure() reads those words in a 502
as failProxy: the next member is asked and nobody rests.

Run:
- go test -count=100 -run TestClosed ./internal/gateway/ on mote (darwin):
  ok. The same on Windows (win-run, 100 runs) and WSL (30 runs): ok.
- go vet ./internal/gateway/ for darwin, linux and windows on mote: ok.
- gofmt -l: clean.
- go test -timeout 45m -count=1 ./internal/gateway/ on mote: every test
  passes except TestCodexPoolSaysTheClientsVersion, which is #4807 (red
  in a full package run on mote, passes alone). It touches neither the
  transport nor failure().
- After the last edit (the Windows wording and a comment): -count=20 on
  mote and -count=10 on Windows: ok.

Broken by hand: with closedBeforeSent returning false,
TestClosedBeforeSentIsSentAgain and TestClosedBeforeSentEveryTimeSaysWhy go
red. With the routing change removed, TestClosedBeforeSentEveryTimeSaysWhy
and TestClosedUnsentFailureScoped go red.

Not tried: the reporter's own TUN proxy. The test server closes after the
handshake as that proxy did. The full ./... suite has not run yet: another
session's full suite holds mote.
2026-11-02 14:55:14 +08:00
yetone aab48dea94 claude: a saved account's .claude.json says magpie's work folder is trusted (#4830)
mydosu (#4830, Windows, v0.1.2679, Claude Code 2.1.316): since
d39358f1b the /usage reads and the "hi" test of a saved account run in
<tmp>/magpie-claude-work, and the account's config directory never got
a trusted entry for it. Every read waited out its 16.8s on the trust
question.

magpie now writes the entry itself, before each run there, into a saved
account's .claude.json (provider.ClaudeTrustFolder, gateway trustWork).
This covers every place Claude Code runs in that folder with a
non-default config dir: askClaudeTUI, claudeUsageTUI, and the bridge's
startRun when the caller's folder isn't used. The key is the one Claude
Code 2.1.316 looks a folder up by (its trust check, read from the
binary): the path in NFC, with forward slashes on Windows
("C:/Users/<me>/AppData/Local/Temp/magpie-claude-work"), and also with
its links resolved (/private/var/... on a Mac). For a Claude Code in WSL
it is the mount path. Only a direct child of claude-accounts is written,
never ~/.claude.json or the account Claude Code is signed in to. Other
keys and the project's own fields are kept, numbers go back as written
(UseNumber), a file that can't be parsed is left alone, and nothing is
written once the entry is there. A run's own fallback temp folder isn't
recorded. The helper's yes answer stays as it was.

I could not reproduce the missing entry itself. On xiaomi-gpu, Claude
Code 2.1.316 with a fake sign-in and the helper's yes recorded the key.
This fix does not depend on why it wasn't recorded on mydosu's machine.

Run at this head:
- mote: gofmt -l internal (empty); GOOS=linux and GOOS=windows go vet
  ./internal/gateway ./internal/provider; go test ./internal/provider
  ./internal/claudetui ok; go test -run
  'Claude|TUI|Usage|Warm|Ask|Trust|Subscription|Bridge'
  ./internal/gateway ok. The full gateway package was not run: two
  other sessions' full gateway suites were running on mote.
- xiaomi-gpu (win-run): go test -run
  'TestClaudeTrust|TestClaudeOneOffTrusts|TestClaudeBridgeTrusts'
  ./internal/provider ./internal/gateway ok (the shell-script ones
  skip there).
- xiaomi-gpu, real Claude Code 2.1.316 in a sandbox HOME/TEMP, helper
  told not to answer the question (MAGPIE_CLAUDE_TUI_TRUST=0). A saved
  account dir under a sandbox claude-accounts, with the entry written by
  trustWork (key "C:/Users/yeton/trust4830-sb/tmp/magpie-claude-work"):
  /usage drew its panel in 5.6s, exit 0. The same dir without the entry:
  "Claude Code asks whether to trust the folder" in 0.9s.

Broken by hand, each red:
- trustWork returning at once: TestClaudeOneOffTrustsMagpiesFolder,
  TestClaudeTrustWorkOnlyMagpiesFolderInSavedAccounts,
  TestClaudeBridgeTrustsMagpiesFolderForSavedAccount.
- the bridge's call dropped: TestClaudeBridgeTrustsMagpiesFolderForSavedAccount.
- no "/" for "\" on Windows: TestClaudeTrustKeysAsClaudeCodeKeys on
  mote, plus TestClaudeTrustWorkOnlyMagpiesFolderInSavedAccounts on
  Windows.
- no claude-accounts guard: TestClaudeTrustFolderOnlyMagpiesAccounts.

Not tried: a real signed-in saved account (the reporter's), and Claude
Code in WSL (the key is the mount path, by unit test only).
2026-11-02 14:51:16 +08:00
yetone f20e174aed plugin: the built-in market copy lists Qoder's four subscriptions, as the registry does
internal/plugin/market.json is the copy used when the plugins repo's
registry can't be read. Its Qoder entry still listed providers ["qoder"]
and the old one-line summary. It now carries the registry's providers
(qoder, qoder-cn, qwenwork, qwenwork-enterprise) and the summary from
magpie-community/plugins 2595d48, which names Qoder 中国版 (qoder.cn), so a
search for it on the Plugins page finds Qoder offline too (小武 on
Discord).

Run at 3b3d32724 on mote: go test ./internal/plugin ok (106s), and the
GUI files listed in the previous commit, 146/146 ok.
Again after rebasing on origin/main 834c6c7df (which changed
internal/plugin and gui/providers.go), at this tree: plugin-pick-sub,
plugin-two-subs, plugin-replaced, qoder-cn-tile, signin-closes-sheet,
i18n-keys and account-rows-fit, chromium + webkit, 69/69 ok;
go test ./internal/plugin ok; ./internal/gui Budget/I18n ok.

Not tried: the Plugins page with the registry really unreachable.
2026-11-02 14:49:36 +08:00
yetone 277c911658 plugins: a plugin's Sign in asks which subscription, and Qoder CN is Qoder 中国版 in Chinese
小武 on Discord: "Qoder 只支持国际版 请添加 Qoder中国版", then "有Qoder CN
没有添加账号的入口". The Qoder plugin serves four subscriptions (qoder,
qoder-cn, qwenwork, qwenwork-enterprise), but the Plugins page's Sign in
on its card and on its Installed row always took the first one not signed
in, qoder.com. Qoder CN was never offered there. In the Add sheet it was
called "Qoder CN" in every language, so a search for 中国版 found nothing.

- plugins.js: with more than one subscription not signed in, Sign in opens
  the app's menu (openProtoMenu), headed "Sign in to which subscription"
  and listing each one by its Add-sheet name (subName). With one, it signs
  in to it directly, as before. The Installed row says "Sign in to
  another…" when more than one is left. The pm-sub lines and tips use the
  same names.
- app.js: the qoder-cn SUBS entry's name goes through t(). openProtoMenu
  passes the click event to a single-choice choose, so the sign-in it
  starts has a fresh trusted event.
- i18n.js: Qoder 中国版 (qoder.cn) / Qoder 中國版 (qoder.cn) / Qoder 中国版 /
  Qoder CN, plus the menu's heading and "Sign in to another…", in zh,
  zh-TW, ja and de.
- The core scripts' budget is unchanged. The ~800 bytes added are paid for
  by cutting two of plugins.js's GitHub-section comments
  (1,533,657 <= 1,533,802).

The registry's Qoder summary was updated to name Qoder 中国版 in
magpie-community/plugins 2595d48. No plugin code changed, so there is no
new npm version and no mover min raise.

Run at 3b3d32724 (this commit plus the next commit's market.json), rebased
on origin/main ce2e81da1, on mote:
- GUI: plugin-pick-sub (new), plugin-two-subs, plugin-replaced,
  qoder-cn-tile, signin-closes-sheet, i18n-keys, plugin-github,
  plugin-github-filter, plugin-github-hooks, plugin-github-wait and
  plugins-more-discover, chromium + webkit: 146/146 ok.
- go test ./internal/plugin ok; go test -run 'Budget|I18n|Lang|Words'
  ./internal/gui ok (TestCoreScriptBudget).
- Before the rebase, 82 reachable GUI files (anything naming plugins,
  Qoder, Sign in to, pm-row or pm-card, plus i18n and gui-*), on mote at
  load ~270: 1122/1145 ok. The reds that failed again when run alone fail
  the same way on origin/main a4916aec1 and ce2e81da1:
  - segs-press-redraw searchAllRow (#4566);
  - usage-fold "most on one screen" (#4790);
  - plugin-move-unserved "Try again" (#4410, #4392);
  - plugin-card-update webkit (#3079);
  - TestMainWindowCorners (#3949).
  account-mask, sessions-toolbar and signin-closes-sheet passed when run
  alone.

Again after rebasing on origin/main 834c6c7df (which changed
internal/plugin and gui/providers.go), at this tree: plugin-pick-sub,
plugin-two-subs, plugin-replaced, qoder-cn-tile, signin-closes-sheet,
i18n-keys and account-rows-fit, chromium + webkit, 69/69 ok;
go test ./internal/plugin ok; ./internal/gui Budget/I18n ok.

Broken by hand: with signInTo always signing in to the first subscription,
plugin-pick-sub goes red (en and zh, 980 and 420, chromium).

Not tried:
- a real Qoder CN sign-in, or the real app window (the GUI tests fake the
  API);
- the Linux WebKitGTK app;
- the whole GUI suite after the rebase.
2026-11-02 14:49:36 +08:00
yetone 834c6c7dfe gui: an account row holds its readings when they wrap (the owner, after a quota refresh)
The owner, with a screenshot of Claude Code's 账号: "有时候这个页面的排版会崩掉",
then "每次点击手动刷新额度的小按钮之后,账号列表的排版就会崩掉". An account's
5-hour and 7-day meters ran under the next account's name.

.accts was a one-column grid (b19f3dbab). When a row's .aq readings went from
one line to two (they wrap by language and width, and a refresh redraws them),
WebKit kept the grid row at its old height, so the second line overflowed into
the next row. Hiding and showing the row put it right; Chromium never did it.
Changing the row's own display (grid, column, block) didn't help; changing the
list's did. .accts is now a flex column, which lays out the same.

account-rows-fit.test.cjs serves five Claude accounts with both windows, opens
the editor, and checks that no row's last line reaches past the row, then
clicks two rows' refresh and checks again. Chromium and WebKit, en zh zh-TW ja
de, 900 and 720px. A last test asserts that every engine and language hit a
case where the readings wrapped, so the check is never made on one line only.

Run at this tree on ce2e81da1 (the 90-file runs on d577c184b; between them main changed no .acc CSS), on mote through mote-run:
- account-rows-fit.test.cjs: 21/21 ok, again on ce2e81da1.
- the 90 GUI files that select .acc or .accts, at load 80 to 170 from other
  sessions' suites: 1625 tests, 1582 ok, 43 red in 11 files. The same 11 files
  run on unchanged origin/main d577c184b: 25 red there, 22 at this head, with the
  cases moving between runs. Their issues: account-eye #4244, key-replace
  #4126, key-rest-date #4691, login-import #1307, provider-typed #4673,
  proxy-login-fields #3382, rest-try-now #4127, signin-again #4643, and
  providers-reset-use #4873 (filed now; 2 of 2 ok alone on both trees).
- gateway-key-models (#4081) and gateway-key-groups (#1974) are red on
  unchanged origin/main 4fc34828e too (models 3 of 3 runs, at line 79 right
  after setViewportSize; groups' left border once), so they are not this change.

Broken by hand: with the old grid .accts, account-rows-fit is red in webkit zh
900, zh-TW 900 and ja 720 ("ferronatoousseni@example.com's readings reach
10.7px past its row"), green with the column.

Not tried: the real macOS app's WKWebView with real accounts; the whole GUI
suite (mote was at load ~85 with other sessions' suites).
2026-11-02 14:31:43 +08:00