Commit Graph
8058 Commits
Author SHA1 Message Date
yetone 2f1759c96c usage, catalog: the same catalog fetched again keeps the usage index
A Claude account's model list fetches models.dev again every 45
minutes (catalog.Asked), most often to the same bytes. Each fetch
rewrote models.json, so its mtime changed, and usage keyed its request
index, the index's file on disk (requests-v1.bin, heat, page, effort)
and its priced summaries on that mtime: the next usage query dropped
every chunk and read every session file again. On the acctp history
(15.7k session files) a start that rebuilds takes ~15 s of CPU in its
first 30 s, against ~2 s for one that keeps the index. Each fetch also
forgot the parsed catalog and told every agent to rewrite its list
(catalog.Changed), for nothing changed.

- catalog.CacheKey names models.json and labs.json by a hash of their
  bytes, kept by their stat so a key costs a stat until a file changes.
  Usage's request meta and price key use it in place of the mtime, as
  liveListKey already did for the providers' lists.
- Sync writes models.json and labs.json only when their bytes changed;
  the same bytes are dated now (Stale, Missing and Asked read the time),
  and Reset and Touched run only when either file changed.

Tests: TestSameCatalogFetchedAgainChangesNothing (catalog) and
TestRequestStateKeptAcrossACatalogFetchedAgain (usage). Broken by hand:
with keepFetched always writing, the catalog test is red (told the
agents on the same bytes); with usage keyed on statKey again, the usage
test is red (meta and price key changed).
2026-11-13 17:16:47 +08:00
yetone cc42ec1d7e agent: an api set by hand in Pi's models.json stays (xiaomanweiman on X)
T3 Code's Pi puts all 71 of its tools into the context on
openai-completions and only 3 on openai-responses, loading the rest when
asked. The reporter set providers.magpie.api to openai-responses in
~/.pi/agent/models.json, and the next catalog sync wrote
openai-completions back.

piAPIsKept (pi_api_kept.go), called from piBlockKept (Pi, its forks and
Aside), keeps an api the user set for magpie's provider or for one of its
models. As with a maxTokens typed by hand (output_kept.go), the stash
records the APIs magpie wanted per file (api:<path>:wanted), and an api in
the file that is none of them is the user's. A model's keeps its baseUrl
and compat with it. With no record yet, the provider's is taken as
openai-completions, the only value magpie ever wrote there, so a file
edited before this release keeps the user's value on its first sync. An
api the file lacks is magpie's. A Chat model left on a provider the user
put on Responses gets compat.supportsStrictMode, as magpie's own
Responses models have it (#3055).

magpie's default is unchanged: a model whose provider speaks Chat stays
on Chat, relayed as Pi sent it, and no setting was added.

Run (mote): go test -count=1 ./internal/agent/ ok (322s); go vet
./internal/agent/ for darwin, GOOS=linux and GOOS=windows; gofmt -l clean.
TestPiKeepsAnAPISetByHand covers a value set before any record, set back
by hand, a model's api with its baseUrl, and one taken out.
Broken by hand: with the piAPIsKept call commented out the test goes red
("provider api = openai-completions, want the user's openai-responses").
Not tried: a real Pi or T3 Code (neither is installed here); the full
suite runs after the push.
2026-11-13 17:14:57 +08:00
yetone 37e3d4d45f LESSONS: a95a7a1cd is the ninth core budget raise on 11-13
+397 for per-key price rates; the day is now +3,028 bytes.

Docs only; nothing run.
2026-11-13 17:03:31 +08:00
yetone 5d54a990d4 usage: switched-off providers' accounts can be checked in, and Check in all (wxkwxk666 on X)
wxkwxk666 asked for two things on the Usage page. First, a provider
switched off should still show its accounts, at the bottom and folded,
so they can still be checked in each day. Second, one button should check
in every account at once.

- provider.OffCheckins (off_checkins.go) lists every account a
  checkiner reaches whose provider is switched off (Off, not Hidden).
  Each is a card with no windows. Nothing is read or asked for it. Its
  check-in result is matched by its own key, not by its name, since two
  sign-ins can share a name (plugins#254).
  GET /api/usage/checkins/off serves the list.
- The Usage page (plugins/usage) adds a "Switched off · n" line after
  the cards and the hidden line. It is folded until clicked. Each
  account shows today's check-in, and a Check in button when it isn't
  checked in yet. The button uses checkinnow.js's ciNowSend, which
  POSTs /api/usage/checkin-account.
- Check in all, at the head of the allowances, presses every account
  not checked in today, from the cards and from the switched-off line.
  It sends one checkin-account request per account, three at a time,
  shows "Checking in i/n…", then gives the counts (checkinPressSaid).
  When no account is due, it says so and sends nothing.
- Nothing switches a provider back on. The new strings are in zh,
  zh-TW, ja and de. Plugin files only: app.js is unchanged.
- docs/subsystems/provider-plugins.md says all of this.

Run, on mote:
- TestOffCheckinsListsSwitchedOffAccounts, in the fakeco plugin
  sandbox:
  - nothing is listed before the switch-off;
  - after it, two cards with distinct keys;
  - a press on one checks in exactly that account;
  - the provider stays off;
  - only the pressed card carries a result;
  - nothing is listed once the provider is switched on.
- go test ./internal/provider ./internal/gui, at this commit on
  origin/main 0fda3a1c1: gui ok; provider ok but for
  TestHostBuildsNoList, red on main already (#6479)
- gofmt
- go vet for darwin, linux (-tags nogui, ./...) and windows
- usage-checkin-all.test.cjs, in Chromium and WebKit, at 900 and
  420px, in en, zh, zh-TW, ja and de (20 of 20). It covers:
  - the line is folded, at the end, with its count;
  - opening it doesn't scroll;
  - a row's own press asks for that account only;
  - Check in all shows 0/2 while held, presses only the two due
    accounts, and POSTs nothing else (no provider switched on);
  - a second press asks nothing and says every account is in.
- 187 GUI files (the Usage page, panel, tray, settings and their
  neighbours), at the rebased head on mote: 3080 cases, 104 red in 16
  files. Those 16 run again on mote at origin/main 5a2d0ff47 and at
  this commit, under the same load: the same 12 files are red on both
  (checkin-now-account #6029, codex-auto-reset #4790, key-balance-card
  #6414, menu-scroll #5982, mobile-web #3952, old-webkit #6030,
  quota-refresh-order #6180, tray-cell-click #5215, usage-cards-hide
  #6294, usage-fold #4790, usage-hidden-way-back #6295,
  usage-range-times #6499, filed now). account-eye, i18n-keys,
  last-page and quota-warm pass on both in that rerun.
- That wide run found account-alias and account-eye red on an earlier
  draft: a fixture answering {} for the new endpoint made the page
  spread a non-array. The page now takes only an array.

Broken by hand:
- Without checkinAll's not-due skip, all 20 GUI cases go red.
- Without OffCheckins' check-in result (q.Checkin), the Go test goes
  red at off_checkins_test.go:56.
- Matching results by name (WithCheckins), as an earlier draft did,
  also went red.

Not tried: checking in a real switched-off vendor account through the
real app. The press is the existing CheckInAccount path, the same one
Settings' per-account Check in now already uses.
2026-11-13 16:56:19 +08:00
yetone 0fda3a1c12 cli: provider set resolve.<host>=…, the editor's Connect to from the CLI (quantum_lsfc on X)
v0.1.4012 added Advanced › Connect to (Provider.Resolve) in the GUI
only; the reporter asked for it from the CLI. `magpie provider set <id>
resolve.<host>=<IP or dns:name>[,…]` sets a host's connect addresses,
an empty value takes the host out, and `resolve=` clears them all (any
other resolve= value is refused, never saved). provider.Save checks
them as the GUI's do (netproxy.CheckResolve, TakesResolve), so a bad
place or a vendor's own host is refused with nothing written. `magpie
provider <id>` lists them as "connect". Usage and docs/reference.md say
how.

Run on mote: go test -count=1 ./internal/cli ok (166s);
TestProviderSetResolve ok; go vet ./internal/cli for darwin, linux
(-tags nogui) and windows ok; gofmt -l clean. A nogui build in a
sandbox HOME on mote: provider add + set resolve.api.corp.example=
10.0.0.5,dns:gw.corp.example saved and shown as connect; resolve=oops
and a bad place refused; resolve= cleared it; provider set --help
printed usage.
Broken by hand: not deleting the host on an empty value, and taking a
non-empty resolve=, each turn TestProviderSetResolve red.
Rebased on origin/main 9572a2b4c and run again on mote: the resolve,
Pair and Help tests of internal/cli ok.
Not tried: a request actually dialled through the rule from the CLI
(the dial is the GUI's, covered by netproxy's and provider's tests),
nor the reporter's managed network; Windows and Linux beyond go vet.
2026-11-13 16:39:09 +08:00
yetone a4cd61f77f claude: a turn refused for the account's limit keeps its session till the reset (#6292)
A Claude subscription turn refused for the 5-hour limit before any reply
(429) ended its run through relay's abort, and the conversation's native
session went with it. After the reset the turn was told whole to a new
Claude Code: 354,900 tokens written to the cache again (recih).

Now relay's abort is told the status and words (relayFailing); on a 429
keepForReset shelves a copy of the session cut before the refused turn
(no user line, no synthetic error line), under the turn's key. Cut at
backLine/backMsg for a resumed idle run, or at fromLen (the saved file's
length at start) for a run started from a saved session that has answered
nothing, so a turn refused again while still limited is kept again.

It waits until the reset the refusal names, else the account's used-up
window's reset from the rate_limit_event (KeptClaudeLimits), else 5h; plus
1h, at least idleLongest, at most longestQuota (8d). until goes into
claude-shelf.json, so the entry survives a restart. Shelf still capped at
shelfMost.

Run (on mica; mote was over its cores):
- go test -tags nogui ./internal/gateway/ -run 'Claude|Shelf|Relay|Bridge|Subscription': ok 93s
- new TestClaudeTurnRefusedForTheLimitKeepsItsSessionTillTheReset (print and
  interactive: two refusals, restart, then --resume of the cut session told
  the turn alone) and TestQuotaShelfFor: ok
- GOOS=linux and GOOS=windows go vet ./internal/gateway/: ok; gofmt clean

Broken by hand, each red:
- keepForReset call removed: "try 1: no session kept"
- fromLen forced to 0: "try 2: no session kept"
- fromLen cut at the file's end (refused turn kept): "try 2: the kept
  session isn't the conversation before the refused turn"

Not tried: a real account hitting its real 5-hour limit; Claude's
"resets 9pm" text is still not parsed by resetsAt (the rate_limit_event's
resetsAt covers it). The full suite runs after the push.
2026-11-13 16:36:09 +08:00
yetone 9572a2b4cc LESSONS: three more core budget raises on 11-13, eight in all
6bc0d1e20 +180, 5a2d0ff47 +81 and 287a1ffa2 +225, which put back the
Hermes profiles section 1d60b165c had moved out while the Agents rows
still drew it. +2,631 bytes on the day; #2710 still has no growth rate.

Docs only; nothing run.
2026-11-13 16:31:39 +08:00
yetone a95a7a1cd8 providers: each API key can bill at a price rate of its own (tnt12231 on X)
A relay sells keys in groups that bill at different rates against the
official price (0.5x on one, 1.2x on another) under one endpoint, and
magpie had only the provider's price rate. Now a key can have its own:

- provider.KeyPriceRates, keyed by key id like KeySpendCaps: cloned,
  normalized on save, carried when a key is replaced. A key without one
  bills at the provider's PriceRate. A price the user set for a model
  stands as set, as it does under the provider's rate.
- Usage prices each call at its key's rate (usage.Pricer memoizes per
  key id, BaseKeyPriceIn), so the Usage page, a key's spend cap and its
  typed balance follow it. PriceAt, used to route by price, takes the
  rate of the key the provider holds.
- GUI: the provider editor's Advanced has "Price rate per key" under
  Price rate, shown only with two or more keys, folded past 8 keys like
  the per-key proxies. An empty line shows the provider's rate as its
  placeholder. Save sends keyPriceRates ({} clears, left out keeps).
  The lines, the check and the placeholder live in keyrates.js,
  imported when a provider with two or more keys opens. The core's
  budget goes up 397 for what is left in app.js (the import, the
  draft's copy, Advanced opening for it, the save's line, proxyLines
  drawing another kind of line); app.js stays under its own.
- CLI: magpie provider key-rate <id> [key [rate|default]].
- docs/subsystems/providers-accounts.md: a Key price rates row.

Run, at this head (rebased on 287a1ffa2) through mote-run:
- go test ./internal/usage ./internal/cli ./internal/gui: ok.
  ./internal/provider: ok but TestHostBuildsNoList, red the same on
  origin/main 51b98b1a8 (3 of 3), filed as #6479 (likely 16b8c300f).
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build: ok.
- GUI: key-price-rate.test.cjs (chromium and webkit x en, zh, zh-TW,
  ja, de: own rates saved, provider rate as placeholder, bad values
  refused, comma decimals, {} on clear, a folded key keeps its rate,
  one key shows no lines and posts none), i18n-keys and
  provider-many-keys-proxy (it shares proxyLines): ok. old-webkit:
  keyrates.js added to its on-demand list; its two reds (compat.js
  first, Safari 15.0 styles) fail the same on origin/main 51b98b1a8
  (#5919 and the on-demand list's #6467 family).
- Earlier, at 92bce5c72: the GUI files that reach the provider editor
  (134 tests). The 6 provider-many-keys reds fail the same on that base
  (#6209); proxy-login-fields' chromium zh timeout passes 12/12 alone on
  base and branch (#6374).

Broken by hand: atKeyRate leaving PriceRate as the provider's made
TestKeyPriceRatePrices and TestPricerKeyPriceRates red; the save not
sending keyPriceRates made 20 of 30 key-price-rate GUI tests red, and
keyrates.js dropping each parsed rate made them red again after the
move.

Not tried: a real relay with several keys at different rates; the real
Linux WebKitGTK app. The budget estimate and the Sessions page's costs
still use the provider's rate.
2026-11-13 16:31:24 +08:00
yetone 287a1ffa26 gui: Hermes's other profiles are picked on the one Hermes row again (Norethcy on X)
Norethcy on X, v0.1.4022: "Hermes 其他 profile 的配置消失了,只有默认的
Hermes Agent". 1d60b165c (v0.1.3743) took the connected row's Other profiles
lines out because each profile had a row of its own (hermes#<name>, from
7050da0a4, Norethcy). c96f33d65 (v0.1.3912, geekbb on X) then took those rows
out of the Agents list (Agent.Nested) to keep Hermes one entry, but left the
section out, so from v0.1.3912 a profile's model could be picked nowhere and
the profiles looked gone. The profile:<name> fields were in /api/state all
along (hermesProfileFields, TestHermesProfileModels), the Library still gives
each profile its skills and MCP servers (hermes#<name> through agent.All),
and nothing in any profile's config.yaml was touched.

The opened Hermes row has its Other profiles section again: one line per
profile, its name (a Chinese one as its name), its model picker (the app's
model picker, Default noted as putting back what it had before magpie) and
`hermes -p <id>`. Hermes stays one row, as geekbb asked. The picker note's
hermes# branch is gone: no hermes# row is drawn since c96f33d65.
The "Other profiles" key is back in zh, zh-TW, ja and de.
docs/subsystems/agent-wiring.md says so.

Core script budget +225 (TestCoreScriptBudget): the section was in the core
before 1d60b165c took it out; the Agents rows draw it, so there is no lazy
page to move it to, and it is packed to the shortest form.

Run on mote (the GUI files at the tree before the rebase onto
origin/main 51b98b1a8; at the pushed head again where named):
- hermes-profiles.test.cjs (restored from before 1d60b165c, plus a profile
  named in Chinese whose hint is its id): chromium + webkit, en/zh/zh-TW/ja/
  de, 1100 and 560px, 20 of 20 green.
- Broken by hand: origin/main's app.js with this test: 20 of 20 red.
- go test ./internal/gui at the pushed head: ok (TestCoreScriptBudget was
  red before the pack and the raise). hermes-profiles, hermes-profile-row
  and i18n-keys at the pushed head: green. go test ./internal/agent -run Hermes: ok.
- GUI files hermes-*, agent-*, i18n-*, click-scroll in both engines
  (64 files, 1082 cases): 1027 pass, 55 red, all in agent-details-ready
  (#6373, #6369), agent-switch-accounts (#5925) and agent-menu-label
  (#6371); the same 55 are red on origin/main 51b98b1a8 run alone.
Not tried: a real Hermes install with several profiles in the real app;
Linux WebKitGTK; Windows. No Go code changed outside the budget constant.
2026-11-13 16:22:51 +08:00
yetone 51b98b1a85 model efforts: a relay listing no levels says where magpie's come from, and a set that changes nothing says so
@czhhcz on X (magpie 0.1.4016, Claude Code, a third-party relay): the
relay's /v1/models gives a Claude model `reasoning_levels: []`, yet
`magpie model efforts` lists five levels for it, and setting every level
was "silently dropped"; only hand-editing modelEfforts worked.

What happens: a custom relay that names no levels for a model gets the
model's own levels from models.dev (borrowedEfforts), and the gateway
fits requests to them, so Claude Code's max and xhigh already reach the
relay as asked (TestRelayListingNoLevelsStillGetsTheAgentsEffort). A set
of every level is the default, so nothing is saved, but the CLI printed
"✓ … offers every level it has" as if it had changed something; the
hand edit changed nothing either. An empty list stays "unknown", not
"none": magpie writes [] itself for levels it doesn't know.

- provider.KnownBorrowed(model) says when a model's levels are borrowed.
- `magpie model efforts` prints, for such a model, that the provider's
  list names none and these are the model's own from models.dev, and
  that `off` sends no reasoning field.
- ChangeModelEfforts / ChangeModelSpec report whether anything changed.
  A set that changes nothing prints "· nothing changed" with what it
  already offers, and no ✓.
- Sibling: `magpie model spec --reasoning` printed "✓ saved" over the
  same no-op; it now says nothing changed.
- GUI: its level chips show the current state, and ticking every level
  is the default, so nothing is sent; no silent-drop path, unchanged.

Run on mote: go test ./internal/cli ./internal/provider (whole packages);
go test ./internal/gateway -run 'Effort|Reasoning|Relay|Adaptive|Spec';
go vet, GOOS=linux -tags nogui and GOOS=windows go vet of the three packages; gofmt -l.
New tests: TestModelEffortsOfARelayThatListsNone (a httptest relay with
reasoning_levels: [] in a sandbox HOME) and
TestRelayListingNoLevelsStillGetsTheAgentsEffort.

Broken by hand, each red: the no-change check skipped (✓ printed again),
the borrowed line left out of the listing, and spec's "saved" forced.

Not tried: a real relay; the GUI suite (no GUI file changed).
2026-11-13 16:10:47 +08:00
yetone 5a2d0ff478 claude-desktop: Use Claude Magpie, a twin on magpie in one click (xMopf7RF on X)
xMopf7RF asked for the Separate app to be reached like a phone's app
twin: one button that makes a second Claude Desktop on magpie and leaves
their own Claude Desktop as it is. Claude Desktop's row, while it isn't
on magpie and Desktop can run so (macOS), now has "Use Claude Magpie":
it turns the Separate app on (settings/desktop-isolated) and then
connects Desktop, so only Claude-Magpie-3p is wired, and says to open
Claude Magpie from Applications. The order matters: connecting first
would wire the user's own Desktop.

The button is drawn by claudemagpie.js with the fold; app.js keeps the
one line that places it, so the core budget goes up by 81.

Run, at this commit:
- TestCoreScriptBudget; gofmt clean.
- GUI on mote, Chromium and WebKit: desktop-twin (five languages, 1100
  and 640px: the posts in order, the status, the button gone after, no
  scroll, no native select; no button without the Separate app),
  desktop-isolated-claude, desktop-isolated, i18n-keys, i18n-en-no-cjk,
  old-webkit (its two reds are on origin/main, #6467, #5919), and every
  agent*/desktop*/claude* GUI file; its reds are all on origin/main
  (#6467, #5919, #6373, #5925, #6179, #6371, #6475).

Broken by hand: connecting before turning the Separate app on turns
desktop-twin red (the post order).

Not tried: clicking the button in a real Desktop; the two calls it makes
are the ones the commit before ran for real (launcher add, then claude-
desktop magpie, in a sandbox HOME on mote).
2026-11-13 16:02:12 +08:00
yetone 6bc0d1e203 claude-desktop: Claude Magpie's Code tab on a Claude Code folder of its own (#6459)
The Separate app (Claude Magpie.app, #5671) kept its own Desktop
userData, but its Code tab's bundled Claude Code still read and wrote
the user's ~/.claude: their CLAUDE.md, skills, plugins and history went
into the twin, and the twin's sessions into theirs (xMopf7RF on X).

An opt-in, macOS-only switch under the Separate app's Advanced fold
(settings.DesktopIsolatedClaude, POST /api/settings/desktop-isolated-
claude, `magpie claude-desktop launcher claude-dir on|off`) gives it
~/.claude-magpie-desktop:

- desktopiso.Script exports CLAUDE_CONFIG_DIR in the app's launch
  script; turning the option on or off remakes the app, and the hint
  says to quit and reopen Claude Magpie, since a running one keeps its
  environment.
- desktopOn writes Desktop's model windows, caps and explore entries
  into that folder's settings.json instead of ~/.claude's while it is on
  (desktopCodeDir, desktopClaudeSync); off moves them back. The folder
  is kept when it is turned off, and shows as the claude# row "Claude
  Code · Claude Magpie".
- The fold is drawn by claudemagpie.js, imported the first time it
  shows; what stays in app.js is the import (isoLazy) and the fold's
  place, 216 bytes, so the core budget goes up by 180 (the 36 of room
  there was taken first).

Run:
- gofmt -l clean; go vet ./internal/... on darwin, GOOS=windows and
  GOOS=linux -tags nogui vet of agent, cli, desktopiso, gui, settings,
  settingsapi (mote).
- go test agent, cli, desktopiso, desktopdir, settings, settingsapi,
  gui, library on mote: all ok except cli's three healthcheck/update
  tests, which ask the gateway mote's own magpie serves on :3425
  (#6223, the same with or without this change).
- TestCoreScriptBudget and TestSettingsSaveKeepsWhatItDoesNotSend at
  this commit and the next.
- GUI on mote, Chromium and WebKit: desktop-isolated-claude (five
  languages, 1100 and 640px), desktop-isolated, i18n-keys,
  i18n-en-no-cjk, old-webkit, and every agent*/desktop*/claude* file
  (98 files, 1,595 of 1,662 pass). Every red is the same on origin/main
  92bce5c72 run alone: old-webkit (#6467, #5919), agent-details-ready
  (#6373), agent-switch-accounts (#5925), claude-quota-onboarding
  (#6179), agent-menu-label (#6371), desktop-tiers Chromium (#6475).
- A real Claude Desktop on mote in a sandbox HOME (~/sb6459, removed
  after): `claude-desktop magpie`, `launcher add`, `launcher claude-dir
  on`. The window and caps moved into .claude-magpie-desktop/
  settings.json, ~/.claude kept only its theme, the script exported
  CLAUDE_CONFIG_DIR, and the launched Desktop's main process and
  children had it in their environment. `claude-dir off` moved them
  back and dropped the export; `launcher remove` removed the app.
  mote's real ~/.claude was listed before and after: unchanged.

Broken by hand:
- desktopOn without the clone-folder branch: TestClaudeDesktopIsolated
  ClaudeDir red (the window stays in ~/.claude).
- The fold without its ontoggle: desktop-isolated-claude red ("shut by
  the redraw").
- settingsapi not keeping the field: TestSettingsSaveKeepsWhatItDoes
  NotSend red.

Not tried: a Code-tab session driven in the real Desktop's UI, so
bundled Claude Code writing into the folder was not seen in this run
(an earlier look at #6459 saw it). Library has no targets for the
clone's folder yet (#6469). The whole GUI suite (1,484 files) was not
run; the files on the Agents page and every i18n file were.
2026-11-13 16:02:12 +08:00
yetone daaa11cb53 update: the clock's check leaves a waiting download alone (iiiiiimone on X)
"With magpie my proxy's traffic is far higher than usual." An idle
`magpie web` (a released v0.1.4000 build, sandbox HOME, no accounts, every
request through a counting proxy, 25 minutes in WSL) sent 89.4 MB: 88.6 MB
of it the update download from usemagpie.ai, 0.7 MB models.dev's catalog
(daily), ~80 KB the update feed and notes. Nothing else.

The download is the waste. With a version downloaded and waiting for a
restart, every check by the clock (every 6 hours by default, 30 minutes
at the shortest) found a newer one, as magpie releases 100 to 160 times a
day, and downloaded it whole (37 to 95 MB by platform) in place of the
one waiting: up to ~380 MB a day by default on Windows and ~4.5 GB at 30
minutes, for an app left running, all over the user's proxy.

Now the clock's check keeps the version waiting, as Settings'
NoAutoDownload already did. Nothing is lost: every restart into it asks
the feed first (recheck, the autorestart's waitRecheck) and fetches the
newest then, quitting puts in the one waiting, and a check asked for
(Settings' Check, Download update) still downloads the newest. With
nothing waiting the clock's check downloads as before.

Run:
- TestUpdateClockLeavesWaitingDownload (new): three clock checks with
  newer versions out keep 0.1.11 and one download; recheck and a check
  asked for each fetch the newest.
- go test ./internal/gui (nogui, CGO off) in WSL magpie-desktop at
  b883bd44e (rebased on 92bce5c72): ok.
- go test -run TestUpdate ./internal/gui on Windows (xiaomi-gpu): all
  pass but TestUpdateThatWontStart, which is red the same at origin/main
  5a48a4251 and is #6059.
- Broken by hand: without `|| u.byClock` the new test is red ("0.1.12
  out: ... Latest:0.1.12 ..., 2 downloads").

Not tried: the macOS run (mote was over its load the whole time, mica's
disk is full); the full suite follows on mote. Traffic of a signed-in
magpie (usage reads per account) was not measured: the sandbox had no
accounts.
2026-11-13 16:01:55 +08:00
yetone 1c6dc247ed codex: the Codex app restarts once for magpie's list named after it started (not_4O4 on X)
not_4O4 (X, magpie 0.1.4012, Windows): the ChatGPT app's Work tab
listed GPT alone, in a new window and in a new project on D: too.

The app-server reads model_catalog_json only as it starts. codex-rs
app-server model_catalog.rs reloads only when needs_reload is set,
which happens on an account change alone. The app keeps one
app-server for all its windows, and on Windows it runs from login
(StartupTask). So a list magpie named after the app-server started
never reached the picker. That happens when the list first becomes
known (the backend answering, or the models_cache stand-in from
327da691a) or when Codex moves from WSL to the Windows config.
magpie's restart follows only the route (codexAppRoute), and the list
is kept out of the route on purpose (#4550). On Windows StaleCopies
reports no app copy, so no Restart was offered either.

Now deskList stashes when it names the key (codex.desk_at, Agent.DeskAt,
provider.CodexAppDesk). codexAppDeskStep marks the app's app-servers
that started before that time as stale, once for each naming, and they
are ended at idle like a Connect's, with RestartApp off too. The time
is kept while the key is taken out and named again in one change (a
model picked in magpie, a reset), and dropped once deskList takes the
list out as not wanted. Left alone:
- an app-server whose start can't be read;
- the takeover's, where the reset names the list again as it ends, in
  the same look or a later one (c.back) (#4550);
- a new list written into a file already named.

Run:
- Real Windows app-server (OpenAI.Codex 26.1106, codex-cli
  0.167.0-alpha.4.1, sandbox CODEX_HOME, cwd D:\cxproj): model/list,
  then model_catalog_json written, config/read, model/list on the same
  process: still the 12 GPT models. A fresh process listed magpie's.
- win-run: TestCodexDesktopList* in internal/agent ok. A temporary
  test started the Store package's codex.exe app-server: codexAppServersOn
  listed it, and codexServerStart read its start; the test file was not
  committed. TestCodexAppRestartedForTheListNamed ok.
- mote (load 25-33 over 18 cores; mica's disk full):
  TestCodexAppRestartedForTheListNamed, TestCodexAppLeftRunning*,
  TestCodexAppServer*, TestCodexAppSwitch*, TestCodexAppCrash*,
  TestCodexDesktopList* ok. go vet for darwin, windows and linux on
  internal/agent and internal/provider: ok.
  go test ./internal/agent ./internal/provider: internal/agent ok;
  internal/provider red at TestWalletCapHolds only, a midnight
  boundary on mote's clock unrelated to this change, filed as #6474.

Broken by hand, each red:
- the desk step marks nothing stale: ended [], want [60];
- no takeover guard: ended [102] at the reset;
- no c.back guard: ended [103] a look after the reset;
- a new time at each naming: TestCodexDesktopListNamedAt red at the
  magpie model pick.

Not tried:
- the real ChatGPT app's window on Windows: ending its app-server and
  watching the picker list magpie's models. ssh sees no interactive app.
- A key named by a magpie before this one has no time, and nothing is
  restarted for it. Restarting then would restart every running Codex
  app once at the update, the ones that work too. Such a user quits
  the app once.
2026-11-13 16:01:06 +08:00
yetone 11be6acd4d LESSONS: the advisor route skipped a key's models (db9a5ec7c, 0b38eb21c)
A second day for "a restriction covers every route": the served advisor
asked a caller-named model as magpieChose, so a key held to some models
reached others; two tags shipped it before 0b38eb21c fixed it and the
native advisor's older gap.

Docs only; nothing run.
2026-11-13 16:00:20 +08:00
yetone 16b8c300fe provider: a Gemini compatible URL saved as a bare host is asked at its /v1beta (equinox0253 on X)
cc0d9c8b0 kept a relay's root typed under "Gemini 兼容" as typed, where it
was saved as …/v1beta before, and requests went to the saved base as it
was. So WandAPI's https://api.wandapi.ai was asked
/models/gemini-3.8-flash:streamGenerateContent?alt=sse with no version, and
the relay refused it (the tweet's second screenshot: Claude Code's
/v1/messages → Gemini, 503).

The saved base stays as typed, and the version is added where a request
goes: provider.GeminiAsked gives a bare host /v1beta, as Google's SDKs add
it to a base_url with no path, and keeps a base with a path of its own
(/v1beta, a relay's /gemini, /proxy/v1) as typed. Base(Gemini) returns it,
so the gateway's requests, the native route and the model list
(catalog.FetchGemini at Base) all take it; a model's test (provider/test.go)
read p.Gemini directly and now reads Base(Gemini) too. The Google preset's
bases already carry /v1beta and are unchanged. docs/subsystems/
providers-accounts.md said GeminiBase adds /v1beta to any bare host, true
before cc0d9c8b0; it now says where the version is added.

Run (mote, -tags nogui, on 5a3f055d7 at origin/main 92bce5c72): the new
TestGeminiBareHostAskedAtV1beta (a fake upstream that answers only at the
expected path; bare host, bare host with a slash, /v1beta, /gemini) red on
the old code (asked /models/gemini-3.8-flash:…, 404), green after; the new
TestGeminiAsked; go test ./internal/gateway ./internal/provider -run
'Gemini|Vertex|OpenCode' ok; go vet darwin, linux, windows on provider,
gateway, catalog; gofmt clean.
Broken by hand: Base(Gemini) and the model test back to p.Gemini: both new
tests red.
Rebased on origin/main 0b38eb21c and run again there (mote, -tags nogui):
go test ./internal/gateway ./internal/provider ./internal/catalog -run
'TestWrongEndpoint$|TestNoChannel|Gemini' ok.
Not tried: a real WandAPI account; the full suite runs after the tag.
2026-11-13 15:59:26 +08:00
yetone 0af0aa1489 catalog: a relay's refusal that names the entry protocol (入口协议) sends the model to the next API (equinox0253 on X)
25ac5a6f6 made WandAPI's 404 "模型 gpt-6.1-sol 不支持当前入口协议" a wrong
endpoint, so gpt-6.1-sol went on to the relay's Chat URL. For gpt-6.1-terra
WandAPI answers Claude Code's /v1/messages with other words, 404
not_found_error "当前没有能承接该入口协议的货源,请联系管理员为端点补充入口
格式或配置协议适配。" (181 bytes, the tweet's screenshot), which matched
none of the three phrases, so the 404 went to the client and the model was
never asked on the relay's next API.

The class: "入口协议" is WandAPI's word for the API a request comes in on,
and any refusal that names it is about that API. catalog.WrongEndpoint now
matches the word itself in place of the three "不支持…入口协议" phrases.
A 404 for a wrong base URL ("404 page not found") or a missing model ("模
型 X 不存在", OpenAI's "does not exist") never names it, and those stay
plain 404s (cases kept in TestWrongEndpoint and TestNoChannelAs404FromAFork).
The same function serves the gateway's fallback and a model's test
(provider/test.go), so both take it.

Run (mote, -tags nogui, at origin/main 92bce5c72): go test ./internal/gateway
-run 'TestWrongEndpoint$|TestNoChannel' ok; go test ./internal/catalog ok.
Broken by hand: with the old "不支持当前入口协议" in place of the word,
TestWrongEndpoint and TestNoChannelAs404FromAFork's gpt-6.1-terra case are
red (the 404 reached the client as "Relay: 当前没有能承接该入口协议的货源…").
Rebased on origin/main 0b38eb21c and run again there (mote, -tags nogui):
go test ./internal/gateway ./internal/provider ./internal/catalog -run
'TestWrongEndpoint$|TestNoChannel|Gemini' ok.
Not tried: a real WandAPI account.
2026-11-13 15:59:26 +08:00
yetone 0b38eb21c3 gateway: Claude Code's advisor is held to the calling key's models
A gateway key held to some models (#882) could reach any other model
through Claude Code's advisor tool, which names a second model inside the
request:

- served advisor (advisor_serve.go, db9a5ec7c): advise() asked the advisor
  model under magpieChose, which drops the key's models list because magpie
  picked the model from its settings. Here the caller named it, so it is
  now asked as the caller and the key's models and limits hold it; a
  refused model comes back as an advisor_tool_result_error.
- native advisor (advisor.go, pre-existing): any same-provider Claude
  model passed upstream as the advisor for a held key. advisorTools now
  takes keyAllows(r, p) and leaves out an advisor whose model the key may
  not use (by magpie's id, the bare Claude id, and with [1m]).

Run (on mote; load ~36, mica out of disk):
- go test ./internal/gateway -run 'Advisor|Advised|KeyModels|Key' ok
- broken by hand (magpieChose back, nil allowed): both new tests red
  (advisor asked 1 time; advisor sent upstream for 3 of 3 refused cases)
- go vet darwin, GOOS=windows, linux nogui: ok; gofmt clean
Not run: the full suite.
2026-11-13 15:54:06 +08:00
yetone 92bce5c724 remote magpie: a request under way takes the address saved now
le13ure on X: after the LAN address of a magpie used as a Remote magpie
provider changed and the user edited it in the provider, requests already
under way kept retrying the old address instead of switching.

Each request held the Provider it started with, and its retries (the
same-one pauses up to 8s, a group's and a provider's patience up to 30s)
asked that copy's address again. The look for a moved magpie
(SeekMoved, v0.1.3177) ran at most once a minute, so other requests
within the minute got nothing from it and kept the stale address. And a
dial to a LAN address no one holds now waited on the OS (~75s macOS,
~127s Linux) per try.

- provider.Readdressed: a Remote magpie copy moved onto the address saved
  now. The gateway's try loop asks it before each try; SeekMoved returns
  it when another look or the user saved one.
- provider.Edited: store() signals every save; a pause between tries
  (pauseAlive, new pauseUntilReaddressed) ends when the waiting Remote
  magpie's address changed, so the next try goes at once.
- netproxy: Dispatch's transports give a dial to a private or link-local
  IP literal 5s (lanDialCap). Names, public, CGNAT/Tailscale untouched.
- docs: providers-accounts "A remote magpie that moved".

Run (mote, nogui, at this tree): go test ./internal/netproxy
./internal/provider ./internal/gateway -run
'TestLANDial|TestLAN|TestDispatch|TestRemoteMagpie|TestPauseEnds|Patience|Replan'
ok; go vet of the three packages for darwin, linux and windows ok;
gofmt -l clean. mote was at load ~28 over its 18 cores (mica's disk is
full), so timings ran slow.

Broken by hand, each red: lanDialCap off (TestLANDialGivesUp, "no
deadline"); Readdressed out of SeekMoved
(TestRemoteMagpieSavedElsewhereIsTaken); the loop-head Readdressed off
(TestRemoteMagpieRetryGoesToTheSavedAddress, 503 from the old address);
the Edited wake out of pauseUntilReaddressed (TestPauseEndsWhenReaddressed,
the pause ran its full 30s).

Not tried: a real two-computer LAN move; the full suite before the push
(started after it).
2026-11-13 15:32:20 +08:00
yetone db9a5ec7c4 gateway: Claude Code's advisor runs in magpie for a model whose upstream can't (Awad_Yoo on X)
Claude Code 2.1.316 sends its advisor (/advisor, settings.json's
advisorModel) for any model when CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL
is set: an advisor_20260301 server tool, which only Anthropic's server
runs. Until now magpie left it out for every other upstream (b6fae8efd).

Now, when the advisor model is one magpie serves and the upstream can't
run it (not a Claude model on Anthropic's API with a same-provider Claude
advisor, which keeps the native passthrough), magpie runs it:
- the model is offered an "advisor" function tool with no parameters;
- a call is answered by asking the advisor model, through magpie's own
  routing, with the conversation so far and a short ask after it (up to 3
  calls a reply, then max_uses_exceeded, as Anthropic answers);
- the client gets the server_tool_use and advisor_tool_result blocks
  Anthropic writes (advisor_tool_result_error with its error_code on a
  failure), and the history Claude Code echoes back is read as a call and
  its result.
Claude Code's system prompt, identity text and its own advisor
instructions go upstream as it wrote them; nothing about the advisor is
added to the prompt beside the tool's neutral description.

Claude Code's agent row gets an Advisor line under Tiers, after Auto
mode, default Off: picking a model writes advisorModel and the env switch
(only when the user hasn't set it themselves); Off removes both, and so
does disconnecting. CLI: magpie claude advisor <model|default>.

Run (on the Linux box, xiaomi-gpu magpie-desktop, at this head; mote was
over its load the whole time and mica's disk is full):
- go vet ./internal/gateway ./internal/agent, and with GOOS
  linux/windows/darwin (CGO_ENABLED=0); gofmt -l clean
- go test ./internal/gateway -run 'Advisor|Advised|Search|Anthropic': ok
- go test ./internal/agent -run Claude: ok
- node --test claude-advisor, claude-auto-mode, i18n-keys,
  i18n-en-no-cjk (Chromium + WebKit, en and zh, 1100 and 560px): 24/24
- TestCoreScriptBudget measured by its own rule: app.js 1,084,341 of
  1,086,267, core 1,267,726 of 1,267,762 (no raise)
- Real Claude Code 2.1.316 in a sandbox HOME/CLAUDE_CONFIG_DIR against a
  sandbox `magpie serve` (darwin nogui build of this tree) with only the
  DeepSeek provider: `magpie claude advisor deepseek/deepseek-v4-pro`
  wrote advisorModel + the env; `claude -p --model deepseek/deepseek-flash`
  asked to consult the advisor got text, server_tool_use (srvtoolu_…),
  advisor_tool_result with deepseek-v4-pro's advice (usage row: v4-pro
  11,205 in / 221 out), then its answer quoting it. A --resume turn sent
  that history back and completed.

Broken by hand:
- advisedHere returning false: TestAdvisorServedForAVendorModel,
  TestAdvisorHistoryGoesBackAsACall, TestAdvisorFailureIsAnErrorCode,
  TestAdvisedHere and TestAdvisorModelAsTheUpstreamNamesIt red.
- the env write left out of the advisor field's Set:
  TestClaudeAdvisorModel red.

Not tried: the interactive TUI's /advisor picker (only -p and the
settings.json route); an advisor on a Chat-only or Responses upstream
with a real account (the fake upstream in the tests is Chat); an advisor
call in the same round as a client tool call, which is dropped as a
search call is. Seen on the way, not changed: in the fresh sandbox,
Claude Code's own "sonnet[1m]" default resolved to sonnet-4-5-20250929
rather than ANTHROPIC_DEFAULT_SONNET_MODEL without --model.
2026-11-13 15:31:06 +08:00
yetone e5c793ebb1 provider: the workbuddy mover's min is 0.2.33 and cursor's 0.2.46
workbuddy 0.2.33 streams the free window's routing read a line at a
time, so a big routing day no longer takes hundreds of MB (plugins
#1077, easonlao). cursor 0.2.46 words a quiet Run's error so Pi
retries it (plugins #1075, wuuli). Both are on npm
(npm view --prefer-online, 07:21 UTC 11-13); keepMovedCurrent brings
every moved user up.

Run (WSL, mote over its load): gofmt -l and go vet on
internal/provider, go test -run 'Mover|Moved|Migrat|Min|Plugin'
./internal/provider ok. Not run: the full suite; nothing but two min
strings changed.
2026-11-13 15:23:22 +08:00
yetone 507d612340 mcpauth: an MCP server's sign-in page is opened only when it is a web page
A sign-in to an MCP server opens the authorization_endpoint its metadata
names, and the GUI handed that URL to the system (open / xdg-open /
rundll32 url.dll,FileProtocolHandler) without looking at its scheme. A
server the user added in the Library could name file:///…/Some.app, a
file://\\host\share\x.exe UNC path, smb:// or an app's scheme, and
pressing Sign in would launch, mount or hand off what the server chose.
/api/open already kept to http(s); this path skipped it.

- mcpauth.WebURL: http or https with a host. start refuses any other
  authorization endpoint before a flow (and its callback listener) exists.
- gui.openMCPSignIn checks it again before OpenURL, so a State that
  didn't come through start is still not opened.

Test: TestAuthorizeEndpointIsAWebPage (file:, UNC file:, smb:, vscode:,
javascript:, https with no host) — red with the check turned off by hand
(the sign-in started at file:///System/Applications/Calculator.app?…),
green with it.

Run (mote; mica's disk is full, mote at load ~33, small run only):
go test -count=1 ./internal/mcpauth/... ok; go test -run
'MCP|SignIn|Library' ./internal/gui ok; go vet darwin ./internal/mcpauth
./internal/gui, GOOS=windows, GOOS=linux -tags nogui ok; gofmt -l clean.
Not run: the full suite.
2026-11-13 15:22:32 +08:00
yetone 5a48a4251c edit: a TOML file's kept table names share one buffer (#2278)
TOMLTables' answer is kept for as long as magpie runs (tomlAnswers),
and Codex's config.toml names a table for every project it trusted,
~11k on a long history. setNames cloned each name on its own: one
allocation a name, rounded up to its size class, all scanned by every
GC. They are now copied into one buffer and sliced from it; they still
hold nothing of the file's text.

Measured on mote, 11k names like projects."/Users/…/p-N", HeapAlloc
and HeapObjects kept, separate processes, twice each:
  before: 841,680 B, 10,994 objects
  after:  ~715,000 B, 2 objects
-15% bytes, 11k fewer objects for the GC to scan.

Run on mote: gofmt -l, go vet ./internal/edit, go test ./internal/edit
(TestKeptNamesArePacked: names equal, none points into the source
text, packing takes 2 allocations, nil stays nil).
2026-11-13 15:18:39 +08:00
yetone a814ee9907 provider: Devin's plugin min is 0.1.40, with an API key sign-in (wuxudongxd on X)
opencode-devin-auth 0.1.40 (magpie-community/plugins aea9438f) adds
"Devin API key (cog_…)": a key typed in, such as a service user's cog_…
key, saved as {type:"api", key} and sent to chat and usage as a sign-in's
token is. Before it, the plugin offered only the browser and CLI
sign-ins, and the reporter had to write the entry by hand.

Run: go test ./internal/provider -run 'Mov|Min|Plugin|Devin' on mote (ok);
the plugin's own bun test (214 pass) and the plugins repo's whole bun
test with a temp HOME (8542 pass, 0 fail). The registry lists 0.1.40 as
latest. The publish run is red only for middleware-system-prompt and
middleware-think-tags, whose trusted publisher isn't set (plugins#180).
Broken by hand: in the plugin, with the new methods removed, its method
tests go red. The min itself is a version string, with nothing to break.
Not tried: a real cog_ key (none on hand).
2026-11-13 15:14:14 +08:00
yetone f3ad175fb2 library: an MCP server's sign-in keeps to its link when Settings say so (hkxhkxhkx on X)
hkxhkxhkx asked for magpie never to open OAuth pages in the browser on
its own. Settings › Privacy › Sign-in pages › "Open sign-in pages in the
browser" (signInLinkOnly, since a45a0f1c5) already does that for every
account's sign-in, built-in and plugin, in the window, a web tab and the
command line (`magpie accounts add`, a plugin's login; `magpie settings
set signInLinkOnly true` sets it there). Audit of every route that opens a
sign-in page: the one it missed is an MCP server's OAuth sign-in from the
Library, which /api/library/mcp-signin opened in the default browser
whatever the setting. The TUI starts no sign-in; `magpie web` opens
magpie's own page (it has --no-open), not a vendor's.

Now /api/library/mcp-signin goes through openMCPSignIn: with the setting
on it opens nothing and answers linkOnly. The Library opens no tab of its
own on linkOnly (web), opens the server's editor from a row's sign-in, and
shows the same words as an account's link-only sign-in, the link with Copy,
and Open in browser. No new strings.

Still opened whatever the setting: a plugin whose own sign-in opens the
page or a Chrome window (Grok Build's CLI on macOS and Windows; agnes,
inkstone, astudio, mclaw, sensenova drive Chrome to sign in).

Run (Linux, magpie-desktop via wsl-run; mote was over its load the whole
time with eight full suites queued, mica's disk full):
- TestMCPSignInLinkOnlyOpensNothing (new), TestSignInLinkOnlyOpensNothing,
  TestMCPSignInSaysTheBrowserDidntOpen, TestOpenSignInLinkOnlyAsked,
  TestCoreScriptBudget, TestI18n* (-tags nogui): ok.
- mcp-signin-link-only.test.cjs (new; en, zh, zh-TW, ja, de; desktop and
  web; 1100 and 420px; Chromium and WebKit) with signin-browser-down,
  mcp-signin, mcp-signin-click, mcp-accounts, signin-link-only and
  i18n-keys: 146/146.
Broken by hand: the route back on openError, the new Go test red ("its
page was opened 1 times"); client.js back to main's, the new GUI test red
(no link-only note).
Not tried: a real MCP server's sign-in in the app; the whole GUI suite;
the full Go suite before the push (started after it).
2026-11-13 15:13:13 +08:00
yetone 18b46f5c25 sessions: the Kimi desktop app's Work calls reach Usage
CNSA0422 on X: magpie didn't count local usage from the Kimi desktop
app. Its Work agent is Daimon, which runs the Kimi Code runtime it
vendors with its own home under the app's share folder, so its calls
are written as Kimi Code's usage.record lines in a folder magpie never
looked in.

Read from Kimi 3.2.27's own bundle (com.moonshot.kimichat, Daimon
1.0.10, Kimi Code runtime 0.5.1): the app passes KIMI_SHARE_DIR, which
is <userData>/daimon-share or the absolute shareDir in
<userData>/daimon-storage.json; Daimon alone falls back to ~/.kimi.
The sessions are <share>/daimon/runtime/kimi-code/home/sessions/<slug>/
<id>/agents/<agent>/wire.jsonl. userData is kimi-desktop under
~/Library/Application Support, %APPDATA% or ~/.config.

- kimi_work.go finds the shares and adds their wire files to Kimi
  Code's ("kimi"), as MiniMax Code Desktop's count as MiniMax Code's.
  Found() lists kimi when only Work sessions exist.
- A record's model is Daimon's alias (daimon-kimi-code). It is read
  as the alias's model in the runtime's config.toml (k2p6-agent).
- magpie's kimi-desktop plugin points the alias's provider at a bridge
  on 127.0.0.1 that forwards to the gateway, which logs those calls.
  A call whose alias's base_url is a loopback address is skipped, so
  it is not counted twice. config.toml is the current setting only,
  so history read for the first time is judged by it.
- docs/subsystems/gateway-sessions.md says so.

Run (mote): go test ./internal/sessions -count=1, ok;
go vet ./internal/sessions for darwin, windows, linux -tags nogui, ok.
Windows (xiaomi-gpu, win-run): go test ./internal/sessions
-run 'KimiWork|Loopback|KimiCode', ok. gofmt clean.

Broken by hand: kimiCallFiles without the Work files made
TestKimiWorkCalls red (no calls), and so did dropping the loopback skip
(the bridged call counted). Restored, green.

Not tried: a real Kimi Work session. This computer has no Kimi desktop
data, so the fixture's records are the Kimi Code format the bundle's
UsageRecord writes and its config.toml is what modelToToml builds. The
Windows installer was not unpacked: the Windows path is Electron's
userData as the bundle's code reads it. k2p6-agent has no price in the
catalog, so these calls show tokens and no cost.
2026-11-13 15:12:46 +08:00
yetone 15500d4378 gateway: Gemini 4 Hydrogen keeps xhigh on Gemini's own API
withGeminiEffort capped every Gemini at high, since no Gemini before took
more. Gemini 4 Hydrogen takes XHIGH (Google's model page: LOW, MEDIUM,
HIGH, XHIGH), so an agent asking xhigh or max on the native Gemini path
got high. A level above high now goes to the nearest the catalog lists
for the model (catalog.EffortsOf), and stays high for a model that lists
none above it or isn't in the catalog. The translated Vertex path already
fitted the level from the same metadata.

Run (mote): go test -tags nogui ./internal/gateway -run
'GeminiEffort|VertexEffort|Vertex' and the vet runs of the commit before.
Broken by hand: decide.go reverted, TestWithGeminiEffortAboveHigh red
(hydrogen at xhigh and max: high, want xhigh).
Not tried: a real Hydrogen request.

Rerun after rebasing onto origin/main 96558cfde: go test of provider,
gateway and catalog -run Vertex|GeminiEffort|Preset|Effort, ok on mote.
2026-11-13 15:06:26 +08:00
yetone 51c3ecc573 vertex: Gemini 4 Carbon and Hydrogen in the preset, and Gemini 4 at us and eu (#6452)
Google Vertex AI's model list lacked gemini-4-carbon (released 2026-11-10)
and gemini-4-hydrogen (2026-11-12); SunsetBirdW and T_t__biu on X, #6452.
Google's model-versions page lists both ids, and each model's page lists
PayGo at global, us and eu, as Argon's now does too, so the us/eu list
gains all three Gemini 4 models.

Their window, output, prices and thinking levels come from models.dev's
google-vertex entry as for every Vertex model, which matches Google's own
pages today: Hydrogen 1,048,576 in / 65,536 out, $1.50 / $0.075 cached /
$7.50 at global, levels low to xhigh; Carbon 1M / 65,536, $2 / $0.10 / $10,
levels low to high. The provider test asks both at thinkingLevel low.

Run (mote): go test -tags nogui ./internal/provider ./internal/gateway
./internal/catalog -run 'Vertex|GeminiEffort|Preset|Effort'; go vet ./...,
GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; gofmt -l.
Broken by hand: presets.go reverted, TestVertexProviderListed red (no
gemini-4-carbon/hydrogen at global); vertex.go's us/eu list reverted, red
at us and eu.
Not tried: a real Vertex project (no Google credentials here). Carbon and
Argon go to $4 / $0.20 / $20 on 2026-12-01 (Google's pricing page); the
price comes from models.dev and follows it when it changes. The bundled
offline catalog (2026-11-10) has neither model until it is refreshed.

Rerun after rebasing onto origin/main 96558cfde: go test of provider,
gateway and catalog -run Vertex|GeminiEffort|Preset|Effort, ok on mote.
2026-11-13 15:06:26 +08:00
yetone 96558cfde6 agent: Codex thread tables are written only for ids magpie can own
JsonParser (X) found [model_providers.openai_token_sharing] in
~/.codex/config.toml, written by magpie, and Codex refusing to start:
"provider auth cannot be combined with experimental_bearer_token". The
id is T3 Code's: T3 starts Codex with -c model_providers.
openai_token_sharing={..., auth={command=...}}, its threads name that
id, and putThreadTables (#1372) wrote a magpie table (name, base_url,
wire_api, experimental_bearer_token) for every provider a thread named
that config.toml lacked. Codex merges T3's -c over it, and the merged
table has both auth and a bearer token.

putThreadTables now writes a table only for a CC Switch id
(ccSwitchProvider) or an id config.toml itself once held, recorded per
Codex home in the stash (codex.filed_tables) whenever magpie reads the
file. A table an older magpie wrote for any other id, recognised by its
exact shape (four keys, name == id, wire_api responses, magpie's own
gateway key), is taken out at Sync, at Disconnect (uninstall and quit
restore) and in TakeLeftovers, unless a profile or model_provider names
it or it has sub-tables. The user's own tables, other apps' tables and
tables with any other key are left alone.

Known tradeoff: a magpie-written table for a card-named CC Switch id
that config.toml lost before this release, and magpie never recorded,
is removed once and not written again. CC Switch's own ids still are.

Run (mote): go test ./internal/agent -count=1 -timeout 45m ok (421s);
gofmt -l clean; go vet ./internal/agent for darwin, linux and windows
ok. Real codex 0.165.0 in a sandbox CODEX_HOME: magpie's stray table
plus T3's -c override reproduces the exact error; without the table
Codex loads.

Tests: TestCodexLeavesOtherAppsProviders (threads name
openai_token_sharing, custom and a relay config.toml once held: no table
for T3's id, the other two written back), TestCodexDropsStrayThreadTables
(wired and unwired; another app's table, a profile-named one and the
user's own key stay), TestCodexSyncDropsStrayThreadTable.

Broken by hand: without the threadTableFor guard and the tidy calls,
TestCodexLeavesOtherAppsProviders and TestCodexDropsStrayThreadTables
went red; without only the Disconnect tidy, TestCodexDropsStrayThreadTables
went red; without only the Sync tidy, TestCodexSyncDropsStrayThreadTable
went red.

Not tried: the TakeLeftovers tidy was not broken by hand on its own;
T3 Code itself was not run, only codex with its -c override.
2026-11-13 15:01:55 +08:00
yetone 01f33495b3 gateway: Mistral's oldest images go ten at a time, so the prompt prefix holds
regain4125 (X, v0.1.3961, Codex desktop on Mistral Vibe,
deepseek-v4-1-flash-1017) saw cache misses on most turns of one long
session with 400K+ inputs. Past Mistral's 20-image limit,
mistralImageLimit (8d5bcf18b) left out the single oldest image each
turn. Every new screenshot then moved the cut one image later, so the
request changed at the first kept image and everything after it missed
the vendor's prefix cache.

The oldest images now go mistralImageStep (10) at a time: a request
keeps 11 to 20 images, and the cut moves only once every ten new
images. Between moves the request starts with the last one's, byte for
byte.

Run (mote): go test ./internal/gateway -run
'TestMistral|TestCodexThreadOnChatUpstreamCaches|Cache' -count=1 ok;
gofmt -l clean; GOOS=linux and GOOS=windows go vet ./internal/gateway ok.
TestMistralImageLimitKeepsPrefix walks 21 to 60 screenshots: at most 20
images go, and the prefix changes only at 21, 31, 41 and 51.

Broken by hand: with the old one-at-a-time cut, TestMistralImageLimit
(both protocols) and TestMistralImageLimitKeepsPrefix ("prefix changed on
40 of 40 turns, want 4") went red.

Not tried: a real Mistral key, so whether Mistral's cache hits on the
stable prefix is not seen; the other prefix sources (tools order,
instructions, reasoning replay, prompt_cache_key) were read and are
covered by TestCodexThreadOnChatUpstreamCaches, not changed.
2026-11-13 15:01:55 +08:00
yetone 59f1bcf98b LESSONS: d06d2383a met the core script budget by moving code out
On the same day as five raises, d06d2383a moved the connect-address save
and the typed certificate into tlscerts.js instead of raising
coreScriptBudget. Recorded under the 11-13 budget entry as the way the
"no page left" raises could have gone.

Docs only; nothing run.
2026-11-13 14:58:08 +08:00
yetone 25ac5a6f65 catalog: a relay's 404 "不支持当前入口协议" is a wrong endpoint, so the model goes to the next API (equinox0253 on X)
WandAPI answered Claude Code's /v1/messages for gpt-6.1-sol with 404 "模型
gpt-6.1-sol 不支持当前入口协议". f94ece2ff took a 404 only when New API's
model_not_found code came with a channel or group named, which this doesn't,
so the 404 went to the client and the relay's Chat/Responses URL was never
asked. catalog.WrongEndpoint now takes "不支持当前入口协议" (and 该/此):
the model is marked off that API and asked on the provider's next one; with
no other API the refusal carries wrongAPINote, and a 404 is retryable, so a
group or fallback goes to its next member as before. It names the protocol,
which a wrong base URL ("404 page not found") or a missing model ("模型 X
不存在", OpenAI's "does not exist") never does; those stay plain 404s.

Run (mote, -tags nogui, at origin/main 11ab58c58 + the previous commit):
go test catalog; go test gateway -run WrongEndpoint|NoChannel: ok.
Broken by hand: without the phrases, TestWrongEndpoint and
TestNoChannelAs404FromAFork/entry_protocol (both shapes) are red.
Not tried: a real WandAPI account.
2026-11-13 14:55:15 +08:00
yetone 4af0f05cff gateway: a tool_reference an Anthropic-compatible endpoint refuses goes as text (emilochen on X)
Claude Code through magpie to DeepSeek V4.1 on an Anthropic-compatible URL
got 400 "DeepSeek V4.1 supports text and image content only; got
'tool_reference'": ToolSearch's answer is a tool_result holding
tool_reference blocks, which magpie relayed as written to every Messages
upstream (only a references-only result got a text block beside them,
#2124; DeepSeek's own API and Kimi lose only the top-level deferred blocks).

A 400/422 that refuses tool_reference in words (refsRefused: a refusal word
in the same clause, no brace between, so an echoed request doesn't count,
and DeepSeek's "expected `tool_reference`" doesn't either) while the request
as sent holds one in a tool_result marks shapeRefs. That request is asked
again at once, and every later one to that provider goes, with each
reference as "Tool <name> is loaded and can be called now." (the words
stringOrText already gives Chat, Responses and Gemini upstreams) and the
named tools without defer_loading; other deferred tools stay deferred, and
the tool_use/tool_result pairing stays (withRefsAsText). It sits in forward's
shape loop, so /v1/messages, count_tokens and group members all get it.
deferredOutUpFront names forwardOnce's existing up-front strip (Kimi,
DeepSeek's own API, OpenCode DeepSeek) so refuseShapes judges the body as
sent. Translated routes already carried the references as text
(TestToolSearchReferenceIsTold), so only the Messages passthrough changed.

Run (mote, -tags nogui, at origin/main 11ab58c58 + this): gofmt -l clean;
go vet gateway+catalog for darwin, linux, windows; go test catalog; go test
gateway -run ToolReference|RefsAsText|RefsOnly|RefsSaid|Deferred|DeepSeek|
ToolResultDefinition|NestedToolResult|ToolSearch|LoadedTools|Kimi|Shape|
Display|TurnEffort|Safeguards: ok.
Broken by hand: with mark(shapeRefs) taken out, TestToolReferenceRefusedGoesAsText
is red.
Not tried: the reporter's real endpoint (the refusal body is built from the
words in the tweet; its JSON shape is a guess, the match is on the words).
2026-11-13 14:55:15 +08:00
yetone 11ab58c587 sessions: a kept folder listing is one array (#2278)
readDirectory keeps each folder's listing to tell an unchanged folder
from a changed one. os.ReadDir's entries are a pointer each to a
separate unixDirent plus its name, so a Codex sessions tree of 10k
files held 20k small objects for as long as magpie ran. The kept
listing is now one []keptEntry (dir, name, type) with pointers into
it: one object per entry, and Info() still lstats on demand as
os.ReadDir's does. Windows keeps os.ReadDir's entries (their Info is
already filled and cheap).

Measured on mote, 10k-file folder, HeapAlloc/HeapObjects kept across
readDirectory, 3 runs each:
  before: 1,297,928 B, 19,996 objects (129.8 B/entry)
  after:  1,042,664 B,  9,994 objects (104.3 B/entry)
-20% bytes and half the objects the GC scans each cycle.

Run: go test ./internal/sessions on mote (TestKeptListingIsCompact
checks entries equal os.ReadDir's in Name/IsDir/Type/Info, are
contiguous, and an unchanged folder is not listed again).
Not tried: Windows (path unchanged there).
2026-11-13 14:45:32 +08:00
yetone d06d2383a4 gui: connect addresses' save and the typed certificate move into tlscerts.js, within the core script budget (quantum_lsfc on X)
The Connect to row put TestCoreScriptBudget 180 bytes over (1265892 >
1265712). The typed-certificate copy in asTyped and the resolve line in
Save now live in tlscerts.js, which the editor imports, so the core
carries no new code. A save before tlscerts.js has loaded sends no
resolve, and the server keeps what was saved (a left-out resolve keeps
it), as it already did for the server pin.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone c49c04241d docs: providers-accounts: connect addresses (Resolve)
Docs only: how Provider.Resolve reaches the dial, where it is taken and
where not (a proxy, a plugin), and the tests that hold it.
2026-11-13 14:30:19 +08:00
yetone 40d0ab62ce gui: Advanced › Connect to, a provider's connect addresses (quantum_lsfc on X)
A provider of the user's own has a "Connect to" box under Advanced, one
line per host: host = place, place. It is drawn by tlscerts.js, which
the editor imports, beside the certificate rows; strings in every
language.

Broken by hand: Save without the resolve line turns
provider-resolve.test.cjs's "saved as a map" and "keeps them, and
clears them" red, 40 of 60, in both engines.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone 4b93d391ca gui: the provider editor's connect addresses are saved and shown (quantum_lsfc on X)
/api/providers carries resolve and takesResolve; Save, Test, Fetch
models and peekcert take resolve (left out keeps what was saved, {}
clears it); provider.Save refuses a rule CheckResolve refuses or one on a
provider that takes none (TestResolveSaved, TestProviderSaveResolve).

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone 97bc02df0d provider: Resolve, per-host connect addresses on a provider's own base URLs (quantum_lsfc on X)
Provider.Resolve is taken where TakesInsecureTLS, TakesClientCert or
PinHosts hold (a provider of the user's own, Remote magpie, a preset at
a host of the user's), never a subscription's account or a vendor's
host; plugins aren't covered (Bun's fetch has no hook for the address).
Via puts the rule on the context. The gateway's offline check leaves a
provider with a rule out of the hosts it dials by name.

Broken by hand: Via without WithResolve turns TestResolveVia red;
otherHosts keeping a provider with a rule turns
TestOtherHostsSkipResolved red.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone 44363f54b2 netproxy: per-host connect rules, as curl --resolve (quantum_lsfc on X)
quantum_lsfc's network sends a company's domains to an internal L4 SNI
gateway; an IP in the base URL fails the certificate and /etc/hosts
can't be edited there. WithResolve puts host -> places on a request's
context; Dispatch keeps a transport per rule whose DialContext connects
that host to the places in order (an IP, ip:port, or dns:<name> looked
up at each connection), each given 8s, then the name as usual. The URL's
name stays the TLS server name and Host. A request through a proxy is
left alone: the proxy gets CONNECT with the name. CheckResolve bounds
and checks a rule.

Broken by hand: dialling the name and ignoring the places turns
TestResolveKeepsNameForSNIAndHost, TestResolvePlaceWithPort,
TestResolveDNSPlaceFollowsItsRecords, TestResolveOrderedFailover and
TestResolveFallsBackToDirect red; dropping the direct-only check turns
TestResolveLeavesAProxyOfTheSameNameAlone red.

Run on mote at the head rebased on origin/main b942a872b: go test
-count=1 -timeout 45m ./internal/netproxy ./internal/provider
./internal/gateway ./internal/gui, all ok; gofmt -l clean; go vet ./...
for darwin, linux (-tags nogui) and windows ok; provider-resolve.test.cjs
(chromium and webkit; en zh zh-TW ja de; 1100 and 420) 60 of 60 ok.
Rebased again on origin/main dea131174 and run on mote:
netproxy, provider and gui (TestCoreScriptBudget) ok, gofmt and the
three vets ok, provider-resolve 60 of 60 and i18n-keys ok; internal/gateway was
not run again at that head (no new main commit touches the offline
check or the dial).
The 94 GUI files the editor's Save, Test and certificate rows reach,
run at origin/main 436d507f0: 88 reds in 15 files, the same tests red
on that main run alone (filed: #6424, and #6010 #6156 #5838 #4621
#4391 #5147 #6030 #6209 #4397 #4673 #6099).
Not tried: a real managed network with an L4 SNI gateway (the
reporter's), and the rule's dial on Windows or Linux beyond go vet.
2026-11-13 14:30:19 +08:00
yetone d370bef982 usage: Failed lists the requests a fallback answered, as Routing shows their tries failed (maohy915 on X)
maohy915 runs magpie on a NAS and uses it from another computer's magpie
through Remote magpie. The NAS's Routing page showed failed calls, but
Usage → Requests → Failed found none. Reproduced with two sandbox
instances on mote (B → remote-magpie → A, where A's provider `bad`
answers 429 and falls back to `good`). A's trace had 2 requests and 1
rerouted. Usage had 2 rows, Failed had 0 and Retried had 1. A try that
fails and is handed on writes no row when nothing is billed, and its
request's row is an answer on the second try. Failed kept only
LostRequest, the requests whose agent got the error, so the failed try
was nowhere under Failed. Plain failures, remote or not, were already
listed; only rerouted ones were missing.

Failed now keeps every request a try failed on (Record.FailedTry): the
requests the agent got an error for, the tries handed on, and the
requests a later try answered. Retried still keeps only the answered
ones. The counts are unchanged: each request is counted once, by how it
ended (小一's rule), so a Failed list reads "1 failed · 2 answered on a
retry". The Failed option and the card's "N failed" button now say so in
their tooltip, in every language. Filtered page cells are cached on disk
under the filter, so settledCountVersion goes to 4; the first start after
the upgrade pairs the history again once.

Run (mote):
- go test ./internal/usage ./internal/usageapi ./internal/gui: ok.
- New test TestFailedKeepsRequestsAFallbackAnswered; updated
  TestRequestsCountedOnceWithTheirRetries.
- GUI, both engines: ledger-retried (5 languages, 420/1100), i18n-keys,
  i18n-en-no-cjk, usage-ledger, api-key-usage, purpose-filter,
  usage-ledger-content, usage-phone-head, usage-loops, usage-request-page.
  All pass except known reds: i18n-keys "a plugin's words are its own"
  (#6422/#6423) and usage-ledger "newest live route needs no
  return-to-live button" (#4078/#3104/#4626).
- gofmt; go vet for darwin, linux -tags nogui, and windows.
- Real repro with a binary built from this tree: A's Failed went from 0
  rows to the rerouted request, both in the API and in the real page
  (Chromium).

Broken by hand:
- Filter back to LostRequest: both Go tests red.
- The Failed option's title dropped: ledger-retried red.

Not tried:
- Restoring settledCountVersion to 3 doesn't turn
  TestSettledCountedAsVersioned red: it counts only Filter{}. The bump is
  by reading.
- Not tried on a real NAS or in the desktop app's remote window; the
  page is the NAS's own web page.
2026-11-13 14:17:49 +08:00
yetone a96d88effa claude-desktop: a model picked for two tiers no longer shows twice in the menu (yanghonghang on X)
v0.1.3997 showed "Gemini 4 Hydrogen · haiku" beside "Gemini 4 Hydrogen"
in Claude Desktop's model menu. dbaeaec12 (#5534) listed a model picked
for two Desktop tiers once more in magpie's inferenceModels, under an
alias id for the later tier, so Claude Code's ANTHROPIC_DEFAULT_<TIER>_MODEL
had a model. But that list is Desktop's model menu (gXn in 4.23118), so the
alias showed as a model of its own.

The later tier's alias is now a row of Desktop's /v1/models only
(DesktopTierRows: a copy of the model's row with the alias id, tagged
anthropic_family_tier and is_family_default). Desktop's gateway provider
pins a tier the list leaves out from a tagged discovered row
(shortnameIdentityOverrides, 4.23118). The list's own pins (IPn) go on top.
With an admin list, Desktop reads /v1/models only when the profile sets
modelDiscoveryEnabled, so magpie's profile carries modelDiscoveryEnabled:
true while a tier is shared (DesktopDiscovers, desktopSyncDiscovery). It
takes the value back once the picks are apart, or when the list is the
user's own. A value the user set is never written over or removed
(desktopDiscoveryMark in the stash). The gateway still reads the alias back
to the pick, so the tier is served as before.

Trade-off: Desktop takes behavesAs only from the list, so the later tier's
alias has none. A non-Claude model shared by two tiers runs on Claude
Code's generic prompt in the later tier, as an id Claude Code doesn't know.
Its window is the session's top (no modelSettings entry is needed when it
matches).

Run (mote, at this head):
- gofmt -l: clean
- go vet: darwin, GOOS=linux -tags nogui, GOOS=windows on internal/gateway
  and internal/agent
- go test -count=1 ./internal/gateway ./internal/agent: ok (1079s, 259s;
  mote at load ~38)

Red on the old code: the new TestDesktopTierSharedPick (all 4 subtests,
"3 entries in Desktop's model menu for 2 models ... labelOverride:
claude-sonnet-5-5 · Fake · haiku") and TestClaudeDesktopModelsSharedTier
were run against 406ad72f1's desktop_list.go with only the two new
functions added.

Broken by hand, each red:
- no DesktopTierRows in listModels: TestDesktopTierSharedPick, "haiku has
  no row".
- discovery never written: TestClaudeDesktopModelsSharedTier.
- the user's own modelDiscoveryEnabled taken away (`!on && has`):
  TestClaudeDesktopModelsSharedTier, "the user's true".

Checked against Desktop 4.23118's app.asar (on mote):
- shortnameIdentityOverrides skips only rows that are restricted (JT) or
  need an update (MMn).
- FPn/IPn pin only the tiers the list tags.
- adminListObviatesDiscovery is skipped once modelDiscoveryEnabled is set.

Not tried: a real Claude Desktop run with the reporter's picks. A [1m]
pick's later tier is pinned without [1m] (the row says supports_1m).
2026-11-13 14:16:12 +08:00
yetone dea131174d catalog: strings and lists the models repeat are held once (#2278)
The models.dev catalog is kept while anything reads it, and an open
page keeps reading it. Its JSON gives each of ~9k models its own copy of
"text", "image", its family, its release date, its reasoning levels and
its SDK's name. shareCatalog, run once after a load, has each repeat held
once; a shared list is clipped, so an append to one model's copies it.

Measured on mote with the real-account sandbox (acctp), page open,
pageheap.sh, alternating w54v (base) and w55v (this):
- pprof inuse, focus catalog.loadGen: 5.51 / 7.06 MB -> 4.01 / 3.52 MB
- liveHeap: 77.7 / 78.5 MB -> 75.9 / 76.8 MB
- Footprint: 128 / 131 MB -> 121 / 129 MB
- CPU at mark: 2.44 / 2.57 s -> 2.53 / 2.47 s (unchanged, noise)

Run: go vet ./internal/catalog; go test ./internal/catalog
./internal/provider/... ok (mote). GOOS=windows and GOOS=linux go vet
./internal/catalog ok (mica).
Broken by hand: without the shareCatalog call TestLoadedCatalogSharesRepeats
fails on all five checks (mica).
Not run: the full suite.
2026-11-13 14:06:17 +08:00
yetone 93906ba755 gui: a second launch on Windows hands over at once, not after 30s (shangyuan0818 on X)
On Windows, opening magpie from the Start menu while it already ran took
over 10s to show the window, longer than a cold start. fb6b4de0a made
every start wait, up to 30s, for the WebView2 profile folder's lockfile
before the app is made. A second launch hands over to the running magpie
only as the app is made (Wails' single instance, in application.New), and
the running magpie's WebView2 holds that folder for as long as it runs,
so every second launch waited the whole 30s, then handed over.

Now the wait is skipped when Wails' single instance mutex for this config
(wails-app-<id>-sim) is held: a magpie runs, and the launch goes straight
on to hand over. A restart after an update or a failed WebView2 start
still waits: the magpie before has ended by then (AwaitPredecessor), so
the mutex is free and only its msedgewebview2 can still hold the folder.

Run:
- Reproduced on xiaomi-gpu (Windows 11) with builds of 406ad72f1 and of
  this commit, sandbox USERPROFILE/APPDATA/LOCALAPPDATA, MAGPIE_ADDR
  :3461, HKCU magpie/ccswitch/App Paths/Uninstall keys exported and put
  back. ssh has no desktop (the real app crashes in uxtheme there, and no
  one was signed in for an interactive task), so a stand-in held what a
  running magpie holds: the single instance mutex for the sandbox's
  config and EBWebView\lockfile without sharing. Launching magpie.exe
  with no arguments, as the Start menu does, three times each: before,
  the launch quit after 30240, 30232, 30234 ms ("still held by another
  process after 30s"); after, 189, 161, 166 ms. That Wails took the
  launch for a second one also shows the mutex name matches Wails'.
- TestWebView2ReadyDoesNotWaitOnTheRunningMagpie (Windows): red with the
  held check turned off by hand (waited 20.06s), green with it.
- go test -count=1 ./internal/gui on mote: ok (150s). On xiaomi-gpu: 9
  reds, the same 9 at origin/main 633ab58e9 and all filed (#6068, #5324,
  #5928, #6059).
- gofmt -l; go vet ./internal/gui on darwin, windows, linux -tags nogui
  and windows -tags nogui (on mote: mica is out of disk).
Not tried: the real tray app with a desktop session and a Start menu
click, for the reason above.
2026-11-13 14:01:50 +08:00
yetone 633ab58e9b gui: every page says it draws a dark theme, so browsers don't repaint it (xjp on X)
Chrome's Auto Dark Theme and Safari's Adaptive Dark Mode (Safari 27.3
beta) repaint pages that don't declare dark support. magpie's GUI draws
both themes itself but never said so, so a browser's light magpie was
repainted. WebKit's post (webkit.org/blog/18541) and Chrome's
(developer.chrome.com/blog/auto-dark-theme) say: `color-scheme: light
dark` (CSS on :root or the meta) is skipped; `light only` opts an element
out (Safari 27.3 beta 1 doesn't honour `only` yet).

- index.html: <meta name="color-scheme" content="light dark">.
- app.css: :root takes `light dark` always (the signal browsers read);
  body takes the theme shown: Settings' Light is `light only`, Dark is
  `dark`, System follows the root. Native controls, scrollbars and a
  plugin's frame follow the theme shown.
- pagebridge.js: a plugin page's light frame is `light only`.
- The other pages magpie serves (magpie web's sign-in, a sign-in's end
  page, an MCP sign-in's end page, a plugin service's "starting" page)
  declare `light dark`; the MCP page drops its fixed #222 text so it
  reads on a dark canvas. keypage.html and the extension popup already
  did; site/ pages already do.

Tests: color-scheme.test.cjs (chromium + webkit; system/light/dark on a
dark OS: meta, root and body schemes), TestPagesDeclareBothColorSchemes,
TestSignInPageDeclaresBothColorSchemes, TestPageDeclaresBothColorSchemes.

Run (mote, before the rebase on origin/main 6bcdc6468): the new GUI
file 6/6 in chromium + webkit; checkbox-look 8/8, plugin-page,
plugin-panels and plugin-page-idle 14/14; go test of the new tests and
-run "PluginPage|Page|Bridge|SignIn" in internal/gui, internal/provider,
internal/mcpauth ok; go vet darwin, linux (nogui), windows ok; gofmt
clean. api-key-theme is red 6/6 here and on origin/main 2f2a0afa5 alone
(#6444, a #lanList selector matches nothing).

At the pushed head (after the rebase): color-scheme.test.cjs 6/6 and
-run "ColorScheme|Budget" in the three packages ok.

Broken by hand: the four new tests on origin/main's code (2f2a0afa5)
are all red (GUI 0/6, three Go tests FAIL).

Not tried: Safari 27.3 beta's Adaptive Dark Mode and Chrome's Auto Dark
Theme themselves (no beta device here); the real app's windows (Wails
WebKit, WebView2, WebKitGTK) with the root's new color-scheme; the full
GUI suite.
2026-11-13 13:58:00 +08:00
yetone 6bcdc6468d sessions: agy's own calls name the model its conversation database names (DvnT662 on X)
Usage → Requests showed every call read from a local agy-cli session with
no model (v0.1.3996). The calls reader read only agy's transcript,
brain/<id>/.system_generated/logs/transcript_full.jsonl, which carries
tokens but no model. agy keeps the model in conversations/<id>.db, the
Antigravity app's layout: gen_metadata field 1.19 is the served model,
and a step's metadata field 20.3 names its generator (0 when left out, as
antigravityRead reads it). A generator's "last_step_index" n in 1.20 names
step n+1 for steps the steps table doesn't hold.

- calls_agy.go: agyStepModels reads the db read-only and gives each
  transcript step its model (through agAppModel, so -n deployment
  suffixes go as on the app's rows). The call file's stat folds in the
  db and its -wal, so a model written after the step is read again.
- agy.go: the Sessions page counts each step's tokens under that model
  (still "agy" when the db names none), and its rev folds in the db too.
- parseVersions / callParseVersions "agy": 1, so cached parses are redone.

Fixture: gen 0 is parkavenue9639's real agy 1.5.6 gen_metadata row from
#3147 (matching its transcript step 1, 11519 in / 781 out); steps.tsv is
the real steps.metadata agy 1.5.7 wrote on this Mac. Generator 1 is made
in the test.

Run (mote): go test -count=1 ./internal/sessions ./internal/usage ok;
go vet darwin, GOOS=linux -tags nogui, GOOS=windows ok; gofmt -l clean.

Broken by hand, each red: calls given no model; no last_step_index
fallback; Sessions not moving counted tokens to the model; call files
ignoring the db's stat; Sessions rev ignoring the db.

Not tried: a live successful agy turn (this Mac's only agy account is
refused, so its db has no answered step); agy in WSL; conversations with
a db and no transcript still count nothing (#5432); tok/s and stripping
-trial (#4805).

Refs #3147, #4805, #5432
2026-11-13 13:53:05 +08:00
yetone a65dade2e3 gui: an accent colour of your own and a picture behind the pages (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked for colours beyond the three themes and for a
local picture. Settings › General gains two rows under Appearance:

- Accent color: magpie's own, six quiet presets (Blue, Teal, Green,
  Orange, Pink, Graphite) and a swatch that opens the system's colour
  picker. Saved as settings.accent (#rrggbb only, checked in saveOwn;
  `magpie settings set accent "#0d9488"` works through settingsapi.Keys).
  The server draws it (appearance.go accentVars): darkened on the light
  theme and lightened on the dark one until it reads as text at 4.5:1
  on the background and cards, with white or near-black text on it,
  whichever reads better. Never under Omarchy, whose theme is the look.
- Background image: Choose… takes a PNG, JPEG, GIF or WebP of 16 MB at
  most, sent as base64 JSON to POST /api/appearance/wallpaper, saved as
  `wallpaper` in magpie's folder (edit.WriteAtomic); settings.Wallpaper
  is its stamp. A thumbnail, Change and Remove show; Remove deletes the
  file. It is drawn behind the window's pages (never the tray panel)
  under a veil of the theme's background at 84%, so text reads as on
  the plain page; the cards stay opaque, and body's colour stays the
  theme's, which Windows' title bar tint reads.

boot.js puts the look's stylesheet in before the first paint and says
which look it drew (bootPrefs.look); applyPrefs asks /api/appearance/css
only when the settings' look differs. The rows, with the Colorblind,
Reduce motion and Loading bird rows, are drawn by appearance.js,
imported when Settings draws, so the core scripts stay under their
budgets with no raise (app.js 2,393 under, the core 503 under).
A save of Settings that doesn't send accent keeps it (Merge guard),
and the wallpaper stamp is kept by every Settings save.

fonts.test.cjs: the two new rows push the font row to the foot of its
560×620 window, where Playwright's click scrolled it in by a pixel and
the test read that as the page moving; the reader now scrolls it in
first with the wheel. settings_keep_test sets Wallpaper; the three
/api/appearance routes are named in the CLI parity test's notYet.

Run (mote, at this change on origin/main 406ad72f1; after the rebase
on fa3ee5a7e, which touched only the Library plugin and the site here,
the core budget, TestEveryRoute*, TestSettings*, TestAccent*,
TestWallpaper*, appearance-look and i18n-keys again, the same result):
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows on
  internal/gui, settings, settingsapi: clean.
- go test -count=1 ./internal/gui/... ./internal/settings/...
  ./internal/settingsapi/... ./internal/cli/...: ok.
  (go vet ./internal/cli too.)
- GUI, chromium and webkit: appearance-look (picking a preset, the
  reader's own and back; boot.js's look not fetched again; choosing
  and removing a picture; the rows keep their height while
  appearance.js loads; en, zh, zh-TW, ja, de at 420 and 1000px: rows
  fit, words translated), fonts, settings-general, settings-sections,
  settings-groups, reduce-motion, skeleton-bird, i18n-en-no-cjk: green.
  Red the same at origin/main 7693cf263 without this change, all
  filed: api-key-theme (#6444, filed now), i18n-keys "No folder"
  (#6422), settings-search and settings-lines-wrap de 440px (#6353).

Broken by hand, each red, then restored:
- Merge guard removed: TestAccentSetting red ("a save without the
  accent changed it").
- accentInk = 1.0: TestAccentReadable red.
- applyPrefs' lookPaint call removed: appearance-look's accent and
  picture tests red in chromium.
- the thumbnail made 66px tall: the row-height test red.

Not tried: the real app on Windows, Linux or Omarchy (title bar tint
with a picture, WebKitGTK drawing the layers), the system's real colour
picker dialog (the test sets the input's value), a 16 MB picture in the
real web views, and the whole GUI suite (queued on mote's suite lock
after the tag).
2026-11-13 13:52:41 +08:00
yetone 2f2a0afa59 memory: the no-project line doesn't say the sessions plugin's "No folder" (#6422)
72facf72e's memory_context answer said "No folder of yours is known
here". The sessions plugin translates "No folder" in its own i18n.js,
so i18n-keys' "a plugin's words are its own" has been red on main
since then (#6422; #6423 is the same red). The line goes to the model,
not the window, so it is reworded: "None of your folders is known
here". memory_mcp_test.go checks "Project: none" only, which stays.

Run:
- node --test internal/gui/tests/i18n-keys.test.cjs on mica: pass 4,
  fail 0 (red 1 of 4 at origin/main fa3ee5a7e).
- go test -count=1 -run Memory ./internal/gateway/ via wsl-run: ok
  (mica's disk is full, 121MB free, so Go couldn't build there; mote
  was at load 35-43 on 18 cores). gofmt clean.
Not run: the full suite.
2026-11-13 13:52:07 +08:00
yetone fa3ee5a7ea readme: ModelGo takes the free README seat
ModelGo paid for one month of the README seat (the owner confirmed
receipt 11-13). The logo is the one Chloe sent (logo_full_black.svg,
byte for byte); the dark copy only turns the black "Model" wordmark
white. /go/modelgo/readme sends the click to the UTM link they gave.

Run: node --test site/*.test.mjs on the WSL box (magpie-desktop),
120/120 at this head (rebased on d813cf0e4).
2026-11-13 13:45:27 +08:00
yetone d813cf0e4b site: llms-full.txt carries the Cherry Studio image models and the MCP server's other command
15e1d65bc and 741d502d2 changed docs pages without running
`node llms-full.mjs`, so site/worker.test.mjs's "llms-full.txt is
current" was red on origin/main 741d502d2.

Run: node --test site/worker.test.mjs on the WSL box (magpie-desktop):
1 red at 741d502d2, 41/41 pass after.
2026-11-13 13:45:14 +08:00