Commit Graph
843 Commits
Author SHA1 Message Date
yetone ccbbcbffcb gui: a restart to update leaves the Mac's menu bar icon for the next magpie (Mitsuha, audie)
From v0.1.1354 a restart to update hands the gateway over, and the old
magpie hides its own menu bar item with Wails' Hide, which is
[statusItem setVisible:NO]. AppKit keeps that in the app's defaults by
the item's autosave name ("NSStatusItem VisibleCC Item-0" = 0 on macOS
26), and the next item made under that name starts hidden. So after the
update the icon was gone, and quitting and reopening didn't bring it
back (Mitsuha on v0.1.1364; audie on two Macs, macOS 27.0.1).

Evidence: a 30-line Cocoa probe made a status item, setVisible:NO, and
every later launch of the same program started with visible=0 and the
key = 0; removeStatusItem kept nothing; removing the key brought it back
on the next launch. This machine's com.yetone.magpie.sbhandover.plist
(the handover commit's own sandbox run) holds
"NSStatusItem VisibleCC Item-0" => false.

Fix (internal/gui/trayshown_darwin.go, app.go):
- leaveMenuBar (was the onHandedOver closure) queues forgetTrayHidden
  on the main thread after Wails' hide block, so the hide is made on
  screen but not kept.
- bringTrayBack, once per computer (a flag in the Mac's defaults, never
  in a WebDAV backup), forgets a kept hide before the tray is made: that
  repairs everyone an older magpie already hit. A hide kept after that
  is the user's and is left alone.
- A magpie handed over to by an older one (which still hides for good)
  forgets the hide once that pid has quit and shows its item, unless a
  hide was already kept when it started.
docs/subsystems/gui-shell.md says so under the handover.

Run (worktree at origin/main ed91aa04e):
- TestHandoverLeavesTheMenuBarIconForTheNextMagpie (AppKit child with a
  real Wails tray, CFFIXED_USER_HOME sandbox): ok, -count=3.
- Broken by hand: leaveMenuBar without forgetTrayHiddenLater -> "handing
  over kept the menu bar icon hidden for the next magpie (1 kept)";
  bringTrayBack without forgetTrayHidden -> "the icon an older magpie hid
  wasn't brought back (still hidden true, 1 kept)".
- go test ./internal/gui/ -count=1: ok 86.7s; go test -tags nogui
  ./internal/gui/: ok 67.2s.
- gofmt -l: nothing. go vet ./internal/gui/ (darwin), GOOS=linux go vet
  -tags nogui, GOOS=windows go vet: ok. go build, GOOS=linux go build
  -tags nogui, GOOS=windows go build: ok.
- No GUI asset changed, so no Playwright run.

Not tried: a real signed update from v0.1.1367 to this build on the
user's bundle id; whether Control Center hides the new version's running
item live when the old one writes the key (the probe's running item kept
visible=1; the on-screen window list needs screen recording rights). Not
run: the full go test ./... (one package touched; other sessions are
queued for the suite). audie's WebDAV sync carries no tray setting and
doesn't restart magpie; the icon going there is taken to be the same
update's restart, not confirmed with them.
2026-10-24 15:20:37 +08:00
yetone ed91aa04ef checkin: an inactive or ineligible check-in shows the plugin's reason (plugins#304)
Qoder's plugin 0.2.32 (magpie-community/plugins 74be632) says why no
check-in was offered: it asked with this machine's own device identity
and Qoder offered no campaign, and Qoder desktop can claim one it shows.
magpie dropped a hook's message for inactive and ineligible and showed
only "No check-in event now". Now:

- GUI: the Usage card's row reads "<label> · <message>", wrapped under
  the label rather than cut off with "…" (data-why, as a failed row's
  reason wraps, #821); Settings' check-in line under the plugin's switch
  carries it too. A result without a message reads as before. No new
  i18n keys: the message is the plugin's own text, as for failed rows.
- TUI: the Usage cell is too narrow, so it adds "c says why"; c's flash
  carries the message (checkinWhy).
- CLI: `magpie accounts checkin` prints it after the label.
- The Qoder mover's min is 0.2.32 (npm view --prefer-online: 0.2.32).
- docs/subsystems/provider-plugins.md says how the message is shown.

Run at this tree (based on origin/main dd1e8822d):
- go test -timeout 45m ./... (tee'd, grepped): every package ok
  but internal/handoff, whose TestTakeOnlyAFreshOfferForThisProgram
  could not bind a unix socket under my long scratch TMPDIR (path over
  104 bytes); with the default TMPDIR internal/handoff is ok.
- gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.
- GUI, chromium and webkit: checkin-reason (new: en, zh, zh-TW, ja, de;
  900 and 440px), plugin-checkin, qoder-checkin-recheck, usage-checkin,
  checkin-account, checkin-early-done, usage-quota-head, i18n-keys:
  155/157. The 2 reds are usage-checkin's "webkit en/zh: Settings has a
  Qoder check-in tab", red the same on a fresh origin/main a9a001a7a
  (#2549, #3091).
- TestCoreScriptBudget: app.js 1,343,313 of 1,343,324, no raise.

Rebased on origin/main 4683a0382 (a9a001a7a's app.js line, 4683a0382's
provider change) and run again at this head: internal/gui (budget:
1,343,323 of 1,343,324), internal/cli, internal/tui and the whole
internal/provider ok; the same 8 GUI files in both engines, 155/157,
the same two #2549/#3091 reds.

Broken by hand: app.js's change reverted, checkin-reason goes red on the
reason; app.css's reverted, red on the wrap; checkinWhy returning "" in
internal/cli and internal/tui, TestCheckinSaysWhyNoneWasOffered red in
each.

Not tried: a real Qoder account offered no campaign (the fixture is the
plugin's own text); the real Linux app (WebKitGTK).
2026-10-24 14:52:13 +08:00
yetone a3b45eb91e provider: a re: pattern matches in any case, as a glob does (usrname1833 on Discord)
A routing group's patterns (Group.Match) and a provider's auto-include
rules both compile through compilePattern. A glob compiled with (?i)
and a re: pattern without it, so re:gpt-.* missed GPT-5.5 while gpt-*
took it. A re: pattern now compiles as (?i)^(?:…)$; (?-i) inside it
makes case matter again from there on (re:(?-i)gpt-.*).

The Routing page's editor works out a pattern's models in JS
(patternRe in plugins/routing/client.js) and refused what JS can't
read. It now reads re: with the i flag too, and takes Go's leading
flag group ((?-i), (?s), ...) as JS flags, so re:(?-i)OR/B is taken
and matches as the gateway will. A flag group further in is still
refused there (JS has no bare (?-i)); the CLI takes it.

Said in groupmatch.go's comments, magpie group's and magpie provider
auto-include's help, and providers-accounts.md (Routing groups, List
schedule and rules). No GUI hint said a pattern's case, so none
changed and no string was added.

Run:
- TestRegexpPatternIgnoresCase (new): ok. With compilePattern's (?i)
  taken off by hand: FAIL, "re:GPT-.* ~ gpt-5.5: false, want true" and
  three more cases.
- group-patterns.test.cjs, chromium and webkit, en and zh: 4 of 4 ok.
  With patternRe put back to the old re: line by hand: 4 of 4 red,
  "(?-i) keeps case 0 !== 1" (old JS refused re:(?-i)OR/B).
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.
- go test -tags nogui -timeout 45m ./internal/provider ./internal/cli
  ./internal/gateway under a sandbox HOME at 1a956129c's tree: ok,
  ok, ok (380s). go build for darwin, linux (nogui) and windows: ok.
- A full ./... run was started and stopped: the machine's disk was
  full (1GB free), and internal/agent's tests failed on "no space
  left on device" in TempDir, not on this change. No full suite ran.

Not tried: the full suite (above); a real provider's auto-include fetch with mixed-case ids;
the Linux app's WebKitGTK; a (?-i) further into a re: in the GUI.
2026-10-24 07:07:57 +08:00
yetone edff2f819a provider: levels kept of a model's own narrow only what is offered again (#92)
4a3e07f1c made provider.Efforts return the levels a user kept, so the
gateway fitted every request to them. That reversed #92 (47e12df41),
which was explicit that narrowing a model's levels changes only what is
shown and "the levels the vendor is asked at stay as they were": a user
who had trimmed a picker with `magpie model efforts` or Names & levels
would have had their agents' xhigh and max asks lowered unasked. Dani's
request (magpie model spec) needs levels to count only where magpie
knows none for the model.

- Efforts is back to what it was before 4a3e07f1c: the vendor's list's
  or models.dev's levels when known, else the ones the user declared
  (`magpie model spec --reasoning` on a custom provider's model), which
  a request is then fitted to. --reasoning off (reasonless) is as
  4a3e07f1c built it.
- TestModelEfforts' "the vendor is still asked at any level it has" is
  restored as it was.
- TestKeptLevelsBoundTheAsk becomes TestNarrowedVendorLevelsAskAsBefore:
  a models.dev-known model narrowed to low-high is offered low..high and
  still sends xhigh, max and low as asked.
- gateway-routing.md, reference.md, the settings.go comment and spec's
  usage say so: narrowing is display-only, declared levels are fitted.

Run at this tree (base 4a3e07f1c):
- go test -count=1 -timeout 45m ./internal/gateway ./internal/provider
  ./internal/cli ./internal/settings: ok (gateway 386s).
- gofmt -l empty; go vet darwin, linux -tags nogui, windows clean.
- Broken by hand, each red: 4a3e07f1c's Efforts (TestNarrowedVendor-
  LevelsAskAsBefore: xhigh and max went as high; TestModelEfforts:
  [low high]); declared levels ignored (TestModelSpecReachesTheGateway:
  xhigh sent as xhigh with low-high declared).
- Every other p.Efforts caller (gateway fit, decide, classify, automode,
  rules, side effort) is on the request path and is back to its
  behaviour before 4a3e07f1c.

Not run: the GUI suite (no GUI file changed; the GUI reads entry
Efforts, which still carry the kept levels) and a full go test ./....
2026-10-24 05:51:22 +08:00
yetone 4a3e07f1cf model: magpie model spec sets a model's window, output, vision and levels at once
Dani Ariyanto on Discord (#feedback, 10-24): a custom provider's models
(kenari/*:free) had no window, reply limit, vision or reasoning known,
and there was no one place to say them.

  magpie model spec <provider/model>                 what it has, and whose each value is
  magpie model spec <provider/model> [--context <n>] [--output <n>] [--vision on|off|auto] [--reasoning <levels>|off|auto]
  magpie model spec '<provider>/*' --context <n> --output <n>
  magpie model spec <provider/model> --reset
  magpie model specs

It writes the stores magpie model context/output/images/efforts write
(providers.json contexts; settings.json modelOutputs, modelImages,
modelEfforts, modelReasonless), so every reader that went by those goes
by a spec: entryFor/EntryOf/Served, /v1/models, max_tokens, the GUI's
/api/providers badges and chips, and the agents' model lists. Every
part is checked before anything is written; a refused command writes
nothing. Agents are told once.

Readers that bypassed the stores and now honour them:
- provider.Efforts returns the kept levels, so the gateway fits a
  request to them (fitEffort): xhigh asked of a model kept to low-high
  goes as high. This reverses #92 (47e12df41), which narrowed only the
  lists handed out; docs/subsystems/gateway-routing.md says so.
- entryFor: levels given a model with none known make it Reasoning.
- gateway AutoVision picks by the user's ModelImages (seesAt).
- GUI gateway client: a reasonless model offers no level chips.

Run at this tree (base a93190ae1):
- go test -count=1 -timeout 45m ./internal/{provider,cli,gui,gateway,
  settings,tui,agent,catalog}: all ok (gateway 505s, agent 360s).
- GUI: gateway-*.test.cjs, model-reasonless, plugin-gateway, i18n-keys
  (25 files, both engines, the new file at 1100 and 420 in en, zh,
  zh-TW, ja, de): 225/225 pass. app.js untouched.
- gofmt -l empty; go vet darwin, linux -tags nogui, windows clean.
- Sandbox HOME, built binary, `magpie web` on 47821/47820 and a fake
  Chat vendor on 47811: before, kenari/glm-5:free had no window or
  levels; after spec 128k/16k/on/low-high, /v1/models said 128000,
  16000, image input, [low medium high]; max_tokens 100000 went as
  16000, xhigh as high, low as low; qwen-x with --reasoning off was
  sent no reasoning field; /api/providers had context 128000, output
  16000, images/imageSet, kept [low medium high], reasonless for qwen-x.
  A models.dev sync during the run (GLM-5 202752/131072) didn't move
  the spec; after --reset the vendor's values came back. Bad values,
  an unknown flag and --help wrote nothing (files hashed).

Rebased onto a6a3dbde8 (the ZCode mover's min, one line): at the
pushed head 5af093d8b's tree, ./internal/provider and ./internal/cli
-timeout 45m ok, and the spec tests in gateway and gui ok.

Broken by hand, each went red: AutoVision on raw sees; Efforts on the
full list; the Reasoning line removed; output, vision or context not
written; ParseLevels skipped; agents told twice; --context 0 taken;
help printing modelUsage; old client.js; the GUI named() image and
reasonless branches.

Not tried / not changed: no full go test ./... (another session's
full GUI suite was running). Codex's ChatGPT-model /models pass-through
and the Codex effort dropdown read catalog.Codex(), not a spec. The
TUI shows no spec badges. A Context-tab trace keeps the window it was
recorded with. Pre-existing and the same on origin/main a6a3dbde8: a
GLM-5 relay with no levels known has xhigh sent as high.
2026-10-24 05:31:59 +08:00
yetone ea9454d2d8 usage: count two ids of one model as one, magpie model alias (SlouchyQuill507 on Discord)
A vendor names one model two ways (deepseek-v4.1-flash and deepseek-flash),
and Usage, Usage > Sessions and `magpie usage` showed two rows. Now:

  magpie model alias deepseek-v4.1-flash deepseek-flash
  magpie model alias deepseek-v4.1-flash            (what it is counted as)
  magpie model alias deepseek-v4.1-flash --reset
  magpie model aliases

kept as settings.json "usageAliases" {from: to}. Off until one is written.
Ids match as routing groups match them (provider.sameModel: vendor/ prefix,
case, "_", snapshot date), at every provider; a chain is followed to its
end; an alias to itself, a loop, or a flag as an id is refused. A loop
written into the file by hand counts each model under its own id.

Display only: requests, agents' model lists, /v1/models, routing groups,
Same as and prices never read it. Each call is priced by the id it was
made under and only then counted under the alias; the alias's own price
is never put on the other id's calls, and a merged row is priced only
when every id in it is. Applied in usage summarize/direct (Models
groups), the gateway sessions projection (alias read before
gatewayCache's lock; the cache key hashes usageAliases), and
sessions.List/Get/Find/Stats (read before storeMu/mu, merged into new
slices so the memo is untouched; ModelEffort rows merged too). A failed
settings.json read keeps the last aliases read, and SetUsageAlias refuses
to write over an unreadable file (EditUsageAliases under fileMu). The GUI
settings save carries usageAliases. No GUI control.

Not aliased: the Requests ledger's per-request model and its model
filter, which show each call's own id.

Run (worktree at f4640c0ae, rebased onto 2b4c0664e with no overlap):
- gofmt -l: clean. go vet ./... darwin, GOOS=linux -tags nogui, GOOS=windows: ok.
- go test -count=1 -timeout 45m (sandbox HOME) internal/usage,
  sessions, provider, cli, settings, gui, tui: all ok.
- Real binary in a sandbox HOME: two usage.jsonl calls priced $2 and
  $100 per M: `magpie usage` showed two model rows ($2.00, $100), and
  after `magpie model alias` one row, 2.0M, 2 calls, $102; the session
  row too. alias/aliases/--reset/loop/self output checked by hand.

Broken by hand, each red then restored:
- no alias in summarizeFrom: TestUsageAlias* red
- nil alias into the gateway projection: TestUsageAlias* red
- statsIn without aliasStats / List without aliasSession:
  TestSessionsCountAliasedModelsAsOne red
- merged usage row keeps Priced true: TestAliasStatsLeavesItsInputAlone red
- loop check off / self check by == / last-good read off / flag check off:
  TestUsageAliasRefusesSelfAndLoops, TestUsageAliasUnreadSettings,
  TestModelAliasCmd red
- GUI save drops UsageAliases: TestSettingsSaveKeepsWhatItDoesNotSend red

Not tried: the GUI pages in a browser (no app.js change; the Usage and
Sessions pages read the same rows), the full go test ./... before push,
Windows box.
2026-10-24 02:48:50 +08:00
yetone f4640c0aee sessions: an agent's folders are one list, newest first, the temporary ones folded at the end
The Sessions page drew each folder as a boxed group with its checkbox,
path and buttons always showing. Now it is one list, the way Finder's
recents read: a row says the folder's name, where it is (home as ~, from
the manage reply's new `home`), its newest session's title, when, and how
many. Temporary folders, the disk's root and apps' hidden folders under
home wait folded under Other folders at the end; a search or a session
opened from elsewhere unfolds them. Checkboxes and the Delete bar come
only with Select, and Done lets the pick go. Relocate project and Delete
all sessions move into a folder's ⋯ menu (hover, always on touch, and
right-click); Delete all asks in magpie's own dialog.

Asked for by the owner ("这个会话页面其实特别丑"), who approved the design.

Tests: sessions-folder-list.test.cjs (new) checks the order, the ~ path,
the fold and its count, Select/Done, the ⋯ menu's Delete all and its ask,
and no horizontal scroll, in Chromium and WebKit, en/zh/zh-TW/ja/de, at
1000 and 420px. The other sessions tests follow the ⋯ menu and Select.

Run at this head (rebased on 17a2b00ef):
- node --test, 37 GUI files (every sessions*/session*, i18n*,
  checkbox-look, account-mask-sessions, routing-session*,
  usage-session*): 493 pass, 0 fail.
- gofmt -l internal/gui: clean; go vet -tags nogui ./internal/gui: ok;
  go test -tags nogui ./internal/gui: ok (budgets included).
Not run: the whole GUI suite at this head. The last full run (183fa169b,
10-23) had its reds filed (#3402 to #3416 and earlier issues); none is a
sessions file. Not tried in the Wails window on a real machine's sessions.
2026-10-24 02:31:17 +08:00
yetone 17a2b00efb gui: the sidebar's open page moves from row to row on a spring, as iOS's selection does
The owner asked for the sidebar's pages (Providers, Routing, Gateway…)
to slide from one to the next like their sub-tabs do, "like iOS".

The open page's row is now marked by one shape (.nav-top-hl) that
navTopGo moves on a damped spring (NAV_SPRING: SwiftUI's response
0.42s, damping 0.84; navTopStep, four sub-steps a frame, dt capped):
- it sets off as the row is pressed, and comes back if the press
  leaves the row or the page refuses to be left;
- being physics, a press that changes its mind turns it with the speed
  it has, never a jump;
- it follows its row while Usage's tab list folds above it and lands
  where the row ends up;
- it is put in place, not sent, when the window opens on a kept page or
  the rows move under it at rest (ResizeObserver); away while Settings
  is open, it fades back in on its row; reduced motion jumps; the
  header's tabs keep their .thumb and draw none.
The rows give up their own ground (open, hovered, pressed) to it.
#nav is position: relative in the sidebar for it, so .seg's centring
left/top are reset (without that the whole list sat 105px right).

Tests:
- sidebar-glide.test.cjs (new): Chromium + WebKit, en + zh, 1024 and
  1440, plus 900 (header): at rest on its row and the list in the
  sidebar, no ground hovered, press sets off before release and comes
  back off the row, Providers→Usage→Agents by frames (≥3 moving
  frames, overshoot < 3px) landing on the row, Settings hides it and
  Routing brings it back, reduced motion jumps, no page errors.
  Broken by hand: without the left/top reset the list check goes red;
  before the "not seen yet" rule the boot slid from Agents (red).
- sidebar.test.cjs: a pressed page row no longer darkens itself (the
  shape comes to it); Settings still must.
- routing-idle-frame.test.cjs counted every self-asking rAF callback as
  Routing's loop, so navTopStep after the click read as 33 Routing
  frames. It now counts only callbacks no global holds (app.js's are
  globals; Routing's frame is in its plugin's scope). Broken by hand:
  Routing's loop made to always ask again → 4 red; green on main's
  assets and on this change.
- TestCoreScriptBudget: app.js 1,343,324 / core 1,535,084 with no room
  added; the sidebar is the window's shell, not a page a plugin can take.

Run:
- Full GUI suite at 183fa169b (this change on 3b10a403d), alone on the
  machine but at load ~216: 11942 pass, 104 fail. The 25 red files
  rerun at load ~10 on this change and on 3b10a403d: the same reds on
  both except routing-idle-frame (fixed above); plugin-card-update,
  segment-press-dialog and sidebar-overlay-scrollbar pass alone here
  (segment-press-dialog red alone on main: #3416). Reds on main, filed:
  #3402 #3403 #3404 #3405 #3406 #3407 #3408 #3409 #3410 #3411 #3412
  #3413 #3414 #3415; already filed: #3350 #3099 #3096 #3094 #3091
  #3104 #3001. codex-predictions and codex-auto-reset were red only at
  load ~216 and passed in both reruns.
- At the pushed head (rebased on f3eb92924): sidebar, sidebar-glide,
  nav-sub-unroll, side-toggle, side-width, header-relang,
  sidebar-tab-top, settings-tabs-stick, omarchy,
  sidebar-overlay-scrollbar, click-scroll, routing-idle-frame,
  plugin-card-update, segment-press-dialog, i18n-keys: 230/230;
  go test -tags nogui -run 'TestCoreScriptBudget|I18n|Docs'
  ./internal/gui: ok; gofmt -l clean.

Not tried: the real Linux app (WebKitGTK); this uses only rAF and
transforms, no view transition. Not run: the full Go suite (only
internal/gui's budget/docs tests; no Go code changed).
2026-10-24 02:21:45 +08:00
yetone a95f0b83ff gui: a restart to update hands the gateway to the new version (xuanwo on X)
Before, a restart to update ended the gateway, so it waited until no
agent request was in flight (#577). An agent busy for hours held the
update back, and Restart now cut its replies off. On a Mac and on Linux
the restart now starts the new version beside the old one and hands it
the gateway's listening socket. The new version takes every new
connection at once. The old one stops accepting, finishes the requests
it has (up to 15 minutes, as `make dev` already gave), then quits.
Nothing an agent sends is refused or cut short.

How (docs/subsystems/gui-shell.md, "A restart to update hands the
gateway over"):
- internal/handoff, new, darwin and linux. The old magpie opens a unix
  socket in a 0700 temporary folder and writes handover.json (fresh for
  2 minutes) in its config folder. The new one finds it, says Hello, and
  gets the listening socket by SCM_RIGHTS with the address, its pid and
  a callbacks socket. Only the same program (same path, same uid) is
  given it. When TMPDIR is too long for a socket path (sun_path is 104
  bytes on a Mac), the folder goes in /tmp (sockDir).
- gateway: Inherit/Listen serve on the socket given, and acknowledge
  once serving. HandOff gives the old one handedOffDrain (15m) instead
  of the 2s an ordinary end gives. A Claude Code run of the old magpie
  whose helper calls its tools on the port gets those calls passed back
  to the old one over the callbacks socket (forwardCallback, mcpCall,
  ownCallback). The bridge's turns are counted on their own
  (Busy.Bridge, BridgeLast).
- gui: restartInto calls beginHandover (OpenBeside `open -n` on a Mac,
  StartBeside for the binary on Linux). On the new version's ack, the
  old one hides its menu bar icon, panel, window and Dock icon (Mac),
  ends its backend, waits for its requests, and quits. OnShutdown
  leaves Codex's failover, the thread port and the install to the new
  one, which serves the gateway they point at.
- Never two on screen. Mac: the old one lets go of its instance lock
  just before giving the socket and takes it back if the handover
  fails, then hides on the ack. Linux: Wails holds the D-Bus name until
  exit, so the new one serves the gateway at once but puts its tray up
  only once the old pid has exited (awaitExit, 16m at most). Until
  then the old tray stays.
- What a handover can't carry: the subscription bridge's Claude Code
  turns live in the old process, so the restart still waits for those
  (restartBusy = blocking(Busy, true)), along with turns parked on
  tools. Every other request is not waited for. The update badge, the
  Updates page and Settings' "Restart automatically" say so, in every
  language in i18n.js.
- A handover that isn't made restarts as before: socket not opened,
  new version not started, no hello in 60s, no ack in 90s. Because the
  restart didn't wait for the requests in flight, it now waits for
  gatewayBusy to be idle (fallbackWait, 15m at most) before it quits
  and relaunches, so a failed handover never cuts a request.
- The overlap. The instance lock is handled as above. Both processes
  write: the sticky routing is flushed before the hand (FlushSticks),
  and files go through the existing locked or atomic writes. Counters
  (RPM, concurrency) are per process for the overlap (gateway-routing
  Constraints). OAuth refresh: the previous commit locks Codex's and
  the ChatGPT API's refreshes across processes. The rest were already
  locked or don't rotate (providers-accounts Constraints).
- Not changed: Windows (no SCM_RIGHTS; it restarts as before and still
  waits for idle, #577), `magpie web` (re-execs in place), and
  `make dev` (its own Handover). MAGPIE_NO_HANDOVER=1 turns it off.

Found by the sandbox run, fixed here: in run 2 the sandbox's long TMPDIR
made the socket bind fail ("bind: invalid argument"). The restart fell
back at once, cut the stream at chunk 6 (curl exit 18), and 4 of 381
requests got no answer over ~2s. Two fixes: sockDir (/tmp fallback), and
the fallback that waits for idle.

Tests (each red when broken by hand or on the old code):
- gateway/handover_test.go: TestHandedOverGatewayFinishesItsStream
  (drainFor without handedOff: "the old one ended with a stream in
  flight"; takeAck off: "the new one never said it serves").
  TestToolCallOfTheMagpieBeforeGoesToIt (mcpCall forward off: 404;
  ownCallback forwarding off: 401). TestInheritedForAnotherAddressIsLetGo,
  TestCallbacksSocketServesOnlyToolCalls, TestBridgeTurnsCount,
  TestSameAddr.
- handoff/handoff_test.go: TestHandOverListener, TestNoAckKeepsTheSocket,
  TestTakeOnlyAFreshOfferForThisProgram, TestCloseRemovesOnlyItsPointer,
  and TestOpenWithALongTemporaryFolder (red on the old Open: "bind:
  invalid argument").
- gui/handover_unix_test.go: TestRestartHandsTheGatewayOver, cross-
  process. The test binary re-execs as the new magpie. A stream through
  the old one finishes whole, requests during the restart are all
  answered, the next ones reach the new pid, and the old one quits only
  after its stream. On the old restart it is red: "quit with a reply
  streaming". TestHandoverNotMadeRestartsAsBeforeOnceIdle ("never says
  hello", "doesn't start") is red on the code before the fallback
  drain: "quit with a reply streaming" / "the restart didn't try to
  hand over".
- gui/handover_test.go: TestRestartWaitsForWhatAHandoverCantCarry,
  TestHandsOverOnlyWhereItCan.
- update/relaunch_open_test.go: TestOpenBeside,
  TestStartBesideWaitsForNothing.
- GUI: update-wait.test.cjs (the handover wording on the badge and
  page), update-restart.test.cjs (Settings' description).

Real run, Mac, sandbox (env -i, HOME and XDG_CONFIG_HOME in a scratch
folder, a long TMPDIR, MAGPIE_ADDR 127.0.0.1:63249, MAGPIE_UPDATE_FEED
pointed at a fake feed). The app is -tags production, ad-hoc signed,
bundle id com.yetone.magpie.sbhandover, built as 0.1.9001 and 0.1.9002.
autoRestart is on. A fake upstream streams 100 one-second chunks. The
real app found the update, downloaded and staged it, and restarted with
the stream in flight (run 3, at this change's tree before the rebase):
- 18:31:43, pid 59833 serves. 18:31:51, the new pid 60477 serves; v1
  logged "magpie 0.1.9002 (pid 60477) serves the gateway now".
- Requests: 375, failed 0. 19 were answered by 59833, then 356 by 60477.
- The stream got all 100 chunks, END and [DONE] at 18:33:24, curl exit
  0, 92s after the hand. 59833 exited within 3s of the stream's end.

Run at the pushed head (7a5bca443's tree, on origin/main f3eb92924),
one suite at a time, each log tee'd:
- gofmt -l internal/ cmd/: none. go vet ./... (darwin), GOOS=linux go
  vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -count=1 -timeout 45m: internal/handoff ok, internal/update
  ok, internal/gui ok (95s), internal/provider ok, internal/gateway ok
  (367s).
- TestCoreScriptBudget: app.js is 1,338,901 of its 1,338,929. My
  additions first went 372 bytes over after the rebase; the badge's two
  wordings now share one args object and the comments I added were cut,
  with no budget raised.
- GUI (NODE_PATH playwright 1.62.0, both engines): i18n-keys, every
  update-*.test.cjs (update-wait 22/22, update-restart 22/22, update-stuck
  40/40 among them), gui-de, gui-ja, gui-zh-tw: all pass.
- f3eb92924 (the Mac relaunch's exec fallback) landed under this. A
  handover that never gets its hello falls back to update.Relaunch, which
  now carries that fallback; OpenBeside keeps open's tries only, since
  the old one is still running then and the fallback follows.
- Linux, Docker golang:1.26.8 with -tags gtk3 (before the rebase): the
  handoff package, the gui handover tests including the cross-process
  TestRestartHandsTheGatewayOver, and the gateway handover tests pass.
- Full GUI suite at f09e9a066 (before the rebases, load ~250 from other
  sessions): 11958 tests, 61 failed in 22 files. 13 pass alone (fonts,
  plugin-updates, rail-tip, routing-keys-fold, routing-mode-goes,
  routing-model-rest, routing-rule-remove, routing-went-on, search-keys,
  segment-press-dialog, sidebar-overlay-scrollbar, usage-overview-fold,
  usage-pack); load reds of this kind are #3393. 9 fail the same on
  origin/main 843417957, each filed: library-mcp-health-wsl #3350,
  quota-count-wrap and quota-name-translated #2228, quota-reads #2150,
  s3-sync #2448, usage-agents-hide #2276, usage-checkin #2549/#3091,
  usage-fold #2163, usage-ledger #3104.

Not tried:
- Windows: unchanged by design, nothing to run there beyond vet.
- A real Linux desktop app. The tests ran in Docker (above); the D-Bus
  wait (awaitExit) was not seen in a real tray.
- Whether the menu bar showed two birds for a moment on the Mac. B's
  tray goes up as it starts, and A hides on the ack, which follows B's
  first listen. They are close, but not ordered, and I didn't capture
  the screen.
- The Mac's real bundle id and LaunchServices registration
  (com.yetone.magpie), the real signed and notarised update, and real
  accounts (the run used a fake upstream).
2026-10-24 02:20:38 +08:00
yetone 85cde4a4de provider: Codex and ChatGPT API refreshes lock across magpies
Two magpies can now run at once: a restart to update hands the gateway
over and the old one finishes its requests for up to 15 minutes (next
commit), and a magpie run from a terminal can sit beside the app. Codex's
auth.json and the ChatGPT API sign-in rotate their refresh token on every
refresh. Their refresh locks (codexMu, siwcRefreshing) were a sync.Mutex,
held in one process only. So both magpies could refresh with the same
refresh token, and the second got refresh_token_reused, which signs the
account out.

Both are now a filelock.Mutex beside logins.json (.codex.lock,
.siwc.lock). The sign-in is read again once the lock is held, so a magpie
that waited uses the tokens the other one wrote instead of refreshing
again. Claude's saved tokens, MCP servers' and plugins' were already
locked across processes. Google's, Vertex AI's and Copilot's refresh
tokens don't rotate. Docs: providers-accounts.md, Constraints.

Tests: TestCodexRefreshWaitsForAnotherMagpie and
TestChatGPTAPIRefreshWaitsForAnotherMagpie. Each holds the file lock as
another magpie would, mid-refresh, writes that magpie's rotated tokens,
then lets go. The refresh must return those tokens and send nothing to
the token endpoint.

Broken by hand: with both locks put back to sync.Mutex, both tests are
red ("refreshed 1 times beside another magpie").

Run: see the next commit's body. The provider package ran at the pushed
head with -timeout 45m.

Not tried: a real Codex or ChatGPT API account refreshing in two magpies
at once. The tests use fake token endpoints.
2026-10-24 02:11:14 +08:00
yetone a2e98cd799 gateway: a streamed Codex turn goes to ChatGPT over its WebSocket (brickhao)
brickhao on Discord: long Codex turns through magpie died with "stream
closed before response.completed". Their network (FlClash) cuts a
streamed HTTP reply from chatgpt.com at about 120 s: 120.7 s through
magpie, 121.5 s over HTTP without magpie. Codex's own WebSocket to the
same backend ran to the end twice (124.5 s, 131.4 s). magpie has no
120 s timer of its own (no WriteTimeout, 10 min to the first header).
The cut is on the leg from magpie to chatgpt.com, which was always
HTTP. Codex answers magpie's 426 by falling back to HTTP, and over
loopback that is harmless.

What changed: codexSocket, first in upstreamTransport, sends a POST to
CodexBase/responses with "stream":true over the backend's WebSocket, as
codex-rs does (ResponseCreateWsRequest, build_websocket_headers).
- Handshake: the turn's headers plus OpenAI-Beta:
  responses_websockets=2026-02-06. x-codex-turn-state and the
  responses-lite header go in client_metadata instead. The message is
  the body (zstd decoded) with "type":"response.create" ahead of it.
- Frames come back as the SSE the HTTP route sends.
  codex.rate_limits and codex.response.metadata are also given as the
  x-codex-* and x-codex-turn-state headers. websocket_timing is dropped.
- An error frame ahead of the reply becomes its HTTP status and body,
  so account rests and failover work as before.
- These go over HTTP: a refused handshake (and the host stays on HTTP
  for 10 min, unless the refusal was 401/429/5xx),
  websocket_connection_limit_reached, and a body that isn't a streamed
  turn.
- A socket closed before the end reads as a cut stream.
- Both Codex's own sign-in passthrough and magpie's ChatGPT accounts
  take this path. Codex identity, instructions and prompts are
  unchanged. coder/websocket is now a direct dependency (it was
  indirect).

Run:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- go test -race -count=3 of the five new tests: ok.
- go test -timeout 45m at 1a5911612 (rebased on origin/main c551a2299),
  sandbox HOME: internal/gateway ok 760.9s, internal/agent ok 596.8s,
  internal/provider ok 172.5s. The rest of ./... was not run before the push.
- Real: a sandbox magpie (this tree, 127.0.0.1:3488, sandbox HOME and
  CODEX_HOME, a copy of the Codex access token with the refresh token
  blanked so nothing could rotate). A curl turn on gpt-6-luna came back
  200 with codex.rate_limits in the SSE (which only the socket sends)
  and the x-codex-* headers. Real Codex CLI 0.162.1 (codex exec,
  xhigh) through it: a 6121-word reply over 165 s ended whole, exit 0.
  Codex logged its own 426 from magpie and fell back, as expected.

Broken by hand:
- socket off in the tests: all four socket tests red (the reply cut
  before response.completed, no handshake, 200 not 429).
- error-frame mapping off: TestCodexSocketErrorIsItsStatus red.
- turn-state into client_metadata off: TestCodexTurnGoesOverWebSocket
  red.

Not tried:
- brickhao's network: this network doesn't cut at 120 s, so the 165 s
  turn shows the socket carries a long turn whole, not that it gets
  past their cut.
- A real turn on a magpie-saved ChatGPT account (fake only).
- Through an HTTP or SOCKS proxy for real.
- Windows/Linux runs.
2026-10-23 23:59:55 +08:00
yetone 34f9686bd2 agent: dsh's desktop app is DeepSeek's own DeepSeek Harness; the community DeepSeek Hermes is not it
WuSix on Discord (Windows 11), on v0.1.1337: the desktop app still isn't
in magpie's Agents, and the repo 0c679c640 built on
(motongv/deepseek-hermes-desktop, "DeepSeek Hermes") is not DeepSeek's.
The official one is github.com/deepseek-ai/deepseek-harness.

What was wrong: 0c679c640 took a community Electron wrapper around
`dsh web` for the app WuSix runs, and listed dsh, wrote the web profile
and dropped dsh's key store for it. That is taken out whole (dshHermes,
the store switch, the web-profile app file, noticeDsh6 and its zh, zh-TW,
ja and de strings, the Running pattern, dsh_hermes_test.go). A user that
v0.1.1337 wired this way keeps profiles/web, which is dsh web's own
profile; the next Apply or Sync writes the key store again.

The official app, read from its source (deepseek-harness at 687f282e8,
dsh-v0.2.1-rc.2) and its real release files:
- apps/desktop/scripts/electron-builder-config.mjs: productName
  DeepSeek Harness, appId from DSH_DESKTOP_APP_ID; first config
  19444907f0 hard-codes com.deepseek.dsh. NSIS per-user
  (perMachine false), a folder the user may pick; installer.nsh writes
  HKCU ${INSTALL_REGISTRY_KEY} InstallLocation and refuses all-users.
- deepseek-harness-0.2.1-rc.2-mac-arm64.zip (sha512 as the feed
  download.deepseek.com/dsh-desk/feeds/mac-arm64/nightly-mac.yml says):
  DeepSeek Harness.app, CFBundleIdentifier com.deepseek.dsh, 0.2.1-rc.2,
  team NAN929V4UM.
- deepseek-harness-0.2.1-rc.2-win-x64.exe installed with /S on the
  Windows 11 box (26200): %LOCALAPPDATA%\Programs\DeepSeek Harness\
  DeepSeek Harness.exe, HKCU\Software\1bf39983-50d0-5fe0-9ef4-
  cece76f67c5e InstallLocation, Uninstall entry DisplayVersion
  0.2.1-rc.2, DisplayIcon <exe>,0. Nothing under HKLM.
- packages/util/home-paths/src/index.ts (defaultDshHome = ~/.dsh,
  DSH_HOME) and apps/desktop/src/paths.ts (profiles/desktop, "shared
  with npm-installed dsh"): the same ~/.dsh as the CLI on every OS.
- No Linux desktop build is published (UPDATE_TARGETS is mac-arm64,
  mac-x64, win-x64; dsh-latest-linux-x64.AppImage is 404); Linux has
  the npm CLI only.
magpie's desktopApps["dsh"] already had all of these (#2279, #2325);
the row is named DeepSeek Harness, the app's own name.

Run:
- Windows box, sandbox USERPROFILE/APPDATA/LOCALAPPDATA (Programs a
  junction to the real one, where the installer put the app), no ~\.dsh:
  the released v0.1.1337 magpie-cli-windows-amd64.exe and this commit's
  build both list "DeepSeek Harness ... ~\.dsh\profiles\desktop\
  cordis.patch.yml" in `magpie ls`. So on a default install v0.1.1337
  already listed it; what WuSix sees isn't reproduced. An unconnected
  agent sits under the Agents page's 未设置 (Not set up) fold; WuSix's
  screenshot and install folder are still to be asked for.
- macOS: the real 0.2.1-rc.2 .app in a sandbox HOME's Applications:
  HasApp true, version 0.2.1-rc.2, `magpie ls` lists it.
- New tests: TestDshOnlyTheOfficialApp (red on 0c679c640's dsh.go:
  "DeepSeek Hermes taken for DeepSeek Harness: detected true") and
  TestDshWindowsAsTheInstallerRegistersIt (the registry values above,
  and the GUID as UUID v5 of com.deepseek.dsh in electron-builder's
  namespace).
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
- GUI: i18n-keys, agent-notice-lang, gui-de, gui-ja, gui-zh-tw: 34/34.
- Full suite: not run at push time (queued behind the suite lock;
  pushed per the owner's ship-at-once rule). TestDsh*, TestDesktop*,
  TestCLIMissing*, TestRegistered* rerun ok at the rebased head on
  origin/main 03951798a; the full run follows through the lock, reds filed.

Not tried:
- The real app opened (neither the .app nor the .exe was started), so
  no request from it through the gateway.
- WuSix's own machine: why their row doesn't show is still unknown.
2026-10-23 22:26:33 +08:00
yetone d3f3df746e routing: the page's head has Routing groups, which brings the groups at the page's foot into view (shihh on Discord)
The routing groups sit below the stage, the story and every request; with
many models (shihh on Discord) they are a long scroll down. The Routing
page's head now has Routing groups (#rtGoGroups) beside New group: a down
arrow, its name, and a tooltip saying where they are. Its click goes
through scrollOnPurpose, brings .rt-gsec to the top of the view and moves
the focus into it. The page's layout is unchanged (no #1354-style move):
the groups stay last in #rtMore. fitGo gives the button only the head's
spare room (the .grow spacer): named, its arrow alone (still named to a
screen reader), or left out, so nothing else in the head moves or wraps.
Strings in zh, zh-TW, ja and de. app.js untouched (plugin files only).

Test: routing-groups-jump.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de
x 1000px web, 480px web, 640px window: 30/30. It is red on main's assets (no
button), red with the scrollOnPurpose check removed (the app's guard pulls
the view back), red without the focus move, and red with fitGo removed
(de at 480px web: Hide accounts moves).

Run at this change on 50f52b540 (de281760e, rebased under it, touches only internal/gateway):
- go test -tags nogui -timeout 45m ./...: 69 packages ok, no FAIL
- gofmt -l: clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: ok
- TestCoreScriptBudget and the other budget tests: ok
- GUI files the change can reach (routing*, group*, i18n-keys,
  click-scroll, title-bar-tools; 125 files, both engines): 1495/1495

Not run: the whole GUI suite. Another session's full GUI run held the
machine for 2h45m+, and this touches only the routing plugin's files.
Not changed: on a phone the web head already shrinks to its 40px
min-height on main, so wrapped buttons slide under the first card (Hide
accounts at 360px in German). Where the head has no spare room, the button
is left out rather than wrapped.
2026-10-23 21:37:16 +08:00
yetone de281760e2 gateway: a conversation going round one tool call with the same result is answered by magpie after 8 turns (audie on Discord)
audie on Discord: on 10-21 Codex Desktop, routed to WorkBuddy's
deepseek-v4-pro, ran the same read-code tool call 308 times between 13:24
and 13:52 (316 requests, 212.65 credits). That evening it did it 340 more
times between 19:58 and 20:22 (343 requests, 324.52 credits). loopGuard
only catches a loop inside one streamed reply. Here every reply was a
short, valid call. The loop runs across turns, so it shows in the
request's own history.

stoppedToolLoop (internal/gateway/tool_loop.go) runs in serveAgent after
the session is recorded and before hooks, middleware and routing. It also
runs in the Codex backend's passthrough on Codex's own ChatGPT sign-in. It
needs the last 8 turns to be the same exchange:
- the same calls: name plus arguments, key order ignored, call ids ignored;
- answered with the same results: text, error flag and images, with
  Codex's "Wall time", "Chunk ID" and "duration_seconds" taken out
  (runNoise);
- with nothing else said on the user's side.
When it finds one, it answers the turn in the agent's own protocol,
streamed or whole (Responses, Chat, Anthropic, Gemini through
relayStatus), with a notice that names the call. Nothing goes upstream, and
no prompt, base_instructions or identity text sent to a vendor changes.
A different result, or any word from the user, starts the count again.
The notice is a turn without calls, so the user's next message carries
on. The check keeps no state, so it is per conversation, and a retried
request doesn't count twice.

The turn is recorded the way Codex's title turns are. sentNowhere's body
becomes answeredHere (from-protocol aware): the Routing trace shows "Tool
loop stopped", and a usage row has provider magpie, rejected, the
conversation's session and native session, and an error starting
"tool loop:". So Usage and Sessions both show why.

Cost: a body with fewer than 8 tool results isn't parsed (a
bytes.Count). For a longer one, only the newest 64 items are parsed,
found with gjson (tailOf). For a 1.5MB Codex turn that is 1.1ms and
2.5MB, against 30ms and 20MB for a full parse (BenchmarkToolLoopCheck).

There is no new setting. Settings › Models › Replies › Stop looping
replies (noLoopGuard, on by default) turns this off together with the
reply guard, and the notice says so. The GUI sub-text is unchanged.
docs/subsystems/gateway-routing.md has a bullet on it.

Run at this commit (vet/build/race at parent bf2e067ef; the full suite
after the rebase onto 50f52b540, at 558b21b7e):
- gofmt -l clean.
- go vet ./... on darwin, GOOS=linux go vet -tags nogui ./..., and
  GOOS=windows go vet ./....
- go build on darwin, linux (-tags nogui) and windows.
- TestToolLoop* and the Codex title/description/prediction tests under
  -race (TestToolLoop* -count=3).
- The tests, in a sandbox HOME against fake vendors:
  - TestToolLoopIsStoppedOnEveryProtocol: 60 poll turns then 8 Codex
    reads with a varying chunk id and wall time, on Responses (stream and
    whole), Codex's backend path, Chat (stream and whole), Anthropic
    (stream and whole) and Gemini. The vendor is asked 0 times, the
    notice and the protocol's done marker reach the agent, and the usage
    row is magpie, rejected, "tool loop", with the session.
  - TestToolLoopStoppedOnCodexsOwnSignIn: gpt-5.5 on the passthrough,
    with a fake CodexBase.
  - TestToolLoopShortOrOffGoesOn: 7 turns, and 40 with the setting off.
  - TestToolLoopLetsProgressBy: 200 polls whose answer moves, and a loop
    followed by the notice and a word from the user. Neither is stopped.
  - TestToolLoopSums.
- Broken by hand, each red, each restored:
  - The guard skipped: every protocol subtest and the Codex sign-in test
    fail ("the agent wasn't told of the loop").
  - runNoise removed: the same tests fail, plus TestToolLoopSums.
  - Results left out of the sum: every progress subtest fails ("a poll
    whose answer moves was stopped").
- Full suite: set -o pipefail; go test -tags nogui -timeout 45m ./...
  through suite-lock, in a sandbox HOME, at 558b21b7e on 50f52b540:
  exit 0, 69 packages ok, no FAIL (internal/gateway 854s, internal/agent
  812s, internal/provider 393s, internal/gui 291s).
- No GUI file changed, so the GUI suite wasn't run.

Not tried:
- A real Codex Desktop or WorkBuddy loop, or any real account. The
  fixture's shape is Codex's exec_command output; audie's literal bytes
  weren't available.
- The Windows box.
- Codex over websocket (magpie answers it 426).
- Responses conversations that use previous_response_id. They carry only
  the newest turn, so they are never stopped.
- Loops with more parallel calls a turn than fit in 64 items.
- A poll that gets the same answer 8 times in a row is stopped too. The
  user's next word, or the setting, carries on.
- dsh's two ~1M-token requests to DeepSeek on 10-23 are a different
  problem, not addressed here.
2026-10-23 21:36:51 +08:00
yetone 50f52b540b redact: a text masked for a vendor before is masked as it was then, so a cached prompt stays cached
With Privacy masking on, a value masked once is "known" and masked
wherever a later request has it (redact/known.go). When a rule first
finds a value in a later turn (a tool printing DB_PASSWORD=...), that
value was masked from then on in the system prompt and the turns already
sent with it as written. The prefix the vendor had cached changed, so
the whole prompt was written to the cache again and none of it was read.

Reported by audie on Discord: DeepSeek Harness on a routing group served
by a custom Anthropic-compatible provider. Adjacent turns 10s apart had
cache_read 0 and cache_write 412K to 427K.

Fix: Mask and MaskJSON (the vendor-bound paths, via masking.Masker) now
use sentKnownSpans. A text masked before gets the known values it had
the first time, keyed by a sha256 of the text and the options. Only
hashes and spans are kept, never a value, in two generations of 65536.
New text still gets every known value masked. Scrub (archives, sessions,
OTel; local only) keeps the latest known set.

Unchanged: if magpie restarts, or a text falls out of both generations,
the text is masked under the current known set once, as before.

What was run:
- internal/redact TestSentTextKeepsItsMasking and internal/gateway
  TestMaskedConversationKeepsItsCachedPrefix. The gateway test sends a
  dsh-shaped Chat Completions conversation to a group with an Anthropic
  member, and a Claude Code-shaped /v1/messages one. It checks that each
  turn's system, tools and earlier messages reach the fake upstream byte
  for byte. Both tests are red with sentKnownSpans forced back to
  knownSpans: the system prompt became "{{SECRET_...}}" on turn 3. Both
  are green with the fix.
- With masking off, a probe of the same dsh shape had the system, tools
  and earlier turns byte-identical on every turn.
- gofmt -l: clean. go vet: darwin, GOOS=linux -tags nogui ./...,
  GOOS=windows ./...: clean.
- Full suite at 8187919d7 (this tree, on origin/main bf2e067ef):
  set -o pipefail; go test -tags nogui -timeout 45m ./..., through the
  suite lock. 69 packages ok, none red (gateway 519s, agent 393s).

Not tried: audie's real setup. Their Privacy setting isn't known; with
masking off this is not the cause, and every breakpoint reading 0
(even the unchanged system block) points at the provider's own cache or
pool. Not tried against a real Anthropic or relay account. GUI not
touched, so the GUI suite was not run. Windows tests not run.
2026-10-23 20:53:53 +08:00
yetone bf2e067ef6 gateway: a Codex account with credits is asked again at its allowance's edge, never benched (豆子, Zhenzhen)
Two Discord reports about ChatGPT accounts left to spend their credits
(the default):
- 豆子: an account whose allowance is used up but which still holds
  credits got a long rest. It should go ahead of accounts with neither.
- Zhenzhen: a Pro lite account ran out mid-session and the running
  session failed with "usage exhausted", while a new session worked.

The cause: when a window fills, ChatGPT can answer that turn 429
usage_limit_reached before it spends the credits, and serve the next
turn on them. magpie took the 429 as quota. On the routed path it
rested the account until the window renewed (candidate.full drove
those rests). On the relay (Codex's own sign-in) it passed the 429 to
Codex, which ended the session.

- /wham/usage's credits (has_credits with a balance over 0, or
  unlimited) are now read into QuotaWindow.Credits, Limit.Credits and
  Allowance.OnCredits.
- Routed path: a 429 quota refusal from such an account (and one let
  spend them, CodexCredits) is asked again at once, once per request,
  before a reset is looked at (creditsAgain, Try.Credits). If it is
  refused again, it rests fallbackCooldown (Rest.By "credits") and its
  usage is read again. full() is zero for it, so a full window rests it
  nowhere else (spendsCredits).
- Relay: the same ask-again, once (relayOnCredits).
- Order: Smart, Pace and Least used put a credits account first of the
  98%+ tier (Seat.Credits, spentBefore). That is after accounts with
  allowance left and ahead of those with nothing left.
- Routing page: says why such an account went first or where it waits,
  tells the asked-again try ("{n} used · on credits"), and the "credits"
  rest. Strings in zh, zh-TW, ja and de.
- Not a plugin path: Codex has no plugin.

Zhenzhen's suggestion to switch to credits early (~3% left) was weighed
and not done: the vendor spends credits only once the allowance is used
up, so switching early only wastes what is left. Retrying at the edge
keeps the running session alive. Codex identity, base_instructions and
prompts are untouched.

Tests, each red on the old code (the GUI test against the old
client.js, the Go ones with spendsCredits/relayOnCredits forced false
or the old strategies.go):
- TestCodexCreditsAskedAgainAtTheEdge: relayed, routed, set not to
  spend. Fake ChatGPT backend that refuses the edge turn and then
  serves on credits.
- TestCodexCreditsNoLongRest: refused again gets a rest of at most
  fallbackCooldown; a 500 gets backoff; no credits keeps the long rest.
- TestCodexCreditsFirstOfTheSpent (gateway) and TestCreditsFirstOfTheSpent
  (routes, Smart/Pace/LeastUsed).
- TestCodexCreditsBalance gains the onCredits column.
- routing-codex-credits-again.test.cjs: en/zh/ja/de, Chromium and
  WebKit, 8/8.

Run at this head (rebased on origin/main e96d577f2):
- gofmt -l clean.
- go vet ./... on darwin, linux (-tags nogui) and windows.
- go test -tags nogui -timeout 45m ./...: 69 packages ok, exit 0.
- GUI: routing-*.test.cjs, panel-routing-*, codex-credits, plan-credits
  and i18n-keys (103 files, both engines), before the rebase. 1251 of
  1253 passed at load ~50-70. The two reds each pass alone (3 of 3):
  routing-effort-change, filed as #3376, and routing-model-rest, #2115.

Not tried:
- The real ChatGPT backend. The 429 at the edge is inferred from
  Zhenzhen's report; no account was run out live.
- The live x-codex-credits-* response headers are not read.
- A workspace plan still within its overage is not treated as on
  credits.
- Affinity between two credits accounts is unchanged.
2026-10-23 20:11:17 +08:00
yetone a77b5b4fc9 gui: Check in now says what the press came to, not "refreshed" (#3326)
Promised to connoryang331 on #3326: a press of Check in now said "Check-in
status refreshed" whatever happened. It now says, in the same toast, a
count per kind (checkinPressSaid): "Claimed: 1 (+200 credits)",
"Already checked in today: N", "Not available yet: N" (inactive,
ineligible, or an "already" magpie asks again), "Check in in its own app:
N" (captcha, Trae's 9074), "Check-in failed for N account(s)" (red, as
before). No layout change. en, zh, zh-TW, ja, de.

A result counts as claimed now only when the vendor was asked on this
press: WorkBuddyCheckin.Asked is now sent as "asked" (omitempty). It is
still never kept: checkinNow writes the file before setting it. An
account claimed earlier today, settled and not asked, counts as already.
The TUI and CLI already say each account's result ("+N", "· already"),
unchanged.

app.js and the core budget: +771 bytes over the previous commit, 349 over
the budget after compacting the helper, raised by exactly that with the
reason in core_budget_test.go (the check-in row is the core's, the tray
panel draws it too).

Tests:
- checkin-early-done.test.cjs: the press's toast is "Claimed: 1 (+200
  credits)" in each language, and checkinPressSaid's text for already,
  not yet and a mix (claimed x2 +150, already, failed), bad = 1 for a
  failure. qoder-checkin-recheck.test.cjs now wants "Not available yet:
  1" for its inactive press.
- Red on the previous commit's app.js: both files 0/20 in Chromium.

Run at this tree:
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
  qoder-checkin-recheck, usage-card-refresh, usage-checkin, Chromium and
  WebKit: 177/179; the 2 reds are usage-checkin's WebKit Qoder check-in
  tab, red alone on origin/main 0815c9186 (#2549, #3091).
- go test -tags nogui ./internal/gui/ -run Budget, ./internal/provider/
  -run 'Checkin|CheckIn': ok.
- Full suite: set -o pipefail; go test -tags nogui -timeout 45m ./...
  at 70c6bb072 (this tree on the previous commit), sandbox HOME: 69
  packages ok, exit 0. go vet of internal/gui and internal/provider on
  darwin, linux (nogui) and windows clean; gofmt -l clean.

Not tried: a press against a real vendor account.
2026-10-23 19:03:58 +08:00
yetone 45fa29973c checkin: an early "already checked in" is asked again, not kept for the day (#3326)
connoryang331 (v0.1.1328, Windows): at 00:00:28 Beijing 14 of 29 plugin
check-ins (AutoClaw CN x5, WorkBuddy x2, CodeArts, Trae x3, MiniMax,
Raccoon x2) answered "already" (done). magpie kept that as the day's
result and never asked again, and Check in now answered from the record
without asking. A real claim at 10:54 paid +200: the vendors' days turn
later than Beijing midnight, so 00:00's "already" was yesterday's.

The class, in the checkiner every check-in shares (built-in and plugin):
- A done, inactive or ineligible answered before noon Beijing
  (checkinSureHour) for an account magpie hasn't seen claim that Beijing
  day is provisional. The loop asks it again 30 minutes (wbCheckinEvery)
  after the answer, until a claim or an answer from noon on: at most 24
  more asks a day per such account, none once magpie claims.
- A press (soon) asks again at once for done, inactive and ineligible,
  whatever the hour. own-app (Trae 9074) and captcha still stand.
- A claim stamps Claimed, carried over while later answers that day say
  done, so a done after magpie's own claim is settled (Qoder's claim then
  done case).
- The record goes out with again: true (worked out when shown, never
  kept). The card says "{name} says already checked in; its day may not
  have turned yet, so magpie asks again later" and keeps Check in now;
  Settings, TUI and CLI say the same. en, zh, zh-TW, ja, de.
- Qoder's recheck (#2696, pluginRechecks) is unchanged: its tests pass
  as they were.

The plugins repo does not cache "already": autoclaw reads the task list
or calls dailySignin each time, codearts, minimax, raccoon and trae ask
the server each call (read at magpie-community/plugins origin/main
652f06d). No plugin change, publish or mover min.

Tests:
- TestPluginCheckinEarlyDoneAskedAgain (the reporter's 00:00:28: loop at
  +29m no ask, +30m asks then claims; a press at 10:54 claims; done all
  day is 25 asks and settles at noon; done after magpie's claim settled)
  and TestWorkBuddyCheckinEarlyDoneAskedAgain.
- TestPluginCheckinOthersSettledForTheDay now answers at 12:00 Beijing
  and checks a press asks again (claimed still settled);
  TestPluginCheckinRunsAsTheBuiltinsDo, TestTraeCheckinAnswers and the
  WorkBuddy nothing-to-claim/refused tests follow the new rule.
- TestCheckinAgainNotShownAsToday (TUI words and cell).
- checkin-early-done.test.cjs: again card's wording, data-state wait,
  Check in now asks plugin-checkin {provider: autoclaw-cn}; a kept done
  is "Checked in today +50" with no press. Chromium and WebKit, 5
  languages, 900 and 440px, 20/20.

Red on the old code: with the non-test change reverse-applied (fields
kept so it compiles), TestPluginCheckinRunsAsTheBuiltinsDo,
TestPluginCheckinOthersSettledForTheDay (inactive, done, ineligible) and
all 4 subtests of TestPluginCheckinEarlyDoneAskedAgain fail; with
origin/main's app.js, checkin-early-done fails ("Checked in today").

Run at this tree:
- gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... clean.
- go test -tags nogui ./internal/provider/ -run 'Checkin|CheckIn',
  ./internal/tui/ -run 'Checkin|OwnApp': ok.
- GUI: checkin-account, checkin-early-done, i18n-keys, plugin-checkin,
  qoder-checkin-recheck, usage-card-refresh, usage-checkin: 177/179. The
  2 reds are usage-checkin's "webkit en/zh: Settings has a Qoder check-in
  tab", red the same alone on origin/main 0815c9186 (filed #2549, #3091).
- Full suite: set -o pipefail; go test -tags nogui -timeout 45m ./...
  at c1a72f2b4 (this tree on origin/main 0815c9186), sandbox HOME: 69
  packages ok, exit 0.

Not tried: real vendor accounts (no early-morning "already" to replay),
Linux and Windows at run time. A vendor whose day turns after noon
Beijing (a US day) is not covered.
2026-10-23 19:03:58 +08:00
yetone 0815c91864 claude: a reply that writes its tool calls as "[tool call …]" text makes them for real instead of showing the lines (Zhenzhen on Discord)
Claude Desktop 3.1623.0 on a Claude subscription ("Fable 5.1 High",
magpie 0.1.1327) showed replies holding lines like
  [tool call mcp__magpie__mcp__ccd_turn__update_plan id=toolu_0Validate args={"advance":true}]
  [tool call mcp__magpie__Bash id=toolu_0Validate bash args={"command":"cd /Users/... && git diff --check ..."}]
and nothing ran. That is the form renderCachedParts gives past calls when
a run is told the conversation as text (renderClaudePrompt for a run
started anew, renderClaudeTurn for a turn with the client's own calls).
The model copied it: Claude Code had no call to make, the turn ended
end_turn, and the client showed the lines as words.

- readOutput holds a reply's words back from the first line that opens
  with "[tool call " (textCalls); words before it, and lines that only
  start like it, go on as they come. A reply that ends there with
  end_turn and calls none of the client's tools isn't ended: once the
  turn's result is in, the run is told textCallsAsk as a user message on
  its input, and the reply goes on in the next message (one
  message_start, as after Claude Code's own call). The client gets the
  real tool_use, registered by mcpCall, so its results go on in the run.
  Asked once per reply; written as text again, the words reach the
  client as before. No input (a run that ends by itself) or a reply that
  also called a client tool: not asked.
- A prompt that tells past calls as text ends with pastCallsNote: the
  lines record earlier calls, and writing one calls nothing. Placed after
  the messages (before </current_turn>), so the history chunks and their
  cache marks are unchanged. A prompt with no call is told as before.
- Neither text names magpie, Claude or Anthropic (checked in the test).
  Claude Code's own prompt and identity are untouched.

docs/subsystems/claude-subscription-bridge.md: new section "Tool calls
written as text", tests added to Verification.

Run at base 34ad18ed8 (origin/main) + this change, sandbox HOME with
pinned caches:
- New tests in claude_text_calls_test.go, built from the report's lines.
  With claude_subscription.go put back to 34ad18ed8 (claude_text_calls.go
  kept so it builds): TestClaudeTextToolCallsAreMadeForReal FAILs "the
  client was shown the calls written as text" (the raw [tool call …]
  deltas in the stream), TestClaudeTextToolCallsAskedOnce FAILs (reply
  ended end_turn after the first text call, run never asked),
  TestClaudeTextToolCallsUnstreamed and
  TestClaudePromptSaysPastCallsAreARecord fail too. Restored: all pass,
  also -race -count=3.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- go test -tags nogui -timeout 45m -count=1 ./internal/gateway/ (log
  teed): ok 515.4s. The first such run failed
  TestClaudeTurnWithItsImagesTakenOutGoesOnInItsRun (passes at
  34ad18ed8): push built each line from string(byte), which turns
  UTF-8 into Latin-1 runes, so "一只猫" reached the client garbled. Now
  s[i:i+1]; TestClaudeTextCallsHoldsOnlyTheLine has a CJK case that
  fails with string(ch) put back (shown "ä\xb8\x80只猫…") and passes
  without.
- Rebased on origin/main 8ef9fc578 (it changed internal/gateway's
  redact paths), then again at the pushed head: gofmt, the three vets
  ok, go test -tags nogui -timeout 45m -count=1 ./internal/gateway/:
  ok 385.4s. Rebased once more on 3b8bcc365 (Codex sign-in refresh,
  internal/gateway's signin_revoked.go): go vet of gateway and
  provider, and -run 'Claude|CodexRefresh' ./internal/gateway/: ok
  39.9s; the whole package not run again at that head.
- Full suite: not run; another session's go test ./... (pid 72083) was
  running on this machine.

Not tried: a real Claude Code or a real Claude subscription. Writing a
user message to an idle run after its result is the path resume already
takes for each next turn; that the model then makes the call it wrote
as text is not shown on a real model. Not tried with Claude Desktop.
2026-10-23 18:19:59 +08:00
yetoneandggbdpq 3b8bcc3654 provider: a ChatGPT token the backend calls expired before its exp is refreshed once and read again (willz on Discord, #2973)
willz on Discord (macOS, v0.1.1330): two saved Team Codex accounts showed
only "Unauthorized". /backend-api/wham/usage answered 401 "authentication
token has expired. Please try refreshing it." while each access token's
JWT exp was still ahead, so codexToken and savedLoginToken handed the
same token back on every read, and on every request, until the account
was signed in again. #2973 is the same 401 on the request path.

What changed
- SignInExpired (codex_expired.go) tells such a 401 by its words:
  token_expired, "authentication token is/has expired", "Please try
  refreshing it". It never matches refresh_token_expired, which is a
  revoked sign-in. accountJSON now keeps the first 4KB of a refusal's
  body on accountStatusError for it.
- Refreshes are keyed on the token that was turned away:
  codexTokenRenewing(dir, stale) for Codex's own sign-in and
  renewSavedLoginFrom(user, stale) for a saved one. Under the lock that
  signing waits on, each reads its store afresh. If the store holds
  another token by then (renewed by Codex or by another reply), that
  token is used and no refresh is spent, so two replies for one token
  spend one rotation. Otherwise they refresh. Codex's own sign-in is
  written back through codexStore.write (temp and rename, every other
  field kept). A saved one goes through writeLogins and only its own
  row is changed; nothing is matched by name.
- The usage read (codexWindowsRenewing) refreshes once on such a 401 and
  reads once more, never again. It is used by loginQuota (saved and
  current accounts), codexSubscriptionUsage, and the reset spenders
  through codexUserWindows (autoreset, expiring, stillExpiring), which
  read the same windows with the same tokens.
  - A refresh that is refused shows its own words on the card: a saved
    account is marked lapsed, "add the account again to use it"
    (savedRefreshFailed); Codex's own says "run codex login".
  - A token that was refreshed and is still called expired says "sign in
    to this account again" (errCodexStillExpired).
  - A refresh that got no answer is shown as that, not as signed out.
- Request path: noteSignIn renews the account a request went with
  (NoteExpiredSignIn, at most 20s, through Account.renew, which is set
  on Codex's own account and each saved one). Nothing is marked. The
  request fails over as a 401 did before, and the next one goes with
  the new token.
- Docs: providers-accounts.md ("A token called expired") and
  gateway-routing.md.

The request-path hook and its gateway tests (codex_refresh_401_test.go,
taken as written) are ggbdpq's patch on #2973. Here they rest on the
stale-keyed refresh. The patch's forced refresh skipped the fresh
keychain read, so it could spend a refresh token Codex had already
rotated.

Tests
- TestCodexUsageRenewsTokenCalledExpired: a saved and a current account,
  both with an hour left, get 401 token_expired. Each is refreshed once,
  read once more, and kept where it lives (auth.json in the sandbox
  HOME, logins.json). A second read refreshes nothing.
- TestCodexUsageExpiredOnce: a refused refresh says to sign in again; a
  token still called expired is read no third time.
- TestCodexUsageOther401NotRenewed, TestSignInExpiredWords,
  TestNoteExpiredSignIn (two replies for one token make one refresh).
- ggbdpq's TestCodexExpired401RefreshesLogin and
  TestCodexOther401DoesntRefresh.

Run at 482d6707a (this change) (rebased on 8ef9fc578):
- gofmt -l internal clean; go vet ./... (darwin), GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./... clean
- set -o pipefail; go test -tags nogui -timeout 45m -count=1 ./... in a
  sandbox HOME, log teed: every package ok (69 ok, no FAIL), provider
  221.1s, gateway 574.4s, agent 434.4s. No other full suite was running
  (another session's gateway-only run was).
Broken by hand: with codexWindowsRenewing's retry and NoteExpiredSignIn
turned off (the old behaviour), TestCodexUsageRenewsTokenCalledExpired,
TestCodexUsageExpiredOnce, TestNoteExpiredSignIn and
TestCodexExpired401RefreshesLogin are red. The card read "Unauthorized",
the reporter's words, and the gateway test's sign-in was "renewed 0
times, want once". The new tests passed under -race.
Not tried:
- the real ChatGPT backend or a real Team account; the live ~/.codex and
  logins.json are off limits to this session;
- a keychain-stored Codex sign-in (the fresh keychain read is the
  existing codexToken path, run here only through file stores);
- Windows and Linux beyond go vet.

Co-authored-by: ggbdpq <ggbdpq@gmail.com>
2026-10-23 18:15:15 +08:00
yetone 56418ac5cb gateway: a client's reasoning effort "off" is magpie's none (plugins#334)
A raw reasoning_effort "off" to the gateway wasn't read as off: no check
knew the word, so a Command Code DeepSeek (plugin 0.1.15) was asked with
no off level and still thought, while "none" turned thinking off
(CHENJIAMIAN on plugins#334).

serve now reads a Chat or Responses body's effort spelled "off"
(reasoning_effort, or reasoning.effort; any case, spaces trimmed) as
"none" before anything else reads the body (offAsNone), so every route,
retry and check downstream (bodyEffort, agentEffort, ThinkOff, the IR's
effortOf, fitEffort) sees magpie's own none. A model asked "<model>:off"
is asked as "<model>:none" (askedAt). What goes upstream is then what
"none" gives today: a model with an off level gets its provider's own
spelling of it (the Command Code plugin's "off"), and one without one
goes at its least level (fitEffort). A literal "off" is never forwarded.
saysOff scans for the word without parsing, so only a body naming it is
decoded; the rest of the body (numbers included) is kept as it came.
Anthropic's output_config.effort and Gemini's thinking level are left
alone: neither API has an "off" level. docs/subsystems/gateway-routing.md
says so.

Run at 85534cd07 (origin/main fetched) plus this change; the package run
below was at 68fb6b6d8 plus this change, rebased onto 85534cd07 with no
conflict (the four commits in between touch agent, sessions, provider's
partners, README and site only):
- gofmt -l internal/gateway: clean.
- go vet ./internal/gateway ./internal/provider (darwin), GOOS=linux
  -tags nogui, GOOS=windows: ok (at 85534cd07+this). go build ./... for
  darwin, linux -tags nogui, windows: ok.
- go test -tags nogui -timeout 45m ./internal/gateway/...
  ./internal/provider/... ./internal/catalog/...: ok (gateway 366s,
  provider 93s, catalog 5s). Not the full ./... suite: another session's
  go test -race -count=20 on internal/gateway and a go test on
  internal/agent and internal/sessions were running on the machine.
- After the rebase: TestPluginThinkingOff, TestOffAsNone, TestAskedAtOff
  and TestLoop* (which reads gateway-routing.md): ok.

Broken by hand: with the offAsNone call in serve and askedAt's :off
branch taken out, TestPluginThinkingOff's chat off, chat OFF spaced,
responses off and suffix off rows fail ("reasoning_effort sent [<nil>],
want none") and "no off, off" fails (sent [<nil>], want low);
TestAskedAtOff fails (askedAt("group/g:off") = "group/g:off", "").
The "chat low" and "chat none" rows pass either way.

Not tried: no real Command Code account; the plugin's off behaviour rests
on the reporter's measurements. The Codex backend path's direct relay to
ChatGPT (Codex's own models, not through serve) is unchanged; Codex never
sends "off".
2026-10-23 16:30:58 +08:00
Yang Yu a1cce7faa1 gateway: the decision model's timeout is a setting (#2934, reyoung)
A routing group's intent classifier (askChat) and System One (askJev)
were each given a fixed 8s. A slow subscription classifier can now be
given longer in Settings > Models > Replies > Intent classifier timeout.
settings.json's classifyTimeout takes 1..60 seconds; 0 or missing keeps
8s. save() refuses below 0 or above 60, and ClassifyWait clamps a value
edited by hand (below 1 gives 8s, above 60 gives 60s). A settings file
that can't be read gives Shared()'s defaults, so 8s, never no timeout.
Both askChat and askJev read it per call. The GUI row is the app's own
segmented control (8, 15, 30, 60, plus a value set by hand), and other
saves carry the value on (prefsKeep, api.go). zh, zh-TW, ja and de
strings; the routing reference and the en, zh, ja docs say it.

Ported from reyoung's classify-timeout-2934 (author kept). On top:
- askJev's defer reworded any error once ctx had expired, so a refusal
  (decideRefused) or an answerError read as the wait ran out lost the
  type askDecideTries rests an account by. Now only errNoAnswer, which
  systemOne returns when postDecide failed with ctx done, is reworded
  to "<provider> gave no answer in <wait>".
- ja intent.html: a stray space in "遅いモデルだと 設定した".
- app.js: the Image generation timeout row and the new row share
  waitRow (~350 bytes less). TestCoreScriptBudget was red (app.js
  1,337,982 > 1,337,000); budgets raised to the exact sizes, app.js
  1,337,633 and core 1,529,393, no room added.

Run (macOS, Go env pinned, sandbox HOME):
- Full go test -tags nogui -timeout 45m ./... at 766cf1cf9: 68 packages
  ok; internal/gui red on TestCoreScriptBudget only, fixed above.
- At ed008ca9f and again after rebasing on 65e80405b: internal/gateway,
  internal/settings, internal/gui ok; gofmt -l clean; go vet (darwin),
  GOOS=linux go vet -tags nogui, GOOS=windows go vet all ok.
- Whole GUI suite at ed008ca9f, chromium and webkit, 4 wide at load
  ~30: 11,930 tests, 52 red, none in the files this change reaches
  (classify-timeout-setting, image-timeout, i18n-keys all pass). The
  red files rerun alone: 44 red in 10 files, the same 44 on origin/main
  65e80405b. All have issues (#2228, #2399, #2150, #2448, #2276, #3091,
  #2549, #2163, #3099, #3104) except library-mcp-health-wsl's ja case,
  filed as #3350.

Broken by hand, each red then restored:
- classifyTimeout fixed at 8: TestClassifierTimeoutSetting and
  TestJevGivenTheClassifierTimeout red.
- askJev fixed at 8: TestJevGivenTheClassifierTimeout red.
- save()'s bound removed: TestClassifyTimeoutKeptAndBounded (-1
  accepted) and TestSettingsClassifyTimeout (61 gives 200) red.
- ClassifyWait's clamp removed: red (600 waits 10m0s).
- api.go's keep removed: TestSettingsClassifyTimeout red.
- prefsKeep's classifyTimeout removed: the GUI test's "sent on with
  other saves" red in chromium and webkit.

Not tried: a real slow classifier or account; Linux and Windows at
run time; the native Linux desktop build; a test that pins the askJev
refusal-at-deadline race (it is timing-only, so no deterministic red
was written for it).
2026-10-23 15:03:08 +08:00
yetone a6efe07cd7 davsync: a GitHub backup too large for one request goes up in parts (Zhang-Wei, Discord)
Zhang-Wei (Discord, v0.1.1327) saw every GitHub sync fail with "GitHub
sync: HTTP 422: Sorry, your input was too large to process. Consider
creating the blob in a local clone of the repository and then pushing it
to GitHub." Their exported backup is 50.8 MB; with the library's sync off
it works. 93b87d000 sends a backup as one base64 blob in one POST
/git/blobs, so 50.8 MB is about 68 MB of request body. GitHub documents
100 MB per blob (on read) but no request size for creating one; a 19 MB
file's Contents PUT (about 25 MB of body) did go through.

A backup over 16 MiB (githubPart) now goes up in parts, in the same one
commit: magpie.magpie-backup.parts/1, /2, ... beside it, and at the
backup's own path a short list (format magpie-backup, version 2, split
github-parts, total size, each part's blob SHA and size). The version is
the list's blob SHA, and the list names each part by blob SHA, so one
version pins one whole set. get() reads the list, downloads each part by
that SHA (as large single files already were), checks each part's git
blob SHA and the sizes, and returns the backup whole; a list that doesn't
add up or a part that isn't the one named is an error. A write removes
the parts the list at the head named and the new backup doesn't use, in
the same commit (only paths known to be there, so the tree never names a
missing path). Blobs already sent are kept across a non-fast-forward
retry. The errChanged check at the head, the ref update without force and
the three rebuilds are unchanged. Backups up to 16 MiB stay one file; the
64 MiB total (four parts) stays, the bound the library's skill budget is
sized for. An empty repository's first backup in parts skips the Contents
API and follows the README note commit.

Why parts, not compression: the sealed bundle is uncompressed JSON with
skill files base64 inside, so compressing would shrink it, but that is a
backup format change for every backend and every export, every other
computer would need the new magpie even for WebDAV and S3, and it still
bounds nothing on GitHub's side. Parts keep the format and touch GitHub
only.

Older magpies: the list opens in backup.Open (unchanged since efbe5660b)
as format magpie-backup with no kdf and version 2, so it says "this backup
was made by a newer magpie; update magpie to open it" and stops: not
ErrCorrupt or ErrNotBackup, so no rebuild over it and no replace offered.
A backup in one file, from any magpie, still reads.

Library: nothing found that shouldn't be carried, so no second commit.
readSkills already skips .git and caps skill files at 32 MiB (about
57 MiB sealed). The skills on this machine (~/.claude/skills, 64 skills,
43 MB; ~/.agents/skills) hold no node_modules, __pycache__ or .venv; the
large files are real assets (images). Leaving node_modules out could break
a skill that ships its dependencies. Zhang-Wei's folders weren't seen.

Tests (fixture only, no network): the fixture refuses a blob POST over
24 MiB with GitHub's text, and serves any blob by SHA. New in
github_parts_test.go: TestGitHubSplitBackup (50.8 MB in four parts, one
commit, byte for byte back, errNotModified, stale put errChanged, then
two parts and back to one file with no part left),
TestGitHubOneFileBackupStillReads (old small and 30 MB single files read;
parts replace one), TestGitHubPartsOlderMagpie, TestGitHubPartsDamaged,
TestGitHubPartsBranchMovedMeanwhile, TestGitHubEmptyRepositoryPartsBackup
and TestGitHubSyncLargeLibrary (a ~38 MB instruction text syncs to a
second computer through Now). TestGitHubLargeBackup now uses 15 MB, to
keep covering one blob over the Contents API's limit.
docs/subsystems/sync-backup.md says how parts work and names the tests.

Record, at base origin/main e435b8867 plus this change (Go 1.26.8,
GOMODCACHE/GOCACHE pinned):
- gofmt -l internal/davsync: nothing. go vet ./... (darwin): clean.
  GOOS=linux go vet -tags nogui ./internal/davsync/...,
  GOOS=windows go vet ./internal/davsync/...: clean.
- go test -tags nogui -count=1 ./internal/davsync/... ./internal/settings/...
  ./internal/cli/... ./internal/backup/... ./internal/library/...: all ok
  (davsync 58s, settings 30s, cli 47s, backup 8s, library 127s).

Red on the old github.go (new tests, a shim for the new names): every new
test fails, the split ones with the reporter's 422 text, OlderMagpie with
"not a magpie backup" (the old code wrote the backup as is).

Broken by hand on the new code, each red:
- stale parts kept: TestGitHubSplitBackup
- part SHA not checked: TestGitHubPartsDamaged/a_part_changed
- blobs sent again on retry: PartsBranchMovedMeanwhile/another_file
- version check at the head skipped: SplitBackup, PartsBranchMoved/
  the_backup, and the older Remote, LargeBackup, BranchMoved tests
- no split (threshold at 64 MiB): SplitBackup, OneFileBackupStillReads,
  PartsOlderMagpie, PartsDamaged
- sizes not added up: PartsDamaged/sizes
- list's format "magpie-backup-parts": PartsOlderMagpie
- empty repository tries the Contents API first: EmptyRepositoryPartsBackup
- list's version 1: OlderMagpie still passes, since old Open also stops
  on the missing kdf; version 2 is a second guard, not the only one.

Not tried: the real GitHub API (no test repository here); the 16 MiB part
is chosen under the largest body seen accepted, not a documented limit.
The full go test ./... and internal/gui's tests were not run: the disk had
under 500 MB free. -race not run; no goroutine was added.
2026-10-23 10:35:44 +08:00
yetone f81913994a gateway: a Responses Lite compaction's summary request offers no tools, and a reply without a summary says what it held (WuSix on Discord)
WuSix (Discord) got "compaction: codex/gpt-6-astra failed to summarise
this conversation 3 times in a row (last: the model wrote no summary)".

codex/gpt-6-astra's catalog entry is Codex's own (codexcat.ownEntry), and
Codex's entry puts gpt-6 on Responses Lite: its tools go as an
additional_tools input item, none in tools. codexInputAs set "tools": []
for magpie's summary request but left that item in, so the model was
asked for the summary with every Codex tool still offered (tool_choice
auto, which codexBody sets anyway). A reply that is a function_call and
no message is "the model wrote no summary". codexInputAs now leaves the
additional_tools item out when it turns the trigger into the summary
prompt; calls in the history stay as they came.

The 502 and the held message now say what the reply held instead
(answeredWith: "(it answered with function_call shell)", "reasoning",
"nothing"), so the next report says which it was.

Hypothesis, not confirmed on a real reply (see below): the fake backend in
TestCodexLiteCompactionOffersNoTools answers a call whenever any tool is
offered, as an agentic model mid-task may. What the test holds is that
the request offers none.

Run at base 398803e3f (origin/main), in this worktree:
- TestCodexLiteCompactionOffersNoTools red before the fix (502
  "compaction: the model wrote no summary"), green after
- gofmt -l internal/: clean
- go vet ./internal/gateway/, GOOS=linux go vet -tags nogui, GOOS=windows
  go vet: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway/: ok
  (366.6s); only comments and docs changed after it started

Real ChatGPT backend, the owner's Codex sign-in (access token read
from ~/.codex/auth.json, not refreshed), 2026-10-23: the exact body
magpie sends upstream, captured from the gateway with a fake backend
(before and after this change), then POSTed to
chatgpt.com/backend-api/codex/responses with Codex's headers and
X-OpenAI-Internal-Codex-Responses-Lite: true. gpt-6-astra, effort low,
reasoning.context all_turns; a developer prompt, a user ask, a
function_call shell (namespace "functions") and its output, then the
compaction prompt. Three tries each:
  (a) old: additional_tools kept, tool_choice auto  200 x3, message
      (978/1010/1037 chars)
  (b) this change: additional_tools left out        200 x3, message
      (1176/1003/991 chars)
  (c) additional_tools kept, tool_choice none       200 x3, message
      (972/1009/1026 chars)
So the backend takes a Lite request whose history calls the "functions"
namespace with no additional_tools item: the fix doesn't 400. The old
request also summarised on this short history, so the cause of WuSix's
reports isn't reproduced on the real backend; with a long tool-heavy
conversation at a higher effort it may still be, and answeredWith will
say.

Not tried: a long conversation, efforts above low, and WuSix's own
conversation.
2026-10-23 09:20:23 +08:00
yetone 398803e3f5 gateway: a model slow to start again and again rests on its account (小八)
小八 on Discord (2026-10-23): a WorkBuddy plugin account answered magpie's
own 504 "no first token in 30s" 58 times on kimi-k3-1 and glm-5.3 (the
vendor's per-model token limit, which it never names, it just stalls).
The group went on each time, then asked the same account first on the
next request: 15 slow starts in 17 minutes in one session.

Cause: gateway.go's hw.slow branch (the group's FirstToken let a member
go) never rested anything, by design ("a long prompt being slow to start
anywhere"), and nothing counted slow starts. So every request waited out
the whole FirstToken on the stalled member before falling back.

Now restSlow (routing.go) counts slow starts per restID (provider,
account or key, model). Once rests nothing, as before. The second in a
row, within slowForget (30m) of the last, rests that model on that
account: 1 minute, doubling each time after, capped by the provider's
RestCapOr(longestRetry), never for a provider whose rest cap is off. An
answer clears the count (servedCandidate). A client-cancelled request
never reaches the slow branch, so it counts nothing. A longer rest
already there is kept. The rest carries Rest.Model, so the Routing page
shows it on that model's rows only. The Routing story of a rested slow
try says so, and the group editor's slow-to-start hint no longer says
"It doesn't rest" (en, zh, zh-TW, ja, de).

Tests: TestSlowStartsRestTheModelOnItsAccount (once: no rest; an answer
in between restarts the count; twice: the model rests on k1 with Key
a#k1/m, Model m, under a minute; k1's whole key and k2/m don't rest; the
next request asks k2/m first; a/n still goes to k1; a third slow start
backs off longer; an answer ends it). TestCanceledSlowStartRestsNothing
(three client cancels during the first-token wait: no rest, no count).
routing-went-on.test.cjs gains a rested slow try in five languages;
group-first-token.test.cjs's i18n list has the new strings.

Broken by hand: restSlow's result ignored in gateway.go -> the first test
red at "twice in a row" (Rest nil); servedCandidate not clearing
routed.slow -> red at "an answer in between starts the count again";
restSlow called in the cancel branch -> the cancel test red at "cancel
2: k1/m wasn't asked (rested?)". All restored, green.

Run at the worktree on base 7aad6a50e: gofmt -l clean; go vet darwin,
GOOS=linux -tags nogui, GOOS=windows: ok. The two new tests -race
-count=3: ok. TestGroupFirstTokenFailsOver, TestNestedGroupFirstToken:
ok. GUI: the 125 routing-*, group-* and i18n-* files, Chromium and
WebKit: 1428 of 1429; the one red, routing-rule-remove de (menu focus
after ArrowUp, the #3094 symptom), passed 20 of 20 alone. Full suite:
set -o pipefail; go test -tags nogui -timeout 45m ./... : 69 packages ok, none failed (gateway 544s, agent 430s, provider 234s).

Not tried: a real WorkBuddy account stalling on its token limit; the
fixture stalls by holding its stream after the role chunk.

Rebased on origin/main ecd983500 (no gateway or routing plugin change in between) and run again there: gofmt, the three go vets, internal/gui (budgets) ok, the four first-token gateway tests ok, i18n-keys, routing-went-on and group-first-token in both engines 43 of 43.
2026-10-23 04:03:39 +08:00
yetone ecd9835005 agent: Claude Code's subagent effort writes nothing without a subagent model (KorenKrita)
KorenKrita on Discord (cause confirmed by them): with Claude Code's
subagent model unset ("Claude Code picks") and a subagent effort set,
claude.go wrote spell(tierWith(main model, effort)) into
env.CLAUDE_CODE_SUBAGENT_MODEL. That pinned every subagent to the main
model, so Claude Code's own pick (the Agent call's model, the subagent's
frontmatter) never ran.

Agent wiring (internal/agent/claude.go):
- With no subagent model, magpie writes no effort, and
  CLAUDE_CODE_SUBAGENT_MODEL stays unset.
- The saved effort is kept, not deleted (the user set it). It lives in
  the stash under claude.subagent_effort, and the subagent effort's Get
  reads "" while there is no model. A model picked later takes it
  ("v/glm:high").
- A value an older magpie wrote that way (the main model at an effort,
  not own, while routed: subagentFollowing) is moved into the stash and
  taken out of the env by writeTiers and by Sync on start.
- subagentOwn no longer counts that value as the user's own model.
- Doc: docs/subsystems/agent-wiring.md, the Claude Code "subagents" entry.

GUI (window, opened Claude Code row):
- The subagent effort moves from its square under the session defaults
  to the right of the Subagents row. It uses the tier rows' markup and
  code (effortBtn in connectPanel, ag-eff), so it lines up with
  Opus/Sonnet/Haiku's effort.
- While the subagent model is unset it shows Default, is disabled, and
  its title says "Set a subagent model first". The new string is in zh,
  zh-TW, ja and de.
- The old square is removed from the opened row. No other layout changes.
- The tray panel's own square is left alone: #3308.

Tests:
- New internal/agent/claude_subagent_effort_test.go
  (TestClaudeSubagentEffortNeedsAModel). On the old code it is red:
    an effort with no subagent model wrote
    CLAUDE_CODE_SUBAGENT_MODEL="v/glm:high"
  With the Sync branch broken by hand it is red at "Sync left an older
  magpie's CLAUDE_CODE_SUBAGENT_MODEL="v/flash:high"". It also checks
  that a set model plus effort still writes "v/glm:low".
- claude_tiereffort_test.go now expects no env for an effort with no
  model.
- New internal/gui/tests/claude-subagent-effort-row.test.cjs (16 cases):
  chromium/webkit x en/zh x 1100/560px x with/without a subagent model.
  It checks:
  - the control sits in the Subagents row at the tier efforts' x and
    height;
  - with no model it is disabled at Default and opens no slider;
  - with a model it posts subagent_effort, with no scroll;
  - the old square is gone.
  It is red against the old app.js ("the old square is still there").
- tier-effort.test.cjs is updated for the moved control.

Run at this tree (parent f985d6bdb):
- go test -count=1 ./internal/gui/ ./internal/agent/ ./internal/provider/:
  ok.
- GUI: claude-subagent-effort-row, tier-effort, i18n-keys,
  subagent-effort, claude-subagents-pick, desktop-subagent-model,
  agent-prefs, agent-tweak-fold, claude-signin and agent-field-names:
  147/147.
- gofmt clean. go vet darwin, linux -tags nogui and windows: ok.

Run at the same change before its last rebase:
- Full Go suite (`go test -count=1 -timeout 45m ./...`, sandbox HOME,
  through the suite lock) at 11b9d671c (on 45593cc1d): every package ok
  but internal/gui's TestCoreScriptBudget. app.js was 1,337,535 bytes,
  over its 1,337,000 budget, after the rebase brought in upstream growth.
  This commit trims its own additions to 1,336,991 (one shared effortBtn,
  shorter comments, a shorter new string) and raises no budget.
  TestCoreScriptBudget now passes.
- Full Go suite at 41737d214 (on 802fb6e61): all 69 packages ok.
- Whole GUI suite at 41737d214 (11,741 tests, 5.8h at load ~250): 48 red,
  none from this change.
  - Red the same on origin/main 45593cc1d, all filed: quota-count-wrap
    and quota-name-translated (#2228), quota-reads (#2150), s3-sync
    (#2448), usage-agents-hide (#2276), usage-checkin (#2549, #3091),
    usage-fold (#2163), usage-ledger (#3104, #3001).
  - Red under load only and green alone: agent-notice-lang (#2960),
    agent-stale-copies (#1949), modal-morph (#3179), plugin-card-update
    (#3079), plugin-github (#3218), and agent-field-names and
    api-key-theme (filed as #3307).
  - Also seen red once under load: codex-subagent-model's fixed 300ms
    wait (#3277).

Not tried:
- a real Claude Code run reading the written settings;
- the Windows box;
- the whole GUI suite again after the string was shortened (only the
  files above were run);
- the tray panel (#3308).
2026-10-23 03:44:55 +08:00
yetone 4f6498f822 routing, usage: an account renamed in magpie reads by its new name (magpie-community/plugins#310, molvqingtai)
molvqingtai renamed a Kiro (plugin) account from "example@gmail.com (foo)"
to "example@gmail.com (bar)", and the Routing page kept saying "(foo)" on
every request made after. Cause: the Routing page never looked up the
user's name at all. A trace's `who` is the vendor's account name
(Weighed.Who), and plugins/routing/client.js showed it as it was. Usage
records (ProviderAccount) keep the vendor's name the same way, and the
Usage page's Accounts, the request log's Account filter, `magpie usage`,
a gateway key's accounts (AccountNames, /api/caller-keys) and Routing's
"Several accounts" pools (onOf) all showed it raw too. This affected
built-in and plugin providers alike.

Records still keep the vendor's name. It is the key the user's name is
stored under (providers.json AccountNames, in lower case), so it stays
the identity: Routing still groups and ranks by `who`. The name is looked
up when it is shown: provider.AccountShown / AccountShownOf /
AccountRef.Shown in Go, and userShown (accountNameOf over /api/providers'
accountNames) on the Routing page. So requests from before the rename
read by the current name too, and a cleared name goes back to the
vendor's. A key's name and an unnamed account read as before.
Already right before this change: quota cards and the menu bar (Alias),
`magpie accounts`, and the editor's account row.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- Red on the old code: TestAccountNameOfAPluginAccount, with
  AccountNames put back to a.User, fails with "a gateway key's accounts
  read [fakeco/31****36@qq.com]". The new GUI test
  routing-account-name.test.cjs, with the old client.js, fails with
  "renamed, the account reads by its new name: Kiro example@gmail.com
  (foo) Pro".
- routing-account-name passes, en and zh, both engines. internal/provider,
  internal/usageapi, internal/cli and internal/gateway ok.
- The five usage files this change's first run found red: usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold (#2163) and usage-ledger
  (#3104) are red alone at the stack and on main the same way.
  usage-overview-fold now passes alone at both.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: a real Kiro account. The fixture is the reporter's case, with
their names.
2026-10-23 01:58:01 +08:00
yetone cba59b05e1 gui: the middle button's autoscroll scrolls a page instead of twitching (#2767)
#2767 (znbsf, with AvatarGanymede's recording on the Discover page) and
多喝热水 on Discord, on Windows: pressing the wheel and moving the mouse
made a page twitch instead of scrolling, or pulled it back. znbsf's patch
found the same cause.

Chromium and WebView2 give the autoscroll a pointerdown of button 1 and
then no wheel, touch or drag of the reader's. The "where the reader is"
rule put back each of its scrolls as it came, so the page twitched
between where it went and where it was.

What changed (internal/gui/assets/app.js, the click guard):
- From a trusted middle press on a view that can scroll (`panning`),
  that view's scrolls count as the reader's, and what a click held is let
  go. This lasts until the autoscroll ends as Chromium ends it: on the
  next press (seen only as a pointerup with no pointerdown), on a key, on
  blur, or on the lift after the mouse moved more than 15px while held.
- A field the guard brings back into view after putting a scroll back
  must have been focused since the reader last scrolled that view
  (`scrolledFrom`). Before, the button the middle press focused, which
  the autoscroll or the wheel took out of sight, was brought back by the
  next scroll that was put back, and the page jumped to it.
- docs/subsystems/gui-shell.md says both.

Guarded by internal/gui/tests/view-middle-autoscroll.test.cjs: a real
middle press and move in Chromium, en and zh, a scroll by code still put
back after the autoscroll ends, and WebKit (no autoscroll) left as it
was.

Broken by hand:
- app.js put back to its base: Chromium 0/3 ("the autoscroll scrolled
  the page: at 0, passed 0,0,0,…"). WebKit passes, as expected.
- Only the panning line taken out: Chromium 0/3, same message.
- Only the scrolledFrom check taken out: Chromium 0/3 ("after the
  autoscroll: a scroll by code is put back (was 374, asked 1212, at
  126)").

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- view-middle-autoscroll and click-scroll pass, both engines.
- plugin-github's "a click scrolls nothing" (1px) was red under the
  whole run's load and passes alone at the stack and on main (#3218).
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: the real Windows app (WebView2) on the Windows box; only
headless Chromium's autoscroll. Linux WebKitGTK has no middle-button
autoscroll, so it is left as WebKit is.
Not done: znbsf's patch doesn't start this on a middle press on a link
(which opens a tab, not an autoscroll). Here it does start, and lets a
scroll by code in that view stand until the next press or key. Left on
#2767, which stays open for the reporters.
2026-10-23 01:58:01 +08:00
yetone c417b1f4e3 library: a skill removed from its source is said so, and every such skill goes in one click, asked first
スライム on Discord (#help, 10-22): taste-skills took some of its skills
out, Update all reported each of them as a failure, and the only way
out was to delete them one by one.

An update or a check that reads the source whole and finds the skill's
folder (or its SKILL.md) gone now calls it removed upstream, not a
failure. GitHub tarballs and other git repositories both work this way.
- UpdateSkill returns *GoneError.
- UpdateSkills and UpdateSomeSkills list it in Result.Gone, not
  Unupdated.
- A check gives status "gone".
- Each marks Skill.Gone. The mark is cleared when a check or an update
  finds the skill there again.
- A fetch that failed, a skill left out of a fetch as too big, and a
  folder that can't be read stay unknown, never gone (goneFrom).

Nothing is deleted by itself. RemoveGoneSkills takes the named skills
out, or every marked one when none are named, through RemoveSkills, so
the folders go to the backups. A skill found in its source again is
kept and said so.
- GUI: a "Removed upstream" tag replaces Update available and the
  update icon. Update all says gone skills apart from failures. "Clean
  up N" sits in the group heading, or in the bar when there is one
  group, and opens a sheet naming each skill. One changed here carries
  "Changed here". Strings are in en, zh, zh-TW, ja and de.
- CLI: `magpie library skill rm --gone [--yes]` asks at a terminal and
  refuses without --yes otherwise. It names the ones changed here.
  update and status print the hint.
- TUI: the row says "removed from <repo> · d takes it out".
- API: POST /api/library/skills/remove-gone {names}.
- Docs: the Skill updates row and Verification in
  docs/subsystems/library.md.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- skill-gone passes, chromium and webkit, en and zh, 860 and 400px.
- internal/library, internal/cli and internal/tui ok, the Gone tests and
  TestLibrarySkillRm among them.
- The rebase onto main met c2636b7b5's Verification line in library.md;
  both sides' tests are kept in it.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Broken by hand, each red, then restored:
- prepare not returning GoneError
- apply not clearing Gone
- leftOutAt ignored
- every Stat error read as absent
- the git check not saying gone
- RemoveGoneSkills taking a skill that isn't marked

Not tried:
- the real taste-skills repo over the network
- the Windows box
- a skill CC Switch installed (Origin, adopt path), which still reports
  as a failure
- a GitHub check with a known commit, which keeps an existing gone
  mark but only marks gone after an update
2026-10-23 01:58:00 +08:00
yetone 93b87d0004 davsync: a GitHub backup too large for the Contents API goes up as a blob (Zhang-Wei, Discord)
Zhang-Wei (Discord, v0.1.1318, 102 skills) saw every sync fail with
"GitHub sync: HTTP 422: Sorry, the file is too large to be processed"
on magpie/magpie.magpie-backup; the last backup that went up was about
19 MB. The Contents API's PUT refuses files well under the 100 MB a blob
can hold.

A repository with commits is now written through the Git Data API:
the ref's head, the file's version at that head (it must still be the one
sync read, or errChanged), a base64 blob, a tree on the head's tree, a
commit with the head as its parent, and a ref update without force. Still
one commit per write or removal, and the version is the blob SHA as
before. A ref update that is not a fast-forward is built again on the new
head (the blob is kept), up to three times, then errChanged; if the new
head changed the backup it is errChanged at once, so another computer's
backup goes through the normal merge. A branch deleted meanwhile is an
error, not created. Usage files and their removal take the same path.

An empty repository has no head to build on, so its first write still
goes through the Contents API (one commit, unchanged). If that is refused
as too large (422 "too large" or 413), a short README.md in magpie's
folder makes the first commit and the backup follows as the second.

Reading was already right for large files: the object media type gives
encoding "none" over 1 MB and bytes() downloads by blob SHA; the new
test covers it at 21 MB.

The fixture now serves the Git Data API (blobs, commits, trees, a
fast-forward-only ref update) and refuses a Contents PUT over
contentsLimit with GitHub's 422 text. docs/subsystems/sync-backup.md says
how writes go and names the new tests.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/davsync and internal/cli ok, the GitHub large-backup tests and
  TestGitHubCmd among them.
- s3-sync.test.cjs (WebKit en) is red alone on main too: #2448, the
  header over the form's tick. This commit doesn't touch the GUI.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Red on the old github.go (the new tests with the old code):
TestGitHubLargeBackup and TestGitHubEmptyRepositoryLargeBackup fail with
"HTTP 422: Sorry, the file is too large to be processed", TestGitHubRemote
too at its 1.26 MB put, and TestGitHubBranchMovedMeanwhile's three
subtests fail.

Broken by hand on the new code, each red:
- version check at the head skipped: TestGitHubRemote, LargeBackup's
  stale put, BranchMovedMeanwhile/the_backup
- no rebuild on a non-fast-forward: BranchMovedMeanwhile/another_file
  and /the_backup
- large read by base64 only: TestGitHubRemote, TestGitHubLargeBackup
- no README initialization: TestGitHubEmptyRepositoryLargeBackup (409)

Not tried against the real
GitHub API: the fixture follows GitHub's documented Git Data API, and
GitHub's exact Contents API size limit is not documented.
2026-10-23 01:58:00 +08:00
yetone efd4770015 agent: a reasoning effort picked in VS Code's Copilot Chat survives magpie's sync (chim3744 on Discord)
chim3744 (magpie 0.1.1318) picked "max" for a magpie model in Copilot
Chat's model picker, and requests went out at "low".

Cause: VS Code 1.142 keeps that pick inside the provider group, as
settings["<model id>"].reasoningEffort (languageModels.ts
setModelConfiguration). magpie's setGroup built its group with
vscodeGroupJSON, which has no settings key, compared the whole object
with sameJSON, and edit.SetJSONItem replaced the whole group. Every Sync
(catalog.Changed on start, a vendor list fetch, a provider edit) and
every magpie model pick in VS Code wiped the pick, and Copilot Chat fell
back to the model's first level ("low" of [low, high, max]).

Fix: vscodeGroupKept lays magpie's group over the one in the file with
mergeTheirs, as theirsKept does for the other agents (#2030). Every key
magpie doesn't write stays: settings, and anything else VS Code or the
user puts there, such as an apiKey reference. The models list stays
magpie's whole, so a model gone from the catalog still leaves it. The
settings of a model magpie no longer lists are kept, since they are the
user's values. When nothing magpie owns changed, the compare is a no-op
and the file is not written. This covers VS Code, VS Code Insiders and
VSCodium (customendpoint and customoai), every profile, since all go
through setGroup. agent-wiring.md lists what is kept.

Siblings checked:
- chatLanguageModels.json is written only by vscode.go. Cursor
  (cursorlocal.go) writes nothing of Cursor's. magpie writes no
  language-model groups for Windsurf, Trae or Kiro IDE.
- Every other syncJSON caller in internal/agent already merges through
  theirsKept, piBlockKept, openCodeKept, mothxBlockKept, qoderKept or
  t3Merged (2eee900dc, #2030's siblings). That covers Pi, Crush, Ante,
  Aside, MothX, StepCode, OpenCode, Qoder, Cline, Command Code, Pencil
  and T3 Code. The exception is Zed's available_models. That is
  magpie's model list, an array, and Zed keeps the model the user picked
  in agent.default_model, outside it.

Test: TestVSCodeKeepsThePickedEffort. It writes the group as VS Code
does after a pick (settings for a listed model and for one no longer
listed), then runs a Sync with nothing changed (the file must stay byte
for byte), a Sync after the catalog gained a model, a magpie model pick,
and a Sync after a model went (the list shrinks and both settings stay).
With the fix broken by hand (want = v, the old whole rewrite) it fails:
"vscode_test.go:550: a sync with nothing changed: the picked effort is
"", want max". With the fix restored it passes.

Record for this push: 13 commits on origin/main ca4a1cde0, head tree
539c84e92. Go 1.26.8, sandbox HOME, GOMODCACHE/GOCACHE pinned. The full Go
run and vet were at tree d6393dfc8, the same Go code as this head: only
app.js comments (cut under the core script budget) and one ja string
changed after it.
- gofmt -l: nothing. go build ./...; go vet ./... (darwin), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./...: clean.
- go test -timeout 45m ./..., through tee, one suite on the machine:
  68 packages ok. The one red was internal/gui's
  TestCoreScriptBudget: app.js 1,335,314 > 1,335,000, since main grew
  app.js under the stack. The autoscroll commit's own comments were cut
  (to 1,334,629) rather than the budget raised, and go test -count=1
  ./internal/gui is ok at this head (113s). Packages the run took from
  Go's test cache had the same inputs.
- GUI: the 18 files this stack touches or names, both engines,
  202 of 204 pass (tree 068acf128, this push less the last commit). The
  two reds: gui-ja, red on main since c2636b7b5 and fixed by this push's
  last commit (gui-ja and i18n-keys 6 of 6 there), and usage-fold's
  chromium "several accounts" (#2163, red on main the same way).
- internal/agent ok in that run, TestVSCodeKeepsThePickedEffort with it.
- No GUI file reaches this change; the GUI suite's reds below are none of
  its.
  The whole GUI suite ran at 1c1fc7183 (this stack's first 12 commits on
  0ddcf28a1): 11713 of 11769 pass. Each of the 21 red files was then run
  alone at the stack and at origin/main 8278fd9b0. Eight are red the same
  way on main: plugin-card-update (#3079), quota-count-wrap and
  quota-name-translated (#2228), s3-sync (#2448), usage-agents-hide
  (#2276), usage-checkin (#3091), usage-fold's chromium "several
  accounts" (#2163), usage-ledger (#3104). The other 13 pass alone on both
  and were red only under that run's load (50 to 335): currency #3101,
  plugin-github #3218, provider-fetch-again #3292, rest-try-now #2564,
  routing-auto-reset #3293, routing-keys-fold #1612, routing-steady #1804,
  routing-wb-restricted #1905, sessions-folder-delete #2218,
  sessions-manage #3294, switch-only #3295, text-size #1866, usage-pack
  #3296.

Not tried: real VS Code/Copilot Chat.
2026-10-23 01:58:00 +08:00
yetone ca4a1cde0d dsh: maxTokens leaves dsh half its window, or a quarter for output where that is more (#3298 item 3)
822f2b304 (#2823) held the maxTokens magpie lists for dsh to a quarter
of the window, because dsh reserves it, plus 65536 of headroom, before
it compacts (compaction-basic's resolveCompactSpec: threshold = min(0.8W,
W - maxTokens - 65536)). On a large window the quarter cut more than
compaction needs: DeepSeek's own deepseek-flash, 1000000/393216, was
listed at 250000, though all 393216 leaves dsh 541248 (54%).

Now the cap is max(W/4, W/2 - 65536): the output may take what leaves
dsh half the window to compact in, or a quarter of the window where that
is more (every window under 262144, where there is no half to spare
beside the headroom). A Max output the user set is still written as set
(outputOr), and contextWindow and /v1/models don't change.

dsh 0.2.0-rc.2's own resolveCompactSpec, run on the installed
compaction-basic over each figure (threshold tokens):

| window / output | vendor | quarter (main) | now |
| 524288 / 524288 | no message budget | 131072 -> 327680 | 196608 -> 262144 |
| 500000 / 393216 (#2823) | 41248 | 125000 -> 309464 | 184464 -> 250000 |
| 131072 / 65536 | no pressure budget | 32768 -> 32768 | 32768 -> 32768 |
| 1000000 / 393216 | 541248 | 250000 -> 684464 | 393216 -> 541248 |
| 400000 / 128000 | 206464 | 100000 -> 234464 | 128000 -> 206464 |
| 200000 / 393216 | no message budget | 50000 -> 84464 | 50000 -> 84464 |
| 128000 / 393216 | no message budget | 32000 -> 30464 | 32000 -> 30464 |

#2823's case stays fixed: 250000 is half its 500000 window (its
reporter's own plan A), against 41248 before 822f2b304; it is lower than
the quarter's 309464, which is the trade. The 128K and 200K windows
#3298 names don't change: any output above the quarter there takes it
straight out of what dsh compacts at, and a user who wants more sets Max
output.

Tests: TestDshOutputLeavesCompactionRoom's table takes the new figures
and adds DeepSeek's 1000000/393216 (393216), 200000 and 128000 windows;
its check now holds dsh's threshold at half the window where the window
has one, never under what a quarter leaves. TestDshModelLimits'
400000/128000 is now 128000; TestMaxTokensWithinContextWindow's dsh
figure follows the formula (its windows are all under 262144). Broken by
hand: the quarter alone (main) is red on 4 cases ("maxTokens 250000;
want ... 393216"), W/2 - 65536 alone on 3 (131072 gets 1), no cap
(pre-#2823) on #2823's own cases (524288/524288, 524288/1048576,
500000/393216, 131072/65536) and the 200K and 128K windows. docs/subsystems/agent-wiring.md says the new rule.

Run at 5adad1877 (this commit on top of item 4's): gofmt -l (nothing),
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... (all clean), go build for darwin, linux (nogui) and windows (ok),
and go test -tags nogui -timeout 45m ./...: all 69 packages ok, exit 0
(gateway 505s, agent 401s, provider 197s).

Not tried: a real DSH session against a 1M DeepSeek model through
magpie; the thresholds above come from dsh's resolveCompactSpec run
directly. Windows under ~87K (64000/384000 -> 16000) still leave dsh no
pressure budget, on main too; that needs a policy of its own and isn't
changed here.
2026-10-23 01:20:37 +08:00
yetone c2636b7b5b library: an MCP command given to agents in WSL is checked in their distro
loong on Discord, Windows host with agents in WSL: a stdio server whose
command is a WSL program (`node /home/loong/tools/xxx.js`), given only to
WSL agents, showed "exited (1) … Node.js v24.9.0" on the Library's MCP
page. The check started it on Windows, where his agents never do; a
sibling written as `wsl -d Ubuntu … node …` checked fine.

What changed:
- checkSides (mcp_check_wsl.go) reads each agent id's `@wsl:<distro>`.
  No WSL agent, not Windows, a Windows path for the command
  (windowsPath: magpie's own image server, `C:/x/npx.cmd`) or Settings'
  Detect agents in WSL off: this computer, as before. Otherwise each
  distro is a side, after this computer when an agent here has it too.
- In a distro the command is found as the agents' shell finds it
  (new wslrun.In: the same login-then-interactive probe Find uses, so
  nvm's node is found; cached for findAge) and started through
  wslrun.Tool.Command, the existing `wsl.exe -d D --exec /usr/bin/env
  PATH=… MAGPIE_WSL_RUN=… <path> args` path, so no new quoting. Its
  env goes over WSLENV (Tool.Env); its Cancel stops the run inside the
  distro.
- A distro that isn't running is never started for a check: Why
  "wsldown", naming it, painted as not checked (ring), like novar.
  Beside a side that was checked it is left out.
- Mixed: each side in turn, the first failure ends it. ServerHealth
  gains Checked (where it started, "" for this computer); the row says
  " · WSL Ubuntu" / " · Windows" on a failure, the tooltip "Failed in" /
  "Checked in". New strings in zh, zh-TW, ja, de.
- healthKey (Go and client.js) includes the sides, so agents moving into
  WSL is a check anew.
- docs/subsystems/library.md says all this.

Tests:
- TestCheckWSLOnlyServerInItsDistro: ok in Ubuntu with the exact wsl.exe
  argv; a stopped Arch is wsldown with no probe and no run; a command
  the distro lacks is notfound there.
- TestCheckWindowsServerHere: a Windows-only server checked here, WSL
  never asked; Windows-path commands stay here.
- TestCheckMixedServerEachSide: ok in both; WSL exit named Ubuntu's;
  Windows failure stops before WSL; stopped distro = checked here only;
  healthKey differs when agents move into WSL.
  All force wslrun.On and fake wsl.exe (Run) and the distro run
  (wslCommand runs this test binary as the fake server).
- library-mcp-health-wsl.test.cjs: chromium + webkit, en/zh/zh-TW/ja/de.

Broken by hand, each red:
- checkSides always this computer: WSLOnly and Mixed red.
- windowsPath exemption removed: WindowsServerHere red.
- mixed drops this computer: Mixed red.
- healthKey without sides: Mixed red.
- stopped distro reported as a failure: WSLOnly and Mixed red.
- client.js without the " · <place>" on a failure: the GUI test 12 of 12 red.

Run:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok.
- GUI: the 94 library-*/mcp-*/i18n-* files, both engines: 780 of 783;
  library-loading (webkit) and library-pick-remove (chromium zh-TW) red at
  --test-concurrency=4, load ~45, pass alone 3 of 3; filed #3300, #3299.
- Full suite at 3831de1a3 (base 1d1c5cf9c), go test -tags nogui -timeout 45m ./..., alone on the machine: every package ok, no FAIL (library 334s, gateway 515s, agent 394s).

Not tried:
- A real Windows + WSL run: the Windows box (10.0.0.132) didn't answer
  ssh. The argv is magpie's existing WSL launch path, unchanged.
- In a distro the command's cwd is what wsl.exe gives it (the Windows
  home under /mnt/c), not the Linux home an agent starts in.
- A Windows program reached from WSL by interop (npx.cmd under /mnt/c)
  given to WSL agents is skipped by the probe and can show notfound.
- A command the probe can't take as a plain name (spaces, quotes): an
  absolute path runs with the default PATH, anything else is notfound.
- A stopped distro beside an ok Windows side isn't shown on the row.
2026-10-23 01:00:44 +08:00
yetoneandskygunner 8278fd9b0c gateway: Volcengine Ark's monthly 429 rests the key until the reset it writes (+0800 CST), not 15 minutes (#3251 CNife, #3276 wyx1818)
Ark's 429 for a used-up month says "You have exceeded the monthly usage
quota. It will reset at 2026-10-25 23:59:59 +0800 CST." with no
Retry-After. resetsWhen read an offset only after UTC or GMT, so nothing
read it, the key rested quotaRest and was asked again every 15 minutes
until the month turned. Two more limits stood behind that one: a written
reset over 7 days off (longestWritten) isn't read, and a quota rest is
held to 8 days (longestQuota), so wyx1818's reset 9 days off would still
have fallen to the 15-minute loop.

- resetsWhen also reads the time as Go prints one (Ark's): four offset
  digits, a space and the zone's name in capitals, then punctuation or
  重置. The offset is read, the name isn't (CST is more than one zone).
  The UTC/GMT form is unchanged; a bare offset with no zone's name, or
  "+08:00" without UTC, isn't read, as Ark doesn't send them.
- monthlyWords (monthly, 月度, 每月, 本月): a refusal that says its
  allowance is a month's has its written reset believed up to
  longestMonthly (35 days) instead of the week (longestSaid). That covers
  Zhipu's 1310 "Weekly/Monthly Limit Exhausted" too (resetsZhipu), the
  sibling held to the same week.
- In failQuota the 8-day cap is lifted to 35 days only when the rest
  came from the vendor's own reset ("resets") and the refusal is a
  month's. A window read full, a Retry-After and the user's own quota
  rest are held to 8 days as before.

Ported from skygunner's branch skygunner:fix/volcengine-resets (e6c2b6fb,
posted on both issues). Taken: the monthly trust window, longestMonthly,
monthlyWords, the reporters' bodies as fixtures and the shape of
TestMonthlyWrittenResetRestsTheMonth. Changed:
- its regex made UTC|GMT optional and took any 2 to 5 letters,
  case-insensitively, after any offset, for every vendor, so "reset at
  <date> +8 now." would read. Scoped here to Go's layout, the zone's
  name matched case-sensitively.
- it lifted the cap to 35 days whenever the body said monthly, whatever
  the rest came from (a window read full, the user's own rest); here
  only for the vendor's written reset.
- its resetsZhipu kept the week; here it shares longestSaid.
vincenty on Discord: no link to another fix is on either issue
(skygunner's commit is authored as "vincent").

Not changed: Ark's plan windows read by its AccessKey (volcPlanQuotas)
still reach only the usage card, not routing (layer 2 of #3251: the
quota is the account's, not one inference key's, and a provider has one
plan, #2849). #3251 stays open for it.

Tests (fixtures: #3251's and #3276's bodies byte for byte, #3276's as
its pretty-printed JSON):
- TestResetsWritten: ark (3 days), ark 9 days off, ark escaped, 35 days
  read and 36 not, past, cut after the offset / in the offset / before
  the full stop, without the zone, +9900, Ark's form without "monthly"
  9 days off (0: the week holds), WorkBuddy's en 9 days off (0: another
  vendor unchanged), "retry after … +0800 CST." (0). Every existing
  WorkBuddy and UTC/GMT case passes unchanged.
- TestResetsZhipu: 1310 9 days off read, 36 days not; 1308 over a week
  off still 0.
- TestMonthlyWrittenResetRestsTheMonth (new): Ark's 429 3d7h and 9d12h
  off reads failQuota and rests by "resets" till then, raw and as the
  agent's error with keepRetry's note; the same body without "monthly"
  rests quotaRest; a month's refusal with no time on an account whose
  window reads full 20 days off rests 8 days by "window".

Broken by hand, in the worktree:
- old routing.go with the new tests: TestResetsWritten (ark: 0s, want
  79h7m59s; 9 days, escaped, 35 days), TestMonthlyWrittenResetRestsTheMonth
  (79h0m0s off: rests 14m59.99s by quota) and TestResetsZhipu (1310, 9
  days off: 0s) red.
- cap not lifted: 228h0m0s off rests 191h59m59s by resets, red.
- longestSaid always the week: ark 9 days / 35 days and Zhipu 1310 red.
- zone's name made optional: "ark without the zone" reads 79h7m59s, red.
- skygunner's cap (any monthly body): window 20 days off rests 479h59m,
  want 192h, red.
Each restored, green.

Run at 268c1d34c (this change on origin/main 95be6bb75, unchanged at
push): gofmt -l prints nothing; go vet ./..., GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./... clean; go build, GOOS=linux go
build -tags nogui, GOOS=windows go build pass. set -o pipefail; go test
-tags nogui -timeout 45m ./... (no other suite on the machine): 69 ok,
no FAIL in the log (internal/gateway ok 571s).

Not tried: a real Ark key (none here), so not against the live API; the
bodies are the reporters' curl output. Not run: the GUI suite (no GUI
change).

Co-authored-by: skygunner <84759+skygunner@users.noreply.github.com>
2026-10-22 23:47:12 +08:00
yetoneand卡提希娅可爱捏 efb7cb11d4 gateway: a safety refusal said in a stream is a refusal for a client answered whole too, and rests nobody (#3274, CartethyiaQwQ)
CartethyiaQwQ (#3274): Codex's "safety filter: cyber_policy" refusal
(the Daybreak note) set healthy accounts aside; two such turns benched a
five-account pool for about 17 minutes.

Cause: the HTTP 400 cyber_policy is already a refusal (policyRefusal reads
its code: next account asked, nobody rests), and so is one said in a
stream relayed as a stream. A Codex account is always streamed upstream,
so a stream:false Responses, Chat or Messages request is answered from
that stream whole. There, a response.failed or error event whose error
has a code (cyber_policy) but no invalid_request_error type got no status
from the decoder, and the whole path answered it 502 api_error: retried
on the same account, then every account asked, each one but the last
resting by backoff. A refusal after a few words went to the client as a
finished 200 turn, and the failure after it rested the account.

Fix, at the decoders and the whole path:
- filterRefused (fallback.go): a stream error event refusedCode reads as
  the safety filter's gets status 400 and Said {"error":{type
  invalid_request_error, code}}. Used by every decoder that set
  Code: refusedCode -- Responses (both error sites, after requestRefused),
  Chat, Anthropic and carriedError.
- The whole path (gateway.go) answers a reply the filter cut part way as
  the refusal, not its words so far, and notes it in refusedHeader, since
  Anthropic's error shape drops the code that settle reads.
- restAfterMarked: a 400 whose error object policyRefusal reads as a
  refusal rests nobody and counts no failure (By "off", Why refused), as
  the ZDR refusal does, for any route that reaches it.
- docs/subsystems/gateway-routing.md says so.

Review of the submitted patch (dc6c695db, not taken as is): it matched
`safety filter|cyber_policy|Daybreak access` anywhere in a 400's words,
so a 400 that echoes the user's prompt in its message skipped the rest
too; its fixture was magpie's own refusedError text, which restAfter is
never handed for a 400; and it gated on status 400, while the path that
rested (above) answered 502, so it would not have stopped the rests.
Its restAfter unit tests' shape is kept in TestRestAfterPolicyRefusal.

Run at 21f7f9df2 (origin/main then) plus this change, unless said:
- New TestStreamRefusalAnsweredWholeRestsNobody: {response.failed, error
  event, refusal after text} x {Responses, Chat, Messages answered whole}
  x {next answers, nobody left}; fixture is the reporter's quoted message
  without magpie's 300-char cut. Asserts the client gets 200 from the
  next account or a 400 naming cyber_policy, every try failRefused with
  no Rest, nothing resting.
- New TestRestAfterPolicyRefusal: cyber_policy 400 rests nobody and
  counts 0 failures; a plain 400, and two 400s echoing the reporter's
  words in the message (code string_above_max_length / code null) still
  rest by backoff.
- Red on the old code: all 18 TestStreamRefusalAnsweredWholeRestsNobody
  subtests and TestRestAfterPolicyRefusal/cyber_policy. Broken by hand,
  each went red: filterRefused returning no status (all 18); the
  part-way clause dropped (6 "after some text"); refusedHeader not set
  (6 Messages subtests).
- A scratch matrix before the fix (also streamed Responses/Chat/Messages
  and Codex's own path, HTTP 400 and response.failed): only the whole
  routes rested; the streamed ones and the HTTP 400 already passed.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux and GOOS=windows
  go vet -tags nogui ./... clean.
- go test -race -timeout 45m ./internal/gateway/: FAIL on two tests
  this change doesn't reach, each ok alone with -race -count=3 and
  filed: TestPluginStreamLongActiveReader (client deadline after 36MB,
  #3286) and TestQuietKeptAliveOnlySoLong (0 keepalives in a 3s pause,
  #3287). Load was 180-280 from other sessions' GUI runs.
- Rebased on ba1dc7f97: gofmt, go vet ./internal/gateway/ and the two
  new tests again: ok.
- go test -timeout 45m ./... at ba1dc7f97 plus this change: ok, 69
  packages, no FAIL (internal/gateway 783s).

Not tried: a real Codex account. Whether the ChatGPT backend sends
cyber_policy as an HTTP 400 or inside a 200 stream, and with or without
an error type, isn't known from the issue; every shape is covered by
tests, not by a live refusal.

Co-authored-by: 卡提希娅可爱捏 <134358478+CartethyiaQwQ@users.noreply.github.com>
2026-10-22 22:53:47 +08:00
yetoneandLoKi 21f7f9df23 checkin: the Qoder plugins' check-in is asked again within the day, as the built-in's was (#2696)
The native Qoder and Qoder CN plugin check-in (pluginCheckinProvider) built
its checkiner without recheck, while the built-in qoderCheckiner set it.
So an inactive or done result was kept for the whole Beijing day, and a
press of "Check in now" was answered from that record too. Qoder CN's
campaign runs 10:00 to 09:59 the next day (mufanmu), so an early read
describes yesterday's campaign and said nothing about today's.

What changed:
- provider: pluginRechecks(id) is true for "qoder" and "qoder-cn" only,
  and sets recheck on their checkiner. A press asks at once. The loop asks
  again after wbCheckinEvery (30m) for inactive and done. Every other
  plugin stays settled for the day.
- GUI (checkinRow): a Qoder account (built-in or plugin) whose check-in
  found no campaign today keeps "Check in now". A press reports "Check-in
  status refreshed" instead of "Checked in", since it may still find
  none. The unused "Checked in" key is replaced in all four languages.
- docs/subsystems/provider-plugins.md names the exception and the tests.

Taken from LoKi's (lokic7123-star) patch on the issue: the recheck on the
Qoder plugin ids, the Check in now button for an inactive Qoder card, and
the neutral press status. Their GUI test was adapted into
qoder-checkin-recheck.test.cjs.
Left out, as the earlier review asked: the blanket 30-minute message, the
UTC timestamps and the client-computed next check. Also left out: the
"Already checked in today" wording and the "· credit" display. That is
not this bug, and the TUI and CLI would need the same change.

Run:
- Red on the old code:
  - All 8 subtests of TestPluginCheckinQoderRechecksCampaigns
    ({qoder,qoder-cn} x {inactive,done} x {loop,press}) fail without
    the fix.
  - Forcing recheck on for every plugin turns
    TestPluginCheckinOthersSettledForTheDay red.
  - qoder-checkin-recheck.test.cjs is red on the origin/main assets (no
    .ci-now on the card).
- At 91bb01e65 (base 9572a3576):
  - Full suite: set -o pipefail; go test -timeout 45m ./... |
    tee. EXIT=0, 68 packages ok, run alone on the machine.
  - qoder-checkin-recheck.test.cjs passes 20/20: chromium and webkit,
    en/zh/zh-TW/ja/de, 900 and 440px.
  - 76 GUI files reachable from the change were run: check-in files,
    gui-*, i18n-keys and tray-usages. Reds:
    - login-import, chromium en/zh: red on main too (#1307).
    - quota-reads webkit de 360: red on main too (#2150, commented
      with its c.toFixed page error).
    - usage-checkin webkit en/zh, Qoder tab: red on main too (#2549).
    - update-wait chromium en and usage-alert webkit en: red only
      under load, pass alone (#3275).
- At this tree, rebased on 87d703c5c (b91bcf260, library only, came
  after). The 8 new main commits since
  9572a3576 bring app.js, i18n.js and provider plugin changes; none of
  them touches check-in code.
  - gofmt -l: clean.
  - go vet ./...: clean on darwin, linux (-tags nogui) and windows.
  - go test ./internal/provider/ ./internal/gui/ ./internal/plugin/
    ./internal/cli/: all ok. internal/gui includes TestCoreScriptBudget.
  - GUI, both engines: qoder-checkin-recheck, i18n-keys,
    plugin-checkin, checkin-account, account-models and
    plugin-keyless-signin pass 119/119.

Not tried:
- No real Qoder or Qoder CN account, and no campaign that opens
  mid-day.
- The full GUI suite: another session's full GUI run held the machine,
  so 76 files were run instead.
- Linux and Windows at runtime.

Reported by mufanmu and LoKi; patch by LoKi.

Co-authored-by: LoKi <317300729+lokic7123-star@users.noreply.github.com>
2026-10-22 21:18:13 +08:00
LoKi 5871f02dd6 plugins, provider, gui: a keyless plugin sign-in needs no key, and a single-identity plugin has one account (#2695, LoKi)
LoKi's patch (lokic7123-star), picked onto origin/main ef6f3749d. A plugin's api
method that has an authorize step and no prompts is reported as keyless:
PluginAPIKey accepts an empty key for that method only, the CLI and the
GUI skip the key field, and a plugin marked auth.single signs in again
on its first account instead of adding another one. Zen Free needs
magpie-community/plugins#205 (keyless and single on zen-free), merged and
published, before its users see this.

Added in review (yetone): TestPluginEmptyKeyOnlyKeyless, which checks that
an empty key is refused for a non-keyless api method, an oauth method
marked keyless, an out-of-range method and an unknown plugin.

Run at the stacked tree (this commit plus #2554 and #2862, on ef6f3749d):
- gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui, and
  GOOS=windows: ok.
- set -o pipefail; go test -count=1 -timeout 45m ./... under the suite
  lock: every package ok (SUITE_EXIT 0).
- GUI: plugin-keyless-signin, account-models, i18n-keys and
  models-select-all-api, chromium and webkit, every language they cover:
  all pass.
Red on the old code: TestPluginKeylessSingleIdentity "keyless metadata lost"; the
GUI test 10/10 red; without signInKey's single line, "single identity
duplicated"; TestPluginEmptyKeyOnlyKeyless red with the Keyless check
replaced by false.
Not tried: a real Zen Free sign-in (needs plugins#205 published).
2026-10-22 20:50:59 +08:00
yetoneandggbdpq 240f3eb4c5 gateway: a name a fake-IP resolver answers is fetched through its TUN or a local proxy (#2593)
With Clash's TUN fake-ip (Clash Verge Rev on Windows, TomXPRIME), Surge's
enhanced mode (h4rk8s) or Loon on, the system resolver answers every name
in 198.18.0.0/15, which the download guard (image_fetch_guard.go) listed
as special. So web_fetch, a caller's image (fetchPicture), a vendor's
image or video by URL and generate_image's download (imagemcp) refused
every URL as "a private address". All of them go through publicTransport;
nothing else uses it.

What changed:
- The address rule moved into internal/netguard (Public, FakeIP,
  LoonPaired), shared by the gateway's guard and a provider's icon
  (icon.go's publicIP is now netguard.Public or FakeIP, as #252 meant).
  The icon guard gets the gateway's stricter list with it (Teredo, 240/4,
  NAT64 and 6to4 forms of a private address are refused there too).
- publicTransport: a name (never an address literal) whose every answer
  is in 198.18.0.0/15 is fetched. With no proxy (pure TUN) the fake
  address is pinned and dialled, and the dial guard lets that one address
  in, no other. Through a proxy on this computer (loopback or localhost)
  the proxy is given the name, never the fake address: h4rk8s showed a
  real Surge CONNECT by name works and by the 198.18 address doesn't. A
  plain http:// request's Host to that proxy is the checked name, never
  the caller's own Host. Through a proxy elsewhere it is refused.
- An answer with any other address beside the fake ones (private or
  public) is judged as before, so fake + 192.168.x is refused; loopback,
  RFC 1918, link-local with 169.254.169.254, CGNAT, unspecified,
  multicast and documentation stay refused; every non-fake answer is
  still pinned; redirects are re-checked as before.
- Loon's synthesized AAAA (fd27:712::/96 holding an A answer of the same
  reply) is left out and the A answer judged in its place, as icon.go
  already did, so a Loon answer isn't refused as fc00::/7.
- docs/subsystems/gateway-routing.md says all of this, and the trust it
  asks for: where a fake-IP name really goes is decided by the fake-IP
  resolver, which magpie can't see, so a name pointing at the user's
  network is reached if that resolver's rules send it there. The icon
  path already accepted this (#252).

Credit: ggbdpq found the cause and wrote both patches on the issue
(hunt/2593-webfetch-fakeip, then hunt51-a-fakeip-proxy: the fake-only,
loopback-proxy, name-not-literal predicate and its test shapes, which
this follows); h4rk8s's real Surge comparison showed the pin had to go
for a proxy; TomXPRIME's Windows report showed pure TUN needs the direct
dial.

Run (darwin/arm64, worktree rebased on origin/main 226551d0d):
- New tests in internal/gateway/fakeip_test.go, with a fake resolver, a
  local proxy recording what it is asked and a local server standing in
  for the TUN (dialPinned seam); nothing reaches the network:
  TestFakeIPNameGoesToALocalProxyByName (web_fetch reads the page; proxy
  asked "http://example.com:80/", CONNECT example.com:443, a foreign Host
  ignored, Loon pair, redirect to a mixed answer refused),
  TestFakeIPNameDialledThroughTheTUN (198.18.0.7:80 dialled, guard
  refuses 198.18.0.8, 198.19.1.1, 127.0.0.1, 192.168.1.10),
  TestFakeIPRefusesTheRest (13 URLs refused with no proxy, a 127.0.0.1
  proxy and a localhost proxy; a proxy elsewhere refused; neither proxy
  nor TUN asked). internal/netguard: TestPublic, TestFakeIP,
  TestLoonPaired.
- Red on the old behaviour: fakeAnswer forced false (what main does)
  fails ByName and DialledThroughTheTUN with the private-address refusal.
  Mutations, each red: no byName (proxy asked 198.18), literals allowed,
  any-fake answer counted, proxy elsewhere allowed, dial guard letting any
  address in, the caller's Host to an http proxy, Loon not dropped.
- Existing guard tests (TestPublicAddr, TestEditImage*, TestWebFetch*,
  TestPrivateDialer*, TestFetchPrivate*) and provider's icon tests pass.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite at 30611fe68 (this change on 226551d0d): set -o pipefail;
  go test -timeout 45m ./... exit 0, 69 packages ok, no FAIL (14 min).

Not tried: a real Clash, Clash Verge, Surge or Loon (none on this
machine); the proxy and the TUN are local stand-ins, so whether a real
fake-IP core routes the name as h4rk8s saw is their evidence, not this
run's. A SOCKS proxy on loopback is not covered by a test (Go sends the
name in the SOCKS request the same way). Kept open for the reporters.

Co-authored-by: ggbdpq <67929842+ggbdpq@users.noreply.github.com>
2026-10-22 19:53:16 +08:00
yetone 226551d0d8 gateway: MiniMax M3.1-Flash is sent its effort in output_config (shin4 on plugins#316)
An OpenAI client's reasoning effort (Responses' reasoning.effort, Chat's
reasoning_effort) for MiniMax Code's MiniMax-M3.1-Flash or -Preview, built
into an Anthropic body for the minimax plugin, went as a thinking budget
alone. Under the reporter's 8192 cap medium, high, xhigh and max were all
budget_tokens 7168, so the level was lost before the plugin saw it.

The two models join GLM-5.2/5.3 in effortInOutputConfig: buildAnthropic
sends output_config.effort next to the budget, and an Anthropic client's
budget gets its nearest level there too (withOutputEffort, passthrough).
MiniMax Code's catalog marks M3.1-Flash forced_on at low..max. The budget
stays as it was (the owner's plan on plugins#317); dropping thinking for
the managed-login route, as MiniMax Code 3.1.4 does, stays the plugin's
call. Nothing goes into prompt text. Claude, MiniMax-M3 and other vendors'
models keep the budget alone. MiniMax's public Anthropic API doesn't list
M3.1-Flash (platform.minimax.io text-anthropic-api), so the rule reaches
MiniMax Code's subscription and any relay serving those two models.

Tests (internal/gateway/minimax_effort_test.go, fake plugin $FAKE_MINIMAX):
- TestMiniMaxPluginGetsTheNativeEffort: the reporter's Responses request
  and its Chat form, low..max, both models, on minimax-code and
  minimax-code-global through the plugin host (bun), plus an Anthropic
  client's budget 10000 -> medium; MiniMax-M3 keeps no output_config.
- TestNativeEffortLeavesOthersAlone: claude-sonnet-4-5, kimi-k3 and
  MiniMax-M3 on an Anthropic relay get budget 7168 and no output_config.

Run at e31e3699a + this change, sandbox HOME, pinned caches:
- with the regex change reverted, TestMiniMaxPluginGetsTheNativeEffort
  fails with the reporter's table ("/v1/responses MiniMax-M3.1-Flash
  medium: output_config <nil>, thinking map[budget_tokens:7168
  type:enabled]"); restored, passes.
- the regex widened by hand to minimax|claude|kimi: TestNativeEffort-
  LeavesOthersAlone fails for all three models; restored, passes.
- go test ./internal/gateway -run 'Effort|Adaptive|Think|GLM|MiniMax|
  Budget|Reasoning|Level': ok. go test ./internal/plugin/...: ok.
- gofmt -l: clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.

Not run before this push: the full suite (the machine is at load ~210
with several sessions queued for it; it runs after, in turn). Not tried:
a real MiniMax Code account. Whether MiniMax's subscription endpoint
honours output_config.effort beside a budget (rather than with thinking
left out, as shin4's live run sent it) is not verified.
2026-10-22 19:36:50 +08:00
yetone ccbc727818 agent, gateway: a Claude model magpie can only ask translated no longer keeps auto mode's server review on (nexnull on Discord)
nexnull (Claude Code 2.1.308, magpie v0.1.1318, DeepSeek 4.1 flash) saw
Claude Code's notice that auto mode's classifier "isn't eligible because
your requests go through 127.0.0.1:3425". The wiring leaves
CLAUDE_CODE_AUTO_MODE_SERVER unset while any model Claude Code can reach
through magpie is reviewed (claudeReviewed), and it judged that by
AutoModeReviewed, which counts a Claude model by its name. A relay that
lists claude-* beside DeepSeek with only a Chat (or Responses) URL, or a
Claude model the user pinned to chat, is asked translated: a probe showed
such a request goes to /v1/chat/completions with no safeguards and no
safeguard_results. So the review stayed on and the notice showed.

AutoModeReviewable (gateway/automode.go) is AutoModeReviewed on a route
that reaches the Messages API: the Claude subscription, or a provider
with an Anthropic URL whose APIs for the model (a user pin first) include
Anthropic. claudeReviewed asks it for the provider and each fallback, so
Claude Code and T3 Code get CLAUDE_CODE_AUTO_MODE_SERVER=0 there. It is
still magpie's own stashed value (claude.auto_mode_server): a user's own
value is left alone, and disconnect or restore takes magpie's off.
serverReview, already on the Messages route, keeps AutoModeReviewed.

Chosen on purpose: any reachable model that is really reviewed keeps the
review on. Writing 0 by mistake would lose server review on Claude
silently, while leaving it on by mistake costs the notice, which Enter
dismisses for 24h. A relay with an Anthropic URL (OpenRouter, AiHubMix)
still counts as reviewable, since some pass the field through. No
client mimicry and no prompt or identity text changes.

Pass-through on Anthropic routes (asked in the same task): no defect.
Probes against a fake upstream showed the anthropic-beta (with
dangerous-tool-use-2026-09-03) and anthropic-version forwarded, the
safeguards body byte-identical, a stream:false reply relayed byte for
byte with safeguard_results and an unknown key intact, and the SSE relay
keeping an unknown key, an unknown event type and toolu ids. The probe
file was removed and is not committed.

Full run at 983425662, the same change one commit back:
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok.
- set -o pipefail; go test -timeout 45m ./...: EXIT 0, 68 packages ok,
  no FAIL (internal/agent 386s, internal/gateway 507s), run alone after
  another session's suite ended.
- TestAutoModeReviewableAsksOnMessages and
  TestClaudeReviewedOnlyWhereMessagesReachClaude are red on the old code
  ("cr/claude-sonnet-5: true, want false"; "a relay without an Anthropic
  endpoint: \"\", want 0").

Rebased then onto 61b92529e (#2932 sessions, #2942 budget; none of
this change's files): go vet ./internal/... ok, and go test for
internal/agent, internal/gateway, internal/budget and internal/sessions
ok at the pushed head.

Broken by hand: dropping the Anthropic-URL check made the gateway test
red; ignoring the user's pin (apis != nil || true) made the agent test
red ("Claude set to be asked on chat: \"\", want 0"). Restored after
each break.

Not tried: real Claude Code 2.1.308 against a sandbox gateway with a
real DeepSeek key, so the notice going away in a live auto-mode session
is not seen. No GUI files are touched, so the GUI suite was not run.
2026-10-22 18:19:00 +08:00
yetone 0ddcf28a1d redact: a backend's id (a UUID, 32+ hex digits) goes as written, never a piece of it
The owner found UUIDs masked, and a backend looks an id up by every
character: a masked one, or half of one, finds nothing or the wrong row.
A probe with every kind on and the model labelling each value found five
ways a UUID went masked:

- a piece of one: PHONE took 13800138000 at the end of
  …-a13800138000, BANK_CARD took 4111-1111-1111-9007 across a UUID's
  groups, and the id went half a placeholder;
- the SECRET rule in a field named for an id, a cursor or a request:
  secret_id, token_id, api_key_id, access_key_id, next_page_token,
  nextPageToken, csrf_token, trace_token, secret_hash;
- the bare "key" rule ("key": "<uuid>", Idempotency-Key);
- the serial rule (sn:, Serial Number:);
- the model labelling a UUID a name, an account and so on (only
  "secret" was held back before), and a phone number masked earlier
  being found again inside a UUID.

noIDs (internal/redact/ids.go) drops, after every finder, a span that is
a piece of an id, and a whole id unless the user's own words or rules
found it, a PASSWORD/API_KEY/TOKEN/PRIVATE_KEY rule did, the SECRET rule
did in a field named for a credential (password=, api_key=, X-Api-Key,
refresh_token, session_token, token), or it was masked before in full.
32 hex digits without hyphens the model calls a secret in prose ("the api
key is 9f8e…") stay masked; a UUID it calls one does not, as before.

Run in ~/workspace/projects/magpie-wt/mask-act at this tree:
- TestIDsGoAsWritten: 7 id shapes × 22 contexts kept, 7 credential
  contexts masked, the model's every label kept, a known phone not found
  inside an id, a phone and a card number of their own masked, the user's
  word masked. With noIDs taken out of mask(): 108 failures; restored: ok.
- The first full redact run caught two of my own mistakes, now fixed:
  idAround didn't check the run's inside, so a 33-character IPv6 address
  counted as an id (TestMoreKinds), and the model's 32-hex API key went
  unmasked (TestModelSecretIsNoID).
- go test ./internal/redact ./internal/maskrec ./internal/gwmw
  ./internal/settings ./internal/gateway (-timeout 45m, -count=1): all ok (gateway 439s)
- gofmt -l: none; go vet ./internal/redact for darwin, linux, windows: ok.

Not tried: a real request through a running gateway with the local model
on; the model's labels are simulated with fakeModel.
2026-10-22 15:42:54 +08:00
yetone c036d6c34a gui: what the window shows can be selected and copied, its controls can't
Outvi V on Discord: the page is user-select: none as a whole, so nothing
could be selected or copied into a bug report, only the few places that
opted in. Two rules at no specificity after body in app.css now make
content selectable: paragraphs, pre and code, a detail's values (dd,
td), hints, notes, every error class (.err, .error, *-err, *-error), a
conversation (.sess-talk, a subagent's too), a request's story and log
on Routing (.rt-log, .rt-steps, .rt-time). Controls stay unselectable
with what is in them, as in a Mac app: buttons, labels, summary,
select, the navigation, menus (.pop), tabs, switches, segments, grips,
draggable rows. With no specificity, a view's own rule still decides
(a list being sorted, a blurred value), and a field stays a field.
An account's or a key's name was selectable by accident through its
row (a button inside .accts > [data-account-id]); .acc .rename now says
so itself, and account-arrange keeps checking it.

user-select.test.cjs: on Routing, a mouse drag across a vendor's error
in a request's story selects it; a drag across a request's row selects
nothing, and the row still opens on a click with text selected
elsewhere; no nav, button, tab, segment or option is selectable, and no
field is unselectable. Both engines, en/zh/ja/de, 1100 and 420 wide:
16/16, twice. Red on HEAD's app.css (16/16 fail: 'none' !== 'text').
Ran: click-scroll 22/22, agent-grip 10/10, provider-order 6/6,
search-order 16/16, account-arrange 2/2 (red in chromium before the
.acc .rename line), account-alias 20/20, panel-arrange 8/8,
sessions-talk 4/4, sessions-subagents 40/40, usage-ledger-detail 6/6.

Not tried: the app's own webviews (WKWebView, WebView2, WebKitGTK); only Playwright's Chromium and WebKit.

Run for this batch of seven commits (devin, routing zh, qoder, masked words
any case, Long conversations, Claude subagents, user-select), in a worktree,
sandbox HOME, never against live configs:
- At e352cc823 (tree ea497c9f5, on origin/main 7dd965ed2): go test
  -timeout 45m ./... with pipefail, tee'd: 68 packages ok, exit 0, no
  ENOSPC. gofmt -l clean; go vet ./... for darwin, GOOS=linux -tags nogui
  and GOOS=windows: clean.
- The whole GUI suite at e352cc823 (node --test --test-concurrency=3
  internal/gui/tests/*.test.cjs, Chromium and WebKit, every language):
  11725 tests, 11679 pass, 46 fail, none ENOSPC. Each red file run alone at
  both 7dd965ed2 and e352cc823 gives the same counts on both, so none is
  from this batch: usage-agents-hide 5/16 (#2276), usage-ledger 28/34
  (#3104), usage-fold, quota-count-wrap, quota-name-translated (#2399),
  usage-checkin 26/28 (#2549), plugin-github 14/18 (#3218), s3-sync 3/4
  (#2448), modal-morph (#3179), fonts (filed as #3227, 1 in 9 alone on
  main). tray-usages (#2453), plugin-card-update (#3079) and
  proto-menu-overflow (filed as #3229) were red only under the full run
  and pass alone on both.
- Rebased onto origin/main 4a87c4476 (only Zed's mover min changed), tree
  8944b5dbb: go test ./internal/provider ./internal/gui (TestCoreScriptBudget
  and the app.js budget) ./internal/redact ./internal/settings
  ./internal/agent: all five ok; gofmt -l clean.
2026-10-22 10:52:04 +08:00
yetone 2ea148b103 gui: Claude Code's unset subagents read "Claude Code's own pick", not "same as model"
KorenKrita on Discord wanted Claude Code's subagent model left unset so
Claude Code picks. magpie already leaves env.CLAUDE_CODE_SUBAGENT_MODEL
out when the field is unset (writeTiers deletes it, setSubagent too),
but the GUI called unset "Same as model", which says the subagents run
on the main model. They don't: Claude Code 2.1.306 (read from the
installed binary) takes the Agent tool call's model, then the subagent's
frontmatter model, then the variable, then the lead's model; the
built-in Explore inherits, capped at opus.

The unset option is now "Claude Code's own pick", its note "{model}
unless the lead or the subagent names another", and the field's title
says what a model set there does. Translated in zh, zh-TW, ja and de.
Codex keeps its own lead's-pick wording.

Tests:
- TestClaudeSubagentsUnsetWriteNothing: routed, pick a model, take it
  back, move the main model; the variable stays absent. Red when
  writeTiers writes the main model for an unset sub (broken by hand).
- claude-subagents-pick.test.cjs: 5 languages x 2 widths x 2 engines,
  20/20. Red on HEAD's app.js and i18n.js (chromium 0/10).
- Ran: codex-subagents-lead 20/20, claude-auto-mode 8/8, desktop-tiers
  4/4, tier-effort 8/8, i18n-keys 3/3; go test -run TestClaude
  ./internal/agent ok.
Not tried: a real Claude Code session picking a subagent model with the
field unset.

Run for this batch of seven commits (devin, routing zh, qoder, masked words
any case, Long conversations, Claude subagents, user-select), in a worktree,
sandbox HOME, never against live configs:
- At e352cc823 (tree ea497c9f5, on origin/main 7dd965ed2): go test
  -timeout 45m ./... with pipefail, tee'd: 68 packages ok, exit 0, no
  ENOSPC. gofmt -l clean; go vet ./... for darwin, GOOS=linux -tags nogui
  and GOOS=windows: clean.
- The whole GUI suite at e352cc823 (node --test --test-concurrency=3
  internal/gui/tests/*.test.cjs, Chromium and WebKit, every language):
  11725 tests, 11679 pass, 46 fail, none ENOSPC. Each red file run alone at
  both 7dd965ed2 and e352cc823 gives the same counts on both, so none is
  from this batch: usage-agents-hide 5/16 (#2276), usage-ledger 28/34
  (#3104), usage-fold, quota-count-wrap, quota-name-translated (#2399),
  usage-checkin 26/28 (#2549), plugin-github 14/18 (#3218), s3-sync 3/4
  (#2448), modal-morph (#3179), fonts (filed as #3227, 1 in 9 alone on
  main). tray-usages (#2453), plugin-card-update (#3079) and
  proto-menu-overflow (filed as #3229) were red only under the full run
  and pass alone on both.
- Rebased onto origin/main 4a87c4476 (only Zed's mover min changed), tree
  8944b5dbb: go test ./internal/provider ./internal/gui (TestCoreScriptBudget
  and the app.js budget) ./internal/redact ./internal/settings
  ./internal/agent: all five ok; gofmt -l clean.
2026-10-22 10:52:04 +08:00
yetone 9691997bb0 gui: Long conversations stays in Settings when no Codex or Claude Code is here to hold it (Linka)
Linka on Discord runs magpie in Docker, with no agent installed. f1e4516da
(10-20) moved Long conversations (#fullContextRow: Compact at / Full
window) into Codex's and Claude Code's settings on the Agents page. In
gateway mode agentPrefsOf is null, and with neither agent present nothing
shows the row, so the compaction threshold couldn't be changed at all.
The setting still applies there: settings.Compact() sets the windows the
gateway serves, which agents on other computers read.

renderAgentPrefLinks now puts the row in Settings › General (before the
search-link rows) when no present agent owns it, and sends it back to
#agentPrefRows when one appears. With Codex or Claude Code present,
nothing changes. No new page. The backend is unchanged, so a compactAt
saved before is read and shown as it was.

Tests:
- agent-prefs.test.cjs: in gateway mode and with only Pi present, the row
  is in General. It shows the saved 200K, a typed 150k posts
  settings/full-context {on:false, at:150000}, and no other agent row is
  in Settings.
- settings-general.test.cjs: its no-agent fixture now leaves
  fullContextRow out of the "not in Settings" check.

Broken by hand: with HEAD's app.js the two new cases are red in Chromium
(the row never appears in General).

Not tried: magpie in a real Docker container; the GUI test fakes gateway mode.

Run for this batch of seven commits (devin, routing zh, qoder, masked words
any case, Long conversations, Claude subagents, user-select), in a worktree,
sandbox HOME, never against live configs:
- At e352cc823 (tree ea497c9f5, on origin/main 7dd965ed2): go test
  -timeout 45m ./... with pipefail, tee'd: 68 packages ok, exit 0, no
  ENOSPC. gofmt -l clean; go vet ./... for darwin, GOOS=linux -tags nogui
  and GOOS=windows: clean.
- The whole GUI suite at e352cc823 (node --test --test-concurrency=3
  internal/gui/tests/*.test.cjs, Chromium and WebKit, every language):
  11725 tests, 11679 pass, 46 fail, none ENOSPC. Each red file run alone at
  both 7dd965ed2 and e352cc823 gives the same counts on both, so none is
  from this batch: usage-agents-hide 5/16 (#2276), usage-ledger 28/34
  (#3104), usage-fold, quota-count-wrap, quota-name-translated (#2399),
  usage-checkin 26/28 (#2549), plugin-github 14/18 (#3218), s3-sync 3/4
  (#2448), modal-morph (#3179), fonts (filed as #3227, 1 in 9 alone on
  main). tray-usages (#2453), plugin-card-update (#3079) and
  proto-menu-overflow (filed as #3229) were red only under the full run
  and pass alone on both.
- Rebased onto origin/main 4a87c4476 (only Zed's mover min changed), tree
  8944b5dbb: go test ./internal/provider ./internal/gui (TestCoreScriptBudget
  and the app.js budget) ./internal/redact ./internal/settings
  ./internal/agent: all five ok; gofmt -l clean.
2026-10-22 10:52:04 +08:00
yetone 9a0df964e4 gateway: a relayed Chat reply that made calls and ended "stop" ends "tool_calls", streamed and whole
喜欢一个人 on Discord (v0.1.1299, deepseek-v4.1-flash through a relay,
usage row stop "stop"): the agent loop ended mid-turn. Their first ask:
when a reply calls tools, finish_reason must be tool_calls on every
path.

Checked each path on origin/main 9b0f48612:
- calls read out of text: tool_calls on Chat stream and whole,
  tool_use on Anthropic, function_call items on Responses (existing
  TestTextWritten*, TestDSMLBlockClosedWithCalls);
- calls the upstream made, ended "stop": the translations' collector
  already ends them "tool" (collector.finish, 蓝猫 on Discord), but a
  relayed Chat reply went on with "stop", streamed and whole, so a Chat
  client reading finish_reason ended its turn with the calls not run.

chatTidy now marks a choice that made a call and turns its "stop" into
"tool_calls"; chatWhole does the same for a whole reply's message with
tool_calls. A reply with no call keeps "stop", and other reasons
(length) stay.

Test: TestChatCallsEndToolCalls (chattidy_finish_test.go): stream with
and without tools offered, whole with text and with null content, a
length end kept, no-call replies kept "stop". Red on the old code (stream:
finish "stop"); broken by hand, each half red alone (the chatTidy line
off: stream red; the chatWhole check off: whole red).

TestGeminiCompatRelayEndedShort pinned the old "stop" after Linka's
Gemini call (gemini_compat_cut_test.go's "whole" cases). Its guarantee
is that a whole reply goes with its one finish_reason and none added;
it now expects that one as "tool_calls". Found by the full suite at
770c5fc48 (the only red).

Docs: gateway-routing.md, beside the call-id entry.

Run at the tree pushed (go test -timeout 45m ./... in a sandbox HOME at
308f693df, tree cfd91bbea, on origin/main c358e7660; only messages
changed since): 68 packages ok, exit 0. The one red at an earlier run
(770c5fc48), TestGeminiCompatRelayEndedShort, is answered in the finish
commit. gofmt -l clean; go vet ./internal/gateway for darwin, linux
-tags nogui and windows clean.

Not tried: a real relay or the reporter's client.

Reported by 喜欢一个人 on Discord.
2026-10-22 04:54:05 +08:00
yetone d1173c8c16 gateway: DeepSeek's calls close left in a reply's text (</||DSML|| calls>) is dropped, after a call the upstream made too
喜欢一个人 on Discord (v0.1.1299, macOS arm64, a Responses client
translated to Chat, deepseek-v4.1-flash through a relay, 232312 in /
645 out, stop "stop"): the client got the text "\n</||DSML|| calls>"
and the agent loop ended mid-turn. Their history has ||DSML|| calls>
712 times against 133 <||DSML||invoke.

Reproduced on origin/main 9b0f48612 (v0.1.1316+1) with those bytes. A
whole block of invokes closed with </||DSML|| calls> was already the
call on every route (the junk regex takes any DSML tag; 7ea8aeaba and
d0c587aee). What leaked was the close with no block before it in the
text:

- after a call the upstream made itself (a relay that made the calls of
  DeepSeek's invokes and left the wrapper's close as text):
  textCallSee and textCallTidy stopped reading text once a native call
  came, and wholeTextCalls left such a message alone, so the close went
  to the client on every route, the Responses translation the reporter
  uses included (a final_answer message after the function_call);
- with no call: textCallAt found only DSML opens (dsmlMark closing
  false), so a lone close was never held and went out as text.

Now textCallAt finds a DSML close as it finds an open, and held text
that is tags and nothing else goes, with the spaces before it after a
native call (spaceBack, settled). No call is read out of a native
reply's text; text that isn't only tags goes on as it came (prose about
</|DSML|invoke> keeps it).

Not rewritten by magpie: nothing in magpie turns tool_calls into
" calls". The only Go source with | is textcalls.go; redact's Writer
restores only {{KIND_xxxxxxxx}} placeholders, and #3143 (88119d4f6,
10-21) changed masking of the request, not reply text. The reporter's
earliest is 10-13, and OKURBITO's capture on #2623 (10-17, workbuddy
deepseek-flash, observedPipes) already has <||DSML|| calls> as the
model wrote it: DeepSeek's own spelling.

Tests (textcalls_close_test.go), from the reporter's bytes:
- TestDSMLCloseLeftAfterCalls: a native call, then "\n</||DSML|| calls>"
  cut at every valid byte, with no opener, <||DSML|| calls> or
  <||DSML||tool_calls> before the call; Chat stream, Chat whole,
  Responses stream and whole, Anthropic stream and whole.
- TestDSMLCloseAlone: "Done.\n</||DSML|| calls>" with no call, every cut,
  Chat stream and whole, Responses both; prose with a close kept.
- TestDSMLBlockClosedWithCalls: the full invoke/parameter block closed
  with " calls>", opened three ways, every cut on Chat, every 5th on
  Responses stream and whole. Green on the old code too (a guard).

Red on the old code: TestDSMLCloseLeftAfterCalls and TestDSMLCloseAlone
FAIL with origin/main's textcalls.go. Broken by hand, each red alone:
textCallSee.settle without settled (responses stream=true keeps the
close), wholeTextCalls' native branch off (chat whole keeps it),
textCallAt back to opens only (chat stream and alone keep it).

Docs: gateway-routing.md's text-calls entry.

Run at the tree pushed (go test -timeout 45m ./... in a sandbox HOME at
308f693df, tree cfd91bbea, on origin/main c358e7660; only messages
changed since): 68 packages ok, exit 0. The one red at an earlier run
(770c5fc48), TestGeminiCompatRelayEndedShort, is answered in the finish
commit. gofmt -l clean; go vet ./internal/gateway for darwin, linux
-tags nogui and windows clean.

Not tried: a real relay or the reporter's client; the bytes are the
reporter's, from their usage row and client history. A close spelled
another way than DeepSeek's DSML marks is not covered.

Reported by 喜欢一个人 on Discord.
2026-10-22 04:54:04 +08:00
yetone b00c82acfa masking: each kind is masked, sent with a warning or held back; a Never mask list and Try it (#1977)
Settings › Privacy gets two sections under What to mask:

- When a value is found: Mask, Warn or Block per kind (redactActions;
  a kind left out is masked). Warn sends the value as written and records
  it with a placeholder nobody remembers, not counted as masked. Block
  masks it as before and the gateway answers 400 naming the kind and the
  value's hint, never the value, with nothing sent (maskBlocked); the
  record is kept as Blocked. The secret kinds come first, the personal
  ones behind Show all kinds. A Never mask list (redactAllow) lets a whole
  value go as written in any case; a longer value it is part of is masked.
- Try it: POST /api/masking/preview masks a text as a request would
  (redact.Preview) and remembers nothing: no placeholder stands for it
  afterwards and its values aren't masked later as seen before. The page
  shows the vendor's text, what was found and what would be done, and
  keeps the text in no storage.

The masking card counts requests held back and values sent as written; a
call whose values only went as written gets an amber badge on Recent calls
and the Routing log. zh, zh-TW, ja and de throughout. Docs: gateway-routing
and gui-shell.

Broken by hand: the new GUI badge assertion fails on the old maskedBadge
(no .warn badge drawn); TestSettingsSaveKeepsWhatItDoesNotSend went red
until the two settings were in its fixture; "{n} held back" turned
i18n-keys red against the routing plugin's "{n} held" and was renamed.

Run at this tree (base origin/main 9b0f48612):
- gofmt clean; go vet on macOS, GOOS=linux -tags nogui, GOOS=windows.
- go test -count=1 -timeout 45m redact, maskrec, settings, gwmw, gui,
  gateway: ok.
- GUI, both engines: every Privacy file, mask-actions, masking-records,
  routing-bodies, i18n-keys, old-webkit: 263/263.
- Whole GUI suite earlier at 083b1c8e7's base, beside 7 other runs:
  53 red; alone, the ones left red fail the same on origin/main
  6fc532198 and are filed (#3179, #2228, #2448, #2276, #2549, #2163,
  #2399), except privacy-usage-stats and account-discovery, which this
  change's taller page moved off screen; both fixed here.

Not tried: a real vendor request held back by Block from a real agent.
2026-10-22 04:07:55 +08:00
yetone 9b0f48612b gateway: a plugin's model that searches by itself can be the web searcher
01huadalang (Discord #feedback, 10-20): Settings › Web search offered only
Antigravity; Trae's search model couldn't be picked, "可能也有别的模型能搜索
但是识别不到". partSearcher and modelSearches answer false for every
provider with an account behind it, so no plugin-served provider was ever
offered, and a plugin had no way to say which of its models searches.

A plugin now marks such a model with `searches: true` (in its config
models or the list its models hook gives). host.js passes it on,
plugin.Model carries it, and pluginCatalog makes it WebSearch "native".
partSearcher offers a plugin provider with such a model, with those models
only, at rank 4 (as Command Code's search models); remoteSearch asks it in
plain words, the way it asks Command Code's. A client's own web_search
sent to that model still goes to magpie's searcher (searchesModel is
unchanged): the plugin's upstream takes no web_search tool.

Behaviour change: a marked plugin model ranks ahead of Antigravity and
Google (rank 5) when magpie picks the searcher itself.

Run:
- TestPluginSearchModelIsASearcher (new; a fake plugin's model marked
  searches answers a weather question with a URL): red on the old code
  (the picker offers [], want the plugin's fake-search alone), green now.
- Broken by hand: host.js without the `searches` passthrough; the test
  goes red at the picker.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows on gateway,
  plugin, provider, catalog.
- set -o pipefail; go test -timeout 45m ./... at this tree: 68 ok, no FAIL.

Not tried: the Trae plugin itself. It declares nothing about search yet;
marking Trae CN's search_agent there needs a Trae account to try it with,
which this machine doesn't have. No GUI files changed.
2026-10-22 03:18:11 +08:00
yetone f5b0157420 gateway: a tool Claude Code's tool search loads goes to OpenAI's Responses API where it was loaded (#2660)
Through /v1/messages translated to a Responses provider, every deferred
tool ToolSearch loaded joined the top-level tools on the next request, so
the prompt changed from its first bytes and the cache missed on each load
(maximia's probe: cached tokens dropped on every request after a load).

Now, where Request.LoadedInPlace is set, a deferred tool (defer_loading,
Tool.Deferred) that a tool_result's tool_reference names (toolRefs,
Part.Loads) goes in an {"type":"additional_tools","role":"developer",
"tools":[...]} item right after the run of tool outputs that loaded it,
once, and not in tools (buildResponses). Parallel results and one result
naming several share one item; a tool named again isn't repeated; the
output's text is as before. A history whose loading result is gone
(compaction, edits) puts the tool back in tools: a new prefix, expected.

Scope (loadsInPlace): OpenAI's own API with a key (api.openai.com,
*.api.openai.com), whose tool search guide documents the item and says
its tools load at the end of the context so the cache is kept; and a
provider the user sets with `magpie provider set <id> additional-tools=on`
(Provider.AdditionalTools, kept by the GUI's save like codexAsSent).
Nothing else: xAI answers the item 422 (#350), the ChatGPT backend has
been seen taking it only for Codex's Responses Lite, Azure, plugins and
relays are untried. An upstream that refuses a request holding the item
with a 400/422 naming additional_tools is asked again with every tool in
tools, logged ("turned away additional_tools ... loaded tools go in tools
from now on") and not sent the item again while magpie runs.

Not handled: a tool a tool_addition block in a system message loads (MCP
late tools, the advisor) stays in tools. Not tried against a real
upstream: no OpenAI key or custom Responses relay was used; the item's
shape and position follow OpenAI's docs, and the fixtures follow
maximia's three-request probe (Claude Code 2.1.302) and the
tool_reference shape Claude Code 2.1.306's binary writes.

Tests: TestLoadedToolsKeepThePrefix (top-level tools and instructions
identical across the three requests, each input a prefix of the next),
TestLoadedToolsInOneItem (parallel, batch, repeat), TestLoadedToolsWhereNotTaken
(unsupported upstream unchanged; compacted; non-deferred),
TestLoadsInPlaceScope, TestLoadedToolsThroughTheGateway (off by default on
a relay, on with the flag, refusal retried without the item and not sent
again), TestAdditionalToolsPair (CLI). Broken by hand: with the
buildResponses placement disabled, the first two and the gateway test go
red; with the refusal retry disabled, TestLoadedToolsThroughTheGateway
goes red.

Run at cff7dc67d (this change on 82fb0702f), sandbox HOME, one suite on
the machine: gofmt -l internal/ clean; go vet ./... (darwin),
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... all clean;
go test -timeout 45m ./... every package ok (gateway 890s, agent 871s,
provider 447s), no FAIL. Rebased onto 52209522a (gui assets, redact and a
gateway-routing.md line of others; no overlap in code): go build ./...,
go vet of gateway, cli and redact, the tests above with TestToolSearch*
and TestCodexAsSent, and go test ./internal/redact, all ok. GUI (playwright) suite not
run: no GUI asset changed (internal/gui/providers.go is Go, in the suite).
2026-10-21 19:58:52 +08:00
yetone 62a3e79b7b redact: more file names that read as addresses stay as written (willz on Discord)
willz (#feedback) asked to tell image names like image@2x.png apart from
emails. b855cfee9 (#3029) already leaves …@2x.png/.jpg/.webp/.pdf and
the other image extensions, for the rule and the local model. This
widens the same check (fileExt in realEmail, which modelTakes calls too)
to what it still masked:
- other files named so, whose extension is no domain either (IANA's list,
  checked 2026-10-21): strings@base.json, styles@2x.css, txt, csv, yaml,
  js/ts, fonts, office files, archives, audio;
- a scale before an extension that is a domain too: icon@2x.zip,
  intro@1.5x.mov, @2x.md, @2x.map (scaleExt). Without a scale,
  ops@files.zip and me@notes.md are addresses and still masked; .ai and
  .io never were file extensions here.
(@2x.mp4 and the like never matched: the rule's last label is letters
only.) There is no allow-list for redaction: Settings → Privacy has
words and rules to mask more, and per-kind switches, but email is part
of "Mask personal data" and can't be turned off on its own.

TestMoreFileNamesAreNoEmail: the names above unmasked, in Mask and in a
request's tool_result through MaskJSON, and a.b@acme-corp.com,
x@company.ai, dev@startup.io, me@notes.md, ops@files.zip,
jane@studio.mov, sales@2x.com, hi@png.dev still masked. Broken by hand:
with b855cfee9's list only it fails on strings@base.json, icon@2x.zip,
intro@1.5x.mov and the request; with zip/mov/md/ai taken as file
extensions whole it fails on x@company.ai, me@notes.md, ops@files.zip,
jane@studio.mov.

Run at this head (on origin/main d3db461bb), sandbox HOME:
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... clean; go build for darwin, linux (nogui)
  and windows ok (at 27a1f428c, the same change on 049040283).
- go test -timeout 45m ./...: 68 packages ok, exit 0 (load ~85-140);
  the same at 049040283. Rebased after onto origin/main 82fb0702f
  (six gateway-only commits, none in redact or its doc):
  go test ./internal/redact ok, go vet redact and gateway clean.
  An earlier run of this change at ba319a758 timed out internal/agent
  and internal/library at 45m (load ~25-77; #2544/#2723, #2853) and had
  TestMainWindowCorners/RightToLeft killed (#2645); alone, library
  (2207s), agent (-timeout 120m, 1887s) and those gui tests passed.
Not tried: a real agent request through a running magpie.
2026-10-21 19:38:31 +08:00