ac4af582301a4e8a29245dbba767eba31334ddf9
292
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
92e8edd7fc |
windows: magpie is listed in Installed apps, and its Uninstall puts every agent back
Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex"; Rk1ngggg asked whether an update cleans it. magpie's own uninstall (Settings › About › Uninstall magpie, `magpie uninstall`) already disconnects every agent and takes Codex's leftovers (#3866), but on Windows magpie wasn't in Settings › Apps › Installed apps, so it was removed the way Windows offers for a program it doesn't list: by deleting the exe and folders, which runs no code. shortcut.Ensure now writes HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie (DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString, URLInfoAbout, NoModify, NoRepair) at every installed start, beside App Paths, and Remove (uninstall's System step) takes it out the same way: only while it names this exe, or an exe that is gone. Its Uninstall runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe has no console, where the terminal's `magpie uninstall` would refuse for want of one to ask on, so those exact args open the app's window (or forward to the running app, OnSecondInstanceLaunch) on Settings › About with Uninstall magpie's question asked (uninstallView, ?uninstall=1). It asks once: a redraw of Settings doesn't ask again, and Cancel removes nothing. magpie web opened at that link asks nothing. Deleting the app by hand still runs no code (macOS drag-to-Trash included); agent-wiring.md says so. Run on mote at the pushed head (rebased onto |
||
|
|
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
|
||
|
|
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 |
||
|
|
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
|
||
|
|
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) |
||
|
|
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 |
||
|
|
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
|
||
|
|
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 |
||
|
|
ff2a06c349 |
gui, tune: Tuned for you weighs a model magpie routes at its provider's price, not by its name (#3435)
Tune weighed a call's tokens by its model's name alone (tune.WeightsFor):
an id starting "claude" at Anthropic's ratios (read 0.1, write 1.25, an
hour's write 2), any other at generic ones (an hour's write at a
5-minute one's price). Claude Code is given magpie's models as
provider/model ids (copilot/claude-opus-5-5, anthropic/claude-opus-5-5),
which the name rule took for no Claude model. So a Claude model on an
Anthropic-billed provider was weighed with its hour costing no more than
5 minutes, and none was weighed at the price the usage pages count.
The replay now takes its weights from a tune.Weigh (CompactOpts.Weigh,
and CacheTTL's third argument), per stream; nil weighs as before. Tuned
for you passes pricedWeights: an id with a provider resolves as the
gateway resolves it (provider.Resolve after ClaudeRead) and is weighed
at that provider's EffectivePriceIn, so a Claude model on Copilot has
its hour at the 5-minute write Copilot bills (the previous commit) and
one on Anthropic at 2x. A model Claude Code named itself keeps its
maker's weights, as does a price with no cache read or write. The
compaction advice is weighed the same way. docs/subsystems/agent-wiring.md
says so.
Run on mote (go1.26.8, macOS) at
|
||
|
|
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) |
||
|
|
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>
|
||
|
|
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 |
||
|
|
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 |
||
|
|
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 (
|
||
|
|
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. |
||
|
|
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
|
||
|
|
1d704f8190 |
codex: OpenAI's threads follow a provider of the user's at the top, where Codex resumes them
harris on Discord (the Codex app, after switching from CC Switch): "This chat uses openai, but your current provider is custom. Switch to openai to continue." CC Switch left its "custom" as config.toml's model_provider, which magpie keeps since #4347, and Codex 0.166 resumes a thread only on the provider it is on now. Every thread started on OpenAI before was refused, and switching to OpenAI would refuse custom's threads instead, so the user was stuck. Nothing moved them: bringOver moves only onto magpie, bringBeside only from such a provider onto OpenAI. lendOwn (each Sync) moves OpenAI's threads onto that provider, as bringBeside does the other way: in place at OpenAI's length, by the row for a paginated thread, the last 30 days rewritten with a copy kept otherwise. The ids go in stash codex.lent; giveLent returns exactly those to OpenAI once Codex is on it again (CC Switch's official card), keeps the record while Codex is on that provider or on magpie, and drops it on any other. Nothing moves while a profile names openai, after the user disconnected Codex, or from a distro's Codex. TestCodexThreadsComeBackOffMagpie/by_hand expected an OpenAI thread to stay on OpenAI with custom set by hand at the top, the stuck state itself; it now expects it on custom. docs/subsystems/agent-wiring.md says so. Run (mote, go 1.26.8): go test -count=1 ./internal/agent/ ok (250s); GOOS=windows, GOOS=linux and native go vet ./internal/agent/ ok; gofmt -l clean. Broken by hand: Sync without lendOwn, TestCodexOwnProviderTakesOpenAIThreads red (thread left on "openai", rollout not on custom); without the disconnected and profile guards, TestCodexOwnProviderLeavesOpenAIThreads red for both cases. Not tried: a real Codex app resuming a moved thread on a real relay; harris's config.toml wasn't seen, so the "custom" here is CC Switch's relay table as it writes it. A thread moved from the ChatGPT backend to a relay carries its encrypted reasoning, which a relay on another account may not accept; the thread then fails on the relay as a switch to it by hand would. |
||
|
|
845e324b13 |
liveagent: each model on its own API, and the request format the user picks stays (xiaoxiaofei)
xiaoxiaofei on Discord: "magpie 默认导入的是 message 格式的,要可以自定义请求格式".
magpie wrote one LiveAgent provider, "magpie", type claude_code with
api anthropic-messages, for every model. K-brain asks all of a
provider's models on the provider's one API (routing/client.go builds
the client per provider; PiModel.api is only validated), and LiveAgent's
settings lock an Anthropic provider's API: only an OpenAI provider
(type codex) has a request format to pick (ProviderModalView.tsx,
resolveProviderApi; K-brain settings_provider.go accepts
openai-completions and openai-responses). So the format couldn't be
changed, and a GPT served on Responses was translated from Messages on
every turn.
Now, as dsh's routes do (dshKinds), each model goes on the provider of
the API it is served on natively (catalog.Model.APIs):
- magpie: type codex, Chat Completions, baseUrl the gateway's /v1, for
every model with no Responses or Messages API of its own (groups, Chat
providers' models);
- magpie-responses: type codex, Responses, baseUrl /v1;
- magpie-anthropic: type claude_code, Messages, baseUrl the root (K-brain
appends /v1; for OpenAI it appends only /chat/completions or
/responses, hence /v1 there).
A codex provider is written with api and requestFormat, as LiveAgent's
settings write one; when the user switches it in LiveAgent, a sync keeps
their format (one LiveAgent doesn't offer goes back to magpie's). A
provider left with no model is taken out. A config.json from before (all
on one claude_code "magpie") is moved on the next sync: each model brings
its record (the user's display name) and whether it was turned off, and
a default/compact/task pick of it follows it to its new provider.
Disconnect takes all three out. Docs: reference.md, agent-wiring.md.
Run (mote, through mote-run):
- go test -tags nogui ./internal/agent -run '^TestLiveAgent|Key': all pass,
new TestLiveAgentRequestFormat and TestLiveAgentFormatMove included.
- go test -tags nogui -timeout 45m ./internal/agent: ok (320s).
- GOOS=linux and GOOS=windows go vet ./internal/agent: clean; gofmt -l clean.
- K-brain 507f560 (the version LiveAgent af89ea7 pins), with Go 1.27.0
on mote: config.LoadFile on the config.json magpie writes in
TestLiveAgentRequestFormat loads it, and routing.ClientForProvider
builds *ai.OpenAI at http://127.0.0.1:3425/v1 for magpie,
*ai.Responses at /v1 for magpie-responses and *ai.Anthropic at the
root for magpie-anthropic (a throwaway test, not committed).
Broken by hand (a copy), each turned a test red:
- the user's format not kept -> TestLiveAgentRequestFormat;
- no carried record from another provider of magpie's -> FormatMove;
- picks not following their model -> FormatMove;
- Responses models left on magpie -> both;
- an emptied provider not taken out -> FormatMove;
- turned-off not carried to the new provider -> FormatMove.
Full suite at
|
||
|
|
4f624241f7 |
codex: the ChatGPT app left on "hit a snag" after an app-server restart is reopened when idle (#4550)
ysm119 on Discord: each Restart of Codex in magpie left the ChatGPT desktop app on "ChatGPT 遇到了问题 / 请重试" till it was quit and opened again. magpie ends the app's own app-server cleanly (code 0); a signed-in ChatGPT 26.1021 then fails "Hosted AppServerManager identity is not ready" on the one it starts, logs fatal_error_broadcasted and shows the page. That is the app's bug; magpie now follows it up. - provider/codex_app_crash.go: for 60s after every end magpie makes (the watcher's step, RestartCodexApp, RestartSwitchedCodexApp) the app's logs are read for a whole fatal_error_broadcasted line stamped after the end. On one, with no request through magpie since or in flight and no Codex turn opened since, the app is quit and opened once. Otherwise it is left as it is and logged. Where it can't be reopened (Linux, an app that didn't quit) the Agents row says "The Codex app hit an error · quit it and open it again" (appSnag) until the app-servers seen then are gone or the app is closed. Unreadable logs reopen nothing. - agent/codex_app_crash.go: the logs as the app's file logger writes them (macOS ~/Library/Logs/com.openai.codex, Windows %LOCALAPPDATA%\Codex\Logs and the Store package's LocalCache, Linux $XDG_STATE_HOME/codex/logs; YYYY/MM/DD folders, tail-read, half lines dropped). The relaunch is the Agents row's: on macOS ChatGPT.app found by its bundle id, quit as ⌘Q does and opened once it has ended, never forced; on Windows codexAppReopen. - GUI line in en, zh, zh-TW, ja, de; docs/subsystems/agent-wiring.md. Run on mote (macOS) at this head on origin/main |
||
|
|
d620ff6b54 |
codex: an old OpenAI thread follows Codex onto magpie by its row, and back at the Disconnect (Parry_Moody, Cyrus)
Parry_Moody and Cyrus on Discord: Codex on OpenAI through an API key
before magpie, and for two days the Codex app answered every older
conversation "继续聊天未成功: This chat uses openai, but your current
provider is magpie. Switch to openai to continue."
Cause, from Codex's source (rust-v0.167.0-alpha.3.1, same in 0.166.0):
every thread Codex 0.166 starts is paginated (history_mode 'paginated'
in its state-DB row), and for those thread-store read_thread takes the
provider from the row, never the rollout ("Paginated history may contain
only a suffix, so its display metadata lives in SQLite"). The app sends
thread/resume with modelProvider null (ChatGPT.app 26.1021, Kct in
app-shared), so the row alone decides, and load_for_resume refuses a row
other than the current provider. bringOver moved threads by rewriting
files: plain ones in place, packed ones only from the last 30 days and
128 MB a sync. An older or packed OpenAI thread kept an openai row.
Now sessions.RetagPagedCodexThreads moves every paginated thread on a
provider by its row alone: any age, packed or not, an id of any length,
no file read, written or copied. Each thread is held by its writer lock
(an open one stays: its writer would write the provider back), one
written to in the last minute waits, 200 rows a transaction. It runs
after the in-place relabel in bringOver, bringBack (so a Disconnect no
longer copies a whole paginated history to the trash), bringOfficial and
bringBeside, and giveBeside by ids (RetagPagedCodexThreadIDs). Legacy
threads keep the file path. The Sessions page lists a paginated thread
on its row's provider (codexPagedProviders, memoised on the DB and WAL
stamp), so it isn't offered a Move it had.
Run:
- real codex-cli 0.166.0 (npm latest) on mote in a sandbox CODEX_HOME,
a fake Responses server: a thread started with OpenAI (API key,
openai_base_url) is paginated, row openai; with model_provider magpie
`codex exec resume` failed with exactly "This chat uses openai, but
your current provider is magpie" (modelProviderMismatch). After
magpie's RetagPagedCodexThreads on that home (a throwaway test calling
it, not committed) it resumed and answered; the rollout still names
openai. Reversed (magpie -> openai) with config back on OpenAI, it
resumed again. The first retag try moved nothing: the rollout had been
written <1 minute before, the ActiveWindow skip, as intended.
- mote: gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
for ./internal/sessions ./internal/agent; go test ./internal/sessions
./internal/agent: ok (sessions 20.1s, agent 194.4s) on mote, plus go vet on darwin, linux -tags nogui and windows
Broken by hand:
- RetagPagedCodexThreads returning nil (the old behaviour):
TestCodexPagedThreadsFollowByRow red (250 packed 90-day-old threads
"on openai, want magpie"), TestRetagPagedCodexThreads red.
- the writer-lock hold skipped: TestCodexPagedThreadsFollowByRow red,
the open thread moved to magpie.
Not tried: the Codex app GUI itself (the app goes through the same
app-server thread/resume, whose modelProvider it sends null); Windows
and Linux runs (vet only). Codex rebuilds a row from its rollout when a
search listing reconciles it, which puts a retagged thread back on its
file's provider until the next sync; not seen, read from the source.
A legacy thread packed over 30 days still waits for Sessions' Move.
|
||
|
|
bd0f338282 |
hermes: a Claude model goes on anthropic_messages, so cache_ttl 1h works; the user's api_mode stays (#5315)
cherish_onlyy (#5315): magpie wrote providers.magpie as chat_completions at the gateway's /v1 for every model. On chat completions to a custom provider Hermes sends no cache marks (anthropic_prompt_cache_policy gives (False, False)), and the marks magpie adds for a Chat client last five minutes, so prompt_caching.cache_ttl: 1h never reached the vendor. They set api_mode: anthropic_messages and the gateway's root by hand and got 1h writes; magpie's next sync or connect wrote chat_completions at /v1 back. Hermes takes api_mode per providers entry, never per model (_resolve_named_custom_runtime, hermes_cli/runtime_provider_custom.py; aliases in config_providers.py's _API_MODE_ALIASES, transport read when api_mode is absent). On anthropic_messages its adapter strips a trailing /v1 and the SDK adds /v1/messages, and for a "claude" model on a third-party gateway it puts its own system_and_3 marks at the configured ttl (agent/prompt_caching.py, read at d914e233). So magpie now writes two entries, as dsh already splits its routes: - magpie: chat_completions at gw/v1, every model not on Messages; - magpie-anthropic: anthropic_messages at gw (no /v1), the models whose native API is Anthropic's Messages and not Responses (hermesOnMessages). model.provider follows the picked model (hermesRoute), in every profile; a sync moves a Claude model magpie had set under "magpie" onto magpie-anthropic, and drops that entry when no model is left for it. Disconnect takes both out. The user's own value: an api_mode or transport on one of magpie's entries that isn't the one magpie writes there (by Hermes's aliases, so "openai" is still magpie's chat) is the user's (hermesModeIn). It stays through sync and pick, base_url follows it, and on "magpie" that entry then serves every model and no magpie-anthropic is written, which is the reporter's set-up exactly. magpie only ever wrote chat_completions into providers.magpie, so nothing earlier is mistaken for the user's. Tests: - TestHermesClaudeGoesOnMessages: Claude on magpie-anthropic (mode, base without /v1, models), deepseek stays on magpie at /v1, Get/Check/Drift clean, a pick moves model.provider back, a bot profile too, Disconnect removes both entries from every profile. - TestHermesSyncMovesClaudeOntoMessages: an existing connected config is moved on sync, and back when the provider goes chat-only. - TestHermesKeepsTheUsersAPIMode: api_mode anthropic_messages at gw, transport: anthropic, codex_responses: each survives two syncs and two picks, base_url kept; api_mode: openai is still magpie's. - internal/gateway TestHermesHourMarksReachTheVendor: a Hermes-shaped /v1/messages turn with 1h marks reaches the Anthropic upstream with every mark at 1h; the same turn on /v1/chat/completions goes at 5m. This one passes on the old code too: the gateway already passed the marks through; it guards that and records why the mode matters. Run (mote-run, this tree): - go test ./internal/agent/ -count=1 -timeout 45m: ok - go test ./internal/gateway/ -run 'TestHermesHourMarksReachTheVendor|TestResponsesToClaudeMarksLastAnHour' -count=1: ok - go vet ./internal/agent/ ./internal/gateway/, GOOS=linux and GOOS=windows: ok - gofmt -l: clean Broken by hand: - hermesSplit returning (nil, false), the old one-entry behaviour: ClaudeGoesOnMessages, SyncMovesClaude and the openai-alias case fail. - hermesModeIn never reporting the user's mode: all three KeepsTheUsersAPIMode cases fail at "sync". Not tried: - Hermes itself: it was not run (running it under a temp HERMES_HOME rewrites the live launcher); its behaviour is read from its source at d914e233. No real 1h cache write was measured against a vendor. - Group models whose members are all Claude, and Claude Code sign-ins (no Native API), stay on chat_completions; GPT on codex_responses is #3080. - Windows and Linux runs of the agent package (vet only). |
||
|
|
1fd02d33ce |
agentplug: an agent plugin can pick the model its agent starts on in a second file (str_, PiG)
str_ on Discord (#help, v0.1.3005): PiG's row on the Agents page only
switched the model list on, where Pi's picks the model it starts on.
PiG, like Pi, keeps its providers in ~/.pig/agent/models.json and the
model a session starts on in settings.json (defaultProvider,
defaultModel; PiG's docs/site/docs/settings.md, startup_model.go). An
agent plugin could name a model key only in the one file connect
writes, so agent-pig 0.1.0 had to be connect-only.
An agent's descriptor can now say `startup: {config, format, model,
keys}`: the other file, the key that holds the model (the id without
magpie's prefix) and keys written beside it. With it the row gets a
model field as a built-in's does. Picking one of magpie's writes
connect's keys into config and the model and keys into startup.config,
each key kept aside as before; a model of magpie's picked in the agent
itself still reads as magpie's; a model of the user's own picked there
while magpie's provider is listed counts as connected (Beside), not
drift, and is kept on disconnect. Sync rewrites the list and leaves the
startup model where it is. Off, or `magpie <id> default` with the plugin
gone (RestoreGone), puts both files back. startup without connect, beside
agent.model, in config's own file, or naming the model key among keys
is refused. An older magpie ignores the field, so agent-pig 0.1.1
(plugins repo) stays connect-only there. Every other agent plugin
already names its model in its own config; pig is the only
connect-only one.
Run (mote):
- go test -count=1 ./internal/agentplug/: ok
- go test -count=1 -run 'TestPlugged|TestPlugin|TestRestoreGone|TestAgent'
./internal/agent/: ok
- go vet, GOOS=linux and GOOS=windows go vet of both packages; gofmt -l
clean
- the four TestPluggedStartup* tests on the old code: red (the row had
a provider field and only listed models)
- real PiG 0.5.3 (darwin-arm64 release, SHA256SUMS checked) in a sandbox
HOME, models.json written by agent-pig 0.1.1's own connect and
settings.json as startup writes it, against a fake OpenAI server:
`pig -p` sent model deepseek/flash with the gateway key. With an
enabledModels scope that leaves it out, PiG started on the scope's
first model (said in the plugin's README).
Broken by hand: no startRestore in Unwire (TestPluggedStartupModel and
OwnPickKept red); no Beside (OwnPickKept red, "wired false").
Not tried: the GUI and the TUI with the real row (app.js unchanged; the
row is the model field every built-in has), Windows and Linux runs of
PiG, a real magpie gateway in front of PiG, a real vendor model.
|
||
|
|
681a472cab |
agent: a Codex thread started during the takeover comes back to OpenAI once it is quiet, not hours later (nb5p on Discord)
nb5p on Discord (v0.1.3001, Codex app): after Send greyed out, Retry in
Codex did nothing. The model picker and Send spun, the same dialog came
back a few seconds later, and the model field read "model unavailable".
With the ChatGPT account Codex is signed in to used up, magpie makes
itself Codex's provider (codex.out), so a turn sent then starts a thread
saved with model_provider "magpie". When the account has room again,
Sync puts Codex back on OpenAI, and its deferred bringBack moves magpie's
threads to OpenAI. It skips a thread written to in the last minute,
which is the one the user was in, and leaves it "for the next Sync".
Nothing schedules one, though: Sync runs on a catalog change, which can
be hours away. The app then can't resume that thread on the provider it
is now on ("This chat uses magpie, but your current provider is
openai", the string still in the Codex the app bundles), so each Retry
failed the same way.
bringBack now asks whether a thread is still on magpie because it was
being written to (sessions.CodexThreadsBusyOn: the state databases' rows
on magpie whose rollout changed within ActiveWindow). If one is, it asks
for one more Sync after ActiveWindow+5s. Only one wait is pending at a
time.
docs/subsystems/agent-wiring.md says so beside bringBack.
Test: TestCodexTakeoverThreadComesBackOnceQuiet. The takeover is on, and
a thread on magpie is written to now. The account comes back, and the
thread stays on magpie while it is written to. A later Sync is asked
for, and that Sync, with the thread quiet, moves it to openai. No other
Sync is asked for after that.
Broken by hand: with the bringBack hook turned off (`if false && ...`),
it fails with "no later Sync asked for" (5.3s). Restored, it passes.
Run on mote at this tree (base
|
||
|
|
3d0d790606 |
codex: the Codex app left on an account that runs out is restarted onto the one Codex is signed in to (nb5p on Discord)
nb5p has two ChatGPT accounts in magpie, B first. The Codex app showed A, and once A ran out Send was grey for every model, magpie's and another provider's too. Cause: magpie's switch back to the first account (or to the account Codex is kept signed in to) leaves the Codex app's app-server running unless "Restart the Codex app to follow" is on. The app-server keeps the account it started on (CodexAppStale), so the app stayed on A while auth.json said B. magpie read only B, which had room, so nothing moved, magpie never took over, and the app-server was never restarted: the app greyed Send on A's allowed false for good. Fix: on each full look of KeepOnAnAccountWithRoom, restartCodexAppLeftOnSpent reads the account the app is left on, and once that is held (codexHeld) marks a spent switch (codexAppSwitched true), which codexAppStep restarts past the RestartApp tick, as a switch off a used-up account already does. Once per app-server left. Run (mote, at this tree): - go test ./internal/provider -count=1: ok - TestCodexAppLeftOnASpentAccountIsRestarted: user switches to A, magpie switches back to B and leaves the app running, A still has room (nothing ended), A runs out with B's room (app-server 7 ended), next look (not ended again). Broken by hand: - codexAppSwitched(true, false) commented out: red, "ended [], want the app-server left on the used-up account". - the once-per-app-server check off: red, "restarted again: [7]". Not tried: the real Codex app on a real account running out; the call in KeepOnAnAccountWithRoom's loop is covered by reading, not by a test. |
||
|
|
775630dac9 |
usage: the compaction picker says each window against the setting now
hayden4608 on Discord (#feedback): "上下文压缩阈值建议这里应该以当前选中的为
基准更直观 而不是以最省token的为基准". Usage › Context's "Other window…"
menu said every value's tokens past the leanest, so the window one had
set (ticked in the menu) read "+N tokens" like any other, and choosing
between them meant subtracting two notes in one's head. The reader
picks away from the setting in use, so that is the baseline now:
- each value says "−N tokens (−x%)" or "+N tokens (+x%)" against the
setting now's own point on the curve (the replay's cost at the current
value when the curve has no point there);
- the setting itself says "Your setting now";
- "Fewest tokens" stays, beside the leanest value's numbers (timed: the
cheapest, as before), so where the minimum is is still shown;
- the menu head says it: "Compact at · against the setting now, from
your calls of the range".
The chart and the "{pct} fewer tokens" line already compare with the
setting now and are unchanged. New strings in zh, zh-TW, ja and de; the
old head's key is replaced. docs/subsystems/agent-wiring.md says the new
baseline.
context-tune.test.cjs: the menu notes in every language at 360 and
1100 wide, against 300K set (−150M/−11% at 250K, −420M/−30% plus
Fewest at 160K, "Your setting now" at 300K), and again after 250K is
put in (250K is the setting, 300K +150M/+12%); the timed case against
120K set (100K −90M/−9% plus Fewest, 240K −20M/−2%).
Run on mote (mote-run), this tree before the rebase:
- context-tune: 120/120 chromium, 120/120 webkit
- i18n-keys 4/4 and compact-one-value 6/6 in each engine
- go test -run 'Budget|Script|Asset|I18n|Lang' ./internal/gui: ok
Broken by hand: the old context.js under the new test fails 20
subtests in chromium (both menu tests, every language and width).
Not tried: the real app with a real replay; the full GUI suite and
go test ./... (run after the push).
|
||
|
|
387b386c84 |
codex: threads of the provider an older beside wiring took down move to OpenAI (yikelizi9438 on Discord)
yikelizi9438 (Windows, the Codex app): models wouldn't load, "This chat uses custom, but your current provider is openai. Switch to custom to continue", and "Model unavailable" in the composer. "custom" is CC Switch's provider id; magpie never names one so. Before #4347 ( |
||
|
|
d6e3a36ffc |
codex: threads of the provider Codex was on before magpie follow it onto magpie (hxy920830 on X)
hxy920830 on X: "magpie希望codex接入的时候自定义供应商名称,我现在名称被替换成了
magpie,原来的会话可以看到,但是加载不出来模型了". Codex had been on a
provider of the user's own (a relay's [model_providers.<id>] table, or CC
Switch's "custom"). Wired with no ChatGPT sign-in, magpie sets
model_provider = "magpie". bringOver moved only OpenAI's threads onto
magpie, so the relay's threads stayed on their provider. From Codex 0.166
(codex-rs app-server config_manager.rs load_for_resume) a thread resumes
only on the provider Codex is on now. The app lists them (thread/list
with model_providers [] lists every provider) but opening one stops at
modelProviderMismatch: "This chat uses <id>, but your current provider is
magpie". Nothing a user can set changes that, so a setting to rename the
provider wouldn't be needed. The threads should just open.
bringOver now moves the threads of the provider Codex was on before magpie
(stash codex.provider, "openai" when none was set), not only OpenAI's:
- an id of magpie's length ("custom") is relabelled in place
(RelabelCodexThreads), then packed ones from the last 30 days
(MovePackedCodexThreads), as OpenAI's already were;
- any other id ("myrelay") can't be written in place, so the threads of
the last 30 days, plain or packed, are rewritten with a copy kept in
the trash, newest first, 128 MB a sync (new
sessions.MoveRecentCodexThreads, sharing MovePackedCodexThreads' body
with packedOnly off). Older ones are left for Sessions' Move/Resume.
#887's guarantee still holds where it matters. Threads of any other
provider stay put. OpenAI's stay when Codex was on another provider. No
threads move for a provider a profile names (the user picks it with -p),
for cc-switch-official (bringOfficial handles it), or for a distro's
Codex. The Disconnect puts the user's model_provider back and bringBack
returns the threads to it, and CC Switch switching back to that provider
does the same. If Codex leaves magpie for a different provider,
bringBack hands them to that one, as it already did with OpenAI's moved
threads. profileNamed moved up so bringOver can use it.
docs/subsystems/agent-wiring.md says so.
Tests:
- TestCodexThreadsFollowMagpieIn "on a provider of the user's before"
used to assert that the custom thread stays. Now it moves to magpie in
place, with no copy, and goes back to custom at Unwire, with
model_provider custom restored.
- New subtest "on a relay's table of another length": myrelay's plain
and packed threads move with a copy kept, a 40-day-old one stays,
OpenAI's stays, and everything goes back at Unwire.
- New subtest "on a provider a profile names": the thread stays.
- New TestMoveRecentCodexThreads: newest first, a copy each, an old
thread and another provider's stay, and the packed-only move still
leaves a plain thread.
Run at this tree (on origin/main
|
||
|
|
c03dee7e3e |
agent: LiveAgent, magpie's models in its model picker (xiaoxiaofei. on Discord)
xiaoxiaofei. asked for LiveAgent (Stack-Cairn/LiveAgent, v2). LiveAgent 2 is a Tauri app that runs its models through K-brain, a Go backend it starts as `k-brain backend -data-dir <root>`; every provider lives in <root>/config.json (JSONC, Pi's provider shape). Root: $LIVEAGENT_HOME, else $K_BRAIN_HOME, else the folder ~/.liveagent/data-dir.json points to, else ~/.liveagent, on every OS (LiveAgent's data_home.rs and kbrain_backend.rs, K-brain's internal/config and internal/storage). Connect adds providers.magpie: type claude_code + api anthropic-messages (what LiveAgent's own settings write for an Anthropic-compatible provider), baseUrl the gateway root (K-brain appends /v1 and posts /messages with X-Api-Key), the key naming LiveAgent, activeModels null, modelOrder in magpie's order, models sorted by id with display name, window, output limit and input [text, image]. K-brain decodes with unknown fields refused, so only its fields are written. A default or compact model still K-brain's endpoint-less demo model1 becomes magpie's first; the user's own pick stays. Through a sync the user's name, the models they turned off, their order, K-brain's metadata and a model's own displayName stay; a new model is on and last; nothing to change writes nothing. A file K-brain wouldn't read as providers (not an object, providers not an object, top-level models, a bare provider) is left alone. Disconnect takes the entry out, puts picks back to K-brain's default, gives a file left with no provider K-brain's demo back (its CLI restores config.json.bak, which could hold magpie's, from a file with none), and removes a file holding only what magpie made. LiveAgent's backend holds the settings and writes them whole on any change, so a change is refused while liveagent or k-brain runs (macOS/Linux; the notice says to quit it first, in every language). Logo: the app's own 64px icon (src-tauri/icons/64x64.png, MIT) in an SVG. Run on mote at this tree: - gofmt -l clean; go vet ./internal/agent ./internal/agentenv for darwin, linux (nogui) and windows - go test -tags nogui ./internal/agent -run 'LiveAgent|GatewayKey|ListsModels' ok; ./internal/agentenv ok; ./internal/gui: only TestCoreScriptBudget red, which is red on its base too (app.js untouched here; #5139) - GUI icon-tile, i18n-keys, agent-notice-lang, gui-zh-tw, gui-ja, gui-de: Chromium 27/27, WebKit 27/27 Broken by hand on mote, each red: the user's activeModels not kept (TestLiveAgentProvider "activeModels after sync [], want [...]"); the demo provider not put back (TestLiveAgentMakesItsFile "emptied file"); the demo default not replaced (TestLiveAgentProvider, TestLiveAgentMakesItsFile). Real use on mote (sandbox HOME and LIVEAGENT_HOME, this magpie on 127.0.0.1:3562, a fake Anthropic upstream on 3561, LiveAgent 2.0.5's bundled k-brain from the release dmg): - k-brain backend's first start wrote config.json as {}; magpie liveagent magpie then wrote providers.magpie and the default pick - `k-brain run "Reply with exactly: pong"` (K-brain's CLI, same config and routing code) answered "pong"; the upstream saw POST /v1/messages from magpie - the backend LiveAgent starts listed magpie's model in /v1/models with it as the default, and its /v1/text/generate answered "pong" through magpie - with k-brain running, connect/disconnect were refused with the notice; after it quit, disconnect removed the file magpie made Not tried: LiveAgent's window itself (its model picker was not opened; the backend's API it reads was); LiveAgent on Linux or Windows; a real vendor reply (fake upstream). |
||
|
|
6b47bce670 |
cli: magpie model compact <agent> sets an agent's own Long conversations
|
||
|
|
3eb2bda4f2 |
settings: Codex, Claude Code and Grok Build each take a Long conversations of their own (molianyin4227 on Discord)
molianyin4227 (Discord #help): models differ, so one compaction size
for every agent fits none; they asked for Codex, Claude Code and Grok
Build to each have their own, falling back to the shared one.
- settings.AgentCompacts[agent] {At, Full} for the agents that write a
compaction window (CompactAgents: codex, claude, grok); Settings.
ForAgent(agent) lays it over CompactAt/FullContext for that agent's
readers only: codexcat.entriesAt, provider codexListed, Claude Code's
writeCompact and desktopPlan, grokModelTables, the route list's
buildModels, Codex's window line (api.go) and Tuned for you
(gui/tune.go, agent/tune.go). A model's or provider's own Compact at
still comes first. An agent with none follows the shared value, so
nothing new is written for it, and an agent outside the three has no
such key and is refused (provider.SetAgentCompact).
- POST /api/settings/agent-compact {agent, own, full, at}; own false
takes the agent's value away. settingsapi.Merge keeps the map.
- GUI: a row "Long conversations in <agent>" under Long conversations,
in the agent's opened row and its sheet: Every agent / Compact at N /
Full window (segs, no select), a size box when Compact at. It lives in
agentcompact.js, imported when the agent's settings hold Long
conversations, then put in synchronously (an async put-in after a
redraw moved the page in chromium: codex-memories-settings' scroll
check). It draws again only when its own values change. i18n in
zh, zh-TW, ja, de.
- Tuned for you's Use on an agent with its own value changes that one,
stashed under tune.long.compact.<agent>; Undo puts it back.
- codex-memories-settings' "no Codex" check counts Long conversations
alone again (:not(.agent-compact)) and waits for the new row.
- docs/subsystems/agent-wiring.md: a row for it.
Core size: app.js 1,311,919 bytes, 109 under origin/main
|
||
|
|
0ee424e3ee |
codex: a thread Codex 0.166 won't resume for its provider moves with Codex (毅, AcMilan on Discord)
Codex 0.166 (openai/codex#57840) refuses to resume a thread whose saved
provider isn't the configured one: "This chat uses openai, but your
current provider is magpie. Switch to openai to continue." (毅), and
"This chat uses cc-switch-official, but your current provider is
openai" (AcMilan). The rollout's session_meta provider wins over the
state DB row, and no -c override gets past it (openai/codex#58865).
Cause on magpie's side: bringOver relabelled only plain rollouts in
place. A thread Codex had packed to .jsonl.zst (a week after its last
turn) stayed on openai, so with magpie as provider it can't resume.
cc-switch-official is the id CC Switch 3.17-3.20 gave the official
account; CC Switch 4 moves those threads back to openai itself (#7948
there), but a user who left CC Switch keeps them stranded.
- sessions.MovePackedCodexThreads: packed threads on `from` updated in
the last 30 days, newest first, up to 128 MB per sync, each moved by
the existing packed rewrite with its copy kept in the trash. Rows
are checked against the file (plain absent, .zst present, meta on
`from`, same home). A state DB without updated_at moves nothing.
- bringOver calls it after RelabelCodexThreads; bringBack already
moves packed threads back.
- bringOfficial: while magpie wires Codex and Codex is on openai or
magpie, cc-switch-official threads move there, unless the user's
top-level model_provider or a profile names cc-switch-official.
- Other providers and packed threads older than 30 days are left; the
Sessions page's Move or Resume takes them.
Run (mote, at the pushed base
|
||
|
|
f0b99745ed |
provider: a Codex account is held on allowed false alone, as the 26.1029 app's Send gate reads it (xiaoq6285)
xiaoq6285 (Discord, Codex App 26.1029 on Windows, Plus, model_provider = "magpie", requires_openai_auth = true) answered |
||
|
|
1987fe220c |
agent restart: a script run on the app's own executable is not the app (WorkBuddy's sidecar)
Northes (Discord #feedback, 11-04): WorkBuddy's Agents row kept "重启 WorkBuddy 后生效" after they quit and reopened it, and its Restart quit WorkBuddy and never opened it again. #3700 (Raters0) is the second half on WorkBuddy AI. Cause, from WorkBuddy 5.5.6's app.asar (read only) and its processes on the Windows box: WorkBuddy starts a sidecar as `<its own executable> .../app.asar/main/sidecar-entry.js --token ...` (ELECTRON_RUN_AS_NODE, detached). The sidecar outlives the app's quit and the next start reuses it, and its prewarm and `--serve` CLIs run as `<executable> .../cli/bin/codebuddy ...`. The daemon is `WorkBuddy.exe ... daemon-app-server-entry.js --stdio`. All of them match the running check's `Contents/MacOS/<exe>` pattern (and WorkBuddy.exe's image on Windows), so: - (a) findRestartable took the oldest match, the sidecar, as the app's start, so magpie's change was always "after" it and the row never cleared, however often the app restarted. On Windows the earliest start was used too. - (b) reopenBundle waited for every process under Contents/ to end; the sidecar never does, so after 30s it said "still open" and never ran `open`. Fix: runsScript(cmd, exe) tells a script run on the app's executable (a .js/.cjs/.mjs argument, or a first non-flag argument that is an absolute path) from the app itself and its helpers (--type=..., /prefetch:, -psn_, a deep link). The macOS running check and the reopen's wait skip such processes (appProcs), and the Windows check reads each process's command line (proc.CommandLine, new) and skips them too. The reopen still waits for real helpers (renderer, GPU). This is shared by every restartable app: Claude desktop, WorkBuddy, WorkBuddy AI and the Codex app. Tests (red on the old code: a copy of the base with runsScript returning false failed all three, since = the sidecar's 2h, the Windows since the sidecar's, and 6 RunsScript rows): - TestWorkBuddySidecarOutlivesQuitOnMac (WorkBuddy and WorkBuddy AI, a space in the bundle): a 2h-old sidecar and prewarm beside the app; the row is behind by the app's start, a manual reopen clears it, the sidecar alone is not "running", Restart quits then opens. - TestWorkBuddySidecarOutlivesQuitOnWindows: same, and Restart closes and ends only the app's tree, then opens it. - TestRunsScript: real Windows command lines from WorkBuddy on the box, macOS ones, and #3700's `codebuddy --serve` line. Run at this head (rebased on |
||
|
|
40cfd32b0b |
provider: a Codex account with no credits and every window at 100% counts held though allowed isn't false (xiaoq6285)
xiaoq6285 (Discord, magpie 0.1.2891, Codex App 26.1029, Windows): a used-up
Plus account, no credits, 用量 showing it used up, config.toml with
model_provider = "magpie" and requires_openai_auth = true, Send grey until
Codex was switched off in magpie. Banked resets and paid credits were ruled
out (codexHeld reads neither resets nor, here, any credits). What is left is
a reading that doesn't say allowed false: codexHeld needed exactly that, so
CodexUsedUp stayed false and Sync kept requires_openai_auth, which makes the
app read the account's rate limit and grey Send.
codexAtLimit now holds: allowed false (as before); allowed not said with
limit_reached or a window at 100%; allowed true with every reported window
at 100%. Credits and the workspace-overage exemptions are unchanged and
still run after it.
Why the two cases that were false stay narrow:
|
||
|
|
247794c613 |
codex: an account that is out takes over for other models too (reverses f37742e14)
With one ChatGPT account out and nothing to serve Codex's own model on (provider.CodexServesWhileOut false), |
||
|
|
0e1054ce19 |
statusline: the gateway serves Claude Code's status line to another computer (steven_4422)
steven_4422 (Discord) runs magpie in Docker and Claude Code on the host.
The status line square writes the host's settings.json, which the
container can't reach, with a command naming a binary inside the container.
GET or POST /v1/magpie/statusline answers the line `magpie statusline`
prints, as text/plain, so the host needs only curl:
curl -fsS -m 1 -H 'Authorization: Bearer <key>' --data-binary @- http://<host>:3425/v1/magpie/statusline || true
Claude Code's stdin JSON (session_id) adds the model, as /v1/magpie/route
does; ?session= and ?only= work too. The renderer moved to
provider.StatuslineText, shared by the CLI and the endpoint. A caller that
isn't this computer needs a gateway key (lanGuard, unchanged; the handler
also refuses a non-local caller without one). A read-only key is allowed
(GET and POST in readOnlyRoutes) and gets the windows without the model; a
key held to budget, models or accounts sees only its own (scopeQuotas).
corsGuard and origin checks are untouched.
magpie web shows the command in Settings -> About (en, zh, zh-TW, ja, de).
Docs: reference.md, agent-wiring.md, gateway-routing.md, docker pages en/zh/ja.
Run at this head (rebased on
|
||
|
|
d8b3749ef7 |
agents: Copilot CLI reaches magpie's models through its providers.json (BYOK)
tony9759 on Discord asked for Copilot CLI to be wired to magpie, since its
docs say it takes a custom model provider URL.
What Copilot does (1.0.105, @github/copilot-darwin-arm64's cli-main.js,
`copilot help providers` / `help environment`; GitHub docs
docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-byok-models):
env BYOK (COPILOT_PROVIDER_BASE_URL, _TYPE openai|azure|anthropic, _API_KEY,
_WIRE_API completions|responses) and a providers.json at
$COPILOT_PROVIDERS_CONFIG, else <COPILOT_HOME or ~/.copilot>/providers.json:
{providers:[{name,type,baseUrl,apiKey}], models:[{id,provider,name,
maxPromptTokens,maxOutputTokens,...}]}, picked as <provider>/<id> in
settings.json "model". Neither needs a GitHub sign-in. The multi-provider
file is marked experimental in the SDK types. The version BYOK started in is
not verified (github/gh-aw#25014 says 1.0.19; GitHub's changelog of
2026-04-07 announces it).
magpie writes the persistent file, not the environment: provider "magpie"
(openai chat completions, the gateway's /v1, the agent-named key) and one
models entry per catalog model, then model = magpie/<ref>. Only entries
naming magpie are magpie's; the user's providers, models and other keys stay
through connect, Sync and Disconnect (which also restores the model they were
on); a file that does not parse is never written over. COPILOT_HOME and
COPILOT_PROVIDERS_CONFIG are honoured (the latter added to agentenv.Vars).
Copilot's own models stay in the field's list.
Run at this head (a4fb75bfd's tree on
|
||
|
|
1e1068c86c |
codex: "Same as the lead" holds every subagent to the lead's model (cleverpigo on X)
cleverpigo (Windows, Codex App 26.1027.6604.0) had Codex's lead on WorkBuddy's DeepSeek-V4.1-Flash, the subagent model on what the GUI called "Same as the lead", and the Routing page still showed a subagent on gpt-5.6-sol through Codex's own sign-in. Cause: that setting, unset, never held a subagent to anything. Since |
||
|
|
6cfe786351 |
agent: Codex that can't be joined again isn't connected by its helper models alone (#3868)
why8023: Codex switched off and on again showed 「已接入」 with its subagents' and memories' models back, while its own model never reached magpie. |
||
|
|
d3de7e8f3e |
agent: a provider of the user's own at magpie's gateway, under OpenCode 2's providers, stays theirs (#3915)
Found while fixing #3883. OpenCode 2 keeps a provider under providers, its base URL in settings.baseURL, and reads it there before the same name under provider, OpenCode 1's spelling: the one under providers is taken whole, and the other is only a WARN, "retained native value over legacy value" (packages/core/src/config/normalize.ts, mergeMaps, at v2.1.4). OpenChamber's provider form saves a provider there and takes it out of provider (packages/web/server/lib/opencode/config-v2.js, writeSectionEntry). magpie read the user's own providers under provider only, in the two places that look for them: - ownGatewayProvider: a provider of the user's own at magpie's gateway that lists the model, as a layout of one provider per family of magpie's models has, gets a pick of that model of magpie's as <theirs>/<model>, with no provider.magpie beside it. One under providers wasn't seen, so the pick went to magpie/<model> and magpie's provider was added beside the user's. - openCodeSpelled: a model on a provider named as one of magpie's and at the gateway (relay/glm-4.6 on the user's own relay) counts as magpie's. Under providers it didn't, so Agent.Models left it out. On origin/main |