Commit Graph
8145 Commits
Author SHA1 Message Date
yetone 63c91cae5f gateway: the body's key checks look for the needle's rarest byte
Each request ran ~45 bytes.Contains over its whole body to ask whether
a key is there at all ("developer", "compaction, "display", the
passthrough key...). Most needles begin with a quote, JSON's commonest
byte, so bytes.Index stopped at every quote, gave up on that and
compared at every byte: on a 2 MB body ~9 ms a request, 36% of the
gateway's CPU in BenchmarkLargeRequest's profile.

bodyHas/bodyIndex find the needle's rarest byte (a static rank of the
bytes JSON, English and code use most) with IndexByte and compare the
needle only there; a needle of common bytes only hands the rest to
strings.Index after 64 misses, so it is never slower than before, and
it allocates nothing (a []byte(sep) of a needle over 32 bytes did).
148 literal and constant needles in internal/gateway use it, and
mayHoldHEIC's "eXB" walk uses bodyIndex.

mayHoldOddBase64 walked every byte through a switch (~2 ms a 2 MB
body); a run it looks for ends a string, so it now looks back from each
quote with a class table and gives the same answer.

Run on mica (Apple M6) at this tree:
- BenchmarkBodyHas, 7 needles over a 2 MB body: 4.43 ms -> 0.38 ms,
  0 allocs (was 1).
- BenchmarkLargeRequest -benchtime 200x, before -> after:
  anthropic 31.2 -> 28.9 ms, anthropic-group 31.4 -> 27.8,
  chat 35.7 -> 32.8, responses 39.8 -> 29.8.
- go vet ./internal/gateway; gofmt -l clean.
- go test ./internal/gateway -count 1 -timeout 45m: ok (858s).
- Broken by hand: bodyIndex's start off by one -> TestBodyIndexIsIndex
  red (wrong index on 5 needles and the random bodies); the URL-safe
  class never counted -> TestOddBase64LooksAsItWalked red. Both green
  again restored.

TestBodyIndexIsIndex holds bodyIndex to bytes.Index on a large
conversation and 3000 random bodies of common and rare bytes;
TestOddBase64LooksAsItWalked holds the new check to the old byte walk
(kept in the test) on 20000 random bodies and the three protocols'
large conversations.

Real account: the built app (mote, sandbox HOME) sent a 6KB request to
DeepSeek on /v1/responses and /v1/messages, both 200 "pong". Not
tried: Codex (the sandbox's sign-in is stale, and renewing it there
would rotate the live refresh token).
2026-11-14 05:51:42 +08:00
yetone 08f77528f4 usage: the serials sourceDigest met go when idle
sourceDigests.by and .last, the serials met this turn and the one
before, stayed for the life of the process: 577 KB of a real history's
idle heap. They only order which digests heat-digests.bin keeps first
when there are more than it holds (2*65536, against ~17k session
files). dropDerived, the 3-minute idle drop, now writes what was made
and lets them go; sourceDigest notes a read (derivedUsed) as the other
per-chunk caches do.

TestDigestTurnsGoWhenIdle: the turn's serials are nil after the idle
drop and the next key hashes nothing again. Red with the nil-ing taken
out by hand ("kept 1 and 0 serials when idle").

Run at this commit on mote (load 23.7, over its 18 cores; mica's disk
was full): go vet for darwin, linux and windows ok; go test
./internal/usage ok (52s), ./internal/gui ok (132s). Real Codex history
in a sandbox HOME (~/r2278), page open 30s then 8.5 min idle: liveHeap
13.13 MB against 13.68 MB before; the heap diff shows sourceDigest's
577 KB gone. Not run: the full suite.
2026-11-14 04:02:26 +08:00
yetone a532b646eb usage: the set of listed session paths is not kept on the index
readRequestBlocks makes a set of every session file's path (on), and
noteBuilt kept it on the index for save, the only reader, which it calls
right after. The set outlived the chunks' forget: 853 KB of a real Codex
history (pprof inuse_space at request_page.go:1214, the make of on) at
8 minutes idle. save takes it as an argument now; the field is gone.

Run at this commit on mote (load 24): go vet for darwin, linux and
windows ok; go test ./internal/usage ok (57s), ./internal/gui ok (158s).
Real Codex history in a sandbox HOME (~/r2278), page open 30s then 8.5
min idle: liveHeap 13.68 MB, against 17.07 MB for v0.1.4089; the heap
diff shows readRequestBlocks' 853 KB gone. One earlier capture read
22.3 MB with 5.2 MB under prefetchEach/sharedBuild; a goroutine dump of
the next run had no prefetchEach goroutine left, so that was a build in
flight when the heap was taken, not a stuck reader.
Not run: the full suite.
2026-11-14 03:46:32 +08:00
yetone 39a00e6f38 gui: the panel's Usage tells all providers' calls apart by model too (OHHHHHH05 on X)
OHHHHHH05 asked on X for usage by model in the tray panel's Usage tab,
which ranked all providers' calls only by provider. The card's head now
has a Provider / Model switch beside the metric switch. Model ranks and
charts the same answer by.model and the series' by.model, with no new
request, the same drawLedRank and drawLedColumns the window's Usage
page draws. The choice is kept (magpie.panelUseSplit). With one provider
picked the ranking is already its models, so the switch is left out.
A click in the ranking still picks a provider only when it ranks
providers. The labels reuse the Provider and Model words, so no string
is new.

panel-usage-models.test.cjs (new), Chromium and WebKit, en zh zh-TW ja
de: the switch's labels, Provider on by default, Model's ranking and
chart keys, no request on the switch, both switches inside the card
at 440px and 320px with nothing sideways, the choice kept on reopening,
the switch gone with a provider picked, no page errors.
panel-usage.test.cjs: its metric selectors skip the new switch.

Run:
- panel-usage-models + panel-usage on mote: 14 pass, 0 fail.
- Broken by hand: the old app.js is red 10 of 10 in Chromium (no
  switch); the split forced to provider is red 10 of 10 in WebKit (the
  ranking keeps providers).
- WSL magpie-desktop (Linux): the 116 GUI files that reach the panel or
  the usage answer (.pu-, panelUse, usage/requests, panel-*, tray-*,
  i18n-*): 1712 pass, 93 fail, panel-usage and panel-usage-models
  green. The 17 red files run again at origin/main ab4b1cf38 and at
  this change: the same files and tests red on both (WebKit language
  counts vary run to run), every one already filed: #4623, #5796,
  #4705, #5869, #2559/#4966, #5215, #4717, #4718, #4263, #4489, #5048,
  #5834, #5156.
- go test -tags nogui ./internal/gui/... on WSL: ok, with the size
  budgets; at the pushed head app.js has 1441 bytes of room and the
  core 96 (codeBytes measure).
- After rebasing onto 767029501: panel-usage-models, panel-usage,
  i18n-keys, i18n-en-no-cjk and the budget tests on WSL again.

Not tried: the whole GUI suite to its end (a full make test-ui at the
pre-rebase head is running on mica; on WSL it ran from a* to b* before
I stopped it for the run above), a real panel in the app, Windows.
2026-11-14 03:45:05 +08:00
yetone 7670295019 copilot: list each model's long-context tier, as Copilot Chat asks /models (gtliuu on X)
gtliuu on X: Copilot's Claude Opus 5.5 has a 200K and a long tier, and magpie
offered only 200K. magpie asked /models at X-GitHub-Api-Version 2026-01-09,
and at that version Copilot lists only the default tier's
max_prompt_tokens. Copilot Chat 0.68 never sends 2026-01-09:
@vscode/copilot-api 0.5.2's _mixinHeaders sets 2026-08-01 on every Copilot
API request, Models included, over networking.ts's 2026-01-09. At
2026-06-01 and later, /models gives each model its whole window (Opus 5.5
1M) and billing.token_prices with a default tier and a long_context tier.

- The editors' sign-in asks GET /models at 2026-08-01
  (copilotModelsVersion). The Copilot CLI's sign-in keeps its own
  2026-07-01, which already lists the tiers. Chat requests are unchanged:
  Copilot served prompts past the default tier at 2026-01-09. The other
  requests still on 2026-01-09 are #6571.
- The window follows Copilot Chat (languageModelAccess.ts and
  agentIntent.ts). A long tier at the default's prices gives the whole
  window: Claude Opus 5.5 1M, and the Sonnet, Fable and Gemini models
  936K or 983K. A long tier with a surcharge keeps the default tier's
  prompt as the window agents are told. The whole window becomes
  MaxContext, which the user can raise the window to. GPT-6 Luna gets
  272K and 872K, and Claude Haiku 5.5 100K and 936K. The whole window is
  the limits' max_prompt_tokens, not the long tier's prompt: Grok 4.7's
  long tier says 500000, but Copilot takes 372000.
- Price: Copilot's own list (AIU per batch_size tokens / 100 = USD per M)
  is the list price, ahead of models.dev. A long tier with a surcharge
  becomes a Tier above the default's prompt. Both 2026-06-01's field
  names (cache_price, context_max) and 2026-08-01's are read. GPT-4.1's
  all-zero list is no price. A flat, older list changes nothing.

Run (base origin/main 7b50e1f2c):
- go test -tags nogui -count=1 -timeout 45m ./internal/provider/...
  ./internal/catalog/... ./internal/gateway/... ./internal/usage/... on
  mote, in a sandbox HOME: all ok (provider 139s, catalog 3s, gateway
  918s, usage 42s). Not the whole ./...: mote's suite lock had six suites
  queued, and mica's disk is full.
- GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., and the
  linux and windows builds: ok.
- gofmt -l: clean.
- Fixtures are the owner's account's real /models replies at 2026-01-09,
  2026-06-01 and 2026-08-01, trimmed to four models.
- Real use: a -tags dev build in a sandbox HOME with only
  github-copilot/apps.json copied, on 127.0.0.1:3476. Its /v1/models
  lists copilot/claude-opus-5.5 at 1000000 (200000 before) and
  gpt-6-luna at 272000, both priced from Copilot's list. A
  584,849-token prompt to copilot/claude-opus-5.5 on /v1/messages got
  200 end_turn, billed by Copilot at 233.9 AIU (400 an M, the default
  tier's price).

Broken by hand, each red:
- /models asked without copilotModelsVersion: TestCopilotListsTheLongContextTier.
- tiers not applied: that test and TestCopilotTiersAtTheFirstTieredVersion.
- the long tier's prompt over the limits': red on Grok 4.7's 500000.
- context_max not read: TestCopilotTiersAtTheFirstTieredVersion.
- copilotListPrice off: TestCopilotListPriceIsCopilots.

Not tried: a request on a surcharged model raised past its default
tier (GPT-6 Luna over 272K), or a Business or Enterprise account's list.
2026-11-14 03:37:38 +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
yetone 58629a0f8e usage: a trim that lets most chunks go gives back the map's table
The usage page's index of session-file chunks is let go when no page has
asked for it in requestIdle + requestForget (trim(0)). A Go map never
shrinks, so the emptied map kept its table: 853 KB of a real Codex
history's index (pprof inuse_space at request_page.go:1461, the map
assignment in keep) stayed for the life of the process, 8 minutes after
the page was last open. trim now copies what is left into a map of its
size when it dropped more than it kept.

TestRequestTrimGivesBackTheMap fills an index with 100k chunks, holds
the keys, and checks trim(0) gives back the table. Broken by hand (the
copy skipped): red, heap 9,054,088 -> 9,051,552. Fixed: 3 of 3 green.

Real Codex account sandbox (mote, acctp HOME, page open 30s then 8 min
idle, memprofilerate=1): liveHeap 18.00 MB -> 17.07 MB; nothing held
under requestIndex.keep (was 853 KB). One earlier run read 23.1 MB with
a usage build in flight at the capture (sharedBuild 5.2 MB); the rerun
had none.

mica: gofmt clean; go vet ./internal/usage for darwin, linux, windows;
go test ./internal/usage ./internal/gui ok.
Not run: the full suite.
2026-11-14 03:11:29 +08:00
yetone 71079b69f5 gui tests: old-webkit knows appearance.js is imported lazily (#6467)
a65dade2e (v0.1.4005) added appearance.js, imported when Settings draws
General or the look changes. old-webkit's "compat.js is the first of
the page's own scripts" then failed with "appearance.js is not loaded
by index.html". It joins the test's list of lazy imports, with a line
saying when it loads.

Run on mote at this head (rebased on origin/main 70bd270ae):
- old-webkit.test.cjs + appearance-look.test.cjs: 32 pass, 2 fail. The
  two are filed and not this change: headerpresets.js unlisted (#6030)
  and .side-foot:has() (#5919).
- With headerpresets.js added in a copy, the test gets past
  appearance.js and stops at navpages.js, also unlisted (filed #6570).
Broken by hand: the same copy with appearance.js taken out of the list
fails on "appearance.js is not loaded by index.html".
Also checked: omarchy.test.cjs's "on Omarchy" timeout is the same at
2f2a0afa5, before a65dade2e (#6027).
Not tried: the full GUI suite again.
2026-11-14 03:04:38 +08:00
yetone 70bd270ae2 agents: Antigravity says how its own sign-in's models come back on magpie (T_t__biu on X)
T_t__biu on X: once magpie wires the Antigravity app, the Gemini models of
their own signed-in Google account leave the app's model list. Cause: magpie
connects the app through Google's Enterprise Gateway (gateway block in
~/.gemini/config/config.json and ~/.antigravity/settings.json). On a gateway
the app's language server runs in AUTH_MODE_ENTERPRISE_GATEWAY and drops the
Google sign-in (Google's docs: the two can't be used at once), so Code
Assist's fetchAvailableModels, which listed the account's models, is never
asked. No key in the file keeps both.

What does keep them: the same Google account signed in under magpie's
Antigravity subscription (the antigravity-auth plugin). The gateway's
antigravity catalog then lists that account's own models beside magpie's,
on that account's quota, pooled with any other Google account added there.
The notice shown on connecting now says so while magpie has no Antigravity
account (provider.Logins("antigravity") empty); with one, it reads as
before. Translated in zh, zh-TW, ja, de; the site's Antigravity page (en,
zh, ja), llms-full.txt and docs/subsystems/agent-wiring.md say the same,
and the subsystem page names what is not built: keeping the app's own
sign-in and adding magpie's models beside it would need the backend's
Code Assist endpoint (--cloud_code_endpoint / CLOUD_CODE_URL) pointed at
magpie.

Run at this head (base 331057743 = origin/main, fetched), on mote:
- go test -count=1 -timeout 45m ./internal/agent ./internal/gui ./internal/cli: ok
- go test -run 'Subsystem|Doc|Loop' ./internal/gateway: ok
- node --test i18n-keys, i18n-en-no-cjk, agent-notice-lang, about-notices
  (GUI): 50/50 pass
- site: node --test worker.test.mjs files.test.mjs: 52/52 (after
  regenerating llms-full.txt, which the first run caught stale)
- GOOS=linux and GOOS=windows go vet ./internal/agent: ok; gofmt -l clean
Real use, sandbox HOME on mote with one real Antigravity account (copied
plugin:antigravity entry only, @magpie-community/opencode-antigravity-auth):
- magpie antigravity magpie/up/g3 wrote the gateway block; GET
  /v1/models?format=antigravity with the app's key listed the account's
  models (Gemini 3.8 Flash, Gemini 3 Flash, Claude Sonnet/Opus 4.6, GPT-OSS
  120B, ...) beside up/g3; a chat on antigravity/gemini-3-flash:low through
  /v1/chat/completions answered "pong" on that account.
- the built binary prints the old notice in that HOME, and the old notice
  plus the new sentence in an empty sandbox HOME.
Broken by hand: Notice's account check forced off, TestAntigravityGateway
red ("no word of the app's own models with no Antigravity account").
Not tried: a real signed-in Antigravity app (none here; the app keeps its
token in the keyring); the whole GUI suite (app.js untouched, only i18n.js
keys added); Windows/Linux runs of the package (no OS-specific code).
2026-11-14 02:44:12 +08:00
yetone 331057743d agents: a provider an agent's visibility keeps is in its model list, off, and ticked is shown it (whysugarsweet on X)
whysugarsweet on X (v0.1.4066): OpenCode Go is in Pi's model list but
not in Claude Desktop's. Desktop's list showed Google Gemini, DeepSeek,
Anthropic, Codex and Grok only.

Nothing leaves OpenCode Go out by protocol. What can narrow one agent's
catalog to some providers is settings.Visible: `magpie visible`, a
profile or settings sync writes it. A provider added later is kept out
of that agent's /v1/models, its config and the Agents page's list. The
page showed no sign of it and had no way to undo it, so the user could
only see Go missing. I haven't seen the reporter's settings, so this is
the likely cause, not a confirmed one.

- GET /api/agent-models/{id} now lists the models the visibility keeps,
  after the rest, as hidden and `kept`. They sit under their provider
  in the list and its rail, so they can be found and ticked.
- POST takes `widen`: kept models that were ticked. provider.Widen adds
  each one's provider (or group) to the agent's visibility. When nothing
  is kept after that, the agent is no longer narrowed at all. The
  provider's other models are then listed and off, so ticking one adds
  just that model.
- A kept model is never saved as hidden or picked one by one. The row's
  count leaves kept models out of "listed".
- Every agent's list shares this code, so the fix applies to every
  narrowed agent, not only Claude Desktop. The gateway's model list and
  Desktop's inferenceModels both come from CatalogFor, so a widened
  provider is served and routed too.

Run, at db9d6507b plus this commit:
- go test ./internal/gui ./internal/provider (mote), whole packages:
  ok. The new tests:
  - TestAgentModelsKeptByVisibility: Go's models are kept and off;
    ticking Kimi widens Desktop to opencode-go; CatalogFor then has it;
    widening the last kept one deletes Visible.
  - TestAgentModelsKeptPicked: a widen is a pick in only-picks mode.
- go test ./internal/gateway with -run on the model, catalog and Desktop
  tests: ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./..., the three builds, gofmt -l: clean.
- New GUI file desktop-model-kept.test.cjs: chromium and webkit; en, zh,
  zh-TW, ja and de; window (1100px, with the rail) and tray panel
  (420px). 20/20 ok.
- GUI files around the list (agent-model*, agent-models*, desktop-*,
  agent-menu-label, agent-connect-*, cursor-local-models, codex-model-*,
  zcode-models, grip-inset, popover-mac-chrome, provider-*picked*,
  i18n-*) on mica: 597/608 at 65f745dd4 plus this change. Every red was
  red the same, alone, on origin/main ea9f2639b:
  - agent-menu-label, webkit panel en/ja/de: #6371
  - desktop-tiers: #6475
  - grip-inset: #6293
  - zcode-models, webkit de panel: filed as #6566
  At the rebased head I reran desktop-model-kept, desktop-model-menu,
  desktop-twin, agent-models, agent-models-provider-ticks,
  agent-models-only-picked and i18n-keys: 114/114 ok (mote).

Broken by hand:
- Kept models left out of agentModelList: the Go test is red ("no
  opencode-go/kimi-k2.6").
- The provider.Widen call removed: red ("visible: [deepseek-x]",
  "picks: [relay/a1]").
- The old app.js save(): the GUI test is red, with no widen posted.

Not tried:
- the reporter's own settings.json;
- the real Claude Desktop app reading a widened config;
- a real OpenCode Go account.
2026-11-14 02:22:28 +08:00
yetone 48f9764027 plugins: a model served on more APIs keeps the client's (gaubeebangeel on X)
gaubeebangeel on X: OpenDesign's Anthropic requests to an Open Design
Cloud account were all sent upstream as chat completions. The Open
Design plugin declares each model on one AI SDK package (chat
completions for most, Responses for deepseek-v4-pro and claude-haiku-5.5,
plugins#141), and pluginAPIs gave a plugin model that one API alone, so
attempt never relayed a /v1/messages request and translated it, though
amr-link serves every model on all three (plugins#888). A DeepSeek
API-key provider, the case first suspected, relays to /anthropic/v1/messages
as sent: tried with OpenCode's, node's and no User-Agent, bare and
prefixed ids, and web search.

A plugin model can now list the other APIs its vendor serves it on, as
their AI SDK packages (m.also; plugin.Model.Also through host.js, config
model and models hook). pluginProtocols gives the model's own API first,
then those; ListedAPIs, the catalog's APIs and the provider's bases come
from it, so a client's request on any of them is relayed as sent. usable
puts a plugin model's own API first, so a request on an API it isn't
served on is still translated to the declared one. A model with no also
is unchanged. opendesign 0.1.13 (plugins 397da020) sets also on every model.

Test: TestPluginModelServedOnMoreAPIsKeepsTheClientAPI (fake plugin,
FAKE_ALSO): Anthropic, Responses and Chat requests to the also model
reach the upstream on their own path; fake-1 (no also) is still
translated to /chat/completions. Red on HEAD's plugins.go: Anthropic and
Responses reached /v1/chat/completions, ListedAPIs and usable were [chat].

Run (mote unless said): go test ./internal/provider ./internal/plugin
./internal/catalog ok; go test ./internal/gateway ok (972s);
GOOS=linux/windows go vet of the three packages ok; gofmt clean.
Not run: the full ./... suite (mote and mica each had full suites
queued under suite.lock); not tried against a real amr-link account
(keyblues's plugins#888 measurements are the evidence it serves
/v1/messages for every model).
2026-11-14 02:14:31 +08:00
yetone db9d6507bb dsh: a thinking level set on magpie's route by hand is what its sessions start on
ming_li52905 on X set a level per route in dsh's config:

    providers:
      magpie-responses:
        reasoning: high

and magpie "overwrote" it. magpie never dropped the key. llm-pi-ai starts
a route's models on profile.reasoning only when the session names no
effort (options.reasoningEffort ?? profile.reasoning, dsh-llm-pi-ai
0.2.2-rc.3). agent-default-model's reasoningEffort, which magpie's
thinking setting writes, is the effort every new session names, so the
user's level never applied.

Now the route's own level wins over magpie's one default:
- A start magpie writes on such a route (switch, set) carries no effort
  of magpie's.
- A sync or round takes out an effort magpie wrote there before
  (dshStartYields). magpie keeps what it last wrote into each list's
  start (dsh-effort:<file> in the stash), so an effort dsh saved itself
  (a composer pick, #1392) is the user's and stays. When the home layer
  mirrors a profile's start, it takes that profile's record too.
- Thinking reads the route's level when the start names none, and
  setting it writes the route's reasoning wherever it is set: each
  profile, the home layer, settings.yaml. It writes no reasoningEffort.
- A route without a level still gets magpie's effort, as before.

Tests: TestDshRouteLevelOfTheUsersOwn (sync, round stability, a switch
away and back, thinking set, dsh's own saved effort kept),
TestDshRouteLevelInTheHomeLayer, TestDshRouteWithoutLevelTakesMagpiesEffort.

Run:
- The three tests at the old dsh.go: red (start keeps "medium" over
  high, thinking reads medium, thinking low leaves the level).
- Broken by hand, each red: the record check ignored (dsh's own effort
  stripped); Get not reading the level; the round's dshStartYields
  removed (both level tests red).
- go test -count=1 ./internal/agent on mote: ok (237.9s).
- GOOS=linux go vet -tags nogui and GOOS=windows go vet of
  ./internal/agent on mote: ok. gofmt -l: clean.

Not run: the full ./... suite. mote's suite lock had four full runs
queued ahead of it. The change is internal/agent only.

Not tried: a real dsh. The precedence comes from dsh-llm-pi-ai
0.2.2-rc.3's source, not from a session.

Risk: a start written before this release has no record. If its effort
differs from a route level the user set, it is taken for magpie's and
removed once, even if dsh had saved it.
2026-11-14 02:02:33 +08:00
yetone ea9f2639b9 LESSONS: a docs edit left llms-full.txt stale, unseen behind cancelled runs
459d668b3 changed docs/sync.html without regenerating llms-full.txt. The
site test was red from 21:05, and CI showed it only once a run was not
cancelled by the next push. Added under "A cancelled run tests nothing".
Docs only; nothing run.
2026-11-14 02:00:33 +08:00
yetone 3d88600100 site: llms-full.txt carries the sync page's pick, preview and undo
459d668b3 (#6428) added "Pick what syncs, preview, undo" to
docs/sync.html (en, ja, zh) without running `node llms-full.mjs`, so
site/worker.test.mjs's "llms-full.txt is current" test has been red on
main since 21:05. The cli (linux/amd64, nogui) job of CI run
43465016007 (d5585933f), the first run in hours not cancelled by the
next push, failed on it.

Regenerated with `node llms-full.mjs`; the diff is that section only
(+988 bytes).

Run at 640304a16 + this change, on mica:
  cd site && node --test worker.test.mjs   pass 41, fail 0
The same test against the old file is red on CI (run 43465016007).
Not run: the Go suite (no Go change).
2026-11-14 01:59:39 +08:00
yetone 640304a165 edit: a TOML file's table names are let go after 5 minutes unlisted
Codex's real config.toml (1.5 MB, ~11k project tables) had its table
names kept for the process's life once the start-up rename
(agent.RenameLegacy) listed them: 1.16 MB of packStrings in an exact
heap profile (memprofilerate=1) after 8 minutes idle in the real-account
sandbox, the largest holder left under cli.init. The whole parse was
already let go after a minute (tomlIdle); the names now go after
namesIdle (5 min) with no list, the other kept answers (GetTOMLTop,
GetTOMLTable, polled every 3s) stay, and a list a caller holds is not
touched.

Cost of a list after the let-go: BenchmarkTOMLTablesCold on that config,
9.0 ms and 21.5 MB of garbage per list (mote, M5 Pro).

Run: go test ./internal/edit (mote), TestTOMLNamesLetGoWhenIdle red with
the drop made a no-op by hand ("the names were kept past namesIdle"),
green with it.

Real-account sandbox (mote, real Codex config.toml), 8 minutes idle after
the page closed. Exact heap (memprofilerate=1): liveHeap 19.47 MB before
(v0.1.4082) -> 18.00 MB after, and RenameLegacy's held bytes 2.24 MB ->
0.86 MB, with no packStrings left. Without the profiler: liveHeap 19.57
-> 18.01 MB, heapInuse 33.1 -> 31.0 MB; footprint 71 vs 75 MB, within
one run's noise of each other. Also run on mica: gofmt, go vet for
darwin, windows and linux, go test -race ./internal/edit, and go test
./internal/agent ./internal/library ./internal/cli, all ok.
2026-11-14 01:58:42 +08:00
yetone 82512bb640 usage: the probe chunk is let go when the pages rest and after warm-up
probeChunk memoised its last chunk for the polling page (#2278), and
nothing ever cleared it: ~5 MB of unpacked probe rows held for the
process's life on a real gateway's history, the largest single live
holder left in an idle heap profile (makeProbeChunk -> rowChunk.add).
ReleaseScratch (page rest) and ReleaseMatchScratch (after warm-up) now
drop it with the rest of the reads' scratch; the next page read makes it
again, and while a page polls the memo still answers.

Run (mica): go test -run 'TestProbe|TestAnswered' ./internal/usage/ ok.
Broken by hand: without the two releaseProbes() calls,
TestProbeChunkLetGoAtRest fails ("ReleaseScratch kept the probe chunk").

Measured on mote, real accounts in the sandbox HOME, idle after the page
was open 30 s and closed 60 s (memv.sh), base vs this, two runs each:
  heap profile in use: 52.5 MB (4.91 MB under makeProbeChunk, held from
    gui.warmStart) vs 46.9 MB (none under it)
  liveHeap: 40.0 / 45.7 MB vs 40.4 / 40.4 MB
  footprint: 94 / 117 MB vs 102 / 107 MB (noisy run to run)
go test ./internal/usage/ ./internal/gui/ on mica: ok.
2026-11-14 01:06:11 +08:00
yetone 6112dd37c1 agents: Use Claude Magpie shows with Claude Magpie made too, and the row names it (xMopf7RF on X)
xMopf7RF on 0.1.4076: "没看到按钮". The Use Claude Magpie button beside
Claude Desktop's switch showed only while Desktop wasn't on magpie and
Claude Magpie was off (`!a.isolated.on`). The reporter had tried Claude
Magpie since 0.1.4064, so it was on while Desktop wasn't on magpie, the
one state where the button hid. The row then still read "on magpie,
Claude Desktop opens a separate profile…", though connecting there wires
only Claude-Magpie-3p (desktopSets), never their own Desktop.

States where Desktop isn't on magpie, before → now:
- Claude Magpie off: button shown (unchanged).
- Claude Magpie on, app there: no button, wrong line → button, and the
  line says connecting puts Claude Magpie on magpie and their own Desktop
  stays signed in with Anthropic.
- Claude Magpie on, app deleted from ~/Applications (launcher ""): no
  button, so nothing made it again → the button, whose
  settings/desktop-isolated on:true remakes the app (desktopiso.Add over
  nothing), then connects.
- isolated missing (not a Mac, WSL): no button (unchanged).

Run (mica, mote over its 18 cores):
- desktop-twin.test.cjs, new cases: Claude Magpie made with and without
  its app, every language, 1100 and 640px, Chromium and WebKit: 62/62 ok.
  Broken by hand: the same file on origin/main's app.js: 40 red (every new
  case), 22 ok.
- TestCoreScriptBudget ok (within the room app.js had).
- Every GUI file naming claude-desktop or isolated (31) with i18n-keys and
  i18n-en-no-cjk, both engines: 760/762; the two reds are
  desktop-tiers' Chromium cases, red the same on origin/main 65f745dd4
  with this change taken out (#6475).

Not tried: the real app on a Mac with a deleted Claude Magpie.app; the
switch alone (not the button) in that state still wires the folders
without making the app again.
2026-11-14 00:51:23 +08:00
yetone d5585933f1 usage: heat-digests.bin is read mapped, not copied into the heap
The heatmap's key names each session file's chunk by a digest kept on
disk by serial (#2278). The file holds up to 2*sourceDigestsKept digests
at 40 bytes each, 5MB on a long history, and every start read it whole
into the heap and kept it there for the process's life. After a save the
encoded bytes stayed instead, the same 5MB.

Where the system maps files (unix), the file is now mapped read-only,
as requests-v1.bin already is (mapDiskFile), and kept is read from the
mapping: its pages are clean file pages, not footprint, and a lookup is
a binary search that touches a few of them. After a save the file just
written is mapped in place of the encoded bytes, when it is still those
bytes. The file is only ever replaced by a rename, so a mapping stays
as it was read. Windows reads it into memory as before (mapsFiles).

Run (mica, go1.26.8):
- go test ./internal/usage/: ok (54s)
- go vet ./internal/usage/, GOOS=windows go vet ./internal/usage/: clean
- Broken by hand (no mapping on load, no keepMapped after save):
  TestSourceDigestsKeptAcrossStarts red, "after a save the digests are
  kept as encoded"; green again with the change.

Real account (mote, the owner's history in a sandbox HOME, magpie web
with the page open, 90s idle, footprint + Go MemStats):
- before (w63 = v0.1.4074's code): footprint 109MB, live heap 44.9MB
- after: footprint 101MB, live heap 39.6MB

- wsl-run and win-run: go test -run 'SourceDigest|Heat' ./internal/usage/
  ok on Linux (the mapped path) and Windows (read into memory).

Not run: the full ./... suite (only internal/usage is changed).
2026-11-14 00:40:00 +08:00
yetone 65f745dd4c plugins: Installed is narrowed by Discover's kinds and origins
WJaunita45604 on X asked for the Installed tab to be filtered by
Discover's categories, and by whether a plugin is official, with
Discover's own categorisation. Installed now has the same strip and menu
as Discover:
- the kinds strip (All, Subscriptions, Middleware, Agents, Tools, Pages),
  each with how many are installed;
- the Origin menu (magpie community, other authors, unofficial on GitHub),
  without Discover's "Not installed only".

browseBar's strip and Origin button are split out (kindStrip,
originButton) so both tabs draw the same component. The rest is in
plugininstalled.js, imported when Plugins first draws, as plugingrid.js
is (old-webkit lists it); until it is in, the list is drawn whole. What
is left in the core is 674 bytes, within its budget's room. A plugin Discover
lists is put where its card is (kindOf, srcOf). One it doesn't list (a
folder, an unlisted npm package) is put by what it is: middleware or
gateway, agent, tools only, a page, else a subscription; from GitHub,
@magpie-community, else other authors.

The strip shows only when two or more kinds are installed, and the menu
only when two or more origins are. A pick that leaves nothing says "No
plugin matches" with Show all. Installed keeps its pick across tabs and
Discover keeps its own. The list head grows when it wraps
(.pm-listhead.pm-bar), so a narrow row doesn't run under the list. There
are no new strings, no native select (the app menu), and no left-border
accents.

New plugin-installed-filter.test.cjs: seven installed plugins of every
kind and origin, two of them GitHub repos from fixtures/plugins-github-31.
It runs in every language, both engines, at 1100px and 420px.

Run (on mote, Playwright 1.62.0, chromium + webkit): the new test, 20 of
20. Red on origin/main 005178104 (no strip on Installed: waitFor
.pm-listhead .pm-kinds times out).

On mote, both engines: at base 077421733, go test -tags nogui
./internal/gui ok and add-sheet*, provider-env-paste, plugin*.test.cjs,
old-webkit, i18n-keys and i18n-en-no-cjk green but the reds below and
the two the scroll buttons' commit fixes. Rebased on origin/main
6e03b746b with that commit: TestCoreScriptBudget ok with no raise;
add-sheet*, provider-env-paste, plugin-installed-filter,
plugin-api-prompt-key, plugin-password-prompt, the eight plugin files
red before, old-webkit, i18n-keys and the scroll files that commit
names: green but the reds below.
Reds that fail the same on origin/main 6e03b746b, run alone there:
old-webkit (#6467 appearance.js, #5919 .side-foot:has), plugin-move-unserved
(#4392), plugin-signed-out-account (#5998), plugin-signin-no-url (#5938),
plugin-page-foreign-error (#6117), plugin-option-placement (#6559),
rollup-short (#6560), text-size in WebKit (#6561), phone-no-sideways de
375 (#5869). The whole GUI suite was not run: mote's and mica's loads
were over their cores all evening (mote 27-53 on 18, mica 66-104 on 12).

Rebased on origin/main 1730c75b9, the pushed head (mote): go test -tags
nogui ./internal/gui ok; add-sheet*, provider-env-paste,
plugin-installed-filter, plugin-api-prompt-key, plugin-password-prompt,
i18n-keys, i18n-en-no-cjk and view-ends, both engines: 252 of 252.
a82bae2bd, landed on top since, changes the routing plugin, the
gateway and i18n.js keys of its own, none of these files; the core
measure at the pushed head is 1,267,635 of 1,268,961.
2026-11-14 00:16:51 +08:00
yetone b3d1334458 providers: the Add sheet's search shows its hint whole
WJaunita45604 on X: 输入框里面的提示的字显示不全. Since a44da380b
(v0.1.4044) the Add sheet's search hint has been "Find a vendor, or paste a
URL and key…" (查找供应商,或粘贴地址和密钥…), in a box 160px wide, so it
was cut off in every language.

wholeHint (addfloat.js, which the sheet already imports) measures the hint in
the box's own font and sets
--hint-w, which the CSS now sizes the box by: in the sheet's row and when
the tools float into the title bar. Where even that has no room it shows
the shorter "Find a provider" (already in every language) instead. At 760px
and narrower the box keeps room for that short hint (--hint-s), and Import…
wraps to the next line rather than cut it; Custom provider stays on the
search's line (add-sheet-custom). Nothing changes in the observer's own turn,
the hint included: the next frame measures, sizes the box and then picks,
as WebKit calls a change while sizes are being told a loop.

The core grows 84 bytes, the import that calls wholeHint, within its
budget's room.

provider-env-paste asked for the long hint at 440px too. It now waits for
the box to be sized and takes either hint below 900px.

New add-sheet-hint.test.cjs: every language, both engines, at 1300, 1024,
900, 420 and 360px. It checks the hint's drawn width against the room in
the row, floated in the title bar, and after narrowing and widening the
window, and asks for the long hint at 1300 and 900px.

Run (on mote, Playwright 1.62.0, chromium + webkit):
- add-sheet-hint, add-sheet-float, add-sheet, add-sheet-custom,
  provider-env-paste: 140 of 140 (the add-sheet runs with the #6216 fix).
- Broken by hand: the test on origin/main 005178104 (no wholeHint, its
  wait for --hint-w swapped for 300ms) is 26 of 26 red, e.g. "the hint
  fits: 222.125 > 140".
- An earlier version that put the search on a line of its own at 520px and
  narrower broke add-sheet-custom's "on the search's line" at 420px. That
  is why Import… wraps instead.

On mote, both engines: at base 077421733, go test -tags nogui
./internal/gui ok and add-sheet*, provider-env-paste, plugin*.test.cjs,
old-webkit, i18n-keys and i18n-en-no-cjk green but the reds below and
the two the scroll buttons' commit fixes. Rebased on origin/main
6e03b746b with that commit: TestCoreScriptBudget ok with no raise;
add-sheet*, provider-env-paste, plugin-installed-filter,
plugin-api-prompt-key, plugin-password-prompt, the eight plugin files
red before, old-webkit, i18n-keys and the scroll files that commit
names: green but the reds below.
Reds that fail the same on origin/main 6e03b746b, run alone there:
old-webkit (#6467 appearance.js, #5919 .side-foot:has), plugin-move-unserved
(#4392), plugin-signed-out-account (#5998), plugin-signin-no-url (#5938),
plugin-page-foreign-error (#6117), plugin-option-placement (#6559),
rollup-short (#6560), text-size in WebKit (#6561), phone-no-sideways de
375 (#5869). The whole GUI suite was not run: mote's and mica's loads
were over their cores all evening (mote 27-53 on 18, mica 66-104 on 12).

Rebased on origin/main 1730c75b9, the pushed head (mote): go test -tags
nogui ./internal/gui ok; add-sheet*, provider-env-paste,
plugin-installed-filter, plugin-api-prompt-key, plugin-password-prompt,
i18n-keys, i18n-en-no-cjk and view-ends, both engines: 252 of 252.
a82bae2bd, landed on top since, changes the routing plugin, the
gateway and i18n.js keys of its own, none of these files; the core
measure at the pushed head is 1,267,635 of 1,268,961.
2026-11-14 00:16:51 +08:00
yetone 36126daeff gui: the scroll buttons don't watch the room kept under a held click
scrollends.js watched every child of the open page for a size change,
app.js's .view-room among them. "Where the reader is" (hold) sizes that
room from its own ResizeObserver, while sizes are being told, so WebKit
ended the turn with "ResizeObserver loop completed with undelivered
notifications" as a page error. It showed once the Add sheet's search
got its hint's width: in German at 420px, a provider's sign-in opened
from its tile made hold give the page room, and
plugin-api-prompt-key and plugin-password-prompt went red in WebKit
(de 420, every run). hold sets scrollTop with the room, and that scroll
is heard, so the buttons still follow.

Found by wrapping ResizeObserver to report each callback that changed an
observed size: hold (app.js heldSizes) took .view-room from 61px to 30px.

Run (on mote, Playwright 1.62.0, chromium + webkit), at this commit with
the next one (the search's width):
- plugin-api-prompt-key, plugin-password-prompt: 22 of 22, three times
  in WebKit; without this change 8 of 8 runs red at de 420.
- add-sheet*, provider-env-paste, old-webkit, and every file that
  touches the scroll buttons or the room (add-button, click-scroll,
  phone-no-sideways, rollup-short, routing-editor-foot,
  routing-save-blank, routing-save-keeps-the-row, sessions-paging,
  signin-closes-sheet, text-size, view-ends-relayout, view-ends):
  every test green but the reds below.

Reds that fail the same on origin/main 6e03b746b, run alone there:
old-webkit (#6467 appearance.js, #5919 .side-foot:has), plugin-move-unserved
(#4392), plugin-signed-out-account (#5998), plugin-signin-no-url (#5938),
plugin-page-foreign-error (#6117), plugin-option-placement (#6559),
rollup-short (#6560), text-size in WebKit (#6561), phone-no-sideways de
375 (#5869). The whole GUI suite was not run: mote's and mica's loads
were over their cores all evening (mote 27-53 on 18, mica 66-104 on 12).

Rebased on origin/main 1730c75b9, the pushed head (mote): go test -tags
nogui ./internal/gui ok; add-sheet*, provider-env-paste,
plugin-installed-filter, plugin-api-prompt-key, plugin-password-prompt,
i18n-keys, i18n-en-no-cjk and view-ends, both engines: 252 of 252.
a82bae2bd, landed on top since, changes the routing plugin, the
gateway and i18n.js keys of its own, none of these files; the core
measure at the pushed head is 1,267,635 of 1,268,961.
2026-11-14 00:16:51 +08:00
yetone 25e4d19c04 providers: an editor closed before its certificate rows load draws none (#6216)
drawEditor imported tlscerts.js and, once it was in, called tlsCertRows
with the module-wide draft. An editor closed (or swapped for another)
before the import resolved handed it null, and drawPin threw "Cannot
read properties of null (reading 'serverPin')". add-sheet.test.cjs opens
and closes editors quickly and went red on that pageerror under load
(#6216). The rows are now drawn only while the draft is still the one
the editor was drawn for. That is 50 bytes of core script, the hook
itself, within the core budget's room at 6e03b746b.

Run (on mote): add-sheet.test.cjs, both engines, 4 times on origin/main
005178104: red 2 of 4 (the serverPin pageerror); 6 of 6 green with this.

On mote, both engines: at base 077421733, go test -tags nogui
./internal/gui ok and add-sheet*, provider-env-paste, plugin*.test.cjs,
old-webkit, i18n-keys and i18n-en-no-cjk green but the reds below and
the two the scroll buttons' commit fixes. Rebased on origin/main
6e03b746b with that commit: TestCoreScriptBudget ok with no raise;
add-sheet*, provider-env-paste, plugin-installed-filter,
plugin-api-prompt-key, plugin-password-prompt, the eight plugin files
red before, old-webkit, i18n-keys and the scroll files that commit
names: green but the reds below.
Reds that fail the same on origin/main 6e03b746b, run alone there:
old-webkit (#6467 appearance.js, #5919 .side-foot:has), plugin-move-unserved
(#4392), plugin-signed-out-account (#5998), plugin-signin-no-url (#5938),
plugin-page-foreign-error (#6117), plugin-option-placement (#6559),
rollup-short (#6560), text-size in WebKit (#6561), phone-no-sideways de
375 (#5869). The whole GUI suite was not run: mote's and mica's loads
were over their cores all evening (mote 27-53 on 18, mica 66-104 on 12).

Rebased on origin/main 1730c75b9, the pushed head (mote): go test -tags
nogui ./internal/gui ok; add-sheet*, provider-env-paste,
plugin-installed-filter, plugin-api-prompt-key, plugin-password-prompt,
i18n-keys, i18n-en-no-cjk and view-ends, both engines: 252 of 252.
a82bae2bd, landed on top since, changes the routing plugin, the
gateway and i18n.js keys of its own, none of these files; the core
measure at the pushed head is 1,267,635 of 1,268,961.
2026-11-14 00:16:51 +08:00
yetone a82bae2bd3 routing: a request's row says the service tier it went at (Anotiaww on X)
Anotiaww on X: with Codex's fast mode on, the Routing page's request log
didn't show that a request went in fast mode.

Two gaps. Codex on its own ChatGPT sign-in (codexUpstreamOn) set only the
route's tier, never its tries', and the Routing row drew only a group
member's fast flag, never a tier.

- codex_backend.go: the try (first and askAgain) carries the body's tier
  (bodyTier), and its end notes tier_served through servedTierAt. The
  handed-on usage record has tier_asked/tier_sent too.
- plugins/routing/client.js: the row shows a quiet tag beside the model
  (fast for priority, Ultrafast, flex) from the try's tier, or the
  route's asked tier while in flight. Its title says the tier and, when
  the reply said another, what it said. No new column. rowSays' sig
  takes the tier, so the row is drawn again when it changes.
- "flex" is a core word in i18n.js (i18n-keys: a plugin can't own a
  word other code says); its title strings are the routing plugin's.
- docs/subsystems/gateway-routing.md says the Codex relay's tries carry
  the tier and what the row shows.

Price: a priority turn is still priced at the standard rate. Pricer and
catalog.Price don't read the tier. That is #1784's open work, in
hhh2210's fork PR (hhh2210/magpie#1, catalog.ServicePrice), so nothing
is duplicated here. No Flags bits added or changed.

Run on mica (mote and mica both over their core count; mica the lower),
at 74b5f2420 on origin/main 1730c75b9:
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags
  nogui ./internal/gateway ./internal/gui: ok
- go test ./internal/gateway -run 'Tier|ChatGPTBackend|OpenAIAPI|
  CodexOwn|CodexRelay|FastPick|SessionRoute': ok
- go test ./internal/gui -run 'Budget|I18n|Routing' (core script
  budget): ok
- node --test routing-service-tier, i18n-keys, i18n-en-no-cjk,
  routing-entry, group-member-fast: 52 of 52
Before the last rebase, at the same change on 817d35ffa: every GUI file
that loads the routing page plus i18n-keys and i18n-en-no-cjk, 3672
tests, 38 red. i18n-keys' "flex" was mine and is fixed above. The other
reds were in six files, with the same 25 red when those files ran alone
at 817d35ffa itself. Each is filed: ctx-session-line #5801,
routing-context-fold #5586, routing-pin-away #6512, routing-row-swap
#3799, routing-story-shrinks #3954, and mobile-web #3952/#5013 (its
"desktop matches origin/main" needs .git, which a mica-run copy lacks).
The rest (codex-subagent-model, desktop-subagent-model, provider-mask,
routing-many-keys, usage-compact-counts) passed on a rerun at
concurrency 3.

Broken by hand: client.js from HEAD~ makes routing-service-tier 0 of 20;
the first Try's Tier dropped makes TestCodexRelayRouteSaysTier red.
Dropping servedTierAt in end leaves it green: uu.Tier is filtered before
end runs. Kept as a guard.

Not tried: a real ChatGPT account's /fast turn, the full Go suite, the
Windows and Linux runtime.
2026-11-14 00:14:26 +08:00
yetone 1730c75b97 library: Claude Magpie is an agent of its own (xMopf7RF on X)
xMopf7RF asked for Claude Magpie, the separate Claude Desktop, to show
on its own in the Library's instructions, skills and MCP, like an
independent agent. Before, Claude Desktop's target wrote its servers
(DesktopConfigs3p) and Cowork skills (desktopdir.Everywhere) into
Claude-Magpie-3p too, and the twin's Code tab folder
~/.claude-magpie-desktop (a claude# row) got nothing from the Library.

- agent.DesktopTwinApp: claude-desktop#magpie, "Claude Magpie", an app
  target while the Separate app is on and its folder is there (macOS).
  MCP to Claude-Magpie-3p's claude_desktop_config.json, Cowork skills to
  its skills-plugin. No instructions file: noPlace points to its Code
  tab's row.
- Claude Desktop's target leaves Claude-Magpie-3p out (DesktopConfigs3p,
  desktopSkillRoots).
- Every claude#<name> row takes CLAUDE.md, skills/ and .claude.json in
  its folder (~/.claude.json for ~/.claude itself). settings.json
  features (hooks, env, tools off) stay keyed on claude.
- Old data: carryTwin, on load and only while nothing is recorded for
  the twin, ticks for Claude Magpie each server and skill magpie gave
  Claude Desktop that is in Claude-Magpie-3p already, so an update takes
  nothing away. library.json syncs, so another Mac's twin sees the same
  ticks. Unticked later, it stays unticked.
- Not changed: desktopCarryMCP still copies the user's own Desktop
  servers into the twin when it is wired.

Run (mote, sandbox HOME in the tests):
- go test -tags nogui ./internal/library ./internal/agent
  ./internal/desktopiso ./internal/desktopdir: ok (167s, 251s).
  GOOS=linux and GOOS=windows go vet of library and agent ok; gofmt clean.
- TestClaudeMagpieIsItsOwnLibraryAgent: InstallSkills, SaveServer and
  SaveInstructions write only Claude-Magpie-3p and
  ~/.claude-magpie-desktop; Claude Desktop's config and manifest,
  ~/.claude/settings.json unchanged; ~/.claude.json, ~/.claude/CLAUDE.md
  and ~/.claude/skills/pdf not written. TestClaudeMagpieKeepsWhatDesktopWasGiven.
- GUI, both engines: library-*.test.cjs (76 files), by-agent,
  every-skill, group-skill-chips, pick-skills, project-*, skill-*,
  i18n-keys and the new library-desktop-twin.test.cjs (separate chips
  for Claude Magpie and Claude Code · Claude Magpie, lit only for what
  they were given, a click on Claude Desktop's asks for it alone; en,
  zh, zh-TW, ja, de at 980 and 420px). 1850 of 1878 the first run, with
  a library.css hand change since dropped; the 28 reds were all in
  library-new-skill, library-subagents, library-wsl-asleep and
  skill-where, and those four files plus the twin test, run again
  without it: 174 of 174.

Broken by hand, each red then restored: carryTwin off (fs/pdf not
ticked, nothing recorded); Desktop's skill roots with the twin's folder
(target reaches Claude Magpie's folder); the claude# branch off (Code
tab target nil); DesktopConfigs3p with the isolated config again
(library and agent tests red).

Filed: #6558, a row's chips reach past its edge at 420px (ja with four
agents, before this too with six); the twin test skips that check for ja
at 420px until it is fixed.
Not tried: a real Claude Magpie.app on a desktop reading the new files.
2026-11-14 00:01:24 +08:00
yetone d0fb3c0084 provider: Claude accounts can be set not to spend extra usage (baksili_ on X)
baksili_ on X asked for a way to keep magpie off Anthropic's paid extra
usage on Claude subscription accounts. magpie can't flip Anthropic's own
switch, so it holds the account itself.

Providers -> Claude -> Advanced has a new "Spend extra usage" row: On,
as before, by default (nothing changes for anyone who doesn't touch it).
Off saves claudeNoExtraUsage. While it is off, HoldCaps holds every
Claude account at 100% of any plan window with no cap of its own (the
same Credits hold a Codex account set not to spend its credits gets),
so a Claude account whose 5-hour or weekly window is used up gets no
requests until it renews and the other accounts take them. What its
plan has left is still used; a cap the user set lower still holds first.

A cap on an account's "Usage credits" window (its extra-usage spend,
set as an amount or a share on the usage card) now holds the account
the same way once that much extra usage is spent (Allowance.extraCapped,
called from CapHeld and NearCap). Before, aside windows carried no
amount, so an amount cap on one never held anything; allowanceOf now
gives aside limits their Amount, Of and Unit.

Every route that picks an account goes through capHeld, so the gateway,
groups and fallback obey it alike. Claude Code switching (NextLogin)
already moves off an account on overages. The warm-up sends a held,
used-up account nothing (codexWarmer.held / spentPast; claudeHeldFull
for Claude), since that request would be billed as extra usage. With
every account held, the client is told "has used up a usage window and
is set not to spend extra usage" and how to turn it back on, and the
call's record says "set not to spend extra usage" (Weighed.ExtraUsage).

Not done: Claude Code's hidden /limit-reset. It resets or buys limits
through endpoints Anthropic hasn't published, and calling them would be
mimicking Claude Code's client, which magpie doesn't do. A Claude Code
signed in on its own, not through magpie, still spends extra usage.

Run on mote at 5b0572ae3 + this change; rebased since on ce2ce86ab
(two gui commits on WebView2 and a GC read, no file in common), where
the gui budget tests passed again:
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: ok
- go test -timeout 45m ./internal/provider ./internal/gateway
  ./internal/settings ./internal/settingsapi ./internal/gui: all ok
  (gateway 939s; the core script budget passes)
- GUI (node --test, Chromium and WebKit): claude-extra-usage-setting
  (en, zh, zh-TW, ja, de at 1100 and 420), provider-prefs,
  claude-lean-prompt-setting, i18n-keys, account-cap, claude-overages,
  quota-credits: 114 of 114
- gofmt -l: clean

Broken by hand (at the 7eecbcc56 base), each red, then restored:
- HoldCaps' claude case -> TestClaudeNoExtraUsageHoldsAtThePlan,
  TestClaudeNoExtraUsageHoldsTheAccount (gateway)
- extraCapped in CapHeld -> TestClaudeExtraUsageCapHoldsAtThePlan
- aside Amount/Of in allowanceOf -> TestAsideWindowAmountCapHolds,
  TestClaudeExtraUsageCapHoldsAtThePlan, TestClaudeHeldFull
- spentPast in warmNow -> TestWarmUpSendsAHeldAccountNothing
- capHeld's extra flag -> TestClaudeNoExtraUsageHoldsTheAccount
- the row left out of #claudeRunList -> claude-extra-usage-setting
  20 of 20 red

Not tried: a real Claude account on extra usage; the hold was checked
with /usage reads built from the CLI's shape, not a live account past
its plan. The full ./... suite was not run (mote and mica over their
load limits, two full suites queued on mote's suite.lock).
2026-11-13 23:42:57 +08:00
yetone ce2ce86ab4 gui: windows drawn again when the screen comes back, WebView2 without occlusion tracking (aquaarboraurum on X)
aquaarboraurum: on Windows the window that comes back after every
auto-update restart is white. Its title bar and status bar are there,
and its page is alive. A restart by hand or a reload draws it.

AutoRestart only restarts once nothing is going through magpie and the
window has sat unused, which is when the user is away, often with the
screen locked or the display off. A WebView2 window first shown then
can keep a white surface: Chromium's native occlusion tracking takes
every window as covered while the screen is locked, and a surface first
drawn in that state may not be drawn again. Closing the window to the
tray and opening it again, which the reporter did by hand, draws it.

- windowsOptions starts WebView2 with CalculateNativeWinOcclusion
  disabled (occlusionOff), after the user's own features. A user who
  enables it in WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS keeps it on.
  Wails still tells a hidden or minimised window so (put_IsVisible).
- Wails' main-thread window registers for session and display-state
  notifications (watchScreenBack). The app's WndProcInterceptor
  (appWndProc, which still calls screensWndProc) draws each open window
  again (redrawShown) when the session is unlocked or the display comes
  on after being off, as mendOnWake already did on wake.

Not reproduced: the white window never showed on xiaomi-gpu (Windows
11, WebView2 157.0.4341.46). The tries:
- quiet and asked restarts, behind other windows, maximised, under a
  full-screen cover, cloaked, minimised then restored;
- the real sandboxed AutoRestart update path (v0.1.9000 to v0.1.9001
  from a local feed).
The box's screen can't be locked for a test, so the locked-screen case
the fix is aimed at wasn't tried.

Run:
- Windows (xiaomi-gpu, signed-in session):
  - TestRestartedWindowIsDrawn: all 13 modes pass on the fix. The test
    is new and plays the update restart (old process, markQuietRestart,
    AwaitPredecessor, openMain). Each mode now also posts an unlock to
    the app's own main-thread window, checks that the window is drawn
    again and stays drawn, and checks that the msedgewebview2 browser's
    command line has CalculateNativeWinOcclusion disabled.
  - Broken by hand (the interceptor ignoring the unlock, occlusionOff
    returning the list unchanged): red on both checks.
  - go vet ./internal/gui; TestScreenBackFrom,
    TestAppWndProcSaysTheScreenIsBack, TestWebView2* pass.
  - The real update path with exes built from this tree: the new
    process's window came up drawn (10 of 360 sampled points white,
    the same as the old window) over 22s of samples.
- mote:
  - gofmt -l;
  - go vet ./internal/gui/..., GOOS=linux -tags nogui, GOOS=windows;
  - GOOS=windows go build ./..., GOOS=linux go build -tags nogui ./...;
  - go test ./internal/gui (142s) and -tags nogui (95s): ok.

Not run: the full ./... suite. mote and mica were both over their load
(mote's suite.lock had four suites queued). The change is in
internal/gui only.
2026-11-13 23:36:49 +08:00
yetone 6f2d1a5ac0 gui: a read under a tight GC runs on four Ps
A collection every few MB wakes an idle-mark thread on every idle P,
and the reads' own workers keep them spinning in between. On mote
(18 cores), a request-index rebuild spent ~2 s in pthread_cond_signal,
~1 s in usleep and ~0.5 s in pthread_kill out of its ~16 s of CPU. The
reads use 4 workers (prefetchEach) or at most 8 (decodeCache), so they
gain nothing from more Ps. tightenGC now sets GOMAXPROCS to 4 for its
first read, and the last read to end calls runtime.SetDefaultGOMAXPROCS.
A GOMAXPROCS the user set in the environment is left alone.

Run: TestTightGCNarrowsProcs plus the other tight-GC tests in
internal/gui (ok, on mica, 12 cores), go vet and GOOS=windows go vet
./internal/gui, gofmt -l. Broken by hand (narrowProcs not called):
TestTightGCNarrowsProcs fails with "two reads on 12 Ps, want 4".

Real account on mote (75G sandbox HOME, network blocked, mote at load
23-47 on 18 cores): each run forced a request-index rebuild with a new
Anthropic price, then read the process CPU after the page closed and
again 20 s later. v0.1.4061 against this build, alternating:
15.3/15.6, 15.9/14.9, 16.8/14.8, 17.7/14.8, 15.0/12.5 s. Mean 16.1 s
before, 14.5 s after, about 10% less. Earlier, v0.1.4061 itself with
GOMAXPROCS=4 in the environment: 17.0/12.8, 15.6/13.5, 15.6/14.0,
15.9/15.5, 15.2/14.2 s. Peak cores during the rebuild: 2.8 and 2.9
before, 1.9 and 3.1 after.
At the pushed head (rebased on 55327848b): go build and internal/gui tests ok
on mica.
Not run: Linux vet (the WSL distro lacks webkitgtk-6.0 and gtk4), and
a machine with 4 or fewer cores, where nothing changes.
2026-11-13 23:26:11 +08:00
yetone 5b0572ae3b agents: Use Claude Magpie is its own button beside Claude Desktop's switch (xMopf7RF on X)
xMopf7RF read Claude Desktop's row as "connect Desktop first", and
connecting is what changes their own Desktop. They asked for one button
beside Claude Desktop that makes the clone and touches neither their
Desktop nor ~/.claude. The button that does this has been in the row
since v0.1.4029, but it was a quiet link at the end of a long status
line that warns about connecting. Their screenshot has no button at all,
so it was easy to miss or they were on an older version.

Now it is a real button (ag-add) beside the switch, where Claude Code's
model picker stands. The status line no longer holds it. What it does
is unchanged: Separate app on, then connect, which wires only
Claude-Magpie-3p (v0.1.4064 keeps ~/.claude out of it for a new twin).
It shows only while Desktop isn't on magpie and the twin isn't made yet,
on a Mac.

Run:
- At the pushed head, after the rebase: desktop-twin, desktop-isolated, desktop-isolated-claude and i18n-keys
  in Chromium and WebKit, every language, at 1100 and 640px: 38/38 per
  engine. desktop-twin now checks that the button isn't in .ag-st, sits
  level with the switch 8 to 28px left of it, and that the status ends
  before it. It waits for the fold's animations first.
- Every GUI file whose fixture has claude-desktop or isolated (38
  files), both engines: WebKit 345/345. Chromium 343/345: the two reds are
  desktop-tiers ("no tiers square"), red the same at origin/main
  6e03b746b and filed as #6475. Its fixture is wired with no isolated, so
  the button never draws there.
- TestCoreScriptBudget: ok.
- Sandbox HOME on mote with the real Claude.app, at this tree: CLI
  launcher add, then connect, then launcher remove. The original
  Desktop's config.json and claude_desktop_config.json, ~/.claude and
  ~/.claude.json were byte-identical after each step. The twin's script
  exports CLAUDE_CONFIG_DIR=~/.claude-magpie-desktop.

Broken by hand: with the button put back in the status line,
desktop-twin goes red ("in the status line").

Not tried: a click in the real GUI app. The backend calls are the same as
v0.1.4064's, which the sandbox covers.
2026-11-13 23:21:56 +08:00
yetone 55327848bb LESSONS: a budget raise that cut a menu item, and a move out (23457a51f, 817d35ffa) 2026-11-13 23:21:37 +08:00
yetone 6e03b746be gui: plugin pages load on Windows again, their sandboxed frame kept in the window's process (Mute06162 on X)
Mute06162 on X (0.1.4066, Windows): every plugin page (用量速览, 对话,
模型指纹, GPT号池) showed "This page stopped working / <page> didn't
answer", and Codex found "Worker request cancellation setup: The
parameter is incorrect" and "Resuming Windows asset request: The
parameter is incorrect" in the log. Both are Wails' own lines
(request_cancellation_windows.go, v3.0.0-beta.24).

Cause, reproduced on xiaomi-gpu (WebView2 157.0.4341.46): WebView2 runs
the plugin page's frame (sandbox="allow-scripts") in a process of its
own (Chromium's IsolateSandboxedIframes; CDP lists it as an "iframe"
target). Wails registers its WebResourceRequested filter with
AddWebResourceRequestedFilter, and that isn't raised for this process's
requests: the frame got its index.html (a navigation), but bridge.js,
app.js and style.css went to the network as http://wails.localhost/...
and failed with net::ERR_CONNECTION_REFUSED. The bridge never said
hello, so after 10s the page was broken. Wails' request cancellation
auto-attaches the frame's target, takes it for a worker, and its setup
on that session fails with E_INVALIDARG: that is the log line.

Fix: windowsOptions starts WebView2 with IsolateSandboxedIframes
disabled (sharedFrameProcess), merged into the one --disable-features
with the user's own, unless the user enables it in
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS. This is app-wide, so it covers
every sandboxed frame magpie makes: plugin pages and plugin panels
(pluginpages.js, the only two), in the main window and the tray panel.
The frame keeps its sandbox: an opaque origin (its context's origin is
"://"), its CSP, messages only.

Run:
- Real repro on xiaomi-gpu, sandbox HOME (C:\Users\yeton\magpie-wvf),
  testdata/page-plugin (magpie-usage-glance, the reporter's 用量速览),
  `magpie app` started in the console session by a one-shot scheduled
  task, driven over CDP:
  - origin/main 077421733: the page shows "This page stopped working /
    Usage glance 的页面没有响应"; the frame target's three subresources
    fail ERR_CONNECTION_REFUSED; err.log has "Worker request
    cancellation setup: The parameter is incorrect." on every open.
  - origin/main with --disable-features=IsolateSandboxedIframes set by
    hand in WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: the frame stays.
  - this change: the card draws (screenshot: "Today, 0 calls, 0 tokens,
    $0.00, Hide cost", so the bridge and usage:summary read work), and
    no Wails line is logged.
- TestWebView2KeepsPluginFramesInTheWindowProcess (new): win-run
  `go test -run WebView2 ./internal/gui` ok on xiaomi-gpu. Broken by
  hand (sharedFrameProcess not called): red on Windows, "disabled 0
  times". TestWebView2ArgsMergeTheUsers and
  TestWebView2ArgsSurviveWailsInit updated for the new default.
- mote: go test ./internal/gui ok (158s).
- mica: go vet ./internal/gui for GOOS=windows, GOOS=linux -tags nogui
  and darwin ok; gofmt -l clean.

Not tried: an older WebView2 runtime (when the runtime turned the
isolation on is not proven; 157 has it), the reporter's other three
plugins (they are frames like this one), Wails' own fix (registering the
filter for every request source kind), and the whole internal/gui
package on Windows.
2026-11-13 23:17:31 +08:00
yetone 817d35ffa9 usage: a window's whole follows the tokens pick's With cache (Anotiaww on X)
@Anotiaww asked (X 2121248031983194214) that the account cards' "Whole ≈ N
tokens" on Usage → Overview follow the page's tokens pick. With cache, it
now adds the window's routed cache read and written, scaled by the same
share used as the input and output; the line reads "Whole ≈ N tokens with
cache" and its tooltip says cache is included. Without cache nothing
changes. Changing the pick redraws the cards. The tray panel shows no
holds line, so it has nothing to follow.

holdsLine and holdsUnknownLine move from app.js into the Usage plugin's
page.js, beside usageWithCache, so the core script budget stays as it is
(it had 14 bytes left). quotaWindows still calls them as globals. New
words are said in zh, zh-TW, ja and de.

Run (mica, both engines, every language):
- quota-holds, i18n-keys, i18n-en-no-cjk: 16/16 ok. The new quota-holds
  test (pick With cache at 360 and 1000px, reload keeps it, pick back)
  went red in both engines with the cache left out and the old words, and
  again with no redraw on pick.
- 185 GUI files that reach Usage or quotas, plus mobile-web, idle-ticks,
  old-webkit and every i18n file, concurrency 3. Reds: account-eye,
  account-mask, account-refresh-holds, claude-quota-onboarding,
  codex-auto-reset (de), key-balance-card (de), menu-scroll, mobile-web,
  old-webkit, quota-count-wrap. The same files are red at the base
  ac0b5c287 without this change (quota-count-wrap 1100px cut, alone), and
  each is filed (#5052, #3951, #5814, #6179, #4790, #6414, #6532, #3952,
  #6467, #3404).
Run (mote): go vet, GOOS=linux vet -tags nogui, GOOS=windows vet, builds;
go test -tags nogui ./internal/gui (TestCoreScriptBudget), ./internal/provider,
./internal/usage ok.
Rebased on 077421733, where 5211fd3ba gave holdsLine a provider's
currency (prov); page.js carries it. At this head (mica): quota-holds,
quota-curve, currency-provider, currency, i18n-keys, i18n-en-no-cjk,
quota-count-wrap 80/83; the reds are quota-count-wrap (#3404, red at
077421733 too) and quota-curve chromium en/zh (#4768), which passes 31/31
alone here and at 077421733. go test -tags nogui ./internal/gui (budgets) ok.
Not run: the full go test ./... and the full GUI suite (both machines were
loaded); the only Go change is a comment.
2026-11-13 23:12:48 +08:00
yetone 23457a51f3 gui: an image or video model's chip says what it makes from its right-click
iceloon on X: under a base-URL provider's Image models a video model sat
with no way to move it. A chat model's chip already had Makes… (#1399);
the Image models and Video models chips now have the same right-click
(Copy model ID, Makes: …), on a provider whose models can be marked
(marksKinds). The pick is staged as on a chat chip and sent with Save as
modelPrefs' kind; the chip's tick is untouched. /api/providers carries
mediaKinds, so a marked media chip shows its tag and its pick. A
subscription's image models get no such menu. No new strings.

The core script budget goes up 316: the chat chip's Makes… is now shared
with the media chips (kindAct, kindTag), and the media chip's Copy model
ID was left out to pack it; the provider's editor draws these chips, so
there is no page to move them to.

Run (at 077421733 + both commits):
- mica: go vet -tags nogui ./internal/gui; go test -tags nogui -count=1
  ./internal/gui ./internal/catalog: ok (before the rebase and the
  last 2-byte pack); mote: TestCoreScriptBudget, TestImageModelMarkedVideo
  and node --check at the pushed tree: ok.
- mote, Chromium and WebKit, en/zh/ja/de, 900 and 420 wide: media-kind
  (new) and model-kind 32 of 32; i18n-keys, video-models-hide,
  image-models-hide ok.
- mote, 106 GUI files the editor's chips reach (model-*, models-*,
  provider-*, image/video-models, i18n-*), before the rebase: 2259 pass,
  106 red in 9 files. The same 9 files run at origin/main 077421733
  are red the same (102 of 138): model-api-preset, model-chip-steady,
  model-copy-id, models-works-only, provider-fetch-again,
  provider-many-keys, provider-max-output, provider-models-rest,
  provider-picks-stay, filed as #6532, #6209, #4621 and #4388.
- Broken by hand, each red, then restored: the media chip's
  right-click removed (media-kind 16 of 16 red), mediaKinds not filled
  in /api/providers (TestImageModelMarkedVideo).
2026-11-13 23:05:14 +08:00
yetone 34916c9fde catalog: a model whose id names videos is no image model; xAI's own grok-imagine-video makes videos
iceloon on X: a Grok channel's fetched list put Grok Imagine Video and
Video 1.5 under Image models, where nothing could mark them Video.
"imagine" is in DrawsID's and ImagesAPI's words, so grok-imagine-video
was drawn as an image. Every provider had the same class: wanx2.1-t2v,
wan2.5-i2v, *-video ids.

- namesVideo: an id with the word video, t2v or i2v is no image model
  (DrawsID, ImagesAPI). cogvideox stays as it was.
- #1399 holds: a relay's model is not a video model by its name. A
  relay's grok-imagine-video now lands among its chat models, where
  right-click Makes… -> Video model already marks it.
- xAI's own list (api.x.ai) is the one whose grok-imagine-video* is a
  video model (xaiFilms), and the gateway makes it at xAI's API:
  POST /v1/videos/generations, then GET /v1/videos/<request_id>, as a
  Grok subscription's backend does. xAI has no OpenAI-shaped
  POST /v1/videos, so filmsOpenAI leaves an xAI key out.
- A list saved before this is mended when read (mendKinds), so an old
  grok-imagine-video saved as an image model moves without a fetch.

Run (mica, mica-run, at ac0b5c287 + this change):
- gofmt -l: clean. go vet (darwin, the changed packages), GOOS=linux
  go vet -tags nogui ./..., GOOS=windows go vet ./..., linux and windows
  builds, go build ./...: ok.
- go test -tags nogui -count=1 -timeout 45m ./internal/catalog
  ./internal/provider ./internal/gateway .: ok (gateway 1012s).
- Broken by hand, each red, then restored: namesVideo returning false
  (TestVideoNamedIsNoImageModel, TestFetchRelayGrokVideoIsNoDrawer,
  TestSavedGrokVideoMended), xaiFilms returning false (TestXAIFilms,
  TestSavedGrokVideoMended), the mend in mendKinds removed
  (TestSavedGrokVideoMended), filmsXAI returning false
  (TestXAIKeyMakesGrokVideo).

Not run: the full go test ./... (both machines' suite.lock queues were
hours deep). Not tried: a real xAI API key (none here); the xAI path is
held to docs.x.ai's /v1/videos/generations and GET /v1/videos/<id> by a
fake in TestXAIKeyMakesGrokVideo.
2026-11-13 23:02:39 +08:00
yetone 077421733d gui: a plugin page's one-tone sidebar mark is drawn in the sidebar's ink (shannnnnks on X)
shannnnnks on X (Docker, v0.1.4059): Day card's sidebar icon was black on
the dark sidebar. Its icon.svg strokes with currentColor, and pluginpages.js
drew every plugin page's icon as an <img>, where currentColor is black
whatever the theme, so any one-tone plugin mark (Day card, Agent office,
Usage) went dark on dark.

The tab now wraps the picture in <i class="nav-ic nav-pic"> and runs the
same toneCheck the Plugins page's logos use: a mark in one near-black or
near-white tone becomes a mask in the tab's own ink (var(--muted), the open
page's --fg, More's list --fg-2), as the built-in pages' marks are; a
coloured picture is drawn as it is. The wrapper is an <i>, not a <span>:
load() retitles a tab through its first span.

New internal/gui/tests/plugin-page-icon-tone.test.cjs (Day card's icon.svg
as a fixture, a white mark, the coloured example icon): dark and light,
window and web, all five languages, Chromium and WebKit; mask paint equals
a built-in mark's ink, 16px, ink over 8% of the box on a screenshot, the
open tab in the text colour, the mark kept and title intact after a second
list read, and the phone's More list. plugin-page.test.cjs now finds the
example icon under .nav-ic.

Run on mote (mote-run):
- plugin-page-icon-tone: 46/46 green; with origin/main's pluginpages.js
  put back by hand, 46/46 red (no mask).
- go test -count=1 ./internal/gui: TestCoreScriptBudget was over by 87
  bytes on the first cut; trimmed, ok.
- node --test, both engines: plugin-page-icon-tone plugin-page
  plugin-page-arrange plugin-page-cookie-proxy plugin-page-csp-hash
  plugin-page-idle phone-tabs phone-web sidebar sidebar-glide
  sidebar-tab-top sidebar-settings-steady side-toggle side-width
  nav-pages-hidden nav-sub-icons nav-lamp last-page icon-one-tone
  i18n-keys: 320/320 ok at the pushed tree.
- menu-scroll, phone-no-sideways, plugin-page-foreign-error are red the
  same at origin/main ac0b5c287 (run there too): #5982, #5869, #6117.
  last-page webkit went red once on /api/autobackup access-control
  errors (#6038's class) and passed on the rerun.

At the pushed head, rebased on 5211fd3ba: go test -count=1 ./internal/gui ok (TestCoreScriptBudget
again on aff11e042, which touches no GUI file),
plugin-page-icon-tone + plugin-page ok in both engines.

Not run: the whole GUI suite (mote and mica both had queued suites under
suite.lock); the real Docker build.
2026-11-13 22:52:30 +08:00
yetone aff11e042d LESSONS: the core budget met by packing again, 3 bytes left (5211fd3ba) 2026-11-13 22:49:51 +08:00
yetone a97c8191bc workbuddy: with the provider left out of the names, a model's id is its name (elis_pina on X)
WorkBuddy's model list read "GLM-5.3:workbuddy/glm-5.3" with Provider in
model names Off. WorkBuddy (5.5.6 renderer, getModelDisplayName) shows
every custom model as "name:id" unless the name is empty or equal to
the id, and magpie wrote the catalog id (provider/model) as the id. So
the provider came back after the colon whatever the names said.

- agent (buddyIDs): for WorkBuddy and WorkBuddy AI under Off or Own,
  each magpie entry in models.json gets the name as its id too, so the
  list shows "GLM-5.3" alone. The catalog id stays when two models
  share a name, when the name is another model's id, when the entries
  point at a magpie on another machine or in WSL, and in On mode.
  A model turned off in WorkBuddy, its default effort and a reply limit
  typed in carry across the change of id: an old id is mapped back
  through every label form (Label, PlainName, the list's name).
- provider.AgentNamed: the catalog id of the one model an agent's list
  names so.
- gateway (namedFor): a request with WorkBuddy's or WorkBuddy AI's key
  for such a name goes to that model before any other resolution, so a
  bare id that another provider serves first is not asked instead. The
  reply keeps the name that was asked for. Other agents' keys are not
  mapped.

Siblings: CodeBuddy Code shares the writer and keeps catalog ids. Its
settings.json names the model by the catalog id (codebuddy.go), and its
CLI picker shows the name alone (no name:id template in its bundle).

What users meet: a change of mode, or of a model's name, changes the
id. WorkBuddy then picks another model for a session that had the old
one, as it does for any model that leaves its list.

Run:
- Unit tests: TestWorkBuddyNamesAreIDsWithoutProvider covers Off, Own,
  back to On, WorkBuddy AI and CodeBuddy. TestWorkBuddyAsksByName uses
  the real handler: a name equal to a bare id that a provider listed
  first serves (hidden from WorkBuddy) reaches the named model, and
  OpenCode's key for the same name does not.
- Broken by hand (on mica), each red:
  - buddyIDs always returning the catalog id: the test sees
    id deepseek/pro under Off.
  - namedFor's mapping skipped: the request went to provider "first".
  - The old-id mapping skipped: Own lost disabled.
- Sandbox HOME, built binary:
  - magpie provider add zai (fake upstream) and magpie workbuddy
    provider magpie wrote "zai/glm-5.3 | GLM-5.3 · Z.ai".
  - magpie model suffix workbuddy off rewrote the file to
    "GLM-5.3 | GLM-5.3".
  - magpie serve on a spare port, then a curl with magpie-workbuddy for
    "GLM-5.2" reached upstream as glm-5.2 (reply model GLM-5.2).
  - WorkBuddy 5.5.6's own CLI (app.asar.unpacked/cli/bin/codebuddy -p
    --model GLM-5.3), with HOME set to the sandbox, answered "pong", and
    upstream saw glm-5.3, streamed.
- Full suite on mote at this tree (go test -count=1 -timeout 45m ./...):
  every package ok (agent 369s, gateway 1062s, provider 230s,
  sessions 254s), log kept whole. The doc line in agent-wiring.md was
  added after the run; no test reads that file. gofmt -l is empty,
  and go vet ./... passes. On mica, GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./..., and the linux nogui and windows
  builds pass.
- That suite ran at base ac0b5c287. The change was then rebased onto
  5211fd3ba (usage currency; no file in common). At the pushed head,
  on mica: go build, go vet of agent, gateway and provider, and
  -run "WorkBuddy|CodeBuddy|AgentSuffix|Labels" in those three
  packages all pass.

Not tried: WorkBuddy's window itself (the name:id rule is read from
its renderer source, not seen on screen), and WorkBuddy AI's app.
2026-11-13 22:49:39 +08:00
yetone 5211fd3ba2 usage: a currency "By provider" shows each provider's costs in what it sells in
onkashiko on X: DeepSeek, Kimi (China), Zhipu and other domestic vendors
price in yuan, the rest in dollars, and one currency for every cost made
the Usage page read wrong for half of them.

Settings > Usage > Currency gains a third choice, By provider. With it,
a figure of one provider's calls (a model's, an account's, a key's row,
a request, a routing try, a quota card's whole) shows in the currency
that provider sells in, and every sum across providers (the total,
agents, sessions, charts, the tray, Bark's daily, the day page) in the
currency a "Totals in" row picks, a row shown only while By provider is
chosen. GUI, TUI and CLI agree. Costs stay stored in dollars; only the
display converts, at the live rate (internal/fx).

Which providers sell in yuan (provider.PricesInYuan): a .cn host; a
preset at its own site that is a yuan preset (deepseek, zhipu,
volcengine, tencent-cloud, bailian, siliconflow…), ends in -cn, or is in
its China region; a plugin id ending in -cn; a provider of one's own
with a yuan models.dev catalog served at that catalog's site. A relay
made from DeepSeek's preset, Z.ai, Kimi's and MiniMax's international
endpoints stay in dollars: they share a catalog with their Chinese
twins, so the catalog alone can't tell.

Known limit: models.dev has only dollar prices (converted from the
vendors' yuan at ~6.7-7.0), so a yuan figure is that dollar price at
today's rate and can differ a few percent from the vendor's own list.

A second ask from onkashiko: set the currency of the menu bar and of
the totals apart, sums converted by themselves.

So Settings > Usage also gains an Advanced fold (closed by default, open while
set) with one row, Menu bar currency: Same as totals (the default), $ or
¥ (settings.TrayCurrency, TrayCostIn). It sets the menu bar's totals
cards and the tray tooltip's cost; the Usage page, the panel, the TUI,
the CLI and Bark's daily message stay in the totals' currency
(totalsCurrency). Like the other menu bar settings it stays on this
computer (KeepOwn). Every sum is still made in dollars and converted
once, at the live rate, so a mixed-currency total is never added up
from yuan and dollars.

Settings' currency rows (Currency, Totals in, Menu bar currency and the
rate in the tooltip) moved out of app.js into currencyprefs.js, imported
when Settings draws its usage prefs, and costInYuan is packed: the core
is 3 bytes under coreScriptBudget, with no raise.

Run:
- go test -count=1 at this tree on mote: internal/settings,
  settingsapi, tui, cli, catalog, provider, fx and gui all ok
  (TestCoreScriptBudget included). The full go test ./... and the whole
  GUI suite are queued behind other sessions' suites on suite.lock
  (mote and mica, load 35 and 60) and had not started at push.
- GUI files at this tree (mica): currency-provider, currency, i18n-keys,
  i18n-en-no-cjk, tray-cost, tray-totals, every settings-*, old-webkit:
  362 pass, 28 red. Every red is red the same at origin/main ac0b5c287
  on mote, and filed: settings-search (#6133, #6353), settings-hints
  (#6107, #6353), settings-lines-wrap de 440px (#6353), old-webkit
  appearance.js (#6467) and :has() (#5919). The one red of this change,
  settings-groups' list of Usage's parts (now with the Advanced fold),
  is fixed here: 14 of 14.
- currency-provider.test.cjs (new): en, zh, zh-TW, ja, de at 900 and
  420px, both engines; By provider, Totals in ¥, then Advanced: $ for
  the menu bar with totals in ¥, totals stay ¥21.60, the fold opens
  itself after a reload. Plus currency.test.cjs (3 choices now),
  i18n-keys, i18n-en-no-cjk, tray-cost: green in both engines.
- TestTrayCostIn (values, refused eur/provider, KeepOwn),
  TestFXByProvider (trayCurrency vs totalsCurrency), TestCoreScriptBudget.
- gofmt -l clean; GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., GOOS=linux go build -tags nogui,
  GOOS=windows go build on mote at this tree: ok.
- Broken by hand, each red: costInYuan ignoring the provider (GUI
  test: deepseek showed $1.00 for ¥7.20), PricesInYuan without the
  preset's site check (a relay made from DeepSeek's preset read as
  yuan), CostIn without its By provider branch (settings test),
  TrayCostIn ignoring TrayCurrency (TestTrayCostIn, TestFXByProvider),
  the fold not opening while set (webkit), the row saving into
  totalCurrency (chromium).
- Real app in a sandbox HOME on mote (dev build, magpie web and magpie
  usage) with DeepSeek, OpenAI and Z.ai presets and one call each: the
  window and the CLI both show deepseek-v4-pro ≈¥15.44, gpt-4.1 ≈$1.00,
  glm-4.6 ≈$0.290 and the total ≈¥24.07 at 6.685; /api/settings' fx
  carries yuan ["deepseek"].
Not tried: Windows and Linux windows and trays, the real menu bar with
Menu bar currency changed (drawn natively; covered through trayCurrency
in Go), a real Kimi CN or Zhipu account.
2026-11-13 22:46:00 +08:00
yetone ac0b5c287f pii: a strict request goes once only what an earlier one sent unread is left (gaubeebangeel on X)
gaubeebangeel on X: with masking on, first tokens on a cloud server
came at 30-40s, 10-15s with it off.

Where the time goes, measured on a 60-turn Claude Code Messages body
(367-414 KB, a 4 KB tool result a turn; TestRealLatencyOfALongSession,
gated on GUARD_REAL_DIR, run in WSL on a Ryzen AI MAX+ 395):
- The rules are not it: 89ms for the body cold, 13ms warm (the rule
  memo); 7-11ms on mote's M5 Pro (BenchmarkMaskLongSession,
  BenchmarkScrubCodexTurn).
- AstrLink Guard on the CPU is: ~7 KB/s on its 4 cores (GOMAXPROCS=32),
  ~3 KB/s on one (GOMAXPROCS=2). A turn whose new text the model reads
  waits for it: 16 KB of new tool output is 3.0-3.5s on 4 cores and
  7.8-8.2s on one. That part is the model's reading and stays.
- With the model turned on (strict, 15s), a resumed or never-read
  history was read on every request, until the 15s ran out, though the
  vendor had that text already and it goes as it went on the same route
  (redact's sentSpans): its finds only feed learnLate. 4 cores: 15.1,
  15.0, 15.0, 7.8s, then 0.85s. 1 core: 15s on eight requests in a row,
  then 7.9s, then 1.9s.

Now a request with a bound that waits for every text (masking's strict
wait) marks what it goes without, as a Bounded one does (backend.sent),
and once all that is left is what an earlier request sent unread, it is
answered with a *Partial (afterSent): what it adds was read, the rest
has the rules' masking, as on the same route it had. The model reads on
into the backlog after the request, to the request's own bound, and
keeps what it finds for the next one. While it waits, a strict request
counts only what it adds for the queue, so it goes before a backlog
read on by an earlier request. A strict request with no bound still
reads everything; Bounded (the default) is unchanged.

After, same body, same box: 4 cores 15.1s (the first request: all new
text), then 0.97, 1.3, 1.4, 2.3, 3.0, 3.1, 3.1, 3.1, 2.9s; 1 core 15.1s,
then 2.1, 4.6, 4.5, 4.8, 4.7, 4.6, 5.7, 4.5, 4.9s. Those later turns
come back to back, so each shares the CPU with the backlog read on
after the one before; with an agent's think time between them it is
read meanwhile.

What changes in what is masked: on the same route, nothing in what a
text goes as. A value the model would find late in a backlog text masks
new text from the request after the read, not from the one it went
with. On another route (the user picked another provider), a backlog
text has the model's finds of now, none until it is read, and goes with
the rules' masking alone; before, it was read for up to 15s, newest
first.

Run (WSL magpie-desktop, at this commit rebased on 005178104):
go test ./internal/pii ./internal/masking ./internal/redact,
go test -run "Mask|Redact|Privacy|Model|Partial" ./internal/gateway,
go test -race -count=5 on TestStrictRequestGoesBeforeTheBacklog,
TestBounded* and TestNewestTextReadFirst, go vet (linux, windows,
darwin) on pii and masking, and the latency runs above with the real
AstrLink Guard files.
Broken by hand: with early forced false,
TestStrictRequestGoesBeforeTheBacklog goes red ("the request waited for
the history an earlier one sent unread", 20s).
Not run: the full suite (mote and mica each had suites queued on
suite.lock); Privacy Filter (pf-serve) on a CPU, which shares
backend.find; the queue-order change has no unit test of its own (a
fair one races the turn's hand-over), only the latency runs.
2026-11-13 22:03:56 +08:00
yetone 533f351085 library: billion-context.json syncs, its settings change from its tab, running bilis reload
@Luxzinw on X asked for three things: sync billion-context's config,
edit its settings in the Library's billion-context tab, and have running
bili proxies reload after a change.

Sync. billion-context.json goes in the library part (library.Bundle.Bili),
by sync and backup file alike. magpie finds it the way bili's
src/paths.ts does: BILI_CONFIG_FILE, else $XDG_CONFIG_HOME (or
~/.config, %USERPROFILE%\.config on Windows), then
billion-context/billion-context.json.
- The text is carried as written, comments kept.
- magpie's summary recipe is carried at the canonical gateway address
  and localized to this computer's gateway when written, so two
  computers on different ports don't trade it back and forth.
- A newer local file is never blindly overwritten. Before a carried file
  replaces a different one here, this computer's copy is kept with the
  backups.
- An unreadable file, or one over 1 MiB, counts as unknown and is never
  carried as empty. A bundle without the file leaves this computer's
  alone.
- A file naming a DSN is left out of keyless backups.
- The credential store (<config>.summary-credentials.json) never
  travels.
- A library with no such file hashes as before.
- The new sync preview names the file when it would be added, changed
  or removed.

Settings. GET/POST /api/library/bili/settings, and a Settings section
under the agents in the tab:
- In front: "Summarize with a fast model" (externalSummary), picked from
  the app's menu, never a <select>. It offers magpie's served models and
  the file's own recipes. "Fold only when nudged" (requireNudge) and
  "Nudge every N tokens" (nudgeGrowthTokens).
- Under Advanced, collapsed: the compression philosophy
  (prompts.compressPhilosophy with acknowledgePromptsRisk, which bili
  needs before it reads a prompt override).
Writes go through edit.PatchJSON and temp+rename, so unknown keys,
comments and the BOM are kept. bili disables its whole compress section
on one bad value, so magpie writes only values bili accepts. A magpie
model becomes a providers.magpie recipe whose key is saved in bili's own
credential store, the way bili writes it (0600, O_EXCL .lock,
temp+rename). A user's own providers.magpie is never taken over. A file
bili can't read is said so and left alone.

Reload. After a change, and after sync writes the file, every running
bili on loopback is sent POST /__bili/config/reload. bili reloads routes
and compress there. The status line says whether it did, or that the
agent needs a restart.

Also: agentenv.Vars clears BILI_CONFIG_FILE in sandboxes, and the
settings-parity list names the two routes for stage 3, as the other bili
routes are.

Run (mica, macOS):
- At abcbc632e, this change on origin/main 9a8219237. The three commits
  main gained before the push (e8001f73a, 7af7a3aba, 005178104) touch
  none of these files:
  - go test -count=1 -timeout 45m ./internal/agentenv ./internal/agent
    ./internal/cli ./internal/library ./internal/gui ./internal/davsync:
    all ok;
  - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
    ./..., go build: ok;
  - gofmt -l: nothing;
  - library-bili-settings, library-bili, i18n-keys and sync-scope
    .test.cjs, Chromium and WebKit, every language, 1100 and 420 wide:
    ok;
  - library-bili-settings was red in WebKit 1 run in 4: the tab was
    clicked by its index in a list read before the sidebar drew its own
    list, in another order, so the click reached another tab. A dump of
    the page at the miss showed Instructions still open. Both files now
    click the tab by its name. library-bili.test.cjs did the same twice
    and is changed with it. After the change: WebKit 6 runs in a row and
    both files in both engines, all green.
- Full go test ./... at an earlier base, 7eecbcc56: only
  TestFolderVarsAreListed and TestEveryRouteHasACommandOrIsNamed went
  red, both guard tests for this change. They are fixed here and pass in
  the run above.
- Whole GUI suite at that base: 71 reds, none in the Library, i18n or
  sync. Each also fails without this change on origin/main 459d668b3
  (68 there, and the rest pass at this head):
  - agent-details-ready: #6369, #6373
  - api-key-theme: #6444
  - account-arrange: #6010
  - agent-switch-accounts: #5925
  - aside-native: #6212
  - agent-menu-label: #6371
  - account-refresh-holds: #5814
  - bark: filed as #6543

Broken by hand:
- Collect not carrying the file: TestBiliFileCarried red.
- The model pick without summary, or Advanced not kept open: the GUI test
  red (22 of 32).
- On the old code the new Go tests don't compile, and the route test
  gets 404.

Not tried: a real bili proxy reloading. The reload is tested against a
fake /__bili/config/reload, and bili's source was read, not run. Not
tried with a real WebDAV/S3/GitHub server between two computers either:
the davsync tests use the fake server. When a running bili doesn't reload, the status
line says to restart the agent.
2026-11-13 22:02:05 +08:00
yetone 0051781044 claude-desktop: a new Claude Magpie leaves the original alone, its own Claude Code folder included (xMopf7RF on X)
xMopf7RF asked for Claude Magpie to be a full clone, like an Android
app twin: making it from magpie must not wire their own Claude Desktop
or touch its config. In a sandbox HOME on mote with the real Claude.app
(`launcher add`, then `claude-desktop magpie`, as "Use Claude Magpie"
does), origin/main f798b4eb7 left Claude's and Claude-3p's files
byte-identical, but:

- ~/.claude/settings.json got Desktop's Explore flag (and, with models
  on magpie, Desktop's windows and caps): the twin's Code tab ran on the
  user's own Claude Code folder, since its own folder (#6459) was
  opt-in;
- `launcher remove` then put the user's own Desktop on magpie
  (deploymentMode 3p in Claude/claude_desktop_config.json, Claude-3p's
  configLibrary): turning the Separate app off always moved the wiring
  back to the usual folders, even when it never came from them.

Decided (product calls are delegated):

- A Claude Magpie made new gets ~/.claude-magpie-desktop
  (desktopIsoClaudeDefault in SetDesktopIsolated). Made new is the app
  off and no Claude-Magpie-3p folder yet, and the user never set the
  option: settings.DesktopIsolatedClaudeChosen, set by the Advanced fold
  and `launcher claude-dir`. A clone made before (chats in
  Claude-Magpie-3p, Code tab on ~/.claude) and a user's off are kept.
  The option itself stays where it was; no new UI.
- Off moves the wiring back only when it came from the user's own
  Desktop (stash claude-desktop.isolated-from-own, set when the on path
  moves it). A twin made beside a Desktop not on magpie leaves that
  Desktop off magpie. A Separate app turned on before this mark (since
  11-09) also leaves it off when turned off; connecting it again is one
  click, while wiring a signed-in Desktop the user didn't ask for is the
  harm reported.

Run (mote, at this change on f798b4eb7; after the rebase onto 7af7a3aba,
which changed internal/agent, agent and settingsapi tests and vet ran
again: ok):
- Sandbox HOME, real Claude.app, the same three steps as above: Claude,
  Claude-3p, ~/.claude and ~/.claude.json byte-identical after add and
  connect and after remove; the twin's app script exports
  CLAUDE_CONFIG_DIR=~/.claude-magpie-desktop and Desktop's Explore flag
  went into that folder. Second sandbox: own Desktop wired, `claude-dir
  off`, `launcher add` moved it into the clone (Code tab on ~/.claude,
  as chosen), `launcher remove` moved it back. Sandboxes removed.
- go test -tags nogui agent, cli, settings, settingsapi, desktopiso,
  desktopdir: all ok. gui TestSettingsSaveKeeps*, TestCoreScriptBudget
  ok.
- gofmt -l clean; go vet ./... (darwin), GOOS=linux -tags nogui and
  GOOS=windows go vet ./..., linux and windows builds: ok.
- GUI, Chromium and WebKit: desktop-twin, desktop-isolated-claude,
  desktop-isolated, i18n-keys: 72 of 72 (no GUI file changed).

Broken by hand:
- Off always moving back (no mark check): TestClaudeMagpieTwinLeaves
  TheOriginal red ("the user's own on magpie true").
- No desktopIsoClaudeDefault call: the same test red ("its own folder
  false").
- The default not asking whether the user chose: TestClaudeMagpieOwn
  FolderKeepsWhatWasSet/chosen_off red ("its own folder turned on").

Not run at push: the full go test -tags nogui ./... (on the
f798b4eb7-based tree) was queued on mica behind another session's
suite (mote and mica both over their core count), not finished. Not tried:
a Code-tab session in the real twin's UI (#6459 saw one write into the
folder).
2026-11-13 21:55:13 +08:00
yetone 7af7a3abad LESSONS: a launch-agent fix that also mended installed ones (#2961) 2026-11-13 21:46:37 +08:00
yetone e8001f73a3 providers: a model named at an effort is priced as its model, for every provider (stockAAAAA on X)
Antigravity's gemini-4-argon-high, gemini-4-carbon-high and
claude-opus-5-5-high showed "price unknown". pricedNamesTo, the list of
ids ListPrice, MakerPrice and PricedName (Usage, the Requests ledger,
Sessions) look a model up by, read an effort off an id only when it
named grok- (#224): for any other id it returned before the effort
pattern, so the base model (gemini-4-argon, $2/$10 on models.dev) was
never tried. The reporter's claim is right.

effortBase now reads the effort off any id, with no regexp (every model
of every provider's list is priced on each Providers poll): -minimal,
-low, -medium, -high, -xhigh, and Antigravity's -extra-high and
-extra-low. The id's own name is still tried first, so a catalog id
that names an effort keeps its own price (o3-mini-high, nano-gpt's
gemini-3.1-pro-preview-high). Not read: -max and -none (gpt-5.1-codex-max,
qwen3.8-max are models at prices of their own), a fast id
(grok-4.7-low-fast), and a base with no digit in its last part
(mistral-medium, vision-medium, claw-high), so a size word is not taken
for an effort. Checked against every model id in the bundled
models.dev catalog: the ids that end in an effort word with a digit in
the base are the same model at an effort (o3-mini-high/low,
gemini-3.1-pro-preview-high/low, gpt-5.3-codex-xhigh). The Grok window
pattern still runs only on ids naming grok-.

Tests: TestEffortIDPricedAsItsModel (new) prices the reporter's three
ids, each other effort word, upper case and a google/ prefix through
MakerPrice, an Antigravity ListPrice and another provider's ListPrice,
keeps o3-mini-high's own price, and leaves gpt-5.1-codex-max,
-none, vision-medium, mistral/vision-high, -high-fast and -ultra
unpriced. TestGrokEffortListPrice: gpt-6-astra-high, unpriced before
because only Grok's ids were read, is now priced as gpt-6-astra, and
cursor-grok-4.7-high as grok-4.7 (the catalog already prices
cursor-grok-4.7 as grok-4.7, renamed).

Run (on mote, mote-run):
- old models.go with the new tests: TestEffortIDPricedAsItsModel FAIL,
  e.g. MakerPrice("gemini-4-carbon-high") = {Input:0 ...}, false; want
  gemini-4-carbon's {Input:2 Output:10 CacheRead:0.1}; same for
  claude-opus-5-5-high and the Antigravity ListPrice.
- new code: go test -tags nogui ./internal/provider/ ./internal/sessions/
  ./internal/catalog/ ok.
- with this Mac's real models.dev cache (~/.cache/magpie/models.json
  copied into a scratch test, not committed): Antigravity's
  ListPrice/EffectivePrice of gemini-4-argon-high and
  gemini-4-carbon-high $2/$10/$0.1, claude-opus-5-5-high
  $4/$20/$0.2/$5; gpt-5.1-codex-max and mistral-medium unpriced;
  PricedName(o3-mini-high) o3-mini.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
  GOOS=windows go build: ok.
- the full go test -tags nogui ./... was not run before this push
  (shipped at once); it is run on mote after it.
Not tried: the reporter's own usage log, or the GUI's Usage page.
2026-11-13 21:44:24 +08:00
yetone 9a82192375 agents: Pi's row picks the protocol magpie's models are asked on (xiaomanweiman on X)
magpie writes Pi's ~/.pi/agent/models.json with api "openai-completions".
xiaomanweiman found that T3 Code's pi plugin then puts all 71 tools in the
context, while on "openai-responses" only 3 core tools load and the rest
come lazily. v0.1.4039 kept an api set by hand; this adds a choice so no
one has to edit the file.

Pi's opened row in Agents has a Protocol row, picked in the app's menu
(no native select): Each model's own (today's default, unchanged),
OpenAI Chat Completions, OpenAI Responses, Anthropic Messages. These are
the KnownApi names in pi-ai 1.4.0 (/opt/homebrew/bin/pi) that magpie's
gateway serves (dshAPIs). The choice is stashed as pi.protocol and written
into the magpie provider block (piProviderOn/piModelOn). Anthropic
Messages also gives each model the gateway root as its baseUrl, since
Anthropic's SDK adds /v1 itself. Effort levels and prompt caching follow
the api actually written. An api typed in models.json by hand still wins
(piAPIsKept) and shows as the picked value. The CLI has
`magpie pi protocol <api|default>`. It is Pi only: not its forks (OmO,
Prime Agent, ...) or Aside. It is hidden while the pi-magpie extension
serves the models, and it reads nothing at a stopped WSL distro (#3896).

Tests:
- internal/agent/pi_protocol_test.go: TestPiProtocolPicked.
- internal/gui/tests/pi-protocol.test.cjs: Chromium and WebKit, en, zh,
  zh-TW, ja, de. It checks the row, the menu (4 items, no select, the
  current one ticked) and what /api/set gets.
- Strings in i18n.js in every language.

Broken by hand: with the protocol not written, TestPiProtocolPicked goes
red. With the menu label left untranslated, pi-protocol.test.cjs goes
16 of 20 red.

Real use: a nogui build ran in a sandbox HOME on 127.0.0.1:3562, against
a fake OpenAI Chat upstream, with the real pi 1.4.0 `-p "say pong"` and a
logging tap:
- completions: POST /v1/chat/completions
- responses: POST /v1/responses
- anthropic-messages: POST /v1/messages?beta=true
- default: /v1/chat/completions
Each answered PONG-FROM-FAKE. An api typed by hand (openai-responses)
survived `magpie sync`, and `magpie pi protocol` showed it.

Run at this head (rebased on origin/main 459d668b3):
- mote: gofmt -l clean; go vet of internal/agent, internal/gui and
  internal/cli ok; go test -count=1 of those three packages ok (an
  earlier run there found TestWSLColdPlaceOpensNothing and
  TestCoreScriptBudget red, both fixed here; the budget is met by
  trimming this change's code, not by raising it).
- mote at the pre-rebase tree: GOOS=linux go vet -tags nogui ./..., a
  windows vet, and go build, all ok.
- mica: pi-protocol.test.cjs 20/20, and the 65 agent-*, pi-*, i18n-* and
  connect-* GUI files. Their only reds are 55 in agent-details-ready,
  agent-switch-accounts and agent-menu-label. The same 55 fail on
  origin/main 459d668b3 alone, and are filed as #6373, #6369, #5925,
  #6029 and #6371.

Not run: the full `go test ./...` and the whole GUI suite. Both machines'
suite locks were queued behind other sessions' suites for hours. Not
tried: Pi forks, or a real vendor upstream behind each protocol (the
upstream was a fake).
2026-11-13 21:41:05 +08:00
yetone f798b4eb7a sessions: keeping a file's calls trims the revision windows only when it holds one
keepCalls and keepCallContinuation trimmed every kept window after each
keep, under callsMu: a sort of the candidates and a map, twice a file.
A request-index build reads ~11.5k session files through four workers,
and the files it reads are disk shards that hold no window (weight 0),
so each trim changed nothing while the workers queued on callsMu for it.
A block and mutex profile of a real-account rebuild showed ~55k
contentions on callsMu (about 5 a file), ~3.5 s of lock handoffs and
~4.3 s in pthread_cond_signal.

Now keepCalls trims only after keeping a file with a window, and
keepCallContinuation only after it adds an entry (its early returns add
none). Every window added is still trimmed at once, so the budgets hold
as before; a window aging out waits for the next keep that adds one.

Run: go test ./internal/sessions ./internal/usage ./internal/gui (ok, on
mica), go vet, GOOS=linux and GOOS=windows go vet ./internal/sessions,
gofmt -l. Real account on mote (75G sandbox HOME, network blocked): a
request-index rebuild forced by a new Anthropic price each run, CPU of
the process 30 s after start, alternating: v0.1.4052 21.25 / 17.68 /
15.95 s, this change 14.81 / 14.14 / 13.43 s (mean 18.3 -> 14.1 s).
Not tried: a test that counts trims; the change is a cost, and every
kept window is still trimmed by the same code.
2026-11-13 21:34:15 +08:00
yetone 58ea9cade8 daemon: a launch agent written as Background is mended to Standard (#2961)
The commit before writes ProcessType Standard for new installs. Every
agent already installed kept Background until the user ran `magpie
daemon install` again, which no one is told to do. Now `magpie serve`
rewrites that one line of the installed launch agent as it starts
(daemon.Mend), leaving the rest of the user's install as it is, and
says so in the log. launchd reads the file when it loads the agent, not on
a kickstart: so it is taken up at the next login, or at `magpie daemon
restart`, which now takes the agent out and loads it again instead of
`kickstart -k` (and `start` does the same when it mends the file).

This is the same class as #6261: the gateway's process held to
background priority by macOS while agents wait on it.

Run:
- TestLaunchdOldAgentMended: an installed agent rewritten to the old
  Background line is mended byte for byte to what Install writes, 0600,
  with no launchctl call from Mend; Restart boots it out before loading
  it; on Linux nothing is touched. TestLaunchdInstall's restart now
  expects bootout, then load. Broken by hand (mended never mends):
  red at "Mend: the plist is" and "want a bootout first".
- TestLaunchdInstall (plutil -lint on darwin), the whole daemon package,
  vet on darwin, linux, windows: ok; and the package run named in 6261's commit: all ok (gateway 908s, plugin 159s, cli 52s) at base 7eecbcc56; at the pushed head (rebased on 459d668b3, which touches none of these files) build, gofmt, linux and windows vet, and awake, daemon, cli tests ok again

- Real launchd on mote (macOS 27.2), a throwaway agent of its own label
  running /bin/sleep: as Background, launchctl print says "spawn type =
  background (5)" and ps pri 4, the band #6261's app was napped into.
  The file rewritten to Standard and `kickstart -k`: still background
  (5), pri 4. bootout + bootstrap: "spawn type = daemon (3)", pri 20.
  So a kickstart doesn't take the mended file up, and restart's reload
  does.

Not tried: a real `magpie daemon install` on mote (it would take the
gateway's port from the other sessions there).
2026-11-13 21:31:01 +08:00
Edward4226 873a5caa2f daemon: the macOS gateway runs as Standard, not Background (#2961)
Generate ProcessType Standard for the gateway launch agent so launchd does not apply Background throttling on an interactive request path. KeepAlive, throttling interval, logs, environment, and lifecycle behavior are unchanged. Verified with gofmt, git diff --check, TestLaunchdPlistProcessType, and TestLaunchdInstall. Not tried: a real macOS launchd reload, plutil on macOS, and a current-main performance A/B.
2026-11-13 21:31:01 +08:00
yetone bda69db0ee awake: the gateway's process keeps macOS from App Napping it (#6261)
ChasLui (#6261, and on X): with the screen locked, every request after a
quiet while got the 30s pre-routing 504 from the menu-bar app (160 in one
night). The app serves the gateway in its own process, and a locked
screen leaves it a background app, which macOS App Naps: priority band 4,
timers throttled, so parsing the 6MB catalog took ~800ms instead of 50ms
and requests queued behind it past unroutedUnknown. Keep-awake
(caffeinate) holds sleep off, not App Nap.

ListenAndServe now holds an NSProcessInfo activity for as long as it
serves (awake.NoNap): NSActivityUserInitiatedAllowingIdleSystemSleep,
Apple's App Nap opt-out without the idle-sleep hold. Held for the whole
life of the gateway, not only while a request is in flight: the request
that suffered is the first one after an idle stretch, which arrives at
an already napped process. NSActivityLatencyCritical is left out: it is
timer precision for audio/video, at an energy cost, and App Nap's
throttling is what the reporter measured. Sleep is still Keep's alone,
only while the user turned keep-awake on.

The command-line magpie is built without cgo and runs from a terminal or
launchd, where App Nap doesn't reach it; there NoNap does nothing.

Run:
- Real App Nap on mote (macOS 27.2): two copies of a throwaway AppKit
  .app (regular policy, launched hidden with open -j -g), one holding
  NoNap. Without it: runningboardd "Set AppNap state: active:Y
  priority:Y timer:Tier5" and ps pri=4 (42 of 42 samples once napped).
  With it: "active:N socket:N priority:N timer:Tier0" and pri=20, never
  4. pmset -g assertions listed nothing for either pid.
- TestNoNapLetsTheMacSleep (darwin+cgo): holds NoNap, reads pmset -g
  assertions, fails on a Prevent* assertion of its own pid. Broken by
  hand with NSActivityUserInitiated: red ("PreventUserIdleSystemSleep
  named: magpie serves the gateway ..."); green with the shipped option.
- go vet (darwin), GOOS=linux and GOOS=windows go vet -tags nogui of
  awake, daemon, cli, gateway; CGO_ENABLED=0 nogui build; gofmt -l.
- go test -count=1 -timeout 45m . ./internal/{awake,daemon,cli,gateway,
  proc,update,masking,plugin} on mote: all ok (gateway 908s, plugin 159s, cli 52s) at base 7eecbcc56; at the pushed head (rebased on 459d668b3, which touches none of these files) build, gofmt, linux and windows vet, and awake, daemon, cli tests ok again

Not tried: the real magpie.app with a real screen lock. mote and mica
were running other sessions' AppKit and simulator tests, which a lock
would break; the hidden-app case above is the same App Nap path
(runningboardd's AppNap state), reached without the lock. The full
suite: both machines' suite.lock queues were hours deep.
2026-11-13 21:31:01 +08:00
yetone 459d668b35 sync: pick what syncs, preview a sync, undo the last one (#6428)
jinpwng (#6428, on X) syncs two computers and wants only Library and
memory to go between them: each keeps its own providers, settings and
models. They also want to see what a sync would change before it
applies, and to roll the last one back.

What syncs: providers, settings and profiles now have switches like
agents' models, library and memory (Config.Providers/Settings/Profiles,
*bool, nil = synced as before, so an existing setup syncs exactly what
it did). The sync form shows Providers (and its API keys), Settings and
Agents' models up front; Profiles, usage and sign-ins sit under
Advanced, closed unless one is set away from its default. The form
sends a part's choice only when it is or was off. A part left out
stays as it is here and on the server; turning it back on joins it
like a first sync (st.Off, rejoin). The sync's line says which parts
each computer keeps ("Stays as it is on each computer: ..."). The
setup text and the CLI carry it: magpie <webdav|s3|github> set
providers=no settings=no profiles=no.

Preview: davsync.Preview (plan.go) says, per part, what syncing now
would bring in, send up, or leave; library items and memory files by
name, sign-ins and plugins gone. Preview... in Settings > Sync shows it,
and Sync now from there runs SyncPreviewed(token): if the server or
this computer changed since, it says so and shows the new plan instead
of syncing something else. CLI: magpie <kind> preview.

Undo: a sync that brings parts in records them (st.Applied) and keeps
a sealed copy of this computer first (keepSealed, as Restore does).
Undo the last sync puts those parts back from that copy, on this
computer only (st.Local, so the next sync sends it up rather than
fetching the server's again). If one of them changed here since, it
asks first (409 changed, Undo anyway). CLI: magpie <kind> undo-sync
[anyway]. Restore's own Undo is unchanged.

docs/subsystems/sync-backup.md and the site's sync docs (en, zh, ja)
have a section on it. i18n: zh, zh-TW, ja, de.

Run (worktree at base 48e394146):
- go test -count=1 . ./internal/davsync ./internal/cli: ok (mote).
  Broken by hand, each went red: syncs() forced true (scope tests),
  rejoin's again forced false, UndoSync without the st.Local update.
- go test -count=1 ./internal/gui: TestCoreScriptBudget was over by
  85 bytes; the sync-left line moved into syncfiles.js, now ok.
- go vet ./internal/gui, GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok. gofmt -l: nothing.
- node --check app.js, syncfiles.js, sync-scope.test.cjs: ok.
- GUI (mica), every test file that opens Settings > Sync or calls
  davsync (22 files) plus i18n-keys, Chromium and WebKit, 1100 and
  420px, en/zh/zh-TW/ja/de: 453 of 454 pass. The red is s3-sync webkit
  en "picking S3 must not scroll the page" (0 !== 98), the same on
  origin/main 52c9880cb (#3413, #2448). An earlier run also had
  library-new-skill chromium en 420 red, the same on main (#6539).
  sync-scope.test.cjs is new: on the old code there is no Providers
  switch, Preview or Undo, so it fails at once.
- Rebased on origin/main 7eecbcc56 (app.js and i18n.js changed there):
  TestCoreScriptBudget, go test . ./internal/davsync, node --check, and
  i18n-keys, sync-scope, webdav-settings-refresh (both engines): ok.
- The full go test ./... was started through mote's suite lock when
  this was pushed; its result goes on #6428.

Not tried: a real WebDAV, S3 or GitHub server (the tests use fakes);
the real app on Linux WebKitGTK. "Save and sync" from the form, after a
preview, syncs without the preview's token check.
2026-11-13 21:09:44 +08:00
yetone 7eecbcc56b routing: a wider window never shows a request on more lines, nor cut off
normalcoder_ on X (v0.1.4053): on the Routing page a request still
answering had its numbers (60 B, ≈ tokens, ago) drawn past the list's
edge, cut off, and widening the window moved Accounts and keys beside the
requests, where each request took two lines it had on one in a narrower
window.

- The hidden probes that size the list's columns now carry a request in
  flight's numbers, measured as "59 min ago" (the widest it says in the
  hour): measured without them, their column had no room; measured as
  "3 s ago", they wrapped once it said "13 s ago" and stayed two lines.
- The accounts go beside only where the page is 1150px or wider and the
  requests, tried beside before the frame is drawn, still keep their
  numbers on one line (sideFit). By width alone, a page kept to 1200px
  left the requests ~850px.

Metrics are never hidden by width: they wrap or go under the model, so
the same ones show at every width; the Metrics menu still picks them.

New routing-rows-widths.test.cjs: a request in flight alone, and with six
finished, on the desktop and the browser page, by request and by session,
from 2000px down to 520px and back: no cell past the list, the same
metrics narrowed and widened, none gone and no row taller on a wider
page. Chromium and WebKit, en and zh.

Broken by hand: byWidth's min1150 put back, red at a page of 1096 -> 1156px
(31 -> 50px); the probe's live numbers measured as they are, red at 768 ->
796px (31 -> 50px). On the original code the live row's numbers were past
the list's edge.
2026-11-13 20:45:46 +08:00