Commit Graph
2443 Commits
Author SHA1 Message Date
yetone 02f1cee794 plugin: a plugin installs the vendor CLI it signs in through (niuniu_8964 on X)
agy-cli signs in and serves requests through Google's agy CLI. In magpie's
Docker image there is none, so its sign-in failed with "agy CLI not found"
and the user had to get a shell in the container and install it by hand,
where it lived outside the volume. Claude's sign-in already installs
claude when it is missing ("Installing Claude Code…"); a plugin had no way
to say it needs a CLI.

A plugin now declares its CLI as auth.cli = {name, manual, installed(),
install({signal})}. The host lists it as Provider.CLI and answers two new
calls, cliInstalled and installCli (run through the provider's proxy, and
given up when magpie gives up). pluginCLI returns that CLI when it isn't
installed, so the plugin's sign-in goes through the same "installing"
state as Claude's: the Providers sheet shows "Installing Antigravity CLI…",
then the sign-in link; a failed install names its cause and the plugin's
manual command. `magpie plugin login` does the same in a terminal. An
answer magpie can't get (host down, a timeout) counts as installed, so a
plugin is never reinstalled for a failed read.

The agy-cli side (installing agy into the data folder, which is on the
container's volume, and keeping that copy current) is in
magpie-community/plugins.

Run, at this head (rebased on 60ebaea03), on mica:
- go test ./internal/cli ./internal/plugin ./internal/provider ./internal/gui: ok
- GOOS=linux (-tags nogui) and GOOS=windows go vet of plugin, provider, cli: ok; gofmt clean
- TestPluginSignInInstallsItsCLI red on the old pluginSignIn (no CLI found,
  straight to waiting), green now. TestPluginInstallsItsCLI covers the host
  calls: listing, a refused install, an install given up, a good one.

Real use, magpie's Dockerfile built on xiaomi-gpu (Docker Desktop, linux
amd64), volume on /config, agy-cli loaded from its working tree:
- `magpie plugin login agy-cli 1`: "Installing it…", agy 1.5.9 downloaded
  to /config/data/magpie-agy-cli/agy, then agy's Google sign-in link.
- restart: agy still there and runs.
- `magpie web` in the container, agy removed, POST /api/plugin-signin:
  state installing ("Antigravity CLI"), then waiting with the link.
- agy.version set back to 1.5.0 and restarted: the plugin updated its copy
  a minute later.

Not tried: finishing a Google sign-in in the container (no keyring there;
agy-cli's file sign-in is the path), a real install on macOS, Windows or a
musl Linux, and the full suite.
2026-11-15 14:52:48 +08:00
yetone 60ebaea033 claude: the newest Claude Code on the machine runs, and an old one's sign-in says it is too old (zi_xiang5806 on X)
zi_xiang5806's in-magpie Claude sign-in ended "Sign-in didn't finish":
the claude magpie ran was an npm 2.1.38 first on PATH, which has no
`auth login --claudeai` ("error: unknown option '--claudeai'"), while
`claude update` had installed 2.1.325 into another Node after it.

- proc.FindTools lists every `claude` (each PATH folder, then where
  installers put it), deduped by real path, cached like FindTool.
- claudecode.Own (behind claudecode.Find, so the sign-in, the gateway's
  bridge, bili, keep and `magpie claude-code` all get it) runs the
  newest. The first on PATH is passed over only for one whose version
  is known and newer; an unreadable version is unknown, not old.
  Versions are read first where each is installed, running nothing
  (npm package.json via proc.PackageVersion, the native installer's
  versions/<v>, Homebrew's Caskroom/claude-code/<v>); only when one is
  known that way is another asked --version (VersionOf, kept per file
  until it changes, an unknown for a minute). With one claude, or none
  known, nothing is run.
- A sign-in whose claude says "unknown option"/"unknown command" now
  says Claude Code is too old, with its version and path, and to run
  `claude update` (or npm install -g @anthropic-ai/claude-code@latest).

Tests: TestClaudeSignInRunsTheNewestClaudeCode and
TestClaudeSignInSaysClaudeCodeIsTooOld put two fake npm-layout claudes
(2.1.38 first, 2.1.325 second) on PATH in a sandbox HOME; both were red
with Find reverted to the first on PATH (the first with the reporter's
exact "unknown option '--claudeai'"). TestOwn*, TestInstalledVersion,
TestFindTools.

Run at base 96d1b93b2 (the 5 commits rebased over touch none of these
files): full `go test -count=1 -timeout 45m ./...` on mote, 101 ok,
exit 0 (internal/gateway ok 1036s; an earlier version that ran
--version on every candidate turned ~20 gateway Claude bridge tests red
through their fake claude, which is why nothing is run when no version
is known where it is installed). claudecode, proc and provider
TestClaudeSignIn also ok on wsl-run (Linux) and claudecode on win-run;
GOOS=linux and GOOS=windows go vet of proc, claudecode, provider ok;
gofmt clean.

Not tried: a real sign-in with a real old CLI and account; WSL's
too-old message; the Agents page still shows the first on PATH.
2026-11-15 14:30:16 +08:00
yetone 45185710e4 codex: Lite requests go without added instructions, and a turn's state stays with its account
legeling567 on X: three ChatGPT Pro accounts behind magpie, Codex on
Astra at high effort, saw frequent 529 "high load", quota spent faster,
and luna replies; CC Switch on the same accounts was fine. Diffed the
official Codex 0.165 against magpie through a recording proxy, both on
the owner's real account (sandbox HOMEs). Two differences:

- Responses Lite (an additional_tools input item, or reasoning.context
  all_turns): Codex sends no top-level instructions and no
  reasoning.summary. codexBody added Codex's full instructions (~21K
  chars) and summary "auto": about 4K input tokens a request more than
  the official client. codexLite now leaves both out; a request that
  isn't Lite still gets them.
- x-codex-turn-state, the backend's routing token for a turn: Codex
  over HTTP sends it back on the turn's next request. Through magpie it
  never was: the pool route didn't hand it to Codex, and Codex over its
  socket to magpie continues a turn by previous_response_id with no
  state. The gateway now keeps the state per account and turn
  (codex_turnstate.go) and sends it on that turn's next request to the
  same account only; a state Codex sends itself goes only to the account
  that issued it. The socket front keeps the last reply's state per turn
  and sends it as the header, and takes it out of client_metadata.

Red on the old code, green now: TestCodexBodyLiteGetsNoInstructions,
TestCodexPoolTurnStateStaysWithItsAccount, TestCodexSocketKeepsTurnState,
TestCodexSocketServed (state left in client_metadata).

Real run (Codex 0.165, gpt-6-astra high, one Pro account, sandbox
magpie built with CodexBase at the recording proxy): request 1 sent no
state and got one; request 2 sent it back and the backend issued no new
one, as with the official client. Neither had instructions or summary;
input tokens ~14.1K-15.5K against the official 15,466 (before: ~19.6K).

Run at this head (run rebased on 8bf9cb99d; pushed on 96d1b93b2, which touches only internal/plugin): go test -timeout 45m
./internal/gateway/ ./internal/provider/ on mote: ok (gateway 961s, provider 144s); gofmt -l
clean; go vet GOOS=darwin, linux, windows on both packages clean.

Not tried: the luna reroute itself (both sides were served gpt-6-astra),
Codex Desktop, three accounts at once, magpie to chatgpt.com over a real
WebSocket (the proxy forced HTTP). OpenAI-Beta: responses=experimental,
which 0.165 no longer sends, is left as is.
2026-11-15 13:56:58 +08:00
yetone 96d1b93b23 plugin: a dist add is judged by the copy Bun leaves, tried again over a broken one
CHENGJIAHEGOXIS on X (Windows, Bun 1.4.4, after v0.1.4229) still couldn't
install @magpie-community/tools-goanyapi from the dist branch: "Unexpected:
failed copying files from cache to destination for package
@magpie-community/tools-goanyapi ... installed ... Failed to install 1
package". 38a90a34c only let a failure over *another* package pass; this one
names GoAnyAPI itself, so the add was refused, and nothing magpie did made
the next try different.

What Bun 1.4.4 does (reproduced, sandbox HOME, its source read in
src/install/PackageInstall.rs):
- A local tarball is installed from its install-cache entry
  <cache>/@T@sha512-<32 hex>@@@1, trusted whole once there. An entry
  missing a file gives a copy missing it, "1 package installed", exit 0
  (macOS on mote and Windows on xiaomi-gpu). Before this, magpie recorded
  that plugin as installed with no index.mjs.
- A copy it can't make still prints "installed", writes the dependency and
  exits 1: a file of the old copy held open without delete sharing on
  Windows gives the reporter's lines with EBUSY; a read-only folder on
  macOS gives EACCES. The reporter's "Unexpected" is a Win32 code Bun has
  no errno for; which one wasn't reproduced (antivirus, a cloud
  placeholder or a transient hold are the candidates).

Now addDist checks node_modules/<name> against the tarball installDist
verified, file by file (.bun-tag and other extras ignored). A copy that
differs is taken out together with Bun's cache entry and its scope link,
and after 2s (distAgainAfter) the add is tried once more. A whole copy is
the package in. One still not whole is errDistPartial, which install never
hands to othersFailed, so the dependency is put back and the plugin isn't
listed. The npm add has no tarball in hand and isn't judged this way.

The fake bun now copies a dist tarball through a modelled cache entry
(.held / MAGPIE_FAKE_BUN_HELD for a copy it can't make, MAGPIE_FAKE_BUN_LOSE
for a file that never arrives); both sandboxes pass BUN_INSTALL_CACHE_DIR.

Run:
- New tests red on the old dist.go/store.go (mote): TestDistAddOverABroken-
  CacheEntry (no index.js), TestDistAddOverAHeldCopy (the reporter's
  error), TestDistAddNeverRecordsAPartialCopy (exit 0 one returned nil).
- go test ./internal/plugin/... on mote at the pushed head (rebased on
  8bf9cb99d): ok 155s. gofmt -l clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui of internal/plugin: ok.
