8a4e32febef69bb797cdf3003ec1395e725d5d63
769
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5416fdb76b |
agent: Claude Code on magpie keeps its MCP tools deferred (ENABLE_TOOL_SEARCH)
cybercaius on Discord (#help): the MCP router's 245 tools took 124K
tokens of a 341K context ("Magpie ×245" in Usage › Context). Claude Code
before 2.1.304 keeps tool search off behind an ANTHROPIC_BASE_URL that
isn't Anthropic's, so every router tool's definition went on every
request. 2.1.304 (10-19) turned it on for gateways itself, but a
conversation begun without it stays held off.
While Claude Code is routed through magpie, magpie now writes
env.ENABLE_TOOL_SEARCH="true" into ~/.claude/settings.json: Claude
Code's own documented switch, no prompt or identity change. The gateway
carries deferred tools to every upstream already (#2660,
withoutDeferredTools). It follows the auto-mode review's ownership:
magpie's value is stashed (claude.tool_search), a value the user set,
an empty one too, is theirs, and magpie's goes in desktopOnly/unroute.
T3 Code's magpie instance gets the same "true" in its environment
unless the user gave it a value there.
Not changed, filed as #4755: agents with no tool search of their own
(OpenCode, Gemini CLI, ...) still get the router's whole list; a lazy
router mode for them needs an owner decision. Not changed: Codex, which
already sends tool_search on magpie's catalog (0.165.0 measured: 14
tools, no MCP ones), and newmax/claudescience, which run Claude Code
through the SDK and set no gateway env of this kind.
Run:
- Real Claude Code 2.1.290 on mote, sandbox HOME, sandbox magpie serve
on 127.0.0.1:3563 built from this tree, a fake Anthropic upstream, a
245-tool stdio MCP server in the Library behind the router, wired
with `magpie claude up/fake-1`: first /v1/messages had 12 tools,
27,443 bytes of tools JSON (+~9KB of deferred names in the messages).
The same with magpie's ENABLE_TOOL_SEARCH taken out (the old
wiring): 266 tools, 245 of them MCP, 242,346 bytes.
- Without magpie, against a capture server: 2.1.200 to 2.1.303 send
every MCP tool (239-257KB); 2.1.304 to 2.1.316 defer them (~28KB);
ENABLE_TOOL_SEARCH=true in settings.json env or the process env makes
2.1.200, 2.1.260 and 2.1.290 defer them too.
- TestClaudeToolSearchOn, TestT3CodeToolSearchOn (new); #4755 filed.
- go test -tags nogui ./internal/agent on mote; GOOS=linux and
GOOS=windows go vet ./internal/agent; gofmt -l.
Broken by hand: writeSearch stashing nothing and writing nothing, and
T3's entry left out: both new tests red. The user-value check skipped:
TestClaudeToolSearchOn red on the user's "false".
Not tried: a real model loading a deferred router tool through
ToolSearch and calling it via magpie (gateway tests cover deferred
tools); Claude Code on Windows/Linux; T3 Code's real app.
|
||
|
|
3defaf6622 |
dsh: a new desktop profile gets magpie's routes when the start is the user's (zyh6036 on X)
DeepSeek Harness Desktop 0.2.1-rc.5's picker listed only "DeepSeek 账号". The app reads $DSH_HOME/profiles/desktop (apps/desktop/src/paths.ts) and makes it from an empty template on its first start. dshFillNewProfiles gave such a profile magpie's routes only when a wired profile started on one of magpie's models; with the web profile wired but started on one of dsh's own, it returned early and the desktop profile stayed bare. Now a bare profile gets the routes alone in that case (no start written, the user's pick stays theirs), and nothing is filled when no profile is wired. Run: - go test ./internal/agent -run TestDshFillNewProfiles on mote at |
||
|
|
0cabaaf243 |
agent: a portable VS Code on a Mac is wired in its code-portable-data folder (#4151)
faketrader runs VS Code portable on a Mac: /usr/local/bin/code links into /Applications/Code/Visual Studio Code.app, and the build reads /Applications/Code/code-portable-data/user-data/User. magpie detected it but wrote ~/Library/Application Support/Code/User, which that build never reads. Their patch on #4151 is the base; this takes its rule and makes it VS Code's own (configurePortable in src/bootstrap-node.ts), on every OS: - A build is portable when its product.json has no `target` (an installer's build has one) and its data folder exists: on a Mac product.json's `portable`, else `<applicationName>-portable-data`, beside the .app; on Windows and Linux `data` beside the install, also for a build that updates into `<install>/<version>/resources/app`. - The build is the one the launcher on PATH is, through a Scoop shim and every symlink. A launcher whose product.json names another editor (a fork's `code`) isn't the build's. With no launcher of its own, a Mac reads the app folders and Spotlight and takes a portable bundle only when every bundle found is that one; beside an installed bundle, which one runs is unknown and nothing moves. - VS Code, Insiders and VSCodium each go by their own bundle and launcher. - User and extensions come from one place (vscodeDirs): connect, Sync, profiles and Disconnect use the portable User folder, and Zoo Code is found by its extension in <data>/extensions and writes its import file there. Windows' Zoo Code under Scoop looked in ~/.vscode/extensions. - Disconnect's preview is refused for a file in a portable data folder: the preview's child keeps PATH, and its launcher would reach the build's real files, not the copy. That also covers Scoop under home on Windows, which main previewed. - An installed build with no portable folder keeps the OS's folder and ~/.vscode/extensions, unchanged. #3260 and #4009 (Windows): |
||
|
|
733fac48fb |
qwenpaw: each model says how its thinking is set, and the editor sets the level (Pkh)
Pkh (Discord, 0.1.2509 on Linux, QwenPaw 2.2.2.post1): QwenPaw's
thinking strength did nothing on magpie's models.
Cause, from QwenPaw 2.2.2.post1's own source:
- providers/provider.py thinking_control() takes a model's
thinking_control, else its thinking_param_style; with neither it is
ThinkingControl() of kind "unknown".
- providers/thinking.py resolve_thinking drops an unknown control to
inherit, so agent.json's thinking_level was never sent.
- magpie wrote neither key in magpie.json's models, so every magpie
model was "unknown".
Change:
- qwenpawModelJSON writes thinking_param_style "effort" and
reasoning_effort_options for a model whose catalog efforts include
levels QwenPaw names (minimal, low, medium, high, xhigh, max), in
QwenPaw's order. "none" is left out: QwenPaw's off sends
enable_thinking / thinking extra_body, which the gateway strips for
some upstreams.
- Both keys are magpie-owned. A model whose efforts go away has them
taken back. A null magpie writes where it never wrote is dropped,
so a user's own config_overrides are kept.
- The QwenPaw agent editor gets an effort field over agent.json's
thinking_level. "" writes inherit. Setting a level drops
thinking_budget, which QwenPaw's validator requires. A budget or
off level the user set is shown and kept.
- Docs: agent-wiring.md and reference.md.
Run:
- gofmt -l: clean.
- go vet darwin, windows, and linux (-tags nogui): clean (mote).
- go test -timeout 45m ./internal/agent/...: ok (mote).
- go test ./internal/gui: 3 reds, also red on origin/main
|
||
|
|
da0005df81 |
agent: /api/state lists running agents once in 3s, not with a pgrep each call
/api/state asks StaleCopies for every wired agent, and each pattern
started `pgrep -lf`, which walks every process's arguments. On a Mac
with ~1000 processes that was most of a state call: 45ms each, on every
page switch, save and GUI poll, with a pgrep child seen in 25 of 40
samples.
StaleCopies now reads runningLately: a pattern's listing is kept for
3s, with each process's start (not its age), so an age read later is
still right. A fresh listing (a restart waiting for its app to end)
replaces what was kept, so the look that finds the app gone is what the
next poll sees. A test that fakes running is asked each time. The
waits in apprestart still list now.
Run (mote, this tree):
- go vet ./internal/agent ./internal/gui; GOOS=linux and GOOS=windows
go vet ./internal/agent: ok.
- TestRunningListedOnceInAWhile, TestRunningNeedsNoPs: ok.
Broken by hand (every call lists): red, "listed 6 times in a row,
want 1".
- go test ./internal/agent ./internal/provider: ok. ./internal/gui:
only TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949), both red on main too.
Real accounts (sandbox HOME from a copy of the live accounts, on this
Mac with its real Codex app, daemons and CLI running):
- /api/state, 10 calls after 200: v0.1.2519 43-60ms, this 8.4-21ms
(twice each, alternating). pgrep children in 40 samples: 26 and 24
before, 1 and 1 after.
- Each wired agent's stale copies (Codex: app, two daemons, cli, each
with its start) are the same from both binaries, read twice 4s apart.
Not run: the full ./... suite; Linux and Windows runs of the agent
package (vet only).
Picked onto
|
||
|
|
9be72c9480 |
zcode: a level's thinking carries its budget, and the user's own level options stay (#3852)
Review of d7e1e284f, two things it changed beyond its case:
- Every level that thinks was written as {"thinking":{"type":"enabled"}}
with no budget_tokens. ZCode puts a level's options in the request, so
a Claude before 4.6 (Sonnet 4.5, Haiku 4.5, a relay's) asked through
magpie at any level would be sent "enabled" without the budget
Anthropic's Messages API requires with it, a 400 it didn't get before.
Each level now carries the budget the gateway reads that effort as
(gateway.ThinkingBudget, budgetOf: low 4096 ... max 32000). The
gateway already makes it adaptive for Claude 4.6 and later
(adaptiveThinking; ZCode's output_config.effort wins over the budget)
and fits it under max_tokens (maxoutput.go).
- providerOptionsByLevel was written over on every sync. A user who put
their own there (the workaround for this very bug) lost it. A level's
options already in config.json now stay; no magpie before #3852
wrote any, so whatever is there is the user's.
Tests: TestZCodeOutputAndReasoning expects the budgets;
TestZCodeKeepsTheUsersLevelOptions keeps a hand-written high level and
fills the others.
Run on mote: go test -run TestZCode ./internal/agent, ok. Broken by
hand: the kept options ignored and the budget left out, and those two
tests fail.
Not tried: a real ZCode 3.x (this Mac has Z Code 0.9.1, a different
app; mote has none), so ZCode putting the options in the body is the
reporter's and the author's reading of zcode.cjs, not seen here.
Batch record (gua's #2833 #3052 #3205 #3867 #4107 #4247 #4245 #4113
#3852 and the three review follow-ups; #4106 left out, its test isn't
red without its fix, see the issue):
- Full run on mote before the rebase (base
|
||
|
|
bc7d833916 |
zcode: the reasoning keys ZCode reads, not OpenCode's (#3852)
magpie's ZCode takeover wrote a model's reasoning as
{"enabled":true,"variants":[…],"defaultVariant":…} — OpenCode's
shape, which ZCode's config.json provider entry is loosely modeled
on. ZCode's own schema for it is
{enabled?, levels?, defaultLevel?, providerOptionsByLevel?}
(resources/glm/zcode.cjs, same in the 3.12.3 the issue reports and
in the 3.16.3 checked on this machine; "defaultVariant" has no
occurrence in the 3.16.3 runtime at all). Its .passthrough() keeps
the unknown keys and ignores them, so ZCode picked a level, sent
output_config.effort and never a thinking field — and an
always-thinking upstream model (Kimi Code's kimi/k3.1-pro, for one)
refused every request with 400.
magpie now writes the keys ZCode reads: levels and defaultLevel it
had all along, plus providerOptionsByLevel with thinking on for
every level and off for the one named "disabled". The kept default
a sync reads back now looks for defaultLevel, falling back to the
defaultVariant an older magpie wrote (a key ZCode never read, only
magpie) so a user's choice survives the first sync after the
upgrade. The provider_config.json rule side is untouched: its
optionSpecs.reasoningLevel.values is already a key ZCode reads.
The OpenCode family keeps variants/defaultVariant: there those are
the keys the app reads.
Fixes #3852
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
b62b914964 |
agent: Claude Code's model field joins its own models with magpie's list once
Claude Code's model field appended its own models to the list it keeps
of magpie's (claudeViaShared), a copy of the whole catalog on every
call, as withVia did for the other agents until
|
||
|
|
ffc18a850d |
agent: an app folder is listed and an Info.plist read again only when it changed
The Agents page asks every desktop app whether it is installed, and its version, on each poll. Each ask listed /Applications and ~/Applications whole (os.ReadDir, for the one-level-down folders of #2325) and read every candidate bundle's Info.plist. With real accounts, 40 window polls spent 38.6 MB of allocations in Agent.Detected, 14.5 MB of it ReadDir. folderSubs keeps a folder's non-bundle subfolders while its modification time stays (adding, removing or renaming an entry changes it), and bundleInfo keeps what an Info.plist said while its size and modification time stay. A time under 2s old is never trusted, as git treats a racily clean index. macBundle and desktopApp.version read through bundleInfo; what each reports is unchanged. Run on mote (macOS), at this tree: - gofmt clean; go vet ./internal/agent for darwin, windows and linux ok. - TestAppFoldersReadAgainOnlyWhenChanged alone 3/3 ok. - Broken by hand: never trusting the kept list and plist -> "an unchanged app folder and Info.plist cost 1268 allocations a look"; trusting them whatever changed -> "Moved.app in a folder added since isn't found" and "Kept.app's Info.plist says another id now". - go test ./internal/agent ./internal/tui ./internal/cli: ok. - go test ./internal/gui (with the next commit's providers.go too): red only on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), as before. - Real-account sandbox, 40 window polls against v0.1.2504's tree: total allocations 509.9 -> 427.6 MB, Agent.Detected 38.6 -> 21.5 MB, os.ReadDir 14.5 -> 4.0 MB; /api/state and drift output byte-identical. phys_footprint_peak 139 MB (136 before; within run noise). Not run: the whole ./... suite; the Linux and Windows app paths (they don't reach these readers). |
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
2c33db2499 |
agent: VS Code 1.139's versioned layout hides the launcher's marker
Tony-ooo's retest (magpie 0.1.2322, VS Code 1.144.0 on Windows): the false positive of #3269 is back — bin\copilot-shim on PATH, no ~\.copilot, and magpie ls still lists Copilot CLI. The marker check |
||
|
|
d8f7d089f1 |
agent: Claude Code's model field appends the kept list without a copy first
The model field (and a WSL Claude Code's, asleep) appended claudeViaMagpie's list to Claude Code's own models, which copies it, after claudeViaMagpie had copied it once already: 6.3 MB of forty polls with real accounts. claudeViaShared gives the list kept, read only, to such a caller; the append makes the field's list one of its own. claudeViaMagpie still gives every other caller a copy. TestClaudeViaMagpieKept now also writes into the model field's options and checks that neither kept list (folded or not) changes. Run on mote at |
||
|
|
68ebd1ec4a |
agent: a provider's options an agent reaches on its own are kept
Goose's model field asked ownOptions each poll, for the picker and again for Drift, and each provider's models were made into options anew (catalog.Provider, options, group, its icon): ownOptionsFrom was 21.2 MB of forty polls with real accounts. For agents without a registry of their own (native == nil), each provider's options are now kept in ownBuilt per provider.StampNow (a minute at most) and copied into the caller's list; Pi's and omp's, which read their own registries, are built as before (ownProvider is the old loop body). TestOwnOptionsKept: a catalog of 200 OpenAI models; asking again takes a fifth or less of the allocations building does, a caller's write doesn't reach what is kept, and a model the catalog lists since is offered. Run on mote at |
||
|
|
5e0d4e1282 |
agent: Claude Code's magpie list is kept as viaMagpie is
Claude Code's model and tier fields asked claudeViaMagpie each poll, for the picker and again for Drift, and it built the list anew each time: 19.1 MB of forty polls of the Agents, Providers and Drift answers with real accounts. It is now kept in builtOptions per provider.StampNow (a minute at most), folded and not apart, and each caller has a copy of its own (buildClaudeVia is the old body). TestClaudeViaMagpieKept: a provider of 102 models; asking again takes a fifth or less of the allocations building does, a caller's write doesn't reach the kept list, the folded list is kept apart, and a provider saved since is offered. Run on mote at |
||
|
|
c1457f2eec |
agent: Drift makes a field's options once a look
Drift asked magpieValue up to three times a field: once to find the
field on magpie's models, then for magpie's record and the value now.
Each ask made the field's options anew, and Claude Code's (its own
models and claudeViaMagpie) are long. fieldOptions keeps each field's
options, by key, for one Drift; magpieValue is unchanged for the other
callers.
Run on mote at this tree:
- gofmt clean; go vet ./internal/agent ok on darwin, GOOS=windows and
GOOS=linux.
- TestDriftMakesAFieldsOptionsOnce ok 3 of 3 alone. Broken by hand
(opts left nil in Drift): "one Drift made the field's options 3
times, want once".
- go test ./internal/agent: ok (324.6s).
Real accounts (sandbox copy of the owner's config, network blocked,
40 rounds of /api/drift, /api/state, /api/providers), v0.1.2488 tree
against this one:
- Drift 54.3 -> 45.3 MB, magpieValue 47.1 -> 42.6 MB, claudeIn.func57
39.7 -> 33.8 MB; total 613 -> 587 MB (totals move +-25 MB between
runs).
- /api/state and /api/drift byte for byte the same.
- footprint peak 138 MB, RSS 180 MB: unchanged.
Not run: the gui suite (gui is not touched).
Run at 573b21f4b; picked onto
|
||
|
|
1cf66e4b17 |
agent: a tool asked on Responses says strict: false, its optional parameters stay optional (#3055)
What changed: OpenAI's Responses API takes a function tool whose strict is left out as a strict-mode one and normalizes its schema, where every property is required, so a tool's optional parameters came back filled (#3055, ArakawaHenri). pi-ai (dsh's llm-pi-ai, Pi and its kin) says strict: false on an ordinary tool only when the model's compat says supportsStrictMode, which it takes as false where the compat is left out. magpie now says it: every model of a dsh route whose api stands as openai-responses carries compat.supportsStrictMode, by the api the route has now (the one the user picked in dsh's Models page kept), not by its name, beside the keys they set there (dshKeepCompat); and piModelJSON says it for a model best served on Responses, which Pi's and StepCode's models.json carry (Pencil's entries stay on Chat throughout). omp's models.yml is left alone: omp turns a models.yml away over a field its schema doesn't name (16.3.5 over a max), so the compat needs an omp version of its own pinned first. docs/subsystems/agent-wiring.md says so. Run: new TestDshTellsAResponsesToolsStrictIsOff and TestPiTellsAResponsesToolsStrictIsOff fail without the change (the first with "a model asked on Responses isn't told strict is off: Compat:<nil>", the second with "resp/gpt-5.5 is asked on Responses and isn't told strict is off") and pass with it; removing only the dsh case turns the first red and only it, removing only the piModelJSON compat line turns the second red and only it. go test ./internal/agent/ (TestMothX fails the same with both files back at the baseline here, so not from this change), gofmt -l on the changed files (nothing), go vet ./..., GOOS=linux GOARCH=amd64 go vet -tags nogui ./..., GOOS=windows GOARCH=amd64 go vet ./..., go build . (darwin arm64), GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -tags nogui ., GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags nogui ., GOOS=windows GOARCH=amd64 go build -o /dev/null . Landed (yetone). Broken by hand on mote: with the dsh case and piModelJSON's compat line taken out, both new tests are red ("a model asked on Responses isn't told strict is off: … Compat:<nil>", "resp/gpt-5.5 is asked on Responses and isn't told strict is off"). Run at the pushed head: go test ./... -timeout 45m on mote with this branch on |
||
|
|
bb478f0e50 |
agent: a look that only ranges over magpie's models reads the list kept
magpieModels gives each caller its own copy of the list it keeps per
agent. Most callers only range over it, or count it, and a range copies
each model anyway, so the copy guarded nothing for them (the models'
own lists were shared before too: the copy was shallow). sharedModels
is the list kept, read only; every `range magpieModels(` and
`len(magpieModels(` in internal/agent (39 files) takes it. Callers that
keep the list, append to it or hand it on still get their copy.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls of /api/state, /api/providers and drift, pprof alloc_space
between two heap snapshots,
|
||
|
|
6712e367e8 |
agent: a look at the stash shares one read of it
Each /api/state and /api/drift poll asked the stash (stash.json) for one value hundreds of times, through Detected, Drift and the agents' wiring checks, and each ask read the file and parsed it again. In a real-account heap profile (20 rounds of drift, state and providers) stashLoad was 24-34 MB of what was allocated. stashShared reads it through filememo.Read, so every look shares one parse until the file changes, by magpie or by another process. Every read-only caller uses it now, the 24 files here and QwenPaw's unstashPeek. stashLoad, which callers change and write back, still gives each its own map, cloned from the same parse. Real use: the owner's real-account sandbox, offline (proxy to :9), 20 warm rounds of /api/drift, /api/state and /api/providers: - allocated 477 MB ( |
||
|
|
93879515a0 |
agent: QwenPaw, each of its agents' active_model one of magpie's (pkh1585 on Discord)
pkh1585 asked for QwenPaw (AgentScope, github.com/agentscope-ai/QwenPaw)
on Discord. Read in its source, 2.2.2.post1, as data:
- Its folder is QWENPAW_WORKING_DIR, else ~/.copaw when that exists (the
old name), else ~/.qwenpaw; WORKING_DIR/.env is loaded without
overriding the environment. config.json's agents.profiles lists the
agents, each with a workspace_dir whose agent.json holds active_model
{provider_id, model}, read again on each message.
- Providers are no plain config: SECRET_DIR (QWENPAW_SECRET_DIR, else
"<WORKING_DIR>.secret") holds providers/{builtin,custom}/<id>.json,
read once at start. A plain api_key there is encrypted to "ENC:" at
start, so that is the place QwenPaw itself keeps keys.
What magpie does now:
- `magpie qwenpaw <model>` and the GUI: a row per QwenPaw agent
(qwenpaw#<id>, the default one as plain qwenpaw), skipping agents whose
backend is ACP (another CLI runs those) and agents turned off.
- Connecting writes providers/custom/magpie.json (mode 600, the gateway's
/v1 and the magpie-qwenpaw key, magpie's models as extra_models with
their window, output and tool use) and sets that agent's active_model
to {magpie, <provider>/<model>}. The old active_model is stashed as it
was and put back verbatim on disconnect, absent and null included.
The provider file is removed only when no QwenPaw agent still uses it.
- A sync after QwenPaw re-saved the provider (encrypted key, discovered
models, its own defaults) keeps what QwenPaw wrote and changes only
what magpie owns, so a second connect leaves the file as it is.
- The notice says QwenPaw reads providers at start-up: restart it once
after connecting and after magpie's models change. New text in every
locale.
- appdir: QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR take ~/ as QwenPaw's
expanduser does; agentenv clears them in tests.
- README (en, zh), docs/reference.md, agent-wiring.md, the site's agent
list and start pages (en, zh, ja), icon.
Run:
- internal/agent's QwenPaw tests (Connect, AgentsAreRows, SyncKeeps-
WhatQwenPawChanged, Check, NotStartedYet, Folders, OwnModelAfter-
Magpies, SyncAfterQwenPawSaved, NullModelRestored) on mote, and the
all-agent tests (applied, rewire, lan_kept, proxy_kept, spelled) with
a QwenPaw fixture.
- Broken by hand, each red: always rewriting the key
(SyncKeepsWhatQwenPawChanged), removing the provider while another
agent uses it (AgentsAreRows), no backend filter (AgentsAreRows lists
qwenpaw#coder), dropping the keep of QwenPaw's own fields
(SyncAfterQwenPawSaved), IsObject for Exists (NullModelRestored).
- Real QwenPaw 2.2.2.post1 (Python 3.12 via uv) in a sandbox HOME on
the Linux box (WSL magpie-desktop), magpie on 3741, a fake OpenAI
upstream on 3742: first start wrote config.json and agent.json;
`magpie provider add fake …`, `magpie serve`, `magpie qwenpaw
magpie/fake/echo-1`; after a restart QwenPaw encrypted the key (ENC:)
and `qwenpaw agents chat` answered "PAWPAW-OK from the fake upstream",
its log "built agent … model=magpie/fake/echo-1"; the upstream saw
/v1/chat/completions model echo-1 streamed, magpie's usage.jsonl
agent qwenpaw status 200. A second connect and `magpie models` left
the provider file unchanged. `magpie qwenpaw default` took
active_model back out (the only diff in agent.json) and removed the
provider; QwenPaw started clean after.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite on mote (go test -tags nogui -count=1 -timeout 45m ./...)
at 9554883db on
|
||
|
|
606743831e |
appdir: on Windows an agent's folder variable follows the registry, and a gone folder it names isn't made again (bm_rabbit on Discord)
bm_rabbit (0.1.2405, Windows x64, Pi 1.4.0) moved Pi's AgentDir from
F:\piData\.pi\agent to F:\HarnessData\Pi\.pi\agent, deleted the old one and
set the User variable PI_CODING_AGENT_DIR to the new path. Changing Pi's
model in magpie then made the deleted folder again with only models.json
and settings.json in it.
Cause: Windows gives a process its variables once, from the registry, and
never passes a changed User variable to one already running. magpie runs
for days in the tray, so appdir.Getenv("PI_CODING_AGENT_DIR") (piDir) kept
the old path, and edit's write did MkdirAll on it. Every agent folder
variable (CODEX_HOME, CLAUDE_CONFIG_DIR, ...) had the same problem.
Fix, where every agent folder is read (appdir.LookupEnv, follow.go): on
Windows a variable in agentenv.Vars that came from the registry (its value
in magpie's environment at start matched the registry's, unset in both
counts too) is read from HKCU\Environment, else HKLM's Session Manager
Environment, with %...% expanded, at most once a second, and set in
magpie's environment so the programs magpie starts get it too. A value
the launcher set itself, or one set inside magpie since (a test sandbox),
stands. The direct os.Getenv reads of agent variables go through appdir
now: claudetui's CLAUDE_CONFIG_DIR, sessions' CODEX_SQLITE_HOME and
PI_DESKTOP_DATA_DIR, cliupdate's GROK_HOME, omp's OMP_PROFILE/PI_PROFILE.
And edit's writeFile no longer makes a missing tree of folders that an
agent's variable names: when the folder the variable names is missing
and so is the folder above it (bm_rabbit's whole F:\piData was gone),
appdir.Gone returns a GoneError naming the variable and the folder. The
named folder itself is still made when its parent is there, as mkdir
would (a CODEX_HOME or ANTE_HOME set before the agent first ran; 12
internal/agent tests rely on it), and an agent's default folder is made
as before. TestAnteHome's ANTE_HOME was <tmp>/elsewhere/ante with
elsewhere missing; it now makes elsewhere first. Writes that call
os.MkdirAll themselves don't ask yet: #4634.
Pi's install-layout.json isn't Pi's: Pi 1.4.0's getAgentDir
(@earendil-works/pi-coding-agent dist/config.js) reads PI_CODING_AGENT_DIR,
else ~/.pi/agent, and no file in the package names install-layout.
magpie doesn't read it.
Tests: TestAgentVarFollowsTheRegistry, TestAgentVarAddedLaterFollows,
TestAgentVarSetByHandStands, TestRegistryReadAtMostEachFollowFor,
TestGoneNamedFolderIsNotMade (internal/appdir, a fake registry), and
TestWriteNeverMakesANamedFolderAgain (internal/edit).
Broken by hand: LookupEnv back on os.LookupEnv, TestAgentVarFollowsTheRegistry
and TestAgentVarAddedLaterFollows FAIL ("after the user moved it,
PI_CODING_AGENT_DIR = .../old, want .../new"); Gone's refusal turned off,
TestGoneNamedFolderIsNotMade and TestWriteNeverMakesANamedFolderAgain FAIL
("= <nil>, want a GoneError", "the folder was made again"); Gone refusing
whenever the named folder is missing, TestGoneNamedFolderIsNotMade FAILs
("a named folder whose parent exists: ..."). All put back, green.
Real Windows run on xiaomi-gpu, sandbox USERPROFILE/APPDATA/LOCALAPPDATA,
at this head: a probe built from this tree started with
PI_CODING_AGENT_DIR=<sb>\piData\.pi\agent in its environment and the User
registry; then the User variable was set to <sb>\HarnessData\Pi\.pi\agent
and <sb>\piData deleted, and agent.Find("pi").Apply("model", ...) ran in
the same process. Pi's dir and os.Getenv are the new folder,
settings.json written there, piData not made. With HarnessData deleted
too: "PI_CODING_AGENT_DIR names <sb>\HarnessData\Pi\.pi\agent, which
doesn't exist and neither does the folder above it: ...", not made. An
earlier run of the old code (LookupEnv on os.LookupEnv, no Gone) wrote
into the old folder and made it again: bm_rabbit's case. The User
variable was removed after; the box had none.
Full run at this change on
|
||
|
|
dd7442f283 |
agent: a look at the via-magpie options shares the kept list
viaMagpie handed every caller its own copy of the options list it keeps per stamp, and a window poll asks for it from most agents' fields and pickers. In a real-account sandbox (abr.sh, 20 polls of drift, state and providers on v0.1.2463) those copies were 33.7 MB of slices.Clone, plus ~8 MB more on the way, of the 713 MB the polls allocated. viaMagpieShared returns the kept list itself, clipped, so an append makes the caller's own array. The 58 callers that only read it, or append onto it, now take it; viaMagpie (a copy) stays for the ones that change it. TestKeptListSharedWithoutACopy checks that 20 shared looks return the kept array, and that an append onto a shared look and a write into get's copy leave the kept list as it was. Run on mote at this tree: - gofmt, go vet (darwin, GOOS=windows, GOOS=linux with gateway), go build ./...: ok. - Broken by hand (shared returns slices.Clone): the test is red, "a shared look copies the kept list". - go test -count=1 ./internal/agent: ok (480s). Not run: internal/gateway and internal/gui packages on this tree. |
||
|
|
544b91ca87 |
dsh: magpie's routes wait for a slow reply as long as the gateway does (tim on Discord)
tim's first "who are you" to gemini-3.8 through the third-party plugin
magpie-gemini-web 0.8.0 took minutes in dsh and ended in 499 ("the agent
canceled the request"). dsh hung up: llm-pi-ai gives a turn up after 5
minutes with no pi-ai event (DEFAULT_STREAM_IDLE_TIMEOUT_MS, every
dsh-llm-pi-ai from 0.1.5 to 0.2.2), and the gateway's ": keepalive"
comments (keepQueued, keepQuiet) are not events. The plugin serves one
request at a time (maxConcurrency 1), dsh's own session title goes to the
same route model in parallel, and the plugin's backend sends no byte
before its first token, so the turn's 5 minutes ran out in magpie's queue
and the backend while the gateway (10 minutes for headers) and the plugin
(240s per wait, then its own 504) were still waiting.
Every one of magpie's dsh routes (patch lists and deepseek-acp's
settings.yaml, all through dshPutProviders) now has streamIdleTimeoutMs:
600000 (dshIdleWait), the gateway's upstreamHeaderWait. A value already on
the route, set in dsh's Models page or by hand, stays. Codex's
comment-blind limit is still met in the gateway (agentQuietMost); dsh's is
a route setting. The plugin's own slowness is its maintainer's and is not
changed here.
Verified:
- New tests TestDshRoutesWaitAsLongAsTheGateway and
TestDshRouteKeepsTheUsersIdleWait (internal/agent/dsh_idle_test.go),
green on mote. Broken by hand: without the field the first fails
("route magpie waits 0ms for the next event, want 600000"); without the
keep the second fails ("sync 1: the user's 120000 became 600000").
- Real dsh 0.2.1-rc.2 (headless, sandbox HOME/DSH_HOME, the route as
magpie writes it, a fake Chat server on 127.0.0.1:3561 that answers
after 8s): streamIdleTimeoutMs 3000 -> "TIMEOUT: pi-ai stream idle
timeout after 3000ms"; 600000 -> "hello there", exit 0. With headers
sent at once and ": keepalive" every second it still timed out at 3000,
so comments don't feed the watchdog. dsh-llm-pi-ai 0.1.5-rc.3,
0.1.7-rc.2, 0.2.0-rc.2 and 0.2.1-rc.5 (npm pack, read) all take the
field per provider, max MAX_TIMER_DELAY_MS.
- gofmt -l clean. On mote: go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./..., go build, GOOS=linux go build -tags
nogui, GOOS=windows go build: all ok.
- Full suite, go test -tags nogui -count=1 -timeout 45m ./..., on the
Linux box (wsl-run, magpie-desktop; mote had two full suites running)
at
|
||
|
|
2597c96365 |
agent: Codex's config.toml is decoded once a read for a sync's own looks
A sync to Codex decoded the whole config.toml again for each thing it checked: codexMultiAgentV2On, putThreadTables, codexEnableEfforts and codexAsyncNow each ran toml.Unmarshal over the file. Codex writes a [projects."…"] table for every folder it was opened in; the owner's config is 1.5 MB with 10,932 tables, and with 10,000 such tables one sync allocated 21 MB. codexTopOf decodes only the top tables these look at (features, model_providers, desktop, profile, profiles) and keeps the result in filememo by the file's mod time and size, so a sync and the polls after it share one decode until the file changes. A missing file is an empty config, as before. TestCodexSyncDecodesTheConfigOnce: 10,000 project tables, one sync to settle, then five more; each must allocate under 12x the file and leave config.toml unwritten. Now ~5 MB a sync. Red on the old code: 51,257 KB a sync over an 868 KB file, past the 10,421 KB bound. Run at this head on mote: gofmt clean; go vet (darwin, GOOS=windows, GOOS=linux) ok; go test -timeout 45m ./internal/agent ./internal/gateway ok. |
||
|
|
019bfc951b |
gui: a page of accounts builds the agent list once, not once a row
accountLabel and the excluded-agents loop called agent.Find for each row,
and Find builds All() again each time: about 3,300 allocations a call.
Over 20 window polls that was 58 MB of the 1.4 GB a magpie allocated.
provider.Held keeps All() for the request that holds it (the gui's held
middleware holds every /api/ request), and agent.FindIn looks the name up
in that list. Outside a hold Held builds it as before, so a caller with
no request in hand gets the same answer.
TestAccountLabelsBuildTheAgentsOnce (sandbox HOME): outside a hold the
label's name and icon are the same; under Hold a row allocates 3 times
against 3302 to build every agent. Broken by hand on mote (agentNamed
back to agent.Find) it is red at 3305 a row.
Run on mote at this tree (on
|
||
|
|
cdd470ce9f |
agent: opencode.json lists magpie's models in the order the user set
The models of magpie's provider in opencode.json were a
map[string]any, whose keys encoding/json marshals sorted: the order the
user dragged to on the Agents page reached magpieModels and died at the
last step, the file listing the models A to Z (#4575). A pure
re-ordering wasn't even written — syncJSONInOrder's sameOrder compared
two alphabetical lists and found them alike. The variants under each
model kept their order since #713 (orderedJSON); the models keep theirs
the same way now, and openCodeKept looks a model up in the ordered
block to put a variant of the user's on it.
Every config in OpenCode's shape moves with the one fix: OpenCode,
OpenChamber, Air, MiMo Code and DevEco Code (openCodeLike and the
openCodeKept calls in air.go and openchamber.go). Pi, Crush and Codex
list models in arrays and were never touched.
Run: TestOpenCodeModelsInOrder in internal/agent (written first) fails
on the unmodified code — the fresh block lands alphabetical and a
dragged order is never written — and passes with the fix. The
models-as-map assertions in TestInferredGroupImagesReachAgentCatalogs,
TestMiMoCodeCatalogNarrowedSeparately and
TestGroupModelsCarryTheirFirstMembersPrice read the ordered block now.
go test -tags nogui -count=1 ./internal/agent ok (150s) but for
TestMothX, which fails the same on unmodified main
|
||
|
|
2e9df9b1be |
agent: which of Codex's models magpie serves is kept while the catalog stays
codexInMagpie marks Codex's own models that magpie serves on the
user's ChatGPT account. Codex's options are asked per field of its
Drift on every drift poll, and each time it built Codex's whole
catalog (provider.CatalogFor) for these few names: 0.2 GB of the
2.6 GB a real config allocated over 20 polls.
The names are now kept in a stampedLists, as magpieModels and
viaMagpie are: built again when provider.StampNow moves, or a minute
after they were.
TestCodexServedKeptWhileCatalogStays: a signed-in account beside a
300-model relay; gpt-5.5 is marked served and the relay's model is
not, a kept answer takes under a twentieth of a build's bytes, and
the account's models picked since are followed at once. Red with the
set found each time ("a set already found took 9948425 bytes, finding
it 9954954").
Run on mote at this tree (
|
||
|
|
6a900e0d04 |
gui: a poll of the Agents page no longer drops every cached model list
/api/state keeps the state it built in agents-state.json, written only
when the bytes change. They changed on every poll: a stale copy's start
is now less how long it has run, two clock reads apart, so it moved by
microseconds each time (on a real config, only
/agents[1]/staleCopies[i]/since differed between two polls). The file
was written through edit.WriteAtomic, whose write calls
filememo.Forget(). That bumps provider.StampNow, so every 15s poll threw
away each agent's model list and picker (magpieModels, viaMagpie) and
every provider's kept catalog, and the next look built them anew.
- StaleCopies' since is truncated to the second (the check against
magpie's change still uses the exact time).
- keepState writes through steady.WriteFile (temp, flush, rename), which
leaves filememo alone: nothing a request reads is built from this file.
Not changed: on Linux and WSL the process list gives a run time in whole
seconds (ps etime), so a copy's since can still move by a second between
polls there; macOS reads the exact start from sysctl.
Run on mote at
|
||
|
|
4182e68ab4 |
agent: whether the installed magpie wired an agent is looked up in the bytes read, not a copy
A magpie beside the installed one (a dev build on its own port) asks,
for each field's drift, whether the agent's config names the installed
magpie's gateway (theInstalled). It took edit.Read's copy of the file
and two strings of it: with a Codex config.toml of 1.5 MB (one table
per project trusted) that was 311 MB in 60 drift polls of a sandbox
built from
|
||
|
|
02ff0e908f |
agent: the Codex app's route opens config.toml to see it can be read, not reads it whole
codexAppRoute runs every 3s for as long as magpie does (the Codex app's app-server watcher). It read the whole of Codex's config.toml with os.ReadFile only to learn the file could be read; the keys it uses come from filememo, which parses the file once per change. Codex keeps every project's trust level in that file, and the owner's is 1.5 MB, so this was 1.55 GB of the 33 GB a live magpie allocated in 53 minutes (heap profile: KeepCodexAppOnItsProvider → codexAppStep → os.ReadFile). It is now opened and closed: a file that can't be opened is still an unknown route, a missing one still a known one. Run on mote: - TestCodexAppRouteReadsNoWholeConfig (new): a 1.6 MB config, 10 looks allocate under 1 MB; a config with mode 0 gives no route. - Broken by hand: ReadFile put back, red (14.4 MB for 10 looks); the unreadable check dropped, red. - go test -run CodexAppRoute ./internal/agent: ok. - go test -count=1 -timeout 45m ./internal/agent ok (185.3s), at this tree rebased on 4a7d1c63a; gofmt -l clean; go vet ./internal/agent for darwin, linux and windows ok |
||
|
|
3baf3b6dfd |
agent: every agent's magpie options are built once per change, not per Drift poll
viaMagpie is the half of every agent's model picker that magpie serves. It built CatalogFor, the own and first accounts, and the fast and ultra picks on every call. The window's /api/drift poll asks each agent's fields for their options every 15s. In a live magpie's 53-minute heap profile (v0.1.2404), Claude Code's options alone (claudeViaMagpie) allocated 4.7 GB of 32.8 GB. viaMagpie now keeps its list per agent and prefix, the same way magpieModels does since v0.1.2422. It builds the list again when provider.StampNow moves, and after a minute for what the stamp can't see (an account another app signed in to). Each caller gets its own copy. The two now share stampedLists[T]. Run (mote, at this tree): - go test ./internal/agent: ok, 191.501s. - TestViaMagpieKeptWhileCatalogStays, TestMagpieModelsKept... and TestIsMagpieKept...: ok. - go vet ./internal/agent: darwin, linux and windows ok. Broken by hand, TestViaMagpieKeptWhileCatalogStays goes red each time: - never kept: FAIL; - the stamp not compared: FAIL; - the kept list handed out unshared: FAIL. Real A/B: magpie web --gateway under the same sandbox HOME as v0.1.2422's record, 200 GET /api/drift each. Before = v0.1.2422's tree. The drift JSON is byte-identical. - allocated under Drift: 2065 MB before, 1717 MB after. - under viaMagpie: 367 MB before, under pprof's cut after. - under CatalogFor: 538 MB before, 229 MB after. - CPU: 1.95s before, 1.80s after. Most of what is left under Drift in this sandbox is theInstalled's read of each agent's config. It runs only for a magpie beside the installed one (this sandbox's gateway port), not for the installed app. |
||
|
|
854fc81619 |
agent: magpie's model list is built once per change, not per field of every Drift poll
The window asks /api/drift every 15s. Each agent's Drift checks its
fields through magpieValue -> f.Options -> magpieModels, and
magpieModels built the whole catalog every time: CatalogFor, the
prices, Labels and Vision's ranking (provider.Described -> seersRanked).
A live magpie's heap profile (v0.1.2404, 53 minutes) allocated 32.8 GB.
Drift accounts for 14.5 GB of it, and magpieModels for 9.7 GB. The
footprint peak of 882 MB rides on that garbage.
magpieModels now keeps the list it built for each agent. It builds the
list again when provider.StampNow moves: a provider, account, plugin or
setting saved, catalog.Touched, or providers.json, settings.json or the
catalog cache rewritten by another process. It also builds it again
after a minute, for what the stamp can't see. Each caller gets its own
copy (slices.Clone). A model's own lists are clipped, so an append in a
caller's copy can't write into the kept list.
Run (mote, at this tree):
- go test ./internal/agent: ok, 188.985s.
- TestMagpieModelsKeptWhileCatalogStays: ok.
- go vet: darwin and windows ok, for internal/agent and internal/gui.
Linux vet of internal/gui fails in wails' cgo menu_linux.go
("undefined: pointer"); that is the cross-compile from darwin and not
this change.
- go test ./internal/gui: three reds, each filed already and none in
code this touches: TestSettingsSaveKeepsWhatItDoesNotSend (#4514),
TestMainWindowCorners/macOS_26_SDK (#3949), TestColdTurnsTaken
(#4510).
Broken by hand, the new test goes red each time:
- never kept: 422 vs 407 allocations;
- the stamp not compared: "a provider saved since is not listed";
- the kept list handed out unshared: FAIL.
Removing the Clip lines leaves the test green: its catalog's lists have
no spare capacity. The clip is a guard that wasn't shown to matter.
Real A/B: magpie web --gateway under a sandbox HOME with the owner's
providers, 200 GET /api/drift each. "old" is this tree with
magpieModelsFor = 0. The drift JSON is byte-identical.
- CPU: old 3.45s, new 1.99s.
- allocated under Drift: old 3098 MB, new 2063 MB.
- allocated under magpieModels: old 1049 MB, new 20 MB.
Not tried: the sandbox has no OAuth sign-ins, so subscription models
weren't in its catalog; the live catalog is larger.
viaMagpie (claudeViaMagpie, 4.7 GB live) still builds per call; that is
the next change.
|
||
|
|
49b8c64559 |
dsh: deepseek-acp gets magpie's route in settings.yaml, and the key store is owner-only
liby233 on Discord: dsh in an editor over ACP (deepseek-acp, CodeG, the
desktop app) listed only DeepSeek's own models. Checked against the real
packages from npm (deepseek-acp 0.9.0, dsh 0.2.1-rc.5): deepseek-acp
mounts FileSettings on $DSH_HOME/settings.yaml alone, never profiles/,
and loads the pi-ai plugin only when that file mentions "llm-pi-ai". Its
credentials-local store throws when .credentials.yaml is readable beyond
its owner ("run chmod 600"), so a 0644 store stops it from starting.
- settings.yaml gets llm-pi-ai.providers.magpie, built by the same code
as the profiles' route (dshPutProviders), at 0600 when magpie creates
it. It gets no agent-default-model of magpie's. The user's routes,
other sections, comments, mode and the api they chose for magpie's
route are kept. Disconnect takes only magpie's route out, and the
section too when nothing else is left in it.
- dsh 0.2 renames settings.yaml to settings.yaml.imported (over the one
before) at each full start and imports it into the profile. The
serving round, Sync, Set and Unwire write it again. The user's own
import from before magpie's first write is copied once to
settings.yaml.imported.kept, so magpie's import never overwrites it.
- .credentials.yaml is made owner-only (go-rwx) on every write and every
Sync, whoever made it 0644. In a WSL distro, a file written through
\\wsl.localhost comes out 0644, so the chmod runs inside the distro:
wsl.exe -d <distro> -e chmod go-rwx <path>. A failure is logged and
doesn't fail the write.
Run:
- internal/agent on mote (ok) and its Dsh/WSL tests on Windows
(xiaomi-gpu, ok); gofmt; go vet on darwin, GOOS=linux -tags nogui
and GOOS=windows.
- The new tests (dsh_acp_test.go) were broken by hand, each turning red:
dshSettingsAgain disabled, ownerOnly disabled, dshKeepImported
disabled, and the round's call removed.
- Real runs on mote in a sandbox HOME (~/runs/realdsh-home), never a
live ~/.dsh. After magpie's Pick, real deepseek-acp's session/new
listed magpie::deepseek/pro and magpie::deepseek/flash; without
settings.yaml it listed only DeepSeek's. With a 0644 store its boot
failed with the credentials-local error, and it started once magpie
had made the store 0600. `dsh --profile web --dump-config` shows
agent-default-model magpie and the route. `dsh headless` ate
settings.yaml into the headless profile, and magpie's round
(dshWiredOnce) wrote it again, after which ACP listed magpie's models
again.
- On magpie-desktop: `wsl.exe -d magpie-desktop -e chmod go-rwx` takes
a file written through UNC from 644 to 600.
Not tried:
- magpie's own write into a real WSL distro end to end; only the
command form above, and fakeWSL in tests.
- A WSL distro has no serving round, so after dsh eats settings.yaml
there, it comes back only on magpie's next Sync or model pick.
- A dsh from before profiles (config.yaml only) is left as before.
Also: fakeWSL answers the chmod without recording it, since it is neither
a start nor a probe (TestWSLMoreAgentsStopped counts starts).
|
||
|
|
73a12e8bf6 |
wsl: a distro's agent folder that is a link is opened where it leads (#4502)
On Windows, adding a skill or switching RTK on for an agent in WSL failed with `mkdir \\wsl.localhost\<distro>\root\.codex: Cannot create a file when that file already exists` (linusxiong). In the distro ~/.codex is a link to /mnt/c/Users/<user>/.codex. Through \\wsl.localhost Windows can't follow a link the distro has: a mkdir of it says it exists, and nothing below it can be made, written, read or listed. ggbdpq found and explained the link (thanks); their patch, which takes that EEXIST as "there", wasn't used: the writes below the link fail next (its test passed because a symlink here is followed). The fix, for every agent folder and every writer through \\wsl.localhost: - The WSL probe asks `readlink -f` in the distro where each agent folder, its skills folder and the folders beside them lead (wslLinkPaths -> distro.Links; a $HOME that is itself through a link is left alone), and which drive each Windows mount is (win:/mnt/c C: -> distro.Drives). - distro.open opens a path at or below a link where it leads: on a Windows drive, the drive's own path (C:\Users\<user>\.codex); elsewhere in the distro, through \\wsl.localhost again. native spells it back through the link, so the agent is told its own path. - A link readlink couldn't resolve is never guessed at: distro.open errors, and the agent is unreached (Agent.Unreached: its notice says why; every field Set and Sync returns it). - Writers: the agents' own files (place.join/place.open, every filepath.Join(at.home, ...) in internal/agent), the library's WSL targets (wslOpen/wslOpened; one "wsl" problem per agent and nothing written), RTK (rtkAt, rtkInstall checks agent.WSLOpen before its mkdir), the Sessions page's WSL reads (sessions.WSLHome.Open) and the Copilot CLI sign-in read (provider.CopilotWSLHomes -> CopilotWSLDirs). - Not changed: magpie's image MCP server opens arbitrary paths an agent in WSL gives it the same way; filed as #4578. Links deeper than the probed paths (other than <agent dir>/skills) aren't resolved. A distro probed by an older magpie has no Links until probed again (each run). Run: - Real Windows box (xiaomi-gpu, distro magpie-desktop, sandbox /tmp/x4502/home with .codex -> /mnt/c/Users/yeton/runs/x4502-target/.codex, .claude -> /tmp/x4502/data/claude, .pi -> a missing folder), a throwaway Windows test running the real probe with that HOME: probe said link:.codex /mnt/c/..., link:.claude /tmp/x4502/data/claude, link:.pi, win:/mnt/c C:, win:/mnt/d D:. The old way, MkdirAll(\\wsl.localhost\ magpie-desktop\tmp\x4502\home\.codex\skills\pdf) = "Cannot create a file when that file already exists" (the report's error). distro.open wrote SKILL.md to C:\Users\yeton\runs\x4502-target\.codex\skills\pdf and to \\wsl.localhost\magpie-desktop\tmp\x4502\data\claude\skills\pdf, both read back with cat in the distro through the links; .pi said "~/.pi in WSL magpie-desktop is a link magpie couldn't follow". Sandbox and target removed after. - New tests with a fake distro whose ~/.codex and ~/.claude are links to /mnt/c/... that don't exist here, so, as through \\wsl.localhost, nothing below them can be made: TestWSLFolderIsALinkToC, TestWSLFolderLinkUnresolved, TestRTKWSLFolderIsALink, TestRTKWSLFolderLinkUnresolved (library); TestWSLProbeLinks (runs the probe script), TestWSLOpenThroughLinks, TestWSLAgentFolderIsALink (config and a Claude session read on C:), TestWSLAgentFolderLinkUnresolved (agent). - Broken by hand: the library tests on the base (with a no-op FakeWSLDrives) fail with "mkdir .../home/me/.codex: file exists", the report's error; with ggbdpq's patch applied they still fail (the skill mkdir, and RTK's hook not written). - mote: go build ./...; go vet of agent, library, sessions, provider for darwin, GOOS=windows (and linux for agent, library); gofmt -l clean; go test -timeout 45m ./internal/agent ./internal/library ./internal/sessions ./internal/provider: all ok. - Windows (win-run): the same four packages. The new tests pass (the RTK ones skip: the fake distro runs sh). 32 tests are red, all already red at the base |
||
|
|
3ecc02b78b |
agent: Claude Desktop is off magpie only when Desktop itself would be (dev_quj on X)
dev_quj on X: "magpie 一直提示Claude Desktop不经过magpie,我重启了依然还是
这个提示" — the Agents row said "已不经过 magpie:配置已变更" while
Desktop ran on magpie.
The check required deploymentMode "3p" in both Claude/ and
Claude-3p/claude_desktop_config.json. Desktop decides otherwise (m4 in
4.4212's and 2.7032's index.pre.js): with a 3p configuration applied it
starts in 3p when the profile has disableDeploymentModeChooser, whatever
deploymentMode says, and otherwise unless Claude-3p's file says "1p". The
Claude folder's deploymentMode is never read. And Desktop 4.4212 deletes
Claude-3p's deploymentMode itself: a stored "1p" with no claude.ai sign-in
is dropped at start (W5r -> "[custom-3p] deploymentMode written { mode:
undefined }") and Desktop relaunches in 3p on magpie. So a file left
without the key, by Desktop or another tool, was called off magpie, and
nothing magpie could do (Reconnect writes "3p" back) kept Desktop from
dropping it again.
desktop3p now asks Desktop's question with the applied profile (magpie's
or the user's for magpie's gateway). The appliedId, address and key
checks are as they were. appReads (the "restart Desktop" notice) reads
the same effective mode instead of the two files' words, so Desktop's own
write at start isn't a change to restart for.
Real Claude Desktop 4.4212.0 (macOS zip, on mote, sandbox
--user-data-dir, never the live config): three starts with magpie's
profile applied and Claude/ {} or "3p"; Claude-3p "1p" + chooser
disabled, "1p" + chooser not set, and {} — each ran in 3p with
apiHost=http://127.0.0.1:3425 in Claude-3p's main.log, and each left
Claude-3p's file without deploymentMode. The "1p", chooser-not-set case
started in 1p, logged "deploymentMode written { mode: undefined }" and
came back in 3p. An earlier start with both files "3p" kept them.
Run at the pushed head on mote (mote busy with other sessions' GUI and
gateway suites, so the touched package only, not the full suite):
go test -count=1 -timeout 45m ./internal/agent: ok
go vet, GOOS=linux go vet, GOOS=windows go vet ./internal/agent: ok
gofmt -l internal/agent: clean
Broken by hand: desktop3p put back to the old rule (both files "3p"):
TestClaudeDesktopModeAsDesktopReadsIt red on the dropped key, the Claude
folder's key gone, "1p" with the chooser disabled, and none with the
chooser on; TestClaudeDesktopChangedSince red too. Green with the fix.
TestClaudeDesktopMSIX and TestClaudeDesktopChangedSince's 1p cases now
turn the chooser on first, as Desktop needs for 1p to count.
Not tried: Windows' Desktop (MSIX or classic) and a real gateway request
from Desktop; a signed-in claude.ai cookie (Desktop keeps "1p" then,
which magpie says only with the chooser on); dev_quj's own files, so
this is the class the report is in, not their proven trigger. No other
desktop agent reads a mode the same way; Codex/WorkBuddy checks unchanged.
|
||
|
|
c63c2136b2 |
agent: with Claude Code's own models hidden, a tier's model keeps its /model row and the switch rewrites settings.json at once (#4548)
Two gaps in the previous commit's replaceBuiltInOptions: - writePicker leaves out the row of a model a tier is on at an effort (#1616), since Claude Code shows it as that tier's row. With replaceBuiltInOptions Claude Code drops the tier rows along with its built-in lineup (2.1.316: only the Default row and the picker's own stay), so such a model was in /model nowhere. While the switch hides Claude Code's own models, every model keeps its row. - SetOwnModelsHidden saved the setting without catalog.Touched, unlike SetHiddenModels, so flipping the switch in the GUI left Claude Code's settings.json as it was until some other change re-synced it. Tests: TestClaudePickerLeavesOutATiersModelAtItsEffort gains the replace case (Terra on Haiku at max is listed); TestOwnModelsSwitchTellsTheAgents counts catalog.Changed per flip. Reviewed and run by yetone at the batch head over |
||
|
|
509d8e7d14 |
agent: a portable VS Code reads its User folder in its data folder
YOUIMARK's Windows has Scoop's VS Code 1.143, a portable build: magpie showed the editor, but its Dir stayed %APPDATA%\Code\User, which doesn't exist — code.cmd on PATH was detection enough — so the provider, models and settings.json magpie wrote went where the build never reads. Before: vscodeUserDir always took the OS's place for the User folder, %APPDATA% on Windows; only detection ever looked at the editor itself, by its launcher alone, so any portable build was found and then read and written in a folder it doesn't use. Now: a build whose launcher has a data folder beside it is portable, as VS Code itself takes a build for portable by that folder alone — a zip's own data folder, or Scoop's, whose apps\vscode\current\data is the persisted one, current a junction into apps\vscode. Its User folder is data\user-data\User there: found, wired, connected and disconnected there. The launcher is found as detection finds it, and a Scoop shim stands for the launcher the .shim beside it names, which proc.Unwrap doesn't read. Zoo Code, which keeps its settings in VS Code's User folder, is laid out by the same function and follows it. An installed build's launcher has no data folder beside it, and keeps the OS's place; so does a portable build before its first run, whose launcher alone is still detection enough, its writes then making the folder where it reads. VSCodium portable is left as it was: its data folder is named by its product.json, which no report asks after. This is the other half of the branch the Copilot-launcher fix came from (taken along with |
||
|
|
2672ba429b |
agent: Claude Code's /model honors the own-models switch too (#4548)
The "show the agent's own models" switch filtered magpie's pickers alone (agent.Picks, #1642): Claude Code's own /model rows stayed put, because nothing magpie wrote for Claude Code looked at the switch — while /model is fed by magpie all the same (modelPicker's rows are writePicker's). raclen traced the whole chain (#4548). writePicker now sets modelPicker.replaceBuiltInOptions (Claude Code's own key: with it the /model picker shows only the listed rows) while the switch is off, and drops the flag again when it is on, so the whole picker is written either way. The Default row stays under both settings: Claude Code keeps it as its own fallback. Tests: TestClaudePickerOwnModelsSwitch writes a settings.json and checks modelPicker carries the rows plus the flag with the switch off, and the flag without it with the switch on. Verification on the base |
||
|
|
e2a65cbc9b |
dsh: a start on a found group's old id moves onto the id its route lists (zyh6036 on X)
zyh6036 on X: DeepSeek Harness Desktop showed no model after magpie turned dsh on and the app restarted, while the profile's patch file was full of magpie's gateway. Cause: a dsh start (agent-default-model) magpie had set to a found routing group keeps the id the group had then, group/auto-<slug>. Since |
||
|
|
d6e1116380 |
codex: each end of the Codex app's app-server says why, and list flaps are guarded (#4550)
|
||
|
|
5cc2eea2fe |
dsh: a dsh CLI that has booted no profile yet is wired in its web profile, not config.yaml (liby233)
liby233 on Discord: in WSL magpie wired dsh in ~/.dsh/config.yaml, and dsh saw magpie's models only once they were written to its settings.yaml. With no ~/.dsh/profiles, dshAt fell back to the "pre-0.1.5" config.yaml. No dsh on npm reads that file. 0.0.1-rc.1 (the first), 0.0.1-rc.5, 0.1.0-rc.8, 0.1.1-rc.1/rc.2, 0.1.2-rc.1, 0.1.3-alpha.2 and 0.2.1-rc.5 all boot $DSH_HOME/profiles/<name> (grepped from their npm tarballs). A dsh makes no profile until one is first booted, so a fresh CLI install, in a distro or not, was wired in a file that nothing reads. - With no profile, and a dsh that is not from before profiles, magpie writes profiles/web/cordis.patch.yml as dsh's template, as it does for Desktop (#2279). dsh's initProfile adds package.json, pnpm-workspace.yaml and cordis.yml next to it and keeps the file. - "Before profiles" is judged by the CLI's version where it is known (locally from its package.json; in a distro the WSL probe now asks dsh --version). Otherwise config.yaml is used only when it holds an entry that isn't magpie's. That keeps the legacy path for a genuinely old dsh. - The sync carries a magpie model already wired in config.yaml (the reporter's state) into the profiles and drops magpie's entries from config.yaml. It does this whether or not dsh has since booted a bare web profile, and only where no profile has a model or wiring of its own. - Disconnecting before dsh ever booted the web profile removes what magpie made, as for Desktop. Tests: TestDshCLIWithNoProfileYet and TestDshConfigYamlCarriedToProfiles (new), plus wslMore's dsh row, now profiles/web. All three are red on the old dsh.go: "names .../.dsh/config.yaml, not the web profile's patch list", and the web profile is left as dsh's bare template after the sync. Tests pin dshVersion, so a dsh on the test machine decides nothing. Run (go test -timeout 45m, logs teed and grepped): - gofmt -l internal/agent: clean. go vet ./internal/agent on darwin, GOOS=linux and GOOS=windows (mote): ok. - go test -run 'TestDsh|WSL' ./internal/agent: ok on mote (macOS), magpie-desktop (WSL Ubuntu 24.04, nogui) and xiaomi-gpu (Windows 11). - Full suite `go test ./...` on mote at this change on origin/main |
||
|
|
70d50254cb |
codex: a change to the model list alone no longer ends the Codex app's app-server
The Codex app crashed and relaunched every few minutes (indekkusu141209 on X, #4550: 08:06, 08:12, 08:26). Cause. KeepCodexAppOnItsProvider ends the app's app-server whenever codexAppRoute changes. Since |
||
|
|
bec9df0888 |
sessions: a provider move leaves a thread a Codex has open (#3751)
#3751's second half; |
||
|
|
140efc8f71 |
agent: Alma is told magpie's models call tools, so it sends native tools and DeepSeek's DSML text no longer shows
ethanchi on Discord, checked with real WorkBuddy turns: Alma showed raw
DeepSeek DSML tool-call text with a magpie model. Alma decides function
calling per model from models.dev by the id (electron/model-capabilities.ts).
For an id models.dev doesn't know, such as a routing group's name
("workbuddy-ai-DeepSeek") or a plugin's model, it found none, and
electron/server.ts wrapped the model in hermesToolMiddleware. That
middleware puts the tools in the prompt, so no native tools went out and
DeepSeek answered in DSML text. The only way round it was turning on Tool
Calling in Alma's Model Options.
Alma stores that switch as capabilityOverrides.functionCalling on the
provider's availableModels (StoredModelCapabilities in
electron/database-schema.ts, written by PUT /api/providers/:id/models,
updateProviderModels). resolveModelCapabilities ->
getModelCapabilitiesWithOverrides takes a set functionCalling over the
auto value, and both places that pick hermesToolMiddleware (server.ts and
tools/agentExecutor.ts) ask resolveModelCapabilities. Read from Alma's
source at 546528ac.
almaModels now puts functionCalling: true in the capabilityOverrides of
every model it lists. That is the same claim the gateway's /v1/models
makes for every chat model (toolsTold). The drawer-only entry for image
generation is not told. A functionCalling the model already has in Alma is
the user's own, since magpie never wrote one before, so it is kept, off as
well as on (almaUserFirst, in almaWithOverrides and almaSameModels), and
it doesn't make every Sync write again. A model whose overrides Alma lost
is told again.
Tests (internal/agent): TestAlmaToldTools is new. TestAlmaToldReasoning's
pinned overrides now carry functionCalling: true, and the user's
functionCalling: false is still kept there.
Broken by hand, each red, then restored:
- functionCalling line removed: TestAlmaToldTools "relay/glm-4.6:
functionCalling <nil>, want true", TestAlmaToldReasoning red.
- user-first skip removed in almaWithOverrides: "user's off:
functionCalling true".
- user-first skip removed in almaSameModels: "second sync wrote [PUT
/api/providers/p1/models]".
Run on mote at
|
||
|
|
47173f593a |
sessions: a Codex thread left magpie keeps no reasoning OpenAI didn't seal
hentulong on X: after routing Codex through WorkBuddy and switching back,
Codex couldn't connect, and a fork said "Persisted response contains
hosted-tool, compaction, or unverifiable hidden reasoning state that
Rustponses cannot replay".
Cause: while Codex is routed through magpie to another vendor, the
reasoning items magpie hands it stay in the thread's rollout. After the
switch back Codex talks to chatgpt.com itself, and OpenAI refuses every
reasoning item it didn't seal. On the owner's real account:
- summary only, no encrypted_content: unsupported_persisted_item_context
(the reporter's Rustponses error) on a previous_response_id
continuation;
- with content (reasoning_text, what Codex 0.165 writes for DeepSeek via
magpie): 400 array_above_max_length "Invalid 'input[5].content'";
- foreign encrypted_content: invalid_encrypted_content.
Codex treats each as fatal, so that thread and its forks fail while new
threads work. No stale config: Unwire/EndFailover drop openai_base_url.
Fix: when Codex is no longer routed or failing over (Unwire, quit,
uninstall and the periodic pass), PortCodexRolloutsLeft rewrites, in
threads begun on openai/magpie, every reasoning item (and every one in a
compacted line's replacement_history) whose encrypted_content isn't an
OpenAI Fernet token ("gAAAA") into type "magpie_reasoning", without id
and encrypted_content. Codex reads an unknown type as Other and never
sends it; magpie's sessions readers still show it. The edit keeps member
order and line length (same fitLine/lock path as the existing port),
has its own state entry, and starts at 2026-09-21. A survey of 150 live
rollouts found 340 of 340 OpenAI reasoning items in the gAAAA shape.
Run (mote, at
|
||
|
|
5d955a4d4b |
tune: Codex can take the compaction advice in the background, its own limit kept (herman_hong)
herman_hong on Discord: Tuned for you advises Codex compact at ~120K.
A foreground compaction kept them waiting, so they had set 384K by hand.
Now that Codex compacts in the background, they want the advice there
and the 384K kept as the backstop.
Codex has this since 0.163.0 (checked in codex-rs at rust-v0.166.0, not
in 0.162.1): [features.async_compaction] enabled and
model_async_compact_threshold_percent, an integer share (1 to 100) of
the model's window, 65 by default. It is Stage::UnderDevelopment, runs
only with remote compaction v2 (which magpie already sets on its
provider), and starts none once the foreground limit is reached. magpie
already writes it from Settings' Background compaction (#2490), with
the version gate and the user's own keys kept. This drives that setting
from tune:
- agent: knob TuneAsync ("async_compact") on codex. TuneRead gives the
share, TuneApply turns Background compaction on at it (stashing what
Settings had the first time), and TuneUndo puts that back unless the
user changed it since. The foreground limit (Long conversations, or
the user's model_auto_compact_token_limit) is never touched. Async
keys the user wrote in config.toml come first (codexAsyncOwn): the
row says so and Apply errors. A table magpie wrote itself doesn't
count as the user's.
- gui/tune.go: advice.async holds the advice as a share of the window,
rounded down. With timed compactions it uses the token-cheapest
window, since a background compaction keeps no one waiting. It is
offered only when it would start before the foreground limit (the
lesser of the limit now and 90% of the window). held lists Codexes
too old for a share.
- context.js: the row gets a text button, "Use 120K in the background",
whose tip gives the share and says the foreground limit stays. After
Use a chip says so, with Undo background. A config.toml of the
user's, or a Codex too old, gets a one-line caveat and no button.
The too-old line is shared with Settings' row (codexHeld). No select,
no layout change. zh, zh-TW, ja and de are in i18n.js.
- The core script budget goes up by 1,571 bytes for the row
(core_budget_test.go says why). app.js is 278 bytes smaller.
Run (at this change on origin/main 6893cfbe3; rebased on
|
||
|
|
d83823d264 |
agent: a Claude Desktop Code tab session on WSL is told Desktop's window too (young02036)
young02036 on Discord: Claude Desktop 4.29.0 on Windows, a Code tab
session whose environment host is "WSL · Ubuntu", a magpie group of
Codex gpt-6.1-sol (500K) and Claude Opus 5.5 (1M) listed as
mythos-magpie-4247180078, and /context read "49.4k / 200k".
Cause: Desktop runs such a session on the distro's Claude Code, which
reads its user settings in the distro. Desktop 4.29.0's remote probe
reads them from `${CLAUDE_CONFIG_DIR:-$HOME/.claude}` there. Desktop sets
CLAUDE_CODE_MAX_CONTEXT_TOKENS only for Cowork (its bundle's one write of
it); a Code tab session gets the mythos-magpie id and no window. magpie
wrote Desktop's window, capabilities and Explore flag into Windows'
~/.claude/settings.json alone: desktopOn() was false for every
claude@wsl:<distro>. So the distro's Claude Code took the unknown id for
200K.
Fix: desktopOn() is true for a distro's Claude Code while this machine's
Desktop is on magpie (desktopSetsHere), so its Sync (desktopOnly when it
isn't on magpie itself, writeWindow when it is) writes the same values
into the distro's settings.json, and takes them out when Desktop leaves.
Turning Desktop on or off also syncs each running distro's Claude Code at
once; a stopped distro has no Sync (asleep) and is written on the first
catalog round after it starts.
Run:
- WSL (magpie-desktop, wsl-run), real Claude Code 2.1.289 in a sandbox
HOME, `claude -p --model mythos-magpie-4247180078 /context`: no env in
~/.claude/settings.json gives "30.4k / 200k" and the unknown-model
notice; CLAUDE_CODE_MAX_CONTEXT_TOKENS=500000 there gives "30.4k / 500k".
- New TestClaudeDesktopWSLContextWindow: a distro's settings.json gets
1000000 and mythos-magpie capabilities with Desktop on, the user's
model/theme kept, nothing before Desktop is on, all gone after it is off.
mote and Windows (win-run) pass.
- Broken by hand: desktopOn returning false for a distro, the test is red
("the distro's window "", want glm's 1000000").
- win-run go test ./internal/agent -run 'TestClaudeDesktop|TestWSLClaude':
only TestClaudeDesktopCarriesTheLanguage red, same at origin/main
|
||
|
|
41357f3935 |
codex: the ChatGPT desktop app on Linux is found, and a switch reaches it
pota on Discord: magpie switches the ChatGPT (Codex) desktop app's account on macOS and Windows but not on Linux. OpenAI ships the app for Linux since 08-11 (preview; learn.chatgpt.com/docs/linux/linux-app): a deb, an rpm and an Arch package, which install /usr/lib/chatgpt. Its app-server is /usr/lib/chatgpt/resources/codex ... app-server, run with the user's HOME and no CODEX_HOME, so it reads ~/.codex like the CLI. isCodexAppServer took only .app/Contents/ and Windows paths, so on Linux nothing found the app: no "still signed in as" notice after a switch, no restart of its app-server, and no version on the Agents row. - provider: linuxCodexApp takes an absolute .../chatgpt/resources/codex as the app's own app-server (findCodexApp, CodexAppStale, the switch's restart all read it). - agent: restartOnLinux; codexAppOpen knows on Linux whether the app is open (any /usr/lib/chatgpt/ChatGPT process, not its codex alone or another program's ChatGPT). desktopApps["codex"].linux reads the version from resources/linux-package-metadata.json, HasApp/AppVersion see it, and codexReaders counts the bundled codex's --version as a reader of Codex's config. version() no longer stops at an empty store read before the other sources. Real run, WSL magpie-desktop (Ubuntu 24.04), OpenAI's chatgpt_amd64.deb 26.1027.30824 (bundled codex-cli 0.166.0-alpha.5.1) under Xvfb, sandbox HOME, fake unsigned JWT accounts alice/bob (no real credentials), magpie web on 127.0.0.1:3591: - POST /api/login/switch alice: 200, auth.json alice; /api/providers then says codexApp "bob@example.com" (the stale notice). - POST /api/codex/daemon/restart-app: 200 in ~3s; the old app-server ended (app log "Codex CLI process exited classifiedAsExpected=true code=0"), a new one started with the sandbox HOME, the notice cleared. - /api/agents/cli: "codex":{"app":"26.1027.30824"}. - The same run with linuxCodexApp reverted: no notice, restart-app 400, the app-server untouched (pota's case). Run at |
||
|
|
cae01311cf |
agent: Kimi Code 2.x's notice says to reopen Settings › Providers, not to restart
After magpie writes Kimi's config.toml, every Kimi was told "reads its settings at start-up — restart open kimi sessions". That holds for the old Python kimi-cli (~/.kimi). Kimi Code 2.x (~/.kimi-code, npm @moonshot-ai/kimi-code) watches config.toml and reloads it, so an open session takes the new models at once; only its web and desktop app's model picker is read again when Settings › Providers is opened again. jiabubu picked from that stale picker and got "Model \"magpie/...\" is not configured in config.toml". The notice now follows KimiDir's legacy flag: kimi-cli keeps the restart advice word for word, and Kimi Code 2.x is told "reads this as it runs; in its web or desktop app, reopen Settings › Providers or reload the page to see new models". The same goes for Kimi in a WSL distro: wslKind gets an optional restartAt, which Kimi's kind uses to pick its notice from the distro's folder (a stopped distro reads as ~/.kimi-code, as kimiDir has it). Both new strings are in NOTICES and translated in zh, zh-TW, ja and de. Run (worktree at |
||
|
|
0407d69e84 |
provider: a group of Kimi models keeps always_thinking, dynamic tools and its default effort
jiabubu on Discord (#feedback): one Kimi Code model put in a routing group so it lists first lost "always thinking" and "dynamic tool loading" in Kimi Code, which the same model straight from its provider has. buildGroupEntries never set AlwaysThinks, DynamicTools or DefaultEffort on a group (the Entry comment said "a group has none of them"), so kimiModelTables wrote the group's table without always_thinking and dynamically_loaded_tools, and default_effort fell back to high. groupSharedKimi now gives a group each of the three when every member's entry says the same, and none of it when one member doesn't or has no entry: a group request can reach any member (rule targets are members too, ruledEntry's of()), so Kimi Code must not shape a request for a member that can't take it. The capability words are Kimi Code 2.4.1's own (catalog-runtime.ts capabilityFromDeclared), already written for direct models; kimi-cli still gets neither. Tests: TestGroupSharesKimiFacts (provider: all share, one without, efforts differ) and TestKimiCodePlanCapabilities now writes a one-member group "top" (the reporter's case: always_thinking, dynamically_loaded_tools, default_effort max) and a group "mix" with a relay model (neither word). Run on mote (mote-run, sandbox HOME): - At 83a630d69 (on |
||
|
|
1a2ce7b8ef |
agent: a model picked in Claude Code's /model beside a Claude main runs at its own window, not 200K
young02036 on Discord put Codex Plus gpt-6.1-sol (500K) and Claude opus 5.5 (1M) in one routing group, with Context set to the smallest member's (500K). Each model picked on its own showed its window. The group showed 200K. Cause: with the main model one of Claude's own, marked [1m], magpie tells Claude Code no window. Anthropic runs that model at its own window, so claudeWindow is 0 and no CLAUDE_CODE_MAX_CONTEXT_TOKENS is written. writePicker still lists every magpie model and group in /model. Claude Code 2.1.314 runs an id it doesn't know as Claude's at that MAX, and with no MAX at its own 200K. So group/mix and w/gpt-6.1-sol picked there ran at 200K. Fix: pickerApart takes desktopPlan's path when four things hold: - the main is a Claude model or a group of them; - claudeWindow is 0; - /model offers a row that is unmarked; - that row isn't Claude's and has a known window. desktopPlan also counts the picker rows (pickerRefs). The top MAX is then the largest window, and each smaller row gets its own modelSettings.<id>.autoCompactWindow. A group gets its smallest member's window, the same as every other agent; under Full window that is 500K uncapped. Every other main is as before. A told window still serves a /model pick, and a main of no known window keeps the last one. Codex, OpenCode, DSH, Pi and the rest already list the group at 500000: they read the catalog's Context, which for a group is its smallest member's. Real Claude Code 2.1.314, in a sandbox HOME against a fake Anthropic server, with `-p --model X "/context"`: - old layout (no MAX): group/mix 200k, w/gpt-6.1-sol 200k; - new layout: group/mix 272k, gpt 272k, glm 204.8k, claude [1m] 1m; - new layout without the group's entry (Full window): group/mix 500k. - go test -tags nogui ./internal/agent/: ok (289s), on the base before the rebase ( |