Commit Graph
8819 Commits
Author SHA1 Message Date
yetone 3eba174fd9 sessions: a restart no longer opens each Claude Code subagent's file again (shangyuan0818 on X)
Every list built each session's subagents, and ccTask and ccMeta keep what
they read in memory only. After a start, each of a few thousand subagent
files was opened for its first user line (or its meta file), under
Defender's per-open scan. The parse already read that file; its task and
meta now stay in its state (StateMore Task, TaskRead, SubMeta) and the
list uses them, falling back to ccTask/ccMeta when a parse has none. A
subagent's parse made before this (no TaskRead) is read again once
(ccStale), then not.

Windows (xiaomi-gpu, Defender on, sandbox HOME, Claude-only reads), fixture
of 12k files / 9.3 GB with 9k subagent files, three requests together:
- warm restart: 2.2 s -> 1.0 s
- restart after one session grew: 2.4 s -> 1.1 s
- restart after one new session: 2.3 s -> 1.1 s
- grow or new session while running: 0.55 s -> 0.4 s on the next list
- cold, no cache: 21 s -> 15.8 s (the subagent read is no longer done twice)
The plain 100-session fixture (6.6 GB) was 0.3 to 0.8 s warm before and
stays there: it has no subagent files to open, and I did not reproduce
"15 s after an agent used". The 5 s cold figure the reporter gives matches.