- win-run go test ./internal/plugin/ (before the rebase): the new tests
  pass; TestStaleMissingIsUnknownWhileDistUnread (#5351, passes alone) and
  TestPiPackage (#4115, red alone on base dd89f1255 too) red.
- Real Bun 1.4.4, real goanyapi 0.1.1 tarball served as the dist branch,
  through AddExact (throwaway test, not committed): clean add, a cache
  entry with index.mjs taken out, and on Windows a file of the old copy
  held open for 3s (EBUSY, then the second try after the pause) each
  installed, and the plugin loaded under bun (its hooks return 37/50
  tools). A hold of 20s: add fails with Bun's EBUSY lines, GoAnyAPI not in
  package.json and not listed.
- All 105 dist packages' latest tarballs added with real Bun 1.4.4 on mote:
  every copy equals its tarball byte for byte (only .bun-tag besides), so
  the check refuses none of them.

Not tried: the reporter's own machine or its "Unexpected" code; the check
on npm adds (#6736).
2026-11-15 13:41:12 +08:00
yetone 8bf9cb99d4 codex: an account with bought credits goes on on them, heard as Codex hears them
123xtv03k on X (v0.1.4233): Codex alone goes on on an account's bought
credits once its plan is used up; through magpie the account stopped.

Codex itself sends no opt-in for credits. It reads
x-codex-credits-has-credits, -unlimited and -balance from every reply,
the 429 included, and `credits` on the codex.rate_limits event
(parse_credits_snapshot; both bools required). magpie knew of credits
only from /wham/usage, read about once a minute, so the 429 that used a
window up was taken as out, and the rest lasted till the window renewed.

- heardCodexCredits reads the headers on every Codex reply (routed and
  the relay's 429), codexEventCredits the event; an image limit's are
  left out. provider.NoteCodexCredits marks the account's windows and
  allowance on credits and clears Held, so Usage doesn't call it out.
- A rest taken for a used-up window before the credits were known is
  lifted once they are, heard or read (provider.OnCredits, creditsKnown),
  only when the account's "Use credits" is on.
- The relay's hold for an account on credits refused twice is at most
  fallbackCooldown (1 minute), like the routed path's, not till reset.
- No header or flag is sent that Codex doesn't send.

Run (mote, at this head rebased on b466aa280; 79b10c5a9 since touches only LESSONS.md): go vet for darwin, linux
and windows of internal/provider and internal/gateway; go test -count=1
-timeout 45m ./internal/provider ./internal/gateway: ok (provider 137s, gateway 907s). gofmt -l
clean.
Broken by hand: without the heardCodexCredits calls, the OnCredits
registration and the hold clamp, every new gateway subtest but "says
none" goes red.
Not tried: a real account holding credits (the owner's hold none). The
Usage card's balance text still comes from /wham/usage only.
2026-11-15 13:28:34 +08:00
yetone b466aa2803 update: a Daily channel, one release a day that passed its tests, for the app and Docker (fishmagic80 on X)
fishmagic80 on X: Stable is too slow (community plugins need a newer
magpie than it has), every release is too fast, and Docker users have
nothing in between. Daily sits between them.

What it is:
- site/worker.js keepDaily: at the daily cut (20:00 UTC, the quarter-hour
  cron) the newest tag whose commit has a successful Test run and whose
  release has all 17 assets is picked and kept in LEDGER "daily". A day
  with none keeps the day before's; a failed GitHub read writes nothing.
  /api/latest?channel=daily (503 until a pick exists), /download/daily/<p>,
  and an urgent release overlays it as on Stable.
- .github/workflows/docker-daily.yml reads that feed and points
  ghcr.io/yetone/magpie:daily at the picked version's image.
- App: settings.UpdateDaily ("daily"); update.Channel()/Picked() (Stable()
  kept); the feed is asked channel=daily, never falls back to GitHub's
  latest, What's new lists every change since yours. Settings > About >
  Update channel has Every version / Daily / Stable; the version row says
  "Up to date on Daily (· {v} is out on Every version)". CLI: magpie
  update channel [stable|daily|every].
- Words in en, zh, zh-TW, ja, de, on top of 7f832b2f2's 尝鲜版/搶先版/先行版
  for Every version (kept as it landed).
- The channel row wraps its switch under its name when narrow (ja at
  420px was 18px past the window with three segments).
- app.js budget +338: the segment, its line and the two Up to date on
  Daily words, packed to one t() per choice; Settings and renderUpdate
  draw on every window, nothing lazy to move them to.
- Docs: docs/reference.md, site docs (docker, privacy in en/zh/ja),
  llms-full.txt, search indexes.

Red on the old code (a daily-old worktree, then only settings allowing
"daily"): the feed was not asked channel=daily, 40 notes instead of all,
Picked false, notesKey "zh" not "zh|daily", the Daily row showed
"available"; the GUI tests had no Daily segment.

Run on mote at this commit's tree (on origin/main ec1a1a7a5; the Daily pick itself is live on the deployed worker: /api/latest?channel=daily answers 0.1.4171, /download/daily 302s to its dmg):
- go test -count=1 ./internal/settings ./internal/settingsapi
  ./internal/update ./internal/cli ./internal/gui: all ok (TestCoreScriptBudget
  included).
- GUI, chromium and webkit, every language: update-*.test.cjs (22 files),
  i18n-*.test.cjs, settings-search.test.cjs: 554 of 554 pass.
- site: node --test site/*.test.mjs, 132 of 132 (130 before the rebuild).
- gofmt -l clean; go vet darwin, windows (gui/update/cli) and
  GOOS=linux -tags nogui.

Also: site/public/search/*.json and llms-full.txt rebuilt
(search-index.mjs, llms-full.mjs); they still listed Antigravity's old
sign-in after 9cd5f3652, so the two site freshness tests were red.

Filed: #6730, engines.magpie is never read, so a plugin needing a newer
magpie installs on Stable (0.1.3078) and fails without saying why
(page-amp-usage >=0.1.3681, middleware-company-guard >=0.1.3841,
page-day-card >=0.1.3427).

Not tried: a real self-update on Daily, a real docker-daily workflow run,
the whole GUI suite, the worker's unauthenticated GitHub reads under a
rate limit.
2026-11-15 13:10:18 +08:00
yetone ec1a1a7a55 library: import the slash commands the agents already have
miantiao_me on X (after v0.1.4189): 「之前在 Pi 定义的可以导入吗?」. Library ›
Slash commands now has a "Find in agents" card at the top. It reads the
command files each agent already has, from the same places magpie writes
them (Pi prompts/*.md, Claude commands/*.md, OpenCode command/ and
commands/, Gemini and Qwen .toml, Qwen .md, Droid), and lists them to
import, the way Subagents' import does.

- Parsing: frontmatter description plus body; for TOML, description and
  prompt. Arguments go back to magpie's form: Claude's $ARGUMENTS[n] and
  $n (0-based) become $n+1, Gemini/Qwen {{args}} becomes $ARGUMENTS,
  Pi's $@ becomes $ARGUMENTS (${@:N} is left as written).
- Files magpie wrote itself are skipped. The same content in several
  agents is one command; a name with different bodies per agent shows
  "Differs by agent" and one of them is picked; a name the library has
  with other content is "Name taken" and can't be picked.
- An imported command keeps its source agents ticked, and magpie adopts
  each original file byte for byte (Command.Taken): sync writes the same
  bytes at the same path, so the file is never doubled or rewritten.
  After an edit the agent gets magpie's render at that path; a rename
  drops Taken. Taken never leaves the machine (Collect strips it, Put
  keeps the local one).
- API: POST /api/library/commands/probe, and commands/import through
  the library change route. internal/cli's parity test names the probe
  as stage 3, like subagents/probe.
- Docs: docs/subsystems/library.md has the new row.

Run at 039e25752 (on origin/main dd89f1255), on mote:
- go test ./internal/library/ ./internal/cli/: ok. ./internal/gui/: only
  TestCoreScriptBudget red (app.js 10 bytes over), red on main, #6733;
  this commit doesn't touch app.js.
- gofmt clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...: ok
  (at fb01ae2bb, base 028b07b4b; the two later main commits are Windows
  hook code in internal/gui).
- GUI: library-commands-import (new: chromium + webkit, en/zh/zh-TW/ja/de,
  420 and 1100 wide, no sideways scroll, press stays in place),
  library-commands, library-subagents-import, i18n-keys, i18n-en-no-cjk:
  64 of 64.
Earlier, at 1a70f31b6 (base 6af327e2b):
- go test -timeout 45m ./...: every package ok except internal/cli's
  TestEveryRouteHasACommandOrIsNamed, which named the missing probe route;
  fixed here and green since.
- Whole GUI suite (--test-concurrency=8, mote at load 17 to 44 with
  another session's go suite and GUI runs): 26887 pass, 1005 fail in 109
  files, none of them library-commands. The 109 files run alone at
  99719df19 and at origin/main 5bd41301b: 1145/996 vs 1144/997, the
  same tests red apart from language/width variants that flip between
  runs. Recorded on #6709.
Tests use a sandbox HOME with real Pi prompt files from Pi's repo
(internal/library/testdata/pi-prompts). Broken by hand: with syncCommands'
Taken branch off, all four import tests go red ("has a slash command of
its own"); with Put's Taken keep off, TestCommandImportNotCarried goes red.
Not tried: a real Pi install on a live HOME (by rule), or Windows/Linux
runs of the Go tests.
2026-11-15 12:59:12 +08:00
yetone dd89f12556 gui: the no-activate hook's handle is swapped atomically, and the Windows exit doc says what the unhook leaves to endProcess (#6705)
On top of wizd's unhook (#6705, afe3b3ff7, kept as authored with its test): noActivateHook becomes an atomic.Uintptr
that unhookNoActivate swaps to 0, so the three places that unhook
(OnShutdown, the main-thread window's WM_DESTROY, Run's return) take it
off once without a racy read-then-clear. Nothing hooks it again:
hookNoActivate runs its SetWindowsHookEx under noActivateOnce, and
noActivateHooked stays true after the unhook.

07dfd0bb8's endProcess (TerminateProcess on itself) and awaitExit are
kept and the gui-shell doc says why: they still cover the other DLL
detaches, an os.Exit while the app runs (Wails' fatal error, which this
unhook doesn't reach), and an update from a version before the fix.

Exit paths reviewed: Quit (tray, page) runs Wails' cleanup, whose
shutdown tasks run on the main thread (InvokeSync), so OnShutdown
unhooks on the hook's thread before Run returns into endProcess. A
restart to update quits the same way. Wails' SingleInstance os.Exit in a
second instance comes in application.New, before any window exists, so
no hook is on. SIGINT/SIGTERM in the app go to Wails (ownSignals), so
through OnShutdown. The handover's quitBy exitNow is Mac/Linux only.

Run at this tree on base 72e06980e (the rebase onto 028b07b4b adds only
routing JS and docs), on xiaomi-gpu (Windows 11 26200,
Go 1.26.8) through win-run:
- TestUnhookNoActivatePreventsExitDeadlock -count=3: PASS 3/3.
- broken by hand (unhookNoActivate returning at once), at the tree before
  the rebase: unhook and destroy-main both FAIL "process hung in
  ExitProcess (stderr=fatal error: exitsyscall: syscall frame is no longer
  valid ...)".
- go test ./internal/gui: 11 reds. TestCoreScriptBudget (app.js 10 bytes
  over its budget) is red the same on macOS at 72e06980e with no script
  touched here; filed as #6733. The other 10 (TestGatewayHeldByAContainer,
  TestLodyImportHandoff, TestImportStatusUnreadableIsUnknown,
  TestAionUiImportRow, TestCherryStudioImportRow, TestProviderSaveClientCert,
  TestPageAwayLetsStatsGo, TestPluginAgentMissingSaysSo,
  TestGatewayModeStatsNameTheGatewaySessions, TestUpdateThatWontStart) fail
  the same on origin/main 9cd5f3652 run alone there, and are filed in
  #6068 (also #5324, #5928, #6059).
- In the signed-in session (scheduled task /IT, where msctf is loaded):
  TestRestartBySelfAsksNoAttention (window, tray),
  TestRestartBySelfComesBackQuietly and TestUnhookNoActivatePreventsExitDeadlock
  pass.
- A real build (go build -tags production -H windowsgui) run as `magpie
  app` in a sandbox profile (USERPROFILE/APPDATA/LOCALAPPDATA redirected,
  MAGPIE_ADDR :3461, page on :3462) in the signed-in session, quit four
  times through POST /api/window/quit?now=1: each exited in 51-62ms. The
  magpie:// handler it registered was put back afterwards.
On mica: gofmt -l clean, go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.

Not tried: a restart to update of a real build on Windows (needs a staged
update); the wedge itself in a real app (07dfd0bb8's endProcess already
ends the normal quit without ExitProcess, so it can't be brought on at
will); Windows on arm64.
2026-11-15 12:39:32 +08:00
Wizard 7ce93508f0 gui: unhook noActivateHook before process exit on Windows (#6705)
Two full-memory dumps on Windows 11 (magpie.DMP on v0.1.4196 and magpie2.dmp on v0.1.4185) show why ExitProcess throws in exitsyscall and wedges with one thread left (#5922, #6678, #6705):

1. hookNoActivate installs a thread-local WH_CBT hook (noActivateCBT, Go callback #93) on Wails' main thread and never unhooks it.
2. When the process exits through runtime.exit(0) -> ExitProcess (for example from Wails' SingleInstance handover os.Exit, Wails' fatal os.Exit, or before 07dfd0bb8's endProcess), runtime.exit(0) acquires runtime.finlock and enters ExitProcess via runtime.stdcall with g1.syscallsp set.
3. Inside ExitProcess -> RtlExitUserProcess -> LdrShutdownProcess -> RtlpFlsDataCleanup -> msctf!CicFlsCallback -> msctf!SYSTHREAD::DestroyThreadMessageWindow -> win32u!NtUserDestroyWindow, Windows dispatches HCBT_DESTROYWND (nCode=4) to noActivateCBT on the main thread.
4. noActivateCBT calls w32.CallNextHookEx, whose nested Go syscall clears g1.syscallsp = 0 on return. When cgocallbackg then calls runtime.exitsyscall, gp.syscallsp < sp triggers 'fatal error: exitsyscall: syscall frame is no longer valid'.
5. runtime.fatalthrow.func1 calls runtime.exit(2) on the same thread (m0), which attempts to lock runtime.finlock a second time and self-deadlocks forever while still holding Wails' single-instance mutex and WebView2 profile handles.

Fix: unhook noActivateHook (w32.UnhookWindowsHookEx) when Wails' main-thread window receives WM_DESTROY in appWndProc, in OnShutdown, and when Run returns.

TestUnhookNoActivatePreventsExitDeadlock reproduces the exact FLS window-destruction callback on ExitProcess's last thread: without unhookNoActivate the child process throws 'exitsyscall: syscall frame is no longer valid' and wedges with 1 thread left; with unhookNoActivate (or WM_DESTROY on the main-thread window) it exits 0 cleanly.

Fixes #6705
2026-11-15 12:39:32 +08:00
yetone 028b07b4bd routing: a folded fold of accounts on one plan shows its bar in the app (Sdsi134a on X)
Sdsi134a on X: on the Routing stage, "Command Code Plan · 3 accounts" folded
said only "3 available", with no quota, though the accounts are on one plan.
foldQuota (ea1a8ae80, chen2652) was meant to show that figure and bar, but
it never could in the app: cardFor matched only cards whose kind is
"subscription", and /api/usage/quotas sends this computer's cards with no
kind (SubscriptionQuota.Kind is omitempty and set only on a remote magpie's
cards). The tests' fixtures carried kind: "subscription", so they passed.
cardFor now takes a card of this computer whose kind is subscription or
none. This also lets the accounts list's per-account windows (#1833) and
the failed-read line (dd9cd59a1) find their cards in the app.

The fold's figure now also says when its window starts again, the soonest
of the accounts' ("5 hours 40% used · renews in 2 h 10 min"), as an account
row does; no new strings. Hide plans on the groups page
(magpie.routingGroupPlans, f362d3b9a) folds the figure and bar away here
too (plansHidden). Mixed plans: nothing, as before.

Run (base 9cd5f3652; rebased onto 72e06980e, whose new commits touch no
routing or GUI file):
- routing-fold-accounts-together.test.cjs, its cards now in the API's shape
  (no kind), plus the reset and the Hide plans case: 22/22 on mote,
  chromium + webkit, en zh zh-TW ja de, 1100 and 420px. With the old
  client.js: 22/22 red (the figure never appears). With the plansHidden gate
  taken out by hand: 11/11 chromium red ("hidden plans").
- With it, on mica: routing-account-windows, -card-error, -group-plans,
  -free-seat, -groups-page, -pooled-card, -remote-windows, -read-allowances,
  -seat-windows, -wallet-lapse, -fold-all, -folder, i18n-keys,
  i18n-en-no-cjk: 306/306.
- go test -count=1 ./internal/gui/ on mote: ok.
Not tried: the real app with several real accounts on one plan (the owner
has none such); the whole GUI suite.

Reported-by: Sdsi134a
2026-11-15 12:35:22 +08:00
yetone 62ced98ccd gateway: a Gemini 3+ on an Anthropic or Chat relay is asked a thinking level, never a budget (Mamba_asr on X)
A relay serving Gemini under a host of its own (Mamba_asr's peta-gemini)
was sent Claude Code's thinking budget_tokens as it came on Anthropic's
Messages, the translation's budget from a Chat or Responses effort, or a
Chat client's extra_body.google.thinking_config thinking_budget. Such a
relay passes it on to Gemini as thinkingBudget, which Gemini 4 turns
away ("Thinking budget is not supported for this model. Use thinking
level instead.", #2083). AI Studio, Vertex AI and the translated Gemini
routes already sent thinkingLevel; the relay routes didn't.

geminiLevelBody (gemini_level_body.go), run in passthrough and
forwardTranslated after xaiBody, acts only for a Gemini 3 or later model
id on an Anthropic or Chat upstream:
- Anthropic: thinking enabled + budget_tokens goes as thinking adaptive
  with output_config.effort, the budget bucketed by effortOfBudget
  (<=4096 low, <=12000 medium, else high) unless the request names an
  effort.
- Chat: thinking_config's budget goes as thinking_level (-1: none, 0:
  low), and reasoning_effort is fitted.
Gemini's own OpenAI-compatible API (geminiCompat: AI Studio, or a
proxy on this computer or the LAN) is left alone: it takes a budget,
and the Chat path already fits its levels and asks again on a refused
one (TestGeminiThinkingLevelRefused and
TestPassthroughGeminiMinimalRefused went red until it was left out).
geminiLevelFor fits a level to the model: the catalog's levels where it
lists them, else nothing above high, and medium as high on a Gemini 3
Pro (which takes low and high only, per Google's model docs).

Run (mote, at this head rebased on origin/main):
- TestGeminiRelayAskedALevel: a fake relay that returns Gemini's 400
  for any budget sent to a gemini-4 model. Its 7 Gemini cases are red
  with gateway.go's old body (budget_tokens / thinking_budget / xhigh
  sent as they came); the 3 other cases (claude-sonnet-4-5 budget_tokens,
  gpt-5.5 reasoning_effort xhigh with a thinking_config budget, and
  gemini-2.5-flash budget_tokens) pass on both, unchanged.
- TestGeminiLevelFor.
- gofmt -l clean; go vet ./internal/gateway on darwin, linux, windows.
- go test -count=1 -timeout 45m ./internal/gateway: ok.
  That full run was at 862660144; rebased onto 049073c97 (the
  Antigravity retirement touched internal/gateway), go vet and
  go test -run 'Gemini|Thinking|Effort|Vertex|Anthropic|Relay'
  ./internal/gateway: ok at this head.
- docs/subsystems/gateway-routing.md names the rule.

Not tried: the reporter's real relay, or any real relay. A relay that
doesn't understand thinking "adaptive" will drop it and use the model's
default thinking, which beats a 400. Not covered: a Responses upstream,
plugin routes, and a Chat body's own "thinking" budget field.
2026-11-15 12:27:05 +08:00
yetone 9cd5f36521 antigravity: retired, the built-in and its plugin both ask Google nothing; Antigravity is served by your own agy (agy-cli)
Google bans accounts it sees on Code Assist through Antigravity's own
client. magpie offered that route twice, the built-in and
@magpie-community/opencode-antigravity-auth, and anyone who picked
Antigravity in magpie took it by default (the owner, 11-15: 全部下线,改推
agy-cli).

- retiredBuiltins has antigravity. googleLogins lists no account of a
  subscription its plugin serves, so no list, usage read, quota read or
  request goes to Google with a built-in Antigravity account (the usage
  loop in subscription_usage.go had no gate of its own). The mover reads
  googleSavedLogins, so saved accounts still move.
- The mover's min is 0.2.0 (on the plugins dist index, b8bf5a57): that
  version sends nothing, answers every request 410 ModelDeprecated
  ("model has been retired", which modelRetired reads, so a group asks its
  next member) naming Antigravity (local agy CLI) and
  `magpie plugin add @magpie-community/opencode-agy-cli-auth`, and turns
  sign-in away. It left the plugins registry (003a38ff).
- Gemini CLI's route, on the same code, is unchanged.
- The built-in's code stays for now (shared with Gemini CLI); taking it
  out is #6723. Its 123 tests serve it again for their run through
  provider.AntigravityBuiltinForTest(), a counter BuiltinRetired reads.
- README (en, zh) and site docs subscriptions (en, zh, ja) point to
  Antigravity through the user's own agy CLI. AGENTS.md and
  provider-plugins.md say why and that neither route comes back.

What users lose: Antigravity with Google accounts signed in to magpie, and
rotating several of them. agy-cli serves the one account the user's agy is
signed in to, and needs agy installed.

Tests: TestRetiredAntigravityAsksGoogleNothing saves an Antigravity
account and checks googleLogins/googleAccountOf give nothing, the mover
still carries it, usage has no Antigravity card and the fake Google was
asked nothing, and Gemini's account still lists. Broken by hand (the
PluginServes gate removed from googleLogins): red,
"googleLogins(antigravity) = 1 accounts".

Run (mote/mica, at this change on origin/main 5bd41301b): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... and go build ./... ok; go test ./internal/gateway/ (1245s),
./internal/agent/ (419s), ./internal/provider/ (253s) ok on mica;
after rebasing on origin/main f362d3b9a: go test ./internal/provider/
(160s) and ./internal/plugin/ (184s) ok on mica.
Earlier at this change minus the test opt-ins: sessions, usage, library,
gui ok (mica). internal/cli's TestEveryRouteHasACommandOrIsNamed is red at
5bd41301b itself (/api/warm-all, #6724), not from this change.
Not run: the full ./... suite (mote and mica each had another session's
full or GUI suite); the GUI suite (no app.js change); a real move of a
built-in Antigravity account onto 0.2.0.

Plugins side: magpie-community/plugins 003a38ff (antigravity 0.2.0) and
f9155256 (agy-cli 0.1.56, comments only).
2026-11-15 12:14:48 +08:00
yetone 862660144e gui: a page's tabs in the sidebar fold from its own row, with a disclosure chevron (hkwok06 on X)
Opening Settings unrolled its tabs in the window's sidebar and nothing
said they would fold again; only opening another page (the gateway)
put them away. The open page's row now carries a quiet disclosure
chevron, as a Mac sidebar's: turned to its list while the list shows
(down for the pages above, up for Settings, whose list opens above its
row), and clicking the row or the chevron again folds the list and
unfolds it, the page staying open on its tab. A list folded stays
folded, per page, until it is opened again (localStorage
magpie.navFolded). The same holds for Usage, Library and Plugins.
The chevron is muted, turns in 200ms on the strong ease-out, and
doesn't move under prefers-reduced-motion. aria-expanded says the
state; Enter on the focused row toggles it too.

The chevron and the fold live in navicons.js (navFoldRows, navFold),
imported with the first list; app.js keeps 123 bytes (navList shared
with navMine, the two rows' clicks asking navFold first), with the
budgets raised by that and the reason in core_budget_test.go.

Run (mote):
- nav-sub-fold.test.cjs (new), chromium + webkit, en zh zh-TW ja de:
  red on the old code (12 of 12, "Settings' row shows a disclosure
  chevron"), green 12 of 12 on this change.
- After rebasing on origin/main 38a90a34c: nav-sub-fold,
  nav-sub-unroll and i18n-keys: pass 38, fail 0; TestCoreScriptBudget
  ok; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet
  -tags nogui ./..., go build ./... ok; gofmt -l clean.
- 45 GUI files the change can reach (nav-*, sidebar/side-*,
  settings-*, menu-scroll, click-scroll, i18n, gui-*, text-size,
  plugin-panels, ...): all pass except menu-scroll's scrollable
  dropdowns (#6532), nav-timeout (#5425) and settings-groups'
  warm-ups and check-in (#6597), which fail the same 5 tests on clean
  origin/main 38a90a34c (pass 8 fail 31 on both).

Not tried: the whole GUI suite (mote and mica were both loaded by other
sessions' suites), and the real app on Linux WebKitGTK and Windows.
2026-11-15 12:05:32 +08:00
yetone 38a90a34ce plugins: a dist add failed by another package, unnamed in Bun's last lines, is done (CHENGJIAHEGOXIS on X)
On v0.1.4210 the reporter (Windows) still couldn't add
@magpie-community/tools-goanyapi from the dist branch:
"bun add ./dist/magpie-community-tools-goanyapi-0.1.1.tgz: exit status 1:
Saved lockfile installed @magpie-community/tools-goanyapi@./dist/... 1
package removed ... Failed to install 1 package". Bun had installed
goanyapi; another package failed, but the line naming it comes before
"Saved lockfile", and the error kept only the last six lines, so
othersFailed found no name and the add failed. The tgz is fine (sha512
matches the index, no dependencies); nothing changes in the plugins repo.

- bunSaid: every Bun error magpie shows (add, update, remove, the dist
  mend) keeps up to 8 failure lines from anywhere in the output before
  its last lines, ANSI and CRs stripped.
- bunFailed reads every way Bun 1.4.4's source (install/*.rs) names a
  failed package: failed to install/link <name>:, refusing to install
  dependency, extracting tarball from/for, downloading tarball <name>@,
  failed to download, Failed to open node_modules folder for, path for
  package.
- othersFailed: a failure naming no package is another's when the add's
  own package is in package.json and installed at the exact version asked
  for (the spec's exact version, or the one installDist read from the
  index; installDist now returns it). Its own package named still fails.
  This covers every plugin kind, provider plugins and tools alike, as all
  go through install().

Run:
- Old code (origin/main 5bd41301b with the new tests): all five new or
  changed tests red, TestUnnamedFailureDoesNotFailADistAdd with the
  reporter's message byte for byte.
- mote: go test -timeout 30m ./internal/plugin/... ok (174s);
  GOOS=windows go vet ./internal/plugin/ and GOOS=linux go vet -tags
  nogui ./internal/plugin/ ok; gofmt -l clean.
- xiaomi-gpu (Windows 11), real Bun 1.4.4, sandbox USERPROFILE/APPDATA/
  XDG_CONFIG_HOME, magpie.exe -tags nogui built from this tree:
  `magpie plugin add @magpie-community/tools-goanyapi` from a clean
  plugins folder installs 0.1.1 from dist with its 37 tools; with
  agency-agents installed and a file of it held open, the add drops
  agency-agents and installs goanyapi. That second shape passes on
  origin/main too (Bun's EBUSY line names agency-agents there).

Not tried: the reporter's exact hidden line, which their message cut
off; no shape I made on Windows hid the name. Publishing tools-goanyapi
to npm, which would skip the dist path, needs the owner.
2026-11-15 11:55:45 +08:00
yetone 5bd41301b9 warm-up: All accounts warms every account in use at one press (CoderMaurice on X)
CoderMaurice on X: with several Claude accounts, Warm up now had to be
pressed once per account. With two or more accounts, the Warm up… menu on
the Warm up now row (a Claude Code or Codex provider's editor, the warm-up
section) now starts with All accounts. It sends POST /api/warm-all, and
provider.WarmAll sends Warm up now to every account that is in use (the
one the agent is on, or one turned on beside it) and whose windows aren't
all running already, going by the cached readings the Usage page shares.
It runs three at a time. An account that is turned off or paused, or
already in its windows, is sent nothing. An account whose sign-in lapsed
is sent nothing and is listed as failed, as Warm up now treats it. The
row's line lists the accounts warmed, the ones already in a window, and
each refusal with its reason (in red).
Accounts that are turned off aren't listed. A gateway rest is not read
(the provider package can't see it). An account rested for a used-up
window is still inside that window, so it is skipped as running.

"All accounts" moves from the usage plugin's i18n.js into core i18n.js,
since the core uses it now. It and two new strings are in zh, zh-TW, ja
and de. app.js stays inside its budget: the single-account and
all-accounts results now go through one formatter.

Run at a1968a0b5 (rebased on origin/main aecf27efb), on mica:
- go test -run 'WarmAll|WarmNow|CoreScriptBudget|Budget' ./internal/provider
  ./internal/gui: ok. New: TestWarmAllWarmsEachIdleAccountInUse,
  TestWarmAllOnlyCodexAndClaude, warm-all cases in TestWarmNowAPISaysWhy.
- Broken by hand: with the "running" skip removed from warmAll,
  TestWarmAllWarmsEachIdleAccountInUse FAILs (busy@ and spent@ warmed).
  With the All accounts item removed from the menu, warm-now.test.cjs
  FAILs ("Warm up all warms every account at one press" and the menu
  list assertion).
- GUI, Chromium and WebKit, en/zh/zh-TW/ja/de, 900px and 440px:
  warm-now, i18n-keys, i18n-en-no-cjk, usage-accounts: 54/54 pass. Before
  the rebase, plan-name-fits, provider-prefs-layout and quota-warm also
  passed (54/54 with usage-accounts).
- gofmt -l: clean. go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/provider and internal/gui: ok.
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok.

Not run: the full go test ./... and the full GUI suite. Both mote and
mica had other sessions' GUI suites running throughout, and this ships
now per the owner's ship-immediately rule. Both will run when a machine
is free. Not tried: a real Warm up all against several real Claude
accounts (the send per account is the unchanged WarmNow).
2026-11-15 11:00:37 +08:00
yetone 01f307091b routing: a group's routing changed counts at a conversation's next turn (#6708)
A conversation under Stays auto keeps its member while its cache holds
cacheWorth (1024) or more. That stays: routing ranking another member
first on its own merits doesn't move a warm cache (backFromStandIn's
rule), since the ranking moves with every reading and a move pays the
whole prompt again. What was missing is the user's own act: a reorder
already counts at the next turn (reorderedSince), but changing a
group's routing (manual -> pace in #6708) did not, so the conversation
stayed on the manual pick.

Group gains RoutedAt, stamped by SaveGroup when Routing changes and
kept otherwise, so it is persisted and a change from the CLI or TUI
reaches the running gateway (unlike NoteReordered, #6265). affine's
Auto branch now also lets the conversation go when its stick predates
the group's RoutedAt. Session, Strict and a turn under way keep it, as
for a reorder. The sibling for a provider's own accounts routing is
#6718.

Tests: TestReroutedGroupTakesTheConversationAtItsNextTurn (a 2.8k
cache, the reporter's size: rerouted "a a b b", a rename-only save
"a a a a", session "a a a a") and TestGroupRoutedAtFollowsTheRouting.
Broken by hand: with reroutedSince returning false the first is red
("a a a a, want a a b b"); green with it, beside TestReorderedAccounts.

Run at e8e5b9e06 (this pair on origin/main 97e6ac36c), on mica because mote's load was over its cores: gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and go vet ./... ok; HOME=sandbox go test -timeout 45m ./... ok, all 101 packages (gateway 932s, agent 337s, provider 209s), no reds. No GUI change. Not tried: a real Remote magpie on a free plan, or a real conversation through a rerouted group; both are covered by the tests above only.
2026-11-15 09:38:24 +08:00
yetone 98fb140869 routing: a Remote magpie signed in to a free plan is spent first by Free quota by expiry (#6708)
weighRouted set a seat's FreePlan only from c.p.Account, so a Remote
magpie whose card is a Free plan (Kind "subscription", Plan "Free")
was weighed as paid, and "Free quota by expiry" spent a paid remote
before it. provider.RemoteSeat now also says whether the card it chose
is a free subscription plan; RemoteAllowance wraps it unchanged, and
weighRouted keeps that bit on the member's left and ORs it into
FreePlan.

Test: TestRemoteMagpieFreePlanSpentFirst (two httptest remotes, a Pro
at 20% and a Free at 60%, FreeExpiring group): the free one goes first
and is the only one in wg.free. Broken by hand: without the
`|| ...freePlan` the test is red ("mac-paid first", free map all
false); green with it, beside TestRemoteMagpiesWeighedByTheirCards and
TestRemoteAllowance.

Run at e8e5b9e06 (this pair on origin/main 97e6ac36c), on mica because mote's load was over its cores: gofmt -l clean; GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and go vet ./... ok; HOME=sandbox go test -timeout 45m ./... ok, all 101 packages (gateway 932s, agent 337s, provider 209s), no reds. No GUI change. Not tried: a real Remote magpie on a free plan, or a real conversation through a rerouted group; both are covered by the tests above only.
2026-11-15 09:38:24 +08:00
yetone 97e6ac36c9 catalog: a provider's model list names each model once (#6582)
elis_pina (LoveEcho1145) on X: some APIs list a model more than once in
their /models, and each copy was a row of its own. A provider asked at its
base already merged copies by id (Provider.fetchOne's add), but one asked at
the URL its list is at (ModelsURL), the add form's List, and every list
fetched another way (accounts, Azure, Kilo, Cline, decision lists) kept
them, in the pickers, /v1/models and the agents' lists.

catalog.Unique keeps each id once: the first copy in its place, with what
it leaves unsaid (a name other than the id, window, output, levels, price,
APIs, tiers, magpie_via, keys) taken from the copies after it, as the
lookups by id (LiveByID's callers) already took the first copy that said
it. It runs at the parse of every upstream /models (catalog.fetchOne, all
pages), at every save (saveLive: the list and each base's part, whoever
fetched it), and at every read (readLive), so a list saved before reads
each id once without waiting for a fetch. A list with no copies comes back
as it is. Plugins' lists are keyed by id in host.js already. Keyed by id
alone, as Provider.fetchOne and fetchPerKey merge already.

Tests: TestFetchedListNamesEachModelOnce, TestSavedListNamesEachModelOnce
(saved, sides, LiveByID, and a file written before with copies),
TestUniqueLeavesAListWithoutCopies, TestProviderListsEachModelOnce (at
base and at ModelsURL: Fetch, List, Available). Broken by hand: with
Unique returning its input, the first two and the ModelsURL case of the
last are red (Fetch/List/Available listed [gpt-5.6 glm-5.3 gpt-5.6
glm-5.3]); with readLive's Unique alone taken out, the saved-before case
is red.

Run on mica: gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags
nogui ./... ok; go test -timeout 45m ./... at b552edb12 (base 6af327e2b):
100 packages ok, internal/plugin red on TestCancelledSignInSavesNothing,
#5532 (filed, same tok-late output, passes -count=10 alone at this head).
Rebased on 87a0af212 (changes only gateway test files and LESSONS
since); at the pushed head internal/catalog and
internal/provider ok, linux/windows vet of both ok. No GUI file changed
and no API shape changed, so no GUI suite was run. Not tried: a real
vendor that lists copies (the reporter named none).
2026-11-15 09:02:39 +08:00
yetone a5e3972a71 agent: the Codex account the user keeps Codex on is never taken over when held, so the app shows it, not "magpie" (davezfr on X)
davezfr on X, after v0.1.4216 (369ec0418): "still shows Magpie". Account
1 has used up both its plan allowance and its credits; picked in Codex's
sign-in it shows "magpie" in the Codex app, while account 2 (room) shows
itself. When it still had credits this didn't happen.

Cause. With quota and credits both gone the account is held (codexHeld:
rate_limit.allowed false, no credits), and the agent package's out()
then makes magpie Codex's provider (codex.out takeover, #540) without
requires_openai_auth. Codex's app-server answers account/read with no
account for such a provider, so the app shows the provider's name,
"magpie", in place of the account the user picked. 369ec0418 only
ended stale holds at their window's reset; a real hold still took the
account over. The takeover is magpie's default; the account the user
keeps Codex signed in to is the user's own value, which the default
overrode (code standards: magpie's default never overrides a value the
user set).

Fix.
- provider.CodexSignInKept: Codex is on the account the user keeps it
  on (keepsLogin: KeepLoginAs names the active account, or kept on the
  first with none named). False under switch-only, keeping off, or kept
  on another account than the active one.
- agent: out() is false for such an account (codexSignInKept, a var
  for tests), so Sync leaves Codex beside its ChatGPT sign-in, a pick of
  magpie's model doesn't take it over, and a takeover made before the
  keep ends. The app shows the account and greys Send till its reset,
  as it does without magpie. Not kept, a held account is taken over as
  before (Always ChatGPT still turns the takeover off for every account).
- docs/subsystems/agent-wiring.md says so.

Users already affected: once updated, the next catalog sync puts Codex
back beside the kept account's sign-in; the Codex app shows the account
after its app-server restarts (the Agents row's Restart, or Restart the
Codex app to follow), as for the takeover's end at a reset.

Tests:
- TestCodexKeptOnAHeldAccountShowsIt (agent): held and not kept: the
  takeover; kept: beside the sign-in, no AppOut, on magpie's model and
  on Codex's own joined model; let go: taken over again.
- TestCodexSignInKept (provider): the reporter's state, two accounts,
  account 1 held (week at 100%, not allowed, no credits) and kept via
  SetKeepLoginAs: CodexUsedUpKnown true and CodexSignInKept true; kept
  on account 2 while on 1, switch-only, keeping off: false.
Broken by hand: with `&& !codexSignInKept()` taken out of out(),
TestCodexKeptOnAHeldAccountShowsIt red (model_provider = "magpie"
written); with CodexSignInKept's match turned to false,
TestCodexSignInKept red ("CodexSignInKept false").

Run: full suite `go test -count=1 -timeout 45m ./...` on mote at this
change on ca64168d3: exit 0, 101 packages ok, no FAIL (log kept whole
in magpie-wt/codex-held-account-scratch/suite.log). After rebasing on
6e6a18eda (gateway only): internal/agent ok, internal/provider ok on
mote. gofmt -l clean; on mica go vet (darwin), GOOS=linux -tags nogui
and GOOS=windows go vet ./internal/agent ./internal/provider ok.

Not tried: the real Codex app with a real held account, and the
reporter's exact setting (if account 1 was picked by a plain switch
rather than kept, magpie moves Codex off the held account to account 2
at its next look, as before, and the takeover stands meanwhile).
2026-11-15 07:39:25 +08:00
yetone ca64168d3e library: a skill beside itself folds back on read; GitHub by git address is one repo
Refeccd on X said eee217712 (v0.1.4213) didn't fix "skills from a grouped
git repository get the repository's suffix". Reproduced in a sandbox HOME
three ways the fix left open:

- Copies an earlier magpie had already suffixed (blog-team beside blog)
  were folded only by foldBeside in a change. Upgrading and opening the
  Library changed nothing; Read, CheckSkills and Read again all kept them.
  readView now folds them too, when any skill has Called and a remote
  source, saves and syncs the agents in the same read, so a folded copy's
  links don't point at a removed folder. Sync problems join the view's.
- A GitHub repository added as owner/repo and then by its git address
  (git@github.com:owner/repo.git) was two sources: sameRepo and
  fromSameSource compared Kind first, so every skill went in again as
  name-owner. Both now match github and git sources through remoteRepo.
  foldBeside folds a copy from the same folder of the same repository
  (before only one whose target was Gone and at another path).
- gitRepoOf looked at a skill's folder and three above it, while a probe
  finds skills four folders into a repository: a checkout's
  skills/team/writing/poem wasn't traced, and an edited poem went in as
  poem-sub. It now looks at the folder and four above it.

Existing suffixed copies: folded on the next read of the Library page
(or next change); the copy's files, renamed, replace the skill's, its
agents are added, and both old folders go to the backups.

Tests (skill_group_suffix_test.go), each broken by hand:
- TestSkillBesideItselfFoldsOnRead: red with the readView fold removed.
- TestGitHubRepoByGitAddressIsHad: red with sameRepo kept same-kind.
- TestGitHubCopyByGitAddressFoldsBack: red with each of the above and
  with foldBeside's old condition.
- TestCheckoutSkillFourDeepIsTraced: red with gitRepoOf at 4.

Docs: docs/subsystems/library.md's "Skills installed together" no longer
says nothing is renamed after the fact; it describes sameRepo, movedIn,
besideName, followsHere's depth and foldBeside on read.

Run on mica at 168d6fb13 (on origin/main ab7cb5537): gofmt -l internal
clean; go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet -tags
nogui ./... ok; go test -timeout 45m ./... ok, 101 packages, no FAIL
(internal/library 298s). An earlier full run at 1bfdeab52 was red in two
of these new tests only: other tests mark owner/repo tooBig for the whole
run, so the fixture now uses its own repository (refeccd/grouped-skills).
No GUI file changed and no GUI test was run: the change is Go only.

Not tried: a real GitLab or intranet repository, and the reporter's own
layout (the reply gave no detail); a real GitHub repo by SSH address
(the test maps it to a local repository through git insteadOf).
2026-11-15 07:04:53 +08:00
ggbdpq dac251b5f5 gateway: a client's own whole replay is asked once more without the ids another resource refuses
A Codex replaying its whole conversation itself (store false, no
previous_response_id) echoes ids the upstream handed out for earlier
turns. When an upstream turns one away as another of its resources' —
the prevForeign refusal — the recovery that strips such ids from a
conversation magpie gave back never ran: the store-off request hung no
ask, so the retry gate stayed shut and the 400 reached the client
(#6320). x1051445024's report; the reporter's own compat proxy stripped
whitelisted optional ids as a workaround.

The store-off request now carries a marked ask when its input reads as a
replayed conversation: more than one item, and one before the last
naming an id that may go without one, or a reasoning's. One id'd item
alone is the client's own new input and goes as it came, as
TestPreviousResponseOtherResourceWholeSentWithoutIDs already holds the
line. On the foreign refusal the same prevElsewhere run takes those ids
out of the replay — reasoning only with its encrypted_content, calls'
call_id pairing kept — and the request is asked again once, only with a
body that differs. Nothing is recorded for a store-off request, and a
known conversation's recovery is exactly as before (the mark is never
set on an ask magpie answered).

Verification on darwin/arm64, upstream/main 873b4987e + this commit:
- New TestClientWholeReplayForeignIDsAskedWithoutThem fails on the
  unmodified base with the 400 reaching the client, passes with this
  commit (2 upstream calls: the refusal, then the replay without ids);
  TestClientWholeSingleIDedItemStaysAsItCame holds the single-item line.
- The existing prev family stays green, the two boundary tests included.
- Ablation: the three hunks reverted (ask hang, prevClientWhole gate,
  prevElsewhere's client-whole treatment), tests kept, the replay test
  red again; restored, green.
- internal/gateway whole package green; gofmt/vet clean.

Fixes #6320

Generated-by: GLM-5.3-Flash (ZCode)

Landed by the maintainer after (mote, darwin/arm64):
- this change's file(s) reverted with its tests kept: its new tests red;
  restored, green
- full suite (go test -tags nogui ./... -timeout 45m) with the stack on
  0b8c4bfc3: every package ok but two reds of that base, fixed on main
  since (4c86b0ab4 cli route parity, e9fcc6229 tui "permission mode")
- rebased on f1c9014cd: go test of internal/gateway, internal/plugin,
  internal/cli and internal/tui ok; go vet darwin, linux nogui, windows ok
2026-11-15 06:40:19 +08:00
yetone 72d3692e5f codex relay: a browser extension's call while magpie is quit is told to open magpie
jipairamen on X (v0.1.4212): a Chrome translation extension pointed at
magpie's gateway address got, for every request,
  403 "magpie's Codex relay serves Codex on this computer only".

Cause: that answer is not the gateway's. When magpie quits with Codex
running, it leaves `magpie codex-relay` at the gateway's port for the
Codex threads still open (codexrelay, 4534561f6). The relay judged who
asks before what is asked: any request with an Origin was refused with
the line above, so an extension's /v1/chat/completions never reached the
"magpie isn't running ... Open magpie" answer (relayGone) that every
other non-Codex call gets, and the doc already promised. The message
read as a permission rule, not as "magpie is closed".

Now a path other than /backend-api/codex/* gets relayGone (503) from any
caller, Origin or not; it passes nothing on, so who asks doesn't matter.
On Codex's own path a page, an extension, a null frame or a rebound name
is still refused (403), with a message that says magpie isn't running
and to open it. No origin rule changed: the relay still forwards only
loopback, Origin-less Codex requests, and the running gateway's
corsGuard is untouched (an unlisted chrome-extension:// origin was
already served keyless there by design; a listed one needs a key).

Siblings: the relay's LeavePath answers only the next magpie (token);
its "forbidden" there is not seen by users. No other handler holds the
gateway's port while magpie is quit.

Tests: TestCodexRelayTellsExtensionToOpenMagpie (chrome-extension://,
moz-extension://, https page, null; four paths; with and without a
key: 503 relayGone, nothing sent to OpenAI) and
TestCodexRelayOnlyThisComputer (now with an extension origin and the
"Open magpie" text). With the old codex_relay.go both FAIL:
  --- FAIL: TestCodexRelayOnlyThisComputer
  --- FAIL: TestCodexRelayTellsExtensionToOpenMagpie
and pass with the change.

Real use: built magpie (nogui) on mote, ran `magpie codex-relay --addr
127.0.0.1:34871 --pids <sleep>` under a sandbox HOME and curled it as
the extension: POST /v1/chat/completions with Origin
chrome-extension://... -> 503 "magpie isn't running: ... Open magpie for
everything else."; POST /backend-api/codex/responses with that Origin
-> 403 with the new text.

Run on mote at a9c98d8de (base b754cb095): gofmt -l (nothing), go vet
./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
go build, GOOS=linux go build -tags nogui, GOOS=windows go build: all
rc 0; go test -tags nogui -timeout 45m ./...: 101 packages ok, no FAIL
(internal/gateway 1081s).
After rebasing onto dcb0f3dcd (gateway, provider and app.js changed
upstream), at e27f946cf: go vet ./..., GOOS=linux and GOOS=windows go vet,
go build rc 0; go test -tags nogui -timeout 45m ./internal/gateway
./internal/provider ./internal/gui ./internal/codexrelay: all ok
(gateway 1086s, provider 335s, gui 296s).
Rebased onto f1c9014cd (agent/wsl, gateway fallback, masking, provider;
none of this change's files) before the push; at abaa78247 only go
build, go vet of gateway and codexrelay, and their TestCodexRelay*,
TestLeave*, TestEnds* were run: ok. The full suite was not rerun there.

Not tried: the user's own extension in Chrome; magpie's Settings page
doesn't change.
2026-11-15 06:27:36 +08:00
yetone f1c9014cd9 wsl, masking: a hung WSL or a slow local model no longer holds requests
vsoullai on X (0.1.4190, Windows): the gateway froze. Each request waited
15s in turn on the local masking model, routing was held 30s and got a
504, and a stopped WSL distro's probe dragged everything down until
redactModel and WSL were turned off. #6167 (Codex held 30s then 504,
fixed by restarting WSL) and #4856 (masking timeouts, 504s) are the same.

WSL (internal/agent/wsl.go, wsl_links.go):
- wsl's lock was held through wsl.exe and through the stat of
  \\wsl.localhost\<distro>, which can't be cancelled. The GUI's look held
  it, and every request's Codex/Claude stand-in, wslUp, distroAt and
  Copilot's WSL folders queued behind it.
- A look (wslRefresh) now runs wsl.exe, the probes and the stat outside
  the lock. Looks take turns on wslRefreshMu, and the lock only guards
  reads and writes.
- wslRoot's stat is bounded (wslRootWait 5s); a distro whose / can't be
  opened fails its probe and is tried again later.
- What a request asks never waits on a look. "Which distros run" is
  asked single-flight in the background and waited for at most
  wslRunningWait (2s). A distro wsl.exe hasn't named as running counts
  as stopped, so nothing opens or wakes a distro on a guess.
- Copilot's WSL sign-in (internal/provider/copilot_cli.go) is read the
  same way: single-flight, waited for at most copilotWSLWait (2s), with
  the last answer kept. Before, its own mutex queued every request
  behind the first one's read.

Masking (internal/masking/masking.go):
- With redactModel on, each request waited up to strictWait (15s). In a
  burst the backlog grew and the requests waited one after another.
- Once a strict request runs out its wait with texts unread, the model
  is "behind". The next requests then wait only defaultWait (2s) until a
  request is read whole or a minute passes (behind, waitFor). The rules
  still mask everything the model hasn't read.

Docs: docs/subsystems/agent-wiring.md (WSL twins) and gateway-routing.md
(masking).

Run:
- New tests, on mote, -race -count=3: TestWSLHangHoldsNoRequest (wsl.exe
  --running, a distro's probe, the stat; each hang injected),
  TestWSLRootHangFailsProbe, TestCopilotWSLHangHoldsNoRequest and
  TestStrictModelBehindWaitsTheDefault, with the other WSL, Copilot WSL
  and masking tests. All ok.
- Broken by hand: the same tests on the old code (origin/main's files
  with only the new tests added). Each WSL hang case failed ("a Codex
  stand-in waited on a hung WSL past 2.2s", "the GUI's look didn't wait
  on the hung WSL"). The Copilot test failed ("13 requests waited on a
  hung WSL past 2.2s"). The masking test failed ("request 2 after the
  model fell behind waited 2.0s").
- Full suite on mica at f08597a58 (this change on b754cb095):
  `go test -timeout 45m ./...`, exit 0, 101 packages ok.
- Rebased on f03869520 (a gateway/provider change). At this head, on
  mica: go test -count=1 ./internal/agent ./internal/provider
  ./internal/masking ./internal/gateway all ok, go vet ./internal/... and
  GOOS=windows vet of those four ok, gofmt clean. The full suite ran at
  the base before it, not again at this head.
- Rebased again on c0cf352a8 (four commits: gateway, provider Codex
  hold, providers base URL, LESSONS). At this pushed head, on mica:
  go test -count=1 ./internal/provider ./internal/masking ok, the WSL and
  Copilot tests of internal/agent ok, go vet of agent, provider and
  gateway (darwin and GOOS=windows) ok.
- gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok.
- Windows (xiaomi-gpu, win-run), internal/agent, internal/provider and
  internal/masking. masking: ok. agent and provider: 52 reds, all in the
  53 that origin/main f03869520 has on the same box (#6068, #1827,
  #5068, #5344, #5950; this run's list is on #6068). None touch WSL,
  Copilot's WSL or masking.

Not tried: a real hung WSL. On xiaomi-gpu, wsl -l -q and -l --running
answered in ~55ms, and a terminated distro's \\wsl.localhost path failed
in 131ms, so the hang was injected in the tests, not reproduced live.

(vsoullai on X, #6167, #4856)
2026-11-15 06:20:15 +08:00
yetone c0cf352a8d gateway: a group member's reply that ends with nothing in it goes to the next member (#6712)
shawn8888's ai-studio (magpie-gemini-web 0.14.0, aistudio2api 0.3.8)
answered a streamed request with 200, a role chunk with "" content, then
finish_reason "stop" and 0 output tokens when Google's every
regeneration came back malformed_response. streamEvent read that Chat
finish chunk as content, so the hold let the stream through as an answer
and group/auto-gemini-4-hydrogen (routing order) never asked agy-cli or
google; the agent got no reply.

A reply's end in an event that says nothing itself is now eventEmptyEnd:
a Chat finish_reason other than length, error or a filter; Messages'
end_turn, stop_sequence or tool_use; a completed Responses reply; Gemini's
STOP. The hold fails the try with a 502 "empty reply: it ended with
nothing in it" only when nothing was said before it, reasoning included,
and only for a group member with another member after it and errors not
passed through (holdWriter.emptyFails). The group's existing empty-reply
branch then asks the next member and rests nobody. A reply held whole is
judged in the one parse settle already made (refusedReply is now
readWhole, which also says empty), so a passing reply is read no more
than before. The last member's empty reply, or a model asked alone, goes
to the agent as it came, so an empty answer can't loop.

Changed on purpose: a Claude member's empty end_turn inside a group with
members left now asks the next member; TestStreamEventRefusals' three
rows for an empty end now say eventEmptyEnd.

Not handled: a stream the hold already let through on its timer (a Gemini
client after 15s) before the empty end came. The plugin side is
BUKOWSKIREAL/magpie-gemini-web#61 (a 502 or error event, not 200 + stop).

Run, on mica:
- new tests red on 369ec0418's fallback.go/gateway.go (checked out over the
  new ones, the unit tables left out): TestEmptyStopFailsOverToTheNextMember
  (chat, messages, responses, gemini), TestEmptyWholeReplyFailsOverToTheNextMember,
  TestEmptyStopEndsAtTheLastMember, TestEmptyEndFromEachUpstreamFailsOver
  (Messages and Responses upstreams) all FAIL; TestReasonedThenStoppedStaysTheAnswer
  passes on both (a guard against reaching too far). All green on the new code.
- go test ./internal/gateway -count=1 (whole package): one red,
  TestStreamEventRefusals' three empty-end rows, updated here; then
  -run 'StreamEvent|Refusal|Empty|FinishReason|Overload|Overflow|ReadWhole|Reasoned|Responses' ok.
- go vet ./internal/gateway, GOOS=linux (nogui) and GOOS=windows vet ok; gofmt -l clean.
- The full go test ./... -timeout 45m runs after the push (ship-at-once);
  its result goes on #6712.
2026-11-15 06:09:25 +08:00
yetone 369ec0418c provider: a Codex account's hold ends at its window's reset, so Codex back on it shows the account, not "magpie" (davezfr on X)
davezfr on X: Codex signed in to their account 1 showed "magpie" as the
account in the Codex app's settings menu; signed in to account 2 it
showed account 2. It used to show account 1.

Cause. When the account Codex is signed in to is held (out of its
allowance, no credits: the app greys Send), magpie becomes Codex's
provider (codex.out, #540) without requires_openai_auth, and the app
reads no account and shows the provider's name. The sync decides that
from CodexUsedUpKnown, the readings kept in memory (loginUsageCache),
and those were taken as they were made, however old. Account 1 had run
out earlier; its reading said held. Codex signed back in to it after its
window's reset still read as held, so magpie took over and the app
showed "magpie". The reading kept on disk already ended such a hold at
the reset (lastQuotasT.reading); the in-memory one, and the kept reading
the background look gets while allowances are read only when asked,
never did. And the loop's fresh read ("room") told the sync nothing:
noteCodexUsedUp compared it with the loop's last answer, given for
account 2 (also room), not with what the sync had gone by.

Fix.
- holdEnded (quota_last.go) is the one rule: a hold that came with a
  window used up when read ends once that window has started again; a
  hold with no window used up stands till a fresh read. The disk reading
  uses it as before.
- loginUsageEntry.asOf applies it to readings from memory, as of when
  each was made: loginReading (LoginUsage, someLoginUsage, CodexUsedUp,
  the switch), loginReadingKnown (CodexUsedUpKnown, codexHeldKnown) and
  the Usage page's cards (withAccountReadings). A window whose reset had
  passed when it was read doesn't overrule the vendor's allowed false.
- noteCodexUsedUp(known, now) also tells the sync when the fresh read
  differs from what CodexUsedUpKnown said before it, in the loop and in
  codexReadNow.

Users already affected: on the first look after updating, the account's
reading has its hold ended at its reset, and the sync puts Codex back
beside its sign-in; the app shows the account again (after its app-server
restart, as the takeover's end already does). An account that really is
held still has magpie as Codex's provider till its reset: that is the
takeover itself, which the app shows as "magpie".

Tests (red on the old code, at origin/main 142994b21):
- TestCodexHoldEndsAtItsWindowsReset: a held reading from 3h ago whose
  5h window reset a minute ago. Old code: "CodexUsedUpKnown = true on a
  hold whose used-up window started again a minute ago". Also checks
  codexHeldKnown, CodexUsedUp with reads held back, a hold before its
  reset (held) and one with no window used up (held).
- TestCodexUsedUpToldWhenKnownChanges: with `|| known != now` taken out
  by hand it is red ("told 0 times, want 1").
- TestNoteCodexUsedUp takes the new signature, unchanged otherwise.

Run: full suite (go test -timeout 45m ./...) on mica at this change on
142994b21: every package ok but internal/gateway, whose reds were all
TempDir "no space left on device" (mica's disk filled mid-run; the
logged doneHold panic is #6690, recovered by net/http). After rebasing
on b754cb095, on mote: internal/provider ok, internal/agent ok,
internal/gateway ok but TestRefusalAfterShownThinkingGoesToTheNext/
chat_1301_to_responses (#5761, open; -count 10 alone ok). gofmt -l
clean, GOOS=linux go vet -tags nogui ./... ok, GOOS=windows go vet
./... ok. Old code: TestCodexHoldEndsAtItsWindowsReset red on
origin/main; TestCodexUsedUpToldWhenKnownChanges red with
'|| known != now' removed.

Not tried: a real ChatGPT account through a real reset with the Codex
app open; the reporter's account 1 may also simply be out now, which
the app shows as "magpie" till its reset, as before.
2026-11-15 06:06:25 +08:00
yetone f038695208 gateway: Smart and Use before expiry weigh a Remote magpie by its cards (#6708, zzh11223311 on X)
A group whose members are Remote magpies, each serving a Claude
subscription signed in there, had every member "not known" (used 0 in
the routing log): weighRouted read an allowance only for this magpie's
own accounts and keys. Smart and Use before expiry went by the tokens
sent lately and stickiness alone.

A Remote magpie is weighed now by the card of the provider serving the
model there (provider.RemoteAllowance): the longest provider path of the
model with a card ("claude" for claude/claude-sonnet-5-5), of several
accounts there the one with the most left for the inner model, as last
read from it (remoteCardCache, the Usage page's read). It never waits.
When the routing weighs the remote against another and its cards are
older than 30s, they are read again in the background, one read at a
time per remote; the remote answers from the cards it keeps and asks no
vendor. Per request this costs a map lookup and allowanceOf over a few
windows per remote candidate. A request to one Remote magpie alone sends
it nothing more.

A window's json leaves out Span, Model and Aside. Without them a "7 days
· Opus" window would count against Sonnet and a 5-hour window would read
as a week. So writeCards now sends each card's `routing`
(provider.ToldRouting), and the reader lays it back on the windows
(withRouting in keepRemoteCards). A card from a magpie too old to send it
stays not known, as before. Passed-on cards keep it, so a third magpie
weighs them too. keepRemoteCards also drops a background read begun
before ForgetRemoteCardsForTest (a generation), so a late read can't
land in the next test's cache.

Not changed: candidate.allowance (cap holds, Codex credits last) still
treats a Remote magpie as no account.

Tests:
- TestRemoteAllowance (provider): an old remote isn't weighed; a read
  with ask=false sends nothing; the first ask reads in the background;
  Sonnet reads the 51% week and ignores the Opus 95%; the five hours is
  a rate cap; the lowest-used account wins; a nested home/codex card
  works; a group id and an unknown provider are not known; the remote is
  asked once within 30s.
- TestRemoteMagpiesWeighedByTheirCards (gateway): two Remote magpies
  (51% renewing in 117h, 25% in 44h). Under pace and Smart, B goes first
  with used 51/25 and B's due at its week. This gateway's cards answer
  carries routing, and a third magpie reads mac-b's Sonnet as 25.

Broken by hand: with weighRouted's remote branch turned off and writeCards
sending plain cards, TestRemoteMagpiesWeighedByTheirCards is red (mac-a
first, used 0/0, no routing in the answer). Asking from every weighing,
a single candidate included, turned four remote tests red
(TestRemoteMagpieRetryGoesToTheSavedAddress and three others counted the
extra GET), so the background read is gated on there being another to
weigh against.

Run at 4c750124d (rebased on origin/main eee217712), on mote: gofmt -l
internal clean; GOOS=linux and GOOS=windows go vet -tags nogui ./...
ok; go vet ./... ok; go test -timeout 45m ./... ok in all 101
packages, no FAIL. Rebased after onto b754cb095 (text size: app.js,
settings), which touches none of these files.

Not tried: a real pair of Remote magpies with real Claude accounts.
2026-11-15 05:45:09 +08:00
yetone ab08a9e7c1 plugins: an add from the dist branch drops a leftover too (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS (Windows) still couldn't install GoAnyAPI from Plugins
after v0.1.4205's leftover fix:

  bun add @magpie-community/tools-goanyapi@latest: exit status 1: ...
  error: GET https://registry.npmjs.org/@magpie-community%2ftools-goanyapi - 404
  (and from the community repo's dist branch: bun add
  ./dist/magpie-community-tools-goanyapi-0.1.1.tgz: exit status 1:
  Unexpected: failed copying files from cache to destination for package
  agency-agents
  installed @magpie-community/tools-goanyapi@./dist/...-0.1.1.tgz
  Failed to install 2 packages)

GoAnyAPI isn't on npm (its first version waits for an owner's publish,
as 77 other community packages do), so the add goes to the dist branch.
ec97a4d7b's drop-and-retry ran only after the npm add, whose 404 names no
broken package; installDist's bun add had none. And the dist error was
wrapped with %v, so othersFailed read only the npm try's output and
failed an add whose own package had gone in ("installed ..."). The
"Unexpected:" wording was already matched by bunFailed.

Fix:
- bunAdd does the drop-and-retry itself (dropBroken, then once more), so
  every bun add has it: npm's and the dist tarball's (which keeps the
  package's name, its spec being a path).
- The dist error wraps both tries (%w), and failedOf reads every
  bunRunError in the tree, so othersFailed sees what Bun said from dist.
- depsState.undo loses its gone list: a dropped dependency isn't in
  package.json when undo reads it, so the list never changed anything.
- Fake bun: MAGPIE_FAKE_BUN_NPM404 (Bun 1.4.4's 404, nothing written),
  ./dist/*.tgz adds, MAGPIE_FAKE_BUN_BUSY_SAYS (the reporter's literal
  Bun output).
- docs/subsystems/provider-plugins.md says so.

Tests: TestLeftoverDoesNotFailADistAdd, TestAnotherPluginsFailureDoes
NotFailADistAdd (reporter's bytes), TestBunFailed (+ the literal output,
LF and CRLF).

Run:
- Both new tests red on origin/main's store.go/leftover.go/dist.go
  (the reporter's error, word for word), green with the fix (mote).
- mica-run at this tree: go vet ./internal/plugin/...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go build ./..., GOOS=linux go build -tags nogui, GOOS=windows go build:
  ok; go test ./internal/plugin/...: ok (150s).
- win-run go test ./internal/plugin/: only TestPiPackage red (fixture
  spawns `sh`), the same alone at origin/main 6256d9956; filed in #4115.
- mote-run go test -tags nogui -timeout 45m ./... at this tree (base
  6256d9956): 100 packages ok, internal/gateway red on
  TestKeyLimitReservationsStayInTheirWindow account/* only, red alone at
  6256d9956 too: filed #6706.
- gofmt -l: nothing.

Not tried: a real Windows bun with a held agency-agents copy (the
reporter's machine state); npm side needs an owner (no NPM_TOKEN secret,
trusted publishing can't create a package).
2026-11-15 04:36:29 +08:00
yetone 6256d9956a gateway keys: a limit can follow a subscription account's own window (ljayic on X)
A key's limit gains the period "account": it names one subscription
account ("<provider>/<user>") and one of its windows (5h, Weekly, Monthly,
...), and starts and resets when that account's window does, at the reset
time in the account's last good reading (quotas.json), never asked of the
vendor on the request's path (provider.AccountWindow).

When the window can't be read (no reading yet, no such window, or its reset
has passed with no reading since), the limit is "reset unknown": it is
neither reset nor lifted. It counts from the latest time the window can't
have begun before (the reset that passed, else when the limit was set), so
it counts at least the window's calls; a refused call gets Retry-After 300
and a 429 saying the window can't be read now, and the accounts are read
again in the background at most once a minute.

GUI: Gateway keys -> a key's limit -> Window -> "An account's window", then
an app-menu picker of the accounts' windows as read (GET
/api/caller-keys/account-windows); the row reads "$x / $y · 5h of
codex/...", and an unknown reset reads "resets with the account's window".
CLI: magpie gateway-key limit <id> account --account codex/me@example.com
--window 5h --tokens 2m. i18n zh, zh-TW, ja, de. reference.md and
gateway-routing.md say it, with the fallback.

Run (at this tree, base ec8125e68, rebased onto 1ac137e10 which touches
none of these files):
- gofmt -l clean; go vet darwin, linux (-tags nogui), windows clean (mica).
- go test -count=1: internal/access, internal/budget, internal/provider,
  internal/cli, internal/gui ok (mica). TestEveryRouteHasACommandOrIsNamed
  was red until the new route was named (magpie quota).
- New: TestAccountWindowLimit (budget), TestAccountWindowFromLastReading and
  TestReadAccountWindowsOnceAMinute (provider), TestParseAccountWindowLimit
  (cli), TestCallerKeyAccountWindowsRoute (gui). Broken by hand: the unknown
  branch made to guess a 5h window from now -> TestAccountWindowLimit red
  ("let through on a window not read").
- GUI: gateway-key-account-window.test.cjs, chromium + webkit, en zh zh-TW
  ja de, 500px, no native select: 10 of 10 (red without the keys.js and
  i18n change). Every GUI file that loads the caller-keys fixture or the
  Gateway keys page, plus i18n*: 1064 tests, 1046 pass, 18 red, the same
  18 red on origin/main ec8125e68 alone: api-key-theme (6, #6444),
  gateway-key-arrange 420px (10, #6268), text-size webkit (a subtest and its test, #6561).
Not tried: a real Codex/Claude account's window through a live gateway;
the full GUI suite (mote and mica each had a full suite running).
2026-11-15 03:50:46 +08:00
yetone 1ac137e100 update: a version found is downloaded at once, not when Update is clicked
canlee886 on X (11-13, again 11-15): with downloads automatic, magpie
showed a new version and downloaded it only after a click on Update.
0.1.4051 made a click go into the copy downloaded and waiting, but the
clock's check (byClock) also kept that copy, so every version out after
it waited for the click: the pill said Update while the newest had never
been fetched. A failed download likewise waited, as a pill to click, for
the next 6-hour check, and a "found" version stayed found when downloads
were turned back on.

Every check that finds a newer version now downloads it with downloads
automatic: the clock's (5 s after start, then UpdateEvery), Check now,
the Version row's refresh and a page asking for notes in another
language (relang now starts the clock's check when the feed names a
newer version). A newer one replaces the one waiting. Only a restart's
check and the update dialog's (keep: recheck, freshen), a restart
waiting for the gateway to go idle (waiting) and downloads on a click
leave it, so a click on Update still restarts at once.

One download at a time stays (begin refuses a check meanwhile); such a
check now sets again (supersede), and the feed is asked again once the
download is in, so a newer version found then takes its place. The
minute loop fetches what was left (fetchDue): "found" once downloads are
automatic, and a failed download (error with retry) after 30 minutes.
docs/subsystems/gui-shell.md has the rule (When an update downloads).

Tests: TestUpdateClockLeavesWaitingDownload, which held the old rule, is
now TestUpdateClockFetchesNewerThanWaiting; new TestUpdateFetchDue,
TestUpdateCheckDuringDownloadTakesNewer (one download in flight at most)
and TestUpdateWaitingRestartKeepsItsDownload.

Broken by hand: putting u.byClock back in the keep-staged condition
turns TestUpdateClockFetchesNewerThanWaiting red (0.1.12 out, still
0.1.11, 1 download); supersede as a no-op turns
TestUpdateCheckDuringDownloadTakesNewer red (never took 0.1.12);
fetchDue false for found turns TestUpdateFetchDue red; dropping
u.waiting turns TestUpdateWaitingRestartKeepsItsDownload red (0.1.12, 2
downloads).

Run at this tree on
ec8125e68, on mote: go test -count=1 -run 'Update|Restart|Fresh|Download|Notes|
Recheck|Relang|Wait' ./internal/gui/ ok. On mica (mote's load was 24.5
over its 18 cores): go vet ./internal/gui/
./internal/update/, GOOS=linux go vet -tags nogui ./internal/gui/,
GOOS=windows go vet ./internal/gui/ ok; gofmt -l clean;
go test -count=1 -timeout 45m ./... (mica): 101 packages ok, no FAIL
(gateway 945s, agent 296s, gui 187s).

Not tried: a real app updating across two published releases; no GUI
file changed, so no GUI run.
2026-11-15 03:45:30 +08:00
yetone ec8125e680 agent: Kimi Code's thinking level is picked in Agents
@apple_test_src on X: every other agent has a reasoning-effort pick,
Kimi Code didn't. Kimi Code 2.x keeps its startup level in
config.toml's [thinking] table (read from @moonshot-ai/kimi-code 2.6.2's
source: ThinkingConfigSchema, persistModelSelection,
thinkingEffortFromConfig). The new "thinking" field writes it the way
Kimi's own /model does: off = enabled=false (effort kept), a level =
enabled=true + effort, Default removes both keys (and the table when
empty). Options come from the chosen model's support_efforts /
default_effort / capabilities, overrides first; "off" is left out for
an always_thinking model; unknown model or unreadable file gives
off/low/medium/high. A cold WSL place reads nothing (#3896). The legacy
Python kimi-cli gets on/off through its top-level default_thinking.

Run:
- Real Kimi Code 2.6.2 on mote, sandbox HOME and
  KIMI_CODE_HOME, fake chat server, config written by this field's Set:
  Default sent thinking {enabled, effort medium (model default)}, off
  sent {type: disabled}, low and max sent those efforts.
- mica-run at bba704222 (rebased on fdf42299e): go vet ./internal/agent native,
  GOOS=linux, GOOS=windows ok; go test -count=1 ./internal/agent
  ./internal/gui ok; gofmt clean.
- mica-run GUI: kimi-thinking (new), agy-effort, i18n-keys and the
  agent-field / codex-default-effort / effort files, Chromium + WebKit,
  en/zh/zh-TW/ja/de: 114/114 pass.
- Broken by hand: dropping override handling and leaving enabled behind
  on Default turned TestKimiThinkingField red. The first version opened a
  stopped distro's config and TestWSLColdPlaceOpensNothing went red; fixed.

Not run: the full go test ./... (mote and mica both had other sessions'
suites running), the legacy kimi-cli binary (its source only), a real
Moonshot account.
2026-11-15 03:12:36 +08:00
yetone ec97a4d7bb plugins: a dependency no plugin needs no longer fails another's install
CHENGJIAHEGOXIS on X (v0.1.4178, Windows) couldn't install GoAnyAPI from
Plugins: "agency-agents" failed with 从缓存复制到目标目录失败, and it was
on no plugin's row, so nothing could remove it.

Cause: every bun add/update/remove installs every dependency in
plugins/package.json again, and a failed `bun add` writes its package
there before exiting 1. agency-agents (a repository with no
package.json) was left by such an add; on Windows a file of its copy in
node_modules is held open, Bun fails "EBUSY: failed copying files from
cache to destination for package agency-agents", and so every later
install failed over a package nothing used.

Fix (internal/plugin/leftover.go, store.go):
- A package Bun says it couldn't install that no plugin is installed as
  (on the list, on or off, an add in flight, pi's agent) is taken out of
  package.json and node_modules and the command runs again: install()
  and runBun, so add, update, check and remove all get it.
- A failed install puts back the dependencies and bun.lock it found.
- An add whose own package went in while another listed plugin's
  failed succeeds; that plugin keeps its dependency.
- Remove and add's clean-ups drop the dependency by hand when
  bun remove fails.
- What is left from before is listed under Installed as "Not used by
  any plugin", each with a Remove (/api/plugins leftovers,
  POST /api/plugins/leftover; pmLeftovers in plugininstalled.js,
  imported when Plugins first draws), in every language.
- plugins.json there and unreadable: nothing is a leftover.
- Core script budget +51 for the one call left in plugins.js (reason in
  core_budget_test.go).

Run:
- mote-run: go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. go test ./internal/plugin (169s) and
  ./internal/provider (148s): ok.
- mica-run go test -count=1 ./internal/gui with the leftovers drawing
  moved into plugininstalled.js: ok (133s); main since touches none of
  internal/gui's core scripts, internal/plugin or plugins.go.
- win-run go test -run 'Leftover|FailedAdd|AnotherPlugin|RemoveTakes|
  BunFailed' ./internal/plugin on xiaomi-gpu: ok.
- Reproduced the EBUSY with Bun 1.4.2 on xiaomi-gpu (a file in
  node_modules/agency-agents held open, then bun add another package).
- Red on the old store.go: TestLeftoverDoesNotFailAnotherAdd,
  TestFailedAddLeavesNoDependency, TestAnotherPluginsFailureDoesNotFailAdd,
  TestRemoveTakesDependencyOutWhenBunFails.
- GUI: plugin-leftover.test.cjs 42/42 (chromium + webkit, en zh zh-TW
  ja de, 980/420px, with and without a plugin); old plugins.js: 21/21
  chromium red.
- mote-run, rebased on fdf42299e: plugin-leftover + i18n-keys 46/46;
  every other plugin*.test.cjs, old-webkit and i18n-en-no-cjk: 255 ok,
  reds only in old-webkit (#6030, #5919), plugin-move-unserved (#4392),
  plugin-option-placement (#6559) and plugin-page-foreign-error
  (#6117), each red the same on a clean origin/main fdf42299e checkout.

Not run: the full go test ./... and the whole GUI suite (mote over
its cores, mica running another session's full suite; one per machine); a real Windows
install through the magpie app.
2026-11-15 03:07:38 +08:00
yetone 93762f968a usage: small, idle clients fold into one Other row
WJaunita45604 on X: test runs leave dozens of randomly named clients of
~10K tokens each in the Usage page's Agents list, and the page crawls.
renderUsage draws every Agents row again at each refresh whose summary
changed, at ~0.1ms of DOM and layout a row: with 400 clients a redraw
took 30-54ms in Chromium and 45-66ms in WebKit, with 2000 136-178ms and
224-246ms (probe at 1200px, Bun/SiYuan/translate-web and N clients).

A client not hidden folds when it is past the 5 with the most tokens,
under 1% of the period's tokens, and either made no call in the last 3
days (the agent group's new `last`) or is past the top 20; two or more
fold, or none do. No setting. Other sits at the list's foot with the
folded groups' sums (usageSum), so totals stay exact, and opens with a
click, Enter or Space; open, it draws the folded rows with their own
actions 100 at a time (Show {n} more). Closed they aren't drawn at all:
with 400 or 2000 clients a redraw now fits one frame (~13-20ms in both
engines), as with none.

Run at 442964d70 + this change, on mote (then rebased clean onto
9afec644c, which touches sync/library/update only; go test -run
'Budget|Size|I18n|Css' ./internal/gui ./internal/usage ok there):
gofmt -l clean; go vet ./internal/usage ./internal/usageapi
./internal/gui on darwin, linux (-tags nogui) and windows: ok;
go test ./internal/usage (58s), ./internal/usageapi, ./internal/gui
(137s): ok.
GUI, both engines: usage-*, i18n-*, mobile-web, own-requests and
ledger-cache-unknown files: 1740 tests, 1663 pass, 77 fail. The reds:
usage-agents-hide #6003/#3414, mobile-web #3952, usage-cards-hide
#6294, usage-range-times #6499, usage-hidden-way-back #6295,
usage-fold #3415, usage-speed-all-models #5834 fail the same way at
base 442964d70 (those 7 files there: 152 pass, 70 fail, the same
usage-agents-hide error "536.7 -> 586.98"); usage-ledger's "newest
live route needs no return-to-live button" is #5048/#6003 (the
Requests tab, which this doesn't touch); usage-chart-dates (chromium)
timed out launching the browser (180s) under load.
The new usage-agents-other.test.cjs: 33/33 (chromium + webkit, en zh
zh-TW ja de, three widths).
Perf probe at 1200px, one redraw: 400 clients 30–54ms (Chromium) and
45–66ms (WebKit) before, 2000 clients 136–178ms and 224–246ms; after,
both fit one frame (~13–20ms), the same as no clients.
Broken by hand: USAGE_FOLD_TOP=0 turns the rule test red; dropping the
100-row cap turns the page test red ("151 !== 100").
Not run: the full GUI suite (mote and mica were both running other
sessions' suites).
2026-11-15 02:51:18 +08:00
yetone 9afec644cc sync: Claude Code's own plugins go with the library (AXmake110 on X)
GitHub sync and backups carried the skills a Claude plugin brought into
magpie's library, but not the plugins installed in Claude Code itself
through its /plugin marketplaces, so a second computer had none of them.

The library bundle now carries ClaudePlugins: each marketplace's source
(from plugins/known_marketplaces.json and settings.json's
extraKnownMarketplaces, only `source` and `autoUpdate` kept) and the
plugin ids enabledPlugins has on, under CLAUDE_CONFIG_DIR when set.
installLocation, installPath and plugins/{marketplaces,cache} stay, as
Claude Code fetches them again. A marketplace from a local folder or
file, or with a user/token in a URL or request headers, is not carried,
and neither are its plugins. claude-plugins-official itself is not
carried (Claude Code adds it), its plugins are.

On the other computer they are added to settings.json's
extraKnownMarketplaces and enabledPlugins, which Claude Code installs
from at its next interactive start: tried with Claude Code 2.1.319 in a
sandbox CLAUDE_CONFIG_DIR, commit-commands@claude-code-plugins was
cloned and installed from those two settings alone. settings.json is
patched in place (comments and other keys kept), written to a temp file
and renamed in, and the old file is kept with the backups. Claude Code's
own known_marketplaces.json and installed_plugins.json are never
written. Only adding: a marketplace known here under that name, and a
plugin with any value here (false too), stay as they are. An unreadable
settings.json is neither carried as "none" nor written over. A computer
with no such plugins carries nil, so its library hash is as before. The
davsync library part counts it as the user's (not unset, #5642), and the
preview lists each marketplace and plugin.

Run (mote):
- go test -tags nogui ./... -timeout 45m -count=1 at 5d12d65dc (on
  origin/main 442964d70): ok, 101 packages, no FAIL
- rebased on becc1ef15 (bili path change in internal/library), then at
  this head: go test ./internal/library ./internal/davsync
  ./internal/backup . -count=1: ok
- go vet ./internal/library ./internal/davsync ./internal/backup, and
  GOOS=linux / GOOS=windows go vet of library and davsync: ok
- gofmt -l: clean
Broken by hand: carriedClaudePlugins and putClaudePlugins returning nil,
the unset clause and the preview branch removed: TestClaudePluginsCollected,
TestClaudePluginsPut, TestClaudePluginsInLibraryPart and
TestClaudePluginsInPreview red. A first version added x@evil for a
carried marketplace that wasn't portable; TestClaudePluginsPut caught it.
The first full run was red only on TestNoEagerPackageRegexps (a
package-level regexp); now lazyre.New.

Not tried: a real two-computer GitHub sync with a real marketplace;
`claude -p` and `claude plugin list` do not install declared plugins,
only an interactive start does. Not yet: a plugin removed or turned off
on one computer is not removed on the others (add-only). GUI sync labels
unchanged (the preview shows each item by name), so no GUI run.
2026-11-15 02:46:01 +08:00
yetone 07dfd0bb8f update: a magpie stuck in its exit on Windows no longer holds the restarted one (BESTLJP0412 on X)
BESTLJP0412 on X (Windows 11 26200, 0.1.4179 to 0.1.4193, WebView2 157):
after an update's restart the window stayed "Not Responding", and a
process with a single thread sat on port 3425 and the WebView2 profile.

A Go process has several threads while it runs; one left means it is in
ExitProcess (os.Exit on Windows), which ends every other thread and then
runs each loaded DLL's detach on the last one. A detach that waits for a
thread already ended (WebView2's, COM's) never returns, so the old magpie
never ends, its handles stay open, and the new one waited its 60s
(awaitGone), went on beside it, and hung on the held port and profile.

Both ends fixed:
- the old one: cli.Main ends through endProcess, on Windows
  TerminateProcess on itself instead of ExitProcess. Everything magpie
  writes is written by then; the kernel closes every handle and no
  detach runs.
- the new one: awaitGone's wait for the old magpie (awaitExit) looks at
  its thread count every 250ms; one thread for a second is a magpie stuck
  in its exit, and it is ended (opened with PROCESS_TERMINATE). This is
  what fixes the update from 0.1.4193 and older, which still exit through
  ExitProcess.

docs/subsystems/gui-shell.md says how a Windows restart waits and ends.

Tests (Windows, real processes; the stuck detach is a fiber-local storage
callback set to kernel32's Sleep with INFINITE, which ExitProcess runs on
its last thread and TerminateProcess doesn't):
- cli TestEndProcessSkipsAStuckDetach: first checks the stand-in is real
  (os.Exit there hangs with exactly 1 thread left), then that
  endProcess(3) ends with code 3. Broken by hand (TerminateProcess taken
  out): red, "endProcess hung in a DLL's detach, as os.Exit does".
- update TestAwaitGoneEndsAMagpieStuckInItsExit: a predecessor stuck that
  way is ended in ~1.4s. Broken by hand (the thread check skipped): red,
  "the start went on after 20.022s with the old magpie still stuck".

Run:
- win-run on xiaomi-gpu (Windows 11): go test ./internal/cli ok (179s);
  ./internal/update all ok but TestPackagedByDpkg, red the same on
  origin/main 442964d70 (#4603, a ':' file name on NTFS).
- mote: gofmt; go vet, GOOS=windows go vet, GOOS=linux -tags nogui go vet
  of internal/cli and internal/update ok.
- mica: full go test ./... -timeout 45m started at this tree; still running
  at push (ship-at-once rule), result to follow on the issue thread if red.

Not tried: a real update restart of the app on Windows with a stuck
WebView2 detach (the hang can't be brought on at will there); the fix is
checked with the FLS stand-in above.
2026-11-15 02:31:56 +08:00
yetone 6f264030af gateway: OpenRouter's agentic-harness 403 rests nothing, and a test says why
Wade111999 on X tested OpenRouter's thinkingmachines/inkling-2-small:free
in magpie and got "403 · … is only available on agentic harnesses".
OpenRouter serves that free endpoint only to agent apps it lists at
openrouter.ai/apps, judged by the app a request is attributed to (its
HTTP-Referer; the 403's routing step is "Gate Free Endpoints by Agentic
Harness"). Its docs and other clients' real-key reports (Skales #325,
OpenTrading #204) say attribution headers of an unlisted app don't pass
it, and the paid thinkingmachines/inkling-2-small has no gate. A model
test is magpie's own request, so it is refused; magpie never names an
app it isn't.

Two things magpie did wrong with it:
- restAfterMarked read the 403 as the key's: it rested the whole
  OpenRouter key (Key "openrouter", by backoff), so one agent request for
  the gated model set every other OpenRouter model aside. It now rests
  nothing and counts no failure, as a region refusal; a group's next
  member is still asked (retryable). A key's own 403 still rests the key.
- the test showed a bare 403. APIError now puts HarnessOnlyHint after
  OpenRouter's words: served only to listed agent apps, a magpie test
  isn't one, the model without :free is served to any request.

Not changed: magpie passes the agent's User-Agent to OpenRouter as
before, but agents send OpenRouter's attribution headers (HTTP-Referer,
X-OpenRouter-Title) only to openrouter.ai itself, so whether OpenRouter
serves an agent's request through magpie is not known.

Run (mica, mote over its load):
- TestHarnessOnlyTestSaysWhy, TestOpenRouterHarnessOnlyRestsNothing:
  red on origin/main's routing.go and test.go (the key rested
  {Key:openrouter By:backoff}; the error had no hint), green after.
- go test -timeout 45m -count=1 ./internal/provider ./internal/gateway:
  ok internal/provider 170.7s, ok internal/gateway 1012.0s (mica, at e513cba54 + this diff)
  Rebased on 51eb1ae4b (main's gemini audio change in both packages): go vet
  of both packages, and the two tests above with -run Gemini|Audio, ok
  on mica at the pushed head.
- go vet, GOOS=linux and GOOS=windows go vet of both packages, gofmt -l:
  clean.
Not tried: a real OpenRouter request; every OpenRouter key on this
machine, mote and mica answers 401 "User not found".
2026-11-15 01:32:07 +08:00
yetone 04ca2afab2 netproxy: Auto reads a Linux desktop's proxy, GNOME's and KDE's (#4147)
On Linux, Auto read no system proxy at all (system_other.go answered
none), so with Clash Verge's system proxy on, magpie opened from the
desktop's menu, with no *_PROXY, went direct and Settings said "No
system proxy found". The user had to type the proxy into magpie and
take it out again when they turned the proxy off.

system_linux.go reads the desktop's own setting, where its apps and
Clash Verge (sysproxy-rs) put it:
- GNOME (and Cinnamon, MATE, Budgie): `gsettings list-recursively
  org.gnome.system.proxy`, mode 'manual' only; HTTPS over HTTP over
  SOCKS, ignore-hosts as the bypass list.
- KDE: ~/.config/kioslaverc (XDG_CONFIG_HOME), ProxyType=1 only, its
  "http://127.0.0.1 7897" address form, NoProxyFor unless reversed.
  Read first on a KDE session, else after GNOME's.
No gsettings, or no GNOME proxy schema, is none; a gsettings that fails
otherwise is a failed read, which keeps the last good one as on macOS.
PAC ('auto', ProxyType=2/3) is not read, as on macOS and Windows.

Codex's view is unchanged on Linux: its reqwest reads no desktop
setting there, so codexProxyFor takes no system proxy unless on macOS
or Windows (codexSystem), with test cases that fail without it.

Not a timezone or language guess (the X ask from jimlee0824v2): it is
wrong for anyone travelling, on a VPN or a TUN, and the system's proxy
is what says whether one is on.

Run:
- red on the old code: TestSystemReadsGnome, TestSystemReadsKDE and
  TestSystemWithoutDesktopProxy (3 of 3); the two Linux cases of
  TestCodexProxyFor with the old codex_proxy.go.
- real gsettings on Ubuntu 24.04 (WSL magpie-desktop) under
  dbus-run-session with a temp XDG_CONFIG_HOME set to manual
  127.0.0.1:7897: system() gave http://127.0.0.1:7897, bypass
  [localhost 127.0.0.0/8 ::1]. The distro's own setting not touched.
- mica-run: go test ./internal/netproxy ./internal/agent ok; go vet of
  both for darwin, GOOS=linux and GOOS=windows ok.
- wsl-run: go test -run 'Proxy|Gsettings|Kioslaverc|TestSystem|Codex'
  ./internal/netproxy ./internal/agent ok.
- win-run: go test ./internal/netproxy ok.
- gofmt -l clean.
Not tried: a real KDE session (fixture from sysproxy-rs' format), the
GUI on a Linux desktop.
2026-11-15 01:18:58 +08:00
yetone 1edebf0500 tray: a card with more than two windows shows them all, in columns of two (jen_celeus on X) 2026-11-15 01:11:08 +08:00
yetone e513cba54a search: the ChatGPT backend's image search gives as many images as asked (LBM_OASIG on X)
web_search's count had no effect on an image search: one image came
back whatever was asked. magpie did send image_settings.max_results,
and the backend answered with twelve images, but it puts each rule of
80 dashes straight after the page's last word ("...beauty.----...\n"),
and codexPages cut only at "\n"+rule, so the twelve were read as one
page. codexBlocks cuts at 80 dashes ending a line with no dash before
them. Page searches gain too: a real search_query reply had 33 pages,
3 of them glued to the one before (30 blocks old, 33 new).

Run: real Plus account (~/.codex token, read-only), /alpha/search with
image_query "golden gate bridge" and max_results 5: 12 images, rules
glued; reply kept as testdata/codex-image-search.json.
TestImageSearchGivesTheCount (counts 1, 5, 12 from the real bytes) is
red on the old split by hand (count 1 gave one page holding all twelve),
green now; TestCodexBlocksKeepLongDashLines. On mica (mote over its
cores): go test -run 'ImageSearch|CodexBlocks|CodexPages|ImageResults|
SearchScope|CodexSearch|AlphaSearch|Searcher' ./internal/gateway ok;
gofmt -l clean. The whole internal/gateway package was still running on
mica when this was pushed (owner: ship at once).
Not tried: through a running sandbox magpie end to end; GUI untouched.
2026-11-15 01:08:19 +08:00
yetone 677034e1a2 gateway: a held request's report says where the request itself stood
wilsonxuuuu on X (0.1.4178, Codex to cloud/auto/gpt-6.1-sol, a remote
magpie's auto group): requests held 30s "in no wait magpie knows of"
and stopped with 504 all day. The report he pasted was cut before its
goroutine dump, so nothing said which step held the request.

watchUnrouted now keeps the handler's goroutine id (about 10us a request
at a 40-frame stack). On give-up, heldOwn finds that goroutine in a dump
of every goroutine and strips the argument words and pc offsets. The
report then puts "stood at: <first of magpie's own functions> (<what it
waited in>)" next to the known waits. It also puts the request's own
stack under "where this request stood", ahead of every goroutine's. The
log line says it as "standing at".

Not found: the block itself. A fake remote that hangs or answers
slowly, 49 cloud/ requests in flight, and 400 Codex requests with 200KB
bodies against concurrent settings and provider writes all routed. The
local magpie asks the remote nothing before routing a cloud/ model. The
next report will name the step.

Run:
- TestHeldReportSaysWhereItStood (a fake slow remote magpie, Codex
  /backend-api/codex/responses for cloud/auto/gpt-6.1-sol, a lock that
  routing needs held) is red on the old code: `stood at: ""`.
- TestHeldOfFindsItsGoroutine checks that heldOf finds the goroutine by
  its id and strips the values.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui and
  GOOS=windows ./... ok (mote).
- Full suite `go test -count=1 -timeout 45m ./...` on mote at 7c405dac7
  (this change on cd030691a): internal/gateway ok (1023s); every
  package ok except two reds already on main, outside this change:
  - TestNoEagerPackageRegexps: chatpage.go, #6689.
  - TestEveryRouteHasACommandOrIsNamed: providers/delete, fixed in
    4c86b0ab4, which this commit is now rebased onto.
2026-11-15 00:57:39 +08:00
yetone 91d27452b7 library: slash commands, written into each agent's own command folder
miantiao_me on X asked for custom slash commands (prompt templates) kept
once in the Library and given to agents as skills are. Library → Slash
commands keeps a name, a description and a prompt where $ARGUMENTS is
every word typed after /name and $1, $2… the first, second… word. Each
ticked agent gets its own command file, in its own folder and shape
(internal/library/commands.go, from each agent's docs and source):

- Claude Code: <claude dir>/commands/<name>.md; $n becomes $ARGUMENTS[n-1]
  (Claude counts from 0), a literal $0 is escaped.
- OpenCode: <config>/commands/<name>.md, as written.
- Pi: <agent dir>/prompts/<name>.md, as written.
- Gemini CLI: ~/.gemini/commands/<name>.toml, $ARGUMENTS is {{args}}.
- Qwen Code: <qwen home>/commands/<name>.md, {{args}}.
- Factory Droid: ~/.factory/commands/<name>.md, $ARGUMENTS.
- Gemini, Qwen and Droid have no $1…: a command using them is not written
  for those agents, and the row and editor say so.
- Codex is listed greyed: it reads ~/.codex/prompts no more, its skills
  took their place. WSL agents get none yet.

What magpie wrote is recorded per file with its hash (Applied.Commands),
through syncOwnFiles, now shared with subagents: a file the user changed,
or one by that name magpie didn't write, is never overwritten or removed;
one equal to magpie's bytes is adopted. Commands travel with backups and
WebDAV sync (Bundle.Commands; an older bundle keeps this computer's).
docs/subsystems/library.md has the row.

Run (mote was over its load, so mica, then mote at the end):
- At 4119054bb on origin/main 90efddaba: gofmt -l clean; GOOS=linux and
  GOOS=windows go vet -tags nogui ./... ok; go test -timeout 45m ./...
  every package ok but internal/cli's TestEveryRouteHasACommandOrIsNamed
  (POST /api/providers/delete, from 90efddaba, #6677).
- GUI at 5783bf8cb (on 49f49c41c): the 276 files this can reach (every
  library, i18n and sidebar-icon file, new library-commands included),
  both engines, 420 and 1100, en/zh/zh-TW/ja/de: 5218 of 5340 pass. The 15
  red files were run again at 49f49c41c itself and are red the same
  there, test for test.
- At this head (rebased on 217e933dd, which touches only core i18n.js of
  these files): internal/library, gui, davsync ok, cli red as above;
  the 81 library, i18n and nav-sub-icons GUI files pass but library-env
  (#6675).
- Final head (rebased on cd030691a): go test ./internal/library ok; GUI
  library-commands, -plugins, -hooks, -subagents, -groups and i18n-keys,
  both engines: 68 of 68 pass.
- Broken by hand: Claude's $n mapping left as written turns
  TestCommandsWordsByPlace red; the sidebar section missing turned
  library-groups red (my bug, fixed here).
- Real, sandbox HOME: Claude Code 2.1.316 `claude -p "/magpietry alpha
  beta"` expanded first=[alpha] second=[beta]; OpenCode 2.0.25 listed it
  (GET /api/command) and its session command expanded the same. Gemini
  got the $n problem and no file.

Red on origin/main too, not this change: found-skill-pick-remove (#5013),
library-env (#6675), skill-group-shared (#6687), old-webkit (#6030,
#5919), the /api/update/using posts (#6133, #6667, #6668), library-new-skill
(#6539), mobile-web (#5013), phone-no-sideways (#5869), view-no-sideways
(#6669), and skill-where, text-size, usage-ledger and
usage-speed-all-models, each with an open issue. Left alone: a Claude plugin's
commands becoming library commands (#6672).

Not tried: pi, Qwen Code and Droid binaries (their files checked by tests
only), Codex (greyed), a real run on Windows or Linux.
2026-11-15 00:48:52 +08:00
yetone cd030691a3 gateway: the chat page's turn is held to its key's MaxConcurrency (#6688)
6bdeedc6f added the /deepseek-chat routes without judging them for a
gateway key's MaxConcurrency or the LazyCat manifest, so
TestKeySlotEveryRoute and TestLazyCatManifestListsTheClientRoutes were red
on main. The first was a real gap. The page's turn asks a model through
the Messages route's handler, called in process (chatInner), past
keySlots. A key capped at one slot could therefore run a chat page turn
beside an agent's request, with nothing waiting.

- keySlotRoutes: the page's messages route is lazy, so its rounds' tries
  take the key's slot (chatInner's clone keeps the hold in its context),
  and asr and tts are eager. The file upload and delete routes are free
  (keySlotFree): they are kept in magpie and never sent to a model.
- docs/reference.md's LazyCat manifest makes /deepseek-chat public, as it
  does the key page (/me), for a key's holder who isn't signed in to the
  box. The page's static files are keyless already; every call it makes
  still needs a gateway key.

gofmt realigned keySlotRoutes for the longer key.

Run: go test -tags nogui -count=1 -timeout 45m ./internal/gateway on
mica: ok (1005s). The new TestKeyConcurrencyChatPage is red with the
messages entry taken out of keySlotRoutes ("timed out waiting for the
chat page's turn waits for the key's slot"), broken by hand on mica.
2026-11-15 00:38:06 +08:00
yetone da29171a4e library: a plugin hook that reads CLAUDE_PLUGIN_ROOT itself gets the folder
@AXmake110 on X: with the Claude Code plugin ponytail installed for an
agent, every start of the agent printed a red error. ponytail's hooks
read the folder in Node, not through the shell:

  node -e "require(require('path').join(process.env.CLAUDE_PLUGIN_ROOT.split(String.fromCharCode(92)).join('/'), 'hooks/ponytail-activate.js'))"

magpie replaced only ${CLAUDE_PLUGIN_ROOT} and $CLAUDE_PLUGIN_ROOT, so
the command went into Claude Code's settings.json (and, for the
UserPromptSubmit hook, Codex's hooks.json) as written. Outside Claude
Code's plugin runtime nothing sets the variable, and Node threw
"Cannot read properties of undefined (reading 'split')".

Fixed for the class (plugin_env.go):
- a hook program's own read of CLAUDE_PLUGIN_ROOT or CLAUDE_PLUGIN_DATA
  becomes a quoted string literal of the folder, with forward slashes:
  process.env.X, process.env['X'], Bun.env, Deno.env.get, Python's
  os.environ[...]/.get/os.getenv, Ruby's ENV[...]/ENV.fetch. The quote
  is chosen so it doesn't end the sh quoting around it. PowerShell's
  $env:X / ${env:X} and cmd's %X% become the folder.
- a plugin's command MCP server gets both variables in its env, as
  Claude Code gives them, unless the plugin set them.
- ${CLAUDE_PLUGIN_ROOT}/DATA in a subagent's prompt and in a copied
  SKILL.md are resolved, as Claude Code resolves them in Markdown.
- every agent gets the same text: the parts are library items, so
  Claude Code, Codex, Gemini, Cursor and Grok are all written from them.
- existing installs: load() heals the hooks, servers and subagent
  prompts of an installed plugin that still name the variables, and the
  next sync (the app's startup sync) writes them out again; the old
  entry is replaced, not duplicated. A SKILL.md copied before is fixed
  by the plugin's Update or a reinstall.

Not carried yet, filed as #6682: exec-form hooks (command + args, whose
args are dropped today) and CLAUDE_PLUGIN_OPTION_<KEY>.

The fixture is ponytail's published hooks files, byte for byte
(DietrichGebert/ponytail 96608e07, testdata/ponytail/README.md).

Run (mote; full suite at 901b56c80 on origin/main 221c91fae, then
rebased on 411769e9c and internal/library + internal/tui run again: ok):
- go test ./internal/library -run TestPlugin: ok.
- New tests: TestPluginHookReadsRootFromItsProgram (installs ponytail for
  Claude and Codex, then runs the SessionStart command under sh with
  node and no CLAUDE_PLUGIN_ROOT), TestPluginHookWrittenBeforeIsResolved
  (old library.json + settings.json, then Sync), TestPluginEnvRefsEachSpelling,
  TestPluginPartsGetItsFolders.
- Broken by hand: with the hook rewrite and the heal off, the first two
  go red and node prints the reporter's TypeError; with only the heal
  off, TestPluginHookWrittenBeforeIsResolved alone goes red; with the
  server env, prompt and skill changes off, TestPluginPartsGetItsFolders
  goes red (the written .claude/agents/helper.md too).
- Real use in a sandbox HOME: installed the real ponytail 5.3.3 from
  github.com/DietrichGebert/ponytail for Claude Code and Codex; the
  three hooks landed with the folder as a literal, and each ran under
  sh with node and printed ponytail's context, no error.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean.
- Windows (xiaomi-gpu): go test ./internal/library -run TestPlugin ok
  (the node run is skipped there).
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...): 98
  packages ok; every red is already on main and none is in the library:
  TestNoEagerPackageRegexps (chatpage.go, #6689), cli's
  TestEveryRouteHasACommandOrIsNamed (#6677), gateway's
  TestKeySlotEveryRoute and TestLazyCatManifestListsTheClientRoutes
  (#6688), and a doneHold panic in a gateway test helper (#6690). The
  tui red (TestEveryWordHasZh) is fixed in the next commit.

Not tried: a real Claude Code or Codex session starting with the hooks
(the commands were run as they run them, with sh -c); a hook run
  on Windows.
2026-11-15 00:28:51 +08:00
yetone 411769e9c7 library: GitHub Copilot gets the Library's instructions with VS Code or JetBrains alone
@codealc on X (0.1.3827, Windows, Codex with Copilot as the provider):
资源库 › 指令 has no way to give GitHub Copilot instructions. The only
Copilot row was Copilot CLI's, listed only when the CLI was detected
(settings.json or the copilot command) and not uninstalled, so a user of
Copilot in VS Code or JetBrains saw none.

Which file Copilot reads, from each surface's own source:
- Copilot CLI 1.0.95: $COPILOT_HOME/copilot-instructions.md, else
  ~/.copilot/copilot-instructions.md (run for real, below).
- VS Code (microsoft/vscode d95071e96, promptsServiceImpl /
  computeAutomaticInstructions): ~/.copilot/copilot-instructions.md, plus
  ~/.copilot/instructions/**/*.instructions.md; its docs' reference table
  gives the same for the Copilot harness's user scope.
- GitHub Copilot for JetBrains 1.21.0 (javap of the plugin's classes):
  getCopilotCliHomePath() (COPILOT_HOME, else ~/.copilot) +
  copilot-instructions.md.

So Copilot CLI's agent now has shared "GitHub Copilot" (as Cursor CLI's
~/.cursor is the Cursor editor's) and a sharedApp check: VS Code, VS Code
Insiders, or the JetBrains plugin is here. agent.SharedRead says so;
SharedHere is true with it even before ~/.copilot exists, and
targetsAsleep keeps a CLIMissing agent whose folder such an app still
reads. The Library's row is named GitHub Copilot; the agent stays Copilot
CLI on the Agents page. SharedName also names Copilot CLI's chats in
Sessions, which are now "GitHub Copilot" as Cursor CLI's are "Cursor".
The user's own text in copilot-instructions.md stays outside magpie's
block, and comes back whole when magpie's instructions are emptied.

Tests (internal/library/copilot_shared_test.go): row named GitHub
Copilot; VS Code alone (no ~/.copilot) gets the row and the file written
without making Copilot CLI detected; JetBrains plugin alone; the user's
own file kept; CLI uninstalled with VS Code still here keeps the row,
with nothing reading it drops it; COPILOT_HOME followed.
TestCursorIsCursorCLI and TestCursorFolderFromTheEditorIsNotTheCLI now
allow Copilot beside Cursor.

Run:
- The six new tests on the old code (source files checked out from
  aa358555f, new test kept): all six red. Broken by hand: the
  targetsAsleep `&& !a.SharedRead()` taken out turns
  TestCopilotCLIGoneVSCodeKeepsTheRow red.
- go test ./internal/library -run Copilot on win-run (Windows 11) and
  wsl-run (Ubuntu 24.04): ok.
- Real Copilot CLI 1.0.95 with COPILOT_HOME at a scratch folder (signed-in
  config copied there, cwd an empty folder), copilot-instructions.md
  holding a user section and magpie's block with a codeword: copilot -p
  answered the codeword; without the file it answered NONE.
- gofmt -l internal: nothing. go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... (mica): ok.
- Full go test -timeout 45m ./... on mote at f32bdee76 (rebased on
  0b8c4bfc3): 99 ok, red only TestEveryRouteHasACommandOrIsNamed
  (#6677, POST /api/providers/delete) and TestEveryWordHasZh (#6686, "permission
  mode"), both red alone on a fresh origin/main 221c91fae.
- Rebased on 221c91fae (6 commits, none in internal/library or the
  agent files here): library, agent, cli, tui and gui packages again at
  6946baa72: library, agent, gui ok; cli and tui red only on #6677 and #6686.
- Rebased on a4dd893af (5 commits in gui/admin, gateway, docs; none in
  library or agent): library, agent and gui again at the pushed head: ok.

Not changed: no GUI file; the row's name comes from the server.
Not tried: VS Code and JetBrains reading the file for real (read from
their source only).
2026-11-15 00:23:13 +08:00
yetone 3ffac60480 docs: the management API's routing groups and the app's switch for it (#6307)
docs/reference.md's Management API lists the routing-groups routes
(list, get, create, update and the Routing page's actions), says they are
checked as the app checks them and that found/skip are not served, names
the key menu's Advanced switch beside `magpie gateway-key admin`, and
drops "this first part leaves out Routing Groups": what is left out on
purpose is the export of sign-ins, which would hand out every account's
secrets. docs/subsystems/gateway-routing.md says how the routes reach
/api/groups (adminGroupActions, adminGroupWrite over provider.SaveGroup)
and names the tests. The site's remote page says the same in en, zh and
ja, and public/llms-full.txt is built again from it (node llms-full.mjs,
on mica).

Run: site's worker.test.mjs (llms-full current) in the full run before
the push; no code changes here.

Run for the three #6307 commits (mica, at 4eafd9963 on 90efddaba's
successor, then the touched tests again after rebasing onto 221c91fae):
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. Builds (darwin, linux nogui, windows): ok.
- site worker.test.mjs: 41/41 (llms-full.txt current).
- go test -tags nogui -count=1 -timeout 45m ./...: every package ok but
  two, both red on origin/main and filed: internal/cli
  TestEveryRouteHasACommandOrIsNamed (POST /api/providers/delete, #6677)
  and internal/tui TestEveryWordHasZh ("permission mode", #6686).
- At 221c91fae + these: go test -run 'Admin|Group' ./internal/gui ok;
  gateway-card, gateway-key-admin, gateway-chat-page in both engines
  62/62; i18n-keys, i18n-en-no-cjk 8/8.
2026-11-15 00:16:11 +08:00
yetone 221c91fae3 gui: the gateway card opens the chat page
The gateway card gets a "Chat page" button beside Restart gateway while
the gateway runs. It opens <gateway>/deepseek-chat/ in the browser, or,
in web mode, the public URL's chat page. Both buttons sit in one
.gw-acts group, so a narrow card wraps them together, and Restart keeps
its .gw-fix class (the takeover, pause and port-holder tests read the
first .gw-fix). The label is translated in zh, zh-TW, ja and de.

Run: gateway-chat-page.test.cjs in Chromium and WebKit, every language,
at 1100 and 420 wide, on mica: ok. It is red without this change (no
button). At 058119705 + this change, on mica, every gateway-*.test.cjs,
i18n-keys and i18n-en-no-cjk in both engines: 328 of 343 pass in
Chromium. The reds are gateway-card's "7 !== 6" (#6029) and
gateway-key-arrange at 420px (#6268), and in WebKit gateway-pause's
"click moved the row" in one language (#6684). All of them are red the
same on an origin/main 3f09b9ffc copy. go test ./internal/gui (budgets): ok.
Go vet (darwin, GOOS=linux -tags nogui, GOOS=windows) and gofmt: clean.
2026-11-14 23:56:19 +08:00
yetone 6bdeedc6fb gateway: serve DeepSeek's chat page with magpie's models
@yanghonghang asked on X for DeepSeek's open-source web chat page
(deepseek-ai/chat-demo) to run on magpie, with its search and link
reading served by magpie's own. magpie now serves it at
<gateway>/deepseek-chat/, with no setup:

- The page is the v0.1.1 release (MIT, LICENSE kept in the zip),
  embedded and served from memory. Its API origin is rewritten to
  location.origin+"/deepseek-chat", and magpie.js adds a model picker:
  any magpie model answers, sent as the magpie_chat_model cookie.
- On this computer the page needs no key of the user's. Another
  computer types a gateway key, as for every other route.
- POST anthropic/v1/messages maps deepseek_web_search to magpie's
  web_search_20250305 and deepseek_read_url to a read_url tool magpie
  runs itself with fetchPage between rounds. Each round goes through the
  gateway's own Messages route, so routing, keys, limits and usage are
  the same as an agent's.
- Files (images, PDFs, text) are kept in memory until a restart; Word,
  PowerPoint and EPUB are refused with 415. ASR and TTS go to the speech
  models set in magpie.
- Only the page's GET/HEAD static files are keyless (readOnlyRoutes and
  lanGuard's chatPageOpen), served under a strict CSP. Its models, chat,
  files and speech routes need a key from another computer, and a
  read-only key is refused on each (readOnlyRefused).

Docs: docs/subsystems/gateway-routing.md, "DeepSeek's chat page".

Real use: a sandbox magpie (sandbox HOME, port 3486 on mote) served the
page in Chromium; a Claude answer with web search showed citations and
source chips, a DeepSeek link read answered from the page, and the
picker was checked in light and dark.

Run: go test -tags nogui -run 'TestChatPage|TestReadOnlyKeyEveryRoute'
./internal/gateway on mica, ok. Without this change every TestChatPage*
is red (the routes 404), and TestReadOnlyKeyEveryRoute is red with the
chat routes missing from readOnlyRefused.
2026-11-14 23:50:45 +08:00
yetone 47684ef176 usage: a table column is what its windows are of, not their names
normalcoder_ on X: in Usage > Overview's table, Antigravity's
"Gemini · 5 hours / 7 days" landed in the last ("Other") column, since
columns were keyed by window name. That holds for every provider whose
names don't match the column keys.

columnOf keys a pooled window to its pool's column (poolWord, "Claude &
GPT" under Claude) and names the window in the cell; any other window
goes by its span (spanOf: "Weekly", "7 days" and "7d" share a column,
headed by the name most rows use, a number on a tie); a window with no
span goes by its name.

Run (mote, chromium + webkit, en zh zh-TW ja de, 1100 and 420px):
usage-account-subcards.test.cjs 40/40 here, 40/40 red on origin/main
0b8c4bfc3. It covers the previous commit's sub-cards as well. The usage
GUI reds are those named in the previous commit, the same on main.

Not run: the whole GUI suite before the push.
2026-11-14 23:49:02 +08:00
yetone 2a6ab83d8a usage: each account of a provider's card is a card of its own; the ⋯ keeps its room
normalcoder_ on X (v0.1.4079, Usage > Overview): accounts inside a provider
card were told apart by a hairline only, and the card's ⋯ was drawn over
the end of the head ("Show the other accounts in brief" was hidden).

- renderQuotas puts each account of a card with several into a
  .subscription-acct box (a provider's keys, a balance a line, stay
  lines); quotaCardMenu looks through the box for the account's head.
- The head keeps 18px for the ⋯ whether it shows or not; where nothing
  hovers, the ⋯ is always shown.
- Core budgets +57 (app.js) / +81 (core): renderQuotas draws every card,
  so there is no page to move it to.

Run (mote, both engines):
- usage-card-menu-room.test.cjs: 20/20 here; red 20/20 on origin/main
  0b8c4bfc3. usage-account-subcards.test.cjs (next commit) guards the
  sub-cards; red on origin/main too.
- go test ./internal/gui -run Budget: ok.
- ~110 usage/quota/i18n GUI files: every red is the same on origin/main
  0b8c4bfc3 and filed: usage-agents-hide (#3414), usage-cards-hide de 560
  (#6294), usage-fold webkit (#6003, #3415), usage-hidden-way-back (#6295),
  usage-ledger Requests (#5048), usage-range-times (#6499),
  usage-speed-all-models (#5834).
- usage-fold "most on one screen" is red on main (#4790, 12 chromium of
  15 wanted); with the boxes it is 11, one account fewer.

Not run: the whole GUI suite before the push; the real Linux app.
2026-11-14 23:49:01 +08:00
yetone cfd70c60c2 update: the old pill quiet ran through 0.1.4181, not 0.1.4179
Comments and docs only: v0.1.4180 and v0.1.4181 were tagged before 3f09b9ffc landed, so they still hold the pill for 3 days. No code changed; nothing run beyond gofmt -l (clean).
2026-11-14 23:48:04 +08:00
yetone 3f09b9ffc6 update: the header's Update pill shows a waiting update at once; only its x holds it, for 3 days (visamzh, normalcoder_ on X)
visamzh (0.1.4174, 0.1.4176 downloaded, Update button and Automatic
updates on) and normalcoder_ (0.1.4079) saw no Update pill for about two
days. Cause: 36eebea13 (v0.1.3879, 11-12) set /api/update's quiet until
this version had been behind for update.Quiet (3 days), counted from the
first newer version seen and kept per running version. With a release
every few minutes, every update starts that clock over, so on any version
a user updates within 3 days the pill never lit, whether a download was
waiting (ready) or one was found with downloads off (found), on every OS.
The Version row and the tray's Restart to update still offered it.

Now being behind holds nothing: ready, found and available light the
pill at once. Only the pill's x (or right-click) holds it, for
update.Quiet across the releases out meanwhile (Behind.Hushed), which
keeps 36eebea13's answer to "always lit" (the x used to hold only until
the next release, minutes later). An urgent release still lights it
through that. The old notes' "since" is never read as a dismissal.
Settings > Update button says "Hidden for 3 days" whenever the x holds
(it said "Hidden for <v> until a newer version is out" only while that
exact version was latest), and Show again lifts the hold
(update.Unhush, an empty update-skip). The x's label and toast say
3 days instead of "until the next version" (en, zh, zh-TW, ja, de).

Users on 0.1.3879 to 0.1.4179 get it with their next update: Settings >
About > Restart to update, the tray's Restart to update, or quitting.
0.1.4079 still checks, downloads and verifies the newest release: its
updater code (LatestEvery + Stage, sandbox HOME on mica) fetched
0.1.4178, passed download, verify (SHA256SUMS signature, attestation)
and unpack, and stopped only at the Team ID check because the probe
binary is unsigned.

Run (mica/mote, macOS, Go 1.26.8), at this tree:
- go test -count=1 ./internal/update ./internal/gui: ok, before and
  after the rebase onto 0b8c4bfc3 (also i18n-keys, i18n-en-no-cjk, update-quiet, update-hide there: 118/118). go vet darwin, GOOS=linux -tags
  nogui, GOOS=windows: clean. gofmt -l clean.
- Broken by hand (old semantics: first-seen sets the clock, Lit needs it
  past Quiet): TestPillLightsWhenANewerVersionIsOut,
  TestDismissalHoldsForTheQuiet and TestUpdateQuietUntilBehindAWhile
  (ready, found, available: quiet true, want false) red.
- GUI, Chromium + WebKit: update-quiet.test.cjs (en, zh, zh-TW, ja, de;
  panel 420, narrow window 400, window 900; ready and found show the
  pill, quiet hides it and Settings says Hidden for 3 days with Show
  again) and update-hide.test.cjs pass; update-quiet red on the old
  app.js (Settings row). 52 GUI files touching Settings, updates, i18n
  and menus: 882/935; the reds (menu-scroll, settings-hints,
  settings-search, settings-lines-wrap, settings-groups warm-ups) are
  the same 50 at origin/main aa358555f run alone (54 pass / 50 fail
  both), filed as #1550, #5982, #6133, #6353, #6597. plugin-card-update
  webkit was red only under --test-concurrency=3 and passes alone.
Not run: the full go test ./... and the whole GUI suite (mote over its
load, mica running another session's GUI suite); not tried in the real
app with a real download waiting.
2026-11-14 23:47:47 +08:00