Commit Graph
1042 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 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 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 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 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 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 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 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 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 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 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 e97271f027 agents: a client of a Remote magpie can connect new agents the remote has connected (KoiLx0 on X)
KoiLx0 runs one magpie as a client of another, through a gateway key, and
had to switch every agent on by hand on the client before it took the
remote's models. A Remote magpie's editor now has "Connect new agents to
this remote" (自动接入新 agent) under Advanced, off by default. It is kept
per computer in the stash (remote.<id>.connectAgents), not in
providers.json, so a synced or shared providers list doesn't turn it on
anywhere else. No server-side key permission.

With it on, the follow loop (FollowRemotePicks, every 5 minutes, and at
once when the switch is turned on) connects an agent installed here that
the remote has connected, on the remote's pick (connectFromRemote), and
records it as <agent>.remote.auto = on. An agent the user disconnected
here is never connected again:
- one with the Agents page's Disconnect mark, connected or not before;
- one recorded on that is no longer connected (taken out by hand in its
  file, or by any other route) is recorded off.
An agent magpie put back on quit (quit.restored) is left to RewireOnStart
and not taken for a disconnect. Connecting it by hand records on again.
The follow throttle's time is now under a mutex, since the save handler
resets it from another goroutine.

The switch shows in /api/providers as connectAgents and is saved as
connectAgents (a save that leaves it out keeps it; a provider that isn't
a Remote magpie is refused it). Advanced opens on its own while it is on.
docs/subsystems/providers-accounts.md says all of this.

app.js stays within its budget (TestCoreScriptBudget): the Remote
magpie's three ticks (MCP servers, skills and prompts, agents) and their
save are one loop, which the new switch costs less than it saves.

Run:
- mote, go test -tags nogui -count=1 -timeout 45m ./... with the first
  draft of app.js: every package ok but internal/gui, where only
  TestCoreScriptBudget failed (1087333 > 1086971). After the loop,
  rebased on origin/main 187d06724 (budget passes there alone), at this
  head: TestCoreScriptBudget, internal/gui, internal/agent and
  internal/cli ok.
- mica: TestRemoteConnectsNewAgents, TestConnectFollowsTheRemoteMagpiesPicks,
  TestProviderSaveConnectAgents ok.
- mote: go vet (darwin), GOOS=linux go vet -tags nogui, GOOS=windows go
  vet on internal/agent and internal/gui ok; gofmt -l clean.
- GUI, mica, both engines, at f261f7ba6 (before the loop and the rebase): remote-connect-agents.test.cjs (new: under
  Advanced and closed while off, sent as ticked, Advanced opens on it
  ticked, unticked sent so; en, zh, zh-TW, ja, de at 420px, no sideways
  scroll) passes, with i18n-keys, i18n-en-no-cjk and every file that
  reaches the provider editor's Advanced or a Remote magpie (64 files):
  1738 pass, 26 fail. The same files at origin/main 19794cc10: 1728 pass,
  24 fail, the same reds by name (editor-hints webkit #6156,
  account-arrange #6010, lan-join #6353, vertex-editor #4720,
  remote-magpie #5013, commented with this sha) except name-suffix-remote
  (#5147, red at base too on another language) and one count-free
  browser launch timeout; both files alone: 80 of 80 pass. At this
  head (rebased, with the loop): remote-connect-agents, library-mcp-on, provider-advanced-fold,
  i18n-keys, i18n-en-no-cjk pass; remote-magpie red as at base (#5013);
  editor-advanced-align red once in webkit, 1 of 4 alone (#6421, a
  Claude Code account's editor this change doesn't reach; it was red at
  base in the 64-file run).
- Real use on mica, sandbox HOMEs, this branch's binary: remote R
  (`magpie serve`, Claude Code on gpt-5.4-mini) and a fresh client C
  with Claude Code installed, not connected. Switch off: C's
  settings.json stayed {}. Switch on, C restarted: "agent: Claude Code
  connected as the remote magpie's", ANTHROPIC_DEFAULT_SONNET_MODEL
  office/openai/gpt-5.4-mini, recorded on. `magpie claude default`
  (disconnect) and C restarted: settings back to the user's, recorded
  off, not connected again.

Broken by hand, each red in TestRemoteConnectsNewAgents:
- connectFromRemote returning at once (the old code): "not connected on
  the remote's group/fast";
- without the on-then-unconnected record: "an agent the user
  disconnected by hand in its file was connected again";
- without the Disconnect mark check: "an agent marked disconnected,
  never recorded, was connected";
- without the quit.restored exception: "a quit-restored agent: wired
  false, recorded off".

Not tried: the switch turned on from the real app's window (the GUI test
fakes the API; the save handler is covered by TestProviderSaveConnectAgents
and real use wrote the stash key); agents other than Claude Code for real
(the code is the same ConnectHow for every agent with fields); Windows and
Linux runs.
2026-11-16 17:23:50 +08:00
yetone 19794cc10c serve: a headless magpie follows a Remote magpie's agent picks (KoiLx0 on X)
v0.1.4298 made a client magpie follow the models a Remote magpie's
agents are on (agent.FollowRemotePicks), but only the app's Library loop
(library.KeepLinked) ran it. `magpie serve` and `magpie serve --web`
followed the remote's model list and efforts (the long-poll in the
gateway) and never a pick changed on the remote. Both now run
agent.KeepFollowingRemote, which calls FollowRemotePicks every 30s; it
still asks the remote at most every 5 minutes, and only while a Remote
magpie is added.

Run at this head, on mica:
- go test -timeout 45m ./internal/agent/ ./internal/cli/: ok
- go vet; GOOS=linux go vet -tags nogui; GOOS=windows go vet: ok
- Real use: two sandbox magpies (R with a fake OpenAI upstream and a
  gateway key, C with R as remote-magpie "office"), both `magpie serve`.
  Claude Code connected on R to openai/gpt-5.5: C recorded
  claude.model.remote at start. R's Claude Code moved to
  openai/gpt-5.4-mini at 15:41; C's ~/.claude/settings.json followed
  at 15:45:49 (the 5-minute step). Efforts set on R (low,high) and a new
  upstream model reached C's /v1/models, Codex's magpie-models.json and
  Claude Code's model list within seconds to about a minute, before and
  after this change.

Not broken by hand: the loop is a ticker around FollowRemotePicks, whose
following is covered by remote_picks_test.go.

Not tried: Windows and Linux real boxes.
2026-11-16 15:46:21 +08:00
yetone 10ce59144f claude: a connected Claude Code starts straight into a session (KoiLx0 on X)
KoiLx0 on X: a Claude Code that magpie connected, on a computer where it
had never run, still opened on the theme picker and the sign-in choice.
Claude Code shows its first-run steps while its global config
(~/.claude.json, $CLAUDE_CONFIG_DIR/.claude.json, or a non-empty legacy
.config.json beside settings.json) lacks hasCompletedOnboarding, which
nothing wrote.

- Connecting Claude Code (and a Sync of one connected before) writes
  hasCompletedOnboarding: true into that file beside the user's other
  keys, and records that magpie wrote it (claude.onboarded in the stash,
  per place).
- Disconnecting takes out only the mark magpie wrote, and only while the
  file has no oauthAccount or lastOnboardingVersion of Claude Code's own.
- A file that already has the mark (the user's own first run) is never
  touched; one that can't be read or parsed is left alone (edit.SetJSON
  writes nothing), and the connect still succeeds.
- The Claude launch profile (claude#launch) is left out; it passes its
  own --settings.
- The per-folder trust prompt is Claude Code's and stays.

Run at this head (rebased on 56c988cb5), on mica:
- go test -timeout 45m ./internal/agent/ ./internal/cli/: ok (188.9s, 73.3s)
- go vet; GOOS=linux go vet -tags nogui; GOOS=windows go vet, both
  packages: ok (on mote). gofmt -l: clean.
- Real use: Claude Code 2.1.316 from npm, fresh sandbox HOME, connected
  by a sandbox magpie to a Remote magpie's model. Before: theme picker,
  then security notes, then the trust prompt. After: the trust prompt,
  then a session on "GPT-5.5 · OpenAI · Remote magpie · API Usage
  Billing".

Broken by hand: with the onboard() calls removed, 4 subtests of
TestClaudeConnectMarksFirstRunDone go red.

Not tried: WSL and Windows on a real box (the path comes from the same
place.join as settings.json there); a user signed in to Claude Code with
an account on a real machine (covered by the "own first run" subtest only).
2026-11-16 15:46:15 +08:00
yetone c4d64a70b2 agent: Codex's config holds only keys Codex knows, checked against its schema (#6828)
hatanokokoroyo (#6828) and Nietzsche_Li on X: Codex 0.169 warns on
every launch that `disable_response_storage` is ignored, and
`codex --strict-config` refuses to start, with magpie 0.1.4291.

The key isn't magpie's. `git log --all -S disable_response_storage`
finds it in no commit, and nothing in the tree writes it. Codex removed
it in openai/codex#3212 (0.30.0, 2025-09); magpie's Codex paths assume
0.133 or later, so none needs it. CC Switch wrote it in its Codex
presets until 4.0.28, which stops writing it and clears it on the next
switch (cc-switch#7524), and relays' setup pages still tell users to
add it. magpie's CC Switch import reads only the model provider. Since
magpie can't show it wrote the line, the user's line is left as it is.

So this adds the guard: testdata holds Codex rust-v0.169.0's own
config.schema.json (descriptions, defaults and enums stripped, 86KB),
and TestCodexConfigHoldsOnlyKeysCodexKnows walks it over the config
magpie writes, in place and as the magpie.config.toml profile, from an
empty config and from a CC Switch one, after setting a model, an
effort, subagents and memories and a sync. A key Codex has removed or
never had fails it. A user config holding the line keeps it, once, and
it is the only unknown key.

Run at this tree (mote): go test -run TestCodexConfigHoldsOnlyKeysCodexKnows
-v ./internal/agent PASS; go test ./internal/agent ok; go test . ok;
GOOS=linux and GOOS=windows go vet ./internal/agent ok; gofmt -l clean.
Broken by hand: codex.go writing disable_response_storage beside the
effort: the test went red naming the key; restored, green.
Not run: the whole suite (a test file and testdata only, in one
package).
2026-11-16 15:09:18 +08:00
yetone b9c385286b agent: the disconnect preview reads no sign-ins, so macOS never asks "Keychain Not Found"
jasonz3g on X (macOS, two Claude accounts): clicking Claude Code on the
Agents page made macOS ask "Keychain Not Found — A keychain cannot be
found to store …" (Cancel / Reset To Defaults), dozens of times.

The Agents page loads a disconnect preview each time an agent's box
shows: DisconnectPreview runs Disconnect on a copy, in a subprocess
whose HOME is a temporary folder. Claude Code's Disconnect builds the
model list (buildModels -> CatalogFor -> provider.All -> Accounts ->
rememberLogins -> liveLogin), which read the Claude sign-in with
`security find-generic-password`, and Cursor's too. On a Mac the
keychain is found through HOME, and the temporary one has none. With a
copy of real ~/.claude and ~/.config/magpie, the dry run ran security
three times under the temporary HOME, started Devin's CLI there, and
rewrote held/lapsed in the copy's logins.json.

previewEnv now sets MAGPIE_NO_ACCOUNTS=1, which every keychain read and
write, liveLogin and askClaudeStatus already honour. The dry run of
the same real copy then runs no security and no CLI, and the agent's
~/.claude files come out byte for byte the same as before (diff -r), so
the preview shows the same changes.

Run:
- TestDisconnectPreviewReadsNoSignIns (new), red on the old code
  (security find-generic-password -s Claude Code-credentials ... twice),
  green after; its second half checks the fixture does reach the
  keychain out of the dry run.
- go test ./internal/agent -count=1 -timeout 45m: ok on mica (macOS)
  and on WSL Ubuntu (magpie-desktop); GOOS=linux and GOOS=windows go
  vet ./internal/agent ok; gofmt -l clean.
- Real binary, dry run of `claude` on a copy of real ~/.claude and
  ~/.config/magpie with logging security/claude stubs: 3 security calls
  before, none after.

Not tried: the GUI dialog itself (no display over ssh); the
reporter's own accounts.
2026-11-16 14:45:15 +08:00
yetone b1dd96ab14 agents: a client of a Remote magpie starts its agents on the remote's models and follows them (KoiLx0 on X)
KoiLx0 runs several computers on one remote magpie and had to set every
agent's models again on each of them, and again whenever the remote
changed. Routing groups already reach a client (a group is a model of the
remote's list, TestRemoteMagpieNewGroupServedBesidePicks); the agents'
picks did not.

- The remote tells, per connected agent, each model field's catalog ref
  at GET /v1/magpie/agent-models (gateway.SharedAgentModels,
  agent.SharedModels). Guarded as the Library is: this computer, or a
  full-access key of a magpie shared on the network; a held key is
  refused (readonly_test), and another machine without a key gets 401
  (TestNetworkGatewayGuardsEveryRoute).
- An agent connected here starts on those picks where this magpie lists
  them as <remote id>/<ref> (How "remote", after "again" and "joined";
  the Agents page says "as on the remote magpie", in all five languages).
- A field taken from the remote, or found on its pick, is recorded in the
  stash and follows the remote's change every 5 minutes
  (FollowRemotePicks from library.KeepLinked). A model picked here is the
  user's: the record goes, and the field is left alone until it is on the
  remote's pick again. A pick this magpie doesn't list is skipped.
- app.js budget: no raise. The new line's 76 bytes come from same and
  alike sharing one string (CONN_WAS) and the native joined case
  returning plain instead of the same t() again.

Run at this head (rebased on c38753a7e, i18n-keys ok there; before that on b010fba05, whose budget raise left 2 bytes;
CONN_WAS's short name gives them):
- mote: go test -count=1 ./internal/agent ./internal/gui ./internal/library
  ./internal/provider: all ok.
- mica: go test ./internal/gateway (whole package, at the pre-rebase tree,
  ok 920s); at this head go build ./... and the gateway's guard, read-only
  and Library tests: ok.
- mica: GOOS=linux and GOOS=windows go vet of agent, provider, gateway,
  library: ok. gofmt -l: clean.
- mica at this head: go test ./internal/gui (budget ok), i18n-keys,
  agent-leave-magpie, agent-connect in chromium + webkit: ok.
- mica, chromium + webkit, before the last rebase: i18n-keys, i18n-en-no-cjk, agent-leave-magpie,
  agent-connect, agent-connect-no-models, agent-connected-unfolded: 0 fail.

Broken by hand: with connectRemote cut out of connect(),
TestConnectFollowsTheRemoteMagpiesPicks fails (connected on
aaa/claude-opus-5-5 (alike)); with the follow's "still the recorded value"
check made always true, it fails on the user's pick written over.

Not tried: two real computers; only a fake remote in the tests. Left for
#6824: a headless `magpie serve` client doesn't follow later changes
(the loop runs in the GUI), an empty field the remote fills later isn't
filled, and WSL / claude#name agent ids don't match across machines.
2026-11-16 14:18:47 +08:00
yetone 13e8002641 claude-desktop: two providers' Claude model read "Opus 5.5 · agy-cli", not the id's tail (onkashiko on X)
Claude Desktop names a row listed as magpie-<n>.anthropic.claude-opus-5-5
after its own catalog ("Opus 5.5"), whatever display_name says, so
agy-cli's and another provider's claude-opus-5-5 read alike and Desktop
5.11492 told them apart by the part of the ids that differs: "Opus 5.5
(…<n>.anthropic.claude-opu…)" (xVn/wVn in its app.asar). Only an
inferenceModels entry's labelOverride comes before the catalog's name,
and Desktop never suffixes such a label (keep in xVn).

magpie now writes the profile's inferenceModels, each row's display_name
as labelOverride, while two rows are named after one Claude model of
Desktop's catalog (desktopNamesClash), not only while a tier is picked.
The ids are unchanged. As with a tier's list, Desktop reads it at start
and its menu stays as listed until the next start; the Agents row's
Restart shows.

desktopNames' own fallback for two rows display_name still leaves alike
(one provider's models named alike) is now the model's id, "Z · D (z2)",
not the whole catalog id; two providers of one name keep the catalog id.
Claude Science takes the same names.

Run (mote, at origin/main 9dcec6751 + this):
- go test ./internal/gateway ./internal/agent ./internal/gui
  ./internal/provider -count=1 -timeout 45m: all ok.
- GOOS=linux and GOOS=windows go vet ./internal/gateway ./internal/agent: ok.
- gofmt -l: clean.
Rebased on 023a56373 (Windows install dialog only); at that head
go test ./internal/gateway ./internal/agent -run 'Desktop|Science': ok.
Broken by hand: with the list written only while a tier is picked (the old
rule), TestDesktopInferenceModelsCatalogNamesClash is red ("two Opus 5.5
rows, no list").
Not tried: a real Claude Desktop 5.11492 reading the list (the labelOverride
precedence and keep are read from its app.asar), and the reporter's setup.
2026-11-16 12:05:45 +08:00
yetone b26f16ee24 agent: Alma has one magpie provider, whichever side turned it on
realLemonawa on X: Alma has its own Magpie preset, and magpie's Alma
agent adds a provider of its own, so turning on both left two.

Alma's preset card claims the provider whose id is "magpie" (Alma
origin/main: forPredef / getProviderForPredefined, provPredefBody in
desktop-native settings_providers_detail.go). magpie's provider is now
made under that id (with the preset's icon), so Alma's card shows it set
up and offers no second one. When a provider has that id already (a
user's own elsewhere), magpie makes one as before and leaves it alone.

almaMagpie already took a Magpie set up in Alma first (same gateway
host) as magpie's, so the row showed connected and nothing was added.
What was wrong was switching off: almaSet("") DELETEd whichever
provider it had matched, the user's own preset included. Now a provider
magpie didn't make (name not "magpie") is kept: only the default model
and image refs that point at it are taken back, as before, and it is
turned off again only if it was off when magpie turned it on
(alma.wasoff in the stash). Sync no longer rewrites its model list after
the switch-off.

Tests: TestAlmaOneMagpie (internal/agent/alma_test.go), against the
fake Alma, whose POST now honours an id and answers a taken id with
Alma's 500 "UNIQUE constraint failed":
- set up in Alma first: connected, no second provider, switch-off sends
  no DELETE, the preset stays on, sync after off writes nothing
- turned off in Alma: enabled on connect, disabled again on switch-off
- none in Alma: created under id "magpie", removed on switch-off
- preset id taken by another host: left alone, a new one made

Red on the old alma.go: "the user's own Magpie was removed:
[PUT /api/settings DELETE /api/providers/magpie]". Broken by hand:
without the id, "none in Alma" fails ("not under the preset's id");
without the Sync skip, "sync after off wrote [PUT
/api/providers/magpie/models]".

Real Alma (alma-server from /Applications/Alma.app, sandbox HOME and
ALMA_DATA_DIR, port 23917, never the live one): the preset's own POST
body creates id "magpie"; a second POST with that id is refused
500 UNIQUE constraint failed; PUT {"enabled":false} turns it off; DELETE
204; magpie's POST body with id "magpie" and type openai is kept as
sent.

Run at this tree (rebased on origin/main 0ffb21f83), on mica:
go test -tags nogui -count=1 ./internal/agent ok (199s); go vet -tags
nogui ./internal/agent for darwin, linux and windows ok; gofmt -l clean.
The full suite is queued on mote behind another session's run and was
not waited for; a red there gets its own issue.

Not tried: magpie's agent end to end against a running Alma (the calls
were replayed with curl). A user who already has both (magpie's old
random-id provider and Alma's preset) keeps both: threads name
"<id>:<model>", so neither is merged or removed for them, and magpie's
old provider keeps its id.
2026-11-16 00:23:37 +08:00
yetone 99a54fa874 agent: agy's own /model pick no longer costs settings.json its model, and each thinking level is a model in agy (LolingVerse on X)
agy's /model writes its pick into settings.json ("model": "magpie/…")
even when started with --settings magpie-settings.json. The next Sync's
migrate took that for an older magpie's wiring and put back the old
stash: a stale model and "modelProvider": "gemini", or nothing, which
took the user's own model and provider out. That is the wrong restore
point the reporter saw. While magpie-settings.json is already on one of
magpie's models, such a pick is now moved into magpie's file (what agy
starts on next), and settings.json's model goes back to the one
connect.was kept when magpie was switched on, or out. The old stash is
no longer read for it.

agy 1.5.9 turns /effort away for every custom model, one with a
thinkingLevel too. A custom model's thinkingLevel takes low, medium or
high, and agy sends it as generationConfig.thinkingConfig.thinkingLevel,
which the gateway already asks over the row's effort (agyLevelAsked). A
model with two or more of those levels now has a custom model per
level, magpie/<ref>:<level>. The row's model field shows such a pick as
its model, so the switch stays on (agyLevelOf).

Run:
- TestAgyOwnPickKeepsSettings is red on the old agy.go. The levels part
  fails with "level low:". The pick part, with the levels cut out,
  fails with settings.json {"model":"stale","modelProvider":"gemini"}.
  It is green on the new code.
- go test -count=1 ./internal/agent ./internal/cli on mote: ok (agent 259s, cli 67s) at base 139a6be2b.
- GOOS=linux go vet ./internal/agent and GOOS=windows go vet of both packages (cli's Linux vet needs cgo for Wails on a Mac); gofmt -l is
  clean.
- Real agy 1.5.9 in a sandbox HOME against a fake Gemini endpoint:
  - /model lists magpie/openai/gpt-5.5:low/:medium/:high;
  - picking :high wrote settings.json "model" and sent
    thinkingLevel "HIGH" with model openai/gpt-5.5;
  - /effort still says "Effort isn't adjustable" for custom models.

Not tried: a real magpie gateway and account behind agy (the fake
endpoint stood in), and Windows or a WSL distro.

Not changed: the agent-agy plugin has the same two gaps
(magpie-community/plugins#1188). The switch turning itself off didn't
reproduce on the built-in or the plugin.
2026-11-15 23:19:21 +08:00
yetone 4a4424ea84 codex: the takeover note names the phone connection the Codex app loses, beside Keep on ChatGPT (Mugenrikka on X)
Mugenrikka on X: once the Codex quota was used up, Codex opened through
magpie stopped connecting to the phone and the account's profile could
no longer be opened.

Cause. This is the used-up takeover (#540, codex.out): with the active
ChatGPT account held, magpie becomes Codex's provider without
requires_openai_auth, so the app-server's getAuthStatus/account/read
answer no account (codex-rs app-server get_account builds the account
from the provider). ChatGPT.app 26.1029's main process then takes the
host as an "execution-storage" identity, not a "chatgpt" one (its
early-bootstrap: authMethod chatgpt/chatgptAuthTokens -> chatgpt;
authMethod null and requiresOpenaiAuth false -> execution-storage), and
"Connect your phone" (remote control) and the profile go with it. magpie
never touches auth.json; the sign-in is still there.

Nothing can keep both. With requires_openai_auth = true the app reads
the account again, but its composer gate then greys Send for every
model while the account's /wham/usage says not allowed (checked in
b3a57b3d8 against the 26.1029 bundle), which is what the takeover
exists to get past; lifting that would mean faking the account's usage,
which magpie doesn't do. The owner's call (247794c61) is that sending
comes first. The way to keep the phone and the profile is already there:
Keep on ChatGPT on the takeover note (the sign-in's Always ChatGPT), or
keeping Codex signed in to that account (a5e3972a7), at the cost of a
grey Send till the reset.

What was wrong in magpie: the takeover note listed what is off (chats,
projects, browser use, cloud tasks, account, usage, Log out) but not the
phone connection, so nothing told the user why the phone stopped or that
Keep on ChatGPT has it back. The note at the reset, which says what the
app lacks until its app-server restarts, didn't name it either.

Change: both notes name the phone connection, in en, zh, zh-TW, ja, de.
codex.go's openaiAuth comment and agent-wiring.md say what the app does.

Tests: codex-app-out.test.cjs checks the hover and the opened row name
the phone connection; codex-app-back.test.cjs checks the reset note does.
Red on the old assets (new tests, HEAD's app.js and i18n.js, mote):
120 of 144 fail, "the hover says what is off, browser use and the phone
connection too" and "the row opened names the phone connection".

Run on mote at this tree (base b0d634b85): node --test of
codex-app-*, i18n-*, gui-* (de, ja, zh-tw) and codex-signin-always,
Chromium and WebKit, every language, 980 and 440px: 271 of 271 pass.
gofmt -l internal/agent clean; go vet ./internal/agent ok; go test
-tags nogui ./internal/gui ok (TestCoreScriptBudget included). The Go
change is a comment only.

Not tried: a real used-up account in the Codex app with a paired phone
(none at hand); what the app does was read from ChatGPT.app 26.1029's
bundle and codex-rs's app-server, not watched happen.
2026-11-15 18:38:00 +08:00
yetone 2649d5d727 agents: Dim alpha (dima) is an agent, started on magpie's gateway (T_t__biu on X)
Dim alpha (arcships/dim, npm dimcode-alpha, command dima) gets a row on
the Agents page. Picking a magpie model there starts dima with the
variables Dim documents for any OpenAI-compatible endpoint
(docs/design/model-startup.md): DIM_BASE_URL (gateway /v1),
DIM_API_FORMAT=openai-compatible, DIM_API_KEY (magpie-dim), DIM_MODEL
and both DIM_MAX_*_TOKENS (the catalog's, else 128000/32000). They hold
for that run only; Dim's saved Providers, settings and database are not
written. The pick is in magpie's own dim.json; a dima function in the
user's shell profiles runs `magpie dim run`, and the row gives the
command for an open terminal. Picking Dim's own (or Disconnect) removes
both. Nothing signs in to, reads or proxies Dim's own account or the
DimAgent subscription (removed at its vendor's request, v0.1.471).

Run:
- mica, at this tree (rebased on 574b7b96f): gofmt -l clean; go vet (darwin), GOOS=linux
  -tags nogui and GOOS=windows go vet of internal/agent, cli, agentenv;
  go test -tags nogui -count=1 -timeout 45m ./... -> ok, 101 packages. An earlier run on mote
  was red in internal/library's TestEveryAgentInLibrary (dim had no
  Library place); dim is now in noLibrary as "not looked at (#5897)".
- Broken by hand: DIM_API_FORMAT=openai-chat turns TestDim and
  TestDimRun red; dropping shell(false) turns TestDim red (function
  kept in .zshrc).
- Real dima 0.1.0-alpha.24 on mote, sandbox HOME, sandbox magpie serve
  on 127.0.0.1:38600 with a fake OpenAI upstream: `magpie dim
  magpie/fakeup/echo-1` wrote dim.json and the .zshrc function; `zsh -ic
  'dima exec -p "reply with one word"'` answered through the gateway
  (upstream got POST /v1/chat/completions, model echo-1); usage.jsonl
  recorded agent "dim"; `magpie dim default` removed the file and the
  function, and dima ran as npm installed it. Dim's home was never
  written by magpie.

Not tried: a real model provider (only the fake upstream); Windows and
WSL runs (the shell function is this machine's home only, no WSL
distro support); a Library target (skills, MCP, instructions; #5897); Dim's interactive TUI beyond
exec -p and --version.
2026-11-15 17:16:57 +08:00
yetone 9cd5f36521 antigravity: retired, the built-in and its plugin both ask Google nothing; Antigravity is served by your own agy (agy-cli)
Google bans accounts it sees on Code Assist through Antigravity's own
client. magpie offered that route twice, the built-in and
@magpie-community/opencode-antigravity-auth, and anyone who picked
Antigravity in magpie took it by default (the owner, 11-15: 全部下线,改推
agy-cli).

- retiredBuiltins has antigravity. googleLogins lists no account of a
  subscription its plugin serves, so no list, usage read, quota read or
  request goes to Google with a built-in Antigravity account (the usage
  loop in subscription_usage.go had no gate of its own). The mover reads
  googleSavedLogins, so saved accounts still move.
- The mover's min is 0.2.0 (on the plugins dist index, b8bf5a57): that
  version sends nothing, answers every request 410 ModelDeprecated
  ("model has been retired", which modelRetired reads, so a group asks its
  next member) naming Antigravity (local agy CLI) and
  `magpie plugin add @magpie-community/opencode-agy-cli-auth`, and turns
  sign-in away. It left the plugins registry (003a38ff).
- Gemini CLI's route, on the same code, is unchanged.
- The built-in's code stays for now (shared with Gemini CLI); taking it
  out is #6723. Its 123 tests serve it again for their run through
  provider.AntigravityBuiltinForTest(), a counter BuiltinRetired reads.
- README (en, zh) and site docs subscriptions (en, zh, ja) point to
  Antigravity through the user's own agy CLI. AGENTS.md and
  provider-plugins.md say why and that neither route comes back.

What users lose: Antigravity with Google accounts signed in to magpie, and
rotating several of them. agy-cli serves the one account the user's agy is
signed in to, and needs agy installed.

Tests: TestRetiredAntigravityAsksGoogleNothing saves an Antigravity
account and checks googleLogins/googleAccountOf give nothing, the mover
still carries it, usage has no Antigravity card and the fake Google was
asked nothing, and Gemini's account still lists. Broken by hand (the
PluginServes gate removed from googleLogins): red,
"googleLogins(antigravity) = 1 accounts".

Run (mote/mica, at this change on origin/main 5bd41301b): gofmt -l clean;
go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet
./... and go build ./... ok; go test ./internal/gateway/ (1245s),
./internal/agent/ (419s), ./internal/provider/ (253s) ok on mica;
after rebasing on origin/main f362d3b9a: go test ./internal/provider/
(160s) and ./internal/plugin/ (184s) ok on mica.
Earlier at this change minus the test opt-ins: sessions, usage, library,
gui ok (mica). internal/cli's TestEveryRouteHasACommandOrIsNamed is red at
5bd41301b itself (/api/warm-all, #6724), not from this change.
Not run: the full ./... suite (mote and mica each had another session's
full or GUI suite); the GUI suite (no app.js change); a real move of a
built-in Antigravity account onto 0.2.0.

Plugins side: magpie-community/plugins 003a38ff (antigravity 0.2.0) and
f9155256 (agy-cli 0.1.56, comments only).
2026-11-15 12:14:48 +08:00
yetone a5e3972a71 agent: the Codex account the user keeps Codex on is never taken over when held, so the app shows it, not "magpie" (davezfr on X)
davezfr on X, after v0.1.4216 (369ec0418): "still shows Magpie". Account
1 has used up both its plan allowance and its credits; picked in Codex's
sign-in it shows "magpie" in the Codex app, while account 2 (room) shows
itself. When it still had credits this didn't happen.

Cause. With quota and credits both gone the account is held (codexHeld:
rate_limit.allowed false, no credits), and the agent package's out()
then makes magpie Codex's provider (codex.out takeover, #540) without
requires_openai_auth. Codex's app-server answers account/read with no
account for such a provider, so the app shows the provider's name,
"magpie", in place of the account the user picked. 369ec0418 only
ended stale holds at their window's reset; a real hold still took the
account over. The takeover is magpie's default; the account the user
keeps Codex signed in to is the user's own value, which the default
overrode (code standards: magpie's default never overrides a value the
user set).

Fix.
- provider.CodexSignInKept: Codex is on the account the user keeps it
  on (keepsLogin: KeepLoginAs names the active account, or kept on the
  first with none named). False under switch-only, keeping off, or kept
  on another account than the active one.
- agent: out() is false for such an account (codexSignInKept, a var
  for tests), so Sync leaves Codex beside its ChatGPT sign-in, a pick of
  magpie's model doesn't take it over, and a takeover made before the
  keep ends. The app shows the account and greys Send till its reset,
  as it does without magpie. Not kept, a held account is taken over as
  before (Always ChatGPT still turns the takeover off for every account).
- docs/subsystems/agent-wiring.md says so.

Users already affected: once updated, the next catalog sync puts Codex
back beside the kept account's sign-in; the Codex app shows the account
after its app-server restarts (the Agents row's Restart, or Restart the
Codex app to follow), as for the takeover's end at a reset.

Tests:
- TestCodexKeptOnAHeldAccountShowsIt (agent): held and not kept: the
  takeover; kept: beside the sign-in, no AppOut, on magpie's model and
  on Codex's own joined model; let go: taken over again.
- TestCodexSignInKept (provider): the reporter's state, two accounts,
  account 1 held (week at 100%, not allowed, no credits) and kept via
  SetKeepLoginAs: CodexUsedUpKnown true and CodexSignInKept true; kept
  on account 2 while on 1, switch-only, keeping off: false.
Broken by hand: with `&& !codexSignInKept()` taken out of out(),
TestCodexKeptOnAHeldAccountShowsIt red (model_provider = "magpie"
written); with CodexSignInKept's match turned to false,
TestCodexSignInKept red ("CodexSignInKept false").

Run: full suite `go test -count=1 -timeout 45m ./...` on mote at this
change on ca64168d3: exit 0, 101 packages ok, no FAIL (log kept whole
in magpie-wt/codex-held-account-scratch/suite.log). After rebasing on
6e6a18eda (gateway only): internal/agent ok, internal/provider ok on
mote. gofmt -l clean; on mica go vet (darwin), GOOS=linux -tags nogui
and GOOS=windows go vet ./internal/agent ./internal/provider ok.

Not tried: the real Codex app with a real held account, and the
reporter's exact setting (if account 1 was picked by a plain switch
rather than kept, magpie moves Codex off the held account to account 2
at its next look, as before, and the takeover stands meanwhile).
2026-11-15 07:39:25 +08:00
yetone f1c9014cd9 wsl, masking: a hung WSL or a slow local model no longer holds requests
vsoullai on X (0.1.4190, Windows): the gateway froze. Each request waited
15s in turn on the local masking model, routing was held 30s and got a
504, and a stopped WSL distro's probe dragged everything down until
redactModel and WSL were turned off. #6167 (Codex held 30s then 504,
fixed by restarting WSL) and #4856 (masking timeouts, 504s) are the same.

WSL (internal/agent/wsl.go, wsl_links.go):
- wsl's lock was held through wsl.exe and through the stat of
  \\wsl.localhost\<distro>, which can't be cancelled. The GUI's look held
  it, and every request's Codex/Claude stand-in, wslUp, distroAt and
  Copilot's WSL folders queued behind it.
- A look (wslRefresh) now runs wsl.exe, the probes and the stat outside
  the lock. Looks take turns on wslRefreshMu, and the lock only guards
  reads and writes.
- wslRoot's stat is bounded (wslRootWait 5s); a distro whose / can't be
  opened fails its probe and is tried again later.
- What a request asks never waits on a look. "Which distros run" is
  asked single-flight in the background and waited for at most
  wslRunningWait (2s). A distro wsl.exe hasn't named as running counts
  as stopped, so nothing opens or wakes a distro on a guess.
- Copilot's WSL sign-in (internal/provider/copilot_cli.go) is read the
  same way: single-flight, waited for at most copilotWSLWait (2s), with
  the last answer kept. Before, its own mutex queued every request
  behind the first one's read.

Masking (internal/masking/masking.go):
- With redactModel on, each request waited up to strictWait (15s). In a
  burst the backlog grew and the requests waited one after another.
- Once a strict request runs out its wait with texts unread, the model
  is "behind". The next requests then wait only defaultWait (2s) until a
  request is read whole or a minute passes (behind, waitFor). The rules
  still mask everything the model hasn't read.

Docs: docs/subsystems/agent-wiring.md (WSL twins) and gateway-routing.md
(masking).

Run:
- New tests, on mote, -race -count=3: TestWSLHangHoldsNoRequest (wsl.exe
  --running, a distro's probe, the stat; each hang injected),
  TestWSLRootHangFailsProbe, TestCopilotWSLHangHoldsNoRequest and
  TestStrictModelBehindWaitsTheDefault, with the other WSL, Copilot WSL
  and masking tests. All ok.
- Broken by hand: the same tests on the old code (origin/main's files
  with only the new tests added). Each WSL hang case failed ("a Codex
  stand-in waited on a hung WSL past 2.2s", "the GUI's look didn't wait
  on the hung WSL"). The Copilot test failed ("13 requests waited on a
  hung WSL past 2.2s"). The masking test failed ("request 2 after the
  model fell behind waited 2.0s").
- Full suite on mica at f08597a58 (this change on b754cb095):
  `go test -timeout 45m ./...`, exit 0, 101 packages ok.
- Rebased on f03869520 (a gateway/provider change). At this head, on
  mica: go test -count=1 ./internal/agent ./internal/provider
  ./internal/masking ./internal/gateway all ok, go vet ./internal/... and
  GOOS=windows vet of those four ok, gofmt clean. The full suite ran at
  the base before it, not again at this head.
- Rebased again on c0cf352a8 (four commits: gateway, provider Codex
  hold, providers base URL, LESSONS). At this pushed head, on mica:
  go test -count=1 ./internal/provider ./internal/masking ok, the WSL and
  Copilot tests of internal/agent ok, go vet of agent, provider and
  gateway (darwin and GOOS=windows) ok.
- gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and
  GOOS=windows: ok.
- Windows (xiaomi-gpu, win-run), internal/agent, internal/provider and
  internal/masking. masking: ok. agent and provider: 52 reds, all in the
  53 that origin/main f03869520 has on the same box (#6068, #1827,
  #5068, #5344, #5950; this run's list is on #6068). None touch WSL,
  Copilot's WSL or masking.

Not tried: a real hung WSL. On xiaomi-gpu, wsl -l -q and -l --running
answered in ~55ms, and a terminated distro's \\wsl.localhost path failed
in 131ms, so the hang was injected in the tests, not reproduced live.

(vsoullai on X, #6167, #4856)
2026-11-15 06:20:15 +08:00
yetone ec8125e680 agent: Kimi Code's thinking level is picked in Agents
@apple_test_src on X: every other agent has a reasoning-effort pick,
Kimi Code didn't. Kimi Code 2.x keeps its startup level in
config.toml's [thinking] table (read from @moonshot-ai/kimi-code 2.6.2's
source: ThinkingConfigSchema, persistModelSelection,
thinkingEffortFromConfig). The new "thinking" field writes it the way
Kimi's own /model does: off = enabled=false (effort kept), a level =
enabled=true + effort, Default removes both keys (and the table when
empty). Options come from the chosen model's support_efforts /
default_effort / capabilities, overrides first; "off" is left out for
an always_thinking model; unknown model or unreadable file gives
off/low/medium/high. A cold WSL place reads nothing (#3896). The legacy
Python kimi-cli gets on/off through its top-level default_thinking.

Run:
- Real Kimi Code 2.6.2 on mote, sandbox HOME and
  KIMI_CODE_HOME, fake chat server, config written by this field's Set:
  Default sent thinking {enabled, effort medium (model default)}, off
  sent {type: disabled}, low and max sent those efforts.
- mica-run at bba704222 (rebased on fdf42299e): go vet ./internal/agent native,
  GOOS=linux, GOOS=windows ok; go test -count=1 ./internal/agent
  ./internal/gui ok; gofmt clean.
- mica-run GUI: kimi-thinking (new), agy-effort, i18n-keys and the
  agent-field / codex-default-effort / effort files, Chromium + WebKit,
  en/zh/zh-TW/ja/de: 114/114 pass.
- Broken by hand: dropping override handling and leaving enabled behind
  on Default turned TestKimiThinkingField red. The first version opened a
  stopped distro's config and TestWSLColdPlaceOpensNothing went red; fixed.

Not run: the full go test ./... (mote and mica both had other sessions'
suites running), the legacy kimi-cli binary (its source only), a real
Moonshot account.
2026-11-15 03:12:36 +08:00
yetone df4578438e models: a model listed bare takes what models.dev says, audio too
Parlevent_ on X: Gemini served through magpie from Vertex AI was listed
as taking text and images only, never audio. Vertex AI's models, and a
relay's, come from a list that says nothing of what a model takes, so
the entry had no input kinds and every agent's fallback said
text+image (provider.Entry.Modalities' Images branch).

catalog.InputsOf is now what most of models.dev's providers list a
model with, by bare id, as SeesImages, ContextOf and the others are
voted. provider.InputsOf uses it when the model's own source said
nothing of input (InputModalities and ImageInput both nil); a source's
own word, a plugin's included, still stands, and the image kind still
follows Images (the user's override included). The GUI's model row and
every agent's list read it through the Entry. OpenCode is now told
audio, video and pdf where the model takes them (its modalities enum
holds all five), not text+image only.

So Vertex AI's gemini-3.5-flash is text, image, audio, video, pdf;
gpt-oss-120b-maas there is text; a relay's bare gemini-3.5-flash is the
same as Vertex AI's. A model models.dev doesn't know stays unknown.

Also: a video sent to a bare-listed model models.dev lists without
video is now refused at magpie ("does not support video input") as it
is for a model whose own list says so, where it went upstream before.

Run (mica, mica-run):
- the new tests: TestGeminiTakesAudioWhereverServed (provider),
  TestInputsOf (catalog), TestOpenCodeInputs (agent): green; red on
  e9fcc6229 with the old code (vx/gemini-3.5-flash takes [text image],
  OpenCode told [text image])
- go test -count=1 -timeout 45m ./... at e9fcc6229 + this change:
  98 ok; red in . (TestNoEagerPackageRegexps, chatpage.go: #6689),
  internal/cli (/api/providers/delete, fixed in 4c86b0ab4) and
  internal/gateway (TestKeySlotEveryRoute and LazyCat manifest, the
  /deepseek-chat routes, fixed in cd030691a), none in code this touches
- again at 677034e1a + both commits: internal/cli, gateway, catalog,
  provider, agent, gui ok; . red only on #6689
- go vet ./..., GOOS=linux go vet -tags nogui ./...,
  GOOS=windows go vet ./...: ok; gofmt -l clean

Not tried: a real Vertex AI account; Codex, Pi, dsh and omp still take
text and image only, as their configs have no other kinds.
2026-11-15 01:25:49 +08:00
yetone 04ca2afab2 netproxy: Auto reads a Linux desktop's proxy, GNOME's and KDE's (#4147)
On Linux, Auto read no system proxy at all (system_other.go answered
none), so with Clash Verge's system proxy on, magpie opened from the
desktop's menu, with no *_PROXY, went direct and Settings said "No
system proxy found". The user had to type the proxy into magpie and
take it out again when they turned the proxy off.

system_linux.go reads the desktop's own setting, where its apps and
Clash Verge (sysproxy-rs) put it:
- GNOME (and Cinnamon, MATE, Budgie): `gsettings list-recursively
  org.gnome.system.proxy`, mode 'manual' only; HTTPS over HTTP over
  SOCKS, ignore-hosts as the bypass list.
- KDE: ~/.config/kioslaverc (XDG_CONFIG_HOME), ProxyType=1 only, its
  "http://127.0.0.1 7897" address form, NoProxyFor unless reversed.
  Read first on a KDE session, else after GNOME's.
No gsettings, or no GNOME proxy schema, is none; a gsettings that fails
otherwise is a failed read, which keeps the last good one as on macOS.
PAC ('auto', ProxyType=2/3) is not read, as on macOS and Windows.

Codex's view is unchanged on Linux: its reqwest reads no desktop
setting there, so codexProxyFor takes no system proxy unless on macOS
or Windows (codexSystem), with test cases that fail without it.

Not a timezone or language guess (the X ask from jimlee0824v2): it is
wrong for anyone travelling, on a VPN or a TUN, and the system's proxy
is what says whether one is on.

Run:
- red on the old code: TestSystemReadsGnome, TestSystemReadsKDE and
  TestSystemWithoutDesktopProxy (3 of 3); the two Linux cases of
  TestCodexProxyFor with the old codex_proxy.go.
- real gsettings on Ubuntu 24.04 (WSL magpie-desktop) under
  dbus-run-session with a temp XDG_CONFIG_HOME set to manual
  127.0.0.1:7897: system() gave http://127.0.0.1:7897, bypass
  [localhost 127.0.0.0/8 ::1]. The distro's own setting not touched.
- mica-run: go test ./internal/netproxy ./internal/agent ok; go vet of
  both for darwin, GOOS=linux and GOOS=windows ok.
- wsl-run: go test -run 'Proxy|Gsettings|Kioslaverc|TestSystem|Codex'
  ./internal/netproxy ./internal/agent ok.
- win-run: go test ./internal/netproxy ok.
- gofmt -l clean.
Not tried: a real KDE session (fixture from sysproxy-rs' format), the
GUI on a Linux desktop.
2026-11-15 01:18:58 +08:00
yetone 411769e9c7 library: GitHub Copilot gets the Library's instructions with VS Code or JetBrains alone
@codealc on X (0.1.3827, Windows, Codex with Copilot as the provider):
资源库 › 指令 has no way to give GitHub Copilot instructions. The only
Copilot row was Copilot CLI's, listed only when the CLI was detected
(settings.json or the copilot command) and not uninstalled, so a user of
Copilot in VS Code or JetBrains saw none.

Which file Copilot reads, from each surface's own source:
- Copilot CLI 1.0.95: $COPILOT_HOME/copilot-instructions.md, else
  ~/.copilot/copilot-instructions.md (run for real, below).
- VS Code (microsoft/vscode d95071e96, promptsServiceImpl /
  computeAutomaticInstructions): ~/.copilot/copilot-instructions.md, plus
  ~/.copilot/instructions/**/*.instructions.md; its docs' reference table
  gives the same for the Copilot harness's user scope.
- GitHub Copilot for JetBrains 1.21.0 (javap of the plugin's classes):
  getCopilotCliHomePath() (COPILOT_HOME, else ~/.copilot) +
  copilot-instructions.md.

So Copilot CLI's agent now has shared "GitHub Copilot" (as Cursor CLI's
~/.cursor is the Cursor editor's) and a sharedApp check: VS Code, VS Code
Insiders, or the JetBrains plugin is here. agent.SharedRead says so;
SharedHere is true with it even before ~/.copilot exists, and
targetsAsleep keeps a CLIMissing agent whose folder such an app still
reads. The Library's row is named GitHub Copilot; the agent stays Copilot
CLI on the Agents page. SharedName also names Copilot CLI's chats in
Sessions, which are now "GitHub Copilot" as Cursor CLI's are "Cursor".
The user's own text in copilot-instructions.md stays outside magpie's
block, and comes back whole when magpie's instructions are emptied.

Tests (internal/library/copilot_shared_test.go): row named GitHub
Copilot; VS Code alone (no ~/.copilot) gets the row and the file written
without making Copilot CLI detected; JetBrains plugin alone; the user's
own file kept; CLI uninstalled with VS Code still here keeps the row,
with nothing reading it drops it; COPILOT_HOME followed.
TestCursorIsCursorCLI and TestCursorFolderFromTheEditorIsNotTheCLI now
allow Copilot beside Cursor.

Run:
- The six new tests on the old code (source files checked out from
  aa358555f, new test kept): all six red. Broken by hand: the
  targetsAsleep `&& !a.SharedRead()` taken out turns
  TestCopilotCLIGoneVSCodeKeepsTheRow red.
- go test ./internal/library -run Copilot on win-run (Windows 11) and
  wsl-run (Ubuntu 24.04): ok.
- Real Copilot CLI 1.0.95 with COPILOT_HOME at a scratch folder (signed-in
  config copied there, cwd an empty folder), copilot-instructions.md
  holding a user section and magpie's block with a codeword: copilot -p
  answered the codeword; without the file it answered NONE.
- gofmt -l internal: nothing. go vet ./..., GOOS=linux go vet -tags nogui
  ./..., GOOS=windows go vet ./... (mica): ok.
- Full go test -timeout 45m ./... on mote at f32bdee76 (rebased on
  0b8c4bfc3): 99 ok, red only TestEveryRouteHasACommandOrIsNamed
  (#6677, POST /api/providers/delete) and TestEveryWordHasZh (#6686, "permission
  mode"), both red alone on a fresh origin/main 221c91fae.
- Rebased on 221c91fae (6 commits, none in internal/library or the
  agent files here): library, agent, cli, tui and gui packages again at
  6946baa72: library, agent, gui ok; cli and tui red only on #6677 and #6686.
- Rebased on a4dd893af (5 commits in gui/admin, gateway, docs; none in
  library or agent): library, agent and gui again at the pushed head: ok.

Not changed: no GUI file; the row's name comes from the server.
Not tried: VS Code and JetBrains reading the file for real (read from
their source only).
2026-11-15 00:23:13 +08:00
yetone 0b8c4bfc34 agent: Claude Code's permission mode is set in magpie and kept (EricChenChannel on X)
The report: "every time I configure settings.json it is overwritten and
reset" for permissions.defaultMode = bypassPermissions.

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

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

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

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

Not run yet: the full go test ./... and the full GUI suite. Both machines
had another session's GUI suite running; they run next and their result
goes on the follow-up. Not tried: a real Claude Code session's /config
changing the mode back (Claude Code's own write; this change can't stop it).
2026-11-14 23:11:16 +08:00
yetone ed82d8fab1 agent: a plugin's connect is given magpie's decision models as decisionModels
An agent plugin's connect() got only chat models in `models`, and
/v1/models leaves decision models out too, so a plugin had no way to
learn magpie's Jev, Clef or plugin `decides` models, though
/v1/systemone and /v1/decisions answer them (baranwang on X,
tweet 2121551068022915149).

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

Run at 87f358b70's tree rebased on 659ca3f02 (a gateway-only parent; the
plugged tests re-run there: ok), on wsl-run, magpie-desktop; mote was at load 75-150, mica's disk full):
- go test -tags nogui -count=1 ./internal/agent ./internal/agentplug: ok
  (agent 191s)
- go vet (linux), GOOS=windows and GOOS=darwin go vet of both: ok
- site: node --test worker.test.mjs -n llms-full: ok
- gofmt -l: clean
Broken by hand: connect given decisionModels [] makes
TestPluggedConnectSeesDecisionModels red (jev and the group missing).
Not run: the full go test ./... before the tag (another session's full
suite held the WSL box, mote over its load); run after, recorded on
the issue/next commit. No real third-party agent plugin tried with it.
2026-11-14 18:55:12 +08:00
yetone 9f4e1120f3 agent: a Codex not connected is never pointed at magpie for account failover
TylerBai_loveai on X (tweet 2121532671180632290): with several ChatGPT
accounts added in magpie and Codex not connected, Codex's requests went
through magpie anyway; only adding Codex in Agents, then Disconnect,
put it back.

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

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

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

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

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

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

Not tried: a real Codex with real ChatGPT accounts across the update
(sandbox HOME tests only), Codex in WSL, Windows.
2026-11-14 18:40:09 +08:00
yetone 81825ed81d agent: fx gets each model's reasoning levels through magpie (@beillusyn on X)
fx through magpie had no effort to pick: magpie wrote its models into
fx's settings without levels, so fx sent no reasoning_effort and every
model ran at its vendor's default.

fx 0.0.17 reads a model's reasoning_efforts in model_metadata (level
name to request fields, listed in /effort and Ctrl+T). magpie now writes
each model's catalog levels there, weakest first, each asked as
{"reasoning_effort": <level>}. Levels fx refuses are left out: auto,
adaptive, default (its word for "none picked"), names outside
[A-Za-z0-9._-]{1,64}, duplicates, and past 16 a model. With no level
picked fx sends none and the vendor's default applies, as before.

fx 0.0.16 refuses an unknown model_metadata key (UnknownField) and with
it the whole settings file, so the levels are written only when fx at
the place says 0.0.17 or later (~/.local/bin/fx, else fx on PATH; a
version not 0.x is the JSON viewer also named fx). An unknown version
gets no levels, and a sync after fx is upgraded writes them. fx's own
effort setting (top level and per workspace) is the user's and stays.

Left alone: fx inside a WSL distro has no version probe, so it gets no
levels (#6636).

Run:
- go test ./internal/agent -run 'TestFx|TestWSL' on mica: ok.
  TestFxEfforts (exact ordered JSON at 0.0.17, the user's effort and
  workspace effort kept, levels gone at 0.0.16 and unknown, back at
  0.0.18), TestFxEffortNames, TestFxVersionIsTheAgents.
- Broken by hand, each red: fxTakesEfforts always true (TestFxEfforts),
  no 0.x check (TestFxVersionIsTheAgents), a sorted map for the levels
  (the order checks).
- Real fx on mica, sandbox HOME, magpie-written settings, a fake chat
  completions server: fx 0.0.17 dev (3c8fab37) --effort high sent
  reasoning_effort high; no effort sent none; --effort xhigh on a model
  without it said so and sent none; --effort none sent "none". fx 0.0.16
  with the levels failed with UnknownField; without them it worked.
  fxVersion read the real binaries as "0.0.17" (takes levels) and
  "0.0.16" (doesn't).
- Full suite on mote (mica out of disk) at d987cc7d5 plus this change,
  -timeout 45m: 98 packages ok, two red. TestNoEagerPackageRegexps
  was this change's package-level regexp, now lazyre.New; after it,
  that test and TestFx/TestWSL ok again at origin/main 75f872ef1.
  TestEveryRouteHasACommandOrIsNamed (POST /api/page-away, from
  80a315a70) is red on main and fixed in the next commit.
- GOOS=linux and GOOS=windows go vet ./internal/agent on mote: ok.
  gofmt -l clean.

Not tried: fx in WSL; a real vendor through the real gateway.
2026-11-14 17:48:48 +08:00
yetone 667ac8bd6f settings: a look at one setting takes the shared settings, not a copy
settings.Load() copies the whole Settings (clone + deepCopy of every map
and slice) for each caller. 133 places read one field of it and threw
the rest away: the proxy for every outgoing request (netproxy), the
GitHub token, the China mirror switch, a model's output cap, wire or
price on a gateway request. With a real account in the tray, Load's
clone was 26.6 MB of the 318 MB the process allocated in its first
seven minutes, most of it through netproxy.For on each request.

Each of them now reads settings.Shared(), the read-only settings every
caller is given for the same settings.json. Only reads were changed:
a scalar field (string, bool, int, float) or a map field's index
read. A caller that keeps a whole map or slice, or calls a method on
the settings, still takes Load's copy.
2026-11-14 14:02:49 +08:00
yetone 6cc70b2b3c agent: deskCatalog cleans an absolute /-spelled path too (#4785)
Dopetaiga's 3751d6cb3 made ownCatalog clean an absolute catalog path, so
a /-spelled one names magpie's list on Windows. deskCatalog, the same
predicate for the Codex app's list, still joined dir onto an absolute
path and never matched one. With the app gone, Sync left
model_catalog_json naming a list it had removed. It now has the same
shape; the WSL spelling keeps its branch.

Run on Windows 11 (xiaomi-gpu, win-run, -tags nogui):
TestCodexSyncMendsGoneCatalog, TestCodexDesktopListSlashSpelled (new),
TestCodexOwnCatalogGoneNotPutBack and TestCodexDesktopList.* are ok at
this tree. With main's codex.go, not_the_provider and the new test are
red. With 3751d6cb3's codex.go (ownCatalog fixed, deskCatalog not), only
the new test is red. On macOS the bug is not visible (/ is the native
spelling there).

Batch record (ggbdpq's five patches #3254 #3356 #4258 #6391 #4785 and
the two follow-ups), on mica through suite.lock:
- At 8c58d9b0b (base 7b002b6be): gofmt -l clean; go vet ./... on darwin,
  windows and linux (nogui) ok; builds ok;
  go test -tags nogui -count=1 -timeout 45m ./... exit 0, 99 packages ok.
- Rebased onto 27c998aba (12 commits, no file in common) at 0806a4fe8:
  vet on all three OSes ok, and internal/agent, internal/provider and
  internal/davsync are ok. Rebased again onto aba6aeac2 (a provider
  balance-history commit, no file in common): at this tree, go vet
  ./internal/... (plus windows for agent, provider and davsync) is ok,
  and internal/provider, internal/agent and internal/davsync are ok.
- Ablations: each new test is red with its product file reverted to main.
  The Windows ones ran on xiaomi-gpu.
Not tried: a real two-process forget, and a real WebDAV server.
2026-11-14 13:14:36 +08:00
yetone f62e93b8aa agent: Claude's Unwire gives up the stashed model in every case (#4258)
The #4258 patch kept the model in the stash until the write that puts it
back or takes magpie's out has gone through. When neither write runs (the
stash kept one of magpie's models and the user has picked their own
since), the model stayed stashed after the Unwire. Before the patch,
unroute's unstash always took it out. It is now forgotten after the
switch in every case that returns nil, which is main's behaviour with
#4258's ordering.

Run (mica, at this tree): TestClaudeDisconnectLeavesNoModelStashed is ok
here and ok at main's claude.go, codex.go and stash.go. With 46b365337's
claude.go alone it is red ("the stash still holds a model after the
Unwire: relay/glm-4.6"). TestDisconnectFailureKeepsStashedOriginals is ok.
gofmt -l clean; go vet of internal/{provider,davsync,agent} on darwin,
GOOS=windows and GOOS=linux is ok.

Not changed: the other agents' restore paths, filed as #6601.
2026-11-14 13:08:40 +08:00
Dopetaiga f12a1f79d8 agent: ownCatalog cleans an absolute /-spelled catalog path on Windows (#4785)
A config.toml naming the catalog with an absolute /-spelled path was
not recognised as magpie's own: the raw string matched neither the
base-name ref nor the \ spelling, so Sync left the key in and Codex
could not load its config once the list was gone. Clean the absolute
path too; on Windows that turns its slashes into the native ones.
The WSL spelling keeps its own branch.
2026-11-14 13:08:40 +08:00
ggbdpq 1dbd3bb07c agent: a Disconnect whose restore write fails leaves the originals stashed
skygunner (#4258): Claude and Codex unroute took the stashed originals
out of the stash before the config write that puts them back, so a write
that failed (a full disk, a file a watcher held) lost them for good, and
a retry had nothing to put back. The same shape was in Claude's
putClouds, and the model's original was taken out before the write that
restores or replaces it, which comes after unroute.

The originals are read with peek and taken out by forgetValues only once
the write has gone through, each only while it is still the value peeked:
one a concurrent change wrote since stays stashed. The model stays stashed
for the caller: Unwire takes it out after its write, and picking a model
of the agent's own after it.

A file that doesn't parse is copied aside before it is written over, as
it was (lastgood.KeepUnparsed); a change reports nothing new. The same
take-out-before-put-back shape in the other agents' restore paths (agy,
antigravity, cline, claudedesktop, astrbot) is left as it is.

Run (worktree at base a8fa771a6):
- go test ./internal/agent -run TestDisconnectFailureKeepsStashedOriginals:
  ok, both computers; broken by hand: forgetValues called before the
  write (claude, injected) puts the failure back
- go test ./internal/agent: ok
- gofmt -l: clean; go vet ./internal/agent: clean

Generated-by: GLM-5.3-Flash (ZCode)
2026-11-14 13:08:40 +08:00
yetone c51b0ca9fa sessions: the Antigravity app connected to WSL has its usage read from the distro (@guyng35955 on X)
@guyng35955 on X: on Windows, with the Antigravity app connected to a
WSL Ubuntu, magpie showed no Antigravity usage.

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

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

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

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

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

Not tried: a real Antigravity sign-in connected to WSL (the box's app
isn't signed in, and the connection needs its GUI), so the language
server's own files are this fixture, laid out as its source writes
them; the full suite (five full suites were queued on mote's
suite.lock and two on mica's).
2026-11-14 12:27:25 +08:00
yetone c5b40bf898 claude-desktop: after Use Claude Magpie the lit row is Claude Magpie, and its Code tab's row says it is on magpie (xMopf7RF on X)
xMopf7RF on X, 0.1.4111: clicking Use Claude Magpie seemed to connect
their own Claude Desktop, and left "Claude Code · Claude Magpie" saying
"Not connected · uses its own settings" with its switch off.

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

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

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

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

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

Not tried: a real Claude Magpie.app in a sandbox HOME on this change
(005178104 did one for the button itself); this change only names rows
and reads the same wiring.
2026-11-14 11:42:50 +08:00
yetone 14f0046e7d agent: Pi's offered thinking levels are kept per stamp, as the model lists are
v0.1.4108 kept the drift poll's "is this value magpie's" answers. After it,
real accounts on mote (acgui6, w75, the window open) showed the poll's
cost had moved into Pi's Values: piOffered on every Drift, every 15s.
Each call walked the agent's model list and built the model's whole
models.json entry, which reads settings again under GroupHasNative. That
was 23 MB of the window's three minutes.

piOffered is now kept per agent and model in a stampedLists, as
sharedModels is: built again when provider.StampNow moves, or a minute
after it was. Its callers (Pi-like Values, their effort options, Aside)
only read it.

Run: TestPiOfferedKeptPerStamp (new), TestThinkingWithoutLevels* and the
Pi tests on mica. Broken by hand (the kept entry dropped on every call):
red, "built again while nothing changed".

Suite on mica at this commit: gofmt clean; go vet internal/agent for
darwin, linux and windows; go test ./internal/agent ok (281.1s).
2026-11-14 10:09:47 +08:00
yetone 8ce32d7008 agent: the window's drift poll remembers which values are magpie's per stamp
/api/drift runs every agent's Drift every 15s while the window is up.
Each Drift asked every field's whole option list whether a value is one
of magpie's, and the model lists under them are built again once a
minute. With real accounts on mote (acgui6, w74), that was 27 MB of the
50 MB magpie allocated in three minutes with the window open.

DriftShown, which only /api/drift calls, keeps magpieValueIn's answer per
agent, field, value and settings while provider.StampNow stays the same,
5 minutes at most. Drift is unchanged for Reapply, rewiring, a launch and
/api/state, which act on the answer.

A provider resting or a model retired by its date is something the stamp
can't see. The window's drift row now shows that within 5 minutes, not 1.

Run: TestDriftShownAsksAValueOncePerStamp and the Drift tests on mica.
Broken by hand (the memo never hit): red, "five polls built the options
5 times, want 1".

Suite on mica at 6c88d61f0 + this commit: gofmt clean; go vet
internal/agent for darwin, linux and windows, internal/gui on darwin; go
test ./internal/agent ok (194.9s); ./internal/gui red only in
TestCoreScriptBudget (1269382 > 1268961). That test is red on
origin/main 6c88d61f0 as well, and #6518 is taken. This change adds no
script.
2026-11-14 09:58:49 +08:00
yetone 70bd270ae2 agents: Antigravity says how its own sign-in's models come back on magpie (T_t__biu on X)
T_t__biu on X: once magpie wires the Antigravity app, the Gemini models of
their own signed-in Google account leave the app's model list. Cause: magpie
connects the app through Google's Enterprise Gateway (gateway block in
~/.gemini/config/config.json and ~/.antigravity/settings.json). On a gateway
the app's language server runs in AUTH_MODE_ENTERPRISE_GATEWAY and drops the
Google sign-in (Google's docs: the two can't be used at once), so Code
Assist's fetchAvailableModels, which listed the account's models, is never
asked. No key in the file keeps both.

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

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

    providers:
      magpie-responses:
        reasoning: high

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

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

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

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

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

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

Risk: a start written before this release has no record. If its effort
differs from a route level the user set, it is taken for magpie's and
removed once, even if dsh had saved it.
2026-11-14 02:02:33 +08:00
yetone 1730c75b97 library: Claude Magpie is an agent of its own (xMopf7RF on X)
xMopf7RF asked for Claude Magpie, the separate Claude Desktop, to show
on its own in the Library's instructions, skills and MCP, like an
independent agent. Before, Claude Desktop's target wrote its servers
(DesktopConfigs3p) and Cowork skills (desktopdir.Everywhere) into
Claude-Magpie-3p too, and the twin's Code tab folder
~/.claude-magpie-desktop (a claude# row) got nothing from the Library.

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

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

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

Filed: #6558, a row's chips reach past its edge at 420px (ja with four
agents, before this too with six); the twin test skips that check for ja
at 420px until it is fixed.
Not tried: a real Claude Magpie.app on a desktop reading the new files.
2026-11-14 00:01:24 +08:00
yetone a97c8191bc workbuddy: with the provider left out of the names, a model's id is its name (elis_pina on X)
WorkBuddy's model list read "GLM-5.3:workbuddy/glm-5.3" with Provider in
model names Off. WorkBuddy (5.5.6 renderer, getModelDisplayName) shows
every custom model as "name:id" unless the name is empty or equal to
the id, and magpie wrote the catalog id (provider/model) as the id. So
the provider came back after the colon whatever the names said.

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

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

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

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

Not tried: WorkBuddy's window itself (the name:id rule is read from
its renderer source, not seen on screen), and WorkBuddy AI's app.
2026-11-13 22:49:39 +08:00
yetone 0051781044 claude-desktop: a new Claude Magpie leaves the original alone, its own Claude Code folder included (xMopf7RF on X)
xMopf7RF asked for Claude Magpie to be a full clone, like an Android
app twin: making it from magpie must not wire their own Claude Desktop
or touch its config. In a sandbox HOME on mote with the real Claude.app
(`launcher add`, then `claude-desktop magpie`, as "Use Claude Magpie"
does), origin/main f798b4eb7 left Claude's and Claude-3p's files
byte-identical, but:

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

Decided (product calls are delegated):

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

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

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

Not run at push: the full go test -tags nogui ./... (on the
f798b4eb7-based tree) was queued on mica behind another session's
suite (mote and mica both over their core count), not finished. Not tried:
a Code-tab session in the real twin's UI (#6459 saw one write into the
folder).
2026-11-13 21:55:13 +08:00
yetone 9a82192375 agents: Pi's row picks the protocol magpie's models are asked on (xiaomanweiman on X)
magpie writes Pi's ~/.pi/agent/models.json with api "openai-completions".
xiaomanweiman found that T3 Code's pi plugin then puts all 71 tools in the
context, while on "openai-responses" only 3 core tools load and the rest
come lazily. v0.1.4039 kept an api set by hand; this adds a choice so no
one has to edit the file.

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

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

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

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

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

Not run: the full `go test ./...` and the whole GUI suite. Both machines'
suite locks were queued behind other sessions' suites for hours. Not
tried: Pi forks, or a real vendor upstream behind each protocol (the
upstream was a fake).
2026-11-13 21:41:05 +08:00
yetone 9205ee109c agent: the Claude Code magpie downloaded keeps ~/.claude from reading as "CLI not found"
Wing8Aqua on X runs magpie as a systemd service on Ubuntu, where the
Claude subscription runs the Claude Code magpie downloaded
(claudecode.Install, in its cache folder, off PATH). Magpie's own runs
make ~/.claude, and the Agents page took that folder, with no `claude`
on PATH, for an uninstall's leftover: Claude showed "CLI not found"
while that Claude Code answered every request, and `magpie claude`
starts it. cliHeld now counts claudecode.Downloaded() for Claude Code.

Run: TestCLIMissing* in internal/agent on Linux (wsl-run): ok, with a
case for a download and one for a version folder without its binary.
Broken by hand (the download not counted): case 5 red.
2026-11-13 19:07:34 +08:00
yetone 880da8c17e agent: ZCode is told a model takes video, so a video it attaches reaches it (Flandern1211 on X, #5098)
A model whose source lists video input (antigravity/gemini-4-argon, say)
reached ZCode as text and image only, in config.json's modalities.input
and in provider_config.json's inputFormat, so ZCode never attached a
video to it. buildModels left the catalog's kinds out of the agent
model, and zcode.go rebuilt the list from m.Images.

- buildModels carries Entry.Modalities() into InputModalities and
  OutputModalities.
- zcodeInputs adds "video" when the model lists it and the provider's
  format is Messages or Chat. ZCode's own built-in rules (3.14.3's
  zcode-builtin.json) use inputFormat.supportsVideo, so the key is one
  its strict schema takes; it is written only when true.

Ported from Flandern1211's fork branch (fix/zcode-video-input,
e955d3c24), with these differences after review:
- Its gateway half (Messages video block and Chat video_url as a file
  part) is on main already, since b4fc29a6e (#6135), so it is not
  taken; TestZCodeVideoReachesCodeAssist keeps their captured ZCode
  shapes as a guard.
- PDF is not offered (no supportsPdf, no "pdf" input), and Messages'
  document block is not read as a file: a translated request still
  loses a PDF (#5452), so ZCode would be told of a kind that doesn't
  arrive.

Test: TestZCodeToldOfVideoInput, red on origin/main e4ea31321
("config.json's media/gemini takes [text image], want [text image
video]"), and red with the Responses gate taken out by hand.

Not tried: a real ZCode with a video against a real Gemini model here;
the reporter captured ZCode 0.17.1's video block and video_url on
Windows 11.

Co-authored-by: Flandern1211 <163982805+Flandern1211@users.noreply.github.com>

Ran (mica, at this tree on e4ea31321): gofmt -l internal (nothing),
go vet ./..., GOOS=windows go vet ./..., GOOS=linux go vet -tags nogui
./..., go test -tags nogui -timeout 45m ./internal/agent
./internal/gateway ./internal/catalog ./internal/provider: ok agent
(297s), gateway (1080s), catalog; provider red on TestHostBuildsNoList
only ("Host allocated 5 times"), #6479, red on main and untouched here
(baffcb65d on main since). Rebased on origin/main ea3edd4b1 (no change
to these files): the new tests and TestZCode/TestCrush again, ok.
2026-11-13 18:57:10 +08:00