Commit Graph
8544 Commits
Author SHA1 Message Date
yetone c9e8422fa8 agent: a field label with no TUI Chinese fails internal/agent's tests
A new agent field's label with no entry in internal/tui's zh map left
TestEveryWordHasZh red on main twice (e9fcc6229 on 11-15 for
"permission mode", 618bfc1a9 on 11-17 for "subagent pool"), each by a
change that ran internal/agent but not internal/tui.
TestEveryFieldLabelHasTUIZh reads tui's i18n.go and keepAsIs (tui
imports agent) and fails in the package such a change runs. LESSONS and
the code standards' criterion 3 name it.

Run: on mote, go test ./internal/agent: ok (250s). The new test on
Linux (wsl-run) and Windows (win-run): ok. gofmt -l: clean.
Broken by hand: with "subagent pool" taken out of i18n.go, red ("kimi's
field \"subagent_pool\" (label \"subagent pool\") has no Chinese").
2026-11-17 15:09:29 +08:00
yetone 6fbc24a05c tui: "subagent pool" has its Chinese
618bfc1a9 gave Kimi Code a "subagent pool" field, and the TUI shows
every agent field's label through zh, so internal/tui's
TestEveryWordHasZh was red at 618bfc1a9 ("no zh for \"subagent
pool\""). It reads 子代理模型池, beside 子代理模型 and 子代理推理强度.