Run: go test ./internal/sessions at this head (mote), gofmt, go vet for
linux, windows and darwin. TestSubagentTaskAndMetaComeBackFromTheSavedParse
is red on the old code (the list read the subagent's file once with its meta
gone); TestSubagentParseWithoutItsTaskIsReadOnce guards the one-time reread.
Not tried: a real Claude Code subagent's meta.json on Windows (the fixture
has none, the meta path is covered by the test); the full suite and the GUI
files are run after the push. A task past a subagent's 16th line is now
found where ccTask gave none.
2026-11-20 03:53:58 +08:00
yetone 03ae057b8e library: a native list that is not a list draws the tab without it
6d153bffc (#7244) iterates /api/library/native's reply. A reply that is
not an array (a GUI test's catch-all {}, an older magpie behind a remote
window) threw in nativeSection, and the Skills, MCP and Hooks tabs drew
nothing. On origin/main 82611c3c9, skill-update-feedback, skill-where and
library-open-again were 38 of 38 red on mica; about 111 GUI test files
that touch the Library answer unknown /api paths with {}.

A reply that is not an array now lists no native rows. A failed read
still draws nothing, as before.

Run (mica, via mica-run, at this head): skill-update-feedback and
skill-where green in chromium and webkit (red at 82611c3c9).
library-open-again stays red with its old error, "the library was read
1 times, not 2", the same as at f534245f1 before #7244 (#6975).
go test -run Budget ./internal/gui ok. Not run: the whole GUI suite at
this head.
2026-11-20 03:04:12 +08:00
yetone 75d0b9feac gui: an icon button at work shows the spinner, not its glyph turning
wiirhan on X (tweet 2123287273043378671): "资源库--技能--更新技能的loading
状态为啥是直接转箭头?" A Library skill's Update turned its own up arrow
while the fetch ran (.lib-icon.busy svg { animation: lib-spin }), so the
busy state looked like a broken arrow, not like work.

glyphBusy (app.js) puts the spinner's arc, CLI_SPIN, the one saving() and
a CLI's update pill turn, in place of the button's glyph while it works,
and puts the glyph back when it is done or fails. The arc turns at .8s,
and under prefers-reduced-motion it stands still.

Siblings: an agent row's Apply again and Restart (.ag-fix) turned their
reapply arrow the same way, and now take glyphBusy too. Kept as they are:
the refresh arrows that re-read data (quota-refresh, usage-refresh,
rt-read, #sync, pu-again). Their glyph is a turning arrow, so turning it
says what it does, and the owner tuned them in #16.

TestCoreScriptBudget: app and core budgets +228. glyphBusy is packed to
its shortest form, and renderAgents and the Library rows draw it on every
window, so there is no page to move it to.

skill-update-feedback.test.cjs waited for the svg itself to animate. It
now waits for the arc's path, with the row's actions still in view.

Run (mote, via mote-run):
- busy-glyph-spinner.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  1100px and 420px (reduced motion at 420). Green 22/22. Red 22/22 on
  origin/main f534245f1's assets. Restart's glyphBusy broken by hand:
  chromium 11/11 red.
- go test ./internal/gui: ok at the rebased head (budget included).
- Whole GUI suite at 59e0421f4, beside other sessions' runs (load 20-60):
  29713 tests, 28689 pass, 1024 fail in 122 files. One red was this
  change's: skill-update-feedback, fixed above. The other 121 files were
  run again at head 0f0827c28: 118 still red (2300 tests, 1021 fail). The
  same 118 files at origin/main f534245f1: 2254 tests, 1017 fail, the same
  files red. Subtest counts differ by one or two in account-cap,
  context-cap, desktop-tiers, menu-input-scroll, rest-try-now and
  tray-cell-click, both ways; none touches an icon button.
  provider-base-as-typed was red once at head and passes when rerun.
  Filed already: #6975 (most of the 118), #6782, #7016, #7097, #7131,
  #7132, #7101, #7100, #7242, #7033, #7083, #7046, #6234.

Not tried: the real app (Wails/WebKitGTK). The change is an svg swap with
a transform animation the spinner already uses there.
2026-11-20 03:04:12 +08:00
yetone ddfc9b17d9 gui: Claude Code's max effort says /effort can't change it (daix91 on X)
@daix91 asked on X whether Claude Code's effort can no longer be changed.
Max is fixed in Claude Code's environment (CLAUDE_CODE_EFFORT_LEVEL=max,
the design since c1d38cc50), which outranks /effort, and nothing in
Details said so. The New sessions effort button's title, where 534b85bf9
put the per-tier lines, now ends with one line while Max is picked: "Max
is fixed in Claude Code's environment, so /effort can't change it. Pick
another level to get /effort back." Picking another level in the slider
drops it at once (renderEffortPicker), and picking Max puts it back. No
visible label is added. The env behaviour is unchanged. Translated in zh,
zh-TW, ja and de.

Test: internal/gui/tests/claude-effort-max.test.cjs covers Chromium and
WebKit, en/zh/zh-TW/ja/de, at 1100 and 560px (20 tests). It checks that
the title ends with the line once and that the line is not visible text,
that there is no sideways scroll, and that picking high drops it at once,
names high in the title and POSTs {agent:claude, field:effort,
value:high}. After a reload it checks the line is still gone, and that
picking Max brings it back.

Run:
- Red on old code: claude-effort-max against origin/main's assets failed
  20 of 20 (no line in the title). With the change, 20 of 20 pass on mica.
- Go, on mote at the pre-rebase head f85198750: gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
  go vet ./... and go build all ok; go test ./internal/gui ok (181s).
- Whole GUI suite on mica at f85198750 (chunked 100 files, concurrency
  3, load 40 to 70): 29,589 tests, 1,044 failures in 135 files.
  claude-effort-max and i18n-keys passed. The 135 files were rerun at
  head and at base 83bb079de: 123 red at head, 118 at base (#6975). The
  five head-only files were rerun alone. images-codex-one, models-fold,
  routing-groups-page and usage-focus-steady passed. desktop-tiers
  failed ("no tiers square"). Run alone six times at base 83bb079de it
  failed 0 to 2 of 4 each time, the same way, so it is #6475 (commented
  with the numbers). Not caused by this change.
- Targeted run on mica: tier-effort, claude-effort, panel-effort,
  claude-subagent-effort-row, wsl-claude-tiers, subagent-effort, gui-ja,
  gui-zh-tw, i18n-en-no-cjk, i18n-keys and claude-effort-max gave 111 of
  112 pass. The red is gui-ja's "ja has every zh string" ("Gets copies…
  {agents}"), #7144, red on main since 88b65d758.
- After rebasing on 82611c3c9 (app.js changed upstream), on mica:
  gofmt -l clean; go test -run Budget ./internal/gui ok (TestCoreScriptBudget
  included); claude-effort-max, i18n-keys, tier-effort, claude-effort,
  panel-effort and i18n-en-no-cjk 66 of 66 pass.

TestCoreScriptBudget has room at this base, so the budget is not raised.

Not tried: a real Claude Code session with Max picked. The env path
itself is unchanged.
2026-11-20 03:00:40 +08:00
yetone 82611c3c9e library: a project turns on a plugin Claude Code installed, in its own settings (#7254)
Plugins Claude Code has installed itself (installed_plugins.json) are listed
on a project's Claude plugins tab, each with one Claude chip. On writes
enabledPlugins.<id> = true into the project's .claude/settings.local.json
through the format-preserving JSON edit (comments and the user's keys stay);
off takes out only a key magpie wrote that is still true. A key the user
already had is neither written nor taken out; a file magpie made goes once
the skill offs, hooks and plugin keys sharing it are all gone. Worktrees
follow through syncTrees; RemoveProject lets go. Written fresh, not ported.

Run (mote-run): go vet library/gui/cli; go test ./internal/library -run
TestProjectClaudePlugin (new, two tests); project-claude-plugins,
project-plugins and i18n-keys GUI files in chromium and webkit, en and zh;
go test ./internal/gui reds only on testenv's docs-index guard
(routing-groups pages newer than the search index, not from this change).
Not tried: a real Claude Code reading the project's enabledPlugins; the
whole GUI suite; a CLI for it; "off" for a plugin the user turned on
user-wide.
2026-11-20 02:49:50 +08:00
yetone 834700c185 site: regenerate the docs index after the routing-groups pages changed
9ec023a46 edited docs/routing-groups.html and its ja and zh copies and left
site/public/llms-full.txt, search/*.json and docs-index.sums stale, so
testenv failed every Go package on main. Rewritten with `node
site/docs-index.mjs`.

Run (mote): go test ./internal/library ok (171s); node --test
site/search.test.mjs site/worker.test.mjs 47 pass, 0 fail. Not run: the
other Go packages, which read the same sums.
2026-11-20 02:42:19 +08:00
yetoneandArobotmaster ab342fa40d library: magpie library project server and subagent add, rm and agents (#7248)
The CLI had project skills and instructions only. `server` and
`subagent` now list, add (agents= or the agents already used, else every
agent here that reads a project's MCP file or subagents folder), take
out and re-point a project's library servers and subagents through
ProjectServer and ProjectSubagents, the calls the Library page makes.
A name the project doesn't have is refused, as is an unknown agent or
flag; a part magpie couldn't place exits 1 with why.

The command shape follows the reference commit in the reporter's fork
(0d3a6de55), rewritten over this tree's calls rather than ported.

Run: mote-run go test ./internal/cli -run TestLibraryProject (the new
TestLibraryProjectServerAndSubagentCmd: the user's own .mcp.json server
survives an add and an rm, Codex's file gets the server, Claude's and
Codex's subagent files come and go with their agents). gofmt and go vet
./internal/cli clean.
Not tried: the whole Go suite; the package run also prints testenv's
docs-index guard (routing-groups pages newer than the search index),
which is not about this change; a real agent reading the files.

Co-authored-by: Arobotmaster <50254754+Arobotmaster@users.noreply.github.com>
2026-11-20 02:40:53 +08:00
yetone 6d153bffca library: list the skills, MCP servers and hooks of plugins installed natively in Codex and Pi (#7244)
The Library now reads Codex's plugin cache (plugins/cache/<marketplace>/<plugin>/<version>,
manifests under .codex-plugin, .claude-plugin or .cursor-plugin; config.toml's
enabled flag) and Pi's packages (settings.json packages, package.json pi.skills,
user and project scope) and lists what they bring on the skills, MCP and hooks
tabs under "Installed in the agents themselves", with origin and scope.
Read-only: nothing is copied, linked or registered; the agent keeps loading it,
load status stays unknown. Paths stay inside the plugin; an unreadable file
means unknown. New GET /api/library/native (lazy, not on the polled
/api/library) and `magpie library native`. Docs row in library.md.

Run (mica, sandbox HOME, nothing of the live ~/.codex or ~/.pi touched):
- go vet darwin; internal/library native tests (6) and the new GUI test
  library-native.test.cjs in chromium and webkit, 5 languages, 980 and 380 px.
- Built binary against a sandbox copy of the real Codex cache manifests (74 files).
- Not tried: Claude native plugins, subagents, Pi MCP and hooks, a live Codex
  or Pi, Windows and WSL Pi. The whole GUI suite and the full Go suite run after the push.
- Not mine: every package using testenv is red on origin/main 9ec023a46 from the
  stale docs index (docs/routing-groups.html and its ja/zh copies; its author is
  regenerating it), so go test of internal/library and internal/gui fails there
  before and after this change. TestEveryRouteHasACommandOrIsNamed named the new
  route; settings_parity_test.go now maps it to `magpie library native`.
2026-11-20 02:34:58 +08:00
yetone 9ec023a46b routing: the default routing is called Quota first, not Smart (@canlee886)
The groups magpie finds on its own (auto/<model>) hold one model served by
several providers, and with no rules they follow their Routing, whose
default was labelled Smart / 智能. @canlee886 read that as "judges how hard
the task is and sends easy ones to a cheap model". It does not: the member
whose allowance renews soonest goes first, ties in list order, the next takes
over on a failure.

A cheap-model rule cannot be a built-in default for these groups: their
members are the same model, so there is no cheaper member to send an easy
request to. The mechanism for hard-to-strong, easy-to-cheap exists (the
"Hard to strong, easy to cheap" template and rules with an intent) but it
needs members of different strength, which the user picks. So the honest fix
is the label.

- The mode is "Quota first" (额度优先, 額度優先, 枠優先, Kontingent zuerst) in
  every picker, chip, tooltip and hint, in all five languages (the English
  key text and each translation).
- The no-rules line now says it does not judge how hard a task is.
- docs/reference.md, gateway-routing.md and the routing-groups site pages
  (en, zh, ja) name it the same. The stored value ("") is unchanged, so no
  saved group or provider changes behaviour and nothing needs migrating.

Run (mica, node --test, chromium and webkit, five languages): 19 GUI files
(routing-rule-example, routing-save, routing-group-strategy, routing-manual,
routing-weight-chip, rotate-figure, account-weight, routing-key-windows,
routing-free-expiring, builtins, i18n-keys, i18n-en-no-cjk and the routing
Smart-text files): 440 of 446 pass. The 6 reds (account-arrange 1 and 2,
key-weight 17 to 20) fail identically on origin/main 87a933e50, filed
separately. The tests assert the new label and hint; run against the old
assets they fail on the old text. Not run: the full Go suite and the full GUI
suite (run after the tag); not tried in the Linux WebKitGTK app.
2026-11-20 01:56:08 +08:00
yetone 87a933e500 memory learning reads WorkBuddy, WorkBuddy AI and CodeBuddy Code conversations (@bxgz233 on X)
"Learn from conversations" (memdistill) reads a session only when the
Sessions list marks it Transcript, which is HasTranscript(agent). The
WorkBuddy family had a summary reader (workbuddyLine) for the Sessions
page and the usage ledger but no transcript reader, so its sessions were
listed and never learned from.

Add wbTranscript (transcript_workbuddy.go), over the same
projects/<cwd>/<id>.jsonl lines: a message's input_text/output_text
blocks (WorkBuddy's own <system-reminder> blocks stay context and its
@scene: blocks are dropped, so the typed words still count as said), a
function_call with its arguments, and its function_call_result by callId.
workbuddy, workbuddy-ai and codebuddy join HasTranscript.

Guard: TestEveryListedAgentHasATranscriptOrIsNamed reads the agent ids
Session.Agent lists and fails for any with no transcript that is not in
noTranscriptYet, and for any in that list that now has one. Siblings still
without a transcript, named there: zcode, dsh, cline, grok, droid, hermes,
alma (issues filed).

Run (mote): go vet ./internal/sessions ./internal/memdistill; go test
./internal/sessions ./internal/memdistill ./internal/memory ./internal/gui.
The new tests fail on the old transcript.go (workbuddy, workbuddy-ai and
codebuddy named, codebuddy not marked readable). internal/gui has one red
that is also red on origin/main 99cc8fa5d, TestSettingsSaveKeepsWhatItDoesNotSend
(RedactModelDir), filed. No GUI file changed. Fixtures are the existing
testdata/workbuddy and testdata/codebuddy session files. Not tried: a real
WorkBuddy account's session through the model.
2026-11-20 01:51:40 +08:00
yetone 99cc8fa5d5 gui: a failed endpoint test's error can be selected and copied (imwritingbugs on X)
The provider editor's endpoint Test result (.res.bad) was ellipsized under
body's user-select: none, so a vendor's error could not be picked up to hand
to an agent. The selectable :where() list in app.css now takes the error and
warning classes (.bad, .warn, .warnbox, *-warn, *-bad, *-fail, .res,
.bal-res), so those texts select; controls keep none. A failed endpoint row
and a failed Detect APIs row get the small copyBtn other values have; a
passing row has none, and a new Test clears the old button.

Run (mote): provider-error-copy.test.cjs, 16 of 16 green in chromium and
webkit, en/zh/ja/de, 1000 and 420 px; 16 of 16 red with app.js and app.css
at the merge-base. go test ./internal/gui ok; gofmt -l clean;
GOOS=linux go vet -tags nogui and GOOS=windows go vet of internal/gui ok.
GUI files the change reaches (provider*, i18n*, model-test*, *select*,
*copy*, balance*): 70 fail, and the same 10 files fail with the same counts
with app.js and app.css at the merge-base (group-editor-selected 2,
model-copy-id 4, provider-fetch-again 14, provider-many-keys 6,
provider-max-output 20, provider-models-rest 4, provider-picks-stay 4,
provider-proxy 4, provider-remove 4, provider-typed 4), so they are on main
already; filed separately.
Not run: the whole GUI suite and the full Go suite (both Macs were busy with
other sessions' full suites). Not tried: the reporter's screenshot was never
seen; the endpoint Test result is the likeliest error they meant. Siblings
are covered through the class list, not each page.
2026-11-20 01:23:51 +08:00
yetone f534245f1c routing: a group with no rules says how it routes (@canlee886 on X)
The editor said nothing of what a group does with no rules. Without rules
the group goes by its Routing (Smart unless set): the member whose
allowance renews soonest first, ties in the listed order, the next taking
over when one fails. One line under Rules now says so (and names the
routing when another is set); with one model or Manual the existing line
stays. Added in zh, zh-TW, ja, de. Layout unchanged.

Run on mote at the change: routing-rule-example (extended: the line in
every language, Smart and In order, gone once a rule is added; Chromium
and WebKit, 1100 and 390 wide), routing-advanced, routing-rule-ops/
remove/drag/columns/models/effort, routing-entry, routing-intent-entry,
group-editor-fits/align, group-template, i18n-keys: all pass.
Not run: the whole GUI suite, Go (no Go changed), the real app.
2026-11-20 00:27:35 +08:00
yetone 228da69efd claudetui: a dialog is recognised by its option rows, not by its words in the history (@alisenray on X)
A resumed conversation that discussed "Bypass Permissions mode" made every
--resume fail at 45s ("asked to accept running in Bypass Permissions mode,
not answered") with the prompt box showing: ready() took the words anywhere
in the restored history for the dialog.

The trust and Bypass Permissions dialogs are now recognised by structure
(optionDialog): the heading, then the No row and the Yes row, with only the
dialog's footer under them. The Claude in Chrome offer, the text-style
screen, sign-in and the two first-run screens must have their words at the
foot of the screen (headingDialog, lastMatchNear), not far up in history.
The "doing" text of a late run uses the same rules.

Run: TestShimIgnoresDialogWordsInHistory (history with the phrase, option
rows, and every other dialog's words above the prompt) is red on the old
tui.go (0 of 3 lines in 30s, "asks whether to trust the folder") and green
now. mica-run go test ./internal/claudetui ok (191s), go vet and
GOOS=windows go vet clean, gofmt -l clean. A first version matched the
heading by its last occurrence and broke the trust dialog (its Yes row
holds "trust this folder"); the existing trust and bypass tests caught it.

Not run: the full suite (queued after the push), a real Claude Code
--resume. The heading-only screens (Chrome, text style, sign-in) are bounded
by distance from the foot, not by option rows, so a history that ends
within 1500 characters of those words with no prompt box could still match;
not seen in the report.
2026-11-20 00:27:07 +08:00
yetone b17d9e3fca routing: with motion reduced, the magpie fades in and out at the dot instead of being gone (iryan_sun on X)
iryan_sun on X: the Routing page's magpie animation between agent and
provider is gone. The same report as vantiboolean's on 11-08 (50eec4994):
with prefers-reduced-motion (Windows' Animation effects off in WebView2,
macOS Reduce motion, or Settings' Reduce motion) bird() returned null, so
a request in flight had wires that faded and a dot, and no magpie. The
animation itself is intact on origin/main; with motion on the birds fly
(routing-sky-under, routing-held-dot).

Now bird() draws the magpie with motion reduced too, class "calm": no
flight (the flight is posed at its end, as before), wings still, and it
fades in by opacity alone (rtfade, 200ms, ease-out), stays 700ms and fades
out (250ms, opacity only; no translate or scale). With motion on nothing
changes.

Tests: routing-calm-in-flight.test.cjs now asserts that a bird appears
under reduced motion (system's and Settings'), its fade animation is
rtfade, rtfade's keyframes hold opacity and no transform, its wings have
no animation, it fades away and is removed.

Run (WSL magpie-desktop, Playwright 1.62.0; mote and mica both had other
sessions' full GUI suites and load over their cores):
- routing-calm-in-flight, both engines, system and Settings reduce, 1100
  and 420px: 8 of 8. Red on origin/main's client.js and routing.css with
  this test: all 8 (chromium timeout waiting for .rt-flier.calm).
- routing-sky-under alone, both engines x 5 langs x 4 widths: 40 of 40 (and
  40 of 40 on origin/main). routing-held-dot, routing-answered-still: ok.
  In a run of four files at once two routing-sky-under webkit cases were
  red (zh-TW and ja, 560px); alone they pass; filed on #6513.
- Rebased on f7173c79a: routing-calm-in-flight and i18n-keys, 12 of 12.
- The whole GUI suite (--test-concurrency=3, WSL) was started at the
  pre-rebase head; its result comes after this push, reds filed.
Not run: go suite (no Go changed); the real app with Reduce motion on.
2026-11-20 00:24:54 +08:00
yetone f7173c79a3 codexcat: another magpie's ChatGPT model is Codex's own, given this Codex's entry for it
A remote with no Codex cache of its own (a server) builds its entry from
the bundled instructions, so office/codex/gpt-6-astra still lacked the
backend's model_messages and fields. OwnSlug takes an id ending in the
entry's codex/<slug> as Codex's own: entriesAt gives it this computer's
models_cache.json entry, as a local account's codex/<slug> gets, and
OwnIn keeps it in the Codex app's first list (gateway catalog too). A
relay's plain gpt-6-astra is not taken.

Run (mote-run, rebased head): TestRemoteChatGPTModelIsCodexOwn red with
OwnSlug turned off (description "GPT-6-Astra via magpie", OwnIn false),
green now; the codexcat, provider, gateway and gui runs, gofmt and the
three vets in the commit before. e2e with a models_cache.json in the
local CODEX_HOME: description "Frontier intelligence for the most
demanding work." and model_messages present, codex exec FAKE-OK.
Not run: the full suite (next, at the pushed head); a real ChatGPT
account behind a real remote.
2026-11-20 00:12:59 +08:00
yetone c3836b4eeb remote magpie: Codex is handed the entries that magpie gives its own Codex (Darkf1ames on X)
A remote magpie's models reached Codex as entries this magpie made up for
a third party's model (its description "· Remote magpie via magpie",
no model_messages, no service tiers), so a ChatGPT subscription the remote
holds wasn't the Codex it is when the account is local. codexEntries
skipped every preset provider, the remote magpie included. It now asks
the remote's /v1/codex/models (#1281) with Codex's client_version and the
remote's key, and listedEntry says " via magpie" once.

Run (mote-run, at the rebased head on f288cc61a):
- TestRemoteMagpieHandsOnItsCodexEntries, TestRemoteMagpieEntry: red on
  the old codex_entries.go/codexcat.go ("asked 0 times", "via magpie via
  magpie"), green now.
- go test ./internal/codexcat; -run 'Remote|Codex|Budget' over
  internal/provider, internal/gateway, internal/gui: ok.
- gofmt -l clean; go vet, GOOS=linux -tags nogui and GOOS=windows vet of
  the three packages: ok.
- e2e on mote, two sandbox HOMEs (remote :3592, local :3593) and a fake
  ChatGPT backend :3591: `magpie codex office/codex/gpt-6-astra` then
  `codex exec`; old binary wrote the made-up entry, new one the remote's,
  both answered FAKE-OK.
Not run yet: the full suite (mote and mica were busy with other
sessions' suites); it runs at the pushed head next.
2026-11-20 00:12:59 +08:00
yetone 958d4fcaf1 pii: the local models' folder is chosen under Advanced, and Move… moves them (MetalHqa on X)
On Windows both models (Privacy Filter 1.6 GB, AstrLink Guard 39 MB)
went onto the C: drive with no way to choose. Settings > Privacy now has
Advanced > Models folder: Move… picks a folder in the system's picker and
moves what is downloaded there; Move back returns it to magpie's cache.
The default is unchanged.

- settings.RedactModelDir is this computer's own (kept by KeepOwn, never
  set by a settings save).
- pii.Root() is the one place every path is made from (dir, guardRoot,
  so the model, its cache files, pf-serve, the CoreML program).
- pii.MoveTo: a rename on one disk, else a copy checked by sha256 read
  back; the setting switches after it and the old subfolders are deleted
  last (never the picked folder); a failure puts back what it moved and
  keeps the old copy. Refuses a relative path, an unwritable folder and
  one inside what is moved. A picked folder that has gone (disk
  unplugged) is not recreated by a download. Download and Remove wait
  out a move.
- GUI: pmfolder.js, loaded on first draw so the core script is no bigger;
  strings in zh, zh-TW, ja, de. Docs: gateway-routing.md, masking.html
  (en, zh, ja), site index regenerated with docs-index.mjs.

Run (mica; mote had no room, load 35/18 and 29/12):
- go test of internal/pii folder tests, internal/gui TestPrivacyModel*,
  internal/settings and settingsapi keep tests: ok. Each broken by hand
  and red: guardRoot ignoring the folder, no rollback, no missing-folder
  check, KeepOwn line removed, settingsapi line removed, folder action
  not calling MoveTo.
- Windows box (win-run): the move tests ok, TestMoveAcrossDisks on a real
  C: to D: move ok.
- GUI privacy-model.test.cjs, Chromium and WebKit, 5 languages, 1100 and
  640px: 104 of 104.
- go vet on pii, gui, settings, settingsapi for linux (nogui), windows
  and darwin: clean. node --test site/*.test.mjs: 135 of 135.

Not run before this push: the whole GUI suite, go test ./... (both
follow at the pushed head), the size-budget and i18n tests (run after the
rebase), gofmt over the whole tree (touched files only), and a real
Privacy Filter download into a picked folder on a real account.
2026-11-20 00:12:34 +08:00
yetone 83bb079dee gui: the scroll capsule sits above Plugins' install box and the Library's save and pick bars, not over Install (WaiooT on X)
scrollends.js lifted the capsule above only .after-list and .view-foot. Plugins > Discover's .pm-manual (and the Library's .lib-savebar, .lib-pickbar) are held at the window's foot too, so the capsule covered the Install button's right end. They are now in the list it steps over. No layout change.

Run (mica, copy of this tree): new view-ends-install-bar.test.cjs red on the old scrollends.js (390px: capsule over pm-browse, pm-minput and Install, all 12 subtests) and green on the new one (12 of 12: chromium and webkit, en/zh/zh-TW/ja/de, 390/560/980/1280 wide); with only the Library classes removed it is red at lib-savebar. go vet ./internal/gui/... and GOOS=windows go vet, gofmt -l clean. view-ends, view-ends-relayout, routing-editor-foot, plugin-manual-float and i18n-keys: 78 of 80 together; the 2 are webkit view-ends' first subtest (en 440 light) timing out at 8s in that batch, twice, while view-ends.test.cjs alone under BROWSER=webkit is 16 of 16 on this tree and on origin/main.

Not run: the whole GUI suite and go test ./... (mica held by another session's full GUI suite, mote at load 46; to be run at the pushed head), the Library's own bars with real fixtures (stand-in sticky bars of each class are used), the real Linux app.
2026-11-20 00:08:39 +08:00
yetone f288cc61af sessions: a deleted Grok Build session's index rows come back with its restore (#4595)
Follow-up to crayonlu's commit (Grok Build sessions deletable, their
session_search.sqlite rows dropped first). Review of that commit:

Sound: the delete is scoped to the session's own folders (updates.jsonl's
dir, plus its subagents' sibling folders grokFiles already folds in); the
cwd's prompt_history.jsonl and other sessions stay. The index is opened by
a normal connection with a 5 s busy timeout and BEGIN IMMEDIATE, so it
works beside a running Grok Build (WAL, the file's journal mode is left as
it is); a file that can't be opened or read stops the delete before
anything moves (failed read = unknown); no index or no tables deletes as
before. Nothing touches the network, no new dependency, no .github/site.
Checked against Grok Build 1.0.67 itself (its binary's SQL and the index
it wrote on this machine, copied, never opened live): session_docs has
session_id, cwd, updated_at, title, content, content_hash, over
session_docs_fts with the _ai/_ad/_au triggers; there is no
DELETE FROM session_docs in the binary, so Grok has no delete of its own
to match.

Wrong or thin: Restore did not put the index row back, and Grok Build's
bootstrap is stamped in meta.last_bootstrap_at, so nothing says it indexes a
restored folder again; a move that failed after the rows were gone
left the session whole but unindexed. Now grokSearchRowsDrop returns the
rows, every column by name (so a Grok Build that adds a column keeps it),
and Delete keeps them in the trash entry's grok_search.json (not in the
note the Trash page lists). Restore INSERT OR IGNOREs them (a row Grok
wrote again meanwhile wins; an unwritable index doesn't stop a restore),
and a delete that stops after dropping them puts them back.
TestGrokDeleteRestore now checks the rows and FTS entries are back;
TestGrokSearchRowsComeBackWhole checks every column and the kept row.
Broken by hand: Restore without the put is red on "after the restore: 0
rows and 0 found".

Run (mote, worktree of this branch; full suite at rebased 0a37c9368 base,
go test -count=1 -timeout 45m ./..., log kept): every package ok except
internal/gateway (TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red on
a pristine origin/main 0a37c9368 too: #7117; a doneHold panic, #6505/#6690)
and internal/gui (TestGatewayPauseRollsBack, TestGatewayPauseFileUnreadable:
TempDir cleanup "directory not empty" only inside the parallel full run,
filed #7232; ./internal/gui alone is ok on origin/main 0a37c9368 (158 s) and
on this branch (174 s)). Neither touches sessions. gofmt -l clean; go vet
(darwin), GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...
clean. The Grok tests also pass on Windows (win-run) and WSL (wsl-run),
real SQLite files in WAL mode in all three. After the last rebase (onto
04e62892e; three library/gateway commits, none in sessions or gui) the
sessions/... (60.8 s) and gui (171.8 s) packages were run again at the
pushed head: ok.

Not tried: a real Grok Build deleting or re-indexing a session itself, and
the real index here was only read from a copy. Still not deletable on the
Sessions page (#4595 stays open for them): Hermes, Alma, OpenCode, ZCode,
Cline, Kimi Code and Claude Desktop (Cowork).
2026-11-20 00:00:52 +08:00
crayon 6671091676 sessions: Grok Build's sessions are deletable, its search index's rows going with them (#3003, #4595)
#3003 (acsfreerun) asked for a Delete on Grok Build's sessions; #4595 kept
them listed with no Delete, because a session is a folder but Grok Build
copies each session's text into $GROK_HOME/sessions/session_search.sqlite,
which a folder delete would leave behind: its search would go on finding a
session Grok Build no longer lists.

Deletable("grok") now says yes, and sessionPaths' "grok" branch moves the
whole folder (updates.jsonl, summary.json, the locks, prompt_context.json,
terminal/, everything else it kept) and its subagents' folders, which
grokFiles folds into the session it ran in. What the cwd's folder holds for
every session there (prompt_history.jsonl), another session's folder and the
index stay. The trash, Restore, Purge, the recent-write ErrActive guard and
WSL handling are the ones Delete already has.

grokSearchRowsDrop (grok_search.go) deletes the deleted session's row in
session_docs, and its subagents', inside one BEGIN IMMEDIATE with a 5 s busy
timeout, so it waits for Grok Build's own write instead of failing; the
session_docs_ad trigger takes the row out of session_docs_fts. It runs before
the first file is moved: a row that can't be taken out (a database that isn't
one, a lock held past the timeout) stops the delete and the session stays
whole, rather than a folder gone from the list and still found by search. No
index file, or one without those tables, deletes as before. Restore brings
the folder back; the index row is not put back, so Grok Build's search finds
a restored session only if Grok Build indexes the folder again.

Tests, in-repo and on fixtures, never on a real ~/.grok: the sessions
package's fixture tree gained a lock file per session, a subagents/ entry, a
terminal/ file and the cwd's prompt_history.jsonl, and a small
session_search.sqlite is built in-test from the real file's schema (v4,
session_docs over FTS5 session_docs_fts with the three triggers).
TestGrokDeleteRestore (delete, folder and row and FTS entry gone, another
session's row kept, ErrActive, Restore, Purge),
TestGrokDeleteLeavesTheSessionWhenItsIndexRowCantGo and
TestGrokSearchRowsDrop; TestGrokSessionDeleteOnThePage drives the page's own
handlers (GET /api/sessions/manage?agent=grok says deletable, POST
/api/sessions/delete moves it, the trash lists it, POST /api/sessions/restore
puts it back).

docs/subsystems/gateway-sessions.md: the delete paragraph, and Grok Build out
of the "sessions magpie cannot delete" list.

Run (mote, this tree, on origin/main 289184a40): gofmt -l clean; go vet -tags
nogui ./... ok (one pre-existing cgo deprecation warning in internal/proc);
go test -count=1 ./internal/sessions/... ok (55.9 s); go test -count=1
./internal/gui -run 'Session|Manage|Forget|Trash|Delete' ok, 63 tests, the
new one among them; go test -tags nogui -count=1 on the same two selections
ok. go test -count=1 ./internal/gui (whole package, 216 s) fails
TestDockReopenKeepsTheWindowsSpace and TestCoveredWindowStaysUp with "timed
out waiting until the window is minimised"; both are red the same way in a
worktree at 289184a40 without this change, so they are this Mac's window
server, not this commit.

Broken by hand: without `"grok"` in Deletable, TestGrokDeleteRestore is red on
"Grok Build's sessions are not deletable"; green with it.

Not tried: a real Grok Build binary deleting one of its own sessions, so
whether it re-indexes a restored folder is unverified (said in the doc).

Isolation: the test binaries put HOME, USERPROFILE, XDG_* and every agent's
own variable (GROK_HOME included) in a temp folder (testenv.Isolate), and the
new tests name GROK_HOME and XDG_CONFIG_HOME themselves. A copy of this
machine's real ~/.grok/sessions (a 14.9 MB session_search.sqlite with 54
rows, one session of 76 files, one parent session of 477 files with two real
subagent folders) was exercised in the scratch folder only: delete, index row
and FTS entry gone, restore to the same file counts, purge; the developer's
own ~/.grok/sessions was snapshotted (every path, size and mtime; the index's
sha256; its session ids) before and after the runs and differs only where the
running Grok Build windows write themselves.
2026-11-19 23:57:01 +08:00
yetone 04e62892eb library: Pi's package search installs a package or repository named outright
eachg0 on X: the skills and MCP searches take a repository or package named
outright, but Pi's (Library → Pi packages → Discover) only searched, so a
package found elsewhere couldn't be installed from it.

Now, like the MCP market's `custom` card, GET /api/library/market/pi answers
`direct` (library.PiDirectAt) when the text names a package, and the GUI
draws it first, even when npm's search finds nothing. The forms are Pi
1.5.2's own (parseSource, parseGitUrl, parseNpmSpec), read from the npm
tarball:

- npm: `name`, `name@ver`, `npm:name[@spec]`, `@scope/name[@ver]`, and an
  npmjs.com package page (…/v/<ver> becomes the pin);
- git: `git:` with any shorthand (`git:o/r`, `git:github:o/r`,
  `git:git@host:path`, `git:host/path`), `https://`, `ssh://`, `git://`,
  `git@host:path`, `host.tld/o/r` and `o/r` (GitHub); a GitHub, GitLab or
  Bitbucket page loses #readme and /tree/<ref> becomes @ref.

Each is installed as one of Pi's own forms. A bare word is offered only
when the registry has it with the pi-package keyword ("web" exists on npm
without it and stays a search); a form named with npm:, a scope or a git
address is always offered, with the registry's version, publisher and
description when it answers. The registry asked is the one in use
(npmmirror), then npm's own. Local folders aren't offered. piSourceOK
refuses a flag, `..`, a backslash, ?#%, whitespace, a host that isn't
dot-separated labels, a part starting with ~, and a ref or pin that starts
with -. InstallPiPackage takes git sources (it forced npm: before), and a
Pi's packages carry an id (piSourceID), so "In <Pi>" matches a git package
under another ref, too. Placeholder in en, zh, zh-TW, ja, de.

Tests:
- TestPiSourceFor: every form above, canonical output, and the refusals.
- TestPiDirectAt: npmmirror's real /pi-rename/latest bytes
  (testdata/npmmirror/pi-rename-latest.json, 2026-11-19), a pin, "web"
  without the keyword, a 404, npm: and a scope on a 404, a found one not
  offered twice, git forms not asking the registry. No network: registry
  fakes only.
- TestPiInstallNamedOutright, and TestPiInstallAndRemove's bad list.
- library-pi-direct.test.cjs: pi-rename typed, offered first, installed
  into Pi; its GitHub page installed into WSL Ubuntu by its address; the
  placeholder; en zh zh-TW ja de, 980px and 380px, Chromium and WebKit, no
  sideways scroll.

Red on the old code: the Go tests don't compile there (piSourceFor,
PiDirectAt undefined); the GUI file is 22/22 red on old assets (the
placeholder, and with that check removed, no direct card, 20/20).
Broken by hand: PiDirectAt returning nil turns TestPiDirectAt red;
piSourceOK refusing git turns TestPiInstallNamedOutright and
TestPiInstallAndRemove red. The first run also found evil..com and
~/pi-tools let through; both are refused now.

Run (mote unless said):
- gofmt -l: nothing.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., go build: ok at 2b2d4bf54; Windows go vet ./... on xiaomi-gpu and
  go vet -tags nogui ./... in WSL magpie-desktop: ok.
- go test -count=1 -timeout 45m ./... at 2b2d4bf54 (base ef997d186): 103
  ok, one red, internal/gateway
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red alone on
  origin/main ed405d1d7 too, #7117.
- GUI: every library-* file plus every file reaching the market or the
  library client (99 files, 2565 tests) at 33f4e935c (base be400389b):
  2556 pass, 9 red, all on main and filed: library-open-again 1100px
  (#6751, red alone on origin/main 0a37c9368 too), library-env Variables
  de (#6675, passes alone), win-fonts monospace stack from b2b3d488c's
  app.css (#7016).
- At the pushed head (base 0417417e5): vet (darwin, linux nogui, windows)
  of internal/library and internal/gui, go build, internal/gui's Budget,
  Keys and I18n tests, internal/library whole, and library-pi-direct,
  library-pi-market, library-pi-extensions and i18n-keys: all ok (70 of 70 GUI tests).

Not run: the whole GUI suite (both mote and mica held other sessions'
full GUI suites for 3h+; the files this change reaches were run), and the
full Go suite again after the last two rebases; internal/library, which
moved upstream, was run whole at the pushed head. Not tried: a real `pi install` of a git source; the market's
fake pi stands in. Local folders aren't offered.
2026-11-19 23:56:07 +08:00
yetone d245951c9f gateway: Antigravity and agy get the hub's tools whole, not find_tools/call_tool
/hub/antigravity wrapped a big tool list in find_tools/call_tool, a second
lazy load on top of Antigravity's own (izhidigua on X, 11-19). agy 1.5.12
loads MCP tools lazily itself: its binary carries "Call a lazy-loaded MCP
tool. Read the tool's schema file", McpToolConfig.enable_lazy_load,
SplitEnabledToolsByEagerLazy and per-tool schema files under
~/.gemini/antigravity-cli/mcp/<server>/. So agy and antigravity join
hubSearchers, like claude, codex, pi, droid and omp. mcp-router.md says so.

enable_lazy_load is a config flag that may be set by the server, not by the
client; an account where it is off would list every tool whole.

Run: TestHubMCPToolsWhole now covers agy and antigravity; with both removed
from hubSearchers it fails ("agy listed [find_tools call_tool]"), with them
it passes. go test -run 'Hub|MCP' ./internal/gateway ./internal/gui ok on
mote; gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet
of internal/gateway ok.
Not run: the full Go suite (mote and mica were both busy with other
sessions' full suites), a real agy session. The Library's agy
mcp_config.json handling is another session's and is untouched.
2026-11-19 23:49:45 +08:00
yetone 0417417e57 library: a project takes a whole Claude plugin, and gives it back (jinpwng on X)
A project can now have a library Claude plugin for chosen agents
(projects/plugin). Its skills, MCP servers and subagents go where the
project's own do (withPlugins adds them for a sync and puts the project's
own sets back after), and its hooks are written entry by entry into
.claude/settings.local.json and .codex/hooks.json (HookRecs). Taking the
plugin out deletes it from Plugins, and only what magpie placed or wrote
comes out; an entry the user changed stays. Removing a plugin from the
library drops it from every project. The Library plugins tab gets a
Project plugins section with per-agent chips, in en, zh, zh-TW, ja, de.

Run, on mote at the pushed head (rebased on origin/main 5d4f9862c):
- go test -count=1 ./internal/library ./internal/gui: both ok
  (204.9s, 181.3s); the same two ok at the earlier base 352b124b3.
- gofmt -l on internal/library and internal/gui: clean.

Not run before this push (mote and mica were both at load 27 to 51 under
other sessions' full suites; pushed at the owner's word to ship at once):
the full go test ./..., Linux and Windows vet, the whole GUI suite in
Chromium and WebKit. They are queued behind those runs and their result
will be filed as an issue per red. Not tried with a real project and a
real plugin outside the tests.
2026-11-19 23:48:47 +08:00
yetone 0a37c93682 library: a skill linked in from ~/.agents/skills whose folder is gone is shown as gone and given to no agent (#7226)
"Bring in all" links a skill of the skills CLI's folder into the library.
After `npx skills remove` its folder is gone: the library entry stayed
listed and every sync linked each ticked agent to the dead link.

markDangling (skill_dangling.go, each read and sync) finds a linked-in skill
whose folder is absent or has no SKILL.md, marks it Gone (the page already
offers to take such a skill out; RemoveGoneSkills only removes the link) and
sets Skill.Dangling, which gives() reads, so no agent, project or shared
folder is given it and magpie's own links to it are taken away. It is cleared
when the source returns. A stat error other than not-exist is unknown and keeps
the entry. Nothing the user owns is deleted. The library's own folders are
never judged.

Run (sandbox HOME, tests only):
- New TestLinkedInSkillWhoseSourceIsGone and TestSourceGoneKinds: red on the
  old code (no Gone, agents keep the link), green after (mica-run).
- Windows junction case TestJunctionToARemovedFolderIsGone, plus the two
  above, via win-run on xiaomi-gpu: ok.
- gofmt -l clean; go vet -tags nogui ./internal/library for GOOS=linux and
  windows: clean.
- Full `go test -tags nogui -timeout 45m ./...` on mote at this head was
  still running when pushed (the first 39 packages ok, no red); shipped
  on the coordinator's word with these targeted runs. No reds named.
Not tried: a real `npx skills remove`, the GUI (no GUI files changed, so the
GUI suite was not run).
2026-11-19 23:44:48 +08:00
yetone 5d4f9862ca library: an agent that is not installed is listed only for what magpie gave it here, not for a synced tick (izhidigua on X)
A library synced from another computer carries each item's agent ticks. held()
counted a tick as a reason to list a not-installed agent, so on a computer
without Claude, Claude Code or Pi the MCP switches (and any row withGone
widens) listed them, while Skills showed only the installed four. Take-it-out
(Target.Gone) is for what magpie wrote into the agent on this computer, which
Applied records and sync never carries; a tick alone gave it nothing to take out.

held() now counts only Applied (skills, MCP, hooks, env, router, router rules).

Run, on mote at this tree: TestGoneAgentWithOnlySyncedTicksIsNotListed (new;
claude-desktop, claude and pi ticked from a sync, none installed, nothing
Applied), red on the old code (all three listed), green now;
TestGoneAgentListedToTakeOut still passes (an Applied agent is listed); go test
./internal/library; gofmt -l; go vet of internal/library for linux, windows and
host.
Not tried: the reporter's two computers; the whole GUI suite (no page file
changed).

Full suite, mote, at 7bb2f5ac0 (this change on bb9c5ae15), log kept whole: go test -count=1 -timeout 45m ./... : internal/library ok; reds elsewhere, none in code this touches: gateway TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117, red on origin/main), gui TestAppReplacesItsOlderGatewayOnceIdle, TestGatewayPauseRollsBack, TestSetPortServesWhenTheOldOneWasTaken (TempDir cleanup, #6297, #7112; ok alone). At the pushed head 6aab35abd the library package ok again.
2026-11-19 23:16:23 +08:00
yetone 7f3b272726 library: the Antigravity app and agy share one MCP file, and magpie's entry in it is magpie's (izhidigua on X)
Antigravity and agy read and write the same ~/.gemini/config/mcp_config.json.
With both ticked and MCP routing switched on, the first one's sync wrote the
"magpie" entry; the second one's hubFor then found a "magpie" entry it had not
written itself and judged it the user's own server by that name (hubOwn): it
kept a direct connection and offered to import it, and switching off left that
side's servers behind.

hubFor now asks sharerWrote: an entry by the hub's name in a file that another
target reading the same path has Applied is magpie's own.

Run, on mote at this tree: TestAntigravitySharedMCPFile (new; two rounds of on
then off, with fs stdio and web http ticked for both, then Read shows no
server direct), red on the old code (the second agent kept its servers direct
and the file kept the foreign entry), green now; go test ./internal/library;
gofmt -l; go vet of internal/library for linux, windows and host.
Not tried: real Antigravity or agy (sandbox HOME only).

Full suite, mote, at 7bb2f5ac0 (this change on bb9c5ae15), log kept whole: go test -count=1 -timeout 45m ./... : internal/library ok; reds elsewhere, none in code this touches: gateway TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117, red on origin/main), gui TestAppReplacesItsOlderGatewayOnceIdle, TestGatewayPauseRollsBack, TestSetPortServesWhenTheOldOneWasTaken (TempDir cleanup, #6297, #7112; ok alone). At the pushed head 6aab35abd the library package ok again.
2026-11-19 23:16:23 +08:00
yetone 6aab35abdf provider: Factory's mover min 0.1.52 (harness read as runtime, Claude Code's tool search sent in full)
Factory answered content_policy_rejected for Claude Code, Pi and Codex
since 11-17, and Claude Code's deferred tools failed (@DennisYan4 on X).
Plugin 0.1.52 (npm has it) reads "harness" as runtime in a client's prompt
and tool descriptions, and sends defer_loading / DeferredToolPlaceholder as
tools declared in full. keepMovedCurrent now brings every moved user to it.

Run at 352b124b3 plus this line, on mote: go test -count=1 -timeout 45m
./... -- all ok except 4 reds: internal/gateway
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (red the same on
origin/main fa52741eb, filed as #7117), and three internal/gui tests
(TestAppReplacesItsOlderGatewayOnceIdle, TestGatewayPauseRollsBack,
TestSetPortServesWhenTheOldOneWasTaken: TempDir cleanup "directory not
empty" under load 30+, green alone). internal/provider alone: ok. Plugin:
bun test packages/factory 226 pass; CI's test job for 0.1.52 passed.
2026-11-19 23:15:01 +08:00
yetone fa52741ebc agent: omp 18.1.6 and later name themselves; magpie's User-Agent only for an older omp (Zyvaletta on X)
magpie wrote `headers: {User-Agent: omp}` into omp's models.yml for every
omp. A newer omp sends `omp/<version>` itself, and the header put that
version out of sight.

From omp's own source: pi-ai 18.1.6 (CHANGELOG 2026-09-03, "Inference
requests now identify as omp by default") wraps fetch in
withInferenceUserAgent, later transportFetch, which sets User-Agent
omp/<VERSION> only when none is set. Real omp runs against a stand-in
gateway on mote, sandbox HOME, `bun add @oh-my-pi/pi-coding-agent@<v>`,
every API (Chat, Responses, Messages, Gemini):
  16.3.5 and 18.1.5: Bun/1.4.2
  18.1.6 and 18.4.4: omp/<version>
18.15+ needs Bun >= 1.4.4 (mote has 1.4.2); its source (18.15.0,
18.22.2) has the same transportFetch.

Now (ompUserAgent): no header from 18.1.6 on; omp/<installed version>
before; plain omp when the version isn't known. The version comes from
the installed package.json (InstalledVersion), never the network.
ompKept takes a User-Agent of magpie's own (omp, or omp/<version>) for
magpie's, so an old `User-Agent: omp` is replaced or removed on the next
sync, and any other value, under any casing, is the user's and stays
alone. usage.AgentOf cuts at "/", so omp, omp/16.3.5 and omp/18.4.4 all
count as omp; nothing reads omp's version from the UA.

Tests (internal/agent/omp_useragent_test.go): TestOmpUserAgentByVersion,
TestOmpOldMagpieUserAgentSynced, TestOmpUsersOwnUserAgentStays.

Broken by hand: origin's omp.go with a stub ompOwnUserAgent, all three
red; ompKept returning yamlKept's result unchanged, the last two red.

Real omp with the new header (mica, same stand-in): 16.3.5 and 18.1.5
with `User-Agent: omp/<v>` send omp/<v> on all four APIs.

Docs: docs/subsystems/agent-wiring.md row "omp's User-Agent"; site
omp.html en/zh/ja.

Run at this tree (base ed405d1d7, mica):
  gofmt -l on changed files: nothing
  go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: ok
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok
  go test -count=1 -timeout 45m ./... (sandbox HOME, mote, at the pre-rebase head): every package ok but
  gateway TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (red on origin/main be400389b too, #7117) and gui
  TestSetPortServesWhenTheOldOneWasTaken (TempDir cleanup race under load 48; 5 of 5 ok alone).
  After the rebase onto 352b124b3..be400389b: internal/agent (45m timeout), fx, usage ok.
No GUI files touched; GUI suite not run.
Not tried: omp 18.15+ run for real (needs Bun >= 1.4.4); a WSL omp.
2026-11-19 23:03:32 +08:00
yetone be400389ba provider: Antigravity counts Gemini 4 Carbon and Argon at their original price, $4 / $20 / $0.20
ZhouYimingsjtu on X: with an Ultra 20x plan, ~$200 of real use gave
Carbon:Neon:Hydrogen = 1.64:1:0.39. magpie priced them 2:3:1.5 by input
(0.67:1:0.5), so Carbon read cheaper than Neon while Antigravity counts it
above. Google's pricing page (ai.google.dev/gemini-api/docs/pricing, read
2026-11-19) lists Carbon and Argon at $2/$10/$0.10 through 2026-11-30 and
$4/$20/$0.20 from 12-01; Neon $3/$15/$0.15 and Hydrogen $1.50/$7.50/$0.075
have no promotion. models.dev (google, vertex, openrouter, copilot) carries
the promo. With the original the ratio is 1.33:1:0.5.

Only the Antigravity route changes: role ids (gemini-pro-orchestrator-*),
agy-cli/ and antigravity/ ids, providers served by Antigravity, and usage
calls from the agy/antigravity agents (priceAsk gains Agy). The price is
the field-wise max of the catalog's and the original, so once models.dev
moves to the original nothing is raised twice. Gemini API, Vertex and
OpenRouter prices are unchanged; Neon and Hydrogen unchanged. Argon is the
sibling with the same promo on Google's page; the reporter did not name it.

Not covered: the Sessions page prices by model name alone, so a bare
gemini-4-carbon in an agy session stays at the promo there; only role and
route-prefixed ids are scoped.

Run (mote, origin/main 352b124b3 base): go vet ./..., GOOS=linux go vet
-tags nogui ./..., GOOS=windows go vet ./... clean; gofmt -l clean.
Full go test -count=1 -timeout 45m ./...: provider red on this change
(effort_price_test, updated here and green: ok internal/provider), usage,
sessions, agent, dirent ok on rerun; reds that also fail on the same base:
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117); sessions hit the
45m timeout under load (WSL tests pass alone); gui TestSetPortServes... and
agent/dirent/gui WSL and watcher reds pass alone on both trees. New tests
red on old code, green on new.
2026-11-19 22:43:48 +08:00
yetone bb9c5ae154 gateway: an inline image is counted in the context map by its vendor's rule, from its size (paiven_x on X)
@paiven_x on X: a Codex session (gpt-6.1-terra) of a few hundred small
screenshots sent ~42 MB a request, and the context map showed 764K
tokens, 413K of them images, while Codex's own count was about 371K.
Every inline image was taken at a flat 1600 tokens (imageTokens), so
~258 small screenshots read as 413K where OpenAI counts an 800x500
one at 480.

Now an image's width and height are read from its header alone
(image.DecodeConfig over a streaming base64 decoder: a few KB of a PNG,
a JPEG up to its frame header, a lean body's imageRef through
keptImageOf), and counted by the rule of the protocol's vendor
(prompt_image.go):
- Anthropic: 28 px patches, ceil(w/28)*ceil(h/28), after the reference
  resizedSize; 2576 px / 4784 tokens for Claude 4.7 and later, 1568 /
  1568 before.
- OpenAI patch models (GPT-5.2 and after, the minis): 32 px patches
  times the model's multiplier, in the side and patch budget each
  detail sets (low/high/original/auto per model, as the vision guide
  lists them).
- OpenAI tile models (gpt-4o, gpt-4.1, o1/o3, gpt-5/5.1): base plus
  512 px tiles after 2048 and 768 fitting; low is the base.
A link, a file, a document, an unreadable image and a Gemini request
stay at 1600; the vendor's count still scales them all (calibrate).

The 475K Codex never reached is Codex's own: 95% (its
effective_context_window_percent) of the 500K its bundled catalog gives
gpt-6.1-terra. magpie writes no auto_compact_token_limit for Terra
unless the user set one (Working keeps its own 500K). Codex compares
the usage the vendor reported (~381K), which was under it, so nothing
compacted until /compact. No workaround added.

Tests: TestPromptImageTokensByVendor builds real PNG and JPEG bytes
(image/png, image/jpeg Encode) and checks each vendor's own doc
numbers: Terra 800x500 auto 480, 2880x1800 high 2949, gpt-5.5 low 192,
gpt-4o 1024x1024 high 765 and low 85, Claude 1920x1080 2691 (high
tier) and 1560 (Sonnet 4.5), 3840x2160 4784, a JPEG behind a 40 KB
APP1 330, \/-escaped base64 480. TestPromptImageSizeReadsHeaderOnly
reads 2880x1800 from the first 4 KB of the base64 and falls back to
1600 for a link, a file and undecodable bytes.

Broken by hand: imageTokensOf replaced by the constant, all 10 cases
of TestPromptImageTokensByVendor red at 1600.

Run at this head (e67b0f4fa, rebased on origin/main 352b124b3): gofmt -l
clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... ok
(mica); go test -count=1 -timeout 45m ./... on mote: every package ok except
internal/gateway, whose only --- FAIL is
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red on origin/main without
this change (#7117). A recovered "close of closed channel" from doneHold.serve
(continuation_test.go:781) is in the log, filed as #6690 and #6505; it fails
no test. TestCoreScriptBudget is in that run (no GUI file changed).

Not tried: a real Codex session with hundreds of screenshots; the counts are
checked against OpenAI's and Anthropic's documented examples only.
2026-11-19 22:42:27 +08:00
yetone 352b124b39 site: APIKEY.FAN renewed, in-app seat runs to 12-24
The owner confirmed 11-19 that APIKEY.FAN paid the renewal. Its
in-app entry would have gone off at 11-24 00:00; until now reads
2026-12-24. The README banners carry no date and stay.

Run: node --test site/*.test.mjs on mote, 135/135 at base 289184a40.
2026-11-19 21:57:35 +08:00
yetone 289184a409 provider: agy's Orchestrator (Neon), gemini-pro-orchestrator-neon, is priced as Gemini 4 Neon (mu33410 on X)
mu33410 on X: Gemini 4 Neon through agy had no price, as Orchestrator
(Argon) had before a75a1fffc. Antigravity's models page
(https://antigravity.google/docs/models/, read 2026-11-19) added Gemini
4 Neon and Orchestrator (Neon), which "plans with Gemini 4 Neon" and
hands implementation to Gemini 4 Hydrogen. Its id is
gemini-pro-orchestrator-neon: the agy 1.5.10 binary's strings hold it
beside gemini-pro-orchestrator-argon and -g1-pro (and gemini-4-neon,
-low, -medium, -high, -xhigh). No catalog prices the role id, so its
calls had tokens and no cost. It is now in antigravityRoles at
gemini-4-neon, so MakerPrice, ListPrice, PricedName, the usage ledger
and the Sessions list price it, under agy-cli/ and at an effort too.

Neon itself (gemini-4-neon, at the efforts agy names it by) was already
priced from models.dev, which lists it since 2026-11-18 for google,
google-vertex, openrouter (google/gemini-4-neon), github-copilot and
opencode at $3 in, $15 out, $0.15 cache read per 1M tokens: the same as
Google's own page (https://aistudio.google.com/docs/pricing, Standard;
no long-context tier, implicit caching only). The Gemini API key,
Vertex, OpenRouter and gcp-ai routes read those catalog rows; the test
now holds gemini-4-neon-xhigh, agy-cli/gemini-4-neon-high and
antigravity/gemini-4-neon-low to that price too. A magpie whose catalog
was synced before 11-18 shows Neon unpriced until its next sync.

Tests: TestAntigravityOrchestratorIDsPricedAsTheirModel,
TestPriceOfAntigravityOrchestratorRoles and
TestAntigravityOrchestratorCallsPriced take the Neon role id (they had
it as unpriced). Broken by hand: with origin/main's models.go all three
are red on gemini-pro-orchestrator-neon (mica), green with the fix.

Run (mote, at this tree, 62c1148ef on origin/main ed405d1d7): gofmt -l
clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows
go vet ./... ok; go test -count=1 -timeout 45m ./... (sandbox HOME):
103 packages ok, internal/gateway FAIL on one test only,
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (OpenCode Go free
model, not reached by pricing), red alone at ed405d1d7 without this
change too and filed as #7117. No GUI files changed.

Not tried: a real agy Neon conversation. This Mac's agy account is on a
plan without Neon (`agy models` lists no Gemini 4), so the id is taken
from the binary, not seen in a step's gen_metadata. The Vertex preset's
model list still names no gemini-4-neon (typed in, it is priced); that
is offering, not price, and is filed as #7214.
2026-11-19 20:22:46 +08:00
yetone ed405d1d78 gateway: an Azure key that answered before, refused 401, rests suspended till it answers (canlee886 on X)
An Azure subscription with a spending limit (a student's $100 a month,
a trial's) is disabled by Azure when its credit runs out and enabled
again on its own when the credit renews. Meanwhile every request 401s
"Access denied due to invalid subscription key or wrong API endpoint",
the words a wrong key gets. magpie read that as any 401: failOther on
the 1-minute backoff climbing to 10 minutes, never asked in the
background, so the key was asked again by requests for weeks, and the
reporter turned the provider off and on by hand around the reset day.

Now restAfterMarked reads a failOther 401 as failSuspended when
azureSuspended holds: no account, Provider.IsAzure, and the key has
answered a request before (provider.LastServed at provider.ServedID,
served.json, 30 days) or is resting suspended already. It rests
suspendedRest (a day) by "suspended", and probeable takes it whatever
its status: keepProbingRests asks the resource's deployments list with
the key at 1, 2, 5 and then every 10 minutes (refused the same while
the subscription is off) and lifts the rest as soon as the list answers,
or when a request does. Its group's requests go to the next member
meanwhile, Azure not asked.

Product calls (mine to make, delegated):
- One 401 is enough, not "repeated" ones: a 401 is about the credential,
  never the model or the request content. On a key that worked, a
  transient 401 is lifted by the first ask a minute in, the same as the
  old one-minute backoff let it back.
- A bad key stays a bad key: a key 401 from its first request (new,
  mistyped, or edited, its KeyID then another) has no answer on record
  and rests as before, failOther/backoff, shown "401 · failed", never
  asked in the background. served.json unreadable is no answer on
  record too (a failed read is unknown, not "it worked").
- Azure only: a 401 says nothing of why on other vendors, and a list
  that answers without the key (OpenRouter's is public) would lift a key
  its vendor still refuses.
- No "back on day N" setting: the probe finds the day Azure enables the
  subscription, so there is nothing for the user to type in, and no
  Advanced field.

GUI: the key list says "Resting · 401 suspended by the vendor · back
at … · checked in the background, back as soon as it answers"; Routing's
restHow says its key answered before, so the vendor has most likely
suspended it (an Azure subscription out of credit). KEY_FAIL and the
routing plugin's FAIL gain "suspended", in en, zh, zh-TW, ja and de.
keyDead is unchanged, so "Remove failing" doesn't offer a suspended key.
docs/subsystems/gateway-routing.md has the rule beside the rest probe.

Not covered: a 403; a key whose last answer is over 30 days old after a
restart (rests are in memory); the last candidate of a request, which
rests only for quota, credit or a timed rate limit, so a lone Azure
provider is asked again by each request, as before, and answers as soon
as Azure does.

Run on mica (mote had other sessions' full suites), at b4c88d44e
unless named, rebased on 9fc1114d8 before the push:
- go test -tags nogui -run 'TestAzureKey|TestSuspended' ./internal/gateway:
  ok. Broken by hand, each red: azureSuspended always false (3 red:
  ThatAnswered, IsAzureOnly, OutlivesItsLastAnswer); served history
  ignored, every Azure 401 suspended (NeverAnsweredIsABadKey and
  OutlivesItsLastAnswer red); probeable's suspended branch off
  (ThatAnswered, IsAzureOnly red).
- azure-suspended.test.cjs, chromium and webkit, en zh zh-TW ja de,
  1100 and 420px: 40/40; with the base's four GUI assets, 0/40.
- At this head rebased, on mote (mica had another session's GUI suite):
  rest-try-now, key-rest-date, rest-probed, azure-suspended,
  routing-rest-off and i18n-keys, both engines: 146 of 164. All 18 reds
  are rest-try-now's (#4127 "ebody holds", #2564), 18 of 40 at
  origin/main 9fc1114d8 too. At b4c88d44e under load 47 on mica the
  same files had 50 timeouts; at light load only rest-try-now's,
  red on main too, are left.
- go test -count=3 -run 'TestAzureKey|TestSuspended|Probe|Rest'
  ./internal/gateway at this head rebased, on mote: ok.
- go vet ./internal/gateway ./internal/gui, and GOOS=linux and
  GOOS=windows go vet ./internal/gateway: ok.
- go test -timeout 45m ./... in a sandbox HOME: the first run filled
  mica's disk (another session's) and ~300 tests failed "no space left
  on device". The six packages it touched, run again: agent and
  provider ok, sessions ran past -timeout 45m with no test failed
  (TestTitleOfALongPromptAllocatesItsTitle at the deadline, #5451; it
  imports neither gateway nor gui); three reds, each filed and
  none in code this changes:
  - internal/dirent watch tests (#7031), red at origin/main 9fc1114d8
    too.
  - TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (#7117), red at
    9fc1114d8 too.
  - TestGatewayModeListsNoOwnSessions (#7064, the listing race): red
    2 of 3 at b4c88d44e, ok 2 of 2 at 9fc1114d8 and 4 of 4 at this head
    rebased.

Not tried: a real Azure subscription disabled for its credit (none to
hand); the list's 401 while disabled is from Azure's documented
behaviour that the data plane refuses a disabled subscription's key on
every route.
2026-11-19 19:38:31 +08:00
yetone 9fc1114d84 provider: Factory's mover takes opencode-factory-auth 0.1.51
@a1pha1nthefog on X (2026-11-19): dsh on Factory's claude-opus-5-5 was
still refused (content_policy_rejected) on v0.1.4532, which installs 0.1.50.
0.1.50 left dsh's web_search under its own name, and Factory refuses it
(two real accounts saw web_search, read_file and execute_command refused
the same day, and listed names behind leading underscores). 0.1.51 renames
those, and a request refused while it declares tools goes once more with
every tool renamed, so a name Factory adds next refuses it once, not for
good (magpie-community/plugins e6c45711). keepMovedCurrent updates every
moved user's plugin to the new min, and the plugin host restarts on it.

0.1.51 is what `npm view --prefer-online` gives at landing.

Run (mote, at origin/main aeca7ae07 plus this change): gofmt -l clean;
go vet ./internal/provider on darwin, GOOS=linux and GOOS=windows; go test
-count=1 -timeout 45m ./internal/provider ok. Plugin side: bun test at the
plugins root 9139 tests, 0 fail; real dsh 0.2.1-rc.2 headless in a sandbox
HOME through the plugin's fetch and a fake Factory taken on the first try,
and on the second when a name not listed is refused.

Not tried: a real Factory account (none here), so Factory's own answer to
the renamed dsh request is not seen.
2026-11-19 18:57:25 +08:00
yetone aeca7ae074 usage: a Claude Enterprise seat's 5 hours come from Claude Code's usage rows; a plan with none says so
@andy_chen1997 on X signed a Claude Enterprise account in, and the Usage
card said "Allowance unavailable", with the reason "Claude Code's /usage
is temporarily unavailable". magpie reads Claude usage only from `claude
-p /usage`. Claude Code 2.1.328 draws that text from the usage endpoint's
five_hour, seven_day, seven_day_sonnet and model-scoped weekly rows. When
it draws none of them, the text is just the subscription line, and
parseClaudeUsage read that as a failed read. An Enterprise seat gets there
in two ways:

- its 5 hours come only as a limits[] row (kind "session") in the JSON
  usage_report, with five_hour null. The gateway now adds each session,
  weekly_all and model weekly_scoped row as /usage's own line, and only
  when the text drew no window of its own. The ISO reset is parsed
  (RFC3339Nano). A row of another shape is skipped, and it never loses
  the extra usage line.
- its plan has no meters: limits is [], or the seat is usage-based
  (Claude Code's vmr/fD: oauthAccount seatTier "enterprise_usage_based"
  or billingType "usage_based" in .claude.json). The card now shows
  "5-hour and weekly limits: None on this plan" as a text row, set aside,
  beside its usage credits. This is not an error, so it isn't used up and
  routing holds nothing against it.

A real fetch failure (rate_limits null, or limits null) still says
temporarily unavailable. magpie still never calls /api/oauth/usage
itself.

Our earlier reply ("Enterprise shows only the 5-hour window") holds for
seat-based Enterprise. It was wrong for usage-based seats, which have no
5-hour or weekly limit at all.

The marker line is "Usage report: no meters on this plan", because a
first wording with "usage limits" was read by claudeUsageDenied as an
account error. The new test caught it.

Run on mote. At the pushed head (on origin/main 71718b277): go vet of
gateway, provider, usage and usageapi, plus go test -run Claude of
provider and -run "TestClaudeUsage|Prompt" of gateway: ok. On
origin/main 6ac19f4bc:
- gofmt -l: clean. go vet ./internal/..., plus GOOS=linux (-tags nogui)
  and GOOS=windows vet of provider and gateway: ok. At 975799a06: go vet
  ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...
  and go build: ok.
- node --test claude-no-limits (new: webkit and chromium; en, zh, zh-TW,
  ja and de; at 360 and 1000px), i18n-keys and i18n-en-no-cjk: 10 of 10
  ok. At 975799a06 qianfan-credit-packs and usage-no-reading passed too
  (14 of 14).
- go test ./internal/provider ./internal/gateway (whole packages):
  provider ok. In gateway only TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes
  fails, and it fails alone on a fresh origin/main 6ac19f4bc checkout too
  (#7117, open).
- go test -timeout 45m ./... in a sandbox HOME, at the same change on
  origin/main 975799a06: every package ok but gateway (the #7117 test,
  as above) and pii. TestArmWindowsRunsX64Serve/no_AVX2 waited out 3m
  for its fake pf-serve-base under load 30-50. It passes alone at
  6ac19f4bc and with -count=3 here. Filed as #7202.

Broken by hand, and each went red:
- dropping the rows append in claudeExtraUsage (TestClaudeUsageRows);
- dropping the RFC3339 parse (TestClaudeEnterpriseUsage, reset nil);
- dropping the usage-based seat check (TestClaudeUsageBasedSeat);
- dropping the no-limits window (TestClaudeEnterpriseUsage);
- dropping zh-TW's "None on this plan" (claude-no-limits, both engines).

Not tried:
- a real Claude Enterprise or Team account (none at hand). The fixtures
  follow Claude Code 2.1.328's usage_report schema and its own handling,
  read from its bundled source in a fresh directory and never run against
  a live config.
- the whole GUI suite: no app.js, layout or API change, only new i18n
  words.
- a seat-based seat whose usage endpoint keeps failing still reads as
  temporarily unavailable. The text can't tell it apart from another
  failure.
2026-11-19 18:48:46 +08:00
yetone 71718b277a prompt: Pi's <available_skills> and its context files count as skills and memory, not system prompt
Reported on X by @JinJieBeWater: Pi's skills showed up as system prompt
in the context breakdown. Pi (pi-coding-agent 0.73.1, read from the npm
tarball: formatSkillsForPrompt in dist/core/skills.js, buildSystemPrompt
in dist/core/system-prompt.js) builds one system prompt: its own text,
then "# Project Context" with each AGENTS.md/CLAUDE.md under
"## <path>", then a paragraph on loading skills ("The following skills
provide specialized instructions for specific tasks. ...") and an
<available_skills> block of <skill> entries (the Agent Skills standard's
format), then "Current date:" and "Current working directory:" lines.
splitSkills knew only Claude Code's "The following skills are available
for use with the Skill tool:" list, systemText only a leading
<skills_instructions> (Codex), and splitMemory only Claude Code's,
OpenCode's and Codex's headings, so all of Pi's prompt was one System
prompt item.

- splitSkills also takes an <available_skills> block out, with Pi's
  lead paragraph before it, on every protocol and in a reminder too.
  The tag must open a line and the block must close, so prose naming
  the tag stays put. Any agent listing skills in the standard's block
  is read the same way.
- splitMemory reads Pi's "## /path/AGENTS.md" files as memory, only
  under Pi's "# Project Context" header, and ends the last one at Pi's
  skills or its closing lines. A file under ~/.pi/ is the user's.

Prompts recorded before keep only token counts per item, so they stay
as they were; new requests are split.

testdata/context/pi-0.73.1-system.txt is Pi's default system prompt
assembled by hand from 0.73.1's source (not run): its tool snippets and
guidelines, two context files and two skills, one description with
Pi's &amp; escaping.

Run on mote at this tree (rebased on e4e9eb092):
- go test ./internal/gateway -count=1 -timeout 45m: every test ok except
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red 3 of 3 on
  e4e9eb092 without this change too (#7117, open)
- go vet ./internal/gateway, also GOOS=linux and GOOS=windows: ok
- gofmt -l: clean
Then rebased onto d7796bf40 (three commits in netproxy, usage, usageapi
and gui, none in internal/gateway); at that pushed tree go vet
./internal/gateway and -run 'Prompt|SplitSkills|SkillsApart': ok.
Broken by hand: with e4e9eb092's prompt.go, TestPromptOfPiSkills is red
("the system prompt keeps the skills"); with the splitMemory branch
turned off, TestPromptOfPiMemory is red (no memory item).
Not tried: a real Pi run through magpie; only Pi's source was read.
No GUI change (the Context view shows the parts it is given), so no GUI
suite.
2026-11-19 18:40:18 +08:00
yetone d7796bf409 usage: a day card's switch builds one page, not one per agent
WaiooT on X: "每日用量卡,切换日期的时候,账单计算很卡". The day-card
page's usage:day read is usageapi.SpanOf. For each date it built the
day's page, then one more page of the same day for every agent (up to
12) only to read that agent's By["modelAt"], and every one of those
builds listed and stat'd every agent session file again
(readRequestState). A switch to an older day misses the request-page
cache (16 pages), so it paid all of them each time.

- RequestPage.AgentModels: each agent's By["modelAt"], counted in the
  same cell pass as By (cellGroup bit of modelAt, keyed by ReportedAs as
  a filter's Agent is), and from the ledger's rows on the LogCalls path.
  SpanOf reads it in place of a page per agent. The calls that named no
  agent are still listed by model only when they are all there are.
- SpanOf holds sessions.OneListing() for its reads, as the sessions
  overview and stats handlers do, so the session folders are listed once
  a read.

Measured on mote (a throwaway test, not committed: 401,502 gateway
records over 365 days in 6 agents x 6 providers, plus 20 Claude Code
session files a day of 60 calls each, half mirrored by gateway records),
origin/main 6ac19f4bc against this:
- switch to a past day: 243-300ms -> 32-48ms
- today again after it: 57-94ms -> 20-28ms
- 7-day span 400ms -> 44ms, 30-day 1.17s -> 91ms, all time 12.3s -> 2.2s
- 30 switches back a day each (180-day ledger): 4.0-4.9s -> 0.87s
The CPU profile before: readRequestState 46%, then the per-agent builds.

TestAgentModelsAreEachAgentsPage holds AgentModels to the page of
each agent, for a whole week and for a day in it, on the cells path and
the ledger path. Broken by hand: counting from the chart's bits (the
whole period) goes red on cells; the whole ledger in place of the
filter's rows goes red on ledger. Keying by the raw agent instead of
ReportedAs stays green: rows carry the reported name already, and only a
renamed client could tell the two apart.
2026-11-19 18:09:56 +08:00
yetone 6ac19f4bc3 netproxy: Windows' "actively refused" is a refused connection too
Explain and sshWhy matched only "connection refused", so on Windows a
proxy or SSH server with nothing listening got no reason, only the raw
dial error. TestSSHProxySaysWhyItFailed was red on Windows at
origin/main 9bf5848c1 (win-run, xiaomi-gpu). Both now also take
WSAECONNREFUSED's "No connection could be made because the target
machine actively refused it".

Run: win-run go test ./internal/netproxy: ok. Broken by hand: refused()
matching "connection refused" only turns
TestRefusedIsExplainedOnEverySystem red (WSL).
2026-11-19 18:04:19 +08:00
yetone a4bf1a039e netproxy: Auto goes direct while the system's loopback proxy isn't running (@bitssly on X)
@bitssly (X, magpie 0.1.4519, Windows 11 amd64): with the proxy on Auto,
every model failed with 502 "proxy not reachable" once their VPN app was
off, a restart of magpie too, until they set the proxy Off. A VPN or
proxy app that quits without clearing Internet Options leaves
ProxyEnable=1 and ProxyServer=127.0.0.1:port in HKCU, and Auto took the
system proxy as it was: every request went to a port nothing listens on.

Auto now takes a system proxy on loopback only while its port accepts a
connection (liveSystem, through the same listening check the login
shell's proxy already had: 300ms dial, kept 15s while up, 2s while down,
so the VPN coming back is followed within 2 seconds). Every route that
asks Auto goes through it: For (netproxy.Func for the gateway and every
transport, and http.DefaultClient through Install), EnvWith (the CLIs
magpie starts, Bun, and the plugin host, whose proxy check every 15s/2s
restarts it on a change) and Describe. Settings › Network says it:
source "down" reads "Nothing answers at the proxy found, {proxy};
requests go direct until it runs again", in every language.

Not changed, on purpose:
- A proxy set in magpie is never gone around: a dead one still fails.
- The environment's *_PROXY, set for this process by whoever started
  it, is taken as it is, dead or not.
- A system proxy elsewhere than loopback isn't probed: a proxy that is
  down can't be told from a network that drops a probe.
- internal/agent/codex_proxy.go reads the raw System(): it predicts what
  Codex itself does.
- Going direct while the VPN is off means vendors see the computer's own
  address. A user who needs to fail closed sets the proxy in magpie.

Run:
- win-run (xiaomi-gpu, Windows 11) go test ./internal/netproxy: ok.
  TestWindowsDeadSystemProxyGoesDirect writes ProxyEnable/ProxyServer to
  a scratch key that RegOverridePredefKey puts in place of HKCU, so the
  box's own Internet Options are untouched. It reads them through the
  real system() and the real 300ms dial: direct while nothing listens,
  the proxy again once a listener runs.
- win-run go test ./internal/plugin: TestPiPackage,
  TestCachedReadsSavedProvidersOnce (#7197), TestDistReadFailedIsntMissing
  (#6075) and TestPluginLeavesTheUserNetworkDirect (#4115) are red on
  Windows at origin/main 239da9991 too; the last two pass 3 of 3 here.
- wsl-run (magpie-desktop) go test -timeout 45m ./... at ac4da60cb
  (these two commits on origin/main 9bf5848c1): ok except
  TestRequestStateKeptAcrossACatalogFetchedAgain (#6572, red at
  origin/main too), TestSearchQueueKeepsCodexAlive/cancel (#7090) and
  the root, cli and gui packages, which need gtk4 there.
- At the pushed head (rebased on e4e9eb092), mote-run go test
  -timeout 45m of netproxy, gui, plugin, gateway, usage, provider and
  agent: ok except TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes
  (#7117, red 3 of 3 at origin/main e4e9eb092 too) and two TempDir
  cleanup reds, TestSetPortServesWhenTheOldOneWasTaken (#7112) and
  TestRequestChunksFromDisk (#4390; 3 of 3 alone).
- go vet ./... and GOOS=windows go vet ./... on mote: ok; vet natively
  on Windows: ok; Linux vet of netproxy, plugin, gateway, agent and
  provider in WSL: ok. gofmt -l clean.
- GUI, wsl-run: proxy-down.test.cjs (5 languages, 1100 and 420px,
  chromium and webkit), i18n-keys and every *proxy* and settings-* file
  at ac4da60cb. Reds: settings-proxy-auth / settings-proxy-remember 4s
  clicks beside a Go suite (#7192, #5562; 30 of 30 alone),
  provider-proxy (#7100) and settings-update-source webkit, red the same
  at origin/main 9bf5848c1. At the pushed head proxy-down, i18n-keys,
  settings-search, settings-proxy-remember, proxy-gaps and
  proxy-own-wording: 94 of 94.

Broken by hand: liveSystem returning the system proxy as it is turns
TestDeadLoopbackSystemProxyGoesDirect red (WSL) and the Windows
registry test red (xiaomi-gpu).

Not tried: magpie.exe against the box's real Internet Options (shared
machine), which source the reporter's proxy was in (registry or env), and
whether a connection dialled direct is kept after the VPN comes back
(#4523 is that class for a changed proxy).
2026-11-19 18:04:19 +08:00
yetone e4e9eb0928 usage: a ZCode call to a provider added by hand at magpie's address is not a local session's (jiangshangmuyun on X)
The Usage page listed one ZCode call as "new-provider · 本地会话" among the
gateway's own rows for the same Trae CN DeepSeek calls. The reporter has one
ZCode window and routes everything through magpie.

Cause: the user added magpie to ZCode by hand as a provider of their own
("new-provider", base URL magpie's gateway), not through magpie's connect,
which writes the id "magpie". ZCode records that id beside each reply, and
readZCodeCalls left out only "magpie"/"dial" (ocGatewayProvider). Its calls
were read from ZCode's database as well as logged by the gateway, and only
hidden again where pairing by session, tokens and end time matched; a call
whose counts didn't agree was listed twice as a "local session".

Fix: zcodeGateway also takes any provider whose base URL, in ZCode's
config.json or provider_config.json, is this machine (loopback, localhost,
0.0.0.0, one of its own addresses) on the gateway's port (MAGPIE_ADDR or the
saved port). Such calls are left out before pairing, as "magpie" ones are.
zcode's call parse version is 4, so cached shards are read again. Like
workbuddyGateway it reads the configuration as it is now. The label itself
is unchanged: a call that did go straight to a vendor is still a local
session's.

Siblings filed, not changed: OpenCode/MiMo (ocGatewayProvider), Pi
(piGateway) and dsh still match the gateway by provider name only (#7193).

Go run on mote at this change on base 9bf5848c1, rebased onto e2e8ea253
(no internal/sessions, usage or GUI file changed between): go test -count=1 ./internal/sessions
./internal/usage ./internal/usageapi (ok); GOOS=darwin/linux/windows go vet of
those packages (clean); gofmt -l clean. Broken by hand: with ocGatewayProvider
back in readZCodeCalls, TestZCodeHandAddedGatewayProvider is red ("a call to a
provider at the gateway's address was read as a local session's").
GUI (no GUI file changed, so as a check of the Usage page that shows these
rows): every usage-*, session-identity and i18n-* file, chromium and webkit,
each language they cover, on mote under load ~40: 1670 of 1777 pass. The 107
reds are in 12 usage files (usage-agents-hide, usage-chart-line,
usage-speed-all-models, usage-upload, usage-ledger and 7 more) and fail the
same at origin/main e2e8ea253 without this change (107 of 308 in those files,
same tests). Filed: #2276, #5834, #6003, #6743, #6790, #6975.
Not tried: the reporter's real ZCode database and config (this computer has
no ZCode); why that one call's tokens didn't pair (no data); the full Go suite.
2026-11-19 17:39:35 +08:00
yetone 992f88d634 usage: a stand-in reading says why the read behind it failed
@tmr11235 on X (tweet 2123334817991520577, magpie v0.1.4520): agy-cli's
card showed "截至 2026/11/15 14:19:19,暂时无法获取最新额度" days later,
with nothing to say why. keepLast stands the last good reading in for a
read that fails with a passing error (timeout, 429, 5xx, network) and
dropped that error, so a stand-in that lasted four days read the same as
one a minute old. The reading now carries the error as readError
(SubscriptionQuota, and Quota for `magpie quota --json` and the gateway
report), and asOfText puts it after the date: "… 暂时无法获取最新额度 ·
agy usage query timed out." A deferred read (not asked) has none, and
the short "As of" line on cards stays short. Every provider's stand-in
gets it, not only agy-cli's.

Run (mote, at origin/main 9bf5848c1 + this commit; again after rebasing
onto c01988e43: vet, the provider/gui quota and budget tests, usage-card-refresh
and i18n-keys, 50 pass):
- gofmt -l clean. go test -count=1 -timeout 45m on internal/provider,
  gui, cli, tui, usage, agent: ok. internal/gateway: one red,
  TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, filed as #7117 on
  origin/main before this (an OpenCode env-block test, not quotas); the
  doneHold fake's "close of closed channel" log is #6690/#6505.
- GUI: usage-card-refresh, account-every-reset, balance-parts,
  claude-usage-asked, panel-quota-refresh, i18n-keys: 94 pass, 0 fail
  (chromium + webkit, every language).
- GOOS=linux/windows go vet ./internal/provider/ (after rebase).
- Broken by hand: without the keepLast line, TestQuotaDeferredReadIsNotFailure
  fails (readError = "", want "connection refused"); without the
  asOfText change, usage-card-refresh fails ("a failed read hid why").

Not tried: the reporter's own failing read (which error it is); a real
GUI with a stand-in card (the fixture page only).
2026-11-19 17:38:05 +08:00
yetone c01988e439 routing: a group's Small context first sends a request to the smallest window that holds it
yg6888 on X (tweet 2123308968848379920): in a group routed Smart, Cursor
Plus's Composer and Grok 4.7 were never used. Not a bug: Smart orders by
allowance tier, then soonest renewal, then listed order, and never weighs
the context window, so the 1M members listed ahead always answered. The
small ones were only ever reached as a fallback.

Smart itself is unchanged; changing its order would move every Smart
user's traffic. A group gets a new routing instead, `fit` (Small context
first; 小上下文优先, 小上下文優先, 小さいコンテキスト優先, Kleiner
Kontext zuerst):

- routes.SmallFirst takes Smart's order and sorts it stably by band (a
  provider set to be used first, the rest with room, the all but used up)
  and then by window, the smaller known first, an unknown one last.
- Its strategy sets ByWindow, so weighRouted fills Seat.Window from
  windowIn (the provider's own Contexts, else the catalog's).
- roomy already leaves out every member the request is estimated past, so
  the first left is the smallest that holds it: a small model is never
  asked for a request too long for it, and keeps its last-resort place as
  under every routing.
- The trace's rows carry `context`; the Routing page says "its 200K
  context window is the smallest that holds this request".
- A group's only: provider.normalize already drops it from a provider and
  the CLI refuses it there. GUI menu, hint, why-lines, TUI and CLI
  (`routing=fit`, small-first) carry it; docs/reference.md, the
  gateway-routing and plugin-runtime pages and the en/zh/ja start pages
  say it, with the search index rebuilt (via docs-index.mjs; #7065).

Run first at the tree rebased on origin/main 6e5882109, then at this
head's (on 856423806; search index rebuilt; gateway/routes vet, routes, rotation, ./internal/gui,
the gateway's new tests and routing-small-first, routing-group-strategy
and i18n-keys 42/42 again), mote over its
cores with another session's full suite on it and mica's disk full, so on
the Linux box (wsl-run) and the Windows box:
- go test -tags nogui ./internal/routes ./internal/cli ./internal/tui
  ./plugins/rotation ./internal/gateway -count=1 -timeout 45m: all ok but
  gateway, whose one red was this commit's own new test asserting a single
  group while an auto group for the shared model exists; fixed (FindGroup
  "group/g") and the window/strategy tests rerun ok, both new ones pass.
  ./internal/provider ok (its only FAIL was the stale search index, since
  rebuilt). ./internal/gui -run Budget ok.
- Broken by hand: SmallFirst returning Smart's order makes
  TestSmallFirstOrdersByWindow and the gateway test red ("a short request
  went to big first"); dropping fit from SaveGroup's whitelist makes the
  gateway test red ("the group didn't keep Small context first").
- GUI (Chromium + WebKit, en zh zh-TW ja de): routing-small-first,
  routing-group-strategy, i18n-keys, routing-cheapest-first,
  routing-free-expiring 112/112 before and after the rebase;
  every routing*, group* and builtins* file (253): 4139 of 4198, the 59
  reds in 11 files that fail the same at origin/main 239da9991 run alone
  (57; routing-many-keys moves between languages each run), all filed:
  #7016, #7097, #6520, #5049, #6512, #4711, #3954, #3799, #4082.
- Windows: CGO_ENABLED=0 go vet -tags nogui ./internal/... ./plugins/...
  ok. gofmt -l clean.

Not tried: the full `go test ./...` and darwin vet (mote busy, mica out
of disk); a real Cursor/Grok account in a group (the window comes from
the same windowIn roomy already trusts). Seen on the way: a recovered
"close of closed channel" in continuation_test.go's doneHold fake, no
test failed from it.
2026-11-19 17:34:30 +08:00
yetone 8564238065 remote magpie: a model is asked on the API the remote asks it on best (OoopsHh on X)
With another magpie as the provider, Pi's models.json had only codex/*
on openai-responses; an OpenAI key's openai/* and a routing group's
auto/* went on openai-completions, and effort max was turned away there
while Responses takes it.

Cause: the remote's /v1/models gives native_endpoints, every API the
model goes on as it is, in its provider's speaking order (Chat first),
and nothing for a routing group. Here Provider.Native took the first one
the remote magpie provider speaks: Chat, for every model but a ChatGPT
sign-in's (listed on /v1/responses alone). The remote's own choice
(Native: ResponsesFirst or the Base URL's API; a group's GroupAPI) was
lost on the wire.

Now the remote's list (X-Magpie-Drawers) says magpie_prefers, the path
it asks the model on best (provider.PreferredEndpoint). The local magpie
keeps it as catalog.Model.Prefers and Native takes it first for a remote
magpie (RemotePrefers), so every agent wired one API per model (Pi, omp,
droid, dsh, grok, hermes, liveagent through catalog.Model.APIs) asks it
there, and the gateway's usable translates another API's request to it
once instead of to Chat. A user's own API set on the model still wins;
a remote from before says nothing and stays as it was.

Not changed: a Chat request a client sends itself for such a model is
still relayed as Chat to the remote, which decides as it does for its
own clients.

Run (mote, at this tree):
- TestRemoteMagpiePrefersResponses (gateway: two magpies on one
  gateway, a fake vendor that turns away reasoning_effort max on Chat)
  and TestPiAsksARemoteMagpiesModelWhereItPrefers (agent): green; both
  red with the RemotePrefers check in Native and usable turned off
  (openai/* and group/auto on chat, Pi's api nil, a Messages request
  relayed as Chat).
- Two real magpie serve processes in sandbox HOMEs, a fake vendor, an
  OpenAI key there with its Base URL given as Responses, a group auto
  and the first magpie as the second's Remote magpie: Pi's models.json
  has office/openai/gpt-6.2-astra and office/group/auto on
  openai-responses with max, and /v1/responses effort max reaches the
  vendor's /v1/responses for both. The same script at the base commit
  wrote both with no api (the provider's openai-completions).
- At base 9bf5848c1: go test ./internal/catalog ./internal/provider
  ./internal/agent ./internal/cli: ok. ./internal/gateway: two reds,
  neither this change's. TestKeptBodyIsOnlyItsCallers is fixed on main
  by e2e8ea253 and passes at this head. TestOpenCodeGoOwnFreeModel-
  GetsNothingOfOpenCodes is red the same on origin/main 975799a06, 3 of
  3 (#7117). gofmt -l: nothing. go vet, GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./...: ok.
- At this head, rebased on 975799a06: the tests above, plus the TestPi,
  TestRemoteMagpie, Native, Prefers, Unique and TestKeptBody runs of
  gateway, agent, catalog and provider: ok.

Not tried: the whole gateway package at this head, the full ./... suite (mote stayed at load 30+ with other
sessions' runs, mica's disk is full), a real OpenAI key, and the
vendor's own Chat refusal of max, which a fake stands in for. Pi
itself was not run; its models.json was read.
2026-11-19 17:28:26 +08:00
yetone e2e8ea253b gateway tests: a flipped byte in the kept-body test is one that changes the body
TestKeptBodyIsOnlyItsCallers flipped the byte at the middle of a dcz body
and expected a 400. Which byte that is depends on the package's .go files
newAgentChat reads as the conversation, and with plugin_credits_last_test.go
added the middle byte fell on bits zstd doesn't read: the body decoded to the
same request, matched its digest and was rightly passed on (200, reached 2,
3 of 3 on mote; 0 of 3 on origin/main 9bf5848c1 without the new file). The
case now takes the first byte from the middle on whose flip changes what it
decodes to.

Run: go test -count=3 -run TestKeptBodyIsOnlyItsCallers ./internal/gateway
on mote, ok.

At the stack's head (tree 5e30adbc6) on mote: GOOS=linux go vet -tags
nogui ./... and GOOS=windows go vet ./... ok; go test -timeout 45m
./internal/gateway ./internal/provider ./internal/plugin ./internal/routes:
provider, plugin, routes ok; gateway red only on
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes, red on origin/main
9bf5848c1 too (#7117).
2026-11-19 17:26:38 +08:00
yetone 504db2206e kiro: the docs say what the Routing page shows, and the min names the ACTIVE, outlasting trial
The ported change said the Routing page shows "on credits · after the
others"; nothing in the GUI renders Weighed.CreditsLast, so the docs now
say the mark is read by affinity only. The plugin (0.1.41, review
follow-up on plugins#1352) says credits only while an ACTIVE bonus has
credits left that outlast the month's reset; the docs and the mover's
note say so.
2026-11-19 17:25:39 +08:00
StringKE 5a83f0ae6c gateway: a plugin's account on its trial credits is asked after the accounts with plan credits left
A plugin window may say credits: used up, the account goes on past it on credits its vendor spends after the window's. Kiro spends a month's plan credits before a trial's, and the plan's are lost at the month's reset while a trial's last a year, so such an account goes after the provider's accounts with room and before those used up, under every routing but Pick account by hand.

Ported from StringKe's branch (StringKe/magpie kiro-trial-last, 23e084262;
yetone/magpie#7179, with plugins#1352, kiro 0.1.41). Kiro's billing docs
say "Kiro uses your plan credits first, then your trial credits" and that
trial credits last 12 months. Opt-in per plugin window (credits), so a key
or a Codex account routes as before: creditsLast and CodexCreditsFirst
stay Codex-only, behindOthers moves only plugin: accounts, and no other
plugin package sends credits. The Kiro mover's min goes to 0.1.41, on npm
(gitHead 0ae116db1).

Run at this stack's head on mote: go test -timeout 45m ./... with go vet
./...: every package ok but internal/gateway, red on
TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (red 3 of 3 alone on
origin/main 9bf5848c1 too, #7117) and TestKeptBodyIsOnlyItsCallers (fixed
two commits on, a test reading the package's own sources). Broken by
hand: with behindOthers taken out of weigh, TestPluginCreditsAfterTheOthers
goes red.
2026-11-19 17:25:39 +08:00
yetone 975799a069 gui: Settings' search finds what the words are about (canlee886 on X)
canlee886 (X, 2123329450502938656) searched Settings for "可访问性",
"监控" and "自动选择模型" and each said no setting matched: "缺少搜索时
的智能联想". The search only found settings whose text had every word.

What it does now, all in finder.js, in the page, nothing sent anywhere:
- A table of ~30 concepts, each with the words a reader may type in
  en, zh, zh-TW, ja and de (accessibility, monitoring, picking a model
  by itself, theme, proxy, notifications, startup, privacy, LAN, cost,
  quota, hotkey, ...), leading to the English names of the settings it
  covers (a setting's English is its data-en in every language). Those
  settings are listed with the ones that have the words themselves,
  for rows, built-ins and other pages' places alike.
- When nothing has the words: a long run of Chinese or Japanese is read
  by its two-character words ("文字大小调整" finds Text size), and a
  Latin word over 3 letters may be one edit off ("currancy").
- When no setting has the words themselves but some are related, the
  line over the parts says "Settings related to “…”" (start-aligned,
  in every language) instead of "No setting matches".
- The finders count first (setFeatsFind/elseFind take a dry flag), so
  a search renders once and the view's MutationObserver doesn't loop.

Not done, on purpose: pinyin (a large table, and readers type Chinese
through an IME), a recent-searches list and "did you mean" chips (a
layout that jumps on focus; the owner has said no to UI churn).

Run (WSL magpie-desktop: mote's load was 26 to 34 on 18 cores, mica's
disk is full):
- settings-search-related.test.cjs (new), Chromium and WebKit, en, zh,
  zh-TW, ja, de at 560x420, plus magpie web at 390x760: 16 of 16.
  Against origin/main 9bf5848c1's assets (SEARCH_ASSETS): 0 of 16, "無
  障礙"/"accessibility"/"barrierefreiheit" show no Text size.
- 37 nearby GUI files (settings-*, search-*, find-*, i18n*, menu-scroll,
  click-scroll, builtins): 636 pass, 34 fail. The six files with reds,
  run again at origin/main 9bf5848c1 and at the change: builtins,
  click-scroll, menu-scroll and settings-update-source are red the same
  at both (#4120, #4471, #1550); search-key-list/search-keys time out
  on one subtest a run, a different one each time, at the change only,
  and touch no Settings search: filed as #7194.
- At the rebased head (239da9991): settings-search-related,
  settings-search, settings-search-reach, find-anywhere and i18n-keys,
  64 of 64; go test ./internal/gui (TestCoreScriptBudget and the rest)
  on Windows (xiaomi-gpu), since WSL has no gtk4: TestCoreScriptBudget and
  the i18n checks pass; 10 Windows reds, none in assets, all filed
  (#6068: TestLodyImportHandoff's %AppData%, TestUpdateThatWontStart,
  TestGatewayHeldByAContainer, ...; #7112 TestSetPortServes...).
- Broken by hand: the base-assets run above.

Not tried: the whole GUI suite (WSL and mote were busy with other
sessions' suites; mica has no disk), the real app (only Playwright's
engines, not WebKitGTK or WKWebView; no motion was added).
2026-11-19 17:21:45 +08:00
yetone 239da9991d provider: Factory's mover takes opencode-factory-auth 0.1.50
dsh (DeepSeek Harness) on Factory got "This request was blocked by
Factory's usage policy check" (content_policy_rejected) on its first turn
(a1pha1nthefog on X). It wasn't its prompt or skills. Since 2026-11-18
Factory refuses a request that declares a tool under certain exact names,
and dsh declares bash, read, write, edit, glob and grep. 0.1.50 declares
such tools under droid's own names (Execute, Read, Create, Edit, Glob, Grep,
Task), or suffixed, and gives the agent its own names back in every reply
(magpie-community/plugins bb849910, porting heggria's #1314).
keepMovedCurrent updates every moved user to it.

npm view --registry=https://registry.npmjs.org --prefer-online
@magpie-community/opencode-factory-auth version gives 0.1.50
(published 2026-11-19T09:02:51Z); its tarball has tool-names.mjs.

Run (mote, at origin/main 9bf5848c1 plus this change): gofmt -l
internal/provider is clean; go vet ./internal/provider; go test -timeout
45m ./internal/provider is ok (164s). The plugin's own run is in its commit:
the plugins suite is 9112 pass and 0 fail, and real dsh 0.2.1 ran a bash call
through the plugin against a fake Factory that refuses the names.

Not tried: a real Factory account. None is here, so Factory's answer to the
renamed request was not seen; dannykkg reported #1314's renames accepted
with a real account (#6994).
2026-11-19 17:03:24 +08:00
yetone 9bf5848c1f gateway: a Kubernetes rolling update runs two pods on one volume safely
@justforlxz on X asked for a RollingUpdate (maxSurge 1, maxUnavailable
0) with no request dropped. The docs said strategy: Recreate, because
the work only the serving magpie may do (renewing sign-ins, check-ins,
moves, plugin updates, WhileServing) was kept to one magpie only by the
gateway's port: a second couldn't bind it. Two pods each bind their own
network namespace, so in an overlap both did it, and two renewals of
one refresh token can spend it (a single-use token rotates).

Design: both pods answer requests at once (each refresh and file write
is already locked across processes: filelock, host.js lockRenew); the
serving work is held to whichever gateway holds gateway.serving.lock
(flock on the config folder, serving.go). The new pod retries every
second and takes the work over as the old pod's gateway ends (its drain
lets go first). A file system without locks is read as no other magpie,
as before.

Pods share the volume but not a pid namespace (both run magpie as pid
1), so the locks that judged a holder by its pid now judge it by host:
- host.js lockRenew records host (hostname + pid namespace); a lock of
  another host is stale by age only, never by "pid 1 is alive here".
- lockMoves (migrate.go) the same.
- gateway.json records Host; forgetListening removes only its own, so
  the old pod's end no longer removes the new pod's file (same pid,
  same Started second was enough before).
- temp and run-mark names get a random part (writeDurable, Claude run
  marks, gateway.json's temp file).

While draining (SIGTERM), every reply says Connection: close, on the
gateway and on magpie web's page port, so an agent that kept its
connection to the old pod alive dials the Service again for its next
request. Without it, the real rollout below had one broken pipe per
kept-alive connection, ~5.8s after each SIGTERM, when the drain's end
closed them.

Docs (en/zh/ja docker, reference.md): RollingUpdate maxSurge 1 /
maxUnavailable 0, the readiness probe, a required podAffinity on
kubernetes.io/hostname (a ReadWriteOnce volume mounts on one node), and
one Recreate update from a version before this one, whose old pod
doesn't take the lock.

Run:
- Real overlap, podman 4.9.3 in WSL magpie-desktop: three pods
  (pa -> pb -> pc) on one volume, each its own container (pid 1, own
  hostname and network), a Service proxy over a readiness-probed
  endpoint list (1s probe, endpoint removed 1s after SIGTERM as
  kube-proxy does), 12 agents streaming 3s SSE turns through it, half
  keeping connections alive, no retries. Before Connection: close: 226
  ok, 10 failed (broken pipe, kept-alive). After: 209 ok, 0 failed;
  second run 207 ok, 0 failed. Each new pod logged "another magpie serves", then
  "let go" as the old pod's gateway ended; gateway.json named the last
  pod.
- Broken by hand, each red then green: TestServingWorkWaitsForTheOther-
  Magpie, TestServingWaitEndsWithItsGateway, TestForgetListeningKeeps-
  AnotherPods, TestMoveLockOfAnotherPod, TestRenewLockOfAnotherPodIs-
  WaitedFor, TestDrainingRepliesCloseTheirConnection,
  TestPagePortClosesWhileDraining.
- Full suite, go test -count=1 -timeout 45m ./..., at 85305a82d (this
  change on 2926b7bef): macOS on mote, 102 packages ok; Linux
  (-tags nogui) in WSL magpie-desktop, 101 ok. Reds:
  - TestAuthLockWaitDoesNotFreezeTheHost, both: this change's
    writeDurable called randomUUID, which the test's sandbox of host.js
    doesn't give. It now names the temp file with Math.random; plugin
    then ok on mote and on Linux.
  - Not this change, filed: TestCappedIsSmall (Linux, #5975),
    TestRequestStateKeptAcrossACatalogFetchedAgain (Linux, #6572),
    TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes (macOS, #7117).
  - Not a red, filed: the macOS log has a recovered "http: panic
    serving ...: close of closed channel" in the doneHold test fake
    (continuation_test.go:781); no test failed on it. It is #6505
    (also filed as #6339 and #6690).
- go vet ./..., GOOS=linux -tags nogui and GOOS=windows go vet ./... ok
  on mote; go vet -tags nogui ./... ok on Linux; gofmt -l clean.
- At the pushed head (rebased on 6e5882109), on mote: go vet (macOS,
  GOOS=linux -tags nogui, GOOS=windows) of gateway, gui, plugin and
  provider ok; go test -count=1 of gui, plugin, provider ok, gateway
  ok but #7117's TestOpenCodeGoOwnFreeModelGetsNothingOfOpenCodes;
  site node --test 135 pass, 0 fail.
- New tests on Windows (win-run): gateway, provider, plugin, gui ok.

Not tried: a real Kubernetes cluster and kube-proxy (the podman harness
stands in for both); a real OAuth plugin's renewal across two pods (the
plugin test uses a fake vendor); an RWX/NFS volume's locks. A stream
that began before SIGTERM and outlasts the drain's 20s still ends with
the old pod. Pods exit 2 on SIGTERM as pid 1 (before this change too).
2026-11-19 16:20:34 +08:00
yetone 6e58821092 provider: WorkBuddy's mover min is 0.2.37, kimi-k3.1-pro's call-only turn
opencode-workbuddy-auth 0.2.37 sends kimi-k3.1-pro (and -highspeed) an
assistant turn with tool_calls and no text with one space as its content.
The model answered such a turn 400 "Invalid request parameters", so dsh,
which records a call-only turn as "content": null, failed on it from the
first tool call on (Gloria335056 on X; the same model on QwenWork,
plugins #1213). keepMovedCurrent brings every moved user's plugin up.

npm view --prefer-online: 0.2.37 is latest.
2026-11-19 15:46:39 +08:00