Commit Graph
2398 Commits
Author SHA1 Message Date
yetone 6bdeedc6fb gateway: serve DeepSeek's chat page with magpie's models
@yanghonghang asked on X for DeepSeek's open-source web chat page
(deepseek-ai/chat-demo) to run on magpie, with its search and link
reading served by magpie's own. magpie now serves it at
<gateway>/deepseek-chat/, with no setup:

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

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

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

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

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

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

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

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

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

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

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

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

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

Cause, reproduced in a sandbox HOME with Claude Code 2.1.316: magpie's
writes to ~/.claude/settings.json are key-level and kept the user's
permissions block. Claude Code itself drops the mode: it ignores
bypassPermissions at launch unless skipDangerousModePermissionPrompt is
true, and its auto-mode nudge and /config write defaultMode over it.

Change:
- agent.Field gets Own: the user's own setting of the agent. Apply does
  not record it, Disconnect neither clears nor restores it, Pick never
  connects the agent for it, magpieValueIn is false for it, and profiles
  (Fields, ApplyFields, InUse) and the WSL copy leave it alone. So the
  mode outlives disconnecting magpie and switching profiles.
- Claude Code's permission_mode field (default, acceptEdits, plan, auto,
  dontAsk, bypassPermissions; "" removes the key) writes
  permissions.defaultMode, and bypassPermissions also writes
  skipDangerousModePermissionPrompt: true so Claude Code honours it.
- GUI: own fields go in agentJSON.own, apart from fields, and
  agentcompact.js draws them in an Advanced fold (collapsed) under the
  agent's settings, with the app menu (no <select>). app.js unchanged.
  Labels in en, zh, zh-TW, ja, de (zh: 高级 › 权限模式 › 跳过权限确认).
- docs/subsystems/agent-wiring.md: Fields and options row.

Run at this tree (base aa358555f, origin/main at commit time), on mote/mica:
- go test ./internal/agent -run 'Permission|Profile' ; ./internal/profile ;
  ./internal/gui -run 'Budget|PermissionMode|AgentOwn|AgentModels': ok
- GUI claude-permission-mode.test.cjs in chromium and webkit, en and zh:
  4/4; i18n-keys, i18n-en-no-cjk: ok
- gofmt -l: clean. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok

Broken by hand:
- Own: false on the field: TestClaudePermissionModeOutlivesMagpie
  ("disconnecting took the mode to \"\"") and TestProfileLeavesPermissionMode
  ("a profile wrote the permission mode") went red.
- Without the GUI own/fields split, the "not a picker on the row" check in
  claude-permission-mode.test.cjs went red.

Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).
2026-11-14 23:11:16 +08:00
yetone 90efddabae gui: providers can be picked and removed together (eiyuuzaki2333 on X)
Many API providers added meant removing them one at a time. Select, by
the Providers search box (shown with two or more), puts a box on every
row as Routing's groups and Library's lists have it: a click on a row
picks it rather than open its editor, Shift picks the rows shown
between, and the bar's box picks every row shown. Remove asks once, in
the app's own dialog, with the count and every name, then posts
POST /api/providers/delete {ids}. That runs provider.Delete for each
id, as the editor's Remove does, inside one agent.Reseat, so agents
move once, to where they end up. One it can't remove comes back in
`unremoved` with why, stays picked and is named in the status; the call
is refused only when nothing was removed. Done or Escape ends picking.

The rows, bar and removal are in pvpick.js, imported when Select is
first clicked. The core grows 270 bytes (pvSel, the button's click and
two lines in renderProviders), and coreScriptBudget is raised by that
with the reason. "{name} wasn't removed: {error}" moves from Library's
words into core i18n.js, since core code says it now.

Run (rebased on origin/main e6e0585bd, on mica; mote was over its 18
cores):
- go test -tags nogui ./internal/gui/ ./internal/provider/: ok
  (TestProvidersDeleteSeveral new; TestCoreScriptBudget ok after the raise).
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; go build: ok.
- GUI, chromium + webkit: provider-bulk-remove (new: en, zh, zh-TW, ja,
  de at 420 and 1100px), provider-remove, provider-find, provider-order,
  providers-off-fold, provider-search, provider-list-off,
  group-bulk-remove, library-pick-remove, i18n-keys, i18n-en-no-cjk: ok.
  found-skill-pick-remove's ja/de 420px subtests are red, and red the
  same at origin/main e6e0585bd in a clean worktree (#5013).
Broken by hand: the handler deleting only ids[:1] turns
TestProvidersDeleteSeveral red ("listed after: [b c d]"); the page
posting only the first id turns provider-bulk-remove red in every
language. Restored, green.
Not run: the full Go suite and the full GUI suite (mote overloaded,
mica running another session's GUI suite); not tried in the real app
with real providers.
2026-11-14 22:18:09 +08:00
yetone e6e0585bd3 antigravity: reword Hermes', OpenCode's, Codex CLI's and pi's identity lines, which Google refuses since 11-14 evening
Since about 18:43 on 11-14 Antigravity answers 429 "Resource has been
exhausted" to a system instruction holding "You are Hermes Agent"
(Hermes' current persona), "You are OpenCode", Codex CLI's "You are a
coding agent running in the Codex CLI" or pi's "a coding assistant
running inside pi", whatever quota is left (@ZhouYimingsjtu,
@Lmohn39 on X). Hermes' earlier persona is still refused as "You're …
created by", so it keeps its "built by". Tried on a real account
(gemini-3-flash), each alone: Codex GPT-6's prompt, Claude Code,
Gemini CLI, Qwen Code, Cline, Kilo, goose, Amp, Droid, Kimi, Aider and
Cursor pass as written.

agTurnedAway gains the four lines; agSaidAs rewords them "You're …" and
"running within pi", the smallest change that passed 5/5 on the real
account (gemini-3-flash: pi 1.5.0's full default prompt, both Hermes
personas, OpenCode's first lines, Codex CLI's prompt; claude-sonnet-4-6:
pi 5/5), through the antigravity plugin's cloak, which has the same
lines (plugins a617ecfd, antigravity 0.1.16, agy-cli 0.1.48,
antigravity-cloak 0.1.9). The refusal's hint names the agent: new
OpenCode, Codex CLI and pi hints, Hermes' covers both personas, word
for word the plugins' and the Routing page's (client.js HINTS, i18n
zh/zh-TW/ja/de).

Run (mica; mote was over its 18 cores):
- go test ./internal/gateway -run 'Antigravity|Cloak|CodeAssist': ok
- go test ./internal/gui: ok
- GOOS=linux and GOOS=windows go vet -tags nogui ./internal/gateway
  ./internal/gui: ok
- node --test i18n-keys, i18n-en-no-cjk, routing-ag-turned-away
  (both engines): 38 pass
- gofmt -l: clean

Broken by hand: with the pi and OpenCode lines out of agTurnedAway,
TestAntigravityCloakRewordsEveryLineItTurnsAway and
TestAntigravityHermesHint go red.

Not run: the full go test ./... (mica had another session's full suite
running, mote over load) and the whole GUI suite; the change is
strings in four tables plus the hint switch.
2026-11-14 21:49:30 +08:00
yetone e0ed2c4d81 gateway: model ids without the provider can be listed alone, in place of provider/model
qQianye on X (v0.1.4094 in Docker, several WorkBuddy accounts): the
client on their computer lists every model as provider/model and they
want those hidden. The advice was the Agents page's model list, but
gateway mode (what the Docker image's web page runs as) has no Agents
page. Settings › Network and sharing › Model ids without the provider
was drawn there already, but only added bare ids beside the prefixed
ones, so the list got longer, not shorter.

The row is now Off / On / Only. Only (settings.BareModelIDsOnly,
POST /api/settings/bare-ids {"on":true,"only":true}) lists each bare id
in place of the first row it stands for (provider.OnlyBare) and leaves
the other rows it stands for out: the found group it reaches
(auto/glm-5.3) and every provider's row of that model it reaches. A row
the bare id doesn't reach (b/vendor/m9, whose bare id names provider
vendor), a held key's row whose bare id isn't listed for it, and other
groups keep their ids, so no model leaves the list. Requests by
provider/model are served as before; only /v1/models changes. Another
magpie's list is unchanged. Claude Code's discovery, which drops a bare
row it wouldn't keep because the full row is there, lists it by its
alias with Only (there is no full row). Off clears Only.

Run, at this commit (base 3dbbb173e, origin/main unchanged at push):
- go test -count=1 -timeout 45m ./... on mica: 101 packages ok, no FAIL
  (log kept whole at mica:~/runs/qq-sb/suite.log). gofmt -l clean;
  go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... clean.
- GUI (Chromium + WebKit, 420 and 900, all five languages) on mica:
  bare-ids, i18n-keys, i18n-en-no-cjk, gateway-mode, settings-tabs-stick:
  66/66 pass. Not the whole GUI suite: mote was over its load and mica
  holds another session's GUI run.
- Broken by hand: with Only ignored in listModels, TestBareModelIDsOnly
  is red (every provider row listed); with Claude Code's bare rule left
  as before it is red (1 of 5 models listed to discovery).
- Docker-style run on mica: the built binary as `magpie serve
  --web` with the image's env (HOME/XDG under a sandbox, MAGPIE_ADDR,
  MAGPIE_WEB_KEY), two custom providers serving kimi-k3 and glm-5.3; the
  page boots with gateway:true and draws #bareIdsRow. /v1/models:
  Off  auto/kimi-k3 auto/glm-5.3 wb1/kimi-k3 wb1/glm-5.3 wb2/kimi-k3 wb2/glm-5.3
  On   the same, then kimi-k3 glm-5.3
  Only kimi-k3 glm-5.3
  kimi-k3 answered by wb1, wb2/kimi-k3 still by wb2.
Not tried: a real WorkBuddy plugin account, and a client reaching it
through another magpie (whose list never takes bare ids).
2026-11-14 21:05:50 +08:00
yetone bc9ea912a5 contributors: 11-14 two of ggbdpq's patches needed the review again (#5452, #5197)
From the review of fee33668d, 7a9c40413 and 131037e2b. Docs only; nothing run.
2026-11-14 20:00:56 +08:00
NightGlowww 131037e2ba gateway: preserve Codex model-list OAuth alongside gateway keys
A managed x-api-key made identifyCaller overwrite Codex's valid ChatGPT
bearer with the internal token. /models then forwarded that token and
returned 401, losing the configured model metadata (#5197).

Keep the bearer privately only for the native model-list GET after key
validation. Restore it on a request copy used by both the model-list
cache and its upstream ask, removing gateway authentication fields.
Key-only requests remain refused; other routes keep normalization.

Verification on Go 1.27.3, macOS arm64, based on 17154e165:
- TestCodexModelsKeepOAuthBesideGatewayKey fails on the unmodified base
  with 401 invalid client sign-in, then passes with this fix.
- Four new test groups pass, including -race -count=20.
- Full nogui suite completed: 84 packages passed, 3 packages failed.
  Existing gateway JSONv2 parity (#3547, including a separate invalid
  UTF-8 sizing difference) and WSL probe (#3680) failures reproduced
  on unmodified base. GUI: core budget (#5139, reproduced on base),
  lane-test isolation (#5150), system-proxy isolation (#2562).
  Plugin git-update tests failed with PATH Bun 1.3.14 on base and patch,
  then passed with bundled Bun 1.4.4. Existing issue patches reviewed;
  separate fixes are not bundled into this OAuth change.
  TestRemoveServerDropsItsIcon skipped: user forbids Playwright setup.
  The full suite is not claimed green.
- gofmt -l and git diff --check are clean.
- macOS, Linux (nogui), Windows: go vet ./... and go build pass.
- Isolated patched Server.Front plus a real OAuth and fresh gateway key:
  GET /models returns 200 and Astra's native 272000/max 872000 entry.
  The explicit 872000 override is checked by the regression fixture.

Tests isolate HOME and pin Go caches. No production replacement or
inference probe; no Linux/Windows runtime or GUI/Playwright run.

Landed from @ggbdpq's verification on #5197. The review dropped the
patch's change to the Codex model-list bullet in gateway-routing.md: it
put back an older text (provider.CodexListed, without CodexListedBeside
and keyListed/GroupStandIns). main's bullet is kept as it is, and only
the new paragraph is added.

Run at this commit's tree on mica: with codex_backend.go and lan.go at
origin/main d987cc7d5 and the new test file kept, all four tests fail
(TestCodexModelsKeepOAuthBesideGatewayKey: 401 "invalid client sign-in";
TestCodexModelsGatewayKeyIsNotOAuth: 200 where a local 401 is wanted;
TestCodexModelsOAuthStillNeedsAnEnabledGatewayKey;
TestCodexModelsCacheUsesClientOAuth). With the change they pass. Full
suite: see the batch's last commit.
Not tried: a real Codex app beside a gateway key.
2026-11-14 19:46:12 +08:00
yetone 1ab2c39843 tray: the menu bar and panel leave out what Usage's Overview hides (onkashiko on X)
onkashiko on X: a quota hidden in the main window still showed from the
menu bar. 7ea1e6a4b made the tray panel and the TUI leave out Overview-hidden
cards and rows, but two gaps were left:

- The menu bar's cells, its tooltip and Windows' tray figure still showed a
  hidden card and its hidden rows. trayUsageCards now goes through
  trayShown: a cell naming an account takes the card the Overview still
  shows (its balance with its plan hidden), a cell following the account
  in use (`|*`) picks that account among every card as before and is left
  empty while its card is hidden, never moved to another account. Hidden
  rows are left out, a card never left with none. settings.TrayUsages is
  untouched, so the cell comes back with the card.
- POST /api/usage/arrange now wakes the menu bar (onTrayUsage) when
  cardsHidden or windowsHidden is sent, so a hide or unhide reaches it at
  once rather than at the next tick (3 minutes by default).
- The panel hid a card after keyCards had put a key's balance on its plan's
  card, so "Hide its balance from Overview" left the balance on the panel's
  plan card, and a hidden plan took its unhidden balance with it.
  panelPageCut now takes the quotas as read and leaves the hidden out before
  keyCards, as overviewCards does; gone counts a merged card hidden only
  when its plan and balance both are.

The Go hide rule (cardHideKey/usageShown) moved from internal/tui to
internal/provider (ShownQuotas, QuotaCardHidden, QuotaRowsShown,
QuotaHideKey), shared by the TUI and the menu bar. Not changed: Bark's
daily push still warns about a near-limit hidden card (an alert, not a
display). Docs: settings.go comments, docs/subsystems/gui-shell.md.

Run on mica (mote at load 117 on 18 cores), at base ee6352b63:
- go test -count=1 -timeout 45m ./internal/gui ./internal/tui
  ./internal/provider ./internal/settings: all ok.
- go vet of those packages; GOOS=linux go vet -tags nogui and GOOS=windows
  go vet of internal/gui, internal/tui, internal/provider: clean. gofmt -l
  clean.
- GUI (Chromium + WebKit, en/zh/zh-TW/ja/de): panel-hidden-balance (new),
  panel-page-hidden, panel-arrange: 28/28. panel-balance-order,
  usage-rows-hide pass. usage-cards-hide and usage-hidden-way-back are red
  at "de 560" (no sideways scroll), the same 8 on an origin/main
  ee6352b63 copy (#6294, #6295). tray-cell-click "chromium zh/en" is red
  1 run in 3 on origin/main as on this tree (#5215).
Broken by hand: panel-hidden-balance is red on origin/main's assets
(the plan card carries the hidden balance, MiniMax's balance gone);
TestTrayLeavesOutWhatTheOverviewHides is red with trayShown returning
trayPick, TestUsageArrangeWakesTheMenuBar red with the onTrayUsage call
removed.
At the pushed head (rebased on 534b1a334, which adds installdir_windows.go):
GOOS=windows go vet ./internal/gui ./internal/update and go test -run
"TestTray|TestUsageArrange|TestCoreScriptBudget" ./internal/gui: ok.
Not tried: the real menu bar on a Mac or Windows with a real account; no
full go test ./... (a full suite was running on mica).
2026-11-14 19:37:57 +08:00
yetone 61e2035d39 gui: a Windows start no one can answer is never asked where to install, so the gateway comes up (v0.1.4160-4166 release check)
Every magpie-releases build from v0.1.4160 to v0.1.4169 failed
windows-check (amd64 and arm64) at "Launch magpie": the exe logged
"magpie 0.1.4166 started (app, ...)" and the gateway never answered, so
none of those versions has assets.

Cause: 14807bcf2 made a copy still named as the site's download
(magpie-windows-amd64.exe) a download wherever it is kept, asked about
through the install dialog. The release check starts
dist\magpie-windows-amd64.exe, so update.Settle now put up the task
dialog. The question comes before anything starts in gui.Run, the
gateway included (Install opens the installed copy in this one's place),
and on the runner no one answers it, so the app waited on it forever.

Now askInstallFolder leaves update.AskFolder unset when no one can
answer (unanswerable): CI set, as every CI service sets it (GitHub's
CI=true), or a window station no one sees (a service, a start over
SSH; GetUserObjectInformation UOI_FLAGS without WSF_VISIBLE). Unasked,
a copy kept outside Downloads runs where it is with nothing recorded
(isDownload's existing ask=false rule), and one in Downloads installs
to the default as it did with no dialog. A person's start on their own
desktop is asked as 14807bcf2 has it. The gateway can't start before
the answer instead: Install forwards to the installed copy and this one
quits, so its gateway would have to be handed over first.

Also fixes #6648: TestSettleAsksAboutADownloadKeptElsewhere expected
forwards() true on every OS, but forwarding is Windows' alone (as its
sibling checks at install_test.go:382/452 already say), so it was red
on Linux and macOS since 14807bcf2.

Tests: TestNoInstallQuestionOnCI (Windows: CI=true leaves AskFolder
nil) and TestInstallQuestionNeedsSomeoneToAnswer (any OS).

Run:
- Reproduced on xiaomi-gpu (Windows 11) as the CI step does it: the exe
  built with go-winres's manifest (so the task dialog exists), named
  dist\magpie-windows-amd64.exe, started `app` with CI=true in the
  logged-in console session (session 1, through a schtasks /it task),
  sandbox USERPROFILE/LOCALAPPDATA/APPDATA/TEMP, MAGPIE_ADDR on a port
  of its own, polling /v1/models 30x2s. At ee6352b63: RED, "the gateway
  never answered", nothing after the start line. With this change:
  GREEN, "install: not asking where to install: CI=true", gateway
  answered, still up 5s later, nothing installed.
- Over SSH (session 0) with CI unset: the question is skipped ("no one
  sees this desktop"); the app then exits on WebView2's controller
  there (no desktop), which is that session's, not this change's.
- Broken by hand: askInstallFolder reading another variable ->
  TestNoInstallQuestionOnCI red ("asks where to install with CI=true").
- win-run go test -count=1 -run 'TestNoInstallQuestionOnCI|
  TestInstallQuestionNeedsSomeoneToAnswer|TestInstallWords' -v
  ./internal/gui/: ok.
- wsl-run go test -tags nogui -count=1 ./internal/update/ (magpie-desktop,
  Ubuntu 24.04): ok (#6648's red gone).
- mica-run: gofmt -l internal/ clean; GOOS=windows go vet and GOOS=linux
  go vet -tags nogui ./internal/update/ ./internal/gui/ clean; darwin go
  vet clean.
- win-run go test -count=1 ./internal/update/: ok except
  TestPackagedByDpkg (#4603, open, untouched).
- mica-run go test -count=1 ./internal/update/ (macOS): ok.

Not run before the push: the full suite (mote at load 144) and the
whole ./internal/gui package (running on xiaomi-gpu and mica at push;
the release blocker didn't wait for it). Not tried: a real person's double-click from D:\下载 after this
change (the dialog path itself is unchanged).
2026-11-14 19:28:21 +08:00
yetone ee6352b638 gui: black's dark page is #000000, and a dark colour darkens the page in its hue (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS on X (tweet 2121543612278472704), on the dark theme:
「现在的纯黑……感觉色对不上」 beside Chrome's black, and the darkest navy of
the system's picker 「感觉是有浅灰存在,所以导致深变浅」. Their screenshots:
black's page (2,1,7), Chrome's (0,0,0); navy #191047's page (24,23,29),
card (31,30,36), the grey of Graphite's.

Why (appearance.go ground()):
- the dark grounds went down by the same amount on every channel, so
  app.css's cool grey cast stayed: black's page was #000003, its card
  #08080c, a blue-black next to Chrome's #000000;
- how dark a pick is was its mean channel against the page's. #191047's
  mean (37) is above the page's (27), so a deep navy counted as light
  and only got a breath of hue (0.08): the same grey page as Graphite.

What changes:
- darkness(): a pick's OKLab lightness under 0.4 (Graphite #52525b is
  0.44, every preset 0.51 or more) is how far the dark grounds go
  toward black; 1 for black. #191047 is 0.23, so 0.43.
- as a ground goes down it loses the grey's cool cast by as much, and
  takes more of the pick's hue (0.08 + 0.25 x darkness). Black's page
  is #000000 with neutral steps above it (card #090909); navy's page is
  a near-black navy.
- Graphite, the presets, colours lighter than 0.4 and the light theme
  are unchanged; lifted() (where the ink starts) is unchanged.

Measured (Settings > General zh, dark, 1200px; screenshot pixels, the
same in Chromium and WebKit), before -> after:
- black: page #000003 -> #000000, card #08080c -> #090909
- #191047: page #191821 -> #0c0b17, card #22212a -> #151420
- #130830: page #17161e -> #0b0813, card #201f27 -> #14111c
- Default, Graphite (#1a1a1e / #232327), teal, #7f1d1d: unchanged

Tests:
- TestDarkPickDarkensPage: black's grounds are neutral greys; three
  dark blues draw a darker, blue page with text >= 7:1 and the accent
  >= 4.4:1; Graphite and the presets have darkness 0.
- TestBlackIsBlack: black's page is #000000 exactly.
- appearance-look: black's dark page is rgb(0, 0, 0); #191047 draws a
  dark navy page with Settings' list on its card (dark), and keeps the
  light page's lightness (light). Fixture gains #191047.

Run on mote (load ~22-35 over its 18 cores; mica's disk is full, 116MB
free), at this change on origin/main dbac411b2:
- gofmt -l internal/gui clean; go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/gui: ok (112s).
- Whole GUI suite (node --test internal/gui/tests/*.test.cjs, both
  engines, every language): cut short at 8650 of ~8700 results to push
  (coordinator); 8279 ok, 371 not ok. appearance-look 20/20 here and
  every accent, look and Settings case ok. Reds outside this change
  (accounts, keys, Check in, quick panel shortcut, gateway card, under
  the box's load); api-key-theme (#6444) and omarchy (#6027) are the
  reds named on origin/main by 90ad90646. Not rerun on a base copy.
- Broken by hand: with the old ground(), TestBlackIsBlack and
  TestDarkPickDarkensPage are red (#000003, blue-grey grounds), and
  appearance-look's dark case is red in both engines ("black's page is
  black").

Not tried: the real macOS app, WebView2, WebKitGTK; the full Go suite;
the GUI reds' base comparison.
2026-11-14 19:10:06 +08:00
yetone 106a24b95e library: skills from GitHub and git update by themselves when switched on
0xYaCo on X: "skill 能自动化升级吗?". magpie already checked for skill
updates by itself (every 12h, as the Skills tab opens), but each update
waited for a click on Update. A new switch, Update by themselves, sits
under the Skills list while a skill comes from GitHub or git
(POST /api/library/skills/auto-update; `magpie library skill auto-update
on|off`; library.json's autoUpdateSkills, this computer's own). It is off
by default. When it is on, KeepSkillsCurrent (a gateway.WhileServing loop)
runs AutoUpdateTick 2 minutes after start and then hourly. Every 12h that
runs CheckSkills, then UpdateSomeSkills on the skills found at "update".
So a skill changed here stays in Unupdated with its Update button, one
removed upstream is only marked, and a replaced edited version goes to the
backups, as with an update by hand. Updated names and a new error are
logged.

Run (WSL2 magpie-desktop, Go 1.26.8; mote was at load 167, mica's disk full),
at ab637d3c4 (this change on 14807bcf2):
- TestAutoUpdateSkills (local git repo fixture, no network) ok.
  Broken by hand (switch and due checks removed): FAIL
  "off: ... Updated:[pdf] ... notes "two"". Restored: ok.
- -race -count=5 TestAutoUpdateSkills|TestInstallFromGitRepo: ok
- gofmt -l: clean; go vet -tags nogui ./... ok; GOOS=windows go vet ./...
  ok; go build -tags nogui, GOOS=windows go build ok
- go test -tags nogui -timeout 45m ./... under a temp HOME: every
  package ok except two reds in untouched packages, each also red alone
  at origin/main 659ca3f02: internal/update
  TestSettleAsksAboutADownloadKeptElsewhere (filed #6648) and
  internal/usage TestRequestStateKeptAcrossACatalogFetchedAgain (#6572).
- GUI: skill-auto-update.test.cjs (en, zh, zh-TW, ja, de; 400px wide;
  Chromium and WebKit), i18n-keys, i18n-en-no-cjk, skill-update-feedback
  and skill-update-edited: 36/36 pass.
Not run: the whole GUI suite had started but not finished at push
(pushed at the coordinator's ask), and nothing was run at the rebased head
e0e8f34a7 (its parents touch lessons/update only). No darwin vet: the
cgo-off cross vet fails in gui's traywindows_darwin_test.go on main too.
Not tried with a real GitHub skill in a live magpie.
2026-11-14 19:09:55 +08:00
yetone ed82d8fab1 agent: a plugin's connect is given magpie's decision models as decisionModels
An agent plugin's connect() got only chat models in `models`, and
/v1/models leaves decision models out too, so a plugin had no way to
learn magpie's Jev, Clef or plugin `decides` models, though
/v1/systemone and /v1/decisions answer them (baranwang on X,
tweet 2121551068022915149).

connect's input now has `decisionModels`, apart from `models`:
provider.OfferedDeciders (what /v1/models lists under
X-Magpie-Deciders), then the decision routing groups, each
{ id, name, provider | group: true,
  endpoints: ["/v1/systemone", "/v1/decisions"] }, [] for none.
`models` and /v1/models are unchanged. Docs: reference.md,
agent-wiring.md, site plugins page (en, zh, ja) and llms-full.txt.

Run at 87f358b70's tree rebased on 659ca3f02 (a gateway-only parent; the
plugged tests re-run there: ok), on wsl-run, magpie-desktop; mote was at load 75-150, mica's disk full):
- go test -tags nogui -count=1 ./internal/agent ./internal/agentplug: ok
  (agent 191s)
- go vet (linux), GOOS=windows and GOOS=darwin go vet of both: ok
- site: node --test worker.test.mjs -n llms-full: ok
- gofmt -l: clean
Broken by hand: connect given decisionModels [] makes
TestPluggedConnectSeesDecisionModels red (jev and the group missing).
Not run: the full go test ./... before the tag (another session's full
suite held the WSL box, mote over its load); run after, recorded on
the issue/next commit. No real third-party agent plugin tried with it.
2026-11-14 18:55:12 +08:00
yetone 659ca3f026 gateway: through a Remote magpie the log records the tier the other magpie sent (JackyFill on X)
Codex -> magpie1 -> (Remote magpie) -> magpie2 -> a ChatGPT account, with
Fast on in magpie2 alone: magpie2 sent service_tier priority and logged
the served tier unknown (the ChatGPT backend says "auto"/"default"
whether priority ran or not, servedTierAt). magpie1 only saw that
"default" in the relayed body, from a host that isn't chatgpt.com, and
logged tier_sent "" and tier_served "default".

A try asked by another magpie (magpieAsks) now says on its reply's
header the tier it sent its vendor (X-Magpie-Tier-Sent, "none" for
none) and, when that vendor's "auto"/"default" tell nothing,
X-Magpie-Tier-Unsaid: 1 (stampTier, from holdWriter.writeHeader). The
asking magpie takes them from a Remote magpie's reply alone (tierThere
in heardReply; a vendor's X-Magpie- headers are still never passed) and
records them as the try's tier_sent and an unknown tier_served, in the
usage log and on the route. A chain passes the farthest magpie's on.
docs/subsystems/gateway-routing.md says so.

Run (wsl-run, Linux, at this head): new TestRemoteMagpieTierRecorded
(one server as both magpies, its key's tier fast then standard, the
backend answering auto/default) green; broken by hand: with the four
source files at origin/main it fails with exactly the report, "sent ''
served 'default', want sent 'priority'"; the whole internal/gateway package ok (932s, -timeout 45m) at
5a28b17c6 (on origin/main 943404477); go vet ./internal/gateway for
linux, windows and darwin clean; gofmt clean.
Rebased after onto 9f4e1120f (agent, provider, gui only; no internal/gateway
file) and run again there: the new test, the tier and remote-group tests
and vet of internal/gateway ok.

Not covered: a reply whose headers a keepalive sent before the try
answered carries neither header, and magpie1 keeps its own record.
Not tried: two real computers or a real ChatGPT account; the full
./... suite; the Windows box.
2026-11-14 18:47:33 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

Cause: Sync's `failover` in codex.go wrote
`openai_base_url = "http://127.0.0.1:3425/backend-api/codex"` (stash
codex.failover), or pointed a CC Switch OpenAI mirror's base_url at the
gateway (codex.mirror_failover), for any Codex signed in to ChatGPT with
another of its accounts on (#1385), on every start and Sync, unless the
user had disconnected Codex or turned on "Only switch Codex's sign-in".
The row said not connected while every request went through magpie.

Fix: failover writes nothing any more. A Codex that isn't wired or
using magpie as its provider gets what failover wrote before taken out
by Sync: the marked base URL, or the mirror's base_url. A base URL the
user wrote by hand has no mark and stays (#856). Failover between Codex
accounts comes with connecting Codex. modelOptions no longer counts
failover as through magpie, so a pick of Codex's own model on the
Agents page doesn't go via magpie. codexProxyOK (the proxy probe only
failover waited for) is gone. The CLI's and GUI's switch-only lines,
reference.md and the subsystem pages say failover is for a connected
Codex.

Users already affected: the first Sync after updating (magpie's start)
removes the marked openai_base_url or mirror base_url, and the route
change restarts Codex's app-server; Codex then goes straight to OpenAI
on its own sign-in. A thread opened while it was on magpie keeps its
provider until reopened, as after Disconnect.

Tests:
- TestCodexNotConnectedStaysOffMagpie: two spare accounts on, Codex
  not connected; SyncCatalog, Sync twice and a model pick leave no
  base URL, no model_provider, not Wired/FailingOver/CodexOwnOnly.
- TestCodexFailoverFromBeforeTakenOut: a marked base URL and a marked
  mirror base_url from before are taken out, bytes restored exactly.
- TestCodexSwitchOnlyKeepsCodexOffTheGateway, the CC Switch mirror,
  disconnect-stays and proxy/EndFailover tests reworked to seed the
  old state by hand; TestCodexFailoverHeldWhileProxyDoesNotPassOn
  deleted with codexProxyOK.

Red on the old code (old codex.go + codex_proxy.go, new tests, mote):
TestCodexNotConnectedStaysOffMagpie, TestCodexFailoverFromBeforeTakenOut
and TestCodexSwitchOnlyKeepsCodexOffTheGateway fail with the reporter's
line `openai_base_url = "http://127.0.0.1:3425/backend-api/codex"`;
TestCodexCCSwitchOfficialOpenAIMirror fails with the mirror pointed at
magpie.

Run (mote; mica's disk is full, 100% with other sessions' runs, and
mote's load was ~17-25 of 18):
- At base b592c1fde: go vet ./... (darwin, GOOS=linux, GOOS=windows)
  ok; go test -timeout 45m ./... 98 ok, two reds:
  TestEveryRouteHasACommandOrIsNamed (fixed on main by 69946f43c) and
  TestCoreScriptBudget, mine (+24 bytes) - the GUI string was shortened
  to fit, no raise.
- Rebased on a63923e3d (what main changed since the base: agent, cli,
  gateway, gui, provider, sessions): gofmt -l clean; go test
  ./internal/agent ./internal/cli ./internal/gui ./internal/provider
  ./internal/sessions all ok. Then rebased on 943404477 (GUI tests
  only below run there).
- GUI (chromium + webkit, every language, both widths): switch-only,
  agent-failover, i18n-keys, i18n-en-no-cjk, claude-switch-only,
  panel-switch-accounts: 115 of 116; the red is claude-switch-only
  chromium 1100 en "the page doesn't move" (scrollTop 3), 4 of 12
  alone here, 0 of 9 on origin/main 943404477, on a path this change
  doesn't touch; filed as #6645 with its output. agent-switch-accounts is 20 of 24
  red the same on a fresh origin/main 69946f43c (#5925, Claude Code
  path, untouched here).

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone 14807bcf20 update: a Windows download kept outside Downloads asks to install too
@XBJNTMs2mDbsvPH on X: on Windows magpie ran from wherever the
downloaded exe was and updated itself in place there, so deleting the
download deleted magpie, and opening copies of different versions left
several Magpie entries in the Start menu.

Cause: update.Settle installed the exe into %LOCALAPPDATA%\Programs\magpie
only when it ran from the known Downloads or Desktop folder or a temp
folder. A browser set to save elsewhere (D:\下载), or a download moved
into a folder of the user's own, never counted, so that copy stayed the
app, updated in place, and each copy opened was an app of its own to
Windows (its own path: taskbar, Start's lists, Open at login,
Magpie.lnk repointed at whichever ran last).

Now an exe still named as the site's download
(magpie-windows-amd64.exe, "… (1).exe", arm64; downloadName) counts as a
download wherever it is, but only through the existing install dialog,
never unasked (no dialog, no install). Installed, it opens the installed
copy as a download in Downloads does, and a newer one replaces it.
Cancel on such a copy is kept in HKCU\Software\magpie NotInstalled (the
exe's path): it runs where it is from then on, is not asked again and
never forwards; another copy is still asked. Cancel in Downloads is not
recorded, as before. forwards() (no magpie.com beside a forwarding
copy) follows the same rule. Uninstall's ForgetInstallDir takes the new
value out with InstallLocation. A renamed copy (D:\Tools\magpie.exe)
is left alone as before. No new UI: the dialog is the one from 49c9491b7.

The shortcut code itself makes only one Magpie.lnk and repoints it; it
was not changed.

Tests: TestSettleAsksAboutADownloadKeptElsewhere and
TestSettleDeclinedElsewhereIsKept (fakes, any OS), TestDeclinedRecord
(real HKCU, a key of its own, Windows). TestSettleLeavesAChosenPlace now
uses a renamed copy and checks nothing is asked.

Run:
- win-run (xiaomi-gpu, Windows 11) go test -count=1 ./internal/update/
  ./internal/uninstall/ ./internal/shortcut/ ./internal/gui/: update,
  uninstall, shortcut ok except TestPackagedByDpkg (#4603, untouched);
  gui red TestGatewayHeldByAContainer and TestLodyImportHandoff (#6068,
  untouched).
- win-run go test -run 'TestSettle|TestDeclinedRecord|TestForward|
  TestNoCompanion|TestInstall' -v ./internal/update/: ok.
- Broken by hand on Windows: the name check off -> both new tests red
  (settle = "" want the installed; declined ""); the decline record
  ignored -> TestSettleDeclinedElsewhereIsKept red ("asked again").
- win-run go vet ./internal/update/ ./internal/uninstall/ ./internal/gui/
  and wsl-run go vet -tags nogui ./internal/update/ ./internal/uninstall/
  (magpie-desktop, covers install_other.go): clean. gofmt -l clean.
- win-run go test -count=1 . (TestAllLazyPatternsCompile and the other
  root guards, the new pattern included): ok.

Not run: the full suite and a darwin vet (mote at load 126-142, mica's
disk full). Not tried: the real app's dialog on an interactive Windows
desktop from a non-Downloads folder (the box's HKCU\Software\magpie and
Start menu are shared with other sessions' magpie there), and the
reporter's duplicate Start entries were not reproduced; which list
showed them is not known.
2026-11-14 18:20:53 +08:00
yetone 07a62b3739 providers: Copy all keys, and magpie provider keys, carry a provider's keys to another magpie
@emilochen on X asked to batch-export one provider's keys, to sync them
between a local and a cloud magpie. Each key row could copy only its own
key (#1480), and nothing printed them all.

- A provider with two or more keys gets a "Copy all N keys" row under
  Add another key. It asks provider/key with allKeys (provider.AllKeys:
  the main key and every listed key, deduplicated, turned-off ones too)
  and copies them one a line, for the other magpie's Paste several
  (keys/import). The secret goes only to the clipboard on the click,
  through the page's copy(); nothing logs it, and the route sits behind
  the GUI API's existing local/origin guards. A signed-in account has
  no keys and is refused.
- The row is drawn by keyrates.js (copyAllKeysRow), already imported
  when a provider with two or more keys opens; keyRateField now takes
  which of its parts to draw. It has its own class, keys-copy-all, not
  .add, since ~21 GUI tests take .acc.add as the one adding row.
  TestCoreScriptBudget's core budget goes up by the 72 bytes left in
  app.js (the placing line and the helper's new argument); app.js stays
  under its own budget.
- CLI: `magpie provider keys <id>` prints the keys one a line;
  `magpie provider keys <id> add [key… | -]` adds them from words or
  stdin (SplitKeys + AddKeys), so
  `magpie provider keys relay | ssh cloud magpie provider keys relay add`
  works. A word starting with "-" is refused, never taken as a key.
- Strings in en, zh, zh-TW, ja, de.

Related: #5387 (sharing saved providers through magpie:// links), not
closed by this.

Run on mote (mote-run) at this tree on 11ddf076b (debc80271, its new parent, changes LESSONS.md only):
- gofmt -l internal/: clean. go vet (darwin) ./internal/provider
  ./internal/gui ./internal/cli; GOOS=linux go vet -tags nogui ./...;
  GOOS=windows go vet ./...; GOOS=linux go build -tags nogui and
  GOOS=windows go build: ok.
- go test -count=1 ./internal/provider ./internal/cli: ok;
  ./internal/gui: ok (TestCoreScriptBudget included, after the budget
  change).
- GUI, Chromium + WebKit: key-copy-all (en/zh/zh-TW/ja/de × 900/420px),
  api-key-usage, i18n-keys, key-price-rate, key-copy, key-weight,
  click-scroll: 104/104. key-copy-all again in WebKit twice: 15/15 each.
- GUI, 43 key/provider/i18n files at the change vs the same files at
  untouched 11ddf076b: the only new reds were api-key-usage's key-row
  count (it counted .acc:not(.add); now leaves keys-copy-all out). The
  other 67 reds are the same on the base and filed: #5835 key-switch,
  #6414 key-balance-card de, #6424 key-box-once, #5866 signin-proxy
  380, #6444 api-key-theme, #4126 key-replace 420, #4673
  provider-typed, #6416 key-import Paste several, and #6628 (filed now)
  login-export's Export row count.

Broken by hand: key-copy-all.test.cjs at untouched 11ddf076b assets
fails 10 of 15 in WebKit (the 5 that pass are "one key has no Copy
all"). The Go tests can't build on the old code (AllKeys, keysCmd).

Not tried: the real app and the system clipboard, the Windows and
Linux boxes, a real cloud/headless magpie over ssh, and the full Go
suite (mote and mica were both over their load limits; the three
touched packages and cross-OS vet ran instead).
2026-11-14 16:34:10 +08:00
yetone 11ddf076b4 usage: a Qwen AI platform Token Plan is read through a sign-in to the platform (@imthe99galaxy on X, #5829)
On v0.1.4137 a provider on the Qwen AI platform's Token Plan
(qwen-token-plan, token-plan.maas.qianwenaiapi.com) had no quota card at
all. The plan key (sk-sp-) only authorizes inference; the platform tells
the plan's usage only to a sign-in on the platform, and magpie had none.

Now each such provider can sign in to the platform, as the QianWen CLI
1.10.0 does (qianwen_plan.go, UA qianwen-cli/1.10.0):
- a device sign-in with PKCE S256 at t.qianwenai.com/cli/device/code and
  /cli/device/token, approved in the user's browser; the editor's
  "Sign in to the Qwen AI platform" opens the page and waits for it;
- the session is the provider's own, kept by provider id in
  qianwen-auth.json (0600), moved on Rename and dropped on Delete;
- cli.qianwenai.com/data/v2/api.json (GenerateCLIAccessToken) mints a
  console token, kept and minted once more when the gateway answers
  NotLogined; ConsoleNeedLogin or a fresh token refused signs it out;
- the usage is the Alibaba Token Plan's BroadScopeAspnGateway call at
  cs-data.qianwenai.com with consoleSite QIANWENAI, region cn-beijing,
  read by the shared aliAskUsage/aliReadWindows (alibaba_usage.go now
  takes the console per call). The sk-sp- key is never sent there.
- Plan windows (planquota.go) and routing's key allowance
  (key_allowance.go, keyTag "qianwen") read it; not signed in, the card
  says so with Open settings (NeedsAccessKey).
- GUI routes /api/qianwen/{id}/signin (POST start, GET state),
  /signin/cancel, /signout; the editor's field lives in qianwenplan.js,
  imported when such a provider's editor opens. The core script budget
  is raised by 326 for the import and one quotaError line (its reason in
  core_budget_test.go). The routes are in the CLI parity's notYet, as
  StepFun's are.

Run, on mote at the base df2b819c6 (= origin/main then):
- gofmt -l: clean. go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet on internal/provider, internal/gui, internal/cli: ok.
- go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli: provider ok; gui and cli red on TestCoreScriptBudget
  and TestEveryRouteHasACommandOrIsNamed, both mine; fixed (code moved to
  qianwenplan.js, budget +326, routes named), then gui ok, cli ok.
- go test -race -run Qianwen ./internal/provider: ok.
- GUI (chromium + webkit, 900/420px, en zh zh-TW ja de where the file
  has them): qianwen-plan 20/20, stepfun-per-provider,
  usage-access-key-card, volc-access-key, quota-balance-error,
  i18n-en-no-cjk all ok; earlier also opencode-zen-balance,
  siliconflow-balance, usage-card-refresh, usage-remote-key-limits,
  usage-remote-cards ok. Reds not mine: i18n-keys "a plugin's words are
  its own" (#6619, fixed on main by ea6470cb7), old-webkit's
  headerpresets.js (#6030) and app.css :has() (#5919).
- Rebased on origin/main 79a30eb9c and run again at that tree on mote:
  go test -count=1 -timeout 45m ./internal/provider ./internal/gui
  ./internal/cli all ok; qianwen-plan + i18n-keys 24 pass, 0 fail. Rebased again onto
  fc75d90af before the push; b507b5f69 and fc75d90af touch only
  internal/sessions and third_party/yaml.v3, not run again.

Broken by hand, each red, then restored: the NotLogined retry, the
code_verifier, renameQianwen, the planquota channel, forgetQianwen on
Delete, the session expiry check, qianwenWatch not called, the sign-in
quotaError mapping.

Not tried: a real sign-in. No Qwen AI platform account is available here,
and approving the device sign-in grants an OAuth permission. Fixtures are
built from the QianWen CLI 1.10.0 source and the live device/code and
unauthenticated replies; the usage reply's shape is the Alibaba Token
Plan's, which the CLI reads with the same code.
2026-11-14 15:46:34 +08:00
yetone 01c3efc4f7 library: billion-context's compression markers can be switched off (@JamesYu32 on X)
@JamesYu32 asked for a switch that turns off the markers billion-context
adds after it folds: compress.visibilityMarkers. In bili 0.1.213
(CONFIGURATION.md, dist/index.js) it is a boolean, true by default; true
appends the 📦/❌ line after a compress, decompress, search_context or
acp_status call and re-injects it into the rebuilt history, false drops
both, and the tool calls still run. Some models imitate the markers.

The billion-context tab's Advanced fold gets "Show compression markers",
on unless the file says false. Off writes compress.visibilityMarkers:
false through edit.PatchJSON (comments and every other key kept); on
takes the key out, back to bili's default, rather than leaving a value
magpie chose. A provider's or model's own compress.visibilityMarkers is
the user's and is left as it is; a non-boolean value (which bili
rejects) is not read as off. The running bili is asked to reload, as
for the other settings. Under Advanced because it is rarely changed.

Run (mote, at this tree on origin/main df2b819c6):
- go test -count=1 ./internal/library/ ./internal/gui/: ok (117s, 136s)
- go vet ./internal/library/ ./internal/gui/; GOOS=linux go vet -tags
  nogui and GOOS=windows go vet of both: clean. gofmt -l: nothing.
- node --test of every library*.test.cjs and i18n*.test.cjs (81 files,
  Chromium and WebKit, every language, 1100 and 420 wide): 1753 of
  1754 pass. library-bili-settings now switches the markers off under
  Advanced and checks the post is {markers:false}. The one red is
  i18n-keys "a plugin's words are its own": third_party/yaml.v3/yamlh.go
  (0caa09b3d) says the usage plugin's "Error type"; red on origin/main
  without this change, fixed in the next commit.
- Real bili 0.1.213 (npm, sandbox HOME/XDG on mote): started with
  {"compress":{"visibilityMarkers":false}}, GET /__bili/config showed
  "compress": {"visibilityMarkers": false}; with the key taken out,
  POST /__bili/config/reload answered 200 and the config had no
  visibilityMarkers (default on).

Broken by hand: on writing true instead of taking the key out,
TestBiliMarkersSwitch fails ("turning markers back on left the key in").

Not tried: a real agent session through bili to watch the markers
disappear from the model's view; only the config bili loads was checked.
2026-11-14 15:33:24 +08:00
yetone df2b819c67 library: Antigravity and Crush get copies of skills on Windows (#6610, #5107)
On Windows without the right to make a symlink, magpie links a skill with
a junction. Go 1.23+ lists a junction as ModeIrregular, neither a folder
nor a symlink, and Antigravity (the app and agy: customizations'
discoverInSubDirsFiltered) and Crush (internal/skills on fastwalk, which
follows only a ModeSymlink) keep only folders and symlinks, so a
junctioned skill never showed in them. dsh, pi and the other Node, Bun,
Rust and Python agents follow a junction.

Checked against the real apps on xiaomi-gpu (Windows 11) in a sandbox
USERPROFILE: Antigravity 2.30.0's language_server.exe (--standalone)
GetAllSkills lists a skill in a folder and one behind a symlink, not one
behind a junction. crush v0.101.0's `crush run` request to a local
capture server listed the folder and the symlink, not the junction. On
macOS agy 1.5.8 (ACP session/new, available_commands_update) takes a
symlink that leads out of ~/.gemini/config, so #6610's "confined to the
folder" filter doesn't touch magpie's links there.

- junctionBlind (agy, antigravity, crush) and skipsJunctions: on Windows
  these targets have Copy, so they get marked copies, made again when
  the library's changes, and the Library page shows "Only ever takes
  copies" for them. A junction an older magpie made becomes a copy.
- inShared: a link in ~/.agents/skills is no skill to them, so Crush,
  which reads that folder too, gets its own copy.
- A project's .agents/skills entry that one of them reads is a copy
  (syncFolder's per-entry flag); one no such agent reads is a link again.
- takeEdits takes an edit made in a project's copy into the library, as
  one in an agent's copy is, so a copy a user edits isn't undone by the
  next sync (Project.Copy's copies too, which were made again over an
  edit before).
- behind lists these agents' stale copies.

Run:
- go vet ./internal/library, GOOS=windows and GOOS=linux go vet, gofmt -l:
  clean (mote).
- go test -count=1 ./internal/library: ok on mote (macOS) 107.9s and on
  xiaomi-gpu (Windows 11) 440.0s, at this change on 0caa09b3d.
- go test -run JunctionBlind ./internal/library: ok on mote and on the
  Windows box (-v: all four new tests PASS, TestJunctionIsALink too).
- After rebasing on be7d22edd: go test ./internal/library on mote, ok.

Broken by hand:
- Without `t.Copy = skipsJunctions(a.ID)`, the inShared check and the
  project per-entry copy: TestJunctionBlindAgentsGetCopies,
  ...AgentSkipsSharedLink and ...ProjectCopies red on mote; on Windows
  TestJunctionBlindJunctionBecomesCopy red (both entries stay junctions,
  Lstat mode 2684354563 attrs, not a dir).
- Without the project loop in takeEdits: TestJunctionBlindProjectCopies
  red, the user's edit replaced by the library's.

Not tried: magpie's own binary syncing a real Antigravity on Windows end
to end (the apps were checked against a folder, a symlink and a junction
made by hand; magpie's copy is a plain folder, which the test checks a Go
ReadDir sees as one). Antigravity and Crush on Linux (symlinks there,
which both take). The full go test ./... suite.
2026-11-14 15:05:21 +08:00
yetone be7d22edda gateway: a pi 1.x run of the Claude bridge starts in pi's own folder
fysly on X: a Pi turn on a Claude subscription told the model two working
directories, Pi's own and magpie's shared work folder under /private/var/
folders (magpie-claude-work-<uid>), where the bridge's Claude Code ran.

Pi 1.x states its folder as a system prompt section with the path on a
line of its own, "<cwd>\n/x\n</cwd>" (buildSystemPromptSections, joined
by getSystemMessageText). clientSaidWorkDir and clientTurnWorkDir read
<cwd> only on one line, as Codex writes it, so clientWorkDir found no
folder and the run started in the shared folder: Claude Code's own
environment then named that folder beside Pi's <cwd>. The folder rules'
reader (workDirIn) already allowed whitespace inside <cwd>; the bridge's
now does too.

Sibling in the same reader: workDirIn decodes the path's &, < and > as
entities (Codex escapes them in <cwd>, Claude Code < and >), the bridge's
did not, so such a folder failed os.Stat and its run went to the shared
folder too. Now decoded the same way.

No text of Claude Code's prompt changes: only the folder it runs in, the
existing clientWorkDir path for Claude Code, Codex and OpenCode callers
(--setting-sources "", no auto memory, CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS).

Run (mote, at 0caa09b3d plus this change): gofmt -l internal/ clean;
go vet ./internal/gateway/ for darwin, GOOS=linux and GOOS=windows ok;
go test -count=1 -timeout 45m ./internal/gateway/ ok (894.8s).
Rebased onto 3e38e4ba2 (codexcat, antigravity, codeassist): go vet and
go test -run 'WorkDir|WorkPlace|Claude' ./internal/gateway/ ok (150.5s)
at the pushed tree.
Broken by hand: with origin/main's claude_subscription.go and the new
tests, TestClaudeRunsInTheCallersWorkDir's "pi 1.x" and "Codex, a folder
written as entities" are red (both runs in magpie-claude-work-<uid>);
green with the fix.
Real pi: pi 1.4.0 in a sandbox HOME/PI_CODING_AGENT_DIR, pointed at a
local capture server; its real /v1/messages body ends
"<cwd>\n<proj>\n</cwd>". That body, sent through the bridge with a fake
claude, ran in <proj>, not the shared folder.
Not tried: a real Claude subscription turn from pi (no sandbox Claude
account here); the full go test ./... (mote and mica both over their load
limits); pi 1.5.x's prompt (1.4.0 installed, workdir.go names the same
<cwd> form since 1.1).
2026-11-14 15:01:56 +08:00
yetone 13cb07fde7 codexcat: an OpenAI model is compacted where Codex's own catalog holds it, GPT-6.1 Terra at 500K (@flower__daisy on X)
@flower__daisy: Codex compacts often after connecting to magpie, "don't
Codex models have 500k now?". Codex's bundled catalog (rust-v0.165.0 to
rust-v0.169.0, models-manager/models.json) gives gpt-6.1-terra a
context_window of 500000; every other listed model 272000 (red-latest
372000). Long conversations' default, the working window, told Codex to
compact every model with a longer window at 272K, "what OpenAI does
with its own models". For GPT-6.1 Terra that is no longer what OpenAI
does:
- a ChatGPT account's codex/gpt-6.1-terra in magpie, with no entry in
  Codex's models_cache.json, got context_window 500000 and
  auto_compact_token_limit 272000;
- an OpenAI API key, relay or found auto/ gpt-6.1-terra got models.dev's
  922K and 272000.
Codex's own entries, passed through beside a ChatGPT sign-in, were
already as the backend gave them.

codexcat.Working is now Long conversations' threshold, except that at
its default an OpenAI model is held to the window official Codex holds
it to (OwnWindow: the account's models_cache.json list, else the bundled
catalog, matched by longest prefix as Codex does), never above the
model's own window. A size the user set (CompactAt, Codex's own Long
conversations) and Full window are as they were. Another vendor's model
and a routing group keep 272K. A model whose window magpie doesn't know
gets the same threshold. The Context tab's advice (tune.go codexWindow)
and the Long conversations row (codexWindowUnder) read it too.

Tests:
- TestBundledWindowsAreCodexOwn: bundledWindows equals the
  context_window of every model in testdata's rust-v0.166.0 models.json.
- TestCodexCatalogHoldsOpenAIModelToCodexWindow: terra on an API key,
  a dated auto/ id, a 400K relay, codex/ at 500K, a relay with no
  window; sol, DeepSeek, Claude and a group at 272K; the account's list
  before the bundled one; CompactAt 300K and Full window as set.
  Broken by hand: with entriesAt back on work.Working, 6 cases red
  (codex/gpt-6.1-terra told [500000 272000]).

Run (mica, mote over its load): go test ./internal/codexcat; go vet
codexcat and gui for darwin, linux (nogui), windows; gofmt -l; go test
./internal/gui -run 'Tune|CodexWindow|Codex.*Window|LongConv|Compact';
then -run 'Codex|Compact|Window|Tune|Catalog|Ultra|Relist' over
gateway, provider, agent, gui and codexcat: all ok (gateway 280s).
Full suite: queued on mica behind another session's suite.lock, not
finished at push (the owner's ship-at-once rule).

Not tried: a real Codex 0.169 session running past 272K on GPT-6.1
Terra through magpie. Claude Code and Grok Build keep the 272K working
window for every model; no Anthropic or xAI catalog gives an OpenAI
model a window of its own.
2026-11-14 14:50:56 +08:00
yetone 73ecef0b36 memory: each memory is a Markdown file of its own
memory.json held every memory in one JSON file, which grew without
bound, was hard to read or fix by hand, and was rewritten whole on every
change. Memory is now a folder, `memory/` beside where memory.json was:

- `<id>.md` is the memory: YAML front matter (kind, scope, status,
  origin, pinned, tags, why, sources, times) and the text as the body.
  The file is the source of truth.
- `meta.json` holds what isn't one memory's: projects, the digest,
  dismissed texts, deletions, declined suggestions, when a search last
  returned each memory (so a search never rewrites a memory's file), and
  the hash of each file as magpie last wrote it.
- `index.json` is a cache of the parsed files by size and mtime only:
  deleted or garbled, memory reads the same.
- `journal.json` holds a change to more than one file (a merge, a sync)
  before any is written; the next read finishes one cut off halfway.

A file whose hash isn't the one magpie wrote was edited or added by hand:
it is the user's (origin user, Edited), so a tidy leaves it and an
agent's change synced from another computer never writes over it. A file
with no front matter is a global fact named by its file. A write leaves
any file that changed on disk since it was read (a hand edit made
meanwhile), and so does a remove. A file that can't be parsed is left
out and never written over nor removed, sync included; meta.json that
can't be read is unknown (an error), as memory.json was.

memory.json is moved in on the first read, all under one journal, and
kept as memory.json.migrated. One that can't be read is an error and
nothing is written.

The scope of a hand-written file keeps its case (a project's holds a
path); "global" in any case is global.

Ran at this head (rebased on origin/main 50d88f17c), on mote:
- go test -count=1 ./internal/memory ./internal/memdistill
  ./internal/memembed ./internal/backup ./internal/library ./internal/gui:
  ./internal/davsync ./internal/appdir: ok; go vet ./internal/...: ok;
  go test -run 'Memory|memory|Doc|Subsystem' ./internal/...: 98 ok
- go vet ./... and GOOS=windows go vet ./... (before the rebase, whose
  three commits touch no memory code): ok; gofmt -l: clean
- win-run go test ./internal/memory ./internal/backup: ok
- wsl-run go vet of memory, backup, library, memdistill, memembed,
  davsync and go test of memory, backup, memdistill: ok
- A copy of the real memory.json (206 memories) migrated in a sandbox:
  every field of every memory the same on the first read, from the
  index, and with the index rebuilt; no memory read as the user's.

Broken by hand, each red, green restored:
- no journal: TestCutOffChangeIsFinished
- no on-disk hash check on write: TestHandEditDuringAChangeStays
- no on-disk hash check on remove: TestHandEditDuringARemoveStays
- broken files written: TestBrokenFileIsLeftAsItIs
- no hand-edit detection: TestHandEditIsTheUsers
- scope lowercased: TestEachMemoryIsAMarkdownFile (and memdistill's
  TestReadsQuietSessionsOnce, which found it)

Not tried: the full go test ./... (mote and mica both over their cores);
the live app's own memory moved in (a sandbox copy only);
`go vet ./...` on Linux (the WSL box has no gtk4 headers for Wails);
a hand edit through a sync service's own conflict copies.
2026-11-14 14:27:01 +08:00
yetone 50d88f17ce sessions: the Claude subscription bridge's own runs are not local sessions
iwinux on X: a Pi request through a group a Claude subscription serves
was listed twice in the request log, once as "Pi · Claude Code" and once
as "Claude Code · Local session", with the same tokens and cost.

Cause: a bridge run is the real Claude Code. It saves its session in the
account's projects folder, in the caller's folder's project: the user's
own ~/.claude or a saved account's claude-accounts folder, both of which
appdir.ClaudeHomes lists. listCCFiles read it as a session of the user's,
and the ledger's pairing (request id, then session and tokens) didn't
match it with the gateway's record, whose session is the caller's. So
every call was counted twice: request log, usage ledger, cost totals,
the Sessions page. -p runs and interactive (TUI) runs alike, plus a
branch's cut copy and a replayed transcript.

Fix: every session a bridge run saves is named by the new
internal/bridgesid. New is a version 4 UUID whose last six bytes are a
keyed SHA-256 of its first ten, the key a random file of this computer's
(<config>/claude-bridge-session-key, made once by temp file + link). To
Anthropic, which Claude Code sends the session id to, it is as random as
any, so it marks nothing upstream. startRun passes --session-id for a new
run (-p and interactive; the TUI helper keeps a --session-id it is given
and makes a marked one otherwise), replaySession and cutSessionWhere name
their files with it. listCCFiles leaves out a .jsonl, and a session's
sub-agent folder, whose id bridgesid.Is knows, for agent "claude" only.
That one listing feeds calls, the ledger, the request log, Sessions,
traces and WSL distros, so all of them drop the double count. Other
bridged runs (warm-up, askClaude, /usage, WSL -p) use
--no-session-persistence and write no session.

Rows already counted twice: a bridge session already removed (a run's
session is removed when it ends) is gone from the ledger already, as it
is read from the files there are. One still on disk under an old random
id (a live or shelved run resumed under it, or a stopped gateway's
leftover in a caller's folder) can't be told from the user's and stays
counted until it is removed; old ids carry no mark to fix it on read.

Tests: TestNewIsKnown, TestKeyKept, TestKeyMadeOnce (bridgesid);
TestBridgeSessionsAreNotLocal (sessions: a marked session in the user's
folder, its sub-agent file, and one in a saved account's folder give no
calls and no rows; the user's session beside them counts);
TestClaudeRunSessionsAreTheBridges (-p and interactive, a new run and a
replayed transcript) and TestClaudeCutSessionIsTheBridges (gateway).

Broken by hand, on mica: bridged() returning false made
TestBridgeSessionsAreNotLocal red (calls req_m1..m4, want req_m1 alone);
newUUID back in startRun, replaySession and cutSessionWhere made both
gateway tests red (print, interactive and the cut copy).

Run on mica at this head (rebased on 7ea1e6a4b): gofmt -l clean, go vet
./... ok, go build ok; go test -tags nogui ./internal/bridgesid
./internal/sessions ./internal/usage ok; ./internal/gateway -run
'Claude|Subscription|Bridge|Fork|Shelf' ok. At the first base (8a59e7616):
the same vet plus GOOS=linux -tags nogui and GOOS=windows vet ok, the three
builds ok, ./internal/claudetui ./internal/appdir ./internal/masking ok.
The full ./... suite was not run: mica's suite lock had five full suites
queued ahead of it, and this ships now.

Not tried: a real Claude Code run with a real account (mote is down;
the -p --session-id flag is Claude Code's documented one, and the
interactive helper already passed it); Windows and WSL runs.
2026-11-14 14:17:52 +08:00
yetone 7ea1e6a4b3 usage: the tray panel and the TUI leave out what the Usage page hides
onkashiko on X: a provider whose allowance card was hidden in the main
window (Usage > Overview, "Hide from Overview") still showed in the menu
bar's panel. The panel's Allowances tab had only its own Arrange list
(panelUsageHidden) and read the full cards.

Now the panel leaves out a card whose cardHideKey is in usageCardsHidden
and the rows in usageWindowsHidden (withoutHiddenRows), as Overview does;
a menu bar cell's card still shows (panelPeek). A subscription whose
every card the page hides counts in the foot's "{n} hidden" and shows as
hidden in Arrange; Show there
also drops its keys from usageCardsHidden, since the panel follows the
page. All of it is panelPageCut in the Usage plugin's page.js, which every
window loads, so the core scripts get no bigger (TestCoreScriptBudget
unchanged). Hiding from the panel alone still leaves the page as it is. The
panel reads settings again each time it is shown (loadBack), so a hide or
unhide in the main window reaches it with no restart.

Siblings: magpie tui's Usage page leaves out the same cards and rows
(usageShown, read at every quota read). The menu bar's cells and tooltip
show only the cards picked in Settings, so they keep a hidden card as
before; routing, caps and counting are unchanged.

Run:
- panel-page-hidden.test.cjs (new): chromium + webkit, en/zh/zh-TW/ja/de,
  10/10 green; red on the old app.js/panelarrange.js (cards still drawn).
- TestUsagePageLeavesOutWhatTheAppHides (new): green; red on the old
  pages.go (balance, account and row still listed).
- GUI: the 128 files that read the panel, Usage or tray code, chromium +
  webkit, every language, on mote: 17 files red, rerun alone at
  concurrency 1 here 123/449 red and at origin/main 015860f2d 122/449,
  the same tests but tray-cell-click's chromium en, which is red alone on
  main too (#5215); the rest noted on #5475. tray-cell-click + panel-arrange +
  panel-page-hidden together before the last rebase (no GUI file changed
  in it): 21 of 22, the one red tray-cell-click's (#5215). At this head
  (after the move into page.js): panel-page-hidden, panel-arrange,
  panel-balance-order and i18n-keys green; the reds in key-balance-card
  (de), panel-fold, tray-cell-click (zh) and usage-cards-hide are each
  in the origin/main 015860f2d record above.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./...) on mica
  under suite.lock at 734f06b64 (this change before the move into
  page.js): 97 packages ok; internal/gui red only on TestCoreScriptBudget
  (fixed by the move), internal/gateway red from "too many open files in
  system" at mica's load ~65. At this head on mote: internal/gateway,
  internal/gui, internal/tui, internal/settings and internal/redact (the
  one commit rebased over) ok; gofmt -l clean; go vet, GOOS=linux go vet
  -tags nogui and GOOS=windows go vet ./... clean; go build ok.
- Rebased onto origin/main 667ac8bd6 (5faed634d): internal/gui (budget
  included), internal/tui and internal/settings ok on mote;
  panel-page-hidden + panel-arrange 18 of 18.
Not tried: the real tray panel by hand on a live install.
2026-11-14 14:10:24 +08:00
yetone 8a59e76165 memory: candidates and set-aside memories don't stay forever
memory.json grew from distilled candidates nobody reviewed and from the
superseded members of merges, which nothing ever removed. memory.Prune
now applies retention on every hourly tick of memdistill.Keep, with
distilling and dreaming on or off:

- a candidate unchanged for 30 days (memory.Keep) is archived;
- an archived or superseded memory unchanged for 30 more is removed,
  recorded in removed (a sync doesn't bring it back) and, if distilled,
  dismissed (never proposed again);
- what the user wrote or pinned (Fixed) is never archived or removed.

Untidy keeps a merged memory when one of its members was removed since:
it is all that is left of that member.

Run on mote at base fc896a9f6, then again at base 90ad90646 (main moved
by GUI-only commits; memory, memdistill and backup rerun ok there):
go test -count=1 ./internal/memory/... ./internal/memdistill/...
./internal/memembed/... ./internal/backup/... ./internal/davsync/...
./internal/library/...: all ok. go vet of memory and memdistill for
darwin, windows and linux: clean. gofmt -l: clean.

Broken by hand, each red: Prune without the Fixed check (archived 3,
removed 3: the pinned and the user's own went); without removed()
(Removed empty, a sync would bring it back); Untidy without the gone
check (the merged memory deleted).

Real data (~/.config/magpie/memory.json, read only): 206 memories, all
changed since 11-13, so the first run changes nothing.

Not tried: the full suite and the GUI suite (no GUI or route change).
2026-11-14 14:00:48 +08:00
yetone 90ad90646a gui: black draws a black dark theme, not Graphite's grey (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS, on v0.1.4124 (tweet 2121468612238266666), with three
dark-theme screenshots of Settings > General, one each with Default,
Graphite and a custom black picked: 「这三个颜色……都显示是一样的」,
「尤其是黑色始终一直是灰色」. Their screenshots show the same page in all
three: ground (25,25,27), card (32,32,34).

Why:
- v0.1.4124 tints the grounds with the pick's hue only (base + k*(c -
  mean(c))), lightness kept. Black and Graphite have no hue, so they
  changed nothing. Default draws no look at all (magpie's own).
- accentOn lifts a dark pick toward white only until it reads at 4.5:1,
  so black's dark ink came out #8a8a8a, next to Graphite's #89898f.

What changes (appearance.go):
- ground(): on the dark theme, a pick darker than the theme's background
  darkens every dark ground by as much (depth()). Black draws a black page
  (#000003), with cards, pills, lines, menus and the tray panel the same
  steps above it as in app.css (card #08080c, line #18181e). Graphite,
  and any colour as light as the ground, draw as before.
- lifted(): black's ink starts most of the way to white, so it is a light
  mono ink (#e0e0e0, dark text on its buttons), not Graphite's grey. On
  the light theme black is #000000, as before. The sibling, white on the
  light theme, now gets a dark ink instead of a mid grey.
- The light theme's grounds keep their lightness: a white pick would melt
  its white cards into the page.
- app.css: a swatch's edge and the chosen ring take a little of the text's
  ink, so the black swatch stays seen on the black page it draws.
- Default stays magpie's own look (grey grounds, indigo accent) for every
  user. Not changed here.

Tests:
- TestBlackIsBlack: black's dark page is black and each ground keeps its
  step; Graphite moves nothing; black's ink is light in dark (>= 1.8:1
  from Graphite's) and #000000 in light; white's light ink is dark; text
  reads >= 7:1 on black's grounds.
- appearance-look.test.cjs: "Default, Graphite and black are three looks",
  light and dark, both engines: three different --accent values; Graphite
  keeps the grey page; in dark, black's page is black, Settings' list sits
  on black's card a step above it, its ink is light; in light, black is
  #000000 ink.
- TestLookFixture's fixture gains #000000 and #52525b.

Run on mote (mote was unreachable for ~20 minutes; the red check ran on
mica), at this commit rebased on origin/main fc896a9f6:
- gofmt -l internal/gui: clean. go vet -tags nogui ./internal/gui, the
  same with GOOS=linux, and GOOS=windows go vet ./internal/gui: ok
  (before the rebase onto fc896a9f6, which touched nothing in gui).
- go test -tags nogui -timeout 45m ./internal/gui: ok (95s, before the
  rebase); at the rebased head go test -run
  'TestAccent|TestLook|TestTint|TestWallpaper|TestBlack|Budget': ok.
- node --test, both engines (the files run every language at 420 and
  1000px where they have that matrix): appearance-look 44/44, i18n-keys
  4/4 at the rebased head; checkbox-look 8/8, seg-contrast 14/14,
  settings-general 20/20, settings-sections 10/10, input-look 20/20
  before the rebase. api-key-theme 0/6 (#6444) and omarchy 8/14 (#6027)
  are red with the same cases on a copy of origin/main fc896a9f6.
- Broken by hand: with origin/main's appearance.go and its fixture
  regenerated for #000000 and #52525b, the new GUI case is red in dark in
  both engines ("black's page is black, not rgb(26, 26, 30)"); light
  passes there, as black was already #000000 ink on the light theme.
- Screenshots, both engines, Settings > General zh at 1200, Default /
  Graphite / black, light and dark, before (origin/main's lookCSS) and
  after (before shots on mica, after on mote): dark black's page goes (26,26,30) -> (0,0,3), card (35,35,39)
  -> (8,8,12); Default and Graphite unchanged; black's ring still shows.

Not tried:
- the real macOS app, WebView2 and WebKitGTK;
- the full Go and GUI suites.
2026-11-14 13:59:58 +08:00
yetone fc896a9f6f redact: a Bilibili BV id, an av number or a YouTube link's id goes as written, whatever the local model takes it for (jimlee0824v2 on X)
jimlee0824v2 on X: in a script's list of nine Bilibili videos
(bvs = ['BV1f94c6uEr3', …]), five BV ids went to the vendor as
{{SECRET_…}}, and the script the vendor's model wrote back could no
longer fetch them. A BV id (BV1 and nine base58 characters) is a public
video's id, not a secret.

Which finder took them: no rule. With Secrets and Personal on and every
kind on, the rules alone mask none of them (the "by the rules" checks in
TestPublicVideoIDGoesAsWritten). The local model did. Asked for real
(Privacy Filter and AstrLink Guard from mote's ~/evalcache) on the
reporter's script: Privacy Filter took all nine BV ids for secrets,
AstrLink Guard eight, and AstrLink Guard took av170001 for an account
number. That the screenshot shows five of nine is the model's score
around its threshold.

The class: a public video's id that the vendor's model needs as written
to look the video up. Now modelFits takes no span of any kind that is
- a BV id (^BV1[base58]{9}$) or an av number (av and up to 12 digits),
  by its own shape;
- a YouTube video's, playlist's or channel's id (10 to 64 of base64url's
  characters) only where its link is right before it: watch?v=, list=,
  youtu.be/, /shorts/, /embed/, /live/, /channel/ on youtube.com,
  youtube-nocookie.com or youtu.be. Eleven base64url characters alone may
  be a key's piece, so no shape alone exempts one.
Nothing is keyed on a field's name. The rules are unchanged: a key in a
BV id's shape after its name (api_key=BV1…) is masked still. Numeric
public ids (a Douyin video's, an X status's) were already held back by
the model checks for bare digits (numberNamedSecret, accountCues).

Tests:
- TestPublicVideoIDGoesAsWritten (new): the reporter's nine BV ids in
  the tool call's arguments as the screenshot shows them, a bilibili.com
  video link, av170001, YouTube watch/youtu.be/shorts/embed/playlist/
  channel links; none masked by the rules, nor as secret or
  account_number from the model. Still masked: a 12-character secret
  (Xq7vR2mK9pLs), BV1 with 0/O/I/l (not base58), a BV id with a 13th
  character, a bare 11-character run, the same run after example.com's
  watch?v=, a key after a YouTube link's &key=, and api_key=BV1VMnk68E9Q
  by the rules.
- TestBVScriptToolCallKeepsIDs (new): the same through MaskJSON as an
  OpenAI tool call's arguments.
- TestMaskEval: cases bilibili-bvids (the reporter's script) and
  video-links, with both real models' recordings added (only these two
  entries; the rest of the recordings were left as committed).
- Broken by hand: the publicID check taken out of modelFits.
  TestPublicVideoIDGoesAsWritten FAILs with each of the nine BV ids
  masked ('"BV1VMnk68E9Q" as secret: masked in "…'{{SECRET_ekl3f6pv}}'…"'),
  av170001 as {{SECRET_…}} and {{ACCOUNT_…}}, the watch?v= id and the
  playlist id; TestBVScriptToolCallKeepsIDs FAILs with all nine as
  {{SECRET_…}}. Restored: both pass.

Run at 3f862a27c's tree (base 1248dc16c, origin/main when pushed):
- mica-run: gofmt -l internal/redact docs (empty); go test -count=1
  ./internal/redact/... ./internal/masking/... ok; GOOS=linux go vet
  -tags nogui ./... ok; GOOS=windows go vet ./... ok; go vet
  ./internal/redact/ ok.
- mote-run (the models' cache is on mote only):
  MAGPIE_EVAL_CACHE=~/evalcache go test -run TestMaskEval -v
  ./internal/redact/ PASS, both models asked.
Not run before the push: the full suite (mica's suite lock had three
suites queued at load 53); it runs after the tag. Not tried: a running
magpie with the model on, and the reporter's whole request (only the
screenshot was posted).

docs/subsystems/gateway-routing.md says it beside the hex number rule.
2026-11-14 13:47:23 +08:00
yetone 1248dc16c7 gateway: Gemini's own tools (Google Search, URL context, code execution) reach Gemini (daoche_wuzui on X)
daoche_wuzui (X, v0.1.4095): magpie's Gemini route ignored Gemini's built-in
tools. A generateContent body's googleSearch/urlContext/codeExecution were
dropped in parseGemini, so the model never searched and no
groundingMetadata came back.

- ir.Request carries GoogleTools. parseGemini keeps googleSearch (and
  google_search_retrieval), urlContext and codeExecution; chat's tools
  read them in both shapes ({"googleSearch":{}} and {"type":"url_context"}).
- buildCodeAssistSent, shared by Code Assist, AI Studio, Vertex and plugins
  spoken to on Code Assist, sends them when no function is declared
  (Google refuses built-ins beside functionDeclarations), Gemini models only.
- A plugin whose API is googleapis.com (Antigravity) now searches itself
  for Anthropic web_search, like the built-in Gemini accounts.
- The Gemini reply carries groundingMetadata (chunks + webSearchQueries),
  streamed and not; executableCode/codeExecutionResult parts are read
  as text instead of being lost.

Run:
- mote-run at 3dc1f13ed (before rebasing onto 27 newer commits):
  go test -tags nogui ./internal/gateway ./internal/provider ok (916s, 139s);
  go vet both; GOOS=windows go vet ./... ok; GOOS=linux go vet -tags nogui
  ./... ok; gofmt -l clean.
- At 80f1e05a3 (the rebase after it only took agent, claude and davsync commits): go vet and GOOS=windows go vet of gateway and provider ok; go test -run "Gemini|CodeAssist|Search|Google|Antigravity|AIStudio|Vertex|Chat|Plugin" ./internal/gateway ok (83s); go test ./internal/provider ok (136s).
- Broken by hand, each red: googleToolsFor, googlePlugin, the reply's
  grounding, the ranCode decode, chatGoogleTool.
- Real account, sandbox HOME (Antigravity plugin, gemini-3.8-flash-low),
  the plugin patched in the sandbox to log what magpie sent it:
  - generateContent with googleSearch+urlContext+codeExecution: the three
    tools reached the plugin, the reply had groundingMetadata (3 chunks,
    webSearchQueries).
  - streamGenerateContent: groundingMetadata in the stream.
  - /v1/chat/completions with {"googleSearch":{}},{"type":"url_context"}:
    both reached the plugin, a grounded answer came back.
  - /v1/messages web_search_20250305: googleSearch sent, the reply had
    server_tool_use + web_search_tool_result.

Not tried: an AI Studio key or Vertex account (unit tests only); the
Gemini CLI account (Google refuses individual Code Assist now); real
code-execution parts (Antigravity's model wrote code as text); whether
Antigravity honours urlContext (a fetch gave the same stale page with and
without it). Anthropic web_fetch is not mapped to urlContext. The full
./... suite is queued behind six runs on mote's suite.lock and had not
run when this was pushed.
2026-11-14 13:15:20 +08:00
yetone 27c998aba0 usage: the tray panel's and Requests' costs follow each provider's currency
onkashiko on X: with Currency set to By provider, the menu bar panel
still showed every cost in one currency; providers and models were not
each in their own. drawLedColumns and drawLedRank (shared by the tray
panel and the window's Requests tab) formatted every value with no
provider, so fmtCost fell back to the Totals in currency.

- usageapi.Ledger echoes the provider a page is filtered to
  (`provider`, omitempty).
- app.js: ledProv(l, split, id) names the provider of a value: the
  ledger's filter, the row's provider (provider split), the provider
  part of a modelAt id, or for a model split the provider(s) that served
  it when they all share a currency. ledFormat/ledFormatLong take it,
  so the rank's values and sub-lines, the tooltip's rows and the axis
  (when one provider is picked) are in that provider's currency. Sums
  (the panel total, the tooltip total, a model served in two currencies)
  stay in the Totals in currency.
- page.js: the Requests head and the cost head use the filter's
  provider; the heatmap tip too. Other fmtCost calls are sums or
  sessions with no provider and are unchanged.
- core script budget +491 (1,269,040 -> 1,269,531): drawLedColumns and
  drawLedRank are drawn by the panel, so there is no lazy page to move
  this to; packed to the shortest form.
- docs/subsystems/gui-shell.md says how By provider reaches the panel.

Run:
- At 065fb6a8b (rebased on 7d5475769), mote: gofmt clean;
  TestCoreScriptBudget and TestLedgerSaysItsOneProvider ok;
  panel-currency-provider.test.cjs 20/20 (chromium + webkit x en, zh,
  zh-TW, ja, de; panel 440/320px, window 1100/420px, no sideways
  scroll, no page errors).
- At ff3ab573d (same change on 90932ed1f), mica, under suite.lock:
  go vet darwin, linux nogui, windows ok; builds for all three ok;
  go test -tags nogui -count=1 -timeout 45m ./... : 99 packages ok,
  exit 0. mote: go test usageapi, gui, usage ok.
- GUI suite, the 155 files the change can reach, mote: 2581 tests, 105
  failures in 13 files; the same 13 files give 104 at 90932ed1f. The
  one extra is tray-cell-click webkit en, flaky on both trees run
  alone (head green twice, base red once). Filed: grip-inset,
  key-balance-card, panel-fold, tray-cell-click, usage-* (#6293,
  #6294, #6295, #6499, #6003, #5872, #6414, #5869, #5796, #5215,
  #4790); panel-shortcut's 20 reds newly filed as #6606.

Broken by hand:
- panel-currency-provider on the old assets (MAGPIE_ASSETS): 20/20 red,
  with the reporter's symptom (DeepSeek $1.00, SiliconFlow $0.500
  under By provider).
- TestLedgerSaysItsOneProvider red with `out.Provider = f.Provider`
  removed.

Not tried: the real app's tray panel with real yuan and dollar
providers.
2026-11-14 12:42:46 +08:00
yetone c51b0ca9fa sessions: the Antigravity app connected to WSL has its usage read from the distro (@guyng35955 on X)
@guyng35955 on X: on Windows, with the Antigravity app connected to a
WSL Ubuntu, magpie showed no Antigravity usage.

Why. Antigravity 2.x (dist/wsl.js and languageServer.js in its
app.asar) runs a Linux language server in the distro when it is
connected to WSL ($HOME/.antigravity-server/bin/<version>/
language_server, started through wsl.exe with --app_data_dir
antigravity), so the conversations go to the distro's
~/.gemini/antigravity, not %USERPROFILE%\.gemini\antigravity. magpie
read Antigravity's conversations only from this computer's folder:
- sessions.wslAgents had no antigravity (nor agy, whose
  ~/.gemini/antigravity-cli in a distro wasn't read either);
- internal/agent kept a distro for the Sessions page only when one of
  wslKinds or the Copilot CLI's folder was there, so a distro with only
  the app's data never reached sessions.WSLHomes;
- and, found on the Windows box: no SQLite database under
  \\wsl.localhost opens in place. Every form (file: URI, plain path,
  mode=ro, provider.OpenReadOnly) answers SQLITE_BUSY after its 3s
  busy_timeout, since the share doesn't take the locks a WAL database
  needs. So listing the files alone would have shown nothing still.

What changed.
- agent: wslKept keeps a distro with ~/.gemini/antigravity(-insiders),
  and the probe looks for them (no agent row for them).
- sessions: wslAgents reads the app's conversations (insiders under
  their own key) and agy's in a distro; their summary rows name the
  distro's folders as Linux does (agyFolder with goos "linux", so
  /home/me/site, not a Windows path). The distro's calls count in
  Calls (wslFiles("antigravity"), wslCallFiles("agy")). The listing
  kept on disk (sessions-wsl.json) carries each file's row, rev and
  read-only, so a stopped distro keeps its titles and folders. A
  distro's ~/.gemini that is this computer's own (a link) is read once,
  as this computer's (sameDir).
- sessions: openAppStore opens agy's and the app's databases read only
  in place, or, under \\wsl.localhost or \\wsl$, as OpenUntouched does
  (immutable with no -wal, else from a copy of the db and its -wal).
- docs/subsystems/agent-wiring.md says which distros are kept for reads
  only.

Not changed: session-read consent ("allow selected" names agents found
on this computer) doesn't look in WSL, as before for every WSL agent.
OpenCode's and ZCode's SQLite readers aren't used for a distro (not in
wslAgents), so they keep provider.OpenReadOnly.

Run (at the tree rebased on dc85a7ca5; then rebased on c8290df25, which
changes nothing under internal/sessions or internal/agent):
- mote: gofmt -l internal (clean); GOOS=linux go vet -tags nogui ./...
  and GOOS=windows go vet ./... ok; go test -tags nogui -count=1
  -timeout 45m ./internal/sessions/ ./internal/agent/: ok (sessions 104s,
  agent 223s).
- Windows 11 (xiaomi-gpu, win-run): go test -run TestWSL
  ./internal/sessions/ ok.
- Real \\wsl.localhost read on xiaomi-gpu: a fixture conversation
  (WAL) and conversation_summaries.db, and agy's conversations, written
  in the WSL distro magpie-desktop's real ~/.gemini from inside Linux;
  a throwaway test on Windows with WSLHomes at
  \\wsl.localhost\magpie-desktop\home\yeton. Before openAppStore: agy
  listed with no folders, the app's conversation missing, 0
  antigravity calls, listing 6.4s (each open waits 3s for BUSY).
  After: the conversation listed with the distro, its title, folder
  /home/me/site, tokens and 4 calls; agy's folders read; listing
  0.21s. With a writer in the distro holding a title only in the -wal
  (wal_autocheckpoint=0, db held open), Windows read the -wal's title.
  The fixture and binaries were removed after.

Broken by hand:
- the three wslAgents entries and the Calls line out:
  TestWSLAntigravityApp red (no antigravity session from the distro);
- sameDir check out: TestWSLAntigravityLinkedHomeOnce red (listed as
  the distro's);
- the listing's row (m.agy, m.rev) not carried: TestWSLAntigravityApp
  red (no title or folder);
- wslKept without the Antigravity dirs: TestWSLAntigravityHome red
  (no homes).

Not tried: a real Antigravity sign-in connected to WSL (the box's app
isn't signed in, and the connection needs its GUI), so the language
server's own files are this fixture, laid out as its source writes
them; the full suite (five full suites were queued on mote's
suite.lock and two on mica's).
2026-11-14 12:27:25 +08:00
yetone c8290df259 provider: Devin's Adaptive and Fusion picks are no longer served
The live gateway's /v1/models listed devin/Adaptive and devin/adaptive,
and Devin answered both with 502 "no API providers are available".
They came from magpie, not the plugin: the plugin's list (and its cached
copy in plugin-providers.json) has neither, since parseFamilies and
parseConfigFamilies skip Adaptive and Fusion. The owner's providers.json
keeps "Adaptive" and "adaptive" in the devin entry's picks (models), saved
when the built-in still listed Devin's router families, before ce8d0e065
served Devin's chat API. A pick only leaves Models when a list that had it
stops having it (dropGonePicks), and no list fetched since ever had these,
so after the move to the plugin they were served as picks of the user's
own (Exposed's unlisted picks) and offered to every agent.

normalize now reads a devin provider's Models and Delisted without
Adaptive and Fusion, in any case (devinRouter, withoutDevinRouters, which
devinModelsFlatten now uses too). Every reader that goes through All
(the gateway's /v1/models, the agents' lists, the editor's Picks) sees
them gone, so old files are fixed for every user on read; the next Save
writes the file without them, and a save that sends one back drops it.
Scoped to provider id devin: another provider's "adaptive" is its own.

Not changed: AccountModels (an account's own list only narrows what it
serves; dropping a lone "adaptive" there would widen it to every model),
Fallback ("devin/adaptive" as another provider's fallback is still tried
and refused) and settings.json's hiddenModels/picked lists (they hide or
pick, never add a model). PickedFrom keeps them, which only means "listed
then". The plugin needs no change.

Run:
- TestDevinRouterPicksNotServed (new): a sandbox HOME with the owner's
  devin entry as written, the plugin moved and its list cached. Red on
  the old provider.go: "served [Adaptive adaptive swe-2 claude-opus-5-5
  Fusion fusion], want [swe-2 claude-opus-5-5]"; green with the change.
- Real data: magpie built at a83fe2325 and at this change (-tags nogui,
  on mica), `magpie models` under a sandbox HOME holding copies of the
  owner's devin entry from providers.json, plugins.json, plugin-auth.json,
  migrations.json and plugin-providers.json. Old: devin/Adaptive and
  devin/adaptive first under Devin, as the live gateway lists them. New:
  the list starts at devin/swe-2, the rest unchanged.
- Full suite on mica through suite.lock at 3b164fafb (this change on
  a83fe2325): gofmt -l empty, go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./..., go build for darwin, linux (nogui) and
  windows, go test -tags nogui -count=1 -timeout 45m ./...: suite exit 0,
  99 packages ok, no FAIL.
- Rebased onto dc85a7ca5 (56 files changed upstream, b76016676 in
  internal/provider): gofmt, vet (darwin, linux, windows) and
  internal/provider's tests again there: vet-ok, ok internal/provider 156s.
  Then rebased once more onto 74c94b5db and e36541ddf (internal/gui
  appearance and site/ only, not re-run).

Not tried: a request through a real gateway, since the requests that
still go (devin/swe-2 and the rest) take no path this change touches.
2026-11-14 12:25:28 +08:00
yetone 74c94b5db0 gui: a picked accent tints the theme's grounds (CHENGJIAHEGOXIS on X)
CHENGJIAHEGOXIS asked, on 0.1.4112 and again on 0.1.4116 ("依然没变,是不是
出bug了"), for the dark theme to follow the colour they picked. v0.1.4114
(a83fe2325) tinted only the chosen thumbs (--mark-fill). Their 0.1.4116
screenshot shows those thumbs purple, but the page, sidebar and cards are
still neutral grey: bg (25,25,27), card (32,32,34). Nothing tinted the
grounds.

lookCSS now also sets the theme's grounds from the picked colour.
- Window, light: --bg, --card-2, --pill, --pill-hover, --seg-track, --line,
  --line-2. Cards stay white.
- Window, dark: --bg, --card, --card-2, --pill, --pill-hover, --line,
  --line-2, plus the menus' --pop-bg.
- Tray panel: the body.panel grounds, in light and dark. tintPanel and the
  Windows title bar read --bg, so they follow.
Each ground takes 5% (light) or 8% (dark) of the colour's offset from its
own grey (base + k*(c - mean(c))). Lightness is kept, so a grey pick changes
nothing. With no accent, or under Omarchy, nothing is drawn.
accentOn and --mark are checked against the tinted grounds too.

Tests:
- TestAccentTintsGrounds covers:
  - every block is tinted;
  - lightness is kept (contrast to the base <= 1.1);
  - a grey pick changes nothing;
  - text is >= 7:1 and the accent >= 4.4:1 on the tinted --bg and --card,
    for many picks;
  - no accent gives no CSS.
- TestTintBasesAreAppCSS holds the Go bases to app.css.
- TestLookFixture holds tests/fixtures/look-accents.json to lookCSS
  (UPDATE=1 rewrites it).
- appearance-look.test.cjs now reads the real CSS from the fixture. A new
  case, in each engine and theme, picks a colour on Settings › General with
  and without a wallpaper, and checks:
  - the list, the sidebar and the body are tinted;
  - Default turns them grey again;
  - the panel's --bg is tinted.

Run on mote, at this commit rebased on origin/main 7b002b6be:
- gofmt -l internal/gui: clean.
- go vet -tags nogui ./internal/gui, the same with GOOS=linux, and
  GOOS=windows go vet ./internal/gui: ok.
- go test -tags nogui ./internal/gui: ok (126s).
- node --test, in both engines, of: appearance-look, omarchy,
  api-key-theme, checkbox-look, sidebar, settings-sections,
  settings-groups, i18n-keys, panel-options-fold and the seg-/theme files.
  Result: 120 of 138 pass. The 18 reds are api-key-theme (6, #6444),
  omarchy (#6027) and settings-groups' warm-ups case (#6597). On a fresh
  origin/main b005d1a47 the same three files give the same 18 reds.
- Screenshots in both engines: Settings › General, dark, zh, the reporter's
  purple #66258d. With no accent the ground is (26,26,30) and the card
  (35,35,39). Before this change the purple pick gives the same values.
  After it, the ground is (27,21,34) and the card (36,30,43).

Rebased on origin/main dc85a7ca5 (then e36541ddf, site/ only; 4 commits, none in appearance, app.css
or boot.js) and run again on mote at this head:
- go test -tags nogui -run 'TestAccent|TestLook|TestTint|TestWallpaper|Budget'
  ./internal/gui: ok.
- appearance-look and i18n-keys: 44 of 44.

Broken by hand: with both tints at 0.0 and the fixture regenerated,
TestAccentTintsGrounds fails and the four new GUI cases are red. Both pass
again with the change restored.

Not tried:
- the real macOS app, WebView2 and WebKitGTK;
- the full Go and GUI suites.
2026-11-14 12:24:31 +08:00
yetone b005d1a473 update: a fresh install of Stable's version stays on Stable (fishmagic80 on X)
The site now offers Stable's downloads, but the app's Update channel is
Every version until changed, so a Stable install was offered the newest
at its first check. Before that check, a fresh install (no version run
before and magpie's folder new, from whatsNew.start) asks the feed for
Stable's version and the newest; when it is Stable's and a newer one is
out, settings take "updateChannel": "stable" (settings.TakeStable, under
the file lock, keeping a channel already set). A feed that can't be read
is unknown and asked again at the next check. A version that is both
Stable's and the newest stays on Every version: its download can't be
told apart. update.LatestStable never falls back to GitHub.

docs/reference.md and the privacy pages (en, zh, ja, llms-full.txt) say
a fresh install asks ?channel=stable once.

Old installs: nothing changes for them. Until a release with this
becomes Stable, a Stable download (0.1.3078 today) is still offered the
newest unless Settings → Update channel is set to Stable.

Run at 936c70756, on mote: gofmt -l internal/ clean; go vet (darwin),
GOOS=linux and GOOS=windows go vet of internal/gui, update, settings ok;
go test -count=1 ./internal/update ./internal/settings ./internal/gui ok
(gui 99.9s). TestFreshStableInstallStaysOnStable goes red (2 subtests)
with the takeStable call removed (broken by hand, on mica). llms-full.txt
regenerated and current.
Not run: the full go test ./... (mote and mica each had several suites
queued on the lock); not tried with a real Stable install.
2026-11-14 12:17:40 +08:00
yetone 7b002b6be8 library: an MCP command's %USERPROFILE%, $USERPROFILE and ~\ are the home on every system (0xBCD18E on X)
0xBCD18E's Library server ran
"%USERPROFILE%\AppData\Local\Programs\Pinky\pinky.exe", and the check
said it couldn't find "%USERPROFILE%\A…": magpie read $NAME, ${NAME}
and ~ in a command but not cmd.exe's %NAME%, so the only way to share
one server across computers with different user names was a per-device
command.

Now HOME and USERPROFILE are both the home, on every system, as $NAME,
${NAME} or %NAME% (either case), and a leading ~ or ~\ too:
- library.json (and so sync and backups) keeps them as written;
- an agent that reads references in a command (Claude Code, CodeBuddy,
  WorkBuddy, Grok, Gemini, omp/Qoder/AtomCode, OpenCode, Cursor) is
  given the home's own variable where it runs: ${USERPROFILE} on
  Windows, where an agent seldom has HOME, ${HOME} on a Mac, Linux and
  in WSL, where nothing has USERPROFILE. Before this, $HOME went to
  Claude Code on Windows as ${HOME}, which it usually hasn't;
- every other agent (Codex, Kiro, Droid, Copilot, Crush, Goose, Pi, ...)
  and magpie's own start (the check, the router, Codex through the
  gateway) get the home's path;
- any other %NAME% (%APPDATA%) is a variable on Windows only, and is
  left as written elsewhere, so 100% or %Y% in an arg stays as it is;
- a command's environment: a leading ~ and %USERPROFILE% / %HOME% in a
  value are put in as the home for every agent and for magpie's start
  (homeEnv); ${NAME} there stays envref's.
No cwd: a Library server has none.

Tests: TestCmdVarsUserProfile forces cmdOS to windows, darwin and linux
for Codex, Claude, Cursor, OpenCode and Claude in WSL, command, args
and env; TestCmdVarsUserProfileLaunch starts a real server by
%USERPROFILE%<sep>prog, %HOME%/prog and $USERPROFILE/prog.
TestCmdVarsPerAgent pins the Unix variable; TestCmdVarsSync expects
${USERPROFILE} in .claude.json on Windows.

Run: the red was checked on origin/main e0889719c's cmdvars.go,
mcp_check.go and mcp_run.go with these tests: all 8 subtests of
TestCmdVarsUserProfile and TestCmdVarsUserProfileLaunch FAIL; with the
change, ok on mote (darwin), on xiaomi-gpu (Windows 11, win-run: the
real check starts the server by %USERPROFILE%\prog, and Claude Code's
.claude.json gets ${USERPROFILE}/bin/x) and in WSL magpie-desktop
(wsl-run). Full suite at b84b6dc3c (this change on e0889719c) on mica
under suite.lock: gofmt -l clean, go vet, GOOS=linux go vet -tags
nogui, GOOS=windows go vet, the three builds, and go test -tags nogui
-count=1 -timeout 45m ./...: 99 packages ok, suite exit 0. Rebased onto
8df4239a8; internal/library run again there.
Not tried: a real agent (Claude Code, Codex) launching the server on
Windows from its written config; no GUI change.
2026-11-14 12:04:38 +08:00
yetone 90932ed1fa gateway: Claude Code's model discovery is shown every model by an id it keeps
Claude Code's Gateway Model Discovery (CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY)
puts in /model only the ids matching /(claude|anthropic)/i: Tvi in the
2.1.316 bundle, te.data.data.filter((se)=>/(claude|anthropic)/i.test(se.id)),
on GET <ANTHROPIC_BASE_URL>/v1/models?limit=1000 with User-Agent
claude-code/<version> (Xs(), not claude-cli/) and anthropic-version:
2023-06-01. A remote magpie's Kimi, GLM and DeepSeek never showed (zent00
on X, tweet 2121440002244747428).

That request alone (claudeCodeDiscovers: the User-Agent and the header,
never another magpie) is now shown a chat model whose id says neither by
Claude Desktop's alias anthropic/magpie-<n> (aliasFor), which unprefixed
already serves as the model for every client, before any provider's
model of that spelling; no Claude id is spelled so. Its display_name is
the agents' list name, which /model shows. Ids Claude Code keeps, names a
gateway key gives models, and every other client's list are unchanged; a
bare-id row it wouldn't keep is left out (its full id's row is there).
"anthropic/<magpie id>" was not used: a provider named anthropic (the
Anthropic preset's id) serves any model asked by that spelling. Zero
config, so no switch.

Run:
- TestClaudeCodeDiscoveryKeepsEveryModel, on mote: red on the old
  gateway.go ("not shown anthropic/magpie-9301644634 for auto/kimi-k3"),
  green with the change; with the anthropic-version check broken by hand
  it fails on the claude-cli/ client. TestCindyDiscovery and the Desktop
  tests green.
- Real Claude Code 2.1.316 binary on mote, sandbox HOME, against the
  gateway with a fake Anthropic upstream: its cache gateway-models.json
  held {"id":"anthropic/magpie-4484984192","display_name":"DeepSeek V4 ·
  DeepSeek"}; `claude -p --model anthropic/magpie-4484984192` answered
  PONG and the upstream was asked model deepseek-v4. Claude Code warns it
  assumes a 200k window for an id it doesn't know, as for any non-Claude
  id.
- gofmt -l: clean. Package vets/builds and go test ./internal/gateway
  started on mote; the full suite (go vet, GOOS=linux/windows vet,
  builds, go test -tags nogui -timeout 45m ./...) is queued under
  mote's suite.lock and runs after the push, per the ship-at-once rule;
  its reds get their own commits.
Not tried: interactive /model screen (the rows come from that cache
file), a real remote magpie over LAN with a gateway key.
2026-11-14 11:43:27 +08:00
yetone c5b40bf898 claude-desktop: after Use Claude Magpie the lit row is Claude Magpie, and its Code tab's row says it is on magpie (xMopf7RF on X)
xMopf7RF on X, 0.1.4111: clicking Use Claude Magpie seemed to connect
their own Claude Desktop, and left "Claude Code · Claude Magpie" saying
"Not connected · uses its own settings" with its switch off.

The wiring was right: with the Separate app on, connecting claude-desktop
writes only Claude-Magpie-3p's config (desktopSets), and the user's own
Desktop is left alone. The page said otherwise twice:
- the row that turned on was still named Claude Desktop. While the
  Separate app is on, state() now names the claude-desktop row Claude
  Magpie (desktopiso.Name), since that is the only config it wires.
- the claude#magpie-desktop row is not wired itself, and need not be:
  Desktop's Code tab runs Claude Code with
  CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST, so its requests go through
  Claude Magpie whatever that folder's settings.json says. While Claude
  Magpie is on magpie, the row carries twinCode (agent.DesktopTwinCode)
  and its line, lit, says "On magpie through Claude Magpie" (en, zh,
  zh-TW, ja, de).

The core script budget goes up 67 for that one connectLine line, cut to
the shortest words that say it; the Agents rows draw it, so there is no
page to move it to. docs/subsystems/agent-wiring.md says both.

Tests:
- TestClaudeMagpieCodeTabRowIsOnThroughIt (agent): DesktopTwinCode only
  for claude#magpie-desktop, only while Claude Magpie is on magpie.
- TestClaudeMagpieRowsAfterUseClaudeMagpie (gui): sandbox HOME, POST
  connect after turning the Separate app on: the wired row is named
  Claude Magpie, the Code tab row has twinCode, the user's own Desktop
  config is unchanged and no Claude-3p folder is made.
- desktop-twin-code.test.cjs: clicks Use Claude Magpie; no lit row is
  named Claude Desktop, the Code tab row's line is lit and fits, the
  click doesn't scroll; en/zh/zh-TW/ja/de, 1100 and 640 wide, Chromium
  and WebKit.

Run (mica; mote's load was over its cores), at e0889719c + this change
(the one later main commit, a83fe2325, is CSS and Go appearance only):
- gofmt -l clean; go vet -tags nogui ./internal/agent ./internal/gui on
  darwin, GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 ./internal/gui (whole package, budget
  included): ok; ./internal/agent -run 'Claude|Desktop': ok.
- node --test, both engines, every agent-*, desktop-*, library-desktop-*
  and i18n-* file (78 files, 1358 tests): 1303 pass, 55 red in 4 files,
  each red the same at origin/main e0889719c and filed:
  agent-details-ready (#6373, #6369), agent-switch-accounts (#5925),
  agent-menu-label (#6371), desktop-tiers (#6475). desktop-twin-code 20
  of 20, desktop-twin, desktop-isolated, desktop-isolated-claude,
  library-desktop-twin, i18n-keys, i18n-en-no-cjk ok.

Broken by hand: at origin/main e0889719c (api.go given only the
TwinCode field, DesktopTwinCode stubbed false), both Go tests are red
("Claude Magpie on: \"Claude Desktop\" wired false"; the code row not
on), and desktop-twin-code is 20 of 20 red ("Not connected · Claude
Code · Claude Magpie uses its own settings").

Not tried: a real Claude Magpie.app in a sandbox HOME on this change
(005178104 did one for the button itself); this change only names rows
and reads the same wiring.
2026-11-14 11:42:50 +08:00
yetone b325718f0a antigravity: turned-away lines go reworded, not broken up; Antigravity min 0.1.12 (#1118)
Since 11-14 Google's check reads past invisible characters. A system
prompt with Claude Code's billing line and Agent SDK line, broken up
with two U+200B in every word as the cloak sent them, was turned away
5 of 5 with the bare 429 "Resource has been exhausted". Claude Desktop's
Code tab through magpie to Antigravity failed every turn (hc295971796
on X, tweet 2121429628019781849), and on v0.1.4110 with the Antigravity
Cloak plugin Antigravity hit 429 very often (daoche_wuzui, tweet
2121432333769433178).

The built-in cloak (codeassist.go) now rewords each line Google turns
away, in plain words:
- the x-anthropic-billing-header line is left out to its line's end; a
  system part or message holding only it is dropped;
- "built on Anthropic's Claude Agent SDK" -> "built on the Claude Agent
  SDK by Anthropic";
- Codex's "based on GPT-5" -> "built on GPT-5";
- Hermes' "created by Nous Research" -> "built by Nous Research";
- omp's RFC "keywords" -> "key words".
A copy an older magpie or middleware broke up (U+200B, U+2060, soft
hyphen, inside or between words) is matched and reworded as the line.
The Code tab's main line passes as written and is kept.

The plugins repo's packages carry the same rewording (plugins 5bb41941:
opencode-antigravity-auth 0.1.12, opencode-agy-cli-auth 0.1.41,
middleware-antigravity-cloak 0.1.7 on the dist branch). The Antigravity
mover's min goes to 0.1.12, the version dist has (these packages are
not on npm); the cloak middleware is Official and updates itself.

Run:
- real Antigravity account, sandbox HOME, gemini-3.8-flash, 10
  sequential requests each through the new plugin: Code tab main prompt
  as Claude Desktop sends it 10/10 200, Agent SDK subagent line 10/10,
  an old two-U+200B copy 10/10, Codex GPT-5 10/10, Hermes' earlier
  persona 10/10, omp's RFC line 10/10. The zero-width break went 0/5.
- mote-run: gofmt -l; go vet, GOOS=linux go vet -tags nogui and
  GOOS=windows go vet of internal/gateway, provider, cli;
  go test -count=1 -timeout 45m ./internal/gateway/ ./internal/provider/
  ./internal/cli/ ./internal/middleware/: all ok (gateway 926s);
  vet clean, gofmt clean.
Broken by hand: codeassist.go from origin/main with these tests: 6 fail
(TestAntigravityCloakClaudeCode2316, ...RewordsEveryLineItTurnsAway,
...AnswersHermesAndCodexByDefault, TestOnlyAntigravityIsSentThePrompt
Reworded, ...LineWrappedOrWidened, ...TurnsCodexsGPT5ThreadAwayOnce).
Not tried: models other than gemini-3.8-flash; the whole go test ./...
(only the four packages this touches); Claude Desktop itself (its Code
tab's system prompt was captured and replayed instead).
2026-11-14 11:42:32 +08:00
yetone 71a806749d sessions: a paginated Codex rollout moves to a longer provider id by its row (@xMopf7RF on X)
@xMopf7RF on X (tweet 2121441393424113800): the Sessions page's Move
refused an old Codex session with "rollout-2026-03-09T09-25-….jsonl.zst
keeps its history by byte, and "magpie" is longer than the provider it
names: Codex couldn't open it moved", and offered nothing else.

Since 67b12956a a paginated rollout's session_meta is only rewritten at
its own length (Codex keeps places in it by byte), and MoveCodexProvider
refused a longer id outright. But Codex reads a paginated thread's
provider from its row in the state database, never from its file
(codex-rs read_thread; RetagPagedCodexThreads already moves such threads
by the row alone, tried with the real codex 0.166). So now
rewriteCodexProvider leaves such a line as it was and says so (kept),
and moveCodexPaths moves the thread by its row. Every caller gets it:
the Sessions page's Move, Resume's move first, and the sync's
MoveCodexThreads/MoveRecentCodexThreads, which met the same refusal for
a provider shorter than magpie.

With no row to move it by, it can't move at all: it is refused as
sessions.StuckError, every file put back and no trash copy left, and the
API says stuck with the provider it stays on. The page then says why,
that the session stays on that provider unchanged and shows in Codex when
Codex uses it again, and that Delete clears it into magpie's trash, where
it can be restored. New string in zh, zh-TW, ja and de.

Run, at 7951989c6 (on origin/main e0889719c):
- go test -count=1 -run 'TestMoveCodexProvider|TestRetagPaged|TestPortCodex'
  ./internal/sessions/ on mote: ok.
- Old code back (codex_provider.go from e0889719c, StuckError stubbed):
  TestMoveCodexProviderPagedByRow and TestMoveCodexProviderPagedNoRow
  FAIL with the reporter's exact error text; green with the change.
- node --test sessions-codex-provider-stuck, sessions-codex-provider,
  sessions-codex-provider-pick, i18n-keys, i18n-en-no-cjk on mote,
  Chromium and WebKit, five languages, 900px and 420px: 42 of 42 pass.
  The new GUI file with the old client.js: 0 of 20 pass.
- gofmt -l on the changed packages: nothing.
- Full suite (vet x3, builds x3, go test -tags nogui ./... -timeout 45m)
  queued on mote's suite lock; pushed before it ran, per the owner's
  ship-at-once rule. Its result goes in a follow-up.

Not tried: a real Codex resuming a thread moved this way. The row-only
move is the one RetagPagedCodexThreads makes, which was tried with codex
0.166.0 exec resume (docs/subsystems/agent-wiring.md). Not reproduced:
the no-row case with real Codex, where Codex 0.166 keeps a row for every
paginated thread; it is covered by a fixture only.
2026-11-14 11:42:17 +08:00
yetone e0889719c8 gateway: a Responses WebSocket turn streams without the HTTP stream field (#5291)
OpenAI's WebSocket mode doesn't use the HTTP stream field: a
response.create leaves it out and is streamed all the same. magpie made
each frame into the HTTP body its route would have had and kept the
field as the frame said it, so a client that left it out (M4n5ter on X,
AnacondaKC's Niko in #5291) got the provider's reply unstreamed and
every frame of it at the end. Codex sends stream:true itself, so it
never showed there.

turn now sets stream:true on every generating turn, whatever the frame
says (left out or false). It is the one place the three socket routes
(/v1/responses, /responses and Codex's backend route) make their body,
so all three are covered; a warmup (generate false) still answers
locally before it, and HTTP POSTs are unchanged.

Ported from AnacondaKC's patch in #5291 (62e3fd1ad), with these
differences: the test runs on /v1/responses and /responses, with stream
left out and with stream:false, checks the body sent upstream, and
TestCodexSocketStreamsWithoutStreamField covers Codex's route.

Tests: TestResponsesSocketStreamsWithoutStreamField and
TestCodexSocketStreamsWithoutStreamField, both red with responses_ws.go
at origin/main 8ed2ae030 ("no text delta before the upstream
completed"; "sent to ChatGPT unstreamed"), green with the change (on
mica). go vet ./internal/gateway for darwin, linux (nogui) and windows
on mote; gofmt -l clean.

Full suite (go test -tags nogui -count=1 -timeout 45m ./...) runs on
mica after the push; its result goes on #5291.

Not tried: a real client (Niko or the reporter's) against a real
provider.
2026-11-14 11:05:49 +08:00
yetone 8ed2ae030c claudetui: an image goes into the interactive mode on Windows 10 as a long paste, not -p (ok123now on X, #5061)
ok123now (magpie v0.1.3901, Windows 10 LTSC 21H2, Claude Code 2.1.316,
Claude Desktop): text worked, one 64x64 PNG was a 502 every try, and the
client asked again without end.

Cause: the helper pastes an image as its file's path in bracketed-paste
marks. Windows 10's conhost (10.0.19041) drops the marks on the way in
(the reporter's lead; #5061 and #5205 measured it on 19044 and 19045),
so Claude Code got the path as typed words, the helper waited out
pasteWait and exited 1, and the gateway answered 502.

Fix:
- claudetui: Claude Code reads its console as VT input (mode 0x208, read
  from a real claude.exe 2.1.316) and takes one read of over 800
  characters as a paste with or without the marks ($X=800 in 2.1.316,
  q6=800 in 2.1.281), a path with spaces after it as the image alone. On
  Windows the path is sent padded with spaces to 900 characters, no
  marks: over 800, and under the 1024-byte blocks the same conhost loses
  of a longer write (#5205). Elsewhere it stays bracketed.
- If the interactive mode still doesn't take a message (an image, or a
  block it can't paste), the helper ends the turn with an error result
  beginning claudetui.Unpastable instead of exiting, the gateway asks it
  once as claude -p with the image itself, and remembers that for 12
  hours. A redo that can't run is a 400, not a 502, so no client loops.
- The reporter asked to keep images interactive: -p counts at about
  twice the plan quota and has none of the interactive run's cache. The
  -p reason (Routing chip, all four locales, and the log line) says so.

Run, at this head (rebased on 925bc7188):
- win-run (Windows 11 26200): ./internal/claudetui; every test passes
  but TestShimFirstMessageWaitsForTools, red on the old code too (#4810).
  TestShimPaddedImageTakenWithoutMarks 3 of 3, TestImagePasteWindowsLength.
- The helper on a real claude.exe 2.1.316 in a ConPTY (sandbox
  CLAUDE_CONFIG_DIR, ANTHROPIC_BASE_URL to a closed port): padded and
  bracketed, the image reached the transcript as an image. A direct
  probe: bracketed and padded paths shown as [Image #1], a bare path
  stays words.
- wsl-run: ./internal/claudetui ok; go vet of claudetui and gateway on
  Linux and Windows.
- GUI: routing-entry, routing-intent-entry, claude-mode,
  claude-tui-setting, i18n-keys, i18n-en-no-cjk in Chromium and WebKit
  (Linux), 112/112.
- Full suite, wsl-run (Linux), go test -tags nogui -timeout 45m ./...:
  every package ok (gateway 883s, claudetui 164s) but internal/usage's
  TestRequestStateKeptAcrossACatalogFetchedAgain, a catalog CacheKey red
  already filed as #6572 and untouched here. The mote suite stayed queued
  behind other sessions' runs, so the suite ran on Linux.

Broken by hand: TestShimPaddedImageTakenWithoutMarks on the old code
(bracketed paste, fake console dropping the marks) is red: the shim
wrote 1 line of 3 in 30s. Its bracketed half is the old behaviour and
ends in an Unpastable error result, not an exit.

Not tried: a real Windows 10 21H2 console (no such box here); the -p
redo with a real Claude subscription. Long pasted text on Windows 10
still loses 1 KB blocks (#5205); this doesn't change that.
2026-11-14 10:48:55 +08:00
yetone 925bc7188b usage: the Requests card's up arrow opens what the bytes sent upstream were made of
theforeveriris (X, 2121408745616162998) saw 8169 requests send 8.6 GB
up and 1.0 GB down and wanted to know why. About 1 MB a request is
normal: every request sends the whole conversation again, with the
system prompt and the tools' definitions. This shows it.

Gateway: promptOf, which already parses the body off the request path,
now also counts the bytes of the system prompt, the tool definitions
and images in the body it read. upParts scales those to the wire bytes
and puts them on Record.UpParts. Nothing new runs on the request path,
and a body that isn't parsed stays "Not measured".

Usage: a packed row keeps the mix in 255ths under flag rowUpParts
(32768); the row stays 152 bytes. Totals gain up_calls, up_measured,
up_system, up_tools and up_images, and Shares carry up_bytes and
up_calls by agent and by model. settledCountVersion goes 4 -> 5, so
settled days are counted again once on the next start.

GUI (Usage -> Requests): the "↑ 8.6 GB" on the Requests card is a
button that opens a "Sent upstream" card: the average per request, one
sentence on why, a bar and legend for Conversation / Tool definitions /
System prompt / Images / Not measured, and the top 8 agents and models
with bytes sent and per request. The open state is kept; × closes it.
A request's details get a "Made of" line. zh, zh-TW, ja, de strings.
Entrance is 200ms ease-out, no movement under reduced motion.

Run (mote, at this head on 27e43ed26):
- go test ./internal/usage ./internal/usageapi: ok
- go test -run 'Prompt|UpParts|UpBytes|DownBytes|Traffic|Ledger|
  CodexOwnTurn' ./internal/gateway: ok
- go test -run Budget ./internal/gui: ok (after the rebase)
- go vet -tags nogui for darwin, linux, windows on usage, gateway,
  usageapi, gui: ok; gofmt -l clean
- GUI: usage-upload.test.cjs 32/32 (chromium + webkit, 1180 and 420,
  en zh zh-TW ja de); with i18n-keys, i18n-en-no-cjk,
  usage-ledger-bytes, usage-traffic, usage-ledger-detail: 144 pass,
  0 fail
- GUI subset i18n*, usage*, ledger* at f1f34d624: the only reds are
  usage-agents-hide, usage-cards-hide, usage-fold,
  usage-hidden-way-back, usage-ledger, usage-range-times and
  usage-speed-all-models. They are red the same way on origin/main
  f1f34d624 without this change and are already filed (#3414, #3415,
  #6003, #6294, #6295, #6499, #5834).
- Screenshots of the card: chromium en 1180 light, webkit zh 1180
  dark, chromium zh 420 light.
- Benchmark: promptOf on a 1.17 MB body, 2.8-3.9 ms/op with counting
  vs 3.2-3.7 without, same allocations (noise).
- Broken by hand: without the b.again guard,
  TestPromptKnowsWhatItsBytesWere goes red.

Not run: the full go test ./... and the full GUI suite. mote and mica
were loaded, with a suite already queued under suite.lock.
2026-11-14 10:22:25 +08:00
yetone ed63a5be5e gui: a picked accent colours what is chosen (CHENGJIAHEGOXIS on X)
「选中任意强调色没反应」: picking an accent in Settings › General seemed
to do nothing. The token did apply. With the real server, in Chromium
and WebKit, under light, dark and system, with and without a background
image, --accent was set by lookCSS and kept. Neither the theme nor the
wallpaper overrode it. But nothing on Settings, the sidebar, the header
tabs or the panel's tabs used --accent: every chosen option is graphite,
var(--fg), by design. So the colour only showed in a few buttons
elsewhere.

The fix is a --mark token, the ink of what is chosen.
- It is var(--fg) by default, so magpie's own look is unchanged, like a
  Mac's Graphite.
- accentVars sets it once the user picks an accent. It is moved toward
  black (light) or white (dark) until it reads at 4.5:1 on the surfaces a
  chosen option sits on: --pill-hover #e9e9ee, and the dark switch thumb
  #4c4c52.
- It is used by .seg/.opt/.ptabs/.warm-tabs/.am-seg/.klf-tab/.day-chip/
  .apptab .on, the header nav's chosen tab, the side-nav's open-page icon
  and Settings icon, and Library's switches and radios. Each is the same
  "chosen" role, so all of them follow the accent, not just one.

Tests:
- appearance_test.go's TestAccentReadable checks --mark's contrast on
  each surface, in both themes.
- appearance-look.test.cjs adds 8 tests, in Chromium and WebKit, light
  and dark:
  - Settings' theme and bird options and the side-nav icon at 1200 with a
    wallpaper set: graphite by default, the mark for #0d9488 and #db2777,
    and back to graphite on Default.
  - The header tabs at 900 and the panel's tabs at 380.

Run:
- gofmt clean. go vet ok on darwin, GOOS=linux -tags nogui and
  GOOS=windows (at 75bdc85fe, the same change on an older main).
- At 6f5549b1f (this change on 08f77528f), on Linux (WSL magpie-desktop),
  since mote's suite queue was hours deep:
  - The whole GUI suite, Chromium and WebKit, every language and the
    panel widths: 27231 tests, 1258 red in 183 files. The same 183 files
    at the parent were 1226 red. The 70 tests red only with the change
    were rerun with their 43 files at concurrency 2: 80 red with it, 89
    at the parent 783b69b8c. Every one left has a language or width
    sibling red at the parent too. None is about colour. They are the
    Linux reds #5559 and #4388 track.
  - go test -tags nogui ./... -timeout 45m: every package ok except
    internal/usage's TestRequestStateKeptAcrossACatalogFetchedAgain,
    red the same at the parent (#6572).
- At the pushed head, on mote (macOS):
  - TestAccent*, TestWallpaper*, TestLook* ok.
  - appearance-look 36/36, i18n-keys 4/4, library-all 26/26.
  - segs-press-redraw 16 red and api-key-theme 6/6 red, the same counts
    at the parent 6c88d61f0 (#4566, #3922, #6444).
  - TestCoreScriptBudget is red (1269382 > 1268961), the same at the
    parent. 92e760f3d took it over (#6518, taken). This change adds no
    script.
- Broken by hand:
  - With the old app.css and library.css, the 8 new GUI tests are red,
    8 of 8.
  - accentVars without --mark: TestAccentReadable fails ("…;--sel:#efefef",
    no mark).

Not tried:
- The whole GUI suite and the Go suite on macOS at the pushed head. mote's
  suite.lock queue was hours deep, so they ran on Linux instead.
- The real macOS app.
- Windows WebView2, and Linux WebKitGTK.
- Charts' --c1 series colour still does not follow the accent; that is
  left as it was.
2026-11-14 09:58:38 +08:00
yetone 4e770f733a library: subagents imported from a repository
CHENGJIAHEGOXIS on X asked for an easy way to install a repository of
subagents such as msitarzewski/agency-agents. Library → Subagents now
has a find line. It takes what the skill installer takes: owner/repo, a
GitHub or GitLab link to a repository, folder or file, any git address,
or a folder on this computer. It lists the subagents found, lets the
user tick all or some, and imports them as Library subagents for the
agents ticked.

- Fetching is the skill importer's: resolvePluginRoot's source handling
  moved into fetchSourceRoot, which both use. tooBig still refuses a
  whole repository that is too big and asks for the folder's link.
- A subagent is a Markdown file whose front matter has a description.
  - Its name is the slug of `name`. In an `agents` or `droids` folder
    with no `name`, it is the file's own name.
  - The description is folded to one line of at most 1000 characters.
  - The body is the prompt.
- Dropped: every other front-matter key (agency-agents' color, emoji
  and vibe, and tools, model, author or anything else). A Codex TOML
  role is not read. A skill's folder (one with SKILL.md) and .git,
  .github and node_modules are skipped.
- Two files with one name: the shallower is taken, and the other is
  listed as left out, with why. So is a file Subagent.check refuses.
- An imported subagent records its source and file (From) and a hash
  of its description and prompt as imported (FromHash). Imported again,
  a subagent from the same file is:
  - have, when it is unchanged;
  - update, when upstream changed and the library's copy still matches
    FromHash (description and prompt replaced; agents, skills, servers
    and model kept);
  - edited, when the user changed it in magpie (left as it is).
- A name the library already uses for another subagent is never written
  over: the import takes the next free name-N.
- A carried library carries From.
- The page has Select all, a filter past eight, a tag per state, the
  files left out, and a summary of what was imported and updated.
  i18n: zh, zh-TW, ja, de.
- The fixture is agency-agents' own files in
  internal/library/testdata/agency-agents. No test reaches the network.

Run on 80ae5ba24, which is this change on e730a14dc:
- gofmt -l is clean. GOOS=linux and GOOS=windows go vet -tags nogui
  ./... are clean (mote).
- go test -tags nogui -count=1 -timeout 45m ./... on mica: 98 packages
  ok. internal/cli's TestEveryRouteHasACommandOrIsNamed was red because
  the new POST /api/library/subagents/probe wasn't named. It is now in
  notYet beside skills/probe and plugins/probe, and the test passes.
- GUI files run in chromium and webkit, in every language:
  - The new library-subagents-import.test.cjs and the doc's Library
    list: 117 of 118 passed. The red was i18n-keys: "{n} subagents" is
    the sessions plugin's key. The keys now use {count}.
  - A second run of the doc's Library list, i18n*, project-subagents,
    skill-install-* and plugin-*: 1652 of 1768 passed. The 116 reds are
    in 7 files that fail the same way alone on a fresh origin/main
    (e730a14dc): 116 there, 114 at this head. Each has an open issue:
    - found-skill-pick-remove: #4097 and #5013
    - plugin-option-placement: #6559
    - plugin-signin-no-url: #5938
    - plugin-signed-out-account: #5998
    - plugin-move-unserved: #4392 and #4410
    - plugin-page-foreign-error: #6117
    - plugin-card-update: #3079

Run at the pushed head, rebased on eb1b83000, on mica:
- gofmt -l is clean.
- go test ./internal/library ./internal/gui ./internal/cli: ok.
- library-subagents-import, library-subagents and i18n-keys: 38 of 38
  passed.

Broken by hand, each red, then reverted:
- Clash renaming off (`false && taken[name]`):
  TestSubagentImportLeavesTheUsersOwn red.
- The edited check made `case true:`: TestSubagentImportAgainUpdates
  red (paid-media-auditor read as update).

Real import, in a sandbox HOME magpie web on mote (built from this
change), with Claude Code and
Codex detected:
- The probe of https://github.com/msitarzewski/agency-agents found 283
  subagents. One was left out: the mcp-memory copy of
  backend-architect.
- Importing all 283 wrote 283 files to ~/.claude/agents (only name and
  description in the front matter) and 283 TOML roles to ~/.codex/agents.
- A probe of .../tree/main/engineering then showed 66, all have.

Not tried: the Windows and Linux runtime, GitLab and plain git sources
against real repositories, an agent in WSL, a repository over tooBig's
limit.
2026-11-14 09:11:31 +08:00
yetone eb1b830004 gateway: Cindy is told each model by its name with its provider's (cdredfox on X)
Cindy's picker listed magpie's GLM-5.3-Flash three times, 千问 3.8-Flash
and DeepSeek-Flash twice each, with nothing to tell them apart. Cindy
0.1.94's model discovery (parseModelsListResponse in its app bundle)
names a row by display_name before name, and magpie's display_name is
the bare model name. /v1/models asked with Cindy's key (magpie-cindy, as
its import link gives it) now gives display_name the name the agents'
lists use, provider.LabelsFor("cindy", ...): "GLM-5.3-Flash · Zhipu",
"... · routing group" for auto/, following Cindy's Provider in model
names (the picker the Agents page already showed for Cindy, which
changed nothing there before), a name the user gave a model kept as
they wrote it. Every other client's display_name is unchanged. In Cindy
a discovered model's shown name follows discoveredMetadata.name, which
its 刷新模型列表 updates for existing models; a name the user typed in
Cindy (nameExplicit) still wins there.

Run:
- TestCindyDiscoveryNamesModelsApart (new): on, own and off, three
  providers' GLM-5.3-Flash apart, a user's own name kept, another client
  plain. Red on the old gateway.go ("on: Cindy told
  map[... or/glm-5.3-flash:GLM-5.3-Flash zp/glm-5.3-flash:GLM-5.3-Flash]").
- Real use: this tree's magpie built and served in a sandbox HOME on
  mica with two custom providers serving glm-5.3-flash; its /v1/models
  with magpie-cindy fed to Cindy 0.1.94's own parseModelsListResponse
  (extracted from /Applications/Cindy.app's app.asar): "GLM-5.3-Flash ·
  OpenRouterX", "GLM-5.3-Flash · ZhipuX", "GLM-5.3-Flash · routing
  group"; with magpie-pi's key all three still "GLM-5.3-Flash".
- Full suite on mica at base e730a14dc (go test -count=1 -timeout 45m ./...): 99 packages ok, no FAIL. go vet ./... (darwin), GOOS=windows go vet ./... and GOOS=linux go vet -tags nogui ./... clean; gofmt -l clean.

Not tried: Cindy's own window. Adding magpie there writes into the live
CindyGlobal folder, which has no account database on this Mac.

- After the rebase onto 9a3f95f3f's parent (two gateway commits): internal/gateway, internal/provider and internal/agent ok on mica.
2026-11-14 08:39:31 +08:00
yetone ab4b1cf38f sessions: a long Codex rollout is read on after a restart, not read again whole
shangyuan0818 on X: on Windows, Usage > Sessions took over ten seconds to
open with one very long session (tens to 100 MB), though there were only
a few sessions.

Cause: a Codex rollout's summary window (state.Codex) and its calls'
window (cxRun) lived in memory only. After a restart, or once the window
had been dropped, the first line a live rollout gained made parseRead,
prepareCalls and readsWhole read the rollout again from its first line:
once for the summary and once for the calls. Claude Code sessions were
already read on through their kept windows (#3493).

Fix: the window of a rollout being written (changed within the hour, the
same files memory keeps windows for) is now kept on disk with the parser
version, a window version, and the size, offset and content hash of the
read that made it. The summary's goes in codex-windows/<hash>.gob next
to sessions.json. It is written with sessions.json, and it is removed
once the cache drops that window. The calls' window goes in the shard's
.rev file next to Claude's. Each is used only when all of those match,
so a window from another read, or from an older layout, is never used;
the file is read whole instead, as before.

Measured (100 MB rollout built from testdata/codex-native-paginated.jsonl,
plus a 100 MB Claude Code session, GET /api/sessions in a sandbox HOME):
  mote (M5), before: after one line appended following a restart, 2.51 s
    (Codex alone 2.25 s). After: 9.7 ms (Codex alone 6.3 ms).
  Windows (xiaomi-gpu), before: 2.61 s. After: 22.8 ms.
  The first read with nothing kept is unchanged: 2.6 s on mote, 2.8 s on
    Windows. Warm and plain-restart opens were already 10 to 30 ms. stats
    and overview stayed at a few ms throughout.
  A real 32 MB rollout: 24 ms after an append, with 2 KB and 4 KB windows.
    A 100 MB rollout with a unique response id per turn: 11 ms, with
    623 KB and 834 KB windows.

Tests: TestCodexSessionReadOnAfterRestart reads a rollout, restarts, then
appends a replayed token_count and a new turn. It checks that neither
reader starts at offset 0, and that calls and the session's tokens,
models and cost match a read from scratch. TestCodexWindowLeavesWithItsSession
covers writing, reading back, refusing another read's window and
removal. TestPlainRolloutReadOnceForSessionsAndCalls (#4369) expected
both readers to start from 0 after a restart; it now expects them to
read on.

Broken by hand, each red: the summary window not read (starts [319830 0]);
the calls window not read ([0 319830]); a summary window emptied of what
it had seen (it panicked in codexUsageState.count, which is why the
version guard was added); a calls window emptied (62 calls vs 61).

Run: gofmt -l clean. GOOS=linux and GOOS=windows go vet -tags nogui ./...
on mote. Full go test -tags nogui -timeout 45m ./... on Linux (wsl-run,
magpie-desktop) at this change on 70bd270ae: every package ok but
internal/usage, whose TestRequestStateKeptAcrossACatalogFetchedAgain is
red the same way alone on origin/main 7b50e1f2c (11 of 20; a same-size
catalog write in one mtime tick, filed as #6572). mote's suite.lock had
five runs queued ahead, so its run of this change is still waiting.
Rebased onto 7b50e1f2c (7 files in internal/provider and internal/usage,
none under internal/sessions); provider, usage and sessions run again
there on Linux: all ok (#6572 passed this time). win-run ./internal/sessions/: only TestAgySessions,
TestAgyRowOnly, TestAntigravityAppFolder and TestCCListingKeepsItsNames
fail, and they fail the same way on origin/main ea9f2639b (#6071).
win-run -run 'Session|Usage|Calls' ./internal/gui/: only
TestGatewayModeStatsNameTheGatewaySessions fails, the same on ea9f2639b
(#6068).

Old data: right after updating, every user's live rollout is read whole
once more on its next change, since no window has been kept yet. From
then on it is read on. Nothing else changes for files not written within
the hour.

Not changed: WorkBuddy, WorkBuddy AI and CodeBuddy calls are still read
whole on every line (556 ms per 100 MB on mote), filed as #6565. Not
tried: the reporter's own machine and files.
2026-11-14 03:28:08 +08:00
yetone 7b50e1f2c6 provider: Claude Code's version-2 model catalog lists an account's models too (#6418)
Claude Code 2.1.323+ keeps an account's models in
<config dir>/cache/model-catalog/<organizationUuid>-<sha256(accountUuid)[:12]>-cc.json
(version 2, catalog.config.models), and magpie read only .claude.json's
additionalModelOptionsCache / modelAccessCache. A model only that catalog
has, and models.dev's anthropic list lacks, was missing from the Claude
provider, `magpie models` and Claude Code's own picker (pwn2ooown).

readClaudeCodeModels, which every reader of those caches goes through
(claudeModels, claudeModelsOf/claudeLists, ClaudeCodeModels,
claudeCodePrice), now adds the catalog of the account its .claude.json
names, from that config directory or Claude Code's own (~/.claude keeps
every account's that signed in there), the one fetched last. A model
models.dev doesn't describe takes the catalog's window, reply limit,
effort levels and mm_images. The legacy caches are read as before.
Another account's catalog is never read; a file of another version or
surface is unknown; a .claude.json or catalog that doesn't parse
(halfway through a write) is what it said last (readKeepingGood), a file
gone is gone.

The name and shape come from this Mac's Claude Code, read only: 7 files
in ~/.claude/cache/model-catalog and 2 in saved account dirs; the name's
first part is organizationUuid and its second sha256(accountUuid)[:12]
for every account whose .claude.json is here.

Run (mote):
- go test -tags nogui ./internal/provider ./internal/agent ./internal/cli
  ./internal/catalog ./internal/filememo ./internal/proc: all ok (provider 166s, agent 357s, cli 67s)
- go vet ./...; GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  internal/provider and internal/agent; gofmt -l clean
- built magpie, `magpie models` in sandbox HOMEs (the issue's repro
  adapted): baseline, other account's catalog, half-written catalog: no
  Fable 5.2; the issue's catalog: listed; legacy cache: listed; a copy of
  a real Claude Code catalog's bytes under synthetic ids: all 13 models
  listed.
- after rebasing on 58629a0f8 (no change in these packages): provider
  and usage ok again at the pushed head.

Broken by hand (TestClaudeCodeCatalogV2Models red each time):
- catalog not read: "Fable 5.2 from the version-2 catalog not listed"
- last good dropped: "a half-written catalog dropped Fable 5.2"
- name keyed on org only: "another account's catalog listed"

Not tried: Claude Code on Linux/Windows (same path under the config dir
assumed); a real account whose catalog has a model models.dev lacks
(every model in this Mac's catalogs is in models.dev); the full ./...
suite. The issue's repro names its file <org>-<accountUuid>-cc.json,
which Claude Code doesn't write, so that literal name is not read.
2026-11-14 03:17:11 +08:00