Run (mote): go test -tags nogui -timeout 45m ./... at 618bfc1a9 was
red on it (and on TestCancelledSignInEndsItsFetch, #5264, untouched);
go test ./internal/tui with this: ok.
2026-11-17 15:09:29 +08:00
yetone 3b4983710a gateway: a usage cap holds with sessions in parallel (yalifesign on X)
yalifesign runs 4 or 5 sessions on one ChatGPT Plus account with a 90%
cap and capStop/capCareful off, and the five-hour window went to 100%
and Codex's own 429. Caps from 99 down to 90 all overshot.

Cause: a Codex reply reports usage (codex.rate_limits, x-codex-*) as
its turn begins, without that turn's own spend. The near-cap gate
(435f04151) took one turn at a time only once a reading was inside the
5-point band. It neither counted nor waited for the turns already out
on the account, and after waiting it read usage again only when the
reading hadn't changed, which a pre-turn reading always changed. Five
sessions start turns on readings outside the band that lag every turn
in flight, and they pile up past the cap.

Fix, in serve's walk and cap_near.go:
- turnSpends learns what one turn spends per account (the rise in used
  over the turns returned since it last moved, at most 2x the band) and
  Server.nearCapOf judges "near" on the reading plus that spend for
  every turn out or returned since the reading.
- Near the cap, after taking the near slot, a turn waits until no other
  turn is out on the account (lanes.out, lanes.idle; a lane slot handed
  to this request is its own and not waited for). With other
  candidates it moves behind them first, as before.
- nearCapAgain reads usage again (bounded by carefulWait) when a turn on
  the account came back after the last good read (lanes.ended vs
  UsageRead), and still when it waited and the reading is unchanged.
The gate is generic over the account, so Claude accounts and plugin
accounts get the same hold. capStop and capCareful are read as before;
nothing changes a value the user set. A key's usage cap has no
near-cap gate at all, before and after this: #6928.

Tests:
- TestCapHoldsUnderParallelSessions: a fake Codex that reports usage
  before each turn and adds 1.5 points after it, 5 sessions x 40 turns
  from 60% to a 90% cap. Fails above cap + one turn (91.5%).
- TestNearCapReadsAgainAfterATurnCameBack, TestNearCapWaitsForTurnsAlreadyOut,
  TestTurnSpendsAhead, TestLaneIdleLeavesItsOwnSlot.
- TestNearCapWaitsThenHolds now has the usage read after the first turn.

Run:
- origin/main adfa196db with the two gateway tests (-count=10, mote):
  TestCapHoldsUnderParallelSessions red 9 of 10 (91.5 to 97.5%),
  TestNearCapReadsAgainAfterATurnCameBack red 10 of 10.
- With the fix: the parallel test 20 of 20 at 90.0%, earlier 39 of 40
  at 90.0% and 1 at 91.5%; near-cap, lanes, key slot and careful tests
  -count=3 ok.
- Broken by hand: no spend estimate, 8 of 20 red (93.0, 94.5%); no
  re-read after a returned turn, ReadsAgainAfterATurnCameBack red 10 of
  10; no wait for turns out, WaitsForTurnsAlreadyOut red on every run.
- go test ./... -timeout 45m on mote at 884bcadb6 (base ff88ec264): 103
  ok, no FAIL. Rebased on 618bfc1a9 (kimi, agent and gui only), then
  internal/gateway, internal/agent and internal/gui again: gateway, agent and gui ok at bb23d1b69.
- gofmt -l clean; GOOS=windows go vet ./... ok; go vet ./... on Linux
  (wsl-run, magpie-desktop): ./internal/gateway/... and ./internal/provider/... ok; the whole tree stops on
  gtk4/webkitgtk-6.0 missing in that distro. GOOS=linux vet from macOS
  stops in Wails' cgo files, as on main.
- No GUI change, so no GUI suite.

Not tried: a real Codex account at its cap with parallel sessions (the
fake reproduces the reported shape, not OpenAI's exact accounting); the
spend estimate on a window that renews mid-run beyond the unit test;
key caps (#6928).
2026-11-17 14:54:11 +08:00
yetone 618bfc1a95 kimi: pick Kimi Code's subagent pool and its effort (XiaoLing_Arisa on X)
XiaoLing_Arisa asked on X for Kimi Code's subagent pool (子代理池) on the
Agents page: which models its subagents may run on, and how hard they
think. Kimi Code 2.x keeps them in config.toml's [secondary_model]:
default_model (the legacy `model` stands for it), the pool
[secondary_model.models] ("alias" = "when to use it") and default_effort.

- internal/agent/kimi_secondary.go: three fields, subagent_model,
  subagent_pool and subagent_effort, written the way Kimi Code takes
  them. Its validator refuses a pool that lacks the default, a name with
  no [models."…"] table, and an effort a pool model can't take, so a
  default goes into the pool, a pool without the default gets its first,
  and only the levels every pool model takes are offered
  (kimiPoolLevels). A magpie model goes in only while [providers.magpie]
  is there. Keys are set in place; hints, other keys and comments stay.
  Before Sync or Unwire drops a magpie model table, its name leaves the
  section (kimiPruneSecondary). The default goes back to the user's own
  (stashed at kimi:<path>:secondary) or to the pool's first, and an empty
  section goes. The user's own pool of their own models is never touched.
  kimi-cli (legacy) has no such section. A stopped WSL distro shows none
  of the three, since each reads the config (#3896).
- GUI: the three fields form one Subagents line in the opened row: the
  model, then the effort (disabled until a model is set), then a
  multi-pick pool menu that stays open between ticks. The model's tick
  can't be removed. The picker's note says an unset model runs each
  subagent on the lead's model. The line is drawn by kimisub.js, which
  Details imports before its first slide so the sheet measures it.
- Size budgets +457 (reason in core_budget_test.go). Translations in
  zh, zh-TW, ja and de. kimisub.js is added to old-webkit's list of
  scripts loaded on demand. The Kimi bullet in agent-wiring.md is
  updated.

Run at this tree on mica (mica-run):
- go test -tags nogui -count=1 ./internal/agent ./internal/gui: ok,
  including TestKimiSubagentPool*, TestWSLColdPlaceOpensNothing and
  TestCoreScriptBudget. An earlier run of these packages found the cold
  read and the budget overrun; both are fixed here.
- go vet ./... on darwin, GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./...: ok. go build: ok. gofmt -l .: empty.
- GUI: kimi-subagent-pool passes 20 of 20 (Chromium and WebKit, 5
  languages, 1100 and 560px). kimi-thinking passes. agent-details-ready,
  old-webkit and i18n-keys have 35 reds, and origin/main ff88ec264 has
  the same 35, all filed: #6373, #6369 (agent-details-ready), #6030,
  #5919 (old-webkit), #6877 (i18n-keys).
- Broken by hand: with Details not waiting for kimisub.js,
  kimi-subagent-pool goes 10 of 10 red in Chromium ("the Subagents line
  is there when Details first draws").
- Real Kimi Code 2.6.2 (npm) in a sandbox HOME with a fake SSE server:
  the pool and effort written here are read and used. A pool naming a
  model with no table is refused when a subagent starts. A bad effort is
  not refused at runtime, but magpie refuses it anyway, as the validator
  does.

Not run or tried:
- The full go test ./... and the full GUI suite: mica and mote were both
  past their load limits with other sessions' suites. Only the packages
  and GUI files above were run.
- A real Moonshot account. The subagent's "timed out" in the sandbox run
  came from the fake server.
2026-11-17 14:30:55 +08:00
yetone ff88ec264a sync: subscriptions whose sign-ins stay on this computer (Ethereal499 on X)
Sync's sign-ins can now leave chosen subscriptions out on one computer
(`signInsExcept`, provider ids; Ethereal499 on X keeps Claude's accounts
off other computers). On that computer:

- its accounts of those subscriptions never go up;
- the server's accounts of them are never merged in, so a removal or a
  new account on another computer changes nothing here;
- the server keeps them as they are for the computers that do sync them
  (syncOnce splits the remote set with SignIns.Except and puts the held
  part back with With after the merge, so the hash doesn't change);
- the preview and Restore count and restore none of them.

An id names both the built-in and its -plugin id. An old config has no
field and syncs everything as before. The setup text doesn't carry the
choice, since it belongs to one computer.

GUI: Settings > Sync > edit > Advanced, under "Sign-ins", a "Not synced"
row with a multi-select openProtoMenu of the subscriptions with an
account. The row shows only while the sign-ins tick is on. The strings
already existed in en, zh, zh-TW, ja and de. CLI: `sign-ins-except=`
on the WebDAV, S3 and GitHub setups ("none" clears it), and status
shows the excluded ids. docs/subsystems/sync-backup.md says it.

Tests:
- TestSignInsExcept (provider) and TestSyncSignInsExcept (davsync, two
  computers on a fake DAV).
- sync-signins-except.test.cjs: both engines, 1100 and 420px, all 5
  languages.

Broken by hand, each red and then restored:
- the Except in collect;
- the Except on the remote set before the merge;
- the Except in the preview;
- the With after the merge;
- the GUI form's post of signInsExcept.

Run:
- At ac4a4cf84 on mote: `go test -timeout 45m ./...`, 102 packages ok,
  exit 0.
- At ac4a4cf84, the whole GUI suite on mote. The first part ran at
  concurrency 6 under load 25 to 37, and mote rebooted mid-run (not
  this session's doing). The 410 files it never reached ran at
  concurrency 4. Reds fell in 125 files, none of them a sync-* file
  except s3-sync (see below).
- At the rebased head b781d0bcb on mote:
  - go test ./internal/davsync ./internal/provider ./internal/cli
    ./internal/gui: ok.
  - Every sync-*.test.cjs, webdav-settings-refresh and
    sync-signins-except: ok.
- gofmt -l: clean.
- On mica: go vet ./..., GOOS=linux go vet -tags nogui ./... and
  GOOS=windows go vet ./... ok, plus go build, GOOS=linux go build
  -tags nogui and GOOS=windows go build.

Red the same on origin/main 873b1f7d5, run there alone:
- s3-sync webkit en ("picking S3 must not scroll the page"), #3413 and
  #2448.
- i18n-keys (", with an image" in plugins/routing), #6877.

Not run: the full Go suite at the rebased head. Another session's full
suite held mote, and mica was full. The 125 GUI files red under load
were not each run alone on main.

Not tried: a real sync between two computers with real accounts.
2026-11-17 14:08:48 +08:00
yetone 873b1f7d5e classify: 15 seconds unset for a classifier that reasons, and its cut call is magpie's wait (ESern29751 on X)
ESern29751 on X (v0.1.4341): in a routing group with intent recognition,
magpie often 499-cancels the intent classifier's request, with MiniMax,
GPT-6 Luna and Grok 4.6 as the classifier.

Cause: those models reason before they answer. The classifier asks for
reasoning_effort none, but MiniMax thinks anyway and Grok 4.6 and Luna go
no lower than low. Through the live gateway with the classify prompt over
a real routing prompt (~5k tokens of context): grok-4.6 took 4.7-8.1s
(288-462 reasoning tokens), minimax-m2.5 3.7-10.3s (439-1012 output
tokens), gpt-6-luna 1.2-7.2s; cold calls reached 12-29s. The unset
classifier timeout was 8 seconds, so most turns were cut off, fell back to
the group's order and lost their intent routing. Each cut call was then
logged 499 "the agent canceled the request", which usage counts as no
failure, though no agent had canceled anything: askChat's own
context.WithTimeout had no cause, the mislabel #2318 fixed for an image's
description but never for the classifier.

Fix:
- settings.ClassifyTimeoutDefault 8 -> 15 (an existing Settings segment).
  A user who saved 8 keeps 8; only the unset value moves. The GUI's
  fallback segment follows (app.js), and the docs (en/zh/ja intent and
  start, gateway-routing.md) say 15.
- askChat's wait is context.WithTimeoutCause(..., sideTimedOut{"decision
  model", wait}): the usage row says "magpie stopped waiting: its
  decision model had no answer in Ns", a failure.
- Siblings checked: the advisor and Codex titles use the client's
  context, compaction and vision already carry sideTimedOut; askJev
  (decision providers) logs no 499 row of its own.
- Tests that assumed the 8-second unset wait now use 15 (classify,
  decide, decide_group, nested_classify_wait, settings).
- app.js grows by the one byte of the fallback's second digit: both
  core budgets +1 with the reason (TestCoreScriptBudget was red at
  exactly 1 over without it). A shorter `|| 15` would show a hand-edited
  negative value as its own segment, so it wasn't taken.
- site: llms-full.txt and the search indexes regenerated for the docs
  pages (node llms-full.mjs, node search-index.mjs).

Test: TestReasoningClassifierAnswersInTheWaitUnset - a classifier
answering in 10 units routes the turn with the timeout unset, and one
slower than 60 units gives no answer with one 499 usage row that says
magpie stopped waiting for its decision model and counts as a failure.

Broken by hand (mica-run): with askChat back on a plain WithTimeout the
test is red ("the classifier's cut call: 499 "the agent canceled the
request""); with the default back at 8 it is red ("gave no answer in
400ms").

Run at 0479372b8, this commit's tree (mica, through ~/suite.lock; mote was over its cores):
- gofmt -l: clean. go vet (darwin), GOOS=linux go vet -tags nogui,
  GOOS=windows go vet: rc 0 (darwin vet rc 0 at the first try on mote).
- go test -tags nogui -count=1 -timeout 45m ./...: rc 0, 103 ok.
  (The first run, on mote before the budget raise and the rebase onto
  adfa196db, was red on TestCoreScriptBudget alone.)
- node --test site/*.test.mjs: 132 of 132.
- GUI (node --test, Chromium and WebKit, five languages, 1100 and 420):
  classify-timeout-setting, settings-places, i18n-en-no-cjk green;
  i18n-keys red only on "a plugin's words are its own" over
  claude_image_budget_test.go's ", with an image", already #6877 from
  2896e82cc, untouched here.

Not tried: the real reporter's group in the GUI with these models after
the change (the timings above were measured through the live gateway
before it); the whole GUI suite (only a fallback value changed in app.js).
2026-11-17 13:31:08 +08:00
yetone adfa196db0 lessons: a docs page change regenerates the site's indexes (seen a fifth time)
00b2c11a6 added a docs row and left llms-full.txt and the search
indexes stale, the fifth time since 11-13 (459d668b3, 256910f17,
9dcec6751, dbbb2f26b). The rule moves into the code standards'
criterion 3. Docs only; nothing run.
2026-11-17 12:58:54 +08:00
yetone f7e0c27636 site: search indexes and llms-full.txt carry 00b2c11a6's Open Code Review row
00b2c11a6 added Open Code Review to the agents docs and ran neither
generator, so site's search.test.mjs (each committed index is current)
and worker.test.mjs (llms-full.txt is current) went red in cli
(linux/amd64) at 2f25728dd (run 44012087296).

Run at origin/main 255ccdd7c on mote: node llms-full.mjs and node
search-index.mjs in site/; then node --test search.test.mjs
worker.test.mjs from the full tree: 46 of 46 ok.
2026-11-17 12:58:45 +08:00
yetone 255ccdd7ca omp: a Protocol row picks the API magpie's models are asked on (imty42 on X)
omp's models.yml had magpie's provider on openai-completions with no way
to change it: ompKept treated the provider's api as magpie's, so an api
typed there was written back on the next sync, and omp's row had no
protocol as Pi's has. An auto/* group whose members don't all take
Responses (provider.GroupAPI) could only be asked on Chat.

- omp's row gets the Protocol row Pi has (protocolField, now shared with
  Pi's piProtocolField): each model's own (unpicked, as before),
  openai-completions, openai-responses or anthropic-messages. omp takes
  each for the provider and a model (KnownApi in pi-catalog types.ts and
  the api enum of models-config-schema-bundle.ts, omp 18.9.1). The pick
  is kept per place and agent folder, so each profile has its own.
  `magpie omp protocol openai-responses` sets it from the CLI.
- ompOn puts the provider and every chat model on the pick: Chat and
  Responses with no api of their own and thinking mode effort; Messages
  at the gateway's root with budget, or anthropic-adaptive for a Claude
  that thinks only adaptively. Image models stay on openai-images.
- The provider's api typed into models.yml by hand now stays and shows
  as picked (ompAPIKept, the same api:<path>:wanted record as Pi's); a
  pick made after it replaces it.

Unchanged: unpicked, Responses-native models and groups whose members
all take Responses already went on openai-responses per model.

Run at this head (3d0cadfce, the same tree; only this message differs),
on mote:
- gofmt -l internal/agent: nothing. go vet ./..., GOOS=linux go vet
  -tags nogui ./..., GOOS=windows go vet ./...: rc 0. go build, linux
  nogui and windows builds: rc 0.
- go test -tags nogui -count=1 -timeout 45m ./... in a sandbox HOME
  under suite.lock: rc 0, 103 packages ok, no FAIL.
- Broken by hand: without ompAPIKept, TestOmpProtocolPicked is red
  ("an api typed by hand: file openai-completions, field \"\"").
- Real omp 18.9.1 in a sandbox HOME against a stand-in server: with the
  provider on openai-responses a group model posted to /v1/responses;
  a model on anthropic-messages at the root posted to /v1/messages.

Not tried: the GUI suite (no GUI file changed; the Protocol row is the
generic one Pi's uses, shown for any agent with a protocol field), and
omp against the real gateway with a real auto group.
Not changed: a model's api typed by hand in omp's models.yml is still
magpie's (the model list is magpie's whole); site docs for omp.
2026-11-17 12:46:56 +08:00
yetone ad585ccd6c claude: settings.json holding a setup-token is readable by its owner alone
2f25728dd switches Claude Code to a setup-token account by writing the
token into CLAUDE_CODE_OAUTH_TOKEN in ~/.claude/settings.json. Claude
Code writes that file 0644 and edit.SetJSON keeps a file's mode, so a
long-lived subscription token sat where every other account on the
computer could read it (Linux homes are often 0755), unlike the sign-in
Claude Code keeps in .credentials.json (0600) or the keychain.

Before the token goes in, the file (a symlink's target) loses its group
and other bits; one that isn't there yet is made 0600 first, so the
token is never in a file others can read.

Run at this head:
- mote: go vet ./internal/provider for darwin, windows, linux: ok.
- mote: go test ./internal/provider -count=1: ok (143.7s).
- magpie-desktop (Linux): the setup-token tests: ok.
- Broken by hand: without claudeSettingsPrivate,
  TestClaudeSetupTokenSettingsPrivate is red in both cases ("644,
  readable by others").

Not tried: a real Claude Code reading a 0600 settings.json (it reads it
as the same user).
Not changed: settings.json is still a file people keep in dotfiles repos,
and Claude Code passes its env on to the tools it runs; both come with
putting the token in its env at all.
2026-11-17 12:17:10 +08:00
yetone 90d7ea9331 agent: a new agent named nowhere in the Library fails internal/agent's tests
TestEveryAgentInLibrary (internal/library) went red on main for a new
agent four times: 399010bef and 68cb92e8e (11-10), 7e8214d60 (11-12),
and effdd1beb today after 00b2c11a6 (Open Code Review). A change that
adds an agent runs internal/agent, and the guard is in another package,
so each was found after the push.

TestEveryAgentNamedForTheLibrary reads internal/library's targets.go and
every_agent_test.go (library imports agent, so it reads the files) and
fails when an agent on this machine's list is in neither a targetOf case
nor noLibrary. The library test still checks a target has something in
it. Same shape as internal/gui's TestEveryRouteIsNamedForTheCLI.

LESSONS.md: the route/setting guard lesson now covers agents, seen a
third day. code-standards criterion 3 names both twins.

Run (mote, at effdd1beb + this change):
- go test -count=1 -timeout 45m ./internal/agent ./internal/library: ok
- broken by hand (open-code-review's noLibrary line removed): red,
  "open-code-review (Open Code Review) isn't named in internal/library";
  restored
- win-run and wsl-run, -run TestEveryAgentNamedForTheLibrary: ok
- gofmt -l: clean
Not run: the full ./... suite (test-only change in one package).
2026-11-17 11:47:18 +08:00
yetone 2f25728ddf claude: Use switches Claude Code itself to a setup-token account (liukaybee on X)
liukaybee adds Claude accounts with `claude setup-token` and wants magpie
to switch only which one Claude Code itself uses, without connecting it
to magpie. Such an account has no sign-in to put in Claude Code's
keychain or .credentials.json, so Use was refused ("magpie only").

Claude Code takes CLAUDE_CODE_OAUTH_TOKEN from the env of its user
settings.json ahead of its stored sign-in. Use on a setup-token account
now writes the token there (claude_token_env.go). Claude Code's stored
sign-in stays as it is and stays Active; the token account is listed
with Uses. A switch to a signed-in account, Use on the signed-in row,
or removing the token's account takes the token out again.

- A value the user set is theirs: magpie keeps only the sha256 of what
  it wrote (claude-token-env.json), never writes over another value and
  never removes one whose hash differs, even if it once wrote it.
- An unreadable settings.json is "unknown": nothing is written, the
  record is kept, and the switch fails without moving the sign-in.
- NextLogin (Switch accounts only) leaves Claude Code on a token in use,
  as its allowance can't be read.
- magpie's own runs pass --setting-sources "" and are unaffected.
- GUI: the token row's Use and In use; the signed-in row says Signed in
  with a Use back. Every new string in zh, zh-TW, ja and de.
- app.js +864 bytes over its budget, raised with the reason in
  core_budget_test.go: one swUse helper shared by both buttons, packed;
  renderAccounts draws every account row, so no page to move it to.

Real use: real Claude Code 2.1.316 in a sandbox HOME/CLAUDE_CONFIG_DIR
(never the live ~/.claude) with a deliberately broken .credentials.json
access token. The settings.json magpie's switch writes (dumped from a
test) gave a PONG with a real account's token; the file after switching
back gave "401 OAuth access token is invalid", i.e. Claude Code was on
its stored sign-in again. Sandbox homes holding real tokens deleted.

Run (mote/mica, at f00e2059d rebased on 593517bf0, then this head):
- Rebased on effdd1beb (internal/gui and internal/provider untouched
  since, but for this): TestCoreScriptBudget and the provider TestClaude*,
  NextLogin and Forget tests rerun at the pushed head, ok.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./...: ok. gofmt -l: clean.
- go test ./... -timeout 45m on mote: 102 packages ok, internal/gui
  FAIL: TestCoreScriptBudget (fixed above, then green) and
  TestQuitKeepsTheMenuBarIconsPlace, killed at its 30s AppKit bar under
  load; passes alone in 1.1s here and on origin/main 00b2c11a6. Filed
  #6919.
- GUI, both engines, every language, on mica: the 45 account, Claude,
  switch, sign-in and i18n files (1275 tests, 68 red). The same 9 red
  files on origin/main effdd1beb give 67 of the same reds (#5925, #6660,
  #6179, #6424, #6010, #5998, #5814, #6877). The one red only at this
  head, accounts-own-signin webkit zh (access-control on /api/autobackup)
  is #6038 and passes 20/20 alone. claude-setup-token: green in all 10
  engine x language runs.

Broken by hand, each red, then restored: the own-value check
(TestClaudeOwnEnvTokenLeftAlone), clearing on an OAuth switch
(TestClaudeCodeSwitchedToSetupToken, ...UnreadableSettings), clearing
on Use back (Switched, InUseNotMovedOff), clearing on remove
(TestClaudeSetupTokenRemovedLeavesSettings), the NextLogin guard
(InUseNotMovedOff), unreadable settings read as empty
(TestClaudeEnvTokenUnreadableSettings).

Not tried: the whole GUI suite (both machines were running other
sessions' full suites for hours); a magpie GUI build clicking Use
against the real binary (the switch's file was checked instead);
Windows and Linux Claude Code.
2026-11-17 11:42:27 +08:00
yetone effdd1beb9 library: Open Code Review has no Library place, with its reason (00b2c11a6)
00b2c11a6 added the open-code-review agent without a Library target or
a noLibrary reason, so TestEveryAgentInLibrary was red on main. OCR is a
review CLI with its own fixed tools, not a coding agent; whether it reads
skills or MCP was not looked at, so it goes in noLibrary.

Run (mica, at this head): go test ./internal/library: ok. The full suite
at 00b2c11a6 (go test ./... -timeout 45m, mica) had this one red and
every other package ok (102 ok).
2026-11-17 11:32:44 +08:00
yetone 00b2c11a6b agent: Open Code Review (ocr) is an agent magpie sets up (@AlanWang1027713 on X)
Open Code Review (github.com/alibaba/open-code-review, npm
@alibaba-group/open-code-review) is a Go CLI, `ocr`, that reviews a diff
with a model. Its Claude Code, Codex, Cursor, Kimi Code and OpenCode
plugins and its skills all run that command, which reads
~/.opencodereview/config.json on every run.

Picking one of magpie's models on its row writes a custom provider
"magpie" there (protocol openai, the gateway's /v1, a key naming Open
Code Review, the model) and points provider at it. The user's own
provider and model are stashed and come back on Disconnect, which also
drops a custom_providers left empty. A model of the user's own can be
picked too (written the way `ocr config model` writes it). Check reports
a hand-edited url or key, or a removed entry. The `ocr` command counts
only under a folder named for Open Code Review, since other programs
share the name. WSL distros get the row too (cold distros not opened).
Its User-Agent, open-code-review/<version>, already counts as this agent.
CLI update via npm. Docs, READMEs, site and icon (OCR's own logo,
Apache-2.0).

Run (mica, at 593517bf0; origin/main has one unrelated usage commit since):
- go test ./internal/agent -run 'TestOCR|WSL|Wsl|TestOwnProviderNamedAsMagpies|TestHandWiredMagpieProviderSiblings|TestAgentOf|TestEveryAgentNamedByItsKey|TestMarkedLinesEveryAgent': ok
- gofmt -l: clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./...: ok
- Broken by hand: url dropped from Check -> TestOCRWiring red; stash
  turned off -> red at the Disconnect restore. TestWSLColdPlaceOpensNothing
  went red before the row's options were given an asleep path.
- Real e2e in a sandbox HOME: npm-installed ocr v1.13.10 (7e5ce06c)
  darwin/arm64, magpie built from this tree, a fake OpenAI upstream that
  calls tools. `magpie agents` lists the row with the user's
  deepseek/deepseek-chat; `magpie open-code-review magpie/fake/m1` wrote
  the entry and kept the user's keys and settings; `ocr llm test`:
  connection ok, tool-call round trip verified; `ocr review` on a repo
  with a nil dereference: 2 findings "[bug · high]" through magpie
  (8 /v1/chat/completions calls, UA open-code-review/v1.13.10, model m1,
  its six review tools); `magpie usage` counts them under Open Code
  Review; `magpie open-code-review default` put deepseek/deepseek-chat
  back and removed custom_providers.
- Full suite: not run before this push (ship at once; mote was running
  another session's suite). It runs on mica right after, at this head.

Not tried: a real vendor model behind magpie; WSL and Windows/Linux
machines for real; the Claude Code / OpenCode plugin path itself (it runs
the same `ocr`); an ocr installed by the curl script outside a folder
named for it is found by ~/.opencodereview only.
2026-11-17 11:10:43 +08:00
yetone 2071195ff4 usage: a plugin window named by one of its models counts that model (Google AI Studio)
WangYeruo on X: with the Google AI Studio plugin (@dorokuma/magpie-gemini-web's
ai-studio), one model's 429 for its quota held the account from every model
until the reset, while AI Studio limits each model's day on its own and argon
still answered after hydrogen was out.

The 429 itself already rested only the model: AIStudio2API's AllCoolingError
("模型 gemini-4-hydrogen 的可用账户均在冷却…;每日限额: … model:
gemini-4-hydrogen …") names it (TestAIStudioModelDayRestsTheModel, a guard;
it passes on the old code too). What held the account was the usage read
after it: the plugin's accountUsage (lib/studio.mjs, 0.15.3) tells a cooldown
as a window named after the model's id, used 100 until it ends, with no
model or models said. magpie read it as the whole account's window, so
Allowance.Full held every model and Pooled said the account was out.

namedModelWindows (pluginLoginQuota) now scopes a plugin window that says no
models, no family and no pool, and isn't text or aside, to the model whose id
its name is, when the provider serves that id. "所有模型" (a cooldown with no
model_id) and any other name stay the whole account's, as before.

Old data: such a reading has a matches, so keepLast doesn't write it down,
as with models/notModels. A reading kept on disk before this, still within
its cooldown, can hold the account from every model after a restart until
the first read (seconds); one past its reset holds nothing.
The plugin can't be fixed upstream: its repo has issues off, and it needs no
change now.

Run (mica-run, at this commit on origin/main acc358f07):
- go test ./internal/provider -run TestPluginWindowNamedByModelCountsThatModel:
  ok; broken by hand (namedModelWindows returning q unchanged) it is red:
  "hydrogen's cooldown holds argon till 2026-11-18 08:00:00", "a 429 of
  hydrogen rests the account, not the model".
- gofmt -l: clean; GOOS=linux go vet -tags nogui ./...: ok;
  GOOS=windows go vet ./...: ok.
- go test -count=1 -timeout 45m ./...: 103 packages ok, no FAIL.
Rebased onto 593517bf0 (codex/t3code/sessions only): go test -count=1
./internal/provider ./internal/gateway at the pushed head: ok.
Not tried: a real AI Studio account through the plugin (none here). No GUI
file touched.
2026-11-17 11:00:09 +08:00
yetone 593517bf00 codex: T3 Code's threads on magpie stay on magpie (xxxxpouqqs on X)
xxxxpouqqs on X: "t3code 每次重新会话都出现类似于 The 'codex-2/gpt-6.1-sol'
model is not supported when using Codex with a ChatGPT account".

Cause: T3 Code's magpie · Codex instance runs Codex in ~/.codex on
magpie with `-c model_provider="magpie"` alone, so config.toml names no
magpie. At the next Sync, bringBack took every thread on magpie for a
leftover and moved it to the provider config.toml names (openai), in
state_5.sqlite and in the rollout. Codex resumes a thread on the
provider it was started on, so reopening a T3 thread sent magpie's
model id to ChatGPT. codexRetagOpenThreads (the Codex app's app-server
restart) moved locked or loaded ones the same way.

Fix:
- t3CodexRunsIn(home, dir): T3's magpie-codex instance runs Codex in
  this home (no homePath, or one naming it; $T3CODE_HOME honoured; an
  unreadable settings file counts as yes).
- bringBack then moves only threads another client started; a thread
  whose originator is T3's stays on magpie (sessions.CodexThreadsBy
  reads originator and model; a failed read moves nothing).
- codexRetagOpenThreads keeps T3's threads the same way
  (RetagLoadedCodexThreadsBut).

Old threads: a T3-started thread an earlier magpie moved to the
current provider with a magpie model id (one with "/") is moved back to
magpie at the next Sync, for every user; a T3 thread started on OpenAI
with OpenAI's own model stays. Nothing to do but update.

Run (worktree at acc358f07 + this change, on mica; mote was over its
cores):
- go test ./internal/agent/ -run 'TestT3|TestCodexThreads|TestCodexTakeover': ok
- broken by hand (`if false && t3CodexRunsIn(...)` in bringBack):
  TestT3CodexThreadsStayOnMagpie red, T3 threads b1 and b3 on "openai"
  and the rollout moved; restored
- go vet darwin, GOOS=linux, GOOS=windows on agent and sessions: ok
- gofmt -l: clean
- go test ./... -timeout 45m: ok, every package (exit 0, 103 packages ok)
- Real use on mote, sandbox HOME, real T3 Code (t3 serve) + real Codex
  0.169 with a fake upstream: the old magpie moved 5 T3 threads to
  openai and the UI resume hit the ChatGPT endpoint with
  codex-2/gpt-6.1-sol ("not supported when using Codex with a ChatGPT
  account"). With this build the next Sync logged "5 thread(s) T3 Code
  started on magpie moved from openai to magpie", and the same thread's
  resume in T3's UI went to the gateway (gpt-6.1-sol, magpie's key).

Not tried: T3's desktop app (only t3 serve), Windows, a real vendor
upstream, an older Codex whose threads table has no originator column
(CodexThreadsBy fails and nothing moves).
2026-11-17 10:27:26 +08:00
yetone acc358f071 gui tests: codex-async-compact's zh and zh-TW notes say Codex CLI as translated (#6658)
35aaaa4b9 (11-13) translated "Codex CLI" as "Codex 命令行" / "Codex 命令列"
for the Codex client setting. codexHeld in context.js passes the same
word through t(), so the held-share note in zh and zh-TW changed too,
and codex-async-compact's expected strings still had "Codex CLI": 4 of
20 cases red (chromium and webkit, zh and zh-TW) since then. The app is
right; the test now expects the translated word.

Run at this head on mote (macOS 27, Playwright 1.62.0):
node --test internal/gui/tests/codex-async-compact.test.cjs: pass 20,
fail 0. Broken by hand: zh's expectation put back to "Codex CLI",
chromium zh and webkit zh red (18/2), restored.

Not run: the rest of the GUI suite (only this test file changes).
2026-11-17 07:55:10 +08:00
yetone ce16633367 tune: a Codex card locked by config.toml's own compact limit hands it to magpie on a click (sufeng1894 on X)
sufeng1894 asked why Codex's compaction threshold can no longer be set by
hand. The card said config.toml's model_auto_compact_token_limit wins, and
the background row said features.async_compaction's
model_async_compact_threshold_percent wins: both locked, and nothing on
the card did anything about it.

Cause. Only the old tune card (9e665491e to f20118304, 10-10 to 10-28)
wrote model_auto_compact_token_limit, stashing the user's own raw value;
the 10-28 migration puts that raw value back, which then locks the card.
So the values on the screen are the user's, or the user's restored by
that migration. A magpie-written value could have lost its stash through
stash.json races (before 270b52573), an unparsable stash (before
58651568b), tuneMigrateCodex forgetting the stash even when its file
write failed, and codexAsyncSync stashing only after every write. The
last two are fixed here: the migration forgets only after the write
succeeds, and codexAsyncSync records its stash in a defer right after
reading the old state, advancing it per successful write.

Change. A locked card shows one button, "Let magpie set it" (zh 交给
magpie 设置, zh-TW, ja, de), only when the user clicks. POST
/api/tune/takeover (TuneTakeOver):
- the file's limit moves into Long conversations by tuneMigrateCodex's
  rule (a lower Long the user has is kept), the key is deleted from
  config.toml with every other key kept, and the file value is stashed
  (tune.codex.compact_file); Undo puts Long back and writes the key back,
  unless the user changed Long since;
- a background threshold of the user's (enabled = true) is adopted as
  magpie's background share with its own Undo, which turns the share off
  and gives back the percent and enabled as they were. enabled = false
  is not taken.
Nothing removes the user's value without that click.

Run:
- internal/agent, internal/gui, internal/cli, internal/tune at the pushed
  head (rebased on ca87ae9c5) on mica: ok. TestCoreScriptBudget raised
  by 189 (the button, its post and Undo background), reason in the file.
- Full Go suite -timeout 45m on mica at the pre-rebase head (2ba62f7f7
  base): every package ok except TestCoreScriptBudget, since fixed.
- Broken by hand, red: migrate forgetting first (TestTuneCodexMigrateKeepsStash),
  asyncGiveBack disabled (TestTuneCodexTakeOverAsync), longUndo in place
  of codexLongUndo (TestTuneCodexTakeOver), and the GUI button disabled
  (context-tune, 11 red).
- context-tune, compact-one-value, codex-async-compact, i18n-keys at the
  pushed head on mica, Chromium and WebKit, every language, 360 and 1100:
  the new test passes; reds are codex-async-compact's zh/zh-TW "kept the
  share out" (4, the same at ca87ae9c5) and i18n-keys' routing plugin
  word (#6877).
- win-run TestTune|TestCodexAsync in agent and gui: ok. wsl-run vet and
  those tests with -tags nogui: ok. GOOS=windows go vet and GOOS=linux
  go vet -tags nogui: ok. gofmt -l: clean.
- make test-ui on mote, pre-rebase head, through header-centre (about a
  third; the rest still running when pushed): reds in 29 files, none a
  tune file. The first 16 (account-arrange to context-cap) were run
  alone at this head and at origin/main ca87ae9c5 on mica: the same
  reds at both (base has 4 more, in agent-own-direct), the #5475 class.
  The next 13 (ctx-session-line to header-centre) were run the same way at the pushed head: 59 red at head, 60 at ca87ae9c5, the same tests (header-centre's halfway case red in one engine at each).

Not tried: a real Codex session after the takeover; codexAsyncSync's
defer has no test with a failing write.
2026-11-17 06:39:40 +08:00
yetone ca87ae9c59 update: an x64 magpie emulated on Windows on Arm updates to the arm64 build (EV_John_Liu on X)
EV_John_Liu on X: "能不能出个windows on arm的版本啊…看到magpie是转译的".
magpie ships magpie-windows-arm64.exe and magpie-cli-windows-arm64.exe,
and the site's Windows button offers it on Arm, but an x64 install on an
Arm64 computer fetched the x64 build on every update and stayed emulated.
update's arch() swapped only an Intel Mac under Rosetta.

- internal/winarm: Emulated() asks IsWow64Process2 (x/sys/windows) once;
  an amd64 build whose nativeMachine is IMAGE_FILE_MACHINE_ARM64 runs
  emulated. A failed call (no IsWow64Process2 before Windows 10 1709)
  means not emulated. false off Windows.
- update: arch() gives arm64 for windows/amd64 when emulated, so
  BinaryAsset picks magpie-windows-arm64.exe (GUI) and
  magpie-cli-windows-arm64.exe (CLI). The swap is the x64 one: canStart
  starts the downloaded exe (it runs natively there), the running exe is
  moved aside, the arm64 one renamed in under the same name, and
  magpie.com is rewritten from the new app's own launcher.
- pii (sibling found on the way): pf-serve has no windows-arm64 build.
  After the switch an arm64 magpie looked for a windows-arm64 pf-serve,
  found none, and left Privacy Filter / AstrLink Guard "not downloaded"
  while on. target() now maps windows-arm64 to the x64 pf-serve Windows 11
  runs emulated; candidates() runs it on the CPU (the x64
  pf-serve-vulkan has no x64 Vulkan driver there), then pf-serve-base
  for an emulation without AVX2. The guard's status says emulated
  (Status.Emulated), and its row reads "On, slowly under x64 emulation:
  the next update installs magpie for Arm" in all five languages, like
  the Rosetta line. app.js's and the core's script budgets grow by its
  66 bytes.
- gui feedback: the diagnostics block's Arch line says
  "amd64 (emulated on arm64)" / "amd64 (under Rosetta on arm64)".

Checked, not changed:
- site/public/index.html: the Windows main button already turns to
  /download/windows-arm64 when userAgentData's architecture is "arm".
  Run in Playwright Chromium and WebKit with a Windows Edge UA and
  injected userAgentData: arm -> windows-arm64; x86 and no
  userAgentData -> windows-amd64.
- telemetry (stats "arch") sends the build's GOARCH; left so, since what
  is sent and the privacy text stay as they are. After the update it is
  arm64 by itself.
- rtk: an arm64 magpie no longer upgrades a standalone x64 rtk.exe
  (rtkArch == "amd64" only), filed as #6896.
- claudecode (win32-arm64) and Bun (windows-aarch64) downloads already
  have arm64 builds.

Run (worktree at origin/main 17da22414):
- mote: go test -count=1 ./internal/winarm ./internal/update
  ./internal/pii ok; ./internal/gui -run Feedback ok.
- mote: go vet ./... ok; GOOS=linux go vet -tags nogui ./... ok;
  GOOS=windows go vet ./... ok; GOOS=windows GOARCH=arm64 go vet of
  winarm, update, pii, gui ok; darwin, windows and linux builds ok;
  gofmt -l clean.
- mote: node --test privacy-model.test.cjs (Chromium and WebKit, five
  languages, two widths) ok; i18n-keys' "a plugin's words are its own"
  is red at this base on claude_image_budget_test.go's ", with an
  image", already #6877.
- xiaomi-gpu (x64 Windows 11, real IsWow64Process2 saying not
  emulated): win-run go test ./internal/winarm, ./internal/update -run
  'WindowsOnArm|Rosetta|Asset|InstallBinary', ./internal/pii -run
  'ArmWindows|GuardNow|Base', ./internal/gui -run Feedback ok.
- magpie-desktop (WSL2): winarm, update, pii ok; gui -tags nogui -run
  Feedback ok.
- mote: go test -count=1 -tags nogui -timeout 45m ./... : every
  package ok but internal/gui's TestCoreScriptBudget (app.js 66 bytes
  over: the new pmSub line). The budgets are raised by those 66 with
  why (pmSub draws every Privacy row, no lazy page to move it to);
  internal/gui then ok in full.
- mote: gui-de, gui-ja, gui-zh-tw, i18n-en-no-cjk and the three other
  privacy-*.test.cjs, in Chromium and WebKit: 28 of 28 each. Not the
  whole GUI suite: the change is one string in one row, no API,
  selector, CSS or layout.

Broken by hand (each red, then restored):
- arch() without the windows clause: TestWindowsOnArmUpdatesToArm64
  (BinaryAsset magpie-windows-amd64.exe) and
  TestWindowsOnArmInstallsArm64Exe (magpie.exe still "2.0 for x64").
- pii target() without the mapping: TestArmWindowsRunsX64Serve
  (target windows-arm64, Supported false); candidates() without the
  Arm branch: its subtests start pf-serve-vulkan.
- Status without Emulated: TestGuardNowSaysEmulated.
- archNote without the emulated case: TestFeedbackArchSaysTranslated.
- app.js without the emulated line: privacy-model's "AstrLink Guard
  says what runs it" red in every language.

Not tried: real Windows on ARM (no such machine); detection is injected
in the tests, and the real call was only seen saying "not emulated" on
x64 Windows.
2026-11-17 04:29:02 +08:00
yetone 2ba62f7f76 gateway: agy's "Individual quota reached … Resets in" rests the account until then
@Airan_FS on X (11-17): an Antigravity account served through agy-cli
answered "⚠ Individual quota reached. Please upgrade your subscription to
increase your limits. Resets in …" as the model's reply, and routing never
asked the next account.

The agy-cli plugin 0.1.87 (magpie-community/plugins afe4c086, on the dist
branch) now ends such a turn with a rate_limit_error in agy's words, before
or after reply text, so the gateway fails over and rests the account as for
any plugin quota error. Here, quotaResetAfter also reads the notice's
"Resets in 1h18m40s" (Go's duration form, which resetsInWords can't read
since no word ends after its "h"), scoped to the "individual quota reached"
line, so the account rests until Google's reset instead of quotaRest's 15
minutes and isn't asked again every quarter hour. gateway-routing.md says so.

Tests from the literal notice (discuss.ai.google.dev report, the tweet):
TestAgyCLIQuotaNoticeRestsUntilItsResetAndFallsOver (group falls over to
the next member, rest "resets" ~1h18m40s, next turn skips it),
TestAgyCLIQuotaNoticeMidReplyStillRests (partial text kept, still rests),
TestAgyQuotaNoticeResetIsRead.

Run (mica, at f33278541 = this change less the doc line): go test ./...
-timeout 45m: 102 ok, no FAIL. mote: GOOS=windows go vet ./... ok,
GOOS=linux go vet -tags nogui ./... ok; gofmt -l clean.

Broken by hand: the old quotaResetAfter with these tests: the account
rests 14m59s by "quota" and resetsAfter reads 0, so all three fail.

Not tried: a real agy account with its quota used up.
2026-11-17 04:14:34 +08:00
yetone 17da22414d LESSONS: what a started process's reader goes by is set before it starts
#6887 (4c6c3a453) and the Claude bridge's run tools (43d9aae09), both reds
only under CI load, both reproduced by an injected 50ms sleep.
2026-11-17 03:13:20 +08:00
yetone 43d9aae09f claude bridge: a run's tools are set before its Claude Code starts
TestClaudeBridgeHandsOverAnUnloadedMagpieTool was red on ubuntu CI at
4c6c3a453 (run 43919594403): call-search was handed
"magpie-web-search__web_search", want
"mcp__magpie__magpie-web-search__web_search".

The bridge set run.tools (and magpie's search and answer tool names)
after start returned, while Claude Code was already running and
readOutput was reading its stdout. On a loaded runner the first
tool_use was read with tools still nil, so 1490045f5's hand-over of an
unloaded deferred tool (which needs r.tools set) didn't apply and the
name went out cut. The same window let magpie's own web search call go
to the client unanswered.

The request now carries runTold, which startRun calls before launch;
the caller still calls it after start for a resumed run.

Reproduced: a 50ms sleep before the old assignment, red 3 of 3 with
CI's exact message; with the fix and the same sleep after start, green
3 of 3. Unchanged code, -count=30: green (the race needs load).

Run at this head (mica, base dbbb2f26b): go test ./internal/gateway
-timeout 45m ok (897s); GOOS=linux and GOOS=windows go vet
./internal/gateway ok; gofmt -l clean. Full suite at dbbb2f26b
(the base, without this change): 102 packages ok.
Not tried: a real Claude subscription run.
2026-11-17 03:13:10 +08:00
yetone ead91a9a50 gui: a browser tab's title names this magpie: MAGPIE_NAME or Settings › Network and sharing › Advanced › Name (starballl on X)
starballl on X (tweet 2122376116220633444) runs several magpie web pages
and every tab is titled "magpie", so they can't be told apart. A magpie
now has a name, and a browser tab's title is "<name> · magpie" (plain
"magpie" with none).

- settings.Name, set in Settings › Network and sharing › Advanced › Name
  (instancename.js, imported when Settings is drawn, so nothing is added
  to app.js's core). Advanced is closed until a name is set.
- MAGPIE_NAME (Docker, magpie web) names it while the field is empty and
  is the field's placeholder. It is read, never written, so a name typed
  in Settings always wins and clearing the field goes back to it.
- One line, at most 60 characters (settings.CleanName).
- This computer's own (KeepOwn): sync and a restored backup never bring
  another magpie's name. A Settings save that leaves `name` out keeps it
  (settingsapi.Merge).
- boot.js titles a browser tab itself for the first paint, so app.js's
  core gains only the line in applyPrefs, which sets the title again from
  every settings read (TestCoreScriptBudget was 74 bytes over with a
  title function in app.js). Only a browser page (web) is retitled: the
  app's windows and tray keep "magpie".
- Docker docs (en, zh, ja) list MAGPIE_NAME; docs/reference.md and
  docs/subsystems/gui-shell.md say how it works.

Tests:
- TestInstanceName (internal/gui): the variable alone names it at boot;
  a saved name wins over it, trimmed; a save without `name` keeps it;
  KeepOwn keeps it; cleared goes back to the variable; no name, none at
  boot. Broken by hand, each red: KeepOwn without Name ("KeepOwn took
  \"other\""), Merge without the keep ("a save without the name changed
  it to \"\""), boot.js with s.Name in place of InstanceName ("named by
  the variable alone: boot <nil>"), boot.js not setting the title ("a
  browser tab's boot.js sets no title"). The app window's boot.js sets
  none.
- TestSettingsSaveKeepsWhatItDoesNotSend now sets Name: the page's other
  saves leave it out, and it is kept.
- instance-name.test.cjs: title from the first paint, the field under a
  closed Advanced, save and clear retitle the tab, Advanced open after a
  reload, 360px, the app's window keeps "magpie"; en, zh, zh-TW, ja, de,
  Chromium and WebKit, 16/16. 14 of 16 red with applyPrefs not setting
  the title.

Run, at this commit on dbbb2f26b plus 9d5d8baf2 (the site index):
- go test ./... -count=1 -timeout 45m on Linux (WSL magpie-desktop, Go
  1.26.8), at the tree before the boot.js move: 99 packages ok,
  internal/gateway included (959s); ., internal/cli and internal/gui
  don't build there without GTK headers. On mica (macOS): . and
  internal/cli ok; internal/gui/... ok at this commit, after the two
  reds that run found (the core budget, the keep test) were fixed.
- go vet and GOOS=linux -tags nogui / GOOS=windows go vet of
  internal/gui and internal/settings, earlier the whole tree on all
  three: ok. gofmt -l clean.
- site: node --test *.test.mjs, 132/132.
- GUI: the 135 files the change reaches (settings, network, LAN, i18n,
  old-webkit, core budget) on mica: 16 files had reds. Run again on this
  tree and on its base, the same tests are red on both (allow-ips
  #4357, settings-hints #6107/#6353, lan-join #6353, i18n-keys #6877,
  old-webkit #6030/#5919 and the rest of the 16) but two:
  search-mcp-library (WebKit, #4756) and gateway-pause (WebKit de 420px,
  #6684), red only beside other files: alone, 0 of 10 and 0 of 3 red on
  both trees.
2026-11-17 03:11:31 +08:00
yetone 9d5d8baf21 site: search indexes and llms-full.txt carry dbbb2f26b's free: line
dbbb2f26b (#5903) added the free: line to docs/routing-groups and left
the committed indexes behind, so site's search.test.mjs (each committed
index is current) and worker.test.mjs (llms-full.txt is current) were
red at origin/main dbbb2f26b.

Run: node llms-full.mjs and node search-index.mjs in site/. On mica,
node --test search.test.mjs worker.test.mjs: 2 of 46 red at dbbb2f26b,
46 of 46 with this change.
2026-11-17 02:43:02 +08:00
yetone dbbb2f26b1 groups: free: takes the models a catalog marks free (#5903)
A routing group's pattern may now start with free: (provider.FreePrefix):
free:workbuddy/* is, of the models workbuddy/* matches, those whose
catalog entry says free (Entry.Free, the vendor's or plugin's own flag as
the catalog was last read). The rest after free: is a glob, a re: pattern
or an id, matched as on its own, so free:re:workbuddy/hy.* works too. It
is expanded where every pattern is (matchesIn, PatternHits) each time the
groups are read, from the catalog magpie already keeps: no request to a
vendor, and a model the next list marks free joins without a save.

Only the flag decides. A $0 price (PricedFree), a rate of 0, an account
named Free or "free" in an id never counts; the test holds a
deepseek-v4-free id with no flag, a rate-0 model and an or/y priced at $0
out. Existing patterns read as before: openrouter/*:free still means ids
ending in :free (that is why the rule is a prefix, not a :free suffix),
and a provider's AutoInclude takes no free: (isIDPattern).

GUI: the Routing editor's pattern box counts and lists a free: rule live
as it does any pattern (patternTest in plugins/routing/client.js, from
groups.models' free), refuses "free:" alone, and one hint line says the
flag is the last catalog's, not a promise of no charge, in en, zh, zh-TW,
ja and de. CLI help, docs/subsystems/providers-accounts.md and the site's
routing-groups page (en, zh, ja) say the same.

routing-levels.test.cjs: the Advanced hint line made the editor taller,
so the second group's Levels row opened under the editor's sticky foot
and the click landed on the foot (webkit en). The test already wheels to
that row for its first group; it now does for the second too.

Run:
- TestGroupFreeRule, TestFreeRuleSyntax and the existing pattern tests
  pass. Broken by hand: with groupmatch.go and autolist.go from
  origin/main both are red (no members for free:workbuddy/*, IsPattern);
  with takes() ignoring the flag, TestGroupFreeRule is red (all six
  WorkBuddy models matched).
- group-free-rule.test.cjs (new): chromium and webkit, en and zh,
  green; red with origin/main's client.js.
- go vet ./... (darwin, mica), GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: clean. gofmt -l: nothing.
- Full suite go test -tags nogui -timeout 45m ./... on Linux (WSL
  magpie-desktop) at 1e180c630 (this change on ac4a4cf84): 102 ok, no
  FAIL. Not run whole on macOS: mote had another session's GUI suite
  and mica's disk was full (2 GB free; a run there failed on "no space
  left on device").
- At the pushed head 6801ae683 on Linux: internal/provider, cli,
  plugin, agent, gui packages; group-free-rule, group-patterns,
  routing-levels, gui-zh-tw, gui-ja, gui-de: all ok, 21 tests pass.
- GUI: the 182 files that reach the Routing page or i18n, on Linux at
  d55680755's tree: 2805 pass, 112 fail in 21 files. The same 21 run on
  origin/main cb4ad12bd: 102 fail in 18 of them. The three red only
  here (input-look, search-keys, routing-levels) were rerun at
  concurrency 2: input-look and search-keys green, routing-levels red
  from this change and fixed above (green 2 of 2). Reds on main, filed:
  group-editor-selected #5049, i18n-keys #6877, codex-memories-settings
  #6372, inner-scroll-contain #4689, grip-inset #6293, and the rest in
  #4120's class; form-align newly filed as #6894.

Not tried: a real WorkBuddy account's catalog (the flags come from the
plugin's list, as the test's fixture has them); the GUI files on macOS.
2026-11-17 02:19:48 +08:00
yetone 8a017b5837 agent: a connect-only plugin whose connect returns only merged objects is connected (plugins#1230)
A connect-only agent plugin is refused with "connect returned no keys to
write" when connect returns nothing. The check counted connect's result
after merged() had taken the plugin's merge keys out of it, so a plugin
whose only keys are objects it lists under `merge` was refused although
those objects' members are exactly what gets written. Lorca's plugin
(plugins#1230) hit it once it dropped its one plain key, changed_at,
which it dropped because unwire left `{"changed_at": {}}` in the user's
credentials.json. Now the merged members count as keys to write.

Run (mote):
- go test -count=1 ./internal/agent ./internal/agentplug: ok.
- go vet ./internal/agent, with GOOS=windows and GOOS=linux: ok. gofmt -l:
  clean.
- A scratch test (not committed) loading plugins#1230's lorca.agent.js at
  883ea48: connect and unwire with no credentials.json leave "{}"; with
  {"anthropic":"k"} and with a file that has custom:gemini and a
  changed_at map, unwire gives the file back as it was.

Broken by hand: origin/main's plugged.go with the new
TestPluggedConnectOnlyMergedOnly: "connect returned no keys to write".

Not tried: the real Lorca app reading the file.
2026-11-17 02:13:18 +08:00
yetone cb4ad12bd1 zcode: the mover's min is 0.1.68, whose every account takes requests (mathfournity on X)
mathfournity on X: several ZCode accounts in magpie, and requests went to
two of them only. The plugin (0.1.40 to 0.1.67) declared maxAccounts 2,
so keepAtOnce held every account past the first two in reserve until one
rested. magpie's own handling of a plugin's accounts was right: on a
throwaway gateway test with the real plugin under bun and four accounts
on a fake Z.ai, 0.1.67 sent 12 requests at once 6/6 to two accounts and
none to the others, and 1302, 1308, 3008 and 500 on one account each
went to the next and rested the first.

plugins 36dc4007 (zcode 0.1.68) declares no maxAccounts and holds what
zcode.z.ai's firewall refuses an address for instead: six Start Plan
requests in flight from this computer over all accounts, besides each
account's three. On the same throwaway test, 0.1.68 sent the burst
3/3/3/3 over the four accounts, failover unchanged. Raising the min
updates moved users (keepMovedCurrent). gateway-routing.md's Accounts at
once row says the plugin no longer declares two.

npm: registry.npmjs.org has 0.1.68 as latest (npm view --prefer-online
--registry https://registry.npmjs.org). The plugins publish run is red
only for middleware-system-prompt and middleware-think-tags (trusted
publisher); its log shows "+ @magpie-community/opencode-zcode-auth@0.1.68".

Run:
- go test ./... -count=1 -timeout 45m on mica at 1c59acd36 plus this
  change: every package ok (102), exit 0.
- Rebased onto 4c6c3a453 (claudetui only): go test ./internal/provider
  ./internal/claudetui ./internal/plugin on mica: ok.
- Plugin: bun test in packages/zcode (HOME=$(mktemp -d), wsl-run):
  275 pass; the new tests red against 0.1.67's code (3 fail).

Not tried: a real ZCode account.
2026-11-17 01:48:56 +08:00
yetone 4c6c3a453e claudetui: a reply is held from its message's row on, not from when send sees it (#6887)
TestShimCutMessageIsUnpastable (new in efb62fe90) was red on ubuntu and
macOS CI at a24a5f6af, 6cc7402bd and ac4a4cf84: a cut message's reply
got out, and its Unpastable error came after it.

The transcript's reader counts a message's row (sawRow) and goes
straight on to the reply's row and emits it. send only began holding
output (checkWhole's hold) once it woke and saw the count, so a reader
that got there first let the reply out before the message was checked
whole. On a busy Windows 10 machine the model got the cut tail and the
user got its answer, which is what the check is for.

sawRow now begins the hold itself while a message is being checked
(said isn't nil), on the reader's own goroutine, before any later row
is read. hold keeps a buffer sawRow began, and send lets out what is
held if it fails after a row was counted but before its check.

Run (mica; mote's load was 37 of 18 cores):
- the old code with time.Sleep(50ms) between send seeing the count and
  checkWhole: TestShimCutMessageIsUnpastable -count=3, red 3 of 3, the
  same output as CI's ("a cut message ended [init, assistant echo: er
  words … K-TAIL]").
- this change, the same 50ms injected: -count=5 ok; 500ms: -count=3 ok.
- injection removed: go test -race ./internal/claudetui -count=2 ok
  (380s).
- Windows (xiaomi-gpu, win-run): go test ./internal/claudetui: only
  TestShimFirstMessageWaitsForTools red, 3 of 3 the same at origin/main
  1c59acd36 (#4810, open).
Not run: the full suite, and a real Windows 10 console.
2026-11-17 01:33:13 +08:00
yetone 1c59acd36d plugin: a fetch whose head never comes is given up on; Devin min 0.1.45 (wu_chong4136 on X)
wu_chong4136 on X: with the Devin plugin a session sometimes hung for
10 to 20 minutes with no reply, until the effort or the context was
changed. The Devin plugin returns its fetch's head only once Devin sends
the reply's first content, and the host's headRead waited for that head
with no bound, while the gateway kept the agent alive on keepalives. A
request Devin took and never answered therefore hung silently. The body
already had bodyIdleWait (30m between bytes, #4934); the head had none.

- host.go headRead: the same bodyIdleWait bounds the wait for the head.
  On it the fetch ends with "the plugin sent no reply in 30m0s; that
  fetch was given up on", Fetch settles the call, and the host writes
  "abort", so the plugin's fetch signal ends its vendor request too. The
  gateway answers the agent its retryable 502 (an SSE error event on a
  stream). This holds for every plugin fetch, not only Devin's.
- ReplyWaitForTest lets the gateway test shorten the wait.
- Devin mover min 0.1.45 (on npm, `npm view --prefer-online`): the
  plugin itself gives up after 5 minutes of quiet from Devin (no head,
  or no frame between reads) with a retryable 504. A real probe saw
  Devin's first frame at 2.5s and at most 13s between frames.
  (magpie-community/plugins e30f8ed0)
- provider-plugins.md says so.

Tests:
- TestHostHeadWaitEndsAFetchNeverAnswered: a head that never comes ends
  in "sent no reply", the host is sent "abort", and the call is
  released; TestHostHeadWaitSparesAHeadInTime: a head in time is kept.
- TestPluginHeadNeverSentEndsInAnError (gateway, through the fake
  plugin in Bun): a vendor that reads the request and never answers
  gives the agent the error on a stream and on a whole reply, and every
  vendor request the plugin made is closed afterwards (asked 30, open 0).

Run:
- mote: the three tests above, ok.
- Broken by hand (headRead without the timer case): the host test fails
  ("held its reader for ever") and the gateway test hangs to its 60s
  timeout in io.ReadAll.
- mica: gofmt -l clean; go vet for darwin, GOOS=linux and GOOS=windows
  on internal/plugin, internal/gateway, internal/provider: ok.
- mica: go test -tags nogui -timeout 45m ./... at this tree (rebased on
  ac4a4cf84): 101 packages ok; internal/gateway FAIL on
  TestImageMCPKeepsDrawingsOffTheHeap alone ("the heap grew by 31 MB"),
  which passes 3 of 3 alone at the same tree and reads the whole
  process heap; filed as #6890.

Not tried: a real Devin request that goes quiet (it can't be made to
happen on demand).
2026-11-17 00:39:50 +08:00
yetone ac4a4cf849 sessions: opening Sessions waits on no WSL listing it already has (shangyuan0818 on X)
shangyuan0818 (X, third round, after v0.1.4091 and v0.1.4255): on Windows,
Usage -> Sessions opened only after a fixed ~20s when sessions were long.
The long sessions were not the cause. Goroutine dumps of the reporter's
case on the Windows box showed four waits on WSL on the page's first asks:

- agent.Looks -> Clients -> All -> wslDistros: a blocking wslRefresh,
  `wsl -l -q` (10s timeout) once its list is a minute old, then
  `wsl -l --running -q` (10s) every time. A WSL that answers slowly but
  answers is never marked hung, so each open after a minute idle waited
  for both: about 18s, every time. ClientsIn drops WSL's agents anyway,
  so Clients now reads only this machine's (local()).
- gui agentsHere (the web-mode own-sessions gate) called agent.All the
  same way. It now calls agent.AllKnown: this machine's agents and WSL's
  as last listed (wslDistrosWithin(0)), never waiting on wsl.exe.
- sessions.wslFilesAs waited wslFirstWait (3s) afresh on each read while
  the first listing was pending, so list, stats and overview each waited
  3s in turn. The 3s is now counted once, from when the first listing
  started.
- provider.copilotCLILogin waited copilotWSLWait (2s) on every re-read
  of a distro's Copilot sign-in, every copilotWSLAge (20s), though it
  had an answer. A re-read now answers the last read at once; only the
  first read waits.

Timed on Windows 11 (xiaomi-gpu), sandbox HOME with a 90 MB Claude JSONL
and a 32 MB Codex rollout, a fake wsl.exe whose -l -q answers "Ubuntu"
after 8s and whose --running hangs; /api/sessions list+stats+overview
together, opened 20s after start, then 70s apart:

  b0674b9ec (old):  0.39s, 18.11s, 18.12s
  this commit:      0.38s,  0.07s,  0.07s

With wsl.exe hanging outright and Sessions opened right after start:
old 10.3-10.5s, new 3s (the designed first wait, now waited once). With
no WSL: 0.4s on both.

Tests, each red on the old code by hand:
- TestClientsAskNoWSL (agent): with Clients back on All(), red (waited
  past 5s on the hung wsl.exe); with AllKnown on wslDistros(), red.
- TestWSLFirstWaitIsWaitedOnce (sessions): four reads with the first
  listing hung; with the wait counted per read, red at 2.007s.
- TestCopilotWSLHangHoldsNoRequest (provider): a re-read on a hung WSL
  with copilotWSLWait 10s must answer within 2s; with the kept answer
  disabled, red at 2.002s.

Run at this tree:
- mote: go test -timeout 45m ./... at dac5095c3 (base b0674b9ec): exit 0, 102 packages ok, no FAIL. Rebased onto
  2ec8e6ad0 after it, which changes README files only.
- mica: go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... ok; gofmt -l clean.
- WSL (magpie-desktop): internal/agent, sessions, provider ok.
- Windows: internal/agent, sessions, provider, gui: 66 reds, 64 of them
  red at origin/main 2ec8e6ad0 too (#6068, #1827, #4115, #2808, #4446,
  #5957, #5343, #5344). The other two, TestHermesProfilesAreNotListedAsAgents
  and TestHermesProfilesFollowMagpieModel, call onMachine, not the code
  changed here, pass alone 3 of 3 on this tree, and follow other Hermes
  tests red at main in the package run (#1841: Windows tests share
  APPDATA).

Not tried: a real WSL distro that is slow (the fake wsl.exe stands in
for it), and the reporter's own machine.
2026-11-17 00:21:23 +08:00
yetone 2ec8e6ad0c readme: 零词元's README seat ended 11-16 and is taken down
零词元 (zerotoken) held a README logo from 10-16 to 11-16. A renewal
reminder went out on 11-13 and no renewal came, so the owner's OK of
11-15 applies: the logo leaves both READMEs, as e28d3affa did for
APINEBULA. /go/zerotoken stays in site/sponsors.js so old links still
resolve.

Run: README-only change; grep shows no zerotoken left in either
README and the rest of line 20 is unchanged.
2026-11-17 00:02:50 +08:00
yetone b0674b9ec4 providers: a key's balance shows on its row, as Usage last read it
lyj1115 on X: magpie found the relay's balance (the probe), but the
Providers row showed only the API key; the figure was on Usage alone.

The row's quiet facts line (host · models) now ends in " · $10472.14",
in the line's own colour and size, with "Balance $…" as its tooltip.
Several keys' balances are added up as the Usage card's head adds them
(shared balances counted once), else the key in use's. A failed read, a
signed-in account (its windows are on Usage) and Usage turned off show
none. Opening Providers asks for Usage's own read (never ?asked=1, so
"read only when asked" holds) when it is over a minute old, as Routing
does (#1833); rows are marked after the list is drawn and after a read.

rowBalance, markBalances and keysSum/keysSumTip live in
plugins/usage/page.js (keysSum moved out of app.js) so app.js stays
under its code budget without a raise; app.js calls markBalances?.().
No new words, no CSS.

Run (mote, at this tree rebased on origin/main 6cc7402bd):
- provider-row-balance.test.cjs: 24/24 green, chromium and webkit,
  en zh zh-TW ja de at 900 and 420px, and Usage off.
- Broken by hand: against origin/main's assets (MAGPIE_ASSETS) it is
  22 of 24 red (no .pv-bal); only the Usage-off cases pass.
- go test ./internal/gui -run 'TestCoreScriptBudget|I18n|Words|Asset|Budget': ok.
- i18n-keys, i18n-en-no-cjk and 12 provider-*.test.cjs files: 329 pass,
  1 red: i18n-keys "a plugin's words are its own" (routing's ", with an
  image"), red the same on origin/main 6cc7402bd, filed as #6877.
- A 218-file GUI batch (provider, routing, balance, usage-keys,
  usage-shared-balance, i18n) was still running on mote at push time;
  new reds against origin/main get issues when it ends.
Not tried: the real app with a real relay's probed balance.
2026-11-16 23:11:36 +08:00
yetone 6cc7402bd3 gateway: agy-cli's verification refusal rests the account as verify, with its link
A contract test for plugins' agy-cli 0.1.81 (83a67717), which turns agy's
bare "Verification Required" ending (kidgpt on X, 11-16) into a 403
permission_error in the words provider.Verification reads. The test posts
that exact message, with a link and without, and checks the client gets
it once (no advice added again), the try fails as failVerify and the
account rests as "verify" with the link when there is one. Test only: the
plugin's update reaches users through the hourly plugin update.

Run (mote): go test ./internal/gateway -run 'TestAgyCLIVerifyWords|TestVerify'
ok; go vet ./internal/gateway clean; gofmt clean. Broken by hand: the
plugin's wording changed to "this account needs verifying" goes red
(the advice is added a second time).
2026-11-16 23:05:48 +08:00
yetone 50a38371df plugin: a page with its own service module is a page on the GitHub list (plugins#1226)
xiaopeng66/magpie-model-lab is a page plugin whose page talks to a
local service it ships as its main (magpie.page.service). readTagged
called any package with a main or exports a provider, so the GitHub
list showed it under Providers. Dropping the !runs check alone would
make every provider that ships a settings page (atomcode's
diagnostics page, for one) a page, so the rule is narrower: a package
with magpie.page.file and a module of its own is a page when its
keywords say "magpie-page", as every page with a main in the plugins
repository does (agent-console, amp-usage, chat, fingerprint,
free-tokens, page-model-quota, page-usage-board, page-usage-tree,
window-warmup). No provider or middleware there says it. The file
looked for in the repository is still its main. Kind only decides the
card's chip and filter; what an install loads is unchanged.

The fixture is model-lab's package.json as it is, without its 900KB
icon; a provider with a page and no keyword stays a provider.

Run (mote):
- go test -count=1 ./internal/plugin: ok (157.9s).
- go vet ./internal/plugin: ok. gofmt -l: clean.

Broken by hand: the old !runs rule with the new test: "a page with a
main: kind """, red.

Not tried: installing model-lab from the GitHub list in the real app.
2026-11-16 22:23:54 +08:00
yetone a24a5f6af4 gui: a model test its vendor queued shows queued, not green (sufeng1894 on X)
sufeng1894 (v0.1.4248) added Qoder China and QwenWork providers (both
served by the Qoder plugin): their models were green in the provider's
Test, and every request through Routing failed with 503.

A Qoder/QwenWork plan queues a model (code 10605, e.g. "this plan's
queue: p4"). The test sends x-magpie-fallback, the plugin answers the
queue's 503 at once, and probe counts it OK with Result.Queued
(d3aecfe95). The GUI drew that as a green dot and "answered", while
routing gives way from a queued member at once (503 busy) and the last
member's wait ends in the queue's 503 (4 minutes unstreamed; a frozen
queue after 5 minutes with qoder 0.2.71, v0.1.4321). So Test said the
opposite of what Routing does.

Now a queued result is its own state: an amber dot, its title
"Queued at its vendor, not answered: <queue>", and Test models' and
Test this model's status say the same and are not "ok". Working only
still keeps a queued model, as the test's OK says (a queue clears).
renderEndpoints is not a sibling: it is drawn only when no address is
plugin://, and only plugins report queued.

core_budget_test.go: +135 for it, the reason in the comment; one
string (queuedSaid) shared by all three places.

Run (mica-run/mote-run, at origin/main 8608ce024):
- models-queued.test.cjs (chromium, webkit): 4/4 ok; with the old
  app.js 4/4 red ("a queued model's dot isn't green", and the single
  test's status timed out waiting for the queued dot).
- go test -run Budget ./internal/gui: ok.
- every models-*, model-*, provider*, i18n-* and test-* GUI file:
  2430 tests, 2323 ok, 107 red (mote). The same 107 in the same 11
  files are red at untouched origin/main 8608ce024 (146 run, 107 red),
  all filed: i18n-keys (#6877), models-works-only (#4391),
  model-chip-steady (#4388), model-copy-id (#4621), model-api-preset
  (#5838), provider-max-output and provider-many-keys (#6209),
  provider-fetch-again, provider-models-rest, provider-picks-stay and
  provider-typed (#6532). A first run on mica died of ENOSPC (its disk
  is full) and tested nothing.
- Rebased onto 07f7e0b45 (nothing under internal/gui changed since
  8608ce024): the budget test and models-queued + model-test-one
  (8/8) ran again there, ok.

Not tried: a real Qoder China or QwenWork account; the reporter's 503
body, so which queue (or another cause) their 503s carry is not
confirmed.
2026-11-16 22:03:48 +08:00
yetone 07f7e0b45d claudetui: Windows 10 gets Microsoft's ConPTY with the release, no folder to place (#5205)
a49f3745e used a conpty folder beside magpie.exe holding conpty.dll and
OpenConsole.exe, which a user had to fetch and place. Windows 10's own
ConPTY drops a paste's bracketed-paste marks and loses 1024-byte blocks,
so without that folder long messages reached Claude Code cut.

Now a Windows release carries the pair. internal/conptypair pins
Microsoft.Windows.Console.ConPTY 1.25.260930003 from nuget.org (MIT): the
package's SHA-512 as nuget.org publishes it (catalog packageHash) and
each file's SHA-256. `make conpty-pair` (go run ./build/conpty, before
release-cli and release-windows) downloads it, checks both, and writes
the pair to internal/conptypair/<arch>/ (gitignored), which -tags
conptypair embeds: about 1.2 MB per Windows binary. At run time, on a
build below 22000 with no conpty folder of the user's, the pair is
written to %LocalAppData%\magpie\conpty\<version>\<arch> (temp file and
rename), each file checked against its pin there before conpty.dll is
loaded; a file that doesn't match is written again. The order is the
user's conpty folder, then the bundled pair on Windows 10, then the
system's; any failure leaves the system's, where the whole-message check
(previous commit) catches a cut message. Windows 11 keeps its own.
1.25.260930003 is the version 3leg0ocat ran whole on Windows 10 19044;
CoreyKatzburg ran 1.25.261109001 on 19045 (under two weeks old).

Run:
- The package hash: the download's SHA-512 matches nuget.org's
  packageHash; the four files' SHA-256 are taken from it.
- Authenticode on xiaomi-gpu (Get-AuthenticodeSignature): all four files
  Valid, CN=Microsoft Corporation.
- go run ./build/conpty on mote: fetched and written; a second run keeps
  them with no download; a package with the wrong hash is refused.
  GOOS=windows go build -tags nogui,packedassets,conptypair for amd64
  and arm64: built, 1.2 MB over the build without the tag.
- win-run (Windows 11 26200) go test -tags conptypair ./internal/conptypair:
  ok; TestBundledOpens writes the pair from the embedded bytes and
  CreatePseudoConsole through its conpty.dll returns S_OK.
- go test ./internal/conptypair ./internal/claudetui on mote: ok.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./... on mote: ok.
- Full suite on mote (-timeout 45m) was still running at push, per the
  ship-at-once rule; a red it shows gets fixed or filed.

Not tried: Windows 10 itself (no Windows 10 box here; xiaomi-gpu is
Windows 11, whose own ConPTY doesn't have the bug, so the build gate
sends it to the system's), and a real Claude Code turn through the
bundled pair; the user folder route that loads the same way was
confirmed on Windows 10 by CoreyKatzburg (19045) and 3leg0ocat (19044).
2026-11-16 21:51:26 +08:00
3leg0ocat efb62fe901 claudetui: a message Claude Code didn't get whole is asked again as claude -p (#5205)
The helper took a message as sent once a row of it reached the
transcript (rows > before), whatever the row held. A console that loses
part of a paste, as Windows 10's own ConPTY does (#5205), gave Claude
Code the rest, and the model answered that as the message.

Now the words the transcript records of it (a user row's text, or a
queued message's) are compared with those pasted, white space, paste
tags, image marks and format characters aside, read in place with no
copy (whole.go). The paths of images Claude Code says it took
([Image: source: <path>] meta rows) are left out and the images counted.
What Claude Code answers meanwhile is held for up to 2s. A message that
isn't whole ends the turn as Unpastable before any of its reply, so the
bridge asks it again as claude -p, as it does an image the interactive
mode didn't take.

This is 3leg0ocat's patch (github.com/3leg0ocat/magpie-lite, branch
claudetui-whole-message, b800c0cb3b), applied as written, with
TestShimCutMessageIsUnpastable added: the fake Claude Code gets a
FAKE_CUT knob that keeps only a long paste's tail past its 1024-byte
blocks, as Windows 10's conhost lost them.

Run:
- go test ./internal/claudetui ./internal/conptypair on mote (macOS):
  ok. TestShimCutMessageIsUnpastable broken by hand (send returning nil
  in place of checkWhole): red, the cut tail answered as "echo: ...".
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
  vet ./... on mote: ok (with the next commit).
- win-run go test ./internal/claudetui on xiaomi-gpu (Windows 11 26200,
  whose own ConPTY keeps the marks): every test ok but
  TestShimFirstMessageWaitsForTools, red on Windows at main (#4810).
3leg0ocat's own record: Windows 10 19044, Claude Code 2.1.319, Windows'
own ConPTY at 64 KB caught 4 of 4 before any reply; with ConPTY
1.25.260930003, none caught across 8/64 KB, a leading /, two images, a
queued message and two turns.

Not tried by me: Windows 10 itself (no Windows 10 box here).
2026-11-16 21:51:26 +08:00
yetone 5ba53b2392 agent: dsh and Pi ask a Gemini 3+ on Messages adaptively, so Xhigh reaches it as xhigh (#6778)
larryhaonlp: DSH's Xhigh on agy-cli/gemini-4-hydrogen through
magpie-anthropic reached agy-cli as high, and a compat
forceAdaptiveThinking: true added by hand in dsh went on restart.

Cause, from the installed sources (dsh 0.2.1-rc.2's and Pi 1.4.0's
pi-ai, anthropic-messages.js and simple-options.js): without
compat.forceAdaptiveThinking pi-ai asks a budget through
adjustMaxTokensForThinking, whose clampReasoning turns xhigh and max into
high (16384), and agy-cli's requestedEffort reads a budget of 16384 as
high. With the switch it sends thinking adaptive plus output_config.effort
from thinkingLevelMap, which agy-cli reads first. magpie wrote the switch
only for Claude that thinks only adaptively and GLM-5.2/5.3.

- gateway.AsksAdaptively is the one rule: adaptiveOnly, AdaptiveWithEffort
  or a Gemini 3 or later (geminiGeneration, the rule geminiLevelBody
  already turns a budget into adaptive + effort by). dsh's dshKindConfig
  and Pi's piModelOn (both cases) use it. Pi now also gets the switch for
  GLM-5.2/5.3, which it lacked (same clamp).
- omp is left on AdaptiveThinking, said in omp.go: its budget isn't
  clamped (ANTHROPIC_THINKING xhigh and max are 32768, read as xhigh), and
  its anthropic-adaptive mode turns thinking off by leaving thinking out at
  the lowest effort, which a model that can stop thinking takes as on.
- The user's own values: dshKeepCompat kept a hand-set switch magpie
  doesn't write, but magpie's own switch won over the user's. magpie
  writes its switches only as true (omitempty), so a false in the file is
  the user's, and now stays.
- The restart: dsh-settings' importLegacyDocument imports
  ~/.dsh/settings.yaml into the profile dsh starts on and renames it
  .imported; magpie writes settings.yaml again with routes that had no
  hand-set compat, so each start of dsh took it out of the profile.
  dshProfilesCompat carries the profiles' hand-set compat into
  settings.yaml's routes, by the same dshKeepCompat.

Existing users: KeepDshWired's sync (30s) and Pi's sync rewrite magpie's
routes, so forceAdaptiveThinking: true lands on a Gemini 3+ there with no
action; a false the user set stays. Pi's models.json provider block is
magpie's own and is written whole, as before.

Run (mote; sandbox HOME):
- go test -tags nogui ./internal/agent -run the new tests and the dsh,
  Pi and omp compat tests (TestDshMaxReachesOutputEffortModels,
  TestDshRefreshKeepsHandSetCompat, TestDshKeepCompatNotAcrossProtocols,
  Pi.*API, Omp): ok
- gofmt -l: clean
- Shipped before the whole ./internal/agent and ./internal/gateway run and
  vet (darwin, linux, windows) finished: it was still going on mote, over
  its cores, and mica's disk was full. A red there gets its own fix or
  issue.

Broken by hand:
- the new tests at origin/main 8608ce024: TestPiAgentsAskGeminiAdaptively
  red (dsh and Pi gemini-4-hydrogen, gemini-3.8-flash; Pi GLM-5.3) and
  TestDshHandSetCompatOutlivesGeminiRuleAndRestart red
- the explicit-false keep taken out: red (hydrogen's false put back on)
- dshProfilesCompat calls taken out: red (settings.yaml lacks the false)

Not tried: a real dsh or Pi run against agy-cli's gemini-4-hydrogen
(the effort agy-cli reads is taken from its requestedEffort source);
omp with a Gemini on Messages.
2026-11-16 21:40:30 +08:00
yetone f97997e6ed LESSONS: a GUI suite with hundreds of known reds is not a baseline
8608ce024 shipped on 1041 GUI fails at head against 971 at origin/main.
Four of its named files run alone on mica at 8608ce024 (load 9): 8 of
60 red, all already filed (#4126, #3079, #4790, #6003). 465 open
'gui tests' issues, none assigned, 2 closed since 11-13.

Run: mica-run node --test models-fold, key-replace, plugin-card-update,
usage-fold at 8608ce024: 52 pass, 8 fail. Docs only otherwise.
2026-11-16 21:31:33 +08:00
yetone 8608ce0243 gui: the sticky tab strips are drawn only under scrolled rows, rounded and evenly inset (CHENGJIAHEGOXIS on X)
Over a background picture the Library tab bar showed a square frosted box
around the rounded tabs, 16px out at the sides, 8 at the top and 4 at the
foot. The strip behind the tabs (Library, Plugins, Settings, the Add
sheet) is now drawn only once rows scroll under it (.stuck), fading in
with opacity, so at the top only the track shows: radius 7, an even 2px
around its 5px pills. When drawn, it sits 4px out from the tabs with
radius 11 at its foot (Library, Plugins), and 6px out with radius 13 in
Settings and the Add sheet.

Run: shots in Chromium and WebKit, light and dark, with and without a
wallpaper, at 1280 and 640, at rest and scrolled, before and after
(strip opacity 0 at rest, insets 4/4/4 when stuck). Full GUI suite at
18ec1674a on mote: 1041 fails across ~118 files; those files at
c4d64a70b (origin/main): 971 fails, same files. market-have, models-fold,
key-replace and plugin-card-update, red only in the head run, were rerun
alone: market-have 3 of 6 red at base, 0 of 6 at head; the others fail
the same at base. Not tried: a real Windows WebView2 window.
2026-11-16 21:16:36 +08:00
yetoneandZhuoyuan Hao 9b376de163 gateway: a Gemini model's levels above high come from its provider too (#6871, hhh2210)
withGeminiEffort (decide.go) and geminiLevelFor (gemini_level_body.go)
let a level above high through only where models.dev's catalog lists
it (catalog.EffortsOf). A model a plugin or relay lists that models.dev
doesn't have, such as ai-studio's gemini-4-hydrogen-search with
low/medium/high/xhigh, had agy's xhigh or max sent as high, after the
candidate step had already fitted it to xhigh from p.Efforts.

withGeminiEffortFor and geminiLevelForEfforts now take the provider's
levels (p.Efforts(model)) first and fall back to the catalog's; the four
withModelEffort sites in serve and passthrough's onEffort retry, and
geminiLevelBody, pass them. A model whose levels stop at high is still
asked high. Left as they were: aiStudioThinking and withFixedEffort
(no provider in scope there). Ported from hhh2210's
hhh2210/magpie#3 (8dd4c5f6e), the doc line reapplied by hand on
today's gateway-routing.md.

Broken by hand: with the tests alone on origin/main, both new tests
are red (gemini-4-hydrogen-search sent "high" for xhigh and max on
Gemini and Chat upstreams, output_config {"effort":"high"} on an
Anthropic relay); the high-only gemini-4-carbon-search case stays high
either way.

Run on mote at b394095c7 (origin/main ccae8e821 + this): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... ok; go build, GOOS=linux and GOOS=windows builds ok; go test
-tags nogui -count=1 -timeout 45m ./... under a sandbox HOME: 101
packages ok, none failed (internal/gateway 993s).
Rebased onto 2896e82cc (one Claude image commit in internal/gateway);
at 4e9533cdb go vet ./internal/gateway ok and go test -tags nogui
./internal/gateway ok (924s).

Not tried: a live ai-studio/gemini-4-hydrogen-search request. Not
changed: #6778 (dsh writes no forceAdaptiveThinking for
agy-cli/gemini-4-hydrogen on magpie-anthropic), which is the agent
wiring's per-model compat, not this fit.

Co-authored-by: Zhuoyuan Hao <hzy2210@gmail.com>
2026-11-16 21:10:12 +08:00
yetone 34606000da gui: the tray panel's Usage tab ends in a heatmap of recent weeks (eiyuuzaki2333 on X)
Asked for "a heatmap like GitHub's / Codex's, also in the tray". The
window already has one (Usage › Requests, 53 weeks, #1369), so no second
copy goes on the Overview, which counts gateway calls only while the
heatmap counts session-file calls too. The tray panel had none.

The panel's Usage tab now ends in a card of the recent weeks, one cell a
day, Monday on top, as many weeks as the card fits (8 to 53: about 25 at
the panel's 440, 17 at 320). It goes after the chart and ranking, so
nothing above it moves. Its shades are the existing monochrome accent
ramp (.l0 to .l4) and follow the tab's own Tokens / Cost / Requests
switch, with no new read; a provider or computer picked above narrows it.
A tooltip says the day and its tokens, requests and cost. Weeks with no
call show no card. No animation.

It reads the existing cached /api/usage/heatmap, at most once a minute
and again when a pick changes; the tab's own 10 s reads don't wait for
it, and no endpoint was added. The card, its reads and tooltip live in
plugins/usage/page.js, which shares its grid (heatGridOf, taken out of
drawLedHeat as it was) and tooltip (ledHeatTip, now told the metric and
provider) with the Requests tab. app.js keeps one guarded call in
renderPanelUse: the ledger read can come back before page.js has run, so
page.js draws the tab again when it loads. Both script budgets hold it
at this base with no raise. The card
is .pu-heat, not .pu-card, so the chart's card stays the tab's one
.pu-card. The panel's light pills are its card's white, so a quiet day
there is a 7% shade of the text over the card.

Run (rebased on origin/main 2896e82cc):
- panel-heatmap.test.cjs (new), Chromium and WebKit, en zh zh-TW ja de,
  440 light and 320 dark: 12 of 12, 3 runs on mote. Red 12 of 12 with
  MAGPIE_ASSETS at origin/main's assets.
- Affected files (usage-heatmap, panel-usage, panel-usage-models,
  panel-usage-first-account, panel-currency-provider, panel-units-follow,
  number-units, usage-chart-axis, usage-head-steady, usage-phone-head,
  i18n-keys, phone-no-sideways) and TestCoreScriptBudget: green but
  phone-no-sideways de 375, the same with origin/main's assets (#5869).
- At 2896e82cc again: panel-heatmap, panel-usage, panel-usage-models,
  usage-heatmap, panel-usage-first-account green; i18n-keys red on a
  routing-plugin phrase 2896e82cc's claude_image_budget_test.go added,
  red on origin/main alone (#6877).
- Whole GUI suite on mica at 91b3af847 (concurrency 4): not finished.
  The runner exited 7 with no message twice (after ~2231 and ~2371
  tests); the third part, grip-inset on, is still running, ~10,900
  tests in. None of the red files is touched by this change. Under the
  whole-suite load (#6709, #6782), with their issues:
  agent-details-ready #6369 #6373, agent-switch-accounts #5925,
  claude-quota-onboarding #6179, bark #6543, api-key-theme #6444,
  aside-native #6212, agent-menu-label #6371, allow-ips #4959,
  account-refresh-holds #6003, account-arrange #6010, desktop-tiers
  #6475, quota-refresh-order #6180, provider-max-output and
  provider-many-keys #6209, rest-try-now and key-switch #6232,
  provider-fetch-again, provider-typed, provider-picks-stay,
  provider-models-rest and menu-scroll #6532, omp-roles #6432,
  recovered-file #4320, quota-bars-alike #6700, login-export #6628,
  gateway-key-arrange #6268, first-untick #6660, editor-hints #6156,
  connect-address-kept #6755, recent-call-bodies #6665, quota-credits
  #6807, models-works-only #4391, codex-memories-settings #6372,
  panel-options-fold #6794, reset-providers #6196, quota-curve #6789,
  model-copy-id #4621, modal-backdrop #6663, loop-guard-setting #6662,
  lightweight #6340, keychain-retry #6661, key-replace #3476,
  key-balance-card #6414, gateway-pause #6684, duplicate-pause and
  key-box-once #6424, codex-async-compact #6658, name-suffix-remote
  #5147, menu-input-scroll #3402, rollup-short #6560, remote-magpie
  #6099, plugin-signin-no-url #5938, plugin-signed-out-account #5998,
  plugin-page-foreign-error #6117, plugin-option-placement #6559,
  phone-no-sideways #5869, partners #6664, panel-fold #5796, omarchy
  #4624, old-webkit #6030, model-api-preset #5838, mobile-web #6790,
  library-open-again #6751, key-import #6416, grip-inset #6293,
  fast-ultra and fast-pick #6201, ctx-session-line #5801, context-cap
  #6514, codex-auto-reset #6232, panel-usage-first-account #6181
  (green alone at this head), lan-join #6353, icon-tile #6759,
  model-chip-steady, header-centre, last-page, nav-timeout,
  plugin-card-update #6709. With no issue before, filed as #6876:
  data-folder, plugin-move-unserved, name-suffix-where-named,
  group-editor-selected, found-skill-pick-remove, quota-count-wrap,
  nav-sub-fold, model-suffix-own, account-models,
  account-models-available.
- Looked at screenshots of the panel at 440 and 320, light and dark, en
  zh de ja, with the tooltip shown.

Not tried: the real app's tray panel on macOS, Windows or Linux
webviews, real accounts' usage.
2026-11-16 20:58:35 +08:00
yetone 2896e82ccb claude: a turn with a new image after a reply split by thinking goes on in its run
Yqihotaru on X (omp 18.20.3, magpie 0.1.4314, DEBUG on): a user turn
with an image, after a reply with no tool calls, logged "no run here has
had this conversation" and was told to a new Claude Code from a
transcript (81 messages, 4 images; the turn before had 5), all of it
written to the prompt cache again. The same turn after a reply with tool
calls, and a text-only turn after it, went on in the run.

omp keeps 5 images in a request to a provider it has no image budget for
(clampProviderContextImages, providerImageBudget's default), so each new
image takes the oldest out: the conversation's earlier images moved, and
only looseTurn.rewrote's mediaMoved could match it. mediaMoved compared
the conversation part by part (heardRuns), and the run keeps its reply as
the one text it said while the client sends it back as the text blocks
Anthropic's stream told it, one between each thinking block (#5705).
#5705 made the turn keys read a reply's words without whitespace; the
part-by-part compare still read two blocks against one text, so the
first such turn found no run.

heardRuns now reads an assistant run's texts in a row as one part, their
words with no whitespace, as messageWords does. A user's texts stay
apart: the text an image left between them is what lostFromRun reads.

TestClaudeOmpImageBudgetGoesOnInItsRun sends omp's clamped history (the
budget of 5, "[image omitted: provider image limit]" in a message left
empty) eight turns, with the reply in one block and split by thinking,
and an image with words, alone, before words, and two at once. The
subsystem page says what heardRuns reads.

Run (on mote, through mote-run, at 98955300a + this change):
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (930s)
- GOOS=linux go vet ./internal/gateway, GOOS=windows go vet
  ./internal/gateway: clean; gofmt -l: clean
- rebased onto ccae8e821, which changes internal/agent only

Broken by hand: at 98955300a without the heardRuns change the new test
is red in all four "split by its thinking" cases at turn 1, the first
turn with an image, with the reporter's line, "no run waits for this
turn: no run here has had this conversation", then "a new Claude Code
is told the whole conversation: 13 messages, 5 images". The one-block
cases pass there.

Not tried: no real omp session or Claude account; the reply's block
shape is inferred (a text-only reply, thinking on) from the report, not
read from the reporter's request. The test skips on Windows (a shell
script stands in for Claude Code). No full ./... run: the change is
confined to internal/gateway.

Reported-by: Yqihotaru on X
2026-11-16 20:39:45 +08:00
yetone ccae8e8211 claude-desktop: a 1M model runs at 1M in the Code tab again (fwxkogaia on X)
Claude Desktop 5.11492 (released 11-13) starts its Code tab's Claude Code
with CLAUDE_CODE_MAX_CONTEXT_TOKENS=200000 in its --settings file whenever
the provider routes models itself, the gateway included (Fcn=2e5 and Lcn in
index.chunk-xV3fJhc7.js; 4.16336 had no such value). Flag settings come
before ~/.claude/settings.json, so the window magpie writes there no longer
reached the Code tab, and every model picked by its plain entry ran at 200K,
a 1M one too. No magpie change caused it: nothing in v0.1.4300..v0.1.4322
touched what Desktop is told about 1M.

Claude Code takes a "[1m]" id for 1M whatever that variable says (pT in
2.1.322). magpie's profile now gets Desktop's own "Use 1M wherever it's
available" (modelPrefer1mContext: true, 3p only, Desktop 1.28929+) once, on
a switch on and from Sync, as toolSearchEnabled is (desktopSeedPrefer1M):
Desktop then shows a model it offers a 1M entry for by that entry alone
(D5n: prefer1m on every supports1m entry) and hands Claude Code its [1m] id.
Desktop offers that entry only for a row whose max_input_tokens is 1M or
more, so nothing smaller changes. The user's own value, false too, or their
taking it away, stays theirs. Compaction is as before: the working window,
or the whole window under Full window.

Not fixable this way: a model between 200K and 1M (a 272K or 400K GPT)
still runs at Desktop's 200K; only a managed policy setting comes before
flag settings, and magpie writes none.

Run (mote, at this tree):
- go test ./internal/agent -run TestClaudeDesktop: ok
- TestClaudeDesktopPrefers1M red with desktopSeedPrefer1M returning nil
  ("switch on: modelPrefer1mContext <nil>"), green with it
- go vet ./internal/agent for darwin, linux, windows: ok; gofmt -l: clean
- go test -timeout 45m ./... at base 98955300a plus this diff: exit 0,
  101 packages ok, no FAIL (log kept whole)
Read, not run: Desktop 5.11492.5's app.asar (downloads.claude.ai zip) and
Claude Code 2.1.322's strings, for the 200K and the [1m] rule.
Not tried: a real Desktop 5.11492 on magpie in a sandbox; the Code tab's
/context with the new profile.
2026-11-16 20:25:25 +08:00
yetone 98955300a7 claude: no request-sized value on a run's command line or in its environment (#6848)
recih (on X) ran a long Claude Code session through the Claude
subscription's interactive mode on a Linux server: every start, the
resume and the replay alike, failed "fork/exec <magpie>: argument list
too long", 8 502s, and every request after. Linux starts nothing with one
argument or variable over 128KiB (MAX_ARG_STRLEN), and startRun put the
conversation's safeguards in CLAUDE_CODE_EXTRA_BODY whole and the JSON
schema in --json-schema whole.

Now no value of a request's goes on the command line or in the
environment over claudetui.StartValueMax (16KiB, under Windows' 32K
variable too):
- interactive mode: CLAUDE_CODE_EXTRA_BODY is a stand-in
  (startSafeguards: all when they fit, else without the parts Claude
  Code itself sheds, else []); guard.json keeps them whole and tap.js
  puts them in each request, as before. tap.js no longer sets the
  variable to a file over the bound, since Claude Code's MCP servers
  and tools inherit it. It is given no --json-schema (it never used it;
  the answer tool has the schema).
- -p: a schema over the bound goes with the initialize request
  (jsonSchema, as the Agent SDK sends it). Claude Code passes over an
  initialize schema it can't use silently, so such a schema is compiled
  first and refused with a 400, as the flag's exit was (#3036).
Other per-request starts checked (warmups, usage, sign-ins, other
agents' bridges): nothing request-sized on argv or env.

Run:
- TestClaudeTUIStartBounded, TestClaudePrintStartBounded,
  TestClaudePrintSchemaPlaces (gateway) and
  TestTapPutsSafeguardsTooLargeForTheEnvironment (claudetui, bun and
  node): red on the old code on mote (152KB env, 277KB arg, 502 for a
  bad large schema, 204KB variable left by tap.js), and on Linux
  (wsl-run, magpie-desktop) the old code failed with the real
  "fork/exec .../magpie: argument list too long" and the tap's child
  start with E2BIG. All green on the new code on mote and Linux.
- Real claude 2.1.316: an initialize jsonSchema answered
  structured_output {"city":"Paris"} (haiku); CLAUDE_CODE_EXTRA_BODY
  {"safeguards":[]} is sent as "safeguards":[] in every request (local
  listener, sandbox config).
- gofmt; go vet (darwin, GOOS=linux, GOOS=windows) on the two packages;
  go test -tags nogui ./internal/claudetui ./internal/gateway on mote:
  ok claudetui 182.5s, ok gateway 1066.8s (at base e25210b6e). Rebased
  on aa3307585: the four new tests plus the guard, safeguards and
  schema tests of both packages again, ok.
- Full suite (go test -tags nogui -timeout 45m ./... on mote): not
  finished at push; its result goes on #6848.

Not tried: the reporter's own session; a real interactive run with
safeguards over 16KiB end to end (the tap is tested with a FetchSession
stub); a Claude Code the helper gives no tap (a path with whitespace)
now sends the bounded stand-in instead of all the safeguards.
2026-11-16 19:18:49 +08:00
yetone aa33075852 provider: Qoder's mover min is 0.2.71 (plugins#1220, #1204)
Qoder 0.2.71 (the npm registry lists it as latest, checked at
registry.npmjs.org) ends a streamed wait in a queue with nothing ahead
whose state hasn't changed for 5 minutes with the queue's 503, where a
frozen Qoder CN RESOURCE_LIMIT queue held the agent on keepalives for an
hour (plugins#1220, nsyan). 0.2.68 to 0.2.70 come with it: the 120s
silent-call 504 (plugins#1204), the Kimi call-only turn (#1213) and bare
tool_calls replies (#1113). Plugin change and its tests:
magpie-community/plugins bf47b85b.

Run: mote-run go test -count=1 -run 'Mover|Moved|Migrate|Qoder'
./internal/provider: ok. gofmt -l: clean.
Not run: the full suite; a real Qoder account.
2026-11-16 19:04:01 +08:00
yetone 8707ea7757 gateway: Codex's prompt suggestions go on a model set for them (@0xcb198609 on X)
The Codex app's home-page prompt suggestions (thread_source
ambient_suggestions, and their safety check, ambient_suggestion_safety;
the Routing page's 提示词建议) are a background agentic turn that reads
the project and connected apps. The app asks for the model its server
config names (codex-app-model-routing's
codex_ambient_suggestions_model_slug, gpt-6-luna) with provider model
fallback on, so with magpie as Codex's provider they ran on the
provider's default model, often auto: @0xcb198609 saw 76.9k tokens in
113s on deepseek-v4-pro. Codex has no config.toml key for that model,
only an on/off switch in the app (store key ambient-suggestions-enabled,
Settings › Configuration › Homepage suggestions; read from the 26.1106
bundle).

magpie now has a setting for it, "Codex prompt suggestions" in Codex's
row on the Agents page (Settings, beside Codex composer predictions):
- Empty, the default, is Codex's own pick: nothing moves. A value the
  user set is never overridden.
- A model or group of magpie's puts both calls there: in serve as the
  codex-suggestions move (the Routing page says why), and on the ChatGPT
  backend's route before the split, carrying the asked model to serve so
  the trace and ledger keep it. codexOwnOffMagpie leaves a bare
  gpt-6-luna to magpie while the setting is on (codexSideSet).
- A target that is disabled, unserved or not allowed to the gateway key
  leaves the call as asked, with a log line (compactRefused).
- To fit app.js's script budget without raising it, the suggestions and
  auto-review pickers share codexPick with codexSidePick, and every
  Codex row's button comes from condButton. The new route is named for
  the CLI (settings_parity_test.go). agent-prefs and settings-general
  list the new row.
- The row's tooltip and the Routing page's Suggestions story say where
  Codex turns them off. magpie's old story said "Suggested prompts",
  which the current app no longer shows; corrected in all five languages
  from the app's own locale files.

Run (mote, at this head rebased on e25210b6e):
- go test -timeout 45m ./...: ok, every package (101). A first run
  at e97271f02 had cli and gui red on the CLI-parity guard and
  TestCoreScriptBudget; both fixed here, without raising the budget.
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
  ./...: clean. gofmt -l: clean.
- TestCodexSuggestionsMoved/Left/MovedOffChatGPT/ModelRefusesBareName,
  TestCodexSuggestionsSetting: ok.
- GUI: codex-suggestions (new), codex-predictions, codex-auto-review,
  routing-kind, i18n-keys: 58/58 ok before the rebase; at this head
  codex-suggestions, i18n-keys, agent-prefs, routing-kind 84/84 ok.
  Every GUI file that opens Codex's row or the Routing kind stories
  (26) ran too: red only in codex-async-compact (zh, zh-TW) and
  codex-memories-settings (chromium scroll), both red the same on
  origin/main e25210b6e and filed as #6658 and #6372.
- Rebased last onto 90d54a267 (internal/sessions and internal/usage
  only): internal/sessions, internal/usage, TestCoreScriptBudget, the
  route guards and the CodexSuggestions tests ok again there.

Broken by hand: codexSuggestionsTo returning "" and codexSideSet's new
case off: TestCodexSuggestionsMoved red (m1 sent, and a 404 "magpie
knows no model gpt-6-luna"), TestCodexSuggestionsMovedOffChatGPT red.

Not tried: a real Codex app's prompt suggestions against magpie (no
Codex.app here or on mote); the whole GUI suite (only the files that
open Codex's row, its settings or the Routing kind stories).
2026-11-16 18:59:40 +08:00
yetone 90d54a2675 usage: Factory Droid's own sessions count under Not through magpie (_meouwu on X)
Droid's sessions were on the Sessions page, but Usage's "Not through
magpie" read no Droid calls, so what Droid spent straight at Factory or
a BYOK provider never added up.

Droid writes no tokens into a transcript: a message line has its time,
the message and a reply's modelId. Read from droid 0.231.0's binary
(its session schema) and the real runs in testdata/droid-skills, what a
session spent is only in <id>.settings.json: tokenUsage, its own running
total (input less the cache, output with thinking, cache read and
written), and lastCallTokenUsage, the latest call alone. So each session
is one call of its total, at its last message (the day Sessions already
counts the same total on), under its settings' model; a subagent's is
under the session that called it, a fork's starts at none.

- sessions: calls_droid.go reads a session with its settings whole
  (wholeCallReaders "droid"); droidFiles joins callSources, behind
  Reads("droid") and allowed() like the rest. WSL is not read: the
  Sessions page doesn't list Droid in a distro either.
- No double count: a session whose settings or any reply names magpie's
  own entry (custom:magpie/...) or a custom model whose baseUrl is the
  gateway's port on loopback is left out whole; the gateway counted those
  calls, and a total can't be split by model. A session is judged when
  read, again once it or its settings change.

Tests: TestDroidCalls (the 4 real droid 0.231.0 sessions: tokens, time,
model; custom:mh on localhost:11434 counted, on the gateway's port left
out; Reads off counts none), TestDroidCallsOfSessions (subagent, fork,
no settings, magpie's entry, Factory's own model), and
TestDirectDroidSessionTotals in usage. Both sessions tests are red on
origin/main (0 calls); with the gateway check broken by hand both go red
on the gateway cases.

Run (mote): go test ./internal/sessions
./internal/usage ok; go vet + GOOS=linux/windows go vet of both ok;
gofmt clean; go test ./internal/gui ./internal/agent ok.
Not tried: a real Droid session against Factory's own models (no Factory
account here); no GUI change.
2026-11-16 18:56:32 +08:00
yetone e25210b6e4 providers: an Alibaba Token Plan's AccessKey says the grants it needs, in the reader's language (MetalHqa on X)
MetalHqa on X: "阿里云百炼 Token Plan 的额度查询需要的权限不明确,希望能够在里面备注出来".
Since 456b5c6c7 (#6506) the grants were named only in aliRAMHint, in
English, on the Usage card after a NotAuthorised refusal, and the editor
still said "a RAM user that may use Model Studio is enough", which is
wrong: the AliyunBailian*/AliyunModelStudio* policies don't cover the
Token Plan.

Now:
- The editor's AccessKey ID for an Alibaba Token Plan has one line under
  it (ALI_RAM): a RAM user's AccessKey needs AliyunTokenPlanReadOnlyAccess
  and AliyunBSSReadOnlyAccess, and Administrator or Subscription plan in
  Model Studio → Account Management; the main account's needs none. The
  Secret's hint loses the wrong sentence. Volcengine and Tencent keys are
  unchanged.
- A card refused with aliRAMHint says the same line in the reader's
  language (quotaError), the raw refusal still in its tooltip.
- zh, zh-TW, ja and de for both strings.
- aliRAMHint says "Subscription plan", as Alibaba's English docs do.

Checked against Alibaba's docs: Token Plan 权限与使用规范 (RAM 子账号授权:
AliyunTokenPlanReadOnlyAccess or FullAccess, AliyunBSSReadOnlyAccess or
FullAccess, 账号管理页面 → 管理员或订阅套餐权限), the personal FAQ (个人版
BSS policy is AliyunBSSReadOnlyAccess) and the English page (Account
Management, administrator or subscription plan permission). magpie reads
the personal plan's usage only, so the read-only policies are named.

Core script budget +275 (app.js and total): one string shown in two
places, less the wrong clause it replaces; the editor and quotaError draw
on every window, so there is no page to move it to.

Run on mote at e97271f02 + this change: gofmt -l clean; go vet
./internal/provider ./internal/gui, GOOS=linux and windows go vet
./internal/provider; go test ./internal/provider -run 'TestAli|Alibaba'
ok; go test -tags nogui ./internal/gui -run
'TestCoreScriptBudget|Words|I18n|Alibaba|AccessKey' ok; node --test of
the new alibaba-ram-grants (20/20, Chromium and WebKit, all five
languages, 420px) with every GUI file that draws an access key or a
card error, i18n-keys, i18n-en-no-cjk, form-align, editor-advanced-align
and quota-name-translated: 253 pass, 7 red, all under load ~70:
editor-advanced-align (#6421, a Claude editor) and qianwen-plan's 8s
sign-in wait (#6852); both green alone on this tree and on the base.
Broken by hand: alibaba-ram-grants on the base's app.js and i18n.js is
red in all 20 cases. After the rebase onto 1bfc6378c: TestCoreScriptBudget, TestAliGateway, alibaba-ram-grants (20/20), i18n-keys and volc-access-key ok on mote.
Not tried: a real RAM user's AccessKey (none here); the whole GUI suite.
2026-11-16 18:14:38 +08:00
yetone 1bfc6378c9 providers: Antigravity CLI's own Gemini API key is found and imported (shenggxhz on X)
shenggxhz set agy up on an AI Studio key: "modelProvider": "gemini" in
~/.gemini/antigravity-cli/settings.json, GEMINI_API_KEY exported in the
shell. `agy models` then listed Gemini 4 Carbon and Hydrogen. magpie's
model refresh didn't, because the agy-cli subscription runs agy on its
Google sign-in, whose models are the account's in Antigravity, and the
key was used nowhere in magpie.

The Providers page now finds that key on its own. A new import source,
"Antigravity CLI" (readAgySettings), reads agy's settings.json and offers
the key as the Google Gemini preset, which lists the key's models from
the Gemini API. With GOOGLE_GEMINI_BASE_URL set, it uses that endpoint's
Gemini API instead. The variables are taken from magpie's environment,
else from the login shell's: a key exported only in .zshrc is found when
magpie is opened from the Dock. proc.GeminiKeyVars are only read
(LoginEnv), never set in magpie's environment. agy on its sign-in offers
nothing. With no key the entry shows as not importable, and a key that
points at magpie itself is refused.

Not changed: the agy-cli plugin's own `agy models` reads the same
setting and, with no key in magpie's environment, fails and keeps the
old list silently. Filed as magpie-community/plugins#1218.

Run:
- red on the old code: with the appReaders entry removed, all four
  TestAgyGeminiKey* tests fail (no "agy" source); green with it.
- a real login shell on mica, in a sandbox HOME (key exported only in
  .zshrc, MAGPIE env without it): DiscoverSources gives status new,
  preset google, the key read.
- real agy 1.5.9 in a sandbox HOME: API-key mode lists the Gemini 4
  models from a list built into agy; without the key it exits 1 with the
  modelProvider error.
- go vet (darwin, GOOS=linux, GOOS=windows) for proc and provider, plus
  darwin internal/gui; gofmt -l clean.
- full `go test -timeout 45m ./...` on Linux (magpie-desktop): every
  package ok except internal/usage's TestRequestStateKeptAcrossACatalogFetchedAgain
  (#6572, filed, untouched here) and the root, internal/cli and
  internal/gui, which don't build there (no gtk4/webkitgtk-6.0 dev
  packages). Those three, plus provider and proc, ran on mote (darwin): ok.
  A first full run on mica died of a full disk (117G of shared Go build
  cache), so it tested nothing.
- GUI on Linux, Chromium + WebKit: icon-tile, import-collision,
  import-opencode, provider-discovery, import-row and i18n-keys pass,
  92 of 93. The one red is icon-tile's dim-color (#6759, red on main).
- appIcon became a table so the agy icon fits app.js's code budget
  without raising it (TestCoreScriptBudget ok).

Not tried: a real AI Studio key or a real Gemini request; the GUI import
sheet in a browser (the source shows through the existing discovery and
import sheets, with Antigravity's icon); Windows (LoginEnv is "" there,
so only magpie's own environment is read).
2026-11-16 17:59:26 +08:00