Commit Graph
6241 Commits
Author SHA1 Message Date
yetoneandcduyzh 2c2d2a5e51 gui: Test models says which key a test goes out with, when several are ticked (water5433)
water5433 (cduyzh) on Discord asked for Test models to say which
account a test uses. Their patch added "Tests use the preferred
account/key by default." to the button's tooltip for every provider,
in en, zh and zh-TW. Taken reworded, because it didn't say what the
code does:
- There is no "preferred" key and no other choice of one: TestModels
  (keySeeing in internal/provider/test.go) sends each model with the
  first ticked key that serves it, made for its endpoint first, so a
  key that doesn't see the model is skipped. "By default" promised a
  choice the editor doesn't have.
- A subscription account is a provider of its own, so "account" only
  confused it; and with one key, or none, there is nothing to say.
So the line, "Each model is tested with the first ticked key that can
serve it", shows only when more than one key is ticked, in en, zh,
zh-TW, ja and de (theirs had no ja or de, and zh-TW said 默認 where
zh-TW says 預設; it now follows the key list's own 勾選/金鑰 words).

app.js stays in the core budget without a raise: the line's comment
and two comments beside it (modelTestWhy, modelTests, testOne) were
cut down.

Test: test-models-key-hint.test.cjs, every language, Chromium and
WebKit, 900 and 390 wide: with two keys ticked the tooltip has the
line, and still has it after a test run puts the title back; with one
of two ticked, and with no key list, it doesn't.

Run (mote-run, at this commit on origin/main 12599e9cd):
- test-models-key-hint: 20/20; with status-long, model-test-one,
  account-models, key-plan and i18n-keys: 114/114 in both engines.
- go test -tags nogui ./internal/gui: ok (TestCoreScriptBudget: core 1,533,793 of 1,533,802).
- Broken by hand in Chromium: no line 0/10; the line on whatever keys
  are ticked red ("One on: no key to choose, no hint").
Not tried: the real app with a real multi-key provider.

Co-authored-by: cduyzh <cduyzh@users.noreply.github.com>
2026-11-03 10:05:30 +08:00
yetoneandcduyzh bf47eb46c4 gui: a long status line goes after 15s at most, not 80ms a character (water5433)
water5433 (cduyzh) on Discord: an error toast stayed on screen far too
long. Since d4c05ca11 (littleHong) status() kept a line for
max(ms, length * 80ms) so a long one could be read, with no upper
bound: a 1,150-character error floated over the window for 92s, and a
longer one for minutes, while it took clicks under it.

The reading time now stops at 15s: max(ms, min(length * 80, 15000)).
Their patch capped the whole thing at 10s, min(10000, max(...)); two
changes from it:
- 15s, not 10s: Test models' failure as littleHong read it (the OfficeAce
  line, 141 characters in English) takes 11.3s, and 10s cut it short.
- The cap is on the length part only, so a time the caller gives is kept
  whole: the damaged-file warning asks for 20s, and the 10s cap cut it to
  half.
The pointer still holds the pill however long, and it goes 2s after it
leaves. The text stays in the pill's title while it shows.

Test: status-long.test.cjs "a long line goes after its reading time, 15s
at most", page.clock driven, en and zh, light 900 and dark 390: a
1,150-character error is there at 14.5s and gone at 15.2s; the reporter's
Test models line is kept for all of its reading time and goes after; a
20s warning is kept to 19.5s; hover holds it past 30s and it goes 2.2s
after the pointer leaves.

Run (mote-run, at this commit and the next on origin/main 12599e9cd):
- status-long.test.cjs: 40/40 in Chromium and WebKit.
- go test -tags nogui ./internal/gui: ok; the core stays in its budget
  with this line's comment cut to one line (1,533,752 of 1,533,802).
- Broken by hand in Chromium: old code 0/4 ("gone at 15s, not after its
  80ms a character"); their 10s cap 0/4 ("still there before 15s").
- No other GUI test both drives the clock and reads #status.
Not tried: the real app; their own failing error, whose text I don't have.

Co-authored-by: cduyzh <cduyzh@users.noreply.github.com>
2026-11-03 10:05:30 +08:00
yetone 12599e9cd0 signin: ChatGPT signs in by device code, the first way from another computer
curtinp118 on Discord runs magpie on a VPS and opens its web UI from home.
ChatGPT's browser sign-in comes back to localhost:1455, which is the
viewer's own computer. The page there won't load, and the box's main line
said "The account shows up here as soon as you're done", so the sign-in
looked broken. The fix until now was to copy the dead page's address back
by hand.

ChatGPT now also signs in by device code, as `codex login --device-auth`
does (codex-rs login/src/device_code_auth.rs). This is
startCodexDeviceSignIn, with StartSignInWith site "device":
- magpie asks auth.openai.com/api/accounts/deviceauth/usercode for a code
  with Codex's client id and headers;
- the box shows the code and https://auth.openai.com/codex/device;
- magpie polls deviceauth/token, where 403/404 means not entered yet, for
  up to 15 minutes;
- it then trades the authorization code at the token endpoint with the
  returned verifier and the /deviceauth/callback redirect.
Nothing listens on this computer.

The window starts this way when magpie web is opened from a host other
than localhost or loopback (remotePage in app.js). Either way, the box has
a link to the other way: "Sign in with a code instead" or "Sign in in the
browser instead". A device code that ChatGPT turns away (404) fails, and
that box links to the browser's way. Strings are in zh, zh-TW, ja and de.
providers-accounts.md describes the flow.

This went over TestCoreScriptBudget. It now fits with no raise
(1,533,700 of 1,533,802, on main's 1,533,789). The two way-switch
buttons share one helper (codexWay), and eight comments on the sign-in
code are cut down: openSignInPage, signingKept, startPluginSignIn, the
sign-in proxy, signInProxyChoices, Copilot's GHE.com, dropSigningIn and
renderStepPlan.

Run on mote (the pushed head is rebased on ae060550b):
- go test ./internal/provider: the new TestCodexSignInByDeviceCode,
  TestCodexDeviceSignInCanceled and TestCodexDeviceSignInOff, against a
  fake auth server that answers with the bytes auth.openai.com gave on
  11-03;
- go test -tags nogui ./internal/provider ./internal/backup (before the
  comment trim, which touched app.js only): ok; ./internal/gui
  ./internal/cli after it: ok;
- GUI at this head: signin-codex-device.test.cjs (new; Chromium and
  WebKit, en and zh, 420px wide), signin-paste-codex, signin-callback,
  signin-port-blocked, signin-paste-plugin, signin-paste-import, the
  sign-in proxy files and i18n-keys, 40 files: 591 pass, 0 fail;
- the whole GUI suite one commit earlier (base c86fa2a34; the rebase onto
  6a6e4fefa only brought in internal/sessions): two runs, each cut short
  when mote rebooted or by the owner's call not to wait. They got through
  1075 and 1395 cases, with 0 not ok;
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., the Linux nogui and Windows builds, and gofmt -l (base
  c86fa2a34).
Rebased on 4cd01c964 at last: go test -tags nogui ./internal/gui ok and
signin-codex-device, signin-paste-codex, signin-callback and i18n-keys
21 of 21. Before that, rebased on ae060550b with the comments cut: go test
-tags nogui ./internal/gui ok, ./internal/provider ok, and 40 sign-in,
proxy, i18n-keys and desktop-tiers GUI files: 594 pass, 1 fail. The red
was signin-proxy's chromium ja 380 proxy test. That file alone then
passed 3 runs, 120 of 120. It is #1814, open since 10-12 for this test
under load, and noted there. The step that failed wasn't kept.
The full go test ./... was not run, by the owner's rule.

On Linux (WSL magpie-desktop, sandbox HOME), magpie web listened on
0.0.0.0:3561 and was reached at the WSL IP. POST /api/signin
{"agent":"codex","site":"device"} got a real code from auth.openai.com
with url https://auth.openai.com/codex/device. The sign-in stayed waiting
across real polls for 12s, nothing listened on 1455, and cancel ended it.

Broken by hand:
- Taking the device branch out of begin() turned
  TestCodexSignInByDeviceCode and TestCodexDeviceSignInOff red.
- Taking the remotePage default out of startSignIn turned 8 of the 12
  signin-codex-device cases red.

Not tried:
- Entering the code with a real ChatGPT account, so a real token trade
  through the device callback hasn't been seen.
- Business/Enterprise workspaces that turn device codes off.

Also not changed: WorkBuddy's plugin sign-in already finishes by itself
from a remote browser (server-side poll; checked on the same WSL setup).
A backup still carries no sign-ins.

Reported by curtinp118 on Discord.
2026-11-03 09:54:05 +08:00
yetone 4cd01c964a agent: a Linux link handler counts only when its desktop entry and program are there (geddy)
geddy (X, 2117406492832010548) added magpie to Cindy on Omarchy: a blank
Chrome tab opened and magpie said it was handed to Cindy. On Linux,
systemLinkHandler took any answer from `xdg-mime query default
x-scheme-handler/cindy` as "found". xdg-utils 1.2.1 (Arch) checks that the
entry exists only for mimeapps.list; a stale line in mimeinfo.cache or
defaults.list comes back as a name with nothing behind it. xdg-open then
can't find the entry and falls back to $BROWSER / chromium, which is the
blank tab.

Now the name xdg-mime gives is looked up in every XDG data dir's
applications/ (with the dash-as-subfolder variants), and its Exec program
must be there (absolute and present, or on PATH). With no entry, the gone
path goes to OpenAppLink, which returns NoLinkHandlerError ("Cindy's links
(cindy://) open …/applications/cindy.desktop, which isn't there") instead
of opening anything. A read error other than not-exist is returned as
unknown. desktopExec (Lody) now shares the same parse (desktopArgs) and
the XDG dir list.

What was run:
- TestDesktopHandlerNeedsItsEntryAndProgram (new) and -run
  'Desktop|OpenAppLink|Lody|CommandProgram' on mote (macOS) and Linux
  (wsl-run, magpie-desktop, Go 1.26.8): ok.
- Real xdg-mime on Linux in a temp HOME, XDG_CURRENT_DESKTOP=Hyprland, a
  stale `x-scheme-handler/cindy=cindy.desktop;` in mimeinfo.cache and no
  entry: origin/main said found and handed the link to xdg-open; this
  change returns the error above.
- Broken by hand: returning found with no entry turns the new test red.
- gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
  of ./internal/agent on mote: ok.
- go test ./... on Linux: every package ok except reds that fail the same
  at base c86fa2a34 on that box: 7 internal/agent install-detection
  tests (#4033; TestHowInstalled fails at base too with -count=3),
  TestCodexPoolSaysTheClientsVersion (#4807), TestCCListingKeepsItsNames
  (#4925). Root, internal/cli and internal/gui need GTK4 there, so they
  ran again with -tags nogui: all three ok.
- Rebased on 1a92a97ca (5 commits, internal/agent's Claude Desktop
  models among them): internal/agent on Linux again, only #4033's
  install-detection reds.

Not tried: a real Omarchy VM (its Hyper-V adapter had no IP, ssh was
refused) and a real Cindy install on Linux.
2026-11-03 09:50:31 +08:00
yetone 8e9b048b65 settings: a row's explanation shows on hover, not under every name
The owner (11-02, a screenshot of Settings › 模型): hide the lines that
explain a setting and show them on hover, so the page reads quiet and
open ("很简洁,很有呼吸感"). Settings' rows now rest as a name and a
control. The pointer resting on a row (450ms, so passing over rows shows
nothing), or a key reaching its control, shows its explanation whole in a
card under the row's name, or over the row where the window ends; the
card takes no pointer and no row moves. It goes when the pointer or focus
leaves, a key is pressed, or the page scrolls (focus's card follows its
row instead, as Tab scrolls it into sight).

- app.css: in #view-settings, under (hover: hover), a .row.pref's plain
  .sub lines are clipped out of sight, not removed, so a screen reader
  and the search still read them; each carries --hint: 1, which the card
  reads. A search shows them in place again, as before. A touch screen
  keeps them all.
- Stays in sight: errors (.err, .bad), states (.say, [role=status],
  .proxy-check), warnings (.image-gen-hidden, .sync-sign-in,
  .vision-not-marked), .no-names, .pv-hits, .feat-why, .font-note, the
  proxy in use (#proxySub), and any line with a button, link, input,
  code or a search provider's failure note in it (.acts, which
  settingshints.js sets on each such line as it is drawn, through a
  MutationObserver, so before it is painted: Safari before 15.4 has no
  :has(), and old-webkit holds the styles to 15.0). Disclosures stay too: what tracing sends (otel's
  sessions row) and the allow list's addresses, as do a disabled
  pattern's matches. .say is new, on the lines that are a state, not an
  explanation: the version row's update state, a sync's last sync, the
  sync notice, the web page's "Served" line, the local masking model's
  state (downloading, on, failed; its two explaining lines, before it is
  on, are hidden) and what Check in now came to.
- One-line rows are one height: a row left with its name alone was 48
  to 51px by its control (the owner, 10-22: one-line rows of one
  height), so under (hover: hover) every Settings .row.pref has a 27px
  content-box min-height, 51px with its padding, its line above outside
  it. Check in now's row aligns to its top, so its result line grows the
  row down and the button stays where it was pressed.
- app.js stays in the core budget (1,533,799 of 1,533,802 at this
  head, on main's 1,533,789) with three comments shortened, no raise.
- settingshints.js: the card and the .acts marks, a module app.js
  imports at start, not in index.html (one line in app.js; old-webkit's
  list of such modules names it). Its :focus-visible check is in a try,
  as Safari before 15.4 throws on it.

Tests, run on mote (macOS) at this tree:
- settings-hints.test.cjs (new): Chromium and WebKit, 1100 and 420px,
  en/zh/zh-TW/ja/de, Settings › Models. At rest the Image recognition MCP
  server's line is out of sight and still in the page; a gone model's
  error and an unticked image model's warning stay in sight; hover shows
  the whole line in a card off the row's name, inside the window, no row
  box moved, pointer-events none; the pointer leaving hides it; Tab (or
  Option-Tab in WebKit) to the row's copy button shows it; a search shows
  it in place; a line given a link shows at once and rests again when
  the link goes. 20/20 green.
- Broken by hand: with the clipping rule's body gone, 20/20 red on "the
  explanation shows at rest"; with app.js's import line gone, 20/20 red
  waiting for the card; with the .acts observer gone, Chromium 10/10 red
  on the link line. Before the kept lines and the row height were
  in, checkin-now-account was 20 red (the result line hidden, then the
  button moved 7px) and settings-general 10 red at 1000px (one-line rows
  48, 50 and 51px); both green with them.
- settings-lines-wrap.test.cjs: a hidden explanation is skipped by its
  "cut short" measure and checked whole in its card instead (#visionMcpRow
  and the searcher row). 20/20 green.
- 22 more GUI files checked a Settings explanation's text, width or
  wrapping in place; each now checks the text and that it is hinted, and
  skips its geometry (redact-*, privacy-model, settings-general,
  searcher-pick, disabled-models, the *-setting rows, images-codex-one,
  and reply-model-setting, new on main since: red 20 of 22 on ".sub
  fits" until it got the same check, then 22/22).
  These 24 files: 536 pass, 2 fail, both images-codex-one's #pop picker
  race, red the same on untouched origin/main 173b7e274 alone (13/18;
  #4618, commented).
- At this tree, on mote: those 25 files, old-webkit and i18n-keys, all
  green but images-codex-one's #4618 race (3 red). After the last
  rebase (ae060550b, 1a92a97ca) and the comments cut: privacy-model,
  settings-hints, old-webkit, desktop-tiers, i18n-keys green, and
  -run 'Budget|Core' ./internal/gui ok. old-webkit was red before .acts (":has()
  (Safari 15.4)" and settingshints.js unlisted). go test -count=1
  ./internal/gui: ok but TestMainWindowCorners (#3949, macOS 27).
- The whole GUI suite on mote (concurrency 3), one commit before .acts:
  cut short when mote went down mid-run (it rebooted). 25 files had
  reds by then. The 4 that open Settings are main's filed reds
  (gateway-caller-keys #3797, omarchy #4624, mobile-web #3952,
  images-codex-one #4618); the other 21 don't open Settings. Run on
  Linux (wsl-run, magpie-desktop), those 21: 269 pass, 98 fail here;
  270 pass, 97 fail on untouched origin/main 173b7e274, the same files
  red. The one difference was old-webkit, fixed above.
  The whole suite was not run again after .acts.

Not tried: the real app's WebKitGTK (Linux) and WebView2 (Windows), and
a real touch screen; the (hover: none) path is only by the media query.
2026-11-03 09:47:25 +08:00
yetone 1a92a97caa provider: the Qoder mover's min is 0.2.56, which signs in to a Lingma 1.0 dedicated domain (Milktea)
Milktea (Discord) couldn't sign in to their Qoder CN IDE enterprise
dedicated domain (企业专属域). Their domain answers 404 at
/algo/api/v1/version, which makes it a Lingma 1.0 one, and 0.2.53 refused
those. In plugins a16adb3, @magpie-community/opencode-qoder-auth 0.2.56:
- signs in with the account Qoder CN IDE already holds on this computer
  (SharedClientCache's cache/id and cache/user, the shapes from Milktea's
  gist);
- chats on the domain itself, as the IDE's worker signs it;
- uses the IDE's three models, falling through when one gets "Model not
  exist";
- reads the IDE's renewed token again when it is near its end or gets a 105.
Raising min makes keepMovedCurrent update every moved Qoder user.

npm view --prefer-online @magpie-community/opencode-qoder-auth version
returned 0.2.56 before this commit.

Run at this head (mote): gofmt -l internal/provider is clean. GOOS=linux
and GOOS=windows go vet ./internal/provider pass. go test -tags nogui
./internal/provider: ok (104.6s). In the plugin, packages/qoder bun test:
375 pass, and the 11 new Lingma tests are red on 0.2.55.

Broken by hand (in the plugin): keeping Cosy-Scene and Cosy-Business-*,
or reading past an error said in an OK frame, turns 2 of the 11 red.

Not tried:
- A real Lingma dedicated domain or a real Qoder CN IDE cache. No such
  account is at hand, so Milktea is asked to try it.
- A move with this min in a sandbox (only the min changed).
2026-11-03 09:41:07 +08:00
yetone ae060550b9 claude-desktop: a tier's pick runs with its tier's Claude prompt (behavesAs)
moer2831 on Discord: a model picked for one of Claude Desktop's tiers ran
in the Code tab on Claude Code's generic prompt, not the one of the
Claude model of that tier ("通用提示词和对应模型提示词差距挺大的,感觉直接
蠢了一个度"). Desktop 4.29 and later hand Claude Code behavesAs only from
a profile's inferenceModels (z3t in 4.4212's app.asar: modelPicker
options with each entry's behavesAs).

What changed:
- gateway.DesktopInferenceModels: while a model is picked for a tier,
  the list is every row /v1/models gives Desktop, by its id and in its
  order (a non-empty list replaces discovery, pzn), with supports1m,
  prefer1m and labelOverride as Desktop read them off the row, and a
  pick's anthropicFamilyTier/isFamilyDefault. A pick that isn't a Claude
  model gets behavesAs = its tier's newest Claude id (claude-opus-5-5,
  claude-sonnet-5-5, claude-haiku-5-5, claude-fable-5-1). Nothing picked
  (or a pick no longer listed): no list. Unreadable picks are unknown.
- agent: desktopSyncModels writes it into magpie's Desktop profile on a
  tier's Set, as Desktop comes on magpie and on Sync; temp+rename, only
  when it changed; taken away when nothing is picked. The list is
  magpie's only while its hash is one magpie recorded (stash mark
  claude-desktop.models); any other list (the user's) is never written
  over or removed.
- Claude Code's modelSettings gets the pick's own window even when it
  matches the default (claudeBudget.behaves), since behavesAs would
  otherwise give it the Claude model's.
- GUI: the tiers menu ends with one line, "Claude Desktop reads the
  tiers as it starts: restart it after a change." (en, zh, zh-TW, ja,
  de). The Agents row's Restart already lights from the profile hash.
- docs/subsystems/agent-wiring.md and gateway-routing.md.

Run on mote at this tree (base c86fa2a34): gofmt -l clean; GOOS=linux
(-tags nogui) and GOOS=windows go vet ./internal/agent ./internal/gateway;
go test -count=1 -timeout 45m ./internal/agent ./internal/gateway
./internal/gui ./internal/cli ./internal/tui ./internal/backup
./internal/davsync ./internal/library ./internal/profile ./internal/stats
./internal/uninstall: ok but internal/gateway's
TestCodexPoolSaysTheClientsVersion (passes alone here and at main; #4807)
and internal/gui's TestMainWindowCorners (red the same at origin/main
6a6e4fefa; #3949). GUI (chromium + webkit, every
language they cover): desktop-tiers, i18n-keys, and every file named for
tiers, picks, roles, Desktop, i18n or a language (887 tests,
871 pass; the 16 reds are 4 files red the same at origin/main 6a6e4fefa:
found-skill-pick-remove #4097, menu-input-scroll #3402,
phone-connect-menu #4706/#4707, provider-picks-stay #4397). Not the
whole GUI suite.

Rebased on origin/main a5c1fa4b4 (nothing there touches agent, gateway or
GUI assets but routing.css), then again at the pushed head: go vet
./internal/agent ./internal/gateway; the size budgets,
TestDesktopInferenceModels, TestClaudeDesktop*, TestClaudePlan;
desktop-tiers and i18n-keys in both engines: ok.

Broken by hand, each red: behavesAs left out (TestDesktopInferenceModels);
the window write's behaves check dropped (TestClaudePlan); the sync on a
tier's Set dropped (TestClaudeDesktopModelsList); the user-list guard
off (TestClaudeDesktopModelsList); the menu's line not shown
(desktop-tiers 0 of 4).

Not tried: a real Claude Desktop 4.29 or later (none on mote; this
Mac's is 2.7032 and live). Builds before 4.29 ignore behavesAs and take
the names. Desktop 1.x gets the mythos ids. A user's own gateway profile
applied in Desktop makes magpie's list do nothing.

Thanks moer2831 for the report.
2026-11-03 09:33:25 +08:00
yetone a5c1fa4b42 routing: long routing groups no longer widen the page (noahhrreion)
noahhrreion (Discord #general): on Routing the groups at the foot made
the page wider than the window, a scrollbar under it and each row's
routing, Edit and switch far off to the right.

Cause: 173b7e274 let the editor's Save bar stick by having the groups'
list clip its overflow (overflow: clip) instead of hiding it. A box
that hides its overflow is a scroll container, whose least width as a
grid item is 0; one that clips is not, so the .rt-gsec grid, with no
columns of its own, sized its one auto column to the longest member
line, which never wraps. With twelve long members that was 7,100 to
8,200px, and #view-routing scrolled sideways. The column is now held to
the section (grid-template-columns: minmax(0, 1fr)); the list keeps
clip, so the Save bar still sticks. Member lines are cut with an
ellipsis in their row again (wrapped on a phone's web page, as before).

routing-groups-wide.test.cjs (new): three groups of twelve long
members; #view-routing and the document no wider than the window,
every row and its members, routing, Edit and switch inside the list,
the long line cut or wrapped. Chromium and WebKit, the desktop window
1440 to 560px (windowMinW) and the web page 1440 to 360px,
en/zh/zh-TW/ja/de. view-no-sideways serves no groups, so it missed this.

Broken by hand: with origin/main's routing.css the new test is red in
both engines (desktop en 1440px: scrollWidth 7120 > 1228).

Run on mote:
- At this tree on origin/main 6a6e4fefa (routing.css is the same there
  as at c86fa2a34, where the rest was run): routing-groups-wide and
  routing-affinity-order 22 of 22 ok; routing-affinity-order alone with
  origin/main's routing.css 20 of 20.
- At c86fa2a34 with this change: go test -run 'Budget|CSS|Asset'
  ./internal/gui ok. The routing-*, group-*, view-no-sideways,
  click-scroll and old-webkit files (both engines, concurrency 4) were
  cut short when mote rebooted at load ~94: 416 ok, 3 red, all a 5s
  wait timing out in WebKit (routing-affinity-cache-write, #3772;
  routing-affinity-order, #4976, filed now). Both pass alone. The rest
  of that run was not run again.

Not tried: the real app window, WebKitGTK on Linux, a real account's
groups. Not changed: in German at 420px the page head's Hide accounts
and New group run ~50px over, with or without groups; the desktop
window can't be that narrow (560px least).
2026-11-03 09:29:06 +08:00
yetone 7c115f6f5b provider: picks gone from a list for over an hour serve the list (maxleebeta)
maxleebeta on Discord: with WorkBuddy and WorkBuddy AI both signed in,
the Agents page's model picker had no WorkBuddy AI model, and its
Providers row read "已登录 · 1 个图像模型 · Free plan" where WorkBuddy's
read "1 个模型".

WorkBuddy AI's /v3/config (read 2026-11-03 with the owner's account) no
longer lists deepseek-v4.1-flash, its free model until now; hy3 is at
x0.00 instead. The China build still lists deepseek-v4.1-flash. A pick a
plugin's list stops listing goes to Delisted (8febe3a50), and a provider
whose every pick is there serves none of its models (waitsForPicks), for
as long as the list leaves them out. A Free plan account whose one pick
was deepseek-v4.1-flash was served nothing, for good. The row counts
chat models on, and with none it shows the plan's drawers from
/v3/config: "1 image model". The owner's own providers.json has the
same state: workbuddy-ai picks [gpt-6-astra], delisted
[deepseek-v4.1-flash].

Now Provider.DelistedAt keeps when the last pick still in Models left
(dropGonePicks sets it, a pick listed again clears it, Save keeps it
across other settings: delistedAtWith, accountSettings). waitsForPicks
holds only for pickWait (an hour) after it. Past that, or for picks set
aside before DelistedAt was kept (DelistedAt is zero), the list is
served as if none were picked. The picks still come back with a list
that has them. Our Free Model's restart, which the wait was for, lists
its channels again within minutes, and relistSoon asks again in 5.

The plugin is unchanged: its list is what WorkBuddy AI serves today.

New test: TestPicksGoneForGoodServeTheList (the real ids: before
deepseek-v4.1-flash, -sg, glm-5.3-flash; after hy3, -sg, glm-5.3-flash).
It checks: none is served at once; the list is served past pickWait,
with another setting saved on the way; the list is served for picks set
aside with no time kept; and the pick and nothing else is served once it
is listed again. Broken by hand:
- waitsForPicks back to its old body: the new test is red ("served []
  after pickWait").
- Save dropping DelistedAt: TestEveryPickDelistedServesNone is red
  ("served after another setting was saved: [pool-a]").

Run on mote on origin/main 6a6e4fefa plus this change: gofmt -l clean; go vet for GOOS=linux (nogui)
and windows of internal/provider and internal/gui; go test -timeout 45m
of internal/provider, internal/gui, internal/routes and
internal/gateway: provider and routes ok; gui red only in TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote); gateway red only in TestCodexPoolSaysTheClientsVersion (#4807).

Not tried: a real WorkBuddy AI Free plan account (we have none); the
owner's account's config was read, not changed. The full ./... suite
wasn't run: one was already running on mote.
2026-11-03 09:26:51 +08:00
yetone 6a6e4fefac sessions: WorkBuddy AI's own sessions are listed under its name (maxleebeta)
maxleebeta (Discord #general) is signed in to both WorkBuddy builds, the
China one and the international one, and the international one was
missing from an agent list. The provider side lists both: provider.All()
and CatalogFor have workbuddy/* and workbuddy-ai/* models under "WorkBuddy"
and "WorkBuddy AI". The sessions package, though, read only ~/.workbuddy.
WorkBuddy AI keeps the same files in ~/.workbuddy-ai (its product.json
dataFolderName, as internal/agent wires it), and nothing read them. So
WorkBuddy AI was missing from the Sessions page's agent picker, from
Usage > Sessions' agent strip, from the reading consent's folders and
from the usage ledger.

Changed:
- WorkBuddyAIDir and workbuddyAIFiles read ~/.workbuddy-ai/projects as
  agent workbuddy-ai with WorkBuddy's parser, in allFiles, Dirs,
  callSources (wholeCallReaders), Deletable and Found.
- buddyDir picks WorkBuddy AI's own models.json for the
  call-through-magpie skip.
- A ~/.workbuddy-ai that is a link to ~/.workbuddy is read once, as
  WorkBuddy's.
- skillsCounted names workbuddy-ai (WorkBuddy's parser counts no skills).
- docs/subsystems/gateway-sessions.md has a line for it.

Tests:
- TestWorkBuddyAI checks sessions, cwd, title, tokens, Deletable, Found,
  calls, the skip of magpie's gateway, and the link.
- TestWorkBuddyAIGatewayIsItsOwn: one model id that WorkBuddy's
  models.json gives to magpie and WorkBuddy AI's gives to the user's own
  provider.
- TestWorkBuddyAISessionsListedUnderTheirName checks /api/sessions,
  /api/sessions/manage and /api/sessions/stats: name "WorkBuddy AI",
  icon workbuddy-color, deletable.

Broken by hand (each went red): allFiles, parserFor, Deletable, Found,
the call sources, the wholeCallReaders entry, buddyDir.

Run on mote at this head (base origin/main c86fa2a34):
- gofmt -l and go vet for darwin, GOOS=linux and GOOS=windows -tags nogui
  (internal/sessions, internal/gui): clean.
- go test -tags nogui -timeout 45m over sessions and every package that
  imports it: ok for sessions (after the skillsCounted line), agent, cli,
  davsync, gui, otlp, tui, tune and usage.
- internal/gateway failed only TestCodexPoolSaysTheClientsVersion, which
  is #4807 (red in a full package run on mote, another test's Codex
  identity reaches it). Nothing here touches it.

Not tried:
- The reporter's screenshots, which we couldn't download, so their list
  may be another one.
- A real WorkBuddy AI install.
- The Agents page's detection of a newer, renamed WorkBuddy AI bundle
  (5.9.3).
- Windows.
- WORKBUDDY_CONFIG_DIR set: both apps then use that folder, and its
  sessions are listed as WorkBuddy's.
- No GUI JS changed (the page reads the agents from the API), so no
  Playwright files were run.
2026-11-03 08:54:40 +08:00
vincent c86fa2a341 gateway: a relayed citation without the offsets OpenAI's schema wants is dropped, the thread healed (#4921)
A thread a routing group served once on Volcengine Ark (or another
vendor whose Responses endpoint writes its url_citations with no
start_index/end_index) never worked on a codex member again: magpie
relayed the reply's annotations as they came, Codex stored them, and
the ChatGPT backend refused every later replay of the history whole —
"Missing required parameter: 'input[221].content[0].annotations[0].
start_index'" — five retries a turn, on any codex member, through any
upgrade (#4921, the reporter's routing log and rollout). This is
#2855's defect with a different field: what magpie hands a client must
be something magpie could send again.

Such an annotation goes, at both seams, as the reasoning-item fix did:

- a whole reply streamed as the vendor's own events (responsesWholeEvents)
  drops it in every place a client reads a citation: its annotation
  events, the content part, the item and the reply the client keeps
  (dropOffsetlessCitations);
- the history Codex replays loses it on its way to the ChatGPT backend
  (withoutOffsetlessCitations, the same leaving-out as a reasoning
  item's text, #1411): to the backend by its own sign-in and compaction
  relay (codexUpstreamOn), to it as a group member or an openai.com or
  Azure upstream (the provider loop, beside withoutReasoningText), and
  asked again without it where a relay in front of it names the
  parameter (refusesCitationOffsets), marked so it is never sent one
  again — a thread already poisoned heals on its next turn, no new
  thread needed.

The text, and a citation that carries its offsets, go as the vendor
wrote them; a turn with no "annotations" in it is not decoded
(anyInputItem scan, itemCitesWithoutOffsets; the undecoded-turn test
holds, allocations and all).

Run: the three new tests fail on the base with the reporter's exact
400 and pass here (ablation: the tidy call and the rewrite's body
neutralized, tests kept); TestCodexRewritesAsBefore,
TestCodexRewritesLeaveTurnUndecoded and the fuzz hold the rewrite to
its scan; the citation/whole/reasoning neighborhood ok (23s); gofmt,
go vet (linux, windows) and go build -tags nogui clean.

Review: this is skygunner's version of the fix (fcea11649), not
ggbdpq's 57dc7b420. ggbdpq's stripped citations only for a request
that wasn't for a magpie model, so the reporter's own path (a routing
group's codex member, the history passed through) kept the bad
annotation. ggbdpq's parity table and verification of the report
were used to check this one.

Changed in review: annotationLacksOffsets looks only at url_citation
and container_file_citation, the two types OpenAI's schema gives
start_index and end_index. file_citation and file_path carry a single
index, so the patch dropped every one of them as "offsetless".
TestCitationsWithOneIndexKept (added in review) holds both kinds and
checks that a history with only file_citations is sent byte for byte.

Broken by hand at the reviewed head: annotationLacksOffsets made to
return false, all four citation tests red; the type check removed,
TestCitationsWithOneIndexKept red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.
2026-11-03 07:43:18 +08:00
ggbdpq 0561d53521 gateway: spawned Claude Code registers no claude-cli:// URL handler (#4928)
--setting-sources "" keeps the user's own disableDeepLinkRegistration
from loading, so every spawned claude registered the claude-cli:// OS
URL handler again and "Claude Code URL Handler.app" came back after the
user had deleted it. A headless run has no use for an OS URL handler:
the setting is now passed as flag settings (--settings is not one of
the sources --setting-sources controls) on the bridge run and the
warm-up and usage runs beside it, whatever the user's settings read.

Review: applied as ggbdpq posted it (patch sha256 checked against the
issue's). Checked in the Claude Code binary that flag settings read
disableDeepLinkRegistration === "disable" and that --setting-sources
"" doesn't filter --settings. `claude auth login` and `auth status`
take no --setting-sources, so the user's own settings already apply
there; they are not changed.

Broken by hand at the reviewed head: claude_warmup.go and
claude_subscription.go reverted to their parent,
TestClaudeSubscriptionPromptKeepsForeignHarnessOutOfSystem,
TestWarmClaudeAsksClaudeCodeOnce, TestClaudeUsageRunsClaudeCode,
TestAskClaudeTUIOn and TestClaudeUsageTUIOn red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq a8d36b0faa fix(claude): a run let go after answering a prompt suggestion leaves its session for the conversation's next turn (#4914)
Claude Code asks its prompt suggestion after each turn as the
conversation and one message more, and its run goes on with it (#1638):
the run waits on from the suggestion's exchange, under a key the
conversation's own next turn never comes by, since the client leaves the
exchange out of its messages. While the run is kept, that turn finds it
by where it stood before and takes it back to there (resume). But a run
let go past idleMost was lost to its conversation: shelve kept its
session where the suggestion's exchange had left it, or, when the
conversation's own turn had already taken the run back from a suggestion
(-p), not at all — its session was marked taken back, which the file may
not say, and no session was kept. The next turn found no run and no
saved session, and a new Claude Code was told the whole conversation in
one message, a prefix the cache had never seen, written to the cache
again (a 50k conversation: 19k read and 29k written where 49k read and
50 written; the log said no run here had had a conversation one had).

The shelf now keeps a session where the conversation's next turn comes
by, too (savedSession.behind, run.behindKey), and unshelve takes it from
there when no session waits at the turn's own key. A session taken back
is kept once the run has answered a whole turn since (run.replied, set
as a turn ends, cleared at each take-back): the file's lines since are
that turn and what came after, and Claude Code's resume goes on from
them. And a run's end is kept under the boundary before its own
(run.convPrev), so the log of a turn that finds it gone says what became
of it when its last exchange was a side question.

Run: TestClaudeLetGoConversationAfterSuggestionResumesItsSession fails
on the parent a3768cdd1 with the product file alone reverted to it,
tests kept (the ablation: the shelf keeps no session for the
conversation's next turn), and passes on the fixed tree with
TestClaudeLetGoConversationResumesItsSession, whose fake now answers a
rewind; go test -tags nogui -count=1 ./internal/gateway/ (559s, only
the known TestCodexPoolSaysTheClientsVersion flake red); gofmt -l
clean on both files; go vet -tags nogui on internal/gateway for
darwin, linux and windows; go build -tags nogui ./... on all three.

Review, changed from ggbdpq's patch: the session kept under the
conversation's next key is cut before the side question when it is
resumed. ggbdpq's patch resumed the shelved session whole, so the
suggestion's question and answer stayed in the history the model
reads on the conversation's next turn. A shelved session found by
behindKey is now copied up to the line before the side question
(cutBehind: cutSessionBefore at behindTurn for a -p run, cutSession
at behindLine for a TUI run, the branch point both already use), the
copy is resumed and the shelved file removed. If the cut fails, the
session is dropped and a new Claude Code is told the conversation, as
before the patch.

The test now checks the resumed session id is a new copy, that the
copy ends at a2 then a3 with one SUGGESTION left (the first one,
already taken back above a2), and that the resumed run is told a3
alone. Its fake Claude writes stdin lines with printf: sh's echo
turned the JSON's \n escapes into newlines, which split every line
and hid its uuid.

Broken by hand at the reviewed head: claude_subscription.go reverted
to its parent, the test red (no session kept); ggbdpq's own
claude_subscription.go put back, red at the cut check (the shelved
session resumed whole). Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq 8ea2d48fb2 fix(gateway): salt a relayed Messages reply's tool_use id the client has seen again (#4910)
Claude Code keeps every tool_use id of a session in one Set and drops a
block whose id it has already seen; a turn whose only block is dropped
becomes "[Tool use interrupted]", and the agent loops on calls that did
run (#4910). An upstream that speaks Messages itself and is relayed as it
came may number its calls' ids by their place in the reply (LiteLLM's
bridge: fc_0 on every turn), so the id one turn went out under comes again
on the next, and every later call of the session is dropped.

A relayed reply's tool_use id the client already holds — an assistant
block of the request the reply answers, or one the reply itself said
before — now goes out under the mark, the upstream's own id and a fresh
salt, which nothing the client holds names; an id the client has seen no
more goes as it came, so an upstream whose ids are its own is relayed
byte for byte. The answer comes back under the salted id and goes to the
upstream as the id it gave, on the call and on the result answering it,
so a strict upstream keeps its own pairing and its prompt cache.

A reply translated from another wire needed nothing: the model's own
call ids pass through there, one fresh a reply.

Run: TestMessagesRelayedToolUseIDsUniqueAcrossTurns fails on the old
code with the one fc_0 on both turns and passes with the change;
TestMessagesRelayedToolUseIDsUniqueInATurn,
TestMessagesRelayedOwnToolUseIDsUntouched,
TestMessagesTranslatedToolUseIDsUniqueAcrossTurns green.

Review, changed from ggbdpq's patch: anthropicInID gives a salted id
back unchanged. Without that, a salted id that a later turn sends to
an upstream of another wire (a group that moved on) was decoded into
the upstream's id plus the salt's NUL byte, and went out with the
NUL. TestSaltedToolUseIDTranslatedAsHeld (added in review) checks it,
and that anthropicOutID's ids still round-trip.

Broken by hand at the reviewed head: the salting turned off in
gateway.go, the three relayed-uniqueness tests red (the translated
and own-id tests stay green, as they should); the anthropicInID guard
removed, TestSaltedToolUseIDTranslatedAsHeld red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq cc22efebb7 davsync: a 403 on the write names the folder it went to, and a full quota (#4927)
The error for a write the server refused, with the address's folder
listing fine, said the account couldn't write in that folder (/dav) -
but the write went to magpie's own folder inside it, and the listing
never proved anything about writing. On 坚果云 (Nutstore) the refusal
is usually the free tier's upload quota used up, which answers 403 on
a PUT with everything else fine (#4927), so the old text sent the user
to check a thing they can't check.

The error now looks at magpie's own folder first: there, the server
refused to change files in it, and the text says so and mentions the
quota; missing, the server refused to have magpie make it, and the
text says to make the folder by hand, or put an existing folder in
the address.

Review, changed from ggbdpq's patch: the folder is named with
path.Join(dir, folder). The patch's dir+"/"+folder said "//magpie"
for an address with no folder of its own (dir "/"). The test now
covers that address too. Broken by hand at the reviewed head:
dir+"/"+folder back, TestDAVWriteRefused red; dav.go reverted to its
parent, red; restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq 8f6dacbf7f gateway: a browser's CORS preflight from another machine is answered, not asked for a key (#4931)
From the report (magpie 0.1.2698, macOS 27.0.1, LAN sharing on, gateway
port 3425): a page at https://learn.trancy.org, listed in Settings ->
Network and sharing -> Web pages, failed to add itself as a custom
engine ("Failed to fetch"). The same OPTIONS preflight for /v1/models,
declaring GET and the authorization header with no key on it, was
answered 204 with the CORS headers at http://127.0.0.1:3425 and refused
401 with no CORS headers at the machine's LAN address and behind an
HTTPS reverse proxy (Nginx Proxy Manager, no CORS handling of its own);
the browser logged net::ERR_FAILED,
corsError: PreflightMissingAllowOriginHeader, and gave up before the
keyed POST. The 401 body was the gateway's own "no API key was sent:
send a magpie gateway key as Authorization: Bearer <key> (or
x-api-key)".

lanGuard sits in front of Handler (Front, oneport.go), and corsGuard is
inside Handler, so a request from another machine met the key check
first: with the gateway shared (or listening on the network),
identifyCaller refused the keyless preflight 401 before corsGuard could
see it. On loopback lanGuard asks no key, which is why the same
preflight was answered there. A preflight is an OPTIONS that declares
the call to come, and per what CORS asks of it carries no key and no
body: the browser cannot send one.

lanGuard now hands a preflight (corsPreflight: an OPTIONS with an
Origin and an Access-Control-Request-Method) to corsGuard instead,
after the allow list and the shared/on-network rules have judged it as
they judge every request. corsGuard answers a listed origin's with its
204 and headers and refuses any other page's as on loopback; the call
the preflight asks after still needs an enabled gateway key, and an
OPTIONS that declares no call is no preflight. `magpie web`'s page
port, which hands client routes to the same Front, is covered by the
same change.

Tests (internal/gateway/cors_test.go), from the report's three-row
table:
- TestCORSPreflightFromLAN: the loopback preflight answered 204 (the
  row that already worked), the LAN-direct one and the reverse-proxy
  one (X-Forwarded-For, loopback peer) answered 204 with Allow-Origin
  and Allow-Headers; an unlisted origin's preflight refused with no
  CORS headers; a keyless GET and a plain OPTIONS from the LAN still
  401; a preflight while magpie isn't shared still refused.

Broken by hand (the preflight handoff taken back out of lanGuard): the
LAN-direct and reverse-proxy rows go red, 401 with the report's own
error body, while the loopback row stays green; restored, ok.

Run (macOS arm64, this tree, -tags nogui):
- go test -run 'TestCORS|TestLAN|TestForeignPages|TestOpaqueOrigin|
  TestLocalhostSubdomain|TestRebound|TestOnePort|TestFront'
  ./internal/gateway: ok.
- the same with -race: ok.
- go vet ./internal/gateway, and with GOOS=linux and GOOS=windows: ok.
- go build . with GOOS=darwin, GOOS=linux and GOOS=windows: ok (the
  darwin cgo enum-conversion warnings in internal/gui are pre-existing).
- gofmt -l on the three touched files: clean.
- go test -count=1 -timeout 50m -tags nogui ./internal/gateway: every
  test ok except TestCodexPoolSaysTheClientsVersion, the known #4807
  (another test's Codex identity reaches it in a full package run); it
  passes run alone at this head.
- go test -tags nogui -count=1 ./internal/access ./internal/settings .:
  ok. ./internal/gui: TestProxyCheckSaysAProxyPassedBy fails, and fails
  the same way run alone on the untouched base a3768cdd1 — this
  machine's environment, not this change (the test drives checkProxy's
  ALL_PROXY walk, nothing of the gateway).

Not tried: a real Trancy page against a real LAN address and a real
Nginx Proxy Manager install; the report's LAN and proxy rows are taken
from its measured curl and browser evidence, and reproduced here at the
lanGuard/corsGuard seam with httptest instead. A preflight arriving
while magpie isn't shared is still refused, so the browser reports the
preflight, not the later call, as the failure — the network's rules
come first, as the report asks.

Review, changed from ggbdpq's patch (security): the patch let every
keyless preflight from another computer past lanGuard's key check.
corsGuard passes some unlisted origins on with no key (a page on this
computer by name or address, *.localhost, the request's own origin,
an app's or extension's scheme), and a route that takes OPTIONS
(Codex's backend relay, the MCP paths) would then serve such a
"preflight" with the user's sign-in. lanGuard now hands on only a
preflight whose origin is listed (corsAllowed); every other one meets
the key check as before, Origin null included. No request other than
an OPTIONS with Origin and Access-Control-Request-Method skips the
key: a POST, GET or DELETE carrying a preflight's headers is 401.

TestCORSPreflightFromLANReachesNothing (added in review) sends a
keyless preflight from the LAN for Codex's relay, an MCP path and
/v1/models from localhost, 127.0.0.1, foo.localhost, the request's own
origin, an extension, app://, null and a foreign site: none reaches
the handler or gets CORS headers. The listed origin's is answered by
corsGuard alone, and other methods with its headers are 401. A
rebound page never gets here: lanGuard's rebound check runs on
loopback first, and from the LAN the key check stands. Broken by
hand at the reviewed head: the corsAllowed condition removed, this
test red (TestCORSPreflightFromLAN stays green); the whole handoff
reverted, both red. Restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq 0bffc1c5db fix(plugin): a silent stream's read gives the fetch up after thirty minutes (#4934)
What changed: a reply body's Read now ends bodyIdleWait (five minutes)
after the last byte the plugin sent, gives the fetch up and says so,
when nothing more comes. The wait is between bytes, not the reply's
whole length: every chunk resets it, so a stream a slow model keeps
fed goes on however long it talks.

Why: a network drop mid-stream can leave a local proxy's socket open
but soundless, and a plugin body's read ended only on a chunk, an
answer, a close, a cancelled ctx or the host's death — none ever came,
so the request hung until the client cancelled it, with no error frame
and no retry (#4934). The gateway's relay already ends a stream whose
read fails with a protocol-valid error event; what the plugin leg
lacked was any read that fails. Five minutes is the silence the
gateway itself holds a client through (keepaliveLongest) before
leaving a stuck stream to a timeout; this is that timeout for a
plugin's reply. The wait for the reply's head is another wait and
stays as it was — this issue is a stream already past its first token.

Run: the new TestHostBodyIdleEndsASilentStream failed before the fix
(a read held for ever) and passes after; TestHostBodyIdleSparesAFedStream
locks the between-bytes reading. go test ./internal/plugin/
./internal/gateway/ ./internal/provider/ -tags nogui, the host tests
under -race, gofmt, go vet and go build all pass, with pre-existing
failures on this machine only (TestHostToldTheGatewayAddress, also red
on a clean upstream/main; TestCodexPoolSaysTheClientsVersion, the known
flake, green on a rerun).

Review, changed from ggbdpq's patch: the wait is thirty minutes, not
five. Five minutes cut replies that are silent for their whole
generation and come in one burst at the end (a model at its highest
effort, a relay that buffers its reply): those run past ten minutes,
and the gateway already keeps a translated reply's client alive
through thirty (translatedQuietLongest). A dead connection's read now
ends at that bound instead of never; the reporter's 4m52s case still
waits on the client to cancel first, which is the trade. The text
above that says five minutes and keepaliveLongest is the patch's
first version.

Broken by hand at the reviewed head: the idle timer (its start and
its reset) set to 1000h, TestHostBodyIdleEndsASilentStream red after
its 5s bar; restored, green. TestHostBodyIdleSparesAFedStream guards
against a whole-reply deadline, not a mutation of this code: with the
reset taken out it stays green (a stopped timer never fires).

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq 29bd947c62 plugin: a lapsed account kept first doesn't say the provider fell back (#4917)
The provider's own row took fellBack and listError from its first
account's listing, whatever stood first in the sign-ins. With a lapsed
sign-in kept under the provider's own key beside a live account (a Kiro
oauth the vendor turned away beside the API key in use), the provider
said its list had fallen back although the live account's list told it:
the models are the accounts' union, so the provider falls back only when
no account tells a list of its own. Reading that row, keepListed put the
last list told over the fresh one and the relist stopped dropping the
picks of models the vendor no longer lists, for as long as the lapsed
account stood first; magpie plugin list said the provider fell back.

The last list told is still kept where every account fell back.

Review: applied as ggbdpq posted it (patch sha256 checked against the
issue's). Broken by hand at the reviewed head: host.js reverted to its
parent, TestLapsedFirstAccountKeepsTheProvidersList red; restored,
green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
ggbdpq d97e52aea5 draw: Loomy's Hy-Image generators draw on the images API (#4913)
iFlytek's Loomy gateway serves three image generators, each listed in
its /v1/models with type "image": Hy-Image-3.5-preview,
doubao-seedream-5-lite, qwen-image-3.0-pro. An OpenAI-compatible plugin
in front of it lists all three, and the reporter measured all three
answering a normal OpenAI-shaped draw on the images API with a 200 and
a URL each.

qwen-image and seedream match catalog.ImagesAPI's words, so those two
reach Settings' image generation picker and draw. hy-image matches only
DrawsID's "image", so Hy-Image-3.5-preview stayed a chat model with no
way to pick it for drawing — the same reason WorkBuddy's Hy-Image
models need their wbDrawers path.

Add "hy-image" to ImagesAPI's words: the model is then a drawer on the
plugin's row like the other two, and the gateway asks it on the images
API instead of chat. No other model's answer changes — every id the new
word catches was already a drawer by DrawsID's broader "image"; only
where it is asked moves.

Test: TestLoomyPluginDraws (internal/gateway) installs a fake Loomy
plugin listing the three generators beside a chat model, checks Drawers
lists all three, and draws Hy-Image-3.5-preview (images API, image
back, chat never asked). Broken by hand: without "hy-image" it is red
(drawers [doubao-seedream-5-lite qwen-image-3.0-pro], the Hy-Image one
missing).

Review: applied as ggbdpq posted it (patch sha256 checked against the
issue's). Broken by hand at the reviewed head: catalog.go reverted to
its parent, TestLoomyPluginDraws red; restored, green.

Run at the pushed tree (this stack of nine on origin/main 3c2dceb34),
on mote (macOS arm64, Go 1.26.8):
- go test -count=1 -timeout 45m ./internal/catalog/...
  ./internal/plugin/... ./internal/davsync/... ./internal/gateway/...:
  catalog, plugin and davsync ok; gateway red on one test only,
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity reaches it in a full package run). It passes run
  alone at this tree, 3 of 3.
- go vet ./... (darwin); GOOS=linux and GOOS=windows go vet -tags
  nogui ./...: ok. gofmt -l on every tracked .go file: clean.
- The hand breaks above ran on this stack before its rebase onto
  3c2dceb34. That commit changed member.go only, nothing these tests
  reach.
Not tried: the GUI suite, since no GUI file changed. Windows and Linux
test runs (the Claude bridge tests use a shell fake and skip on
Windows). No real vendor, Claude Code or network was used; every
case runs against fakes.

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-03 07:43:18 +08:00
yetone 3c2dceb340 gateway: "member" in Model name in replies names the member to Claude Code and Codex too (ZoeCats)
ZoeCats (Discord #feedback, after v0.1.2760): with Settings › Models ›
Replies › Model name in replies on "vendor" the name is no longer written
over, but on "member" (作答的成员) a reply still didn't name the routing
group's member that answered.

Cause: replyNamingOf turned the "member" setting into the model asked for
whenever the agent was Claude Code, Claude Desktop or Codex (vendorNamed,
kept from #822's memberModel). ZoeCats's agent is Claude Code, so the
setting did nothing for them, while "vendor" was already for every agent.
The setting was saved and read as it should be (the vendor choice worked
through the same path), and an absent X-Magpie-Response-Model falls
through to the setting.

Fix: the user's pick is for every agent. Those three already take a
provider/model id back under the default (the group or provider/model
they asked for), so the member's provider/model id is no new shape for
them. vendorNamed, replyNamingOf's unused agent argument and the dead
namesMember are gone. The menu's note for "member" says "for every agent,
groups included" in en, zh, zh-TW, ja and de; settings.go's comment and
gateway-routing.md say the same.

Tests (fake upstreams, no network):
- TestReplyNamesMember: "on, codex", "on, claude code", "old file on,
  codex" now want the member, plus "on, claude desktop" and "on, codex,
  name asked" (the header still wins), on 6 paths x streamed or not, each
  after a failover in a group.
- TestPluginReplyNamesMember (new): a group served by the fake plugin,
  Chat and Messages, streamed and whole, with no token and Claude Code's,
  member and default.
- TestGeminiReplyNamesAskedModel: also with replyModel member and vendor.
- reply-model-setting.test.cjs: the member note says every agent and
  names no Claude Code.
Red on origin/main db7c57670 with only the tests changed: every
codex/claude code/claude desktop member case of TestReplyNamesMember
and the four Claude Code member cases of TestPluginReplyNamesMember
(the reply named group/chat, group/claude). Gemini and plugin member
cases without a vendorNamed token were already green.

Run on mote at this tree (on origin/main db7c57670, the pushed base):
- gofmt -l internal/ clean; GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of ./internal/gateway ./internal/settings clean.
- go test -tags nogui -count=1 -timeout 45m ./internal/settings
  ./internal/settingsapi ./internal/gui ./internal/cli ./internal/gateway:
  settings, settingsapi, gui, cli ok; gateway ok except
  TestCodexPoolSaysTheClientsVersion, the open #4807 (another test's
  Codex identity; red in the full package, green alone), untouched here.
  TestReplyNamesMember, TestPluginReplyNamesMember and
  TestGeminiReplyNamesAskedModel pass.
- node --test reply-model-setting + i18n-keys (chromium + webkit, 5
  languages, 1100 and 420 wide): 26 pass, 0 fail.
Broken by hand: the tests alone on the old member.go (above) were red.

Not tried: a real Claude Code or Codex session reading the member's id
back (the default already gives them a provider/model or group id); a
real vendor account through a real group.
2026-11-03 07:15:52 +08:00
yetone db7c576706 update: a list of the newest 40 says how many releases there are in all
sujingshen on X, v0.1.2606 to v0.1.2762: the update sheet read "40 个版本"
for about 156 releases. The app keeps only the newest update.MostNotes
(40) and counted the list it kept, so the line named the cap, not the gap.

update.NotesBetweenTotal returns the count of every release in the range
beside the capped list. /api/update/notes and /api/whatsnew send it as
`total` when it is more than the list, and mergedNotes then reads
"156 releases · the newest 40 shown, v… – v…" (en, zh, zh-TW, ja, de).
Settings' What's new, where withWaiting puts pending releases first and
cuts again, sends no total, since that count was of the installed ones.

Run on mote at this tree: gofmt -l internal clean; GOOS=windows go vet
and GOOS=linux go vet -tags nogui of internal/gui and internal/update ok
(the cgo Linux vet needs gtk4/webkitgtk dev packages neither mote nor
magpie-desktop has); go test ./internal/update ok (new
TestNotesBetweenTotalPastTheCap: 56 releases keep 40 with total 56, 6
keep 6 with total 6); go test ./internal/gui ok except
TestMainWindowCorners, the macOS 27 red of #3949. GUI files in chromium
and webkit: update-notes-ask 16/16 (new: a list cut short says how many,
en and zh), whats-new 4/4 (new case: 156 in all), whats-new-range 12/12,
whats-new-failed 4/4, i18n-keys 4/4.

Not tried: a real update from an install 156 releases back.
2026-11-03 06:35:33 +08:00
yetone cb7d7f9aa6 routing, usage: a request names who answered with the provider's logo (Jiabubu)
Jiabubu on Discord asked for the provider's icon before the answering
provider or account in the request lists. Routing's Requests rows now draw
icon(logoOf(member)) for the try's member (tried(r, tr)), the same logo the
request's story uses, between the dot and the name, at 14px. A request
nobody answered has no try and no logo. In Usage → Requests, the "Provider ·
account" cell holds the ledger's provider icon (l.providers) before
.where-name, inside a new .where-line. A row read from a session file
(source "log") names no provider for sure and gets none. .where-name's text
is unchanged. No new strings, no new icons.

Test: request-provider-icon.test.cjs. Routing has codex-color and
deepseek-color, none on the failed row, a 14px logo before and level with
the name. Usage has openai and zhipu-color, none on the log row, the name
alone in .where-name, the logo inside the cell. Chromium and WebKit, en zh
zh-TW ja de, at 1100 and 420px.

Run at the pushed head on mote: see the head run below. Also
routing-log-icons, routing-row-reuse, routing-live-patch, usage-ledger,
usage-ledger-search, usage-ledger-fit, usage-ledger-agent-middle,
session-identity, i18n-keys, phone-rows. Budget tests ok: app.js is
untouched, and the plugin files are outside the script budget.
Broken by hand: dropping the Routing logo makes 22 of 22 red; dropping the
Usage logo makes the Usage checks red in every case.
Not tried: the whole GUI suite (mote was busy with two other whole suites);
the real Windows app.

Head run (mote, 1e6a29337 on 173b7e274): Budget ok. The 16 files above plus
the two new ones: 242 ok, 6 red, all in usage-ledger's "newest live route
needs no return-to-live button", which is red the same way on 173b7e274 alone
(2 of 2; #3104, #4078). routing-row-swap, routing-steady, routing-steps-cap,
routing-story-shrinks, routing-order-unknown and routing-rule-* were red in
the wider run. Run at 173b7e274 and at this head together, they gave 26 and
25 reds in the same tests (#4932, #4628).
2026-11-03 06:25:07 +08:00
yetone 51dcb67383 routing: in a narrow window the accounts and keys sit several to a line (Jiabubu)
Jiabubu on Discord (Windows, 0.1.2738): with the window narrow, Requests and
Accounts and keys go one under the other, and every account or key then took
a whole line, so a page of many accounts ran far down. The cause is
routing.css: under 1150px .rt-acts stays a one-column block list. Now, when
the columns stack (not .min1150, or .solo), .rt-acts is a grid of
auto-fill columns of at least 168px. Each provider's heading and an open
"N accounts" summary row span the whole line. Beside the requests (1150px
and wider) the column holds one to a line, as before. No collapse arrows
and no other change to the page: once the list is compact the page is no
longer long.

Test: routing-accounts-narrow.test.cjs. At 700, 560 and 420px, four
accounts with two of them sharing a line, side by side; headings and the
summary row across the list; no sideways scroll; names inside their box;
one to a line at 1440. Chromium and WebKit, en zh zh-TW ja de.

Run at the pushed head on mote: that file 10/10. Also routing-columns,
routing-keys-fold, routing-group-fold, routing-compact and the rest of the
head run in the next commit's body; TestCoreScriptBudget and other
Budget tests ok (no script grew). Earlier, at dcc84dbc0, every routing-*,
panel-routing*, usage-ledger*, session-identity, i18n-keys and phone-rows
file: 1051 ok, 5 red. Four were load (a browser launch timing out at 180s)
and passed when run again alone. The fifth, routing-many-keys, is red on
origin/main 173b7e274 too (#4082, numbers added).
Broken by hand: routing.css at its base makes all 10 red (700px, one
account per line).
Not tried: the whole GUI suite (mote had two other sessions' whole suites
running at load ~200); the real Windows app at a narrow width.
2026-11-03 06:25:07 +08:00
yetone 173b7e2742 routing: the group being edited reads as selected, its Save in reach (Jiabubu)
Jiabubu (Discord, #feedback): on Routing, the group being edited
looked like the groups above it, and Save was a small text button at
the editor's foot, a long scroll down.

The editor in the groups list now reads as the selected row: a soft
accent tint (4% over the card) and a 1.5px accent ring all round, its
corners following the list's when it is first or last. No stripe down
one side. Its bar (Remove, Cancel, Save) is sticky at the bottom of
the view while the editor's rows scroll by, on the editor's own tint,
and sits where it always was once its foot is reached. Cancel and Save
are 28px tall at 13px (were 23px at 12px); the web's 44px touch size
still wins on a phone. The list clips its overflow instead of hiding
it (overflow: clip, with hidden as the fallback), so the bar can
stick. Nothing else on the page moves (#1354).

Measured, editing the third of four groups (a ten-member group) with
its head near the top of a 760px window: Save was at y 1845 (1000
wide) and 3013 (420 wide), out of sight; now at 714 and 694, in sight,
in Chromium and WebKit.

group-editor-selected.test.cjs, in Chromium and WebKit, desktop and
web, 1100/770/420 wide, en/zh/zh-TW/ja/de (and dark in zh): the editor
is tinted apart from the other rows and has a ring, both sides alike;
scrolled by the reader to its head, Save and Cancel are in the window,
uncovered, 28px and 13px or more; scrolled to its foot, the bar
follows the last row inside the editor.

Broken by hand: with origin/main's routing.css it fails at "light
desktop 1100 en: the editor is tinted apart from the other groups";
with only the list's overflow: clip taken out, at "Save is in the
window (1353-1381)".

Run on mote at this tree (on origin/main 8abdf53a8), with mote at load
164-191 from other sessions: the new test 2 of 2 ok; the GUI files this
can reach (360 files, every one naming a usage card, the panel card, the
routing page, app.css, i18n or a budget; both engines, every language,
narrow widths), 5573 of 5668 ok. The 22 red files were run again alone at
this head and at 8abdf53a8: three were this change (routing-save-blank
and routing-save-keeps-the-row wheeled until Save was in sight, which it
now is at once, so they wheel to the editor's foot; quota-holds took a
faded "not enough data" as muted, now the reset line's caption colour),
fixed here and green at concurrency 2. The rest are red at 8abdf53a8 too
(account-eye #4244, routing-rule-* #4585, tray-cell-click and usage-fold
#4790, numbers on #4932). The whole suite was started once and stopped at
316 tests after an hour at that load; it was not run to the end.

Rebased on origin/main 1851ead1a (app.css and the usage page changed),
then run again at the pushed head: go test -run 'Budget|CSS' ./internal/gui
ok, and quota-caption-contrast, group-editor-selected, quota-holds,
routing-save-blank, routing-save-keeps-the-row, plan-credits and
balance-fix, 154 of 154 ok in both engines.

Not tried: the real app's window, and WebKitGTK on Linux.

Reported by Jiabubu on Discord (#feedback).
2026-11-03 05:50:10 +08:00
yetone 95a61a5d18 usage: a card's captions read at 4.5:1 on the card (Jiabubu)
Jiabubu (Discord, #feedback) found the Usage Overview cards' captions,
"重置于 …", "本周期" and a curve's dates, small and hard to read in
both themes. They were --faint: 1.95:1 on a light card, 2.16:1 on a
dark one, under WCAG AA's 4.5:1.

Every caption on a card is --muted now: a window's reset line, the
curve's range and axis dates, "Last reading", a balance curve's pace,
a credit day's note, the all-accounts head and its unknown, a card's
error line, and on the tray panel's allowance card .pq-sub, .pq-rn,
"until …" and an auto-reset's used line. Light's --muted is 3.66:1 on
white, so a card (and its tinted all-accounts box) takes --ctl-fg,
the token documented as a control's quiet text at 4.5:1 on every
surface; dark keeps its --muted. The reset line's "held" reason lost
its 0.75 opacity (it read under 4.5:1); it keeps the caption colour. Sizes are unchanged; the figures keep --fg-2 at 600.

Measured in the page (Chromium and WebKit, same numbers):
  Usage card, light: captions 1.95 -> 5.95:1; figures 8.64:1
  Usage card, dark:  captions 2.16 -> 4.64:1; figures 8.03:1
  Panel card, light: .pq-sub 2.79 -> 5.95:1
  Panel card, dark:  .pq-sub 3.66 -> 5.54:1 (computed from the tokens)

quota-caption-contrast.test.cjs checks every caption on a Usage card
at 4.5:1 or better, each below the card's figure by 1.5 or more, and
the panel card's captions at 4.5:1, in Chromium and WebKit, light and
dark, en/zh/zh-TW/ja/de, at 900 and 420 wide.

Broken by hand: with origin/main's app.css it fails at "light en 900:
.quota-reset reads at 1.95:1"; with only .pq-sub put back on --faint
it fails at "light en panel: .pq-sub reads at 2.79:1".

Run on mote at this tree (on origin/main 8abdf53a8), with mote at load
164-191 from other sessions: the new test 2 of 2 ok; the GUI files this
can reach (360 files, every one naming a usage card, the panel card, the
routing page, app.css, i18n or a budget; both engines, every language,
narrow widths), 5573 of 5668 ok. The 22 red files were run again alone at
this head and at 8abdf53a8: three were this change (routing-save-blank
and routing-save-keeps-the-row wheeled until Save was in sight, which it
now is at once, so they wheel to the editor's foot; quota-holds took a
faded "not enough data" as muted, now the reset line's caption colour),
fixed here and green at concurrency 2. The rest are red at 8abdf53a8 too
(account-eye #4244, routing-rule-* #4585, tray-cell-click and usage-fold
#4790, numbers on #4932). The whole suite was started once and stopped at
316 tests after an hour at that load; it was not run to the end.

Rebased on origin/main 1851ead1a (app.css and the usage page changed),
then run again at the pushed head: go test -run 'Budget|CSS' ./internal/gui
ok, and quota-caption-contrast, group-editor-selected, quota-holds,
routing-save-blank, routing-save-keeps-the-row, plan-credits and
balance-fix, 154 of 154 ok in both engines.

Not tried: the real app's window (the GUI suite's pages only), and
the menu bar cells, which have their own colours.

Reported by Jiabubu on Discord (#feedback).
2026-11-03 05:50:10 +08:00
yetone 1851ead1a7 library: Pi and omp lock ~/.agents/skills from their versions; Put skills in links every skill there
usrname1833 on Discord asked for two things.

Pi reads ~/.agents/skills itself, so a skill kept there is Pi's whatever
is ticked, with the lock as Codex and OpenCode have. Pi started to in
0.54.0, not 0.19 (its CHANGELOG; userAgentsSkillsDir in
package-manager.js), and omp in 11.0.0 (src/discovery/agents.ts; 10.6.2
doesn't). Target.SharedToo says so from the version, and every reader of
readsShared goes through Target.readsSharedDir: Always (the lock),
syncSkills' inShared (no second link) and a handover's readsSharedHere.
OmO's senpi reads it in every npm version (0.74.0 up), so omo joins
readsShared. A Pi or omp of no known version is taken as older, as
before.

The second ask is a switch: Library > Skills > "Put skills in": each
agent's own folder (the default, today's behaviour) or ~/.agents/skills
(Library.SharedSkills; POST /api/library/skills/where {how};
magpie library skill where agents|shared). On, every library skill on
here gets magpie's link in ~/.agents/skills (syncShared, after
sweepShared), so every agent and tool reading that folder has it and
shows it locked. The files stay in the library rather than moving, so
updates, edit tracking and Off here keep working; existing skills just
get links when it is turned on, nothing is moved. A user's own entry by
the same name is never written over. Off takes out magpie's links there
and nothing else, and agents' own links come back. Per computer:
Collect doesn't carry it. docs/subsystems/library.md says all this.

Not covered, filed: on Windows without link rights the shared entry is
a marked copy, and takeEdits doesn't take edits made in it (#4958).

Run on mote rebased on d76c4b23a (which has 8abdf53a8):
gofmt -l clean; go vet GOOS=linux and GOOS=windows on internal/library,
internal/gui, internal/cli ok; go test internal/library, internal/gui,
internal/cli ok. GUI, every skill-*, library-* and i18n-keys file in
chromium and webkit: 1302 pass, 4 fail, all in library-all (webkit) and
library-null-agents (chromium). Both pass alone at this tree (52/52), so
they are load reds, filed as #4967. skill-where.test.cjs (new) covers en,
zh, zh-TW, ja, de at 900px and 400px. Before the rebase, cli's
TestEveryRouteHasACommandOrIsNamed was red on /api/usage/checkin-account
(not this change); it is green at this base.

Rebased twice more on origin/main (cli's settings_parity_test, app.js,
i18n.js, settings): internal/cli and internal/gui go test ok, i18n-keys
and skill-where green at the pushed tree.

Broken by hand, each red, then restored: since() always false
(TestPiReadsSharedSkillsFromItsVersion, TestSkillsWhereShared red);
syncShared step dropped (red); sweepShared's keepsShared keep dropped
(red on the SameFile no-relink check); the holder line in wanted
(TestSkillsWhereSharedWithKimi red); skillWhereBar not appended
(skill-where 0/11 per engine).

Not tried: a real Pi, omp or OmO run (versions read from their npm
source); the setting on the Windows box or in WSL; the whole GUI suite.
2026-11-03 05:43:12 +08:00
yetone 91379b9339 settings: a reply's model can be the vendor's own name again, the member, or the model asked for (ZoeCats)
ZoeCats (Discord #general): since v0.1.2473 a reply's model says the name
the client asked for (a group or provider/model id), groups that aren't
aggregates included, and the only way back to the vendor's own text was the
X-Magpie-Response-Model header, which their client can't send.

Settings › Models › Replies › Model name in replies (replyModel), picked
from the app's menu, in en, zh, zh-TW, ja and de:
- "" the model asked for (the default, as now);
- member: magpie's provider/model that answered (what memberModel did;
  Claude Code, Claude Desktop and Codex still get the name asked for);
- vendor: the vendor's own text, for every agent, the vendorNamed three
  included, as every agent got before v0.1.2473 and as the header's
  "vendor" already gave them.
X-Magpie-Response-Model (asked, member or vendor) still picks for its
request; an unknown value falls through to the setting, as before.

memberModel is folded in without changing anyone's choice: a file with
memberModel on reads as replyModel member, an explicit replyModel wins, and
memberModel is written beside it as a mirror so an older magpie reads the
same. An older page sending only memberModel changes the setting only when
its switch moved (a vendor choice survives its saves). The CLI's set/reset
goes through Keys/Choices (replyModel in place of memberModel).

app.js's row is paid for by five comments in Settings' code cut down:
app.js is 145 bytes under its base, no budget raise.

Run on mote at this head (rebased on origin/main b328a7790):
- gofmt -l clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows
  go vet ./... clean.
- go test -tags nogui -count=1 -timeout 45m ./internal/settings
  ./internal/settingsapi ./internal/gui ./internal/cli ./internal/gateway:
  settings, settingsapi, gui, cli ok; gateway ok but
  TestCodexPoolSaysTheClientsVersion, red in the full package and green
  alone (#4807, another test's Codex identity; passed alone at the
  previous head).
- GUI (node --test, chromium + webkit): reply-model-setting (5 languages x
  1100/420, plus default-to-member), loop-guard-setting, i18n-keys,
  account-discovery, disabled-models, masking-records,
  refusal-retries-setting: 222 pass, 0 fail.
- Whole GUI suite earlier at d73b208ac's tree: reds in account-eye (#4244)
  and segs-press-redraw's "every Settings option" (#4566, searchAllRow;
  red the same at origin/main b328a7790, run alone), plus load reds in
  unrelated pages; none in Settings' Replies.

Rebased again onto f3681b90c (Agents page, usage, claude /usage) and
run there: internal/gui and settingsapi -run Budget|SettingsSave|Keys ok,
settings TestReplyModel ok, i18n-keys + reply-model-setting 26/26.

Broken by hand (each red, then put back):
- replyNamingOf ignoring the vendor setting: TestReplyNamesMember's
  vendor, vendor+codex, vendor+claude code cases red on every protocol.
- normal() without the memberModel fold: TestReplyModelFoldsMemberModel
  and TestReplyNamesMember's "old file on" red.
- Merge without the old page's memberModel rule: TestReplyModelSaves'
  old page turns it on / off red.
- settings_keep_test.go went red at the earlier head (MemberModel not sent),
  fixed by setting replyModel member there.

Not tried: a real vendor account through a real group; the GUI test was not
run against the old app.js (the row doesn't exist there).
2026-11-03 05:38:18 +08:00
yetone 39f83063ce provider: WorkBuddy's mover min is 0.2.16, Extra credits beside the plan's (Jiabubu)
Jiabubu (Discord, magpie 0.1.2738, Windows): a WorkBuddy account's quota
line under Routing → Accounts and keys showed the plan's Credits only,
with no extra credits (gifted, promo, bought). Fixed in the plugin,
magpie-community/plugins 52fff4d (workbuddy 0.2.16): "Extra credits" is
every kind but the plan's base, as WorkBuddy's own usage panel and the
summary's CreditGroups say (plan_bonus, addon, benefit), so a Pro
account's plan bonus no longer sits inside "Credits". This raises the
min so keepMovedCurrent brings every moved user to it.

npm view --prefer-online @magpie-community/opencode-workbuddy-auth
version: 0.2.16, before this commit.

Run on mote at this tree: gofmt -l internal/provider clean; go vet and
go test ./internal/provider -count=1: ok. The plugin's own run is in its
commit (whole plugins repo 4872 pass, 0 fail).

Not tried: a real account with extra credits on screen. The owner's
WorkBuddy AI account has plan base credits only (its card reads
"0.19 / 100", unchanged), and the China account's meter answered 401.
2026-11-03 05:34:34 +08:00
yetone f3681b90c3 gui: the Agents page says a model's load by the picked model and in its picker (axelburks on Discord)
axelburks (Discord #feedback) could see a model's load only on its
provider's page, too deep to judge which model to pick on the Agents
page. A plugin's reported load (magpie.load) now shows there too, as the
same quiet grey badge the provider page uses:

- by the picked model in each agent's model row, before the chevron;
- on each row of that row's model picker, after the speed.

GET /api/model-loads (speeds.go) answers every fresh load (LoadFresh,
5 minutes) by "provider/model" lowercased, the ref /api/model-speeds
uses: plugin.FreshLoads copies the fresh entries under one lock, and
provider.ModelLoads keys them by magpie's provider id, the user's own
listed id too (ModelIDs), with model@size falling back to its model as
ModelLoad does. With no plugin reporting it is one lock and an empty
map. The page reads it when a model picker opens and with the Agents
page's 15s drift check, each throttled to once per 30s, and the drift
read only while a row shows a magpie model. No new poll; /api/state and
Option are unchanged. The core script stays under its budget
(1,533,802) by shortening comments in the picker and agent-row code;
no budget raised. The
route is named in the CLI's route list (read-only, U) like model-speeds.

Run at this head (rebased on origin/main b4073c06a; the rebase onto
dcc84dbc0 touches none of these files), on mote:
- go test ./internal/gui (TestModelLoadsByRef, TestModelLoadsNoneReported,
  budgets) ./internal/plugin ./internal/provider ./internal/cli: ok,
  except TestEveryRouteHasACommandOrIsNamed's POST
  /api/usage/checkin-account, red on main (#4826, e87140242).
- Full go test ./... -timeout 45m before the rebase: 84 packages ok;
  reds were TestEveryRouteHasACommandOrIsNamed (this route, now named,
  and #4826), TestCodexPoolSaysTheClientsVersion (#4807, full-package
  run only) and TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27).
- go vet for darwin, GOOS=linux -tags nogui and GOOS=windows on
  plugin, provider, gui, cli: ok. gofmt -l: clean.
- agent-model-load.test.cjs: chromium and webkit, 1000 and 440px, en,
  zh, zh-TW, ja, de: 40 of 40. Screenshots looked at in both engines.
- Whole GUI suite: not finished. Three whole-suite runs (WSL, mote) were
  cut at 1,266 and 642 tests by load and a session restart; their reds
  were all in provider-editor, Settings and Usage files. Then the files
  a new API call or the Agents row can reach (183: every agent-*, every
  model/picker/speed/load file, the five strict-fixture files, every
  file using .field, ag-open, renderAgents or /api/drift, i18n-keys),
  split mote/WSL, both engines: reds only in model-chip-steady (#4388),
  mobile-web (#3952), model-copy-id (#4621), balance-fix (#4683),
  allow-ips (#4357, output added), agent-update-all (#2988), account-eye
  (#4244), models-works-only, models-select-all-api, model-suffix-own,
  provider-detect-models, provider-models-rest, remote-magpie,
  routing-rule-models, usage-speed (WebKit on WSL, #4218/#4471). Each red
  file was run alone at this head and at origin/main b4073c06a: the same
  reds both sides, except agent-update-all's fixed 200ms wait (#2988),
  red once at the head. codex-subagent-model, red under load, passed
  alone.

Broken by hand, each red, then restored: the picker row's badge line,
fieldBtn's badge line (red at the renderAgents redraw check), the
readLoads painter, and ModelLoads' listed-id loop (TestModelLoadsByRef).

Not tried: a real plugin reporting load in the live app; the tray panel
layout; WebKitGTK in the real Linux app and the Windows app.
2026-11-03 05:21:47 +08:00
yetone dcc84dbc04 usage: the Overview says each account's credits, and the period's (lcyksp)
lcyksp (Discord #feedback) asked to see the WorkBuddy credits (积分) the
calls spent, per account too, not only tokens. The summary already summed
each reply's usage.credit into every group's Totals, and the Requests
page's ranking showed it, but the Overview's Accounts, Models and Agents
rows and its tiles never said it. Each row's line now says "{n} credits"
when a reply said any, and the calls tile says the period's sum. No tile
is added, so the four-tile grid is as it was; the text was translated
already.

Run on mote:
- go test ./internal/usage ./internal/usageapi: ok. TestPlanCreditsByAccount
  (new) checks each account's sum in the summary and the Requests page;
  with Totals.count not adding credits it is red (summary a@x: 0 of 0).
- GUI, every usage*, i18n*, ledger and credits file (both engines):
  1322 pass, 31 fail. plan-credits' new Overview test (5 languages, 420px)
  is red with page.js as before ("WorkBuddy · 70 calls"). The reds are
  usage-agents-hide (#2276, #3414), usage-fold "most on one screen"
  (#4790) and usage-ledger's return-to-live (#3104, #4078, #4626). Run
  alone at d8a34cbcf they fail the same way.
At the pushed head (on b328a7790): usage and usageapi ok; plan-credits,
usage-accounts and i18n-keys 32 pass, 0 fail.
Not tried: a real WorkBuddy account's Overview in the app. Calls from
before replies carried usage.credit say no credits.
2026-11-03 05:16:57 +08:00
yetone 3a74cd92e8 claude: /usage waits for its figures, and a read without them is unknown
Seagull fries (haioushutiao, Discord #help; magpie 0.1.2704, Claude Code
2.1.316, Windows 11, Claude Pro): the Claude card said 暂时无法获取额度,
"Claude Code's /usage told no allowance: ❯ /usage ─── Settin s Status
Config Usage …". Reproduced with a real Claude Code 2.1.316 under
Windows' pseudo console in a sandbox: /usage's panel is drawn first with
"Loading usage data…" while Claude Code asks Anthropic for the figures
(5s timeout, retried only on a 401), and the helper took 3s of a still
screen as the panel drawn whole. On a slow answer it told the panel's
frame as the result, and parseClaudeUsage called any text with no window
"told no allowance". A failed load ("Error: Failed to load usage data",
"r to retry") went the same way.

claudetui:
- screen.go: a small terminal grid (CUP/CUU..CHA/VPA, EL, ED, ECH, CR/LF
  with scrolling, OSC/DCS skipped, an escape or UTF-8 character cut
  between reads kept), 200x50 on Windows as the pseudo console is made,
  80x24 elsewhere. The pseudo console sends only the cells that changed,
  skipping a cell that holds the same letter ("Settin\x1b[1Cs"), so the
  stream read split words and kept a redrawn digit beside the old one.
  While /usage is read, each look of the screen with a window is kept
  (panel), and usageText reads that before the stream.
- command(), built on b4073c06a's wait for the panel (ikunbots; its
  usageDrawn and "hadn't drawn" error kept, now also judged on the grid,
  since the pseudo console's split "Settin s" never matched its tabs):
  "Loading usage data" on screen is waited out (to
  commandWait, s.doing "was still loading /usage's figures" for the
  deadline message); "Failed to load usage data" gets one "r"; a panel
  still with no figure and loading or failed on screen is an
  error_during_execution result, "/usage couldn't load the plan's usage:
  <screen>".
- the fake draws the panel a frame at a time (fakeFrames), as Claude Code
  does: with one write, the pseudo console passed on only the last
  frame, which no longer shows the windows. TestShimReadsUsage now passes
  on Windows (#4820, the fake's side; a real panel with figures was not
  seen on Windows, see below).

provider:
- parseClaudeUsage: a panel with no figure is "Claude Code's /usage
  showed no usage figures: …", not "told no allowance" (kept for
  claudeUsageDenied's refusals).
- claudeUsageUnknown: Claude Code's "temporarily unavailable" and the
  helper's "couldn't load the plan's usage" keep the account's reported
  reading (quota_last), as the first did alone before. Other no-figure
  text is still shown as an error (TestClaudeHeaderSurvivesUnclassified-
  UsageFailure, TestClaudeUsageReadingAloneDoesNotHideUnclassifiedFailure
  hold that).

Fixtures are the reporter's case as the pseudo console passed it on for
the real 2.1.316 (a temporary dump of the helper's screen bytes, sandbox config,
proxy that never answers / refuses): testdata/usage-loading-win-2.1.316.bin
and usage-failed-win-2.1.316.bin.

Run at the pushed head:
- mote: go test ./internal/claudetui ./internal/provider ok; go test
  -run 'Claude|Usage|TUI' ./internal/gateway ok; GOOS=darwin/linux/
  windows go vet ./internal/claudetui ./internal/provider ok; gofmt -l
  clean.
- xiaomi-gpu (win-run): go test ./internal/claudetui: all pass except
  TestShimFirstMessageWaitsForTools, red on Windows at main (#4810).
- xiaomi-gpu, real Claude Code 2.1.316 (npm), sandbox CLAUDE_CONFIG_DIR
  with a fake token, magpie.exe built from this tree, helper run as the
  gateway runs it: a proxy that never answers gives is_error "/usage
  couldn't load the plan's usage: … Settings Status … Loading usage data…"
  after the 20s wait (was a success with the chrome); a refused proxy
  shows "Failed to load usage data", "r" is pressed, and the same error
  comes back in 6.6s. "Settings" is whole now.

Broken by hand (before the rebase onto b4073c06a; the merged loop is
re-checked below):
- old tui.go: TestShimWaitsForUsageFigures slow, retried and failed again
  all red, each telling the reporter's chrome as success.
- the "r" not written: TestShimWaitsForUsageFigures/retried red.
- old parse message: TestClaudeUsageWithoutFiguresIsUnknown red ("told
  no allowance"); old quota_last check: its couldn't-load cases red.
- after the rebase, on the merged loop: the "r" not written,
  TestShimWaitsForUsageFigures/retried red; the old "anything still 3s"
  in place of usageDrawn on the grid, TestShimWaitsPastTheBanner red.

Not tried: a real account (the box has none of the owner's), so a real
2.1.316 panel with figures was never seen through the pseudo console;
whether Claude Code's frames that show the windows reach the pseudo
console's output before it renders the next one is shown only by the
fake. Not taken: asking Anthropic's /api/oauth/usage, which the owner
ruled out (9bf6d4352).
2026-11-03 05:16:40 +08:00
yetone b328a7790b gui tests: balance-fix types the account token into its own box, not the proxy's password (#4683)
9c8636a35 (#3382) gave the Proxy field a login, so a new custom
provider's Advanced fold has a "Password (optional)" box before the
account balance token. The test took the second password input as the
token, typed it into the proxy's password, and the Balance URL hint
never came: every "Sub2API balance shortcut" case and "a token on a new
custom provider with no Balance URL" were red at main in both engines,
not only under load or on Linux (#4683, #4682). The token box is now
found by its own placeholder, in each language. The app is unchanged.

Run on mote: balance-fix.test.cjs, chromium + webkit, every language
and width: 100/100 ok at this head; at main 5ec237568 the same file was
red in every Sub2API case and the /api/user/self case.
Found by a debug run listing the editor's password inputs.
Not tried: other tests that pick a password input by position
(grepped: only balance-fix does in the editor).
2026-11-03 05:11:59 +08:00
yetone 311ec2ac0c provider: the Command Code mover installs opencode-commandcode-auth 0.1.22 (EDwinpzy)
0.1.22 sends reflection/beam each earlier assistant message's reasoning
back as reasoning_content, "." where the history has none, so Beam's
second turn is no longer turned away with 400 "Missing required
parameter: 'messages[N].reasoning_content'" (EDwinpzy on Discord,
#feedback, magpie 0.1.2717). A model the Provider API asks the same of
is asked once more with it and filled from then on; other models'
requests go as they came. keepMovedCurrent updates every moved user.

npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-commandcode-auth version: 0.1.22 (plugins
38ef050; publish run 41498900393 is red only for think-tags, plugins#180).

Run on mote: go test -count=1 ./internal/provider ok.

Not tried: a real Beam request; the Command Code key here answers 401.
The plugin's bun tests cover the reporter's two-turn shape as the
chat-completions and responses routes hand it to the plugin.
2026-11-03 05:10:44 +08:00
yetone 6c08ee13b0 gateway: a model asking for earlier reasoning back goes on to the group's next member
EDwinpzy (Discord #feedback, magpie 0.1.2717): Command Code's
reflection/beam:free answered a second turn with 400 "Missing required
parameter: 'messages[N].reasoning_content'". The 400 wasn't retryable,
so a routing group of Beam then Glyph ended at Beam and never asked
Glyph. The client's request is whole; it is that model's demand for
history it doesn't have, and another member's model may not make it.

reasoningBackRefused (thinking_back.go) reads the demand: DeepSeek's
"must be passed back" (thinkingBackRefusal) and words that name
reasoning_content as missing or required. shapeRefused and retryable
take it, so the member fails as a shape refusal (failShape): no rest,
the next member is asked once. refuseThinkingBack's refill still runs
first, inside forwardOnce. A 400 for a missing 'messages' or 'model'
still stops at the first member. The plugin side (commandcode 0.1.22
fills Beam's earlier replies with reasoning_content) ships separately.

Tests: TestGroupFailsOverAMissingReasoning (chat and responses routes,
the reporter's two-turn shape, his words in the Provider API's error
JSON) and TestMissingReasoningIsNotABadRequest.

Run on mote: go test -count=1 -timeout 45m ./internal/gateway: every
test passes except TestCodexPoolSaysTheClientsVersion, red in a full
package run and green alone, already filed as #4807 (another test's
Codex identity reaches it); go test ./internal/provider ok;
GOOS=linux and GOOS=windows go vet ./internal/gateway ok; gofmt -l clean.
After a rebase on 253aee08b (conflict with #4732's zhipuImageRefusal in
shapeRefused, both kept): the same packages and vets again, provider ok,
gateway red only for #4807 and TestCompactionOverByteCapEveryTime, which
is #4862 (red in a full run, green alone). At the pushed head, rebased on
d76c4b23a: TestGroupFailsOver*, the two new tests, ThinkingBack, Zhipu,
Webp, #4807's and #4862's tests ok in gateway; Mover/Moved/CommandCode ok
in provider.

Broken by hand: with reasoningBackRefused returning false (the old
classification), both new tests are red (400 from Beam, Glyph never
asked; shapeRefused and retryable false for every demand).

Not tried: a real Beam request (the Command Code key here answers 401),
so the error JSON around the reporter's words is constructed, not saved.
2026-11-03 05:10:38 +08:00
yetoneandggbdpq d76c4b23a4 sessions: Grok Build's own calls reach Usage, its turns through magpie left to the gateway (#4423)
liubing0806: with Local session selected, Usage lists Kimi's, Claude's,
Codex's and DeepSeek Harness's models and no Grok Build one, while Usage
→ Sessions shows the same sessions' grok-4.7-build tokens. Grok Build
had no call reader.

From ggbdpq's patch (via gua2100): calls_grok.go reads the updates.jsonl
the Sessions page reads, as parseGrok counts it. Each turn_completed is
a call per model in its modelUsage (input without what the cache held),
at the line's time; an empty modelUsage falls back to the session's
model. A subagent's folder is its own session; a fork counts lines from
its created_at on. It is a line source (lineCallReaders): a grown file is
read on from where the last read stopped, its carry kept in the disk
shard as Pi's is.

Added here: the patch left a turn asked through magpie's gateway to
gatewayMatches, and said such a turn may land in both ledgers. It does:
a turn_completed sums every request of the turn per model (modelCalls 7
and 17 in liubing0806's report) under the model the reply named
(moonshotai/Kimi-K3 for magpie's group/auto-kimi-k3), so no gateway row
matches it one to one. The model a turn was asked on is in its prompt's
user_message_chunk (_meta.modelId), and a turn asked on one of the
[model."magpie/…"] tables magpie writes in Grok Build's config.toml (by
table name, its model, or the magpie/ prefix) is the gateway's and left
out here. With no prompt line read, the session's model decides. The
carry keeps the asked model (Asked) across reads.

Run at this tree on mote: go test ./internal/sessions ./internal/usage
./internal/otlp ./internal/tune ./internal/davsync -count=1: ok;
go test ./internal/sessions -run Grok -race: ok; gofmt clean; go vet
GOOS=linux and GOOS=windows ./internal/sessions: ok.
Broken by hand: grokCallLine returning at once: TestGrokCalls,
TestGrokCallsForkKeepsItsOwnTurns, TestGrokCallsLeaveTheGatewaysTurnsOut
red; the gateway check off: TestGrokCallsLeaveTheGatewaysTurnsOut red (e
counted 26124 in).
Not tried: a live Grok Build session read by the GUI's Usage page; the
fixture lines are a real session's of each kind with the prompt cut.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:39 +08:00
yetoneandggbdpq fbbdf6e056 claude: a turn Anthropic refuses as a third-party app's says why, and isn't asked again (#4503)
Anthropic answers some Claude subscription turns with "API Error: 400
Third-party apps now draw from your extra usage, not your plan limits.
Add more at claude.ai/settings/usage and keep going." isjiajia01's
controlled tests show when: Claude Code's interactive mode (the cli
entrypoint) carrying a client agent's own system prompt, such as Pi's,
gets the 400, and claude -p is served the same prompt. sounfury saw the
same thing on 0.1.2586 (Pi refused, Eta served, same Pro account). Until
now the client got that bare 400, which says "keep going" and doesn't
say why, and the log said only "exit status 1".

The client still gets the 400, followed now by magpie's explanation:
Anthropic counted the turn as a third-party app's and answered nothing.
It ran in the interactive mode with the agent's own system prompt.
Asking again the same way may draw from the Claude account's extra
usage, so magpie doesn't ask again on its own. claude -p is served such
prompts: turn off "Claude Code's interactive mode" in Settings › Models
› Replies or in the provider's editor. The plan counts a -p request at
about twice the interactive mode's. A claude -p run that gets the same
refusal says so, without the advice to turn the mode off. The log names
the refusal and its mode, and every run's start and end lines now say
"interactive mode" or "claude -p".

The owner decided this on #4503. ggbdpq's patch redid such a turn once
as claude -p, at about twice the plan's count, without asking. This
commit keeps the patch's detection (thirdPartyWords) and its fake
interactive Claude Code harness, and drops the automatic redo. The
explanation stays clear of quotaWords, so the refusal remains a 400
about the request: no account rests for it, and the next account isn't
asked.

Run on mote at a3768cdd1 plus this change:
- go test ./internal/gateway -run 'TestClaudeTUI|TestClaude.*Refus|TestBridgeFailed|TestClaudeTooLong' -count=1: ok
- the new tests and TestClaudeTUIRefusalIsNoAccountsFault, -race -count=3: ok
- gofmt -l internal/: clean
- GOOS=linux and GOOS=windows go vet ./internal/gateway/: ok

New tests: TestClaudeTUIThirdPartyRefusalSaysWhy (whole and stream: a
400 with the explanation in both msg and body, the helper started once,
one run only so no -p redo, not retryable, failure() not
credit/quota/rate/auth) and TestClaudeThirdPartyRefusalOfPrint.

Broken by hand: with thirdPartyRefused returning msg unchanged, both new
tests went red. With req.interactive never set,
TestClaudeTUIThirdPartyRefusalSaysWhy went red.

Not tried: a real Claude Pro account getting the refusal. The refusal
line is the reporters' wording, played back by a fake Claude Code; the
exact stream-json shape of a real one wasn't captured. The full
./internal/gateway suite and ./... weren't run here.

Reported-by: isjiajia01, sounfury
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:39 +08:00
yetoneandggbdpq b9a45f59e0 claude: the run works in the caller's own folder, not one a turn quotes, and a --bare CWD: line is read (#4449)
clientNamedWorkPlace took the last working-directory line anywhere in
the request, so a user turn that merely quoted one ("Primary working
directory: /x", alone or inside a longer line) overrode the caller's
own, or broke the capture and fell back to magpie's shared folder; and
claude --bare states its folder as "CWD: /x", which was never matched,
so a --bare caller always worked in the shared folder while being told
it was theirs (WardLu).

From ggbdpq's patch (via gua2100): the caller's own word wins. Its
instructions and system messages are read first (every form, "CWD:"
included, on a line of its own); a turn is read only when the caller
named nothing, and only in the forms a caller states its folder in
(Codex's <environment_context>, OpenCode's <env>). "Primary working
directory: /y (was /x)" is read as /y, as the routing rules read it.

Not taken from the patch: it unmasked a folder whose word the redact
rules had masked and ran Claude Code there. Claude Code tells Anthropic
the folder it runs in (" - Primary working directory:" in its own
environment; the bridge goes straight to Anthropic), so the masked word
would have left the machine as written. A folder not on disk, masked or
not, falls back to magpie's folder as before, envElsewhere tells the
model its tools run in the caller's environment, and its paths are put
back on their way to the caller. TestClaudeNeverRunsInAMaskedFolder
Unmasked holds that.

Run on mote at this tree: gofmt -l internal/gateway clean; GOOS=linux
and GOOS=windows go vet ./internal/gateway ok; go test ./internal/gateway
-run 'TestClaude|TestWorkDir' -count=1 ok.
Broken by hand: the unmask put back: the masked test red (ran in
.../someuser-libs/proj); claude_subscription.go back to main: 6 of 9
subtests of TestClaudeRunsWhereTheCallerRunsNotWhereATurnQuotes red; the
layer split alone dropped: 3 red.
Not tried: a real claude --bare caller; a real redact plugin's masker
(the test masks through maskTextHits with RedactWords). Sibling:
workDirIn (workdir.go) still takes a quoted line in a user turn for
routing rules and the plugin folder header: #4940.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:39 +08:00
yetoneandggbdpq 4bac5eed26 usage: a request's row says what went up to the vendor, tries summed (#4456)
RunMintOn asked how much a long session sends upstream: a proxy counted
~900 MB up in 45 minutes, and no ledger row said what a request sent.

A row now has up_bytes, the bytes that went on the wire, every try and
every second ask summed (zstd's size for a ChatGPT turn), and
plain_bytes, the last try's body before compression. They are summed
in the request's context on its own goroutine, set in serve and, for
Codex's own turns that come from the mux and not through serve, in
codexUpstreamOn. Handed-on rows carry neither; rows from before carry
neither.

From ggbdpq's patch (via gua2100), two changes:
- the patch counted in codexUpstreamOn but set the context only in
  serve, so a Codex turn on its ChatGPT sign-in, the zstd case the
  issue is about, wrote 0 and 0 (TestCodexOwnTurnKeepsUpBytes);
- a second request inside one try (RetryOneAuth, RetryZhipuCoding,
  RetryOpenCodeFreeOnZen) went up uncounted; it counts now
  (TestLedgerCountsATrysSecondAsk).
Request bodies to other vendors stay as their client sent them; zstd
stays Codex's (the owner's call, on the issue).

Run at this tree on mote: go test ./internal/gateway -run
'UpBytes|TrysSecondAsk|OneAuth|Codex|Draw|Relay' -count=1: ok;
go test ./internal/usage ./internal/redact -count=1: ok. gofmt clean.
Broken by hand: no context in serve: TestLedgerKeepsUpBytes and
TestLedgerCountsATrysSecondAsk red; none in codexUpstreamOn:
TestCodexOwnTurnKeepsUpBytes red (row 0/0, backend got 79 of 8444);
the second ask not counted: TestLedgerCountsATrysSecondAsk red.
Not tried: a real session's numbers against a proxy's; the GUI shows
neither field yet.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:39 +08:00
yetoneandggbdpq e737dff447 redact: a dotted name a call is made on is no secret to the masking model (#4444)
kewab's redaction shot: gctx.GetInt64("user_id") went out with
gctx.GetInt64 replaced by a made-up key. No rule reaches such a span;
the local model called it a SECRET, and modelFits let it through.

modelFits's SECRET case now turns away an identifier path (identPath)
that a '(' touches: the name a call is made on. ggbdpq's patch (via
gua2100) asked notCode there, the rules' check, which also skips a name
with a space before its '(' and one after a colon that a comma follows.
The model is asked about prose too, and there those are secrets: with
notCode, "tell Bob it is Pw7nK4xQ9rTe (rotated today)" and "note:
hunterTwoThree, keep it" went out as written. Only the touching '(' is
taken.

Run at this tree on mote: go test ./internal/redact ./internal/usage
-count=1: ok. gofmt -l clean.
Broken by hand: the guard gone: TestModelMisreadsNotMasked red on
gctx.GetInt64; the patch's notCode in its place: TestModelFindsStill
Masked red on the three prose secrets above.
Not tried: the real local masking model (the tests use the stand-in
model the suite's other model finds use).

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:39 +08:00
yetoneandggbdpq d5fea7f02e gateway: a relay whose list names gpt-image-2 under a namespace draws it (#4432)
loscoy's retest (v0.1.2670) still got 404 "magpie knows no model
"gpt-image-2" to draw with" for the bare name a Codex harness asks for:
the relay's cached list names the family under a namespace
(openai/gpt-image-1, openai/gpt-image-2 …), and drawsFamily, which
a130035a0 narrowed to a drawer whose id starts gpt-image-, read those as
none of the family, so the relay that draws was passed over.

drawsFamily now reads each drawer by the part of its id past the last
"/". The narrowing stands: only a relay whose own list draws a GPT Image
takes the family. A new drawnAs sends the relay the id its list names
the model by (openai/gpt-image-2 for gpt-image-2), on both the images
route (resolveDrawing) and Codex's native image tool (drawingModel);
a name the list doesn't carry goes as asked, for the vendor to serve or
refuse in its own words. ggbdpq's patch (via gua2100) sent the bare name
upstream; loscoy asked whether the namespace had to be kept, and a
relay that lists only openai/… may not know the bare one, so the listed
id is sent.

Run at this tree on mote: go test ./internal/gateway -run
'Draw|Drawing|Relay|Codex|UpBytes' -count=1: ok. gofmt -l clean.
Broken by hand: drawsFamily back to the whole id: TestRelayDrawsThe
GPTImageFamilyFromANamespacedList, TestCodexNativeDrawsItsOwnModelOnA
NamespacedRelay and TestCodexNativeDrawsByTheRelaysNamespacedName red;
drawnAs returning the bare id: the first and last red.
Not tried: loscoy's real relay; the namespaced id is what its list says,
not seen on its wire.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-11-03 05:08:38 +08:00
yetone 8abdf53a88 cli: Check in now for one account is named in notYet, beside the per-vendor check-ins (#4826)
TestEveryRouteHasACommandOrIsNamed was red on main since e87140242 added
POST /api/usage/checkin-account (Settings' Check in now for one account)
with neither a command in cliForRoute nor a notYet entry. No command
checks in a single account: `magpie accounts checkin` checks in every
account, and the per-vendor routes it covers (minimax-, plugin-, qoder-,
trae-checkin) are already in notYet under stage 3, so this one joins them.

Run at dfd3b720b (origin/main) on mote: go test -tags nogui -count=1
./internal/cli/ ok (100.6s). Without this line the test fails with
"POST /api/usage/checkin-account has no command" (the red on main, #4826).
gofmt -l internal/cli clean. Not tried: nothing outside internal/cli; the
change is a test-only map entry.
2026-11-03 02:44:33 +08:00
yetone 8f128877ae provider: the ZCode mover installs opencode-zcode-auth 0.1.43 (plugins#649, frank6com)
0.1.43: when zcode.z.ai's edge firewall (Aliyun) answers a Start Plan
request (POST /api/v1/zcode-plan/anthropic/v1/messages) with its 405
block page, every account of the plugin holds off zcode.z.ai for three
minutes. The Start Plan and -Trial requests are answered locally with
the same 405 and provider.BlockedHint, so EdgeBlocked and retryable still
fall back. Free first stays on the coding plan. frank6com's two Start
Plan accounts and three sessions with subagents went on knocking from
both accounts after the block, and ZCode's own app got the same 405, so
the address was blocked, not the account. npm --prefer-online had 0.1.43
when this landed.

Run on mote: go test ./internal/provider ok, gofmt -l clean, GOOS=linux
and GOOS=windows go vet ./internal/provider clean. That run was on
2ab923571 with this line and the WorkBuddy and Qoder mins; nothing in
internal/provider changed between it and this commit's base. The
plugin's own run record is in plugins 036fb6e.

Not tried: a real block. Reproducing it means getting the owner's
address blocked.
2026-11-03 02:41:46 +08:00
yetone b4073c06a0 claude-tui: /usage waits for its panel, never takes Claude Code's banner as it (ikunbots on X)
ikunbots (v0.1.2738) showed a Claude card saying "Claude Code's /usage
told no allowance: ▘▘ ▝▝ /private/var/folders/…/magpie-claude-work-501
────". After /usage is typed, Claude Code draws itself again (banner,
folder, the prompt's rules) before the panel. A slow /usage leaves that
still, and the helper took any screen still for 3s as the panel, so the
banner was told as /usage's answer and parsed as an error.

Now a screen without "NN% used" counts as drawn only when the panel's
Settings tabs show and nothing says loading (usageDrawn). With no panel by
commandWait (or the caller's deadline), the result is an error naming what
was last drawn, never a success carrying the banner.

Run (on mote):
- go test ./internal/claudetui/: ok (new TestShimWaitsPastTheBanner: the
  fake draws the reporter's banner, then the 2.1.316 panel 4.5s later;
  TestUsageDrawn; a "banner, no /usage panel" case in
  TestShimEndsAtItsCallersDeadline).
- Broken by hand (old "anything still 3s" condition back):
  TestShimWaitsPastTheBanner red, told the banner as the result, as in the
  report.
- go test -run 'Usage|TUI' ./internal/gateway/ ./internal/provider/: ok.
- GOOS=darwin/linux/windows go vet ./internal/claudetui/ ./internal/gateway/: clean; gofmt clean.

Not tried: a real slow /usage on a real account; the "loading" word is
a guess at the panel's loading text, which only keeps waiting longer.
2026-11-03 02:41:17 +08:00
yetone dfd3b720bd docs: the gateway's OpenAI images and videos routes, and what each vendor is sent
A table of POST /v1/images/generations, /v1/images/edits, POST /v1/videos, GET /v1/videos/{id} and /content, what each takes and answers, and each vendor's translation, checked against draw.go, draw_volcengine.go and video.go. Asked for by axelburks on Discord. Docs only; nothing run.
2026-11-03 02:40:27 +08:00
yetone 5bd1aee637 video: Seedance takes a last frame and Ark's own fields through /v1/videos
/v1/videos read OpenAI's request into Ark's content-generation body
but left out the last frame (last_frame, which magpie reads for
MiniMax), and dropped every field OpenAI's API doesn't have, so a
caller in OpenAI's shape couldn't turn off Seedance's audio, fix a
seed or ask for an adaptive ratio (axelburks on Discord asked that the
OpenAI shape be converted to the vendor's).

volcengineVideoBody now sends last_frame as an image_url item with
role last_frame, and passes the request's other fields on as sent
(masked as the prompt is, as for a provider's own videos API). A
multipart form's "false" or "42" goes as false or 42, as Ark takes
them.

Run (mote): at a7f31ef46 (this stack on 2c90922b0), gofmt -l internal clean,
GOOS=linux and GOOS=windows go vet ./... ok; go test -timeout 45m of
internal/gateway, imagemcp, browsermcp, cli, davsync, gui, library,
settingsapi, tui, agent: all ok but two reds already filed and untouched
here: gateway TestCodexPoolSaysTheClientsVersion (#4807) and cli
TestEveryRouteHasACommandOrIsNamed (#4826). After rebasing on 1490045f5, gateway re-run there (pushed onto 253aee08b, whose later commits change only provider/gui Gemini URL defaults; not re-run):
gofmt, both vets, and gateway -run Ark|Volcengine|Video|Videomaker|
ImageMCP|Draw|Image|Film|MiniMax|Grok plus imagemcp, ok.

Broken by hand: arkFilms false for a non-preset Ark key turns
TestArkKeyMakesSeedanceVideos red (create 404 at /api/v3/videos, the
reported gap); leaving out the last_frame item, or sending multipart
strings untyped ("false", "42"), turns
TestArkVideoTakesLastFrameAndItsOwnFields red.

Not tried: a real Ark account (the fake answers with Ark's captured
replies from volcengine_fixtures_test.go); multipart extras against real
Ark; the MCP's generate_video has no last_frame argument yet. Siblings
filed: #4954 (an OpenAI key's Sora can't make videos), #4955 (Seedance
listed as chat models).
2026-11-03 02:40:27 +08:00
yetone 93060c98d0 video: an Ark key's Seedance models make videos at Ark's tasks (axelburks on Discord)
axelburks asked for image and video APIs on the gateway that convert
OpenAI's request shape into the real vendor's, Volcengine's in
particular. /v1/videos already did that for the Volcengine preset's
Agent Plan, but any other Ark key (pay-as-you-go /api/v3, or an Ark
endpoint added by hand) had no video models, and one marked a Video
model was sent to an OpenAI-shaped <base>/videos that Ark doesn't
have (404).

Now an Ark key's Seedance models (listed or picked, named seedance) are
its video makers, started at <base>/contents/generations/tasks with
volcengineVideoBody, polled at .../tasks/<id> and downloaded from
content.video_url, as the Agent Plan's are. The id names the key that
started the video, and its poll and download go on that key.

Docs: docs/subsystems/gateway-routing.md.

Run (mote): at a7f31ef46 (this stack on 2c90922b0), gofmt -l internal clean,
GOOS=linux and GOOS=windows go vet ./... ok; go test -timeout 45m of
internal/gateway, imagemcp, browsermcp, cli, davsync, gui, library,
settingsapi, tui, agent: all ok but two reds already filed and untouched
here: gateway TestCodexPoolSaysTheClientsVersion (#4807) and cli
TestEveryRouteHasACommandOrIsNamed (#4826). After rebasing on 1490045f5, gateway re-run there (pushed onto 253aee08b, whose later commits change only provider/gui Gemini URL defaults; not re-run):
gofmt, both vets, and gateway -run Ark|Volcengine|Video|Videomaker|
ImageMCP|Draw|Image|Film|MiniMax|Grok plus imagemcp, ok.

Broken by hand: arkFilms false for a non-preset Ark key turns
TestArkKeyMakesSeedanceVideos red (create 404 at /api/v3/videos, the
reported gap); leaving out the last_frame item, or sending multipart
strings untyped ("false", "42"), turns
TestArkVideoTakesLastFrameAndItsOwnFields red.

Not tried: a real Ark account (the fake answers with Ark's captured
replies from volcengine_fixtures_test.go); multipart extras against real
Ark; the MCP's generate_video has no last_frame argument yet. Siblings
filed: #4954 (an OpenAI key's Sora can't make videos), #4955 (Seedance
listed as chat models).
2026-11-03 02:40:27 +08:00
yetone 253aee08b4 provider: an AI Studio key's Gemini URL is filled in once, and stays empty when the user clears it
3e61d814e gave a provider at AI Studio's OpenAI-compatible URL AI
Studio's Gemini API base in normalize, which runs on every load and
save, so a user who cleared that URL got it back each time: magpie's
default overrode the user's value (code standards).

Now it is filled in once and recorded (GeminiFilled, geminiFilled in
providers.json). A URL cleared after that stays empty, from the CLI
(`magpie provider set <id> gemini=`), by hand in providers.json, or in
the editor: the form doesn't send geminiFilled, so its save carries it
over from the saved provider, as it does the other fields the form
doesn't show. Providers that already got the URL from 3e61d814e have
no record yet; their first load records it, the URL unchanged, so a
clear after that holds.

Tests: TestAIStudioGeminiClearedStays (provider: clear, then two loads
and saves), TestSaveKeepsGeminiCleared (gui: /api/provider/save with
the URL cleared). Broken by hand: the old fill (no GeminiFilled check)
turns both red, the URL back each time; the editor's save without the
carry-over turns TestSaveKeepsGeminiCleared red.

Run on mote at this change on 2ab923571: gofmt -l clean; GOOS=linux go
vet -tags nogui ./internal/... ok; GOOS=windows go vet ./internal/... ok;
go test ./internal/provider ok; go test ./internal/gui ok except
TestMainWindowCorners/macOS_26_SDK, #3949 (macOS 27 AppKit, untouched
here); go test ./internal/gateway -run Gemini/AIStudio ok.

Not tried: the editor itself in a browser (no JS change; the field and
its save were already there). A user who cleared the URL in the hours
between 3e61d814e and this commit got it back then; clearing it again
now holds.
2026-11-03 02:37:56 +08:00
yetone 1490045f59 claude bridge: an unloaded deferred magpie MCP tool is handed over by its full name
packinggoods (#feedback, 11-02): every first MCP call in Claude Code
failed with "Error: No such tool available: magpie-web-search__web_search"
and the retry worked.

Claude Code with tool search on names a deferred MCP tool in a reminder
and leaves it out of tools until ToolSearch loads it. Through the Claude
subscription bridge the run's model reads that name and calls it,
mcp__magpie__magpie-web-search__web_search; toolStart cut mcp__magpie__
and, the tool not being one the client sent, handed the client the bare
magpie-web-search__web_search, which it has no tool of. After a
ToolSearch the tool is in tools, the cut name maps back, and the call
works: the retry. a3768cdd1 (the router sending a name it no longer
lists to its server) doesn't reach this; nothing gets to the router.

toolStart now hands such a call over under the name the model called,
the client's own, when the cut name maps to nothing and isn't among the
run's tools. A declared tool maps as before; with the run's tools not
yet set the old behaviour stays.

Reproduced in a sandbox HOME with Claude Code 2.1.316 against a fake
Anthropic API and a stdio MCP server: a call of the bare name gives
the reporter's exact error, and a call of the full name of an unloaded
deferred tool runs.

Run at this head (mote): go test -tags nogui ./internal/gateway -run
'TestClaudeBridgeHandsOverAnUnloadedMagpieTool|TestClaudeBridgeKeepsMagpieMCPNames|TestClaudeRunEndsAfterStructuredOutput|ToolChoice|ToolName'
ok; then rebased on fb872a68e (a2837c1f5 and 2ff93ffd6 on top change
only two provider movers' mins): gofmt -l internal/gateway clean,
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway ok,
go test -tags nogui ./internal/gateway -run 'Claude|MCP|Hub|ToolName|ToolChoice'
ok (88s).
Broken by hand: with the name = called line out,
TestClaudeBridgeHandsOverAnUnloadedMagpieTool is red: handed
"magpie-web-search__web_search", want
"mcp__magpie__magpie-web-search__web_search".
Not tried: a real bridge run on a real Claude account, and the
reporter's own setup (agent, account) is inferred from the screenshot.
Not changed: a deferred tool of another client MCP server
(mcp__linear__…) is still answered by the run (#4956, related #4854).
2026-11-03 02:36:06 +08:00
yetone 2ff93ffd64 provider: the Qoder movers install opencode-qoder-auth 0.2.55 (plugins#643)
0.2.55 has a request that names no effort and a max_tokens of 1024 or less
think at none (the lowest level for a model that always thinks) rather
than at the model's default. This is WorkBuddy's #643 rule applied to the
same default in qoderBody. npm --prefer-online had 0.2.55 when this
landed.

Run on mote at this head plus the next commits' one-line Qoder/ZCode mover mins: go test ./internal/provider ok, gofmt -l
clean, GOOS=linux and GOOS=windows go vet ./internal/provider clean
(TestQoderMoversSendTheClientsModelConfig still holds). The plugin's own
run record is in plugins 58adead.
2026-11-03 02:35:49 +08:00
yetone a2837c1f50 provider: the WorkBuddy mover installs opencode-workbuddy-auth 0.2.15 (plugins#643, itspig)
0.2.15 gives a chat whose max_tokens (or max_completion_tokens) is 1024 or
less no default reasoning effort. On 0.2.14, a 64-token session title on
deepseek-v4.1-flash-sg ended "length" with 64 reasoning tokens and no
text. npm --prefer-online had 0.2.15 when this landed.

Run on mote at this head plus the next commits' one-line Qoder/ZCode mover mins: go test ./internal/provider ok, gofmt -l
clean, GOOS=linux and GOOS=windows go vet ./internal/provider clean. The
plugin's own run record is in plugins d51bd50.
2026-11-03 02:35:49 +08:00