ac4af582301a4e8a29245dbba767eba31334ddf9
872
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
39569d5604 |
claude desktop: an optional Claude Magpie app beside your own Claude (#5671)
baranwang on X asked to keep Claude Desktop's own (1P, Anthropic) sign-in while using magpie. Turning on "Separate app" in Claude Desktop's row on the Agents page (or `magpie claude-desktop launcher add`) moves magpie's 3P wiring into ~/Library/Application Support/Claude-Magpie-3p and adds ~/Applications/Claude Magpie.app. That launcher opens Claude.app with --user-data-dir on that folder, so it runs side by side with the user's own Claude.app. Its icon is Claude's icon with a magpie badge. Off is the default, and turning it off (`launcher remove`) moves the wiring back and removes the app. It is macOS only: Desktop's packaged app strips CLAUDE_USER_DATA_DIR, and on Windows it hardcodes LOCALAPPDATA\Claude-3p. The folder ends in -3p because Desktop adds -3p to any other name. Restarting the isolated app ends only its own process (pkill on its --user-data-dir) and opens the launcher again. Run at 1b25cda26 (this change on origin/main |
||
|
|
88b541a25c |
images: every pointer names Settings › Models › Images, where the page is
The image models moved under Settings › Models, but the Library's Magpie
Image sheet, the MCP server's instructions to agents, the gateway's
"no image model" errors, the video tool's text and the docs still sent
users to "Settings › Images", a tab that no longer exists (the scattered
settings audit after netube99 on X). Every user-facing string now names
Settings › Models › Images in en, zh, zh-TW, ja and de, as do the site's
Qwen docs (en, zh, ja), llms-full.txt, the subsystem pages and comments.
Run in the tree with this change and the rest of the audit's fixes
(mote, base
|
||
|
|
dae104bfac |
capre: a length check, not an unrolled repeat, holds nine patterns
Go's regexp unrolls a bounded repeat into that many copies of its
class: [A-Za-z0-9.-]{0,254} (the session terminal's bundle id) was
89kB of program, kept from start to exit, and Codex's item-id refusal
`.{0,1000}?` 88kB. Measured one by one over magpie's 540 package-level
patterns (1.5MB in all), the nine largest bounded ones were ~440kB.
capre.MustCompile(expr, max) is the pattern with * or +, matching only
a string of max characters at most (rune count, so the (?i) Kelvin
sign and invalid bytes count as the regexp counted them). The nine:
settings' bundle id, library's name and agent id (now name@wsl:distro
cut in two), Anthropic tool names, the trace page's name and find,
access's MCP server, OpenClaw's profile and Codex's provider id. The
item-id refusal is a function: the tail within 1000 characters of a
head.
Run on mote (go1.26.8):
- go test ./internal/capre ./internal/access ./internal/settings
./internal/library ./internal/sessions ./internal/agent ./internal/gui
. : ok; ./internal/gateway -run 'ItemID|Undeclared|ToolName|Refus': ok
- TestCappedMatchesBounded holds each old pattern against its new one
over 14 units x 19 lengths (0..300, at each bound +-1); with the
length check taken out it is red (1586 mismatches).
TestItemIDRefusalAsTheRegexp holds the function against the old
regexp at 998..1002 characters of x, é, 日, \xff, \n; with 1001 it is
red. TestCappedIsSmall: 1304 bytes held, 49680 bounded.
- go vet native, GOOS=linux and GOOS=windows over the touched packages
(gui natively: its Linux build needs cgo); gofmt -l clean.
- Real build, GODEBUG=inittrace=1: magpie's own inits allocate
11.93MB -> 10.61MB.
- Idle on the real-account copy, 180s heap: regexp programs (sampled)
4.54MB -> 3.01MB.
Not tried: the full ./... suite; the gateway package beyond the run
above.
|
||
|
|
fc8e98ba47 |
edit: Codex's thousands of [projects] tables are left out of the reads that don't want them (#2278)
Codex writes a [projects."…"] table for every project it is trusted in;
the owner's config.toml has 10,933 of them in 1.5 MB. go-toml's decoder
checks each table against its siblings one at a time, so every decode
of the file cost ~0.3s of CPU, and six readers decoded it again each
time Codex wrote it, plus a whole-file check before each write magpie
made to it.
- edit.TOMLWithout drops [projects…] tables in a single unstable.Parser
pass. The agent's codexTopOf, sessions' readCodexConfig, provider's
readCodexStoreSetting, library's rtk sandbox, hooks rekey and MCP
entries read through it. None of them reads projects. A file that
doesn't parse is passed through unchanged, so it still fails.
- validateTOML checks definitions with the rest of the file and the
projects decoded apart, 128 projects to a decode. A bare [projects]
table, a dotted projects.… key outside the tables, or any error
decodes the whole file, so the error is the one it gives.
Run on mote (M5 Pro):
- BenchmarkCodexConfigDecode (10,933 projects): 283ms -> 7.6ms a decode.
- BenchmarkValidateCodexConfig: 52ms (the whole decode was 283ms).
- Startup CPU profile, first 70s, the real-account copy (the real
1,524,099-byte config.toml): 2.76s -> 2.26s of samples; go-toml
0.32s -> none sampled.
- go test ./internal/edit ./internal/sessions ./internal/provider
./internal/library ./internal/agent: all ok.
- go vet of the same five on darwin, GOOS=linux and GOOS=windows; gofmt -l clean.
Broken by hand:
- Decoding the batches into struct{} instead of a map:
TestValidateTOMLDefinitionsInGroups went red ("a key twice", "a
subtable then its key"), so the check keeps maps.
Not tried:
- the whole suite. Only the five packages that read the file were run.
- Now that projects is left out, a project table defined twice no longer
fails these readers' decode. Codex itself refuses such a file.
|
||
|
|
2b22425b45 |
agent: Claude Science in a WSL distro is found and run on magpie from Windows
shuitunlulu_ (Discord) has Claude Science in WSL2, and Windows magpie didn't find it. It is now a WSL twin (claude-science@wsl:<distro>), found by the probe's claude-science (~/.local/bin or PATH). Its daemon is restarted there through wsl.exe with ANTHROPIC_BASE_URL set, the same steps as this machine's (claudescience.go is now one scienceHost for here and for each distro), and v0.1.3334's keeper puts it back on magpie in each running distro that has a note (claude-science-wsl-<distro>.json). With no note, nothing runs in WSL. The daemon takes http only to a loopback address and sends its Claude sign-in as the key. In mirrored networking it gets the gateway's address. Under NAT magpie starts a relay in the distro: socat on 127.0.0.1:<gateway port> to Windows' WSL address. The daemon gets http://127.0.0.1:<port>/<WSL key>; the gateway's lanGuard takes the key off the path (takeWSLPathKey) before fromWSL judges it. Connect says so when the distro has no socat. Disconnect stops the relay with the connections it forked, as one process group. When Windows' firewall keeps WSL out, the row shows the same firewall drift and rule as other WSL agents. Run: - gofmt -l clean - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows (mote) - go test ./internal/agent ./internal/gateway on mote (macOS) - go test ./internal/agent on xiaomi-gpu (Windows 11): 26 FAIL; 25 fail the same at origin/main |
||
|
|
608c1543e8 |
gateway: a bare model name goes to the asking agent's own subscription first
freefcw on X: Codex, started by Mirasim, asked for gpt-6-astra by its bare
name. Its own ChatGPT subscription serves it, but magpie sent it to Devin
through the group it found (auto-gpt-6-astra, soonest renewal first).
With found groups off it still went to another vendor: Resolve takes the
first provider in the Providers order, AutoStandIn and agent.Reseat did
the same.
Now:
- A bare model id the asking agent's own subscription in magpie serves (a
provider whose Account.Agent is the agent: Codex's ChatGPT accounts,
Claude's for Claude Code, Copilot's) goes there, found groups on or off
(gateway ownFirst, provider.OwnRoute). count_tokens counts it there too.
- Kept as they were: a group the user made or changed by that name; a found
group magpie set one of the agent's fields to (agent.SetToGroup over the
applied record, #750's bare spelling included, wired as
gateway.SetToGroup); a gateway key held to some models; ids with a
provider in them and group refs; clients magpie doesn't know as an agent.
- Found groups off: a bare id several providers serve, none of them the
agent's own, is refused for an agent that has a subscription of its own
in magpie, with a 400 naming the provider/model ids and
"magpie group auto on" (provider.OffSpread). Off, magpie picks no vendor.
- AutoStandInFor and Reseat's sameModel prefer the agent's own
subscription for a found group that is gone.
Docs: gateway-routing.md's Model resolution row and the bare-ids section.
Run (mote, at this tree on
|
||
|
|
77076eef47 |
agent: an npm update on Windows lets go of magpie's own claude and codex first
CLJY (Discord) had %APPDATA%\npm with only the 308-byte sh shim of claude: no claude.cmd, no claude.ps1 and no codex at all, and `npm i -g @anthropic-ai/claude-code` ended in "npm warn cleanup ... EPERM ... unlink ...\.claude-code-<rand>\...\claude-code-win32-x64\claude.exe". On Windows a running program's file can't be removed. npm moves the old package aside, takes the old shims away, and stops partway when a claude.exe of that package is still running; the sh shim is what is left. magpie keeps such processes running itself: - the Claude subscription bridge keeps up to 6 Claude Code runs waiting for their conversations' next turns, for up to an hour; - Codex's app-server daemon has no idle exit, and magpie restarts it. Its Update button ran npm with both still up. - agent.UpdateCLI, on Windows through npm, bun or pnpm, first lets go of them: gateway.LetGoIdleClaudeCode ends every waiting run (its session shelved for the next turn, as a run let go past idleMost is) and returns once each has exited; provider.StopIdleCodexDaemon stops the daemon when no codex session is on it. Runs in a turn and sessions are left. - An update on Windows that leaves the CLI's file gone fails, saying to quit it and reinstall, instead of "updated". - proc's toolIn (FindTool) and codexExecutable no longer take the bare extensionless file on Windows, which CreateProcess can't run. Beside name.exe and name.cmd, the sh shim alone stands for the .exe it runs (Claude Code's bin\claude.exe), read from cmd-shim's exec line and kept inside its folder; a node shim (codex) or any other script is skipped. The testdata shims are cmd-shim 7's bytes, made with cmd-shim@7 on the Windows box. Run at this head (rebased on origin/main; after the rebase, vet on all three systems and the changed tests again: ok on Windows and macOS): - gofmt -l internal/: clean. go vet of proc, agent, provider and gateway on macOS (mote), Windows (win-run) and Linux (wsl-run): ok. - Windows (win-run): internal/proc ok; TestToolInNPMShShimAlone, TestLetGoIdleClaudeCodeFreesTheExe and the TestClaudeIdle* tests pass. internal/agent, internal/provider and internal/gateway (-run "Claude|LetGo|Codex") have Windows reds, and the same run at origin/main |
||
|
|
1a37cc8516 |
agent: Antigravity CLI's thinking effort is picked in its row, and the gateway asks it of Gemini
xyenon on Discord: agy's effort can't be set for magpie's models. agy 1.5.3
has --effort for one session only, and turns it away for a custom model
(/effort says "not adjustable"); settings.json has no key for it (--settings
rejects every name tried as an unknown setting). Its requests ask
thinkingConfig {"includeThoughts":true,"thinkingBudget":-1}, the model's own
choice. So the pick lives in magpie, as the Antigravity app's and Cursor
Private Inference's do: agy's row gets an effort field
(provider.AgentEffort("agy")), shown while agy is on magpie's models, with
the levels the model lists. Nothing picked leaves agy's requests as today.
The gateway had no Gemini case in withFixedEffort, so a pick, a fixed member,
a rule's effort or a mapped level did nothing on a Gemini-wire request.
withGeminiEffort writes the thinkingConfig as the model takes it, from
vertexBudgets: a Gemini 2.5 gets a budget in its range (it refuses a level;
none is its least, or 0 for flash), a Gemini 3 a level from low to high
(minimal kept), a Gemini before 2.5 is left alone. includeThoughts is kept as
asked. The effort block and the needs-reasoning retry call it with the
upstream model (withModelEffort).
At a stopped WSL distro the field reads nothing (#3896), as
TestWSLColdPlaceOpensNothing asks.
Run on mote (mote-run), at the pushed head (rebased on
|
||
|
|
b1e8eb15a6 |
agent: the function agy in a POSIX profile is agy(), which dash reads
magpie put bash's `function agy {` in ~/.bashrc and ~/.zshrc (and a WSL
distro's). On fnOS ~/.profile reads ~/.bashrc, so sh -lc, which is dash
there, read it too and stopped at a syntax error; Codync's SSH probe
failed (ljlwlcz on X, v0.1.3336). Both POSIX bodies, agyFunction's and
agyDistroFunction's, now open with `agy() {`. The keyword was there so an
alias named agy isn't expanded where the function is defined; that guard
is now an `unalias agy 2>/dev/null || true` on the line before, since a
shell expands aliases a line at a time. Blocks already in a profile are
rewritten between their markers the next time magpie writes them.
Run (mote, macOS; wsl-run, Ubuntu 24.04 where /bin/sh is dash):
- TestAgyFunctionInEveryPOSIXShell (new): each POSIX body read after an
alias agy by dash, sh, bash, zsh (mksh/busybox when present), then agy
run: here falls through to the agy on PATH, the distro one passes the
key, gateway and --model. Green on mote and in WSL.
- Broken by hand: with the old `function agy {` head it is red in dash
(exit 2, both bodies); with `agy() {` and no unalias it is red in dash,
sh (bash posix) and zsh.
- go test -timeout 45m ./internal/agent ./internal/update ./internal/cli:
ok on mote. gofmt -l clean; go vet for darwin, linux, windows ok.
Not run: the full suite, a real fnOS box, Codync itself.
|
||
|
|
f1a4b57511 |
agent: Claude Science goes back on magpie after its app starts its own daemon
shuitunlulu_ on Discord: after magpie connected Claude Science, it went
back off magpie. The daemon reads the gateway only from its environment's
ANTHROPIC_BASE_URL. The 0.1.72 app (Electron) attaches its window to a
daemon running; with none it starts its own (`serve --stdio
--adopt-install`, launch_context app-child) in its own environment, which
has no such variable. Its "let the app run it instead", and the offer it
makes once it updated past the daemon, stop magpie's daemon to do the
same. The keeper only started a daemon when none ran, so the app's stayed.
KeepClaudeScience now puts magpie's daemon back on the port the other was
on (stop, serve --detached with the variable) in three cases: a daemon
magpie didn't start, one started for the gateway's old address, or its
own older than the program installed (`--version`, asked again only when
the file changed). It does this only when status says no session runs
(active_frames and active_conversations 0; a status without them counts
as busy). It never touches one launchd or systemd keeps, and does it at
most three times an hour. It reads operon.lock every 10s and asks status
when the lock's pid changed or a minute went by.
Run:
- go test ./internal/agent (mote): ok 261s
- gofmt -l, go vet for darwin, linux and windows (mote): clean
- Real Claude Science 0.1.72 on mote, the keeper driven through a
throwaway test (not committed) against the real claude-science:
- App attached to a terminal daemon: status parsed (idle, terminal),
the daemon was replaced on port 18481 and the new one has
ANTHROPIC_BASE_URL. shell.log says "adopted daemon restarted
(45446 → 89598) — following the successor", so the window carried on.
- App opened with no daemon: it started its own (app-child, port 8000,
no ANTHROPIC_BASE_URL in ps -E). The keeper replaced it on 8000 with
the variable, and the app showed its "stopped from the command line"
screen. Reopening the app attached it to magpie's daemon
(ADOPT-RUNNING).
- Broken by hand, each red: no idle check (the busy and unknown-status
cases), no retake cap, no version skew, no lock-pid trigger.
Not tried:
- The screen's "start it again in the app" button (read in main.js:
runInvariant adopts the daemon running; reopening the app did the
same).
- A daemon with a session running: one would need a Claude sign-in.
The fake covers it.
- The Windows attach shell, and Linux.
Reported-by: shuitunlulu_
|
||
|
|
d1f8d8aae7 |
agent: Cherry Studio adds magpie through its providers link (plugins#865)
Cherry Studio (CherryHQ) shows on the Agents page, and with
`magpie cherrystudio`, on macOS, Windows and Linux. Its row is the link
its main process takes, cherrystudio://providers/api-keys?v=1&data=, with
the gateway at <gw>/v1 as an OpenAI-compatible provider named magpie and
the named key agentKeyAt("cherrystudio"). Cherry Studio asks the user to
confirm it. magpie writes nothing into its store. "Added" is read
untouched from its 2.x database (Data/cherrystudio.sqlite, user_provider),
in the default userData and every one boot-config.json moved it to. A
database or boot-config that can't be read, or a 1.x userData (Local
Storage, no database), is unknown. The data is standard base64, because
Cherry Studio swaps raw + and / before parsing and back after. /api/open
lets that link through. aionui's database status is generalized into
dbStatus{has} so both apps share it. Icon: Cherry Studio's own logo, not
cherryin-color (a different product).
Run (mote, at this change on origin/main c66cdbea9; then rebased on
|
||
|
|
a210b3bd5f |
agents: a reply limit typed by hand into Pi or OpenCode is kept
sayagoodbyeplz on Discord set Pi's maxTokens for WorkBuddy's
deepseek-v4.1-flash to 128000 in models.json, and magpie's next sync
wrote models.dev's 384000 back. magpie writes its models block whole,
so a hand edit inside it was never kept.
output_kept.go records, in the stash, per file and model, every reply
limit magpie has wanted there (the last 8). A value in the file that is
none of them is the user's, and the next sync keeps it. Pi's
providers.magpie.models[].maxTokens and OpenCode's
provider.magpie.models.<id>.limit.output go through it. A Max output the
user sets in magpie (Model settings, Advanced, or `magpie model output`)
is still written over the hand edit, since that is their word in magpie.
With no record (a model new to the file, an unreadable stash) the value
is magpie's, as before. The record keeps every wanted value, not only
the last one written, because the same block is also built for Drift
and never written.
Other agents that write a reply limit are not covered yet: #5693.
Run (mote, at this tree):
- go test ./internal/agent/ (whole package): ok, again at the rebased
head on
|
||
|
|
cdf734757a |
agent: OpenMausBot gets magpie's models back, and a Restart for a list it hasn't read
maxleebeta (Discord #feedback, 11-08) picked Antigravity's models in
magpie, and OpenMausBot's model search didn't find them. magpie wrote them
correctly: a sandbox with an Antigravity sign-in lists
antigravity/gemini-3.8-flash[1m] and the others in config.json. OpenMausBot
loses them in three ways, each reproduced on the real app:
- it reads config.json once, at start, so a list magpie writes while it
runs never reaches its picker;
- a change to any engine in its Settings writes back every engine as it
held them since it started, so magpie's newer list is replaced by the
old one;
- an edit of magpie's engine there (updateClaudeEndpoint) keeps only the
model picked.
Nothing in magpie wrote the list again: a sync runs on a catalog change,
or when magpie starts.
- KeepOpenMausBotListed (gateway.WhileServing, every 30s) writes magpie's
list again when the file lists other models (ombListStale). The model
picked in OpenMausBot (ANTHROPIC_MODEL) and its other engines stay. It
isn't a Check drift: that reads as unwired, and a port change rewires
only agents without one.
- OpenMausBot gets a Restart on its Agents row (restartApps: OpenMausBot.app,
OpenMausBot.exe; appReads: ombPart = gateway, first model, list, not the
key), so one running on an older list is offered a reopen. Its own save
of the same engine after it starts doesn't count.
The same gap in NewMax, LiveAgent, OpenPencil, OpenBot, Pencil and ZCode
is #5662.
Run (mote, at this tree rebased on origin/main 00198b26e;
|
||
|
|
06324e99e8 |
automode: say that Claude Code may have no local check behind a gateway
chenxiang0010 saw "Auto mode can't check actions in this session ... your requests go through 127.0.0.1:3425, which doesn't pass it through". magpie's comments and the gateway-routing and agent-wiring pages said that Claude Code, finding no safeguard_results, classifies locally. Claude Code 2.1.312 to 2.1.316 (read from their bundles) turn that local classifier off behind a non-Anthropic base URL when Anthropic's per-account flag tengu_bright_dragonfly is "all" (PA(), bbt(): auto_mode_side_calls_retired, localClassifierSwitchedOff). A call with no server verdict then gets "No classifier runs for this session", and each action the check would judge asks for approval. 2.1.314 adds the text for CLAUDE_CODE_AUTO_MODE_SERVER=0: "Claude Code no longer has a check of its own to use instead". So on a route only Anthropic doesn't answer (another vendor's model, another subscription's Claude, a translated route, a relay that drops the fields), auto mode has no check at all for such an account. magpie can't answer one on Anthropic's behalf. The reviewed routes (Anthropic's API, a relay passing the fields, the Claude subscription bridge) still carry the beta, safeguards and safeguard_results as before. Comments and docs only, no change in behaviour. Not changed: answering 400 naming safeguards on an unreviewed route, as Claude Code's gateway spec allows. It sets a refused latch for the session, so a later /model to a reviewed Claude stays unchecked, while the strip loses nothing. Run: gofmt -l internal (clean); go vet -tags nogui ./internal/gateway ./internal/agent on mote (ok). Not tried: a real Claude Code run, since the flag is Anthropic's per account and the reporter's route is unknown. Reported-by: chenxiang0010 (Discord) |
||
|
|
30b7a17326 |
codex: a relay's dated or renamed GPT id keeps its xhigh, max and Ultra levels
Found while looking into maomao_00001's report on Discord: the Windows Codex app offered no xhigh or Ultra for a relay's model. Their relay (vip.aipro.love, ids from its public /api/pricing) names its 31 models plainly, and every one already got its full levels in magpie-models.json before this change and gets the same after it, so this is not their fix. Exact ids (gpt-6.1-sol, openai/gpt-6.1-sol) were fine; two spellings other relays use were not: - OpenAI's dated snapshot id (gpt-6.1-sol-2026-09-29) was unknown to the catalog, so it got the low/medium/high fallback. borrowedEfforts now drops a dated suffix and takes the base model's levels. - A relay's rename (codex-gpt-6.1-sol, "[A] gpt-6.1-sol", an id the user marked the same as gpt-6.1-sol) got the levels up to max but no Ultra, because OffersUltra matched exact ids only. It now matches through catalog.IsOneOf, the lookup ContextOf and EffortsOf use. Only known models change: a dated id whose base is unknown (model-x-2026-01-01) keeps low/medium/high, a dated Luna gets its own levels without Ultra, and glm-5.3-flash keeps [low high max]. Not changed: a dashed-date id's window and price are still unknown, because catalog.SameModel doesn't strip that date form (#5643). Run: - TestCodexCatalogRelaysKnownModelsLevels red on the old code (the dated Sol and Luna at [low medium high], three renames without ultra), green with the fix. - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... and builds on mote. - go test -tags nogui ./internal/catalog ./internal/provider ./internal/agent ./internal/codexcat on mote: all ok. - The relay's 31 ids put through codex's Set with the real models.dev file (a probe, not committed): the same levels on origin/main and with this change. - Full suite: not finished. My probe runs reused the suite's copy on mote, so it was stopped; it runs again after the push. Refs: maomao_00001 (Discord) |
||
|
|
498d23b1d1 |
commandcode: providers.json entries carry a model's window and reply limit (#5567)
Command Code reads a model's context window and output limit from
providers.json alone: its parseModel2 takes raw.contextWindow (or
limit.context) and raw.maxOutput (or limit.output), its getContextLimit
falls through to its own 200K default when both miss, and its catalog
lookup keys on the bare vendor id, so "magpie/deepseek-v4.1-flash"
never matches the embedded "deepseek/deepseek-v4.1-flash" — and it
never interrogates the gateway's /v1/models. magpie's entry carried
only name, reasoning and reasoningEfforts, so a 1M-window model was
served to Command Code as a 200K one and compacted long before it had
to; the same model's dsh entry carried both numbers, per model.
ccProviderJSONAt now writes the pair the way piModelJSON does: the
window as m.Context when it is known, the reply limit as maxTokens(m)
when the model declares an output, under Command Code's own names,
contextWindow and maxOutput. A model with no output declared carries
no maxOutput.
Checked against Command Code's own bundle (command-code 1.74.1,
dist/cli.mjs): it reads contextWindow ?? limit.context and
maxOutput ?? limit.output for a providers.json model.
Run on mote at this tree: go test -tags nogui -run TestCommandCode
./internal/agent ok. TestCommandCodeModelLimits is red with main's
commandcode.go put back ("pro contextWindow <nil>, want 1048576"), and
red with the Output > 0 guard dropped ("flash carries maxOutput 0 with
no output declared"); green restored. gofmt -l clean.
Not tried: a real Command Code session against the gateway.
Reported-by: becausemadoka
Co-authored-by: ggbdpq <ggbdpq@gmail.com>
|
||
|
|
56f0956044 |
codex: switching Codex off gives a relay's table its own base_url back
Switching Codex off on the Agents page left a provider table of the
user's own (a relay, not CC Switch's) pointed at magpie's gateway, and
forgot the relay's URL for good. takeTables points such a table at
magpie while a Codex thread names it, and keeps its base_url in the
stash (codex.tables). bringOver then moves that thread onto magpie, so
by the Disconnect no thread names the table any more: giveTables asked
ccSwitchTables for the tables on magpie, which skips a table no thread
names, put nothing back, and dropped the stash. Codex was left on the
user's provider again, with that provider sending to 127.0.0.1:3425.
giveTables now reads each stashed table as it is and puts the URL back
where it still says magpie's; one the user changed since stays.
The report ("all of Codex's configuration was reset to defaults" after
the switch and a Codex restart) is not reproduced as such: every other
line of a full config.toml survives the Disconnect, an edit made while
connected too, in each auth and provider case. The new test is the
guard for all of it. TestCodexOffKeepsAppsOwnConfig guards the other
writer the switch sets off (agent.Rewired starts the library's Sync,
which gives Codex its MCP servers one way on magpie and another off it):
what the Codex app writes for its browser, Chrome and computer use
(plugins, marketplaces, node_repl with its env table and env_vars, a
server kept off, shell_environment_policy.set, [desktop]) stays through
on and off, node_repl imported into the library or not. It passed on the
old code too.
Run (mote, then the Linux box once mote's disk filled up): go test -run TestCodexOffKeepsUsersConfig ./internal/agent
(10 subtests: ChatGPT, API key, no auth, relay, relay + ChatGPT, each
with and without an edit while connected), go test -run Codex
./internal/agent ok 37s, go vet for darwin, linux and windows; on Linux (wsl-run) go test -run
'TestCodexOffKeepsAppsOwnConfig|TestRunCodexEntry|TestRunDirectServerIsCodexsCommand'
./internal/library and TestCodexOffKeepsUsersConfig ok, go vet for all
three systems of internal/agent and internal/library. The
config.toml each subtest leaves was loaded by the real Codex CLI
0.164.0-alpha.11.1 (codex mcp list, sandbox CODEX_HOME): all ten load
and list the user's MCP servers.
Broken by hand: the old giveTables back, the four relay subtests go red
with "lost base_url = https://relay.example.com/v1".
Not tried: the Codex app (ChatGPT.app) itself switched off and
restarted; the reporter's own config, version and OS (not known).
Reported-by: darwish4021 (Discord)
|
||
|
|
21a89fa4e8 |
liveagent: a model or provider of magpie's deleted in LiveAgent stays out
zero2sin on Discord: every LiveAgent restart brought back magpie's three providers as magpie wrote them (one Anthropic model, two OpenAI providers of twenty or thirty models each) over what they had edited in LiveAgent. LiveAgent's developer pointed at magpie, rightly: SyncCatalog runs at magpie's start and on every catalog change, and LiveAgent's Sync wrote every model of magpie's into magpie, magpie-responses and magpie-anthropic each time. A model the user deleted, or a whole provider of magpie's, came back on the next sync, and LiveAgent read it at its next start. TestLiveAgentProvider even asserted that a model missing from the file is put back. magpie now remembers, per config.json, which of its models and providers LiveAgent has had (liveAgentKept, in the stash). One gone from the file since is the user's: it stays out until they put it back in LiveAgent, or turn magpie off and on for LiveAgent. A model new to magpie's list is still added, once. A provider of magpie's whose models the user all deleted is left as they have it. The user's own providers were never touched and still aren't. LiveAgent's backend writes back what it holds on any settings change, so a model magpie adds while LiveAgent runs is dropped by its next save without the user doing anything. Such a model is held as pending under the LiveAgent/k-brain pids then (liveAgentPIDs, pgrep): missing under the same pids, or after LiveAgent quit, it is written again; once other pids run (LiveAgent restarted and read it), it counts as had. Windows can't be asked what runs, so there each counts as had at once. Run (wsl-run, magpie-desktop; mote's disk is full, 553MB free): gofmt, go vet ./internal/agent for linux, windows and darwin, go test ./internal/agent: every test passes but TestGrokInstalled, red on WSL2 at main too (#3548, Windows binfmt interop takes the fake grok). On mote before its disk filled: go test -run TestLiveAgent -v ./internal/agent, all 10 pass. New tests: TestLiveAgentKeepsWhatTheUserTookOut (the reporter's case: magpie-anthropic and a Chat model deleted, a provider of their own added; two syncs leave the file byte for byte; a new magpie model is added once; a model put back stays; off then on gives everything back), TestLiveAgentAddedWhileRunning, TestLiveAgentAddedThenQuit. TestLiveAgentProvider now expects a deleted model to stay out and a model new to magpie to be added on and last. Broken by hand: take() returning want unchanged (the old behaviour) turns TestLiveAgentProvider, TestLiveAgentKeepsWhatTheUserTookOut and TestLiveAgentAddedWhileRunning red ("sync 0 undid the user's edits"); wrote() marking every added model as had turns TestLiveAgentAddedWhileRunning and TestLiveAgentAddedThenQuit red. Not tried: a real LiveAgent; the reporter's own config.json; a LiveAgent that saves over a pending model and is restarted before any sync (reads as the user deleting it, documented); baseUrl/apiKey/type edits on magpie's providers are still magpie's and are written back. Reported-by: zero2sin |
||
|
|
4912e760da |
agent: TestDshLinuxDesktopEntry is skipped on a Windows host (#5617)
61394481c's entry test went red in Windows CI's "Windows dsh
configuration" step ("the AUR's entry, its program on PATH, not
found"). An entry's program is found the way the host finds one:
proc.LookPath (Windows wants a PATHEXT extension) or an absolute file
with an exec bit (Windows has none, and /home/... isn't absolute
there). The check runs only when linuxAppOS, runtime.GOOS, is linux,
so on Windows it never runs and there is nothing to test. The test
is skipped there with that reason. TestDshLinuxDesktopApp (the
folders) and TestDshLinuxDesktopAppProfile still run on Windows.
Run:
- win-run (xiaomi-gpu): go test -count=1 -run Dsh -v ./internal/agent/
(covers CI's '^Test(Dsh|KeepDsh)'): ok; red at
|
||
|
|
61394481c7 |
agent: DeepSeek Harness Desktop is found on Linux (AUR, .deb, AppImage entry)
xianhongtao (magpie 0.1.3232, Arch Linux) has DeepSeek Harness Desktop
from the AUR (deepseek-harness-desktop 0.2.2rc.1-1) and no dsh CLI.
magpie knew the app on macOS and Windows only, so it said "DeepSeek
Harness CLI not found ~/.dsh/profiles/web/cordis.patch.yml".
HasApp for dsh now also finds the Linux app (linuxApp, desktopapp_xdg.go):
- a folder holding the Electron executable deepseek-harness with
resources/app.asar beside it: /usr/lib/deepseek-harness-desktop (the
AUR's) or /opt/DeepSeek Harness (electron-builder's .deb/.rpm);
- or the app's desktop entry in the XDG data dirs (XDG_DATA_HOME first,
then XDG_DATA_DIRS, the first file of a name wins, Hidden=true hides
it): Name=DeepSeek Harness, Type Application, MimeType holding
x-scheme-handler/dsh, and its Exec program there (on PATH, or an
absolute executable file: an AppImage anywhere). Scans of a folder are
kept by its mtime, trusted only when read over a second after it
changed and for a minute at most.
Linux only; macOS and Windows keep their own checks.
Siblings: everything reading HasApp for dsh follows: the profile a fresh
~/.dsh gets (profiles/desktop), the desktop lead and notices, cliHeld and
CLIMissing (so the GUI's and the CLI's "CLI not found" go away). The
"running" check for noticeDsh2 also knows deepseek-harness, the app's
Linux executable. With both profiles present (the reporter's case) Path
stays profiles/web as on macOS; the desktop lead picks the model shown.
Run (mote, through mote-run):
- go test -count=1 -race -run 'TestDshLinux|TestDshDesktop|TestCodexLinux|Lody' ./internal/agent/: ok
- go test -count=1 ./internal/agent/ ./internal/gui/ ./internal/cli/: ok
- gofmt -l clean; go vet ./...; GOOS=linux go vet -tags nogui ./...;
GOOS=windows go vet ./...; GOOS=linux/windows go build: ok
Run (wsl-run, magpie-desktop, Ubuntu 24.04): the TestDshLinux tests
-count=3: ok. The first WSL run caught a stale scan of a folder made
again within the same mtime tick; the 1s rule fixes it.
Broken by hand (mote), each red, then restored:
- installed() without onLinux: all three new tests red ("the AUR's app:
app false, CLI missing true", "the AUR's entry, its program on PATH,
not found", the profile = profiles/web, want profiles/desktop);
- no scheme check: "another app's entry taken for DeepSeek Harness's";
- no Hidden check: "an entry the user hid still counts".
Not tried: a real AUR, .deb or AppImage install of DeepSeek Harness
Desktop (the fixtures are the AUR PKGBUILD's entry and layout as the
reporter gave them, and AppImageLauncher's entry shape); the GUI suite
(no GUI file changed). The full suite runs after the push.
Reported-by: xianhongtao (Discord)
|
||
|
|
e9bde2520d |
codex: OpenAI's threads follow Codex onto magpie from a provider of the user's, and a move the budget stopped asks for the next sync (Lice9735 on X)
Lice9735 on X, Windows, magpie 0.1.3233, Codex app 26.1104: an old chat (10-13) answered "模型提供商不匹配 — 此聊天使用的是 OpenAI,但你当前 的提供商是 magpie。请切换至 OpenAI 以继续", only a new chat worked, after |
||
|
|
e6cdeac9c6 |
proc: with no WSL distro registered, or after wsl.exe asks to be updated, magpie starts no wsl.exe (TraderX219 on X)
TraderX219 on Windows: while magpie ran, a console window "WSL 必须更新到 最新版本……按任意键安装" came up every 20 to 30 seconds. magpie asked wsl.exe for its distros (the running list retries every 30s after a failure), and Windows' inbox wsl.exe answers each run on a computer without a current WSL package by starting `wsl.exe --update --confirm --prompt-before-exit` in a console of its own. proc.Command, CommandContext and ProbeContext are where every wsl.exe magpie runs is made (agent's wslRun/wslExec, wslrun, claudetui, the library's rtk and MCP checks, the gateway's TUI helper), so both gates sit in wslOff beside #1264's ErrWSLOff: - The registry is read first (HKCU\...\CurrentVersion\Lxss, one subkey with a DistributionName per distro). With the key there or gone and no distro in it, wsl.exe isn't started: ErrNoWSLDistro. agent's wslList and wslrun's running list read that as "no distros", not as a failure or a hang, so nothing is retried every 30s. It is read at every start, so a distro installed later is seen at once. A read that fails is unknown: wsl.exe is asked as before. - When a run's output (UTF-16LE or UTF-8, stdout and stderr) says WSL must be updated or installed, proc.WSLSaid writes settings' wsl-update mark (atomic, like wsl-hung) and no magpie process starts wsl.exe for 6h: ErrWSLNeedsUpdate. The mark holds the WSL package version (HKLM Lxss\MSI Version) and the registered distros; a change to either clears it. A refused listing is unknown, so wsl.seen, WSLKept values and links are kept, never removed. docs/subsystems/agent-wiring.md describes both. Run: - mote: gofmt -l (clean); go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...; go build for darwin, linux (nogui), windows: all ok. - mote: go test -count=1 of internal/proc, agent, wslrun, library, sessions, claudetui at base |
||
|
|
32fc5809e1 |
agents: OpenMausBot gets magpie as an engine of its own, written as its own Claude endpoints are (a user on X)
A user on X asked for OpenMausBot (github.com/milind-soni/OpenMausBot,
read at 516ca75; released 0.1.145). Its bots run on engines from
`instances` in ~/.openmausbot/config.json ($OMB_DATA_DIR,
server/config.ts:713). Without this, a Claude bot reached magpie only
through ~/.claude/settings.json, and its picker listed Claude's static
models alone: OpenMausBot doesn't read the model from env
(readClaudeModelCatalog, claude.ts:296-316).
- openmausbot.go writes `instances.magpie` in the shape of OpenMausBot's
own "Claude endpoint" (newClaudeEndpoint, claude-endpoints.ts:91-139):
- driver claudeAgent, access custom
- config.configDir is <data>/providers/magpie. Given that,
OpenMausBot starts Claude Code with that CLAUDE_CONFIG_DIR and
strips account keys the engine doesn't set (claudeEnvironment,
claude.ts:111-136, 158-179), so the engine owns its routing.
- requireApiKey
- ANTHROPIC_BASE_URL, AUTH_TOKEN, API_KEY and MODEL point at the
gateway
- endpointModels holds magpie's models, kept to the ids
CLAUDE_MODEL_ID accepts. One bad id makes OpenMausBot refuse the
whole engine (claude.ts:636).
- A non-empty `instances` is the whole fleet (config.ts:1173). With
none saved, magpie writes DEFAULT_FLEET (instance-fleets.ts) beside
magpie, stashed as openmausbot.fleet. Off takes the fleet out again
if the user hasn't changed it.
- What stays the user's: the engine's name, a model they picked from
the list, their other env and an inherited `cli`.
- Check reports the base URL drifting away from the gateway.
- OpenMausBot reads config.json once at start (index.ts:780), and an
engine edited in it writes back the fleet it holds
(routes/instances.ts:132, config.ts:997-1012). So Set is refused
while it runs (errOMBRunning), and the notice asks to quit it first,
since Windows can't tell.
- ListOnly, ListsModels, OMB_DATA_DIR in agentenv. The icon is
OpenMausBot's build/icon.svg (Apache-2.0).
- i18n in zh, zh-TW, ja and de. Docs: reference, agent-wiring, both
READMEs.
- Codex bots use ~/.codex (codex.ts:373-386), which the Codex wiring
already covers.
- The agent package's TestMain holds ombRunning false. An OpenMausBot
open on the test machine refused every test that turns magpie on for
each agent: my own sandbox OpenMausBot on mote turned
TestSyncKeepsAnAddressOnAnotherMachine, TestListOnlyAgentsReadConnected
and TestReverseProxyIsStillMagpie red. With a process named
openmausbot running, they now pass. LiveAgent's, OpenPencil's and
NewMax's running checks have the same hole and are left to #5587.
Run (all on mote):
- gofmt -l: clean
- go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows: ok
- go build for the same three targets: ok
- go test -tags nogui ./... -timeout 45m at e1453a168 (this change on
origin/main
|
||
|
|
5f01b9d052 |
agent tests: the WSL probe test has a timeout(1) where macOS has none (#5570)
TestWSLProbeLooksPastWindowsCommand runs the distro probe in the host's
/bin/sh, and the probe asks a command's version under `timeout 10`.
A distro has timeout (coreutils); macOS 26.2 has none (mote's macOS
27.2 has one), so the ver: line was "sh: timeout: command not found", no version,
and the test was red on every macos-latest run since it landed in
|
||
|
|
49f207c784 |
agents: DS Bot, wired in the DSH home it runs on
DS Bot (github.com/Fei2411/DS-Bot, Apache-2.0, dsbot.app) is a DSH plugin and an Electron app built on it. The app ships its own DSH (0.2.2-rc.1 in 0.3.0) and runs it with DSH_HOME at a data folder of its own, booting the profile ds-bot, and never reads ~/.dsh: magpie's dsh row didn't reach it. It is a row of its own now, ds-bot (dsbot.go), wired by dsh's code on its folder (dshOn, split out of dshAt): magpie's routes and start in profiles/ds-bot/cordis.patch.yml, the key in that folder's .env and .credentials.yaml. The folder is $DS_BOT_HOME, else locations.json's dataDir in the app's userData ($DS_BOT_SHELL_DATA, else <config>/DS Bot, or the legacy DeepSeek Bot), else ~/.ds-bot, as the app's first-run.mjs and legacy.mjs choose it. A locations.json that can't be read or names no folder is unknown: nothing is read or written. The routes there list the models shown for DS Bot on the Agents page (dshListFor), and the serving round fills a profile the app makes there as it does ~/.dsh's (dshHomesRounds). Found by DS Bot.app (io.github.fei2411.dsbot) or its Windows per-user install (guid from its electron-builder.yml). Three notices, translated into zh, zh-TW, ja and de. DS_BOT_HOME and DS_BOT_SHELL_DATA are in agentenv's sandbox list. Run: - go test ./internal/agent/ ./internal/agentenv/ ./internal/gui/ ./internal/cli/ ./internal/appdir/ on mote: ok but internal/gui TestMainWindowCorners/macOS_26_SDK, red on mote's macOS 27 whatever the change (#3949). - go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./... on mote: ok. gofmt -l: clean. - node --test i18n-keys, i18n-en-no-cjk, agent-notice-lang (chromium), and agent-notice-lang in webkit: all pass but i18n-keys "a plugin's words are its own", red on main for three plugin words (#5332, #5426, #5482). - Real DS Bot 0.3.0 (DS-Bot-0.3.0-mac-arm64.zip) on mote, all in a sandbox HOME with DS_BOT_HOME, DS_BOT_SHELL_DATA and DS_BOT_WORKSPACE under it: a magpie built from this tree (nogui), MAGPIE_ADDR 127.0.0.1:3572, a fake OpenAI upstream on 3571 added as a provider. `magpie ds-bot magpie/fake/m1` before the app was ever opened wrote the profile; the app's first start kept it (agent-default-model still magpie's) and added its own files beside it. Its Chief Bot offered "Magpie: m1 · fake, m2 · fake"; picking m1 and sending "ping" over CDP went through magpie to the fake (POST /v1/chat/completions model m1, stream) and "pong from fake" showed. `magpie ds-bot default` then took every magpie entry out and the .env with it. Only my own pids (app, serve, fake) were stopped. Broken by hand, each red, then put back: - dsbot's desktopApps entry out: TestDsBotWired (not detected). - dshListFor always "dsh": TestDsBotOwnModels. - dshHomesRounds without DS Bot's home: TestDsBotProfileMadeWhileServing. - a bad locations.json taken for ~/.ds-bot: TestDsBotDataFolder. On the old code the tests don't build (no ds-bot row at all). Not tried: the Windows app (install path and registry guid read from its electron-builder.yml, not from an installed copy); Linux (its AppImage and deb aren't looked for; the data folder its first start makes finds it); a real vendor behind magpie; a default Bot model set in DS Bot (the notice says it wins, per its models.js). Not done: usage gives DS Bot no User-Agent of its own (its DSH's requests likely count as dsh's), and the Sessions page doesn't read its data folder's sessions. Reported-by: rnhung |
||
|
|
9ed0f1fa49 |
agents: Claude Code's prompt cache lifetime is picked in its settings
Linka (Discord) asked to set Claude Code's prompt cache TTL from magpie. Until now only Usage › Context's "Tuned for you" card wrote it, and that card offers nothing when the value is already the cheapest it found. Claude Code's opened row and settings sheet now have two rows under its own Long conversations: "Prompt cache · main conversation" and "Prompt cache · subagents". Each opens the app menu with Claude Code's default, 5 min and 1 hour. They write the keys the card writes, promptCacheTtl and subagentPromptCacheTtl in Claude Code's settings.json (agent.ClaudeCacheSet, POST /api/settings/claude-cache). Default takes the key out. A pick is the user's own: it forgets the card's stash, so the card's Undo leaves it. A variable that comes before the setting (FORCE_PROMPT_CACHING_5M, CLAUDE_CODE_PROMPT_CACHE_TTL, CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL, in settings.json's env or magpie's own) disables the row and names the variable, and the route refuses it, so a value the user set by hand is never written over. The names were checked in Claude Code 2.1.316's binary. Its resolver checks FORCE_PROMPT_CACHING_5M, then the env var, then the setting (enum "5m"/"1h"), then an agent's experimental.cacheTtl, then ENABLE_PROMPT_CACHING_1H. With nothing set, the main conversation gets 1h on a subscription within its limits and subagents get 5m. Run (mote, at this tree on |
||
|
|
0d70f335ec |
agent: the disconnect preview of a plugin's agent shows what it puts back, not nothing (plugins#799)
Purfeather found that disconnecting MiniMax Design (an agent a plugin adds)
showed the dialog's generic sentence: /api/agents/.../disconnect-preview
returned changes: []. The preview runs Disconnect in a process whose HOME
(and APPDATA, LOCALAPPDATA, XDG_*) is a temporary copy, but a plugin agent's
stash key is "plugin:<id>:" + the file's whole path, so the copied
stash.json named the file under the real home. The dry run found no stash,
read the agent as not on magpie, and changed nothing.
The same holds for every built-in whose stash key carries its file's path
(Droid, AtomCode, Cline, Qwen, Kimi, Zed, Hermes, Muse, Snow, ...): their
previews found the file wired but not what to put back, and showed magpie's
lines taken out instead of the user's model going back.
The fix is in one place, DisconnectPreview: after copying magpie's files it
rewrites the copy's stash so each key naming a path under home names it
under the copy's home (moveStashKeys/movedKey; a separator must follow
home, and Windows compares without case, since %APPDATA% can spell the
home folder otherwise). The real stash, its key format and the real
connect/disconnect are unchanged, so stashes users already have keep
working and nothing is migrated. A stash that is missing or doesn't parse
is left as it is.
Run at this head (
|
||
|
|
a9667daad5 |
codex: CC Switch's OpenAI mirror's threads follow OpenAI, and OpenAI's follow the mirror
Chris on Discord (the Codex app on a Mac): "Model provider mismatch. This chat uses OpenAI, but your current provider is OpenAI. Switch to OpenAI to continue." The Codex app names a provider by its table's name. CC Switch's OpenAI mirror ([model_providers.custom], name "OpenAI", requires_openai_auth, no base_url) is named OpenAI as the built-in openai is, and Codex up to 0.167 resumes a thread only on the provider id it is on now (app-server config_manager.rs load_for_resume and check_thread_model_provider_for_input: ModelProviderMismatch; 0.168.0-alpha drops that check). magpie left the mirror out of every thread move: bringBeside skipped it as the provider it took down, lendOwn skipped it at the top, and bringOfficial took only cc-switch-official. So a thread on the mirror stayed refused with Codex on OpenAI beside magpie, and OpenAI's threads with Codex on the mirror. Both are the ChatGPT account's threads, so they follow whichever of the two Codex is on: - bringOfficial moves every mirror table's threads to the provider Codex is on with magpie (openai or magpie), unless the mirror is at the top, a profile names it, or it is the provider magpie took down (stash codex.provider); - bringBeside takes that one, recorded, and giveBeside gives its threads back at the Disconnect that puts the mirror back on top; - lendOwn moves OpenAI's threads to a mirror at the top, and giveLent back once Codex is on OpenAI. Existing threads: each sync moves them, "custom" in place (OpenAI's length), a paginated one by its row, any age; others' ids the last 30 days with a copy kept, as before. Config.toml and the provider ids magpie writes are unchanged. Run: real codex 0.167.0 in a sandbox CODEX_HOME, `codex exec resume` of a thread on custom with Codex on openai: "This chat uses custom, but your current provider is openai" (modelProviderMismatch), resumed past the check after the relabel to openai; the reverse (custom at the top, thread on openai) refused the same way. mote (go 1.26.8): go test -count=1 ./internal/agent/ ./internal/sessions/ ok (408s, 58s); go vet ./internal/agent/ native, GOOS=windows, GOOS=linux ok; gofmt -l clean. Broken by hand: the three old exclusions back, all three new tests red (thread left on custom / on openai); bringOfficial without the stash skip, TestCodexMirrorAtTopJoinsWithItsThreads red (the mirror's thread left on openai after the Disconnect). Not tried: the Codex desktop app itself (not on any test box), and Chris's config.toml wasn't seen, so which way round his threads were is inferred from the two ids that name "OpenAI". A thread on a mirror with a profile naming it stays; after the Disconnect, OpenAI's own threads stay on OpenAI as before. Reported-by: Chris (Discord) |
||
|
|
f7cf17290c |
codex: the app's logs and sessions are read at each file's own time, not the Windows folder listing's
bitssly on X (tweet 2118722838249234609, v0.1.3177, Store Codex 26.1029.7803.0, app-server 0.166.0-alpha.6): when Codex's usage ran out the Codex app flickered, showed "Hosted AppServerManager identity is not ready" (fatal_error_broadcasted) and had to be quit and opened again, four times in a day. The page is the app's own bug after its app-server is ended (#4550), and magpie ends it on purpose when it becomes Codex's provider for the used-up account. |
||
|
|
f9a88c4fbe |
wsl: a distro's Pi from fnm, mise or an npmrc prefix is found, past a Windows one on PATH
千里不再 on Discord: Pi installed in WSL wasn't detected. The WSL probe runs `sh -lc`, which reads ~/.profile but not ~/.bashrc, where fnm's installer puts its PATH, so `command -v pi` missed it and wslbin had no fnm folder. A Pi not run yet has no ~/.pi either, so nothing found it (and for fnm users who had run it, its version was lost). Also, WSL appends Windows' PATH, so a Pi npm installed on Windows answered `command -v pi` with a /mnt/c path; that stopped the `|| wslbin` fallback and parseProbe then dropped it as a Windows command (#406), so the distro's own Pi was hidden. Now wslcmd takes `command -v` only when it isn't on a Windows drive (/mnt/X or any drive /proc/mounts lists), else walks PATH past Windows drives, else wslbin. wslbin gains the folders proc.UserBinDirs has here: fnm (aliases/default, then the highest version; FNM_DIR, ~/.local/share/fnm, ~/.fnm), mise's installs (highest), ~/.npmrc's prefix, ~/.npm/bin, cargo, deno, Homebrew. Every WSL kind goes through it, not only Pi. Run: - mote: GOOS=windows/linux/darwin go vet ./internal/agent; go test -run "TestWSL|TestOmo|TestPi" ./internal/agent ok. gofmt -l clean. - wsl-run (magpie-desktop, Ubuntu 24.04): same tests ok. - Real WSL: in magpie-desktop, a scratch HOME with the real fnm installer, `fnm install 22`, `npm i -g @mariozechner/pi-coding-agent` (pi 0.73.1), never run. Old probe: no bin:pi. New probe: `bin:pi .../fnm/aliases/default/bin/pi`, `ver:pi 0.73.1`, pi@wsl listed; a fnm codex was found past a /mnt/c one. Real home still finds codex, pi and claude (3.9s). Through proc.CommandContext on Windows (win-run) with Detect agents in WSL on, the probe runs (#4872 gates only when it is off). Broken by hand: origin/main's wsl.go with the new tests: all four subtests of TestWSLProbeFindsNodeManagersBins and TestWSLProbeLooksPastWindowsCommand red. Not tried: the reporter's own install (method unknown; fnm with a never-run Pi is the case reproduced). Asking bash -i for ~/.bashrc's PATH was tried and dropped: under timeout(1) an interactive bash stops itself (state T) on WSL and outlived its timeout. Reported-by: 千里不再 (Discord) |
||
|
|
dbaeaec124 |
claude-desktop: a model picked for two tiers is listed for the second too, so that tier isn't left empty (#5534)
Claude Desktop keys a profile's inferenceModels by name and reads one tier
off an entry: for each tier, the entry tagged with it (isFamilyDefault
first) names ANTHROPIC_DEFAULT_<TIER>_MODEL for the Code tab's Claude
Code (JNn/WNn in 4.16336's app.asar, FPn in 4.23118's). desktopTierOf
tags a model picked for two tiers with the first only, so the second had
no model. dawei picked copilot/claude-sonnet-5.5 for sonnet and haiku
(Copilot has no Haiku 5.5); Desktop spawned Claude Code with
ANTHROPIC_DEFAULT_HAIKU_MODEL empty, and its small tasks (WebFetch page
summaries) ran on the session's copilot/claude-opus-5.5 at 94-244 s each.
Now:
- desktopSharedTiers: each tier whose pick an earlier tier already has.
- DesktopInferenceModels lists such a model once more per later tier,
after the rows (the first row, which a new session starts on, stays
first), tagged with the tier and isFamilyDefault, with the row's 1M
fields and its label plus " · <tier>".
- desktopTierAlias names it in the form claudeLooking gives the model
under a number made of its id and the tier (magpie-<n>.anthropic.<model>,
mythos-magpie-<n>, or anthropic/magpie-<n> for a model listed by its own
id). aliased reads that number back to the model, so the gateway serves
it as the pick (desktopTierAsked), and a session saved on it is still
served after the picks change.
- desktopRunsAs (previous commit) gives it behavesAs where Claude Code
doesn't know the id.
- agent: CLAUDE_CODE_MODEL_CAPABILITIES and the modelSettings budgets
carry the extra ids too (gateway.DesktopTierAliases).
- docs/subsystems/gateway-routing.md and agent-wiring.md say so.
Not changed: /v1/models still tags one row per model (Desktop reads no
/v1/models while the list is written); the Providers page's Desktop
number is the first id's. Desktop's menu shows the extra entry
("Claude Sonnet 5.5 · Copilot · haiku"); the list has no hidden entries.
Ported from mdwsk88's desktop-tier-shared-pick (817edde09), reviewed line
by line. Added here: TestDesktopTierSharedPick's "every tier" (one model
for opus, sonnet, haiku and fable: three extra entries, every name
distinct, each tier tagged once, each id read back and its tool-less
small task served on the pick while the session is on another model)
and "own id" (a Claude model with no reasoning levels, listed by its own
id: the later tier is anthropic/magpie-<n> with behavesAs that model).
Run on mote (go1.26.8):
- TestDesktopTierSharedPick (4 subtests), TestDesktopGroupPickRunsAsItsModel,
TestClaudeDesktopModelsSharedTier, TestClaudeCapabilitiesDesktopSharedTier:
ok. Broken by hand, each red:
- desktopSharedTiers looping over no tier (the old behaviour): all four
subtests ("haiku has no entry"), and both agent tests;
- aliased not reading a tier's number back: all four subtests
("magpie-2213721611.anthropic.claude-sonnet-5-5 read back as ...").
- go test -run 'Desktop|Claude|Alias|Tier' ./internal/gateway
./internal/agent: ok. go vet darwin, linux (-tags nogui), windows,
go build ./...: ok. gofmt -l: nothing.
- Desktop's own code: the list this commit gives for opus m1, sonnet and
haiku claude-sonnet-5-5, fable m1, run through JNn/WNn taken verbatim
from Desktop 4.16336's app.asar in node: HAIKU =
magpie-2213721611.anthropic.claude-sonnet-5-5, FABLE =
mythos-magpie-7663130977, OPUS and SONNET as before. The same list
without the extra entries (the old one): HAIKU and FABLE "".
Not tried: a real Claude Desktop reading the list and starting Claude
Code; the Playwright suites (no GUI file changed). The full suite runs
after the push.
Reported-by: dawei (Discord)
Co-authored-by: mdwsk88 <11055210+mdwsk88@users.noreply.github.com>
|
||
|
|
e1eeeed734 |
browser: the extension's key connects Magpie Browser and nothing else; own needs this computer; a key turned off closes its browser
|
||
|
|
f4068ccc25 |
proc: with Detect agents in WSL off, no wsl.exe is started on any path (#4872)
With Settings' Detect agents in WSL off (noWSLAgents), every Claude request still reached wsl.exe: wslReady (wslClaudeStandIn, wslCodexStandIn) and wslClaudeClassifier listed the running distros without asking wslLooks, the gate #1264 put on wslAgents, wslHomes and WSLRunning. wslrun's Up, In and running weren't gated either (only Find was). On a computer without WSL, Windows' inbox wsl.exe answers each ask with a window offering to install WSL, one per request. The fix is at the one choke point every command magpie starts goes through (TestNoCommandBypassesProc): proc.Command and CommandContext (and so ProbeContext, wslrun.Tool.Command/Probe, the Claude TUI helper's ConPTY start, which checks cmd.Err) refuse wsl.exe by any name or path (wsl, WSL.EXE, C:\Windows\System32\wsl.exe) with proc.ErrWSLOff while the setting is off, as a probe of an app's own program is refused. The paths that reach it: agent's wslRun/wslExec (lists, probes, links, chmod, reach), wslrun.Run/Find/In/Up/Stop, library's cmdvars, mcp_wsl, mcp_check and rtk_wsl, claudetui's wslread, the gateway's Claude Code in WSL. The settings read is settings.Shared() and only for a wsl name. Not gated: the Sessions page's resume line for a WSL session (a string a terminal runs on the user's click), whose sessions aren't listed with detection off. skygunner/vincent's stand-in fix is kept as well, so the stand-in and classifier return before taking wsl's lock or recording a failed list. Run: - mote-run: go vet ./internal/proc ./internal/agent ./internal/wslrun; GOOS=windows go vet of proc, agent, wslrun, claudetui, library, gateway; GOOS=linux go vet of proc, agent, wslrun, claudetui: clean. go test -count=1 ./internal/proc ./internal/wslrun ./internal/claudetui: ok; -run 'WSL|Wsl|Dsh' ./internal/agent ./internal/library ./internal/sessions: ok. gofmt -l: nothing. - win-run on xiaomi-gpu (Windows 11, real wsl.exe present): the four new tests plus TestWSLDetectionOff, TestWSLClaudeStandIn, TestWSLCodexStandIn, TestNoCommandBypassesProc: ok; -v shows each new test PASS; go test ./internal/proc ./internal/wslrun whole: ok. TestWSLRunnerRefusedWhenOff runs agent's real wslRun there. Broken by hand (wslOff's check made `if false && …`, agent/wsl.go at origin/main, new tests kept), on mote: TestWSLOffStartsNoWSL red for every name and maker, TestRunRefusedWhenOff "Run ran wsl.exe: exit status 1", TestWSLRunnerRefusedWhenOff red, TestWSLStandInAsksNothing WhenOff red with three "-l --running -q" asks. Not tried: the reporter's own Windows without WSL (the install window itself); the full suite runs after the push under the suite lock. Reported-by: 陌离 (Discord) Co-authored-by: vincent <vincent@users.noreply.github.com> |
||
|
|
2000ae4398 |
antigravity: each model's window reaches the app through its catalog; the notice names what a gateway turns off (YujunT46308)
YujunT46308 on X: wired through magpie, Antigravity 2.29.0 showed a
200K window for every model, and after a restart it lost /boost,
/teamwork, /plugin and /generative_ui.
The window. The app's backend (Resources/bin/language_server) resolves
models from models.list, then models.listSource (a remote catalog,
fetched with the gateway key), then <url>/v1/models, then its built-in
catalog. From /v1/models it reads the id alone; a model its catalog
doesn't know gets its family's defaults, maxTokens 200000. No field of
the OpenAI list (context_window, context_length, max_input_tokens) is
read. magpie now points models.listSource at
<gateway>/v1/models?format=antigravity, which answers {"list": [...]}
in the app's own fields (modelId, displayName, maxTokens,
maxOutputTokens, supportsImages, supportsThinking) for the models the
key may use. A field magpie doesn't know is left out. The user's own
listSource is stashed with their gateway and put back; Sync adds the
catalog to a file wired before, at the gateway's current address.
The picker now shows magpie's names, so NoNames is off for it.
The Google features. Not fixable on this route: on a gateway the app
uses no Google sign-in and its backend calls neither cloud_code_endpoint
nor api_server_url (headless run below), and Google's docs say a gateway
and a Google Account can't be used at once. The experiments and
commands Google's servers turn on for a signed-in account are off while
it is on magpie. No key in settings.json keeps both. The notice shown on
connecting (GUI toast, CLI) now names what is lost and that turning it
off gives it back, in en, zh, zh-TW, ja, de.
Run (mote, at this head unless said):
- go test -tags nogui ./internal/agent ./internal/gateway -run Antigravity:
ok. Broken by hand: the listSource writes taken out ->
TestAntigravityGateway, TestAntigravityCatalogSource,
TestAntigravitySyncAddsCatalog red; the ?format branch taken out ->
TestAntigravityCatalog red.
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui,
GOOS=windows go build: ok.
- GUI (Chromium and WebKit): i18n-keys, i18n-en-no-cjk,
agent-notice-lang, about-notices, gui-de, gui-ja, gui-zh-tw,
name-suffix-no-names at the pre-rebase tree (only i18n.js differs in
the GUI): all pass except i18n-keys "a plugin's words are its own",
red the same on origin/main
|
||
|
|
37c1bc043b |
agent: a group whose members all serve Responses, one best there, is asked on Responses
zyh6036 on X: several subscriptions that all serve the Responses API were asked on Chat once they were put in a routing group. Pi, OmO, omp, StepCode, droid, dsh, Hermes, Grok CLI and the live agents ask each model on the one API catalog.Model.APIs names, and a group had Responses only when every member's Native was Responses (allResponses, #1594). A relay that serves Chat and Responses, best on Chat (no Base URL API given, not OpenAI's own host), counts as Chat there, so one such member put the whole group on Chat, and the gateway then translated Chat to Responses for the ChatGPT, Copilot GPT or Responses-relay members. Found groups (auto-<slug>) hit this without the user doing anything: a new relay that also lists gpt-5.5 moved auto/gpt-5.5 from openai-responses to Chat (pi_api_test shows it). provider.GroupAPI now gives Responses when one member is best on Responses and every other takes a Responses request as it is (Responses among the APIs it relays), or translates every request anyway (a Claude Code subscription). So no member is translated that Chat would have relayed, and the ones best on Responses are relayed, not translated from Chat. The gateway already relays a /v1/responses request to each member that serves it (usable), so nothing changes there. Mixed groups: a member that Responses doesn't reach (a Chat-only key, a Messages-only Claude) keeps the group on Chat, where that member is relayed; picking Responses there would translate it on every turn. A Messages-only group stays on Chat as before (#1594's reason: a Claude member's thinking is known by its own model id, not the group's). An agent plugin's connect is told a group's native_endpoints now (provider.GroupEndpoints: the APIs every member relays), where it had none. /v1/models still leaves them out for a group: TestRemoteMagpieNativeAPI holds that a remote magpie sends a group's request on in the client's API for the other side to pick per member. No setting added: the group's API follows from its members. Run (mote, through mote-run): - go test ./... -timeout 45m at 65780f04f on |
||
|
|
fcc0daa23e |
usage: Tuned for you tells Claude Code's cache here with no calls, and an hour of the user's has Use 5 min
linkaww (Discord, #help) set Claude Code's prompt cache to 1 hour from Usage > Context > Tuned for you and asked how to go back to 5 minutes. On the computer that sends its requests to a Remote magpie the card was empty, so there was nothing to see or undo. Cause: the card's rows came only from advice, which needs 50 calls read from this computer's session files, or from a knob tune put in itself (TuneKept, v0.1.3120). A Remote-magpie client with too few calls read here, or a 1 hour it didn't put in through magpie (set on the other computer's card and copied, set by hand, or stashed by a version before 3120), had no row. The setting itself is Claude Code's settings.json on the computer where Claude Code runs (promptCacheTtl, subagentPromptCacheTtl); a Remote magpie's requests read B's, not A's. Now: - agent.TuneCacheHere reads Claude Code's two cache lifetimes on this computer whoever set them: the main conversation's always, the subagents' when something sets it, nothing when there is no ~/.claude. adviseOf adds them to the kept knobs, so Claude Code's card shows with no calls at all, each row's Now saying 1 hour, 5 minutes or Default. - A row with too few calls at 1 hour that magpie didn't put in has Use 5 minutes (tooltip: Replaces your 1 hour; Undo puts it back); after it, Undo gives the hour back from the stash. A variable that comes first (CLAUDE_CODE_PROMPT_CACHE_TTL, FORCE_PROMPT_CACHING_5M) still locks it. - A row with too few calls no longer reads "Already the leanest". - The three Use buttons share one helper, which pays for the new one: context.js is 82 bytes smaller, TestCoreScriptBudget's budget untouched. No new strings. Run (mote, via mote-run): - go test ./internal/agent ./internal/gui -count=1: agent ok; gui's only reds are TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote) and, before the helper, TestCoreScriptBudget (fixed as above); after: -run 'CoreScriptBudget|Tune' ok. - context-tune.test.cjs in Chromium and WebKit, all five languages, 360 and 1100 wide: 24 of 24 ok. i18n-keys: every test ok but "a plugin's words are its own", red on main for three strings in other files (#5332, #5426, #5482). - gofmt -l clean; go vet darwin (touched packages), GOOS=linux -tags nogui ./... and GOOS=windows ./... ok; builds for all three ok. Broken by hand: - old internal/gui/tune.go: TestTuneTellsTheCacheHere red ("the user's own 1h, no calls: rows []") and TestTuneKeepsWhatItPutIn red. - old context.js: the new GUI test red in both engines (Now read "—" where Default is expected). Not tried: a real Remote magpie pair (two computers) with linkaww's settings, and a real Claude Code session reading the 5m after the press; the whole GUI suite ran after the push, not before (suite lock held). Reported-by: linkaww (Discord) |
||
|
|
f9e6061b85 |
claude: claude-magpie runs Claude Code through magpie, a plain claude left on the user's account
baranwang on X (11-06): `claude` stays on the user's own Claude account, `claude-magpie` goes through magpie, and nothing is switched back and forth. `claude-magpie` runs `magpie claude run [args…]`. That writes a settings file of magpie's own, <config>/claude-launch/settings.json, connected as Connect connects Claude Code (the gateway, its key, the shared LAN key when sharing is on, the model, the tiers) and starts `claude --settings <file> args…`. Claude Code puts a --settings file's env and model over the user's settings.json, a claude.ai sign-in and the shell's variables (tried on 2.1.318), so ~/.claude/settings.json is never rewritten. ANTHROPIC_API_KEY and the cloud switches (Bedrock, Vertex…) are blanked in the file, so neither the user's file nor the shell can take a request past magpie. The file is the agent `claude#launch`, listed nowhere: the Agents page, Check and Notice see only the user's file. It is set again when the gateway moved or its key changed. - /model in a claude-magpie session saves to the user's settings.json (Claude Code never writes a --settings file). After the session a magpie model picked there moves into the launch file, for the next claude-magpie, and the user's file gets its model back. A Claude alias (sonnet) stays. - Claude Code's own one-time `opus` -> `opus[1m]` rewrite of the user's file (migration_opus_to_opus1m), which the launch file's 1M opus tier sets off, is undone the same way. Found in the end-to-end run below. - claude runs as a child so that can happen: on Unix a stopped child stops magpie too (^Z, fg; proc.WaitFollowingStops reaps it with WUNTRACED, as cmd.Wait can't see a stop), and claude's exit code is magpie's. On Windows magpie ignores Ctrl+C while claude has it. - The command: a launcher beside the `magpie` command. Settings › Command line (AddCLI) writes it; `magpie claude launcher [add|remove]` adds it for a command put there before. It is a `#!/bin/sh` exec of magpie's stable path, or on Windows a .cmd running "%~dp0magpie". A file by that name without "written by magpie" is never written over. - Docs: agent-wiring.md, and the start page in en/zh/ja. Run at this commit (rebased on origin/main |
||
|
|
be5e8f29f1 |
dsh: its own models are the two it ships, deepseek-flash named DeepSeek-V4.1-Flash (Kylin_Cloud on X)
Kylin_Cloud (X, 11-06, v0.1.2606): DeepSeek Harness's direct models in magpie listed deepseek-v4-flash, which dsh doesn't have, and showed deepseek-flash as "DeepSeek-V41-Flash"; dsh's built-ins are only DeepSeek-V4.1-Flash and DeepSeek-V4-Pro. Cause: dshModels is a table copied by hand from dsh 0.1.5 ( |
||
|
|
b020ae1022 |
agent: Claude Desktop 4.23118.0's gateway window still has no Chinese (xwoffice)
xwoffice on Discord: "Claude Desktop 接入以后界面会变成英文 取消了又恢复成中文".
Nothing changes in behaviour; this records that the cause is still
Desktop's, in the newest release too.
On magpie, Desktop runs in its 3p mode, whose window is its bundled UI.
Read from Desktop 4.23118.0 (darwin RELEASES.json currentRelease,
published 11-05, downloaded and unpacked, not run):
- Resources/ion-dist.asar's i18n has en-US de-DE fr-FR ko-KR ja-JP es-419
es-ES it-IT hi-IN pt-BR id-ID, no zh. Its supported list in
assets/v1/shared-99 and shared-67 is the same 11, and the window maps
navigator.languages onto them, else en-US, then calls
electronIntl.requestLocaleChange with that pick on mount.
- app.asar's resources/frame/shell/i18n/frame-shell has the same 11.
- app.asar's resources/i18n has zh-Hans and zh-Hant, for the signed-in
(claude.ai) window only. So disconnecting brings Chinese back.
magpie carries the signed-in "locale" into Claude-3p/config.json
(desktopCarryLocale), but Desktop writes its own pick over it at every
start. Nothing magpie can write keeps Chinese there, and magpie doesn't
patch Anthropic's signed app. Chinese readers are told so on the
Agents row and in the switch-on notice since v0.1.2123 (
|
||
|
|
6bc5702cd4 |
agent: magpie's OpenCode provider sets setCacheKey, so OpenCode sends its session's prompt_cache_key (#5468)
mariamatrix (#5468) and mahiro233 on Discord: magpie writes OpenCode's magpie provider with @ai-sdk/openai-compatible and only baseURL/apiKey, so OpenCode sends no prompt_cache_key and an upstream that caches by it misses. Checked against OpenCode's source and real runs (sandbox HOME on mote, a recording Chat server): - 2.2.5: v1/config/migrate.ts maps options.setCacheKey to compatibility.supportsPromptCacheKey, and openai-chat.ts sends prompt_cache_key only then. Without it: no key; with it: "prompt_cache_key":"ses_…" on the turn and the title request. A config with magpie's provider under providers, compatibility.supportsPromptCacheKey true, sends it too; without, none. - 1.19.5: setCacheKey true sends camelCase promptCacheKey (the previous commit sends it on as prompt_cache_key). - 2.0.25: ignores the option; the run answers as before, no error. Now: - the "opencode" shape's options have setCacheKey: true. Every writer of provider.magpie goes through it and openCodeKept: OpenCode, its OPENCODE_CONFIG_DIR copies, MiMo Code, DevEco, Air's OpenCode and OpenChamber's. - openCodeNative writes it as OpenCode 2 does: compatibility .supportsPromptCacheKey, not a setting. - a setCacheKey the file has already under provider.magpie.options, or a supportsPromptCacheKey under providers.magpie.compatibility, is the user's (false too) and stays, through a sync and a pick. Kilo has no wiring in magpie; no other agent's config has this option. TestAirProviderWritesKeepCustomFields compared every option as a string; it now compares a bool as its JSON. Run on mote: go test ./internal/agent (full package) ok; go test -run 'OpenCode|CacheKey|Air|OpenChamber|Deveco|Mimo|KeepTheir' ./internal/agent ./internal/gateway ok; go vet on darwin, GOOS=linux, GOOS=windows; go build ./... (darwin, windows); gofmt clean. Broken by hand, each failing TestOpenCodeSetsCacheKey: no setCacheKey in the shape ("no setCacheKey"); no keep under provider ("the user's false not kept"); no keep under providers (same); no move out of settings ("setCacheKey in OpenCode 2's settings"). Not tried: a config written by a running magpie fed to a real OpenCode (the real runs used configs of the same shape, written by hand); a real upstream's cache hit rate before and after. Reported-by: mariamatrix Reported-by: mahiro233 |
||
|
|
6b91c2ea5b |
usage: a cache or window Tuned for you put in keeps its Undo with too few calls
linkaww on Discord (11-06): "之前在用量 - 上下文把Claude Code缓存改成了1h 请问在哪里改回5m". Usage › Context › Tuned for you is the one place in the GUI that sets Claude Code's promptCacheTtl, subagentPromptCacheTtl and a model's autoCompactWindow, and its row (with Undo) came only from advice, which needs 50 calls in the range. On Today, or a quiet week, the row and the way back were gone, and an agent with no calls had no card at all. agent.TuneKept lists the knobs tune put in (its stash, read back as ours, not under Long conversations). /api/tune adds each one that has no advice row as a few row, and keeps an agent with none of its own calls when it has one. The card draws a few row as In use with Undo and "Not enough calls in this range to tune on", and no curve; the card's totals skip it. A value the user wrote themselves is not listed. Codex's compact is left out: Settings changes it. Run (mote, at this tree): - go test ./internal/agent ./internal/gui -count=1: agent ok. gui is red only in TestMainWindowCorners, which is red the same way on a fresh origin/main |
||
|
|
773902a77b |
provider: Find copies the provider it gives; a list asks each group once
In the same live profile (v0.1.2906, two idle minutes, 269 MB): - provider.Find copied every provider through All, each account's keys and headers, to give one (9.3 MB); All's copies were 4.6 MB of their own. sharedAll is the providers held, for reading; Find and resolveIn copy only the one they give, and the pricers read sharedAll. - buildModels asked a group's members up to five times (its compaction, its price twice, its protocols, its tiers), each walking the members and resolving each (GroupFinder 7.9 MB, membersFound 6.3 MB). provider.FoundOnce answers each group once per build; every caller only reads the members. Run (mote, at this tree): - gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet ./internal/agent/ ./internal/provider/: clean - go test -count=1 -timeout 45m ./... (all three commits' tree): 85 packages ok, internal/gateway 748s, internal/provider 193s. Two red: internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, filed before, untouched here), and internal/agent's TestCodexEffortOptionsReadTheKeptList, whose bar counted the environment's copy (see the effort test's comment), fixed in its test. - then go test -count=1 -timeout 45m ./internal/agent/ with that fix: ok (200.1s) Broken by hand (mote, -run): - Find through All again: 167 allocations against a bar of 60, red; green it is 6 (TestFindCopiesTheOneItGives, which also checks that a change to what Find gives reaches neither the next Find nor All). - FoundOnce forgetting what it found: group:a walked 5 times, red (TestFoundOnceAsksEachGroupOnce). Not tried: the numbers on the live app after this build. |
||
|
|
fb4632ee0c |
agent, provider: Codex's polls and the usage quotas read what is kept
Heap profile diff of the live magpie (v0.1.2906, /v1/magpie/heap, two idle minutes with the window open: 269 MB allocated): - ownCodex found the codex provider through provider.All, a copy of every provider, on each look (~9 MB). Its picks are now kept per stamp (codexPicks, stampedLists), read only. - Codex's model and effort fields copied magpie's whole model list on each Options call, every poll of the effort field (~11 MB). They read sharedModels, the list kept, which they only read. - visibleQuotas built every provider's offered models to narrow Gemini's and Antigravity's quotas (~20 MB). exposedIDs builds the providers asked only. Run (mote, at this tree): - gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet ./internal/agent/ ./internal/provider/: clean - go test -count=1 -timeout 45m ./... (all three commits' tree): 85 packages ok, internal/gateway 748s, internal/provider 193s. Two red: internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, filed before, untouched here), and internal/agent's TestCodexEffortOptionsReadTheKeptList, whose bar counted the environment's copy (see the effort test's comment), fixed in its test. - then go test -count=1 -timeout 45m ./internal/agent/ with that fix: ok (200.1s) Broken by hand: - codexPicks through provider.Find again: 285 allocations, red (TestCodexOwnModelsFollowPicks, bar 20). - the effort field on magpieModels again: 199896 bytes a look past its StampNow's 1712, red (TestCodexEffortOptionsReadTheKeptList, bar 20000). The test takes the look's StampNow off: os.Environ copies the environment, and each t.Setenv before it in the package made that longer (an Unsetenv leaves its slot), ~56 KB a look in the whole package; run alone it is 1.7 KB. - exposedIDs without the ids check: "other" built, red (TestExposedIDsBuildsOnlyTheProvidersAsked). Not tried: the numbers on the live app after this build; that profile is taken once it is released. |
||
|
|
dfa42c07cd |
agent tests: an allocation count is the fewest of five rounds
TestAlmaProvidersSeenDecodeOnce (v0.1.3114) went red in the whole internal/agent package on mote: 401 allocations against its bar of 400, green alone. testing.AllocsPerRun counts every goroutine's allocations, and another test's watcher or poll left running lands in a round now and then. leastAllocs takes the fewest of five rounds, which such a stray reaches in one round, not in all five; leastBytes does the same for bytes (runtime.MemStats TotalAlloc). Run (mote, at this tree): - gofmt -l internal, go vet ./..., GOOS=windows and GOOS=linux go vet ./internal/agent/ ./internal/provider/: clean - go test -count=1 -timeout 45m ./... (all three commits' tree): 85 packages ok, internal/gateway 748s, internal/provider 193s. Two red: internal/gui's TestMainWindowCorners/macOS_26_SDK, mote's macOS 27 (#3949, filed before, untouched here), and internal/agent's TestCodexEffortOptionsReadTheKeptList, whose bar counted the environment's copy (see the effort test's comment), fixed in its test. - then go test -count=1 -timeout 45m ./internal/agent/ with that fix: ok (200.1s) Broken by hand: with the bytes.Equal check in almaProvidersSeen removed the look measures 7232 allocations and goes red, as before. |
||
|
|
6a78060c6d |
agent: Alma's providers are not decoded again from the same answer
almaProvidersSeen decoded Alma's providers list each time it was asked past almaReadFor, on each poll of the Agents page. On the live magpie (v0.1.2906) Alma's answer is 227 KB, and its json.Unmarshal was ~13 MB of what an idle two minutes allocated (heap profile diff from /v1/magpie/heap). The same bytes are now answered with the providers they gave last time, by pointer or by bytes.Equal; changed bytes are decoded as before. Run (mote, at this tree): - go vet ./internal/agent/, gofmt -l: clean - go test -count=1 -timeout 45m ./internal/agent/: ok (216.6s) - TestAlmaProvidersSeenDecodeOnce's new part (almaReadFor 0, AllocsPerRun of a look) is green at most 400 allocs; with the bytes.Equal check removed by hand it measures 7232 and goes red. Not tried: a live Alma app against this build; the bytes compared are what almaGet already returned. |
||
|
|
d2c29abe73 |
codex: a chat the Codex app had open as magpie became its provider moves once the app lets it go (crypto0xfish on Discord)
crypto0xfish on Discord, the Codex app: "Model provider mismatch. This chat uses OpenAI, but your current provider is magpie. Switch to OpenAI to continue." magpie makes itself Codex's provider (model_provider = "magpie") when Codex has no ChatGPT sign-in, is signed in with an API key, the user picks magpie API, or the ChatGPT account is used up (the takeover). bringOver then moves OpenAI's threads to magpie, a paginated one by its row (RetagPagedCodexThreads), skipping any a Codex holds open (its writer lock) or wrote to in the last minute, "for the next sync". The Codex app holds the lock of every thread it has loaded, the chat on screen among them, however long ago it was written (tried below), and nothing asked for that next sync: Sync runs on catalog changes, which can be hours away. So the chat open at the switch stayed on OpenAI; the app refuses it while loaded (app-server check_thread_model_provider_for_input compares the loaded thread's provider with config.toml at each turn), and after the app let it go it was refused again on resume by its row, until something else synced. |
||
|
|
cff530079f |
wsl: a bridged distro reaches Windows on the bridge's adapter, not the LAN router
ecalpal_ on Discord (magpie 0.1.2689, Windows 11, WSL 3.0.3.0, Ubuntu
22.04.5; .wslconfig vmSwitch=WSL_Bridge_Switch, networkingMode=Bridged,
dhcp=false). In bridged networking the distro is a peer on the LAN and its
default route is the router, 192.168.9.1. magpie took that next hop for
Windows: wsl.json got {"net":"bridged","gateway":"192.168.9.1"} and Pi's
models.json a baseUrl on 192.168.9.1:3425, where nothing listens, with the
gateway token rather than the WSL key. serveWSL already listened on
192.168.9.147, Windows' address on vEthernet (WSL_Bridge_Switch).
wslrun.HostAt now picks the address: "" where the distro's 127.0.0.1 is
Windows' (mirrored, consomme, virtioproxy, as before); the next hop as it
is when it is Windows' own address on a WSL adapter (NAT, unchanged);
otherwise Windows' address on the one WSL adapter whose network holds
that next hop (bridged: 192.168.9.1 in 192.168.9.147/24 -> .147). A next
hop on no WSL network is kept as it was. The adapter list moved from
gateway.wslNets to wslrun.Nets (gateway.WSLNets still wraps it), so both
probes use it: agent's parseProbe (distro.Gateway, what place writes into
agents) and wslrun's (Tool.Host, a 127.0.0.1 proxy handed to a WSL CLI),
which had the same bug.
The key follows the address: keyAt(http://192.168.9.147:3425) is on a WSL
net (OnWSLNet), so agents there get the WSL key.
Existing users: on the next start, the first probe of the running distro
writes the new gateway into wsl.json and keeps 192.168.9.1 in Was. The
startup SyncCatalog then rewrites Pi's provider block (baseUrl and apiKey)
at the new address; keptaway treats the old router address as magpie's
because it is in Was. A distro that isn't running at start is fixed at its
first probe after it runs, and its agents' files at the next sync after
that. Codex in WSL, which keeps its own base_url, gets the existing
"unreachable" drift with "Use 192.168.9.147:3425" (wslMovedFrom), not an
automatic rewrite.
Tests (fixtures are the reporter's values):
- wslrun TestHostAt: bridged/nat/mirrored/consomme each with its own route
and adapters; TestParseProbeBridged (Tool.Host and proxy).
- agent TestWSLBridgedReachesWindowsOnTheBridge (bridged .147, nat
172.20.0.1 unchanged, mirrored 127.0.0.1) and
TestWSLBridgedOldRouterWrittenOver: wsl.json and Pi's models.json as
0.1.2689 wrote them, then a probe and a sync: baseUrl .147, apiKey the
WSL key, wsl.json rewritten.
Run:
- Broken by hand: probe code put back to HostLoopback only. Both new agent
tests and TestParseProbeBridged FAIL (Gateway/Host 192.168.9.1).
- mote: gofmt -l empty; go vet, GOOS=windows go vet, GOOS=linux go vet
-tags nogui for wslrun, gateway, agent; GOOS=windows go build: ok.
- mote: go test -timeout 45m ./internal/wslrun ./internal/agent
./internal/gateway: ok (wslrun 1.3s, agent 231s, gateway 855s)
- xiaomi-gpu (win-run): go test ./internal/wslrun ./internal/gateway
-run 'HostAt|ParseProbe|WSL' ok; ./internal/agent -run
'WSL|ParseProbe|Omp' ok. A first try with a fallback (bridged + one WSL
adapter -> that adapter) went red there on TestParseProbe and
TestWSLNetworkingFromWslinfo, because the box's real NAT adapter
(vEthernet (WSL (Hyper-V firewall)) 172.17.32.1/20) was taken for the
bridge; the fallback was dropped.
- xiaomi-gpu, real adapters: HostAt("nat", "172.17.32.1", Nets()) =
172.17.32.1; magpie-desktop is NAT (wslinfo nat, default via
172.17.32.1), so its value is unchanged.
Not tried: a real bridged WSL (none on the LAN; magpie-desktop's
networking was not changed), a real magpie start against an existing
wrong config, and the full go test ./... before the push (run after).
|
||
|
|
429f9317d2 |
uninstall: Codex's base URL at magpie's gateway goes even with magpie's notes gone (#3866)
Uninstalling disconnected only the agents that read as connected. A
Codex whose config still had openai_base_url at magpie's gateway (or
model_provider = "magpie") but whose notes in magpie's folder were gone
(the folder deleted by hand, a fresh install beside an old config, a
magpie older than the notes) read as not connected, so the uninstall
left it pointing at a port nothing answers: every Codex turn then failed
with a connection error that never names magpie.
Uninstall's Agents step now ends with Codex's leftovers pass
(agent.TakeCodexLeftovers, the Agent's TakeLeftovers): the base URL goes
by viaBase()/dropBase and magpie as provider by asProvider()/dropProvider,
the same gates and drops a Disconnect uses, notes or not. Codex's own
model, its own provider and keys stay, and so does
[model_providers.magpie], which threads started on magpie name. Taking
anything shows "Codex's leftover settings" in the report and restarts
the Codex app's app-server. docs/subsystems/agent-wiring.md says so.
Not changed: deleting magpie.exe by hand runs no code, so the reporter's
Windows case is covered only through Settings > About > Uninstall magpie
or `magpie uninstall`. The pass is this machine's Codex only, like
EndCodexFailover; a WSL distro's config is left as it was. viaBase
matches any loopback port with /backend-api/codex, as Disconnect does.
Run on mote, base origin/main
|
||
|
|
1493acb468 |
gui: Codex's memories default reads right on Codex 0.167.0 and before
Codex 0.167.0 (openai/codex#58091) moved its default memory models:
extraction from gpt-5.6-luna to gpt-6-luna, consolidation from
gpt-5.6-terra to gpt-6.1-terra. The memories square's unset text and the
Settings row's tooltip named the old pair. They now say "Codex's own
memory models", true on either version, in en, zh, zh-TW, ja and de.
The code comments (agent/codex.go, gateway/codex_memory.go,
gateway/codex_follow.go, the tests' headers) name both pairs with the
Codex version that uses them. No behaviour changes: magpie routes these
calls by kind (memgen, memory_consolidation), not by the model name.
Run on mote at the pre-rebase base
|
||
|
|
faa69b8319 |
dsh: a dsh test's temp home is given up only once it is really gone
TestDshSetEffortWritesALegacyEntryWithTheCatalog died once at cleanup, not in its body: on Windows, t.TempDir's RemoveAll found .config/magpie not empty (LoKi's box, reported by yetone, #2982). Save replaces providers.json by renaming a file over it, and a scanner holding the file that was just renamed over keeps its entry listed while the entry is pending deletion, so the folder reads as not empty for a moment; t.TempDir's own cleanup retries a sharing violation but not a "not empty" one, so it gave up on the first try. The seven dsh tests that set up such a home now share dshTempHome, which tries the removal until the folder is really gone, for a short while, before t.TempDir's cleanup gets its turn. Not verified on Windows: the failure is one-off under a scanner there, and on macOS removing a folder whose file is still open succeeds, so the race cannot be reproduced on this machine. With the retry taken out the suite is green on macOS as before, so the only change in behavior is the retry itself. Generated-by: GLM-5.3-Flash (ZCode) Review: go test -tags nogui -count=20 -run TestDsh ./internal/agent/ ok on Windows 11 (xiaomi-gpu, win-run, 232s) and -count=3 on mote. The cleanup is registered after t.TempDir, so it runs first (LIFO) and TempDir's own RemoveAll finds the folder gone. Not tried: a Windows box under the load that made the original red. |