ac4af582301a4e8a29245dbba767eba31334ddf9
21
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
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. |
||
|
|
d08b6118bd |
agents: Restart a desktop app that started before magpie's change, after asking
微雨南山 and stones on Discord: Claude Desktop, WorkBuddy and the Codex
app read magpie's settings only as they start, so a change made in
magpie did nothing until they quit and reopened the app themselves.
The agent's row now carries a Restart when the app is installed, running,
and started before its config last changed (agent.AppBehind):
Claude Desktop, WorkBuddy and WorkBuddy AI on macOS (bundle executable
via pgrep), Claude Desktop and WorkBuddy on Windows (process tree, main =
earliest process whose parent is outside it). A press opens magpie's own
dialog first (confirmAction); Cancel and Escape send nothing. On accept
POST /api/agents/restart/{id} quits the app gracefully (AppleScript quit
on macOS; taskkill without /F on Windows, then /F /T after appCloseWait
for a tray that holds on), waits, and opens it again. On macOS an app
that won't quit is reported (StillOpen) and never forced. The Codex
app's existing Restart now asks first too. CLI agents get none.
changedAt: a stash digest that changed with no file written since the
app started now counts the change as now, so a change magpie made while
the app ran is seen (it was dated to the old write and missed).
app.js budget, not raised: archivePanel moved into plugins/usage/page.js
(its own comment called it the Usage page's; Routing's trace calls it at
draw time, after page.js has loaded), maskWho, maskProv and stillMotion
into plugins/redact, and usageHidOpen into plugins/usage. app.js is
1,108 bytes smaller than on main, budget unchanged.
Run (the first five at the pre-rebase head, same code):
- GUI agent-app-restart + agent-stale-copies: 120/0, chromium and webkit,
en/zh/zh-TW/ja/de, window 980 and 440 and panel 440, no sideways scroll,
no placeholder in aria-label or title.
- Broken by hand: without the confirm the GUI test is red; without the
changedAt fix TestChangedAtWithoutAWrite is red; without the since gate
TestWorkBuddyRestartOnMac and TestWorkBuddyRestartOnWindows are red.
- macOS, real fake-app processes in a sandbox HOME with a stubbed
launcher: quit in 100ms and reopened; a held quit returns StillOpen
after 4s, not forced.
- Windows box, console session (schtasks /IT), fake app and stub
launcher: graceful close in 407ms; a tray that holds on is ended after
5.66s; reopened through the stub.
- gofmt -l clean; go vet darwin (agent, gui), GOOS=linux and
GOOS=windows; builds.
- At 2c5327925 (on origin/main
|
||
|
|
e26d26ab5b |
agent: a Mac app in a folder of /Applications' own, or wherever Spotlight has its bundle id, is found: DeepSeek Harness Desktop in /Applications/AI no longer reads as 未找到 CLI (#2325, sungoku)
sungoku (macOS 15.8.1, magpie 0.1.1253) keeps DeepSeek Harness.app in
/Applications/AI and has no dsh CLI. magpie looked for the bundle in
/Applications and ~/Applications only, so the app wasn't found and dsh's
row said 未找到 CLI (the same gone rule as cjyrainbow's Windows case,
#2177).
macBundles is now the one place a Mac app's bundle is looked for, by
AppVersion/HasApp (dsh, Codex) and macBundle (WorkBuddy): its names in
each app folder, then in each folder one level down that is no bundle
itself (an .app inside another app's bundle doesn't count), then wherever
Spotlight has its bundle id (`mdfind kMDItemCFBundleIdentifier == '<id>'`,
as zedAppPath already finds Zed.app). The bundle's Info.plist must still
carry the app's id. Spotlight's answer is kept 5 minutes per id, because
the Agents page asks on every read and a missing app would otherwise run
mdfind each time. It is never asked in a test binary testenv isolated
(MAGPIE_TEST_SANDBOX), so no package's tests see the developer's own apps
(#1823). The agent TestMain stubs it too. appHere (Claude.app, OpenCode,
Goose: whether their folders are gone) also looks one folder down,
through the same inAppFolders.
Not changed: pencil, t3code, reasonix, claudescience and cursorlocal read
macAppFolders with their own names and still look only at the top level.
Test: TestDshDesktopAppInASubfolder covers no app; an app inside
Other.app (not taken); another bundle id in /Applications/AI (not taken);
sungoku's /Applications/AI/DeepSeek Harness.app (found, 0.2.0-rc.2); and
DSH.app on another folder, found only once Spotlight names it. Broken by
hand three ways, red each time: no subfolder scan, no Spotlight, bundles
inside bundles allowed.
Real mdfind query tried read-only on this Mac: com.apple.Safari ->
/Applications/Safari.app, com.openai.codex -> /Applications/ChatGPT.app.
DeepSeek Harness isn't installed here, so not tried with the real app.
Run in this worktree (origin/main
|
||
|
|
2a1637f4f6 |
agent: DeepSeek Harness Desktop is wired when installed but never opened, and found in any folder it was installed to on Windows (#2279, liangjinyuan-sihan)
DeepSeek Harness Desktop already reads magpie's route: its lib/main.js
(0.2.0-rc.2, the latest on its update feed, read from download.deepseek.com's
dmg and Windows installer) resolves $DSH_HOME, else ~/.dsh, and runs on
profiles/desktop, so the CLI's wiring applies. Three gaps remained:
- Installed but never opened, there is no ~/.dsh: the row wasn't listed,
and connecting wrote the legacy config.yaml the app never reads. magpie
now writes profiles/desktop/cordis.patch.yml from dsh's own template
(PROFILE_PATCH_TEMPLATE) with its routes; the app's initProfile writes
only missing files, so its first start keeps them. The notice says it
starts on this when first opened (noticeDsh5, in all 5 languages).
Disconnect before that first start removes what magpie made, when
nothing else is there; afterwards only magpie's entries go.
- On Windows the installer lets the user pick the folder and registers it
under HKCU\Software\1bf39983-50d0-5fe0-9ef4-cece76f67c5e InstallLocation
(read from the NSIS script of dsh-latest-windows-x64.exe). magpie reads
that, so a custom folder is found, and the Uninstall entry's
DisplayVersion gives the version shown.
Tests: TestDshDesktopNeverOpened (pick on a never-opened app writes the
desktop profile, a user's key in .credentials.yaml and the user's own start
survive Disconnect, the app's first start is told apart),
TestDshDesktopRegisteredFolder (registry stubbed; exe must be there; WSL
twin has none).
Run on this tree, rebased onto
|
||
|
|
79fec406c6 |
agent, gui: a Claude Code provider switch (CLAUDE_CODE_USE_BEDROCK, …) steps aside while magpie is wired in and comes back after; one magpie can't take out is said (jw1dev on X)
jw1dev's ~/.claude/settings.json had CLAUDE_CODE_USE_BEDROCK=1. magpie wrote
ANTHROPIC_BASE_URL and its model ids beside it. Bedrock ignores the base URL,
so Claude Code went to AWS, Bedrock refused magpie's model, and magpie still
showed Claude Code as connected.
Claude Code 2.1.300's six switches (agentenv.ClaudeProviders: BEDROCK,
VERTEX, FOUNDRY, ANTHROPIC_AWS, ANTHROPIC_GOOGLE_CLOUD, MANTLE; on = 1, true,
yes or on, any case, trimmed):
- In a settings file magpie writes (user settings, WSL twins), a switch
that is on is taken out on every route that writes the wiring: connect,
model pick and Rewire/Reapply through writeTiers, and Sync. Its raw JSON
value is stashed (claude.cloud.<var>, under the distro id for WSL). It is
put back as written when magpie steps out (Disconnect, or the model set
back to default), unless the user set it again since. AWS_*/GCP
variables and a switch that is off stay.
- Where magpie doesn't write it (managed settings, ~/.claude.json's env,
the login shell's env), Check names the variable, the cloud and the
file. It reads them in Claude Code's own order: managed wins, then the
user's settings, then ~/.claude.json, then the shell. Two notice
templates, translated in zh, zh-TW, ja and de. The row's line and its
Reconnect pill now show a drift detail through tNotice.
- proc.LoginEnv reads the switches but never sets them in magpie's env,
and testenv unsets them.
- T3 Code: a switch is never carried onto magpie's instance. Its Check
says when the user's ~/.claude settings have one on. That Check first
checks the instance's ANTHROPIC_BASE_URL against the gateway (t3EnvOf),
as every agent's Check must for TestDriftUnwiredEveryAgent,
TestPortMovesEveryAgent and TestReverseProxyIsStillMagpie.
- Claude Desktop's Code tab runs with CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST,
under which Claude Code ignores these switches in settings, so nothing
changes there.
Run:
- gofmt -l: clean.
- go vet: native ./..., GOOS=linux -tags nogui, GOOS=windows: clean.
- go test -tags nogui ./...: every package ok except internal/agent, where
t3code's first Check (cloud only) failed the three every-agent tests
above. Fixed with the wiring check, then the whole internal/agent package
was rerun: ok (368s).
- GUI, Chromium and WebKit, 102/102 each: new claude-cloud-drift (5
languages, 1100 and 420px, file and shell notices), gui-de, gui-ja,
gui-zh-tw, i18n-keys, agent-notice-lang, agent-proxied,
agent-unreachable, cli-behind, menu-scroll, agent-connect,
agent-disconnect.
- Sandbox HOME (scratchpad dir, live ~/.claude untouched):
- Setup: real claude 2.1.300 with settings.json
{CLAUDE_CODE_USE_BEDROCK:"1", AWS_REGION, AWS_PROFILE}, a magpie-cloud
binary from this tree serving on 127.0.0.1:3487, a fake OpenAI
upstream on 3486.
- `magpie claude fake/fake-model` took the switch out and stashed "1".
- `claude -p "say hi"` printed PONG-FROM-FAKE-UPSTREAM, and the fake
logged POST /v1/chat/completions model=fake-model.
- `magpie claude default` left settings.json byte-for-byte the same as
before connect (cmp).
- Control: the switch put back by hand beside the wiring (the reported
state). Claude Code never reached magpie: the fake logged nothing.
Broken by hand, each went red:
- no dropClouds in writeTiers, then in Sync;
- putClouds returning at once, and putClouds writing over the user's own;
- no claudeCloud in Check;
- the T3 filter and the T3 Check;
- shellVars without ClaudeProviders;
- the tNotice calls taken out of the line and pill: claude-cloud-drift
went 17 red.
Not tried:
- A project's .claude/settings.json(.local) isn't read, because magpie
doesn't know where Claude Code runs.
- WSL and Windows were not run for real; tests only.
- Real Vertex, Foundry and AWS accounts.
- T3 Code and Claude Desktop with a switch, run for real.
- The drift shown in the real app window. The CLI has no drift output.
- The user's own ANTHROPIC_MODEL being lost across connect/disconnect is a
separate gap, fixed in its own commit.
|
||
|
|
ffd0778696 |
agent: an agent reaching magpie through a reverse proxy isn't drift, and a sync keeps the proxy's path (#1985)
davisjiahao put magpie behind a company nginx (https://ai.corp.example/magpie) and pointed their agents there with magpie's key. Every agent whose Check compares its URL exactly called that "unwired", offered Reconnect (which writes 127.0.0.1 back), and each start's sync replaced the origin but dropped the /magpie path. Decision: a URL that isn't magpie's is still magpie when it ends with magpie's path, the rest is an http/https address on another machine, and GET <rest>/ answers as the gateway's GET / ({"name":"magpie"}). Something else there (a relay CC Switch wrote) stays drift. Loopback on another port is magpie on an older port: drift, never probed. An unknown answer is not drift (as unreachable/proxied), so Reconnect isn't offered before the probe has answered. - reach.go: magpieAt / realMagpieProbe / reachesMagpie, probed in the background through the existing cache; answersAsMagpie shared with codex_proxy.go's realProxyProbe. offLoopback takes https too. - applied.go: wiringOff (the choke point for ~40 agents) accepts it; Codex's "bypassed" isn't told for a request to the host the config keeps magpie at, or one the gateway saw from it after. - claude.go (managed settings) and reasonix.go: their own exact checks. - codex.go: codexKeptGateway keeps https, default ports and a path prefix (#816's kept address, trusted by magpie's key); viaBase matches the kept codexURL, since at.host() falls back to loopback for https. - keptaway.go: awayPath keeps the path every URL at the away address had. - Port moves need nothing: Rewire/OnGateway re-set only unwired agents. - Picking a model in magpie still points the agent at this magpie (documented, unchanged). Run (sandbox HOME, worktree): - go test -tags nogui ./internal/agent: ok (297s) rebased on |
||
|
|
55213c1b4d |
agent: the Windows Codex app's version comes from its main Store package only, and agent tests never read the machine's AppX registry (#1334)
Review follow-up to 46e4107 (AwadYoo). What: - storeAppVersion counts only the main package (empty resource id). The Windows box's AppX registry key keeps a resource package that Get-AppxPackage no longer lists (Clipchamp.Clipchamp_4.6.10420.0_neutral_split.scale-125_… beside the installed 4.7.10020.0_x64__…). A stale entry like that is no sign the app is installed, and a newer-numbered one would win "newest". - internal/agent's TestMain stubs windowsStorePackages, as it already does for nodeModulesOf and the other machine readers (#1823's rule): on a Windows box with the Codex app installed, tests read nothing of it. - the doc comment for storeAppVersion had a blank line in the middle of it. It is joined, and windowsStorePackages has its own comment. Run (go1.26.8, sandbox HOME, private GOCACHE): - Windows box (Win 11 x64): installed the real Store app (winget 9PLM9XGG6VKS, "ChatGPT", OpenAI.Codex_26.1007.2314.0_x64__2p2nqsd0c76g0). A probe built from origin/main printed AppVersion="" HasApp=false; built from this series: AppVersion="26.1007.2314.0" HasApp=true, and CLI() ok=true App="26.1007.2314.0" with no codex CLI on PATH. - break checks: the resource-id filter put back to len(fields) < 3 -> TestCodexWindowsStoreAppVersion FAIL `Codex Store app: "27.0.0.0"`; AppVersion without the Store read -> FAIL `Codex Store app: ""`. Restored: pass on darwin and on the Windows box (test binary built with GOOS=windows GOARCH=amd64, run there with the real app installed). |
||
|
|
f156d90460 |
agent, gui: Codex isn't handed to a magpie it can't reach, through a proxy or after magpie quits (Muma102kMichael, Leon920717, thisisvainxx on X)
Muma102kMichael (Windows): after magpie took Codex over, every project and every new chat got 502. Codex's reqwest sends its requests for http://127.0.0.1:3425 through HTTP_PROXY/ALL_PROXY or the system's proxy, and only an exact IP or a CIDR in NO_PROXY (on Windows, with no NO_PROXY, the bypass list with "*." removed) keeps 127.0.0.1 off it: "127.*" and "localhost" don't, and macOS' exceptions aren't read. A proxy in global mode answers 502 for every request. With [features] respect_system_proxy Codex asks the system alone and goes direct with no proxy set there. Account failover, which magpie writes uninvited when 2+ ChatGPT accounts are on, put all of Codex's traffic, its own models included, behind that proxy. - codex_proxy.go works out Codex's proxy the way Codex does and probes GET / through it (must answer as magpie). Failover waits for that probe and isn't written while the proxy doesn't pass Codex on; one written before goes again. - New drift kind "proxied": the Agents pill says Codex reaches magpie through a proxy that doesn't pass its requests on, How to fix names the fix (DIRECT rule for 127.0.0.0/8, NO_PROXY=127.0.0.1, or 127.0.0.1 in Windows' bypass list), and the dialog has a one-click Disconnect from magpie (also on unreachable drift). - Leon920717: after quitting magpie Codex kept retrying. The app that serves the gateway now takes failover out in OnShutdown (EndCodexFailover); the next start's Sync writes it again. A connected Codex is kept (its model is magpie's; Disconnect restores). A kill or crash still leaves failover in place. - thisisvainxx: "several restarts". Codex's app-server keeps the base URL it started with, and KeepCodexDaemonCurrent ends with magpie, so EndCodexFailover restarts it when no codex session is on it. Run: - real codex-cli 0.162.1 in a sandbox CODEX_HOME against a fake 502 proxy and a fake gateway: NO_PROXY=localhost,127.* -> 30 POSTs to the proxy; NO_PROXY=localhost -> proxy; NO_PROXY=127.0.0.1 -> gateway; respect_system_proxy with HTTP_PROXY set -> gateway directly. - go test -tags nogui ./internal/agent/ (full package, 465s, ok) and the new tests after the daemon change; each new test went red with its guarantee broken by hand (failover gate, drift, EndFailover, daemon restart on quit). - node --test agent-proxied/agent-unreachable/agent-failover/ agent-disconnect-preview: 104 passed, chromium + webkit, en zh zh-TW ja de, window and panel. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui clean. Not tried: the quit path in the real app, on the Windows box, or whether computer use / remote connection broke for this same reason. |
||
|
|
d06df18255 |
agent: magpie configures the Aside account Aside has active, or the one picked on its row (#1499, fjrtdk)
Aside keeps one folder per account (~/.aside/u/<id>, each with its own settings.json, models.json, credentials.json and state.db), and which one is in use is currentAccountId in ~/.aside/accounts.json, which the app and `aside account use <id>` both set. magpie only ever wrote u/0 and asked the runtime about --account u0, so with u1 active Connect changed an account the reporter wasn't using. - magpie now follows currentAccountId. An accounts.json that is missing, doesn't parse, names no active account, or names one with no folder is "unknown" and keeps u0, as before; it is never written. - The Aside row gets an account field (under Details, shown only with more than one account) listing each account with its e-mail or "Local Account" and which one is active in Aside; `magpie aside account u1` does the same from the CLI. The pick is kept in magpie's own aside-account.json; Default removes it and follows Aside again. A pick whose folder is gone is passed over. - What magpie remembers to put back on Disconnect is per account (aside-state.json for u0, as before, aside-state-uN.json for others), so switching accounts never restores one account's model into another. The legacy stash still migrates into u0's only. - All runtime reads and writes go to `aside repl --account uN` for the account in use. - GUI strings in en, zh, zh-TW, ja, de. Run: go test -tags nogui ./... in a sandbox HOME; new aside_account_test.go uses the reporter's accounts.json bytes (TestAsideFollowsTheActiveAccount, TestAsideUnreadableAccountsKeepU0, TestAsidePickedAccountOverridesActive, TestAsideRestorePointsArePerAccount, TestAsideKeepsModelsPermissions); with asideChoice forced to 0 the follow, pick and restore tests fail, and with one shared record the restore test fails. GUI: aside-account.test.cjs (chromium and webkit, 980 and 360px, en/zh/zh-TW/ja/de) plus aside-native, i18n-keys, agent-field-names, agent-layout and agent-models-picker, 45 passing. gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent ./internal/gui. |
||
|
|
588e51ea4c | agent, gui: an agent connected by its config to an address where nothing answers is told, not shown connected (#1013, cjyrainbow: Codex Desktop's WSL environment reads Windows' ~/.codex/config.toml, whose openai_base_url and [model_providers.magpie].base_url the reporter pointed at Windows as WSL sees it, forwarded to 127.0.0.1:3425 by a portproxy of their own; after a reboot the portproxy listened no more and the Agents page still said Codex was connected) — Drift looked only at the config, which was right. Now an agent pointed at an address off loopback (this machine's Codex at an address the user kept, #816, through Agent.reach; every WSL twin under NAT, at Windows as the distro sees it, through Agent.Gateway) has that address tried from here (reach.go: GET /v1/models, any HTTP status an answer, 2 s timeout, in the background, at most every 20 s per address, never waited for), and one that doesn't answer while the gateway answers on loopback is a new drift, "unreachable", with Addr and the advice in Detail: under WSL (or on Windows) magpie with Settings › Share on local network on, or the user's netsh interface portproxy, which may need setting up again after a restart; Windows' firewall allowing the port for the WSL network; on Windows 11, networkingMode=mirrored; elsewhere, the forward to start again or gateway.URL() to point at. An answer not had yet, and a gateway down on loopback too, are no drift. The config is never changed for it, except where the address is one a WSL distro reached Windows at before (distro.Was, the last 4 kept in wsl.json as a re-probe finds Gateway changed) and the distro reaches Windows at another now: Drift's Move names that one, and Reapply moves the config there (Agent.move; Codex's codexMoveGateway rewrites openai_base_url and magpie's own provider's base_url, only where they begin with the old address). An address no distro was seen at is the user's own and is never offered a move. In the GUI the row's line says "{agent} is set up, but nothing answers at the address it reaches magpie by" in red with the advice as its tooltip, and its pill is "How to fix" (an i, not the reapply arrow), which opens the advice in a dialog (too long for the status line; it wraps and can be copied) and sets nothing — or "Use <address>" (the existing "Use {url}" string) when there is a Move, which reapplies; two new t() strings with zh, ja and de. The probe runs from Windows, not from inside WSL, so a firewall keeping WSL out isn't seen; the advice names it. TestKeptAddressNotAnswering (the reporter's case: Codex at 172.28.96.1, unreachable with the address and loopback in the detail; no drift once it answers, none with the gateway down too), TestKeptAddressProbeNeverWaitedFor, TestKeptAddressMovedWithWSL (Move from a Was address, Reapply rewrites both URLs, Check empty and no drift after; a 10.0.0.7 address is told but never moved) and TestWSLAgentAddressNotAnswering (Codex in a NAT distro told, with Share on local network, portproxy and firewall; a mirrored one never probed) fail without the Drift change and pass; TestLoopbackNotProbed, TestReachProbe (httptest: a 401 is an answer, a closed port none) and TestWSLWas pass. TestMain stubs reachProbe so no test dials out. -race -count=10 on them; go test -tags nogui ./internal/... under a temp HOME, go vet (darwin, windows), gofmt -l, linux and windows (nogui) builds pass. agent-unreachable.test.cjs (the window at 560px and the tray panel at 440px: the red line and tooltip, How to fix's dialog posting nothing, Use <address> posting the reapply, no sideways scroll) fails on main and passes on Chromium and WebKit in en, zh, ja and de; agent-connect, agent-layout, agent-field-names, aside-native, gui-de, gui-ja and i18n-keys pass on both. Not tried on a real WSL NAT setup (the Windows test box didn't answer ssh). docs/subsystems/agent-wiring.md says it. | ||
|
|
4a97acf12a |
refactor(agent): separate Aside provider connection from model settings (#827)
* refactor(agent): connect Aside as a native provider with verified settings * fix(agent): offer explicit offline Aside model and disconnect actions Offer Save for next start after an initial runtime read failure, using a structured API error instead of saved runtime state. Keep refusals and failed readbacks on the live error path. Add a separate offline disconnect confirmation that restores the checked file plan, clears restore records and removes the provider last. Bind the confirmation to its preview revision and roll back ordinary write failures. Cover offline API and browser flows, cancellation, stale plans, missing CLI, restore metadata and native provider spelling. Keep state file-only. |
||
|
|
c6875999b0 |
fix(agent): isolate Aside disconnect previews from the live daemon (#818)
* test(agent): reproduce Aside daemon calls during disconnect previews * fix(agent): isolate Aside disconnect previews from the live daemon |
||
|
|
21702d01ff |
Add German translation; harden paths against unset env vars (#770)
* Add German translation and harden paths against unset env vars Add a German locale to the GUI, tray menu, usage alerts and website home page, and refuse to start when the home folder is unset or relative so nothing is written under the working folder; the pi plugin no longer adopts the user's PI_CODING_AGENT_DIR, and an inherited APPIMAGE no longer selects portable mode. Scripts refuse to run from the wrong folder or empty a shared out folder, and a new internal/testenv sandboxes every test package from the user's real files, which also fixes the Claude picker and Termux installer tests on Windows. * Makefile: know magpie's folder by its go.mod, so paths with spaces work The check compared $(CURDIR) with $(dir $(abspath …)), which make splits on spaces, so a checkout under 'My Projects' or 'John Doe' refused every target. It now reads go.mod relative to the working folder and wants magpie's module there: make -C and a symlinked Makefile work, make -f from another folder still stops before any recipe runs. * i18n: German for the strings main added since, with a parity test 75 strings main added (group order, patterns, slow-start wait, usage caps, RTK savings …) get their German, and two that main dropped go. gui-de.test.cjs checks, as gui-ja does, that de has every zh string with its placeholders and tags, and that the window reads in German when picked or on a German system. * appdir: ignore relative folder variables when reading, keep them for children CheckEnv no longer unsets anything. magpie reads the XDG folders, APPDATA/LOCALAPPDATA and every agent's folder variable through appdir.Getenv/LookupEnv, which pass over a relative value; the environment stays as it is, so the agents magpie starts get the variable as the user set it. That covers what proc.UserPath lends from the login shell too, which is set after main's check and reached the desktop app unchecked. On Windows a path rooted on the current drive (\Users\x, Git Bash's /c/x) counts as usable, and magpie version and help answer without a home, before run makes any folder. * Sandbox the tests main added since internal/wslrun gets testenv's TestMain, and four tests main added that set HOME alone set their home with testenv.SetHome, so on Windows they don't read the runner's profile through USERPROFILE. * agentenv: PI_CONFIG_DIR and OPENCODE_DB take relative names on purpose omp puts $PI_CONFIG_DIR under the home and OpenCode a relative $OPENCODE_DB in its data folder, so neither depends on the working folder: appdir no longer passes them over. * i18n: German for the Library's multi-select and System One's decision API The 19 strings main added since (#791's skill multi-select, the decision API snippets) get their German; the one main replaced (four APIs → five APIs) goes. * appdir: tidy the import into magpie's group; say what Go makes of /c/x The appdir import joins the group of magpie's own imports where a file has one. rooted's comment now says that Go takes a Git Bash path like /c/x as \c\x on the current drive, not C:\x. |
||
|
|
28a830fc5c |
aside: magpie picks Aside's model, its thinking level, its four task models and its picture model (#789)
* aside: magpie picks Aside's model, its thinking level and its four task models (X: junjie — Aside Settings → Models has a Default model row magpie could not touch, and Fast/Standard/Deep/Visual rows it could not reach at all) Aside reads the same provider list Pi does, so magpie hands it the whole catalogue in a provider block of its own, carrying the magpie-aside token so its requests are told apart in usage. What differs is the default: Aside keeps it as one object in ~/.aside/u/0/settings.json naming the provider, the model, the thinking level and fast mode together, so the model field reads and writes two keys where Pi's are two strings, and both go through Aside's own settings API — the running daemon holds its default and writing the file behind it leaves the daemon on what it already had, read back the same way with the old model still named after magpie had written the new one. The API is reached through the repl, the settings command having no set of its own. The four task roles are the same shape as the default and are wired the same way, each a Quiet field following the model, so a role the user has not set is not a line of its own and follows the default. A role is written whole: thinkingLevel is required by Aside's schema and a role without one is refused, so a role keeps the level and fast mode it had, a new one takes the default's, and where neither is set it takes the level Aside gives its own roles. Taking magpie out puts every role back, the user's own model where there was one and nothing at all where magpie was the only thing that set it, and a role the user moved onto a model of their own is left alone. Each change checks the value that came back: Aside answers a set with the settings as they now are and drops what it will not take without a word — a role naming a model it has not resolved yet is the one that happens — so without the check a change that went nowhere read as one that landed. Caught, it is written to the file, which is what Aside reads at its next start, and the Agents page says so. The account magpie wires is 0: the folder is ~/.aside/u/0 while the CLI names it u0, and TestMain stands in for the binary so a test can never change the real Aside's default. A models.json carrying a magpie provider of someone else's is refused rather than written over, and one that will not parse is the user's to fix. With the owner's real Aside under a sandbox HOME: a pick reached the gateway and was attributed to a client named Aside, the default put the user's own minimax model back and took the magpie provider out, and a role set through magpie was read back by the running daemon the moment it had a magpie model to resolve. Not tried: a change written to the file taking hold at Aside's next start, which needs a restart. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... pass (TestBunThroughBridge fails, reproduced on a pristine worktree of the parent; internal/plugin passes alone and times out only under the full run's load). * aside: the row appears for an Aside that is installed and not yet used (the CI preview of #789 could not find .row.agent[data-id="aside"]) Detected() took ~/.aside/u/0, the account folder, and that only exists once someone has signed in. The binary was the other look and the CLI installer links it into ~/.local/bin, which a magpie launched from Finder has no PATH entry for, so an Aside that was installed and never used showed no row at all — the preview installed one, drove the UI and could not find it in either the installed list or the row selector. The installer writes ~/.aside/cli and the daemon writes the rest, so ~/.aside is the folder that is there from the install, and it is the one Detected() should ask about. Path stays the account's settings.json, which is the file magpie edits and the only one worth reading a model out of. TestAsideIsDetectedBeforeAnyAccount fails on the old Dir: it takes PATH away so the binary cannot be found either, makes the installer's folder and no account, and expects the row. * aside: a wedged repl gives up, and the model comes off through Aside (yetone on #789) Three things about the way out of an agent and into one, all found on a real Aside. The repl had no timeout. proc.Command(...).Output() waits as long as the command does, so a daemon that has wedged or one waiting on input leaves a pick in the Agents page or the CLI hanging on it, and switching off asks up to five times over — the default and four roles. proc.CommandContext with ten seconds: Aside answers in milliseconds, and a run that does not is written to the file instead, which is what Aside reads at its next start, with the notice that says so. TestAsideGivesUpOnAReplThatHangs runs the real command against an aside that never returns: it passes in the timeout, and without CommandContext it hangs until the test's own timeout kills it. Switching off with no model of the user's behind magpie's wrote settings.json directly. By then the provider block was gone, so the running daemon went on using magpie/… with no way to reach it, and asideStale was never set, so nothing said the change needed a restart. It goes through asideApply like every other change, with the value that came back checked. The provider block now goes last, after the default and the four roles are put back. A step that fails on the way out otherwise leaves the settings naming a provider that is no longer there. TestAsideDefaultTakesTheProviderOutLast watches the block from inside the settings step and fails on the old order. The icon is Aside's own brand-embossed-light.svg with the embossing's transparency taken off, so the mask is solid and takes the row's text colour like every other agent. As it was, the white fills at 8–20% opacity the dark and light brand files are built with left the mark almost invisible on a light row, and it vanished entirely in dark mode. Same paths, same shape, now solid; checked in the app next to Pi's. Tested against Aside 1.0.928.1 (daemon 1.26.928, CLI 1.26.916.1741) on darwin/arm64. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./internal/agent pass (408). * aside: the model Aside draws with is magpie's to set too (X: Aside Settings → Images had no row for it) Aside keeps a fifth model setting beside the default and the four task roles: imageGenerationModel, the provider and the model it draws pictures with and nothing else — no thinking level, no fast mode, since neither means anything for a picture — and no key at all on an account that has never picked one. It is a magpie field like the roles: Quiet, so it is not a line of its own on an account that has none, and taking the model after while it is unset. A model of magpie's needs the provider block to reach it through, and what it named before is remembered the same way a role's is, so `magpie aside model default` puts the user's own picture model back and takes a picture model of magpie's off rather than leaving it naming a provider that is no longer there. Not wired: customModels, which is the user's own model definitions with their own credentials, and asideModelCatalog, a list of model ids to pin or hide. Neither is a model magpie picked, so neither is a setting of magpie's to own. Aside 1.0.928.1, daemon 1.26.928. go vet, the agent/gui/profile tests, the three CLI cross-builds and the CLI verification under a temp HOME all pass. |
||
|
|
5d126a0db7 | agents: Pi's model picker lists the models of its openai-codex sign-in from Pi's own registry, and its Default says it lets Pi pick (#709) — Pi's native options came from models.dev by provider id, and models.dev has no openai-codex (Pi's "OpenAI Codex (legacy)" ChatGPT sign-in), so a Pi signed in to both openai and openai-codex was offered openai/… only. Pi's (and OmO's) own options now come first from the model registry in the package Pi was installed from: the pi command on PATH leads to @earendil-works/pi-coding-agent, and pi-ai's dist/providers/data/<provider>.json (Pi 1.0) is read as is, in its order, chat models only (no gpt-image-2), memoized by the file's stamp — the list Pi's /model offers, which moves with every Pi update. A provider the registry doesn't have keeps models.dev's list; openai-codex with no registry in reach falls back to Codex CLI's models_cache.json (the same ChatGPT backend); models.dev's openai list isn't mapped onto it. The rows are openai-codex/<model> under "OpenAI Codex" with OpenAI's logo, a row each beside openai/<model> of the same name; picking one writes defaultProvider=openai-codex, defaultModel=<model> as before. omp shared the gap for its current model's provider (ownOptions): it now reads omp's own catalog (@oh-my-pi/pi-catalog src/models.json, non-chat kinds left out); omp's signed-in providers that aren't the current one are still #341's. Default in Pi's and OmO's model picker now says "clears the default model; Pi picks one on its own" (zh 清除显式默认模型,由 Pi 自动选择; no ja table exists), other agents' still say what they ship with. TestPiOffersItsOwnOpenAICodexModels (a fake npm-linked Pi 1.0 install, temp HOME and PI_CODING_AGENT_DIR, auth.json with openai and openai-codex oauth test metadata), TestPiOpenAICodexWithoutItsRegistry and TestOmpOffersItsOwnOpenAICodexModels fail on the old code (no openai-codex rows) and pass; pi-default-note.test.cjs (webkit, en/zh) fails on the old app.js and passes; agent-disconnect, agent-models and agent-model-groups GUI tests pass. Read-only against this machine's real installs: Pi 1.0.0 gives openai-codex 9 models and openai 44, omp's catalog openai-codex 8. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestProvidersAnswerWhileListsComeIn, TestClaudeSignedOut, TestClaudeAccountNamedAsItsLogin and TestClaudeIdentityServedWhileAsked, timing tests that pass alone. Not tried in the GUI with real Pi sign-ins, nor with a Pi older than 1.0 (no data folder: models.dev and Codex CLI's list as before) or a Windows npm shim. | ||
|
|
6e6338f8d6 |
agent: configure Zed models and gateway credentials automatically (#584)
* agent: configure Zed models and gateway credentials automatically Add Zed to the CLI and Agents page with an OpenAI-compatible magpie provider, a synced model catalog and default model selection. Preserve existing JSONC settings and restore the previous provider and default model on reset. Store the gateway credential in Secret Service, macOS Keychain or Windows Credential Manager so Zed needs no manual API key entry. Cover config preservation, catalog sync, model limits, Flatpak paths and credential failures. Verified with the full nogui test suite, go vet, macOS and Windows cross compilation, and a local Zed conversation through the gateway. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd03-00d7-75fd-956f-c505e07ba60d Co-authored-by: Amp <amp@ampcode.com> * agent: store Zed credentials directly through Secret Service D-Bus Replace the Linux and FreeBSD secret-tool subprocess with the existing godbus client. Open a session, create the default collection when needed, unlock it and replace the matching Zed credential. Handle collection, unlock and item prompts, dismissal and timeout. Verify the protocol on isolated D-Bus instances with no helper executables on PATH, including immediate completion signals and failed writes. The full nogui suite, targeted vet and race checks, macOS and Windows cross compilation pass; local credential readback confirms replacement without duplication. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd03-00d7-75fd-956f-c505e07ba60d Co-authored-by: Amp <amp@ampcode.com> * docs: remove the separate Zed configuration paragraph Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd03-00d7-75fd-956f-c505e07ba60d Co-authored-by: Amp <amp@ampcode.com> * agent: fix Zed reset, keychain access and translated notices Avoid restoring magpie’s own provider after a model change in Zed, and cover reselection followed by reset. Remove the unsupported Flatpak config path. Authorize the installed Zed app and security command to access the macOS gateway credential. Translate Zed’s notice and apply translation when selecting or reapplying an agent model. Verified with the full nogui test suite, go vet, Zed race tests, cross compilation and browser checks. macOS keychain behavior still needs runtime verification on a Mac. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd70-98a1-737f-93bd-77e181f904c1 Co-authored-by: XYenon <register@xyenon.bid> * agent: preserve Zed model picks when resetting magpie Restore the stashed default model only while Zed still selects magpie. Preserve a model chosen in Zed itself and discard the stale model stash, while restoring the previous provider. Find Zed Preview in Applications folders and Spotlight without requiring a CLI, and use any in the isolated D-Bus tests. Verified the reset regression fails before the fix and passes afterward. The full nogui suite, go vet, Zed race tests and macOS/Windows test cross compilation pass. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd70-98a1-737f-93bd-77e181f904c1 Co-authored-by: XYenon <register@xyenon.bid> * agent: retain Zed provider backup when reselecting magpie When Zed’s provider already points at the gateway, update only the model stash and preserve the original provider backup. Reset can then restore the user’s provider after a native model pick followed by another magpie pick. Add a regression covering the full sequence and checking the restored provider, model catalog, custom headers and latest native model. Confirm it fails before the fix and passes afterward; all Zed tests, the full nogui suite and go vet pass. Amp-Thread-ID: https://ampcode.com/threads/T-01a0fd70-98a1-737f-93bd-77e181f904c1 Co-authored-by: XYenon <register@xyenon.bid> --------- Co-authored-by: Amp <amp@ampcode.com> |
||
|
|
d8ebf2b893 | test: one list of the agent folders a sandbox clears, so no sandbox misses an agent (yetone, on #522: A shared list of env vars for the other sandboxes would be a welcome follow-up) — every sandbox kept its own list of the variables that point at an agent's folder, and each had drifted: the gateway's cleared 5 of the 32 magpie reads, the provider package's 2, the tui's 10, the library's 20. A sandbox clearing 2 meets whatever Grok, Kimi, Hermes, MiniMax, Qoder or ZCode the developer has installed, which is how #522 came about — Qoder's two were in the library's list and in none of the four that failed. internal/agentenv is now the one list, and the 21 sandboxes that fake an environment with no agent in it clear it, each keeping beside it the variables that are not an agent's: APPDATA and LOCALAPPDATA, which a sandbox sets to a folder of its own rather than clearing, VISUAL and EDITOR. A name in the list is one magpie reads, and TestVarsAreRead walks the sources to say so, which is how two names a sandbox had been clearing turned out to be read by nothing at all — GEMINI_CLI_HOME and OPENCODE_CONFIG in internal/backup's, while OPENCODE_CONFIG_DIR, the one internal/agent reads (agents.go:545), was not in it. Where a sandbox set an agent's folder to a fixture of its own, the clearing now comes first, since a list of 32 wipes what a list of 5 left standing. Not converted: the omp tests' four variables, which are the ones omp's own lookup consults (a Pi fork) rather than every agent's, and the warm-up's Claude Code traffic flags, which are not folders — CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC stays out of the list for that reason too, its one test setting it on purpose. On Windows 11 the whole suite answers as it did before the change: 31 packages pass, and the same 15 tests in internal/library, internal/gateway and internal/agent fail for what they failed for before (symlinks this machine has no privilege for, and TestSuffixModesReachAgentFiles). go vet ./..., go build -tags nogui (windows, GOOS=linux, GOOS=darwin), and go vet -tags nogui for linux and darwin over every package touched pass. (#543) | ||
|
|
27f0e4ebdd |
codex: when the ChatGPT account runs out of its allowance after a magpie model was picked, magpie becomes Codex's provider, and goes back beside the sign-in when the allowance is back (#540: once the Codex 5-hour/weekly quota is used up, a third-party model through magpie sends nothing in new or old sessions; Dazzle-sys: the session was on the magpie model all along, the quota went elsewhere) — the Codex desktop app refuses to send for a ChatGPT account that is out of its allowance before any request is made, whichever model the turn is on, so a magpie model beside the sign-in (openai_base_url, ChatGPT mode) is blocked with it; Codex's open-source core and TUI only report a usage limit after a response, the block is the app's, keyed on the account. bd5bf422 made magpie the provider (model_provider = "magpie", model_catalog_json; the app-server's getAuthStatus then answers requires_openai_auth false, the app's API state) only when a model was picked while the account was already out, so an allowance running out later left Codex as it was. KeepOnAnAccountWithRoom now also looks, every 5 minutes, whether the active Codex account is out (CodexUsedUp, now read through LoginUsage's cache, fetched at most once a minute, as the agents' sync asks it on every catalog sync) and tells the agents' sync when that changes (noteCodexUsedUp → catalog.Touched); Codex's Sync then sets the magpie model again, which wires it as the provider while the account is out, marked codex.out in the stash, and puts it back beside the sign-in once the allowance is back, only where it was moved for that (a provider asked for with sign-in "api" stays). Threads started on Codex's own provider and reopened may still be held by the app; the Codex app may need a restart to take the new config. agent's TestMain stubs codexUsedUp so no test asks OpenAI. TestCodexRunsOutAfterPick (ChatGPT mode, then out: provider; out again: stays; back: beside the sign-in; api stays) fails without the change; TestNoteCodexUsedUp checks only a change is told. No request was made to OpenAI. go vet ./internal/..., go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui -count=1 ./... under a temp HOME pass.
|
||
|
|
f7f6741218 |
test: a test's sandbox keeps Qoder's folder out, so no test reads the developer's real sessions (#522)
* test: a sandbox keeps Qoder's own folder out, so no test reads the sessions of whoever's machine it runs on — QoderDir takes $QODER_CONFIG_DIR, else $QODERCN_CONFIG_DIR, before ~/.qoder and ~/.qoder-cn (internal/sessions/qoder.go:19), so a test that faked a home through HOME and USERPROFILE still listed the developer's real Qoder and Qoder CN sessions, and one that asked which agents an environment with nothing in it shows found two. Qoder's CLI sets both for every child it starts, and magpie manages Qoder, so writing magpie from inside Qoder is a likely way to run its tests: five failed here, with a real conversation's titles in the output. sessions' setupCalls, the tui's home and the agent package's TestMain unset Claude Code's, Codex's, DSH's, Pi's, omp's, Cline's and WorkBuddy's folders already, and the library's list has Qoder's two (library_test.go:41); these three did not. TestSessionsPage, TestSessionsList, TestSamePrefixRewriteWithGrowth, TestCallsConcurrentWithSessionReaders and TestUnsetAgentsReadEmpty fail without the change on a machine with the variables set, and pass with them and without. go vet, go test -count=1 ./internal/tui/ ./internal/sessions/ pass; in internal/agent, TestSuffixModesReachAgentFiles fails on this Windows box with and without the change (another matter, not touched here), and TestWSLProbeScriptSaysWhere fails only under a POSIX-style PATH such as git-bash gives its children, and passes under a native Windows one. Twelve more sandboxes unset the other agents' folders without Qoder's (backup, davsync, profile, gui/backup, eight in provider, gateway/claude_warmup, webdav_cli); no test of theirs reads a Qoder folder today, so none is changed here. * test: the CLI's sessions sandbox keeps Qoder's folder out too (yetone, reviewing: 还漏了一处:根包 sessions_cli_test.go 的 sessionsHome 同样只清了别的 agent) — sessionsHome unset every other agent's folder without Qoder's two, so with QODER_CONFIG_DIR or QODERCN_CONFIG_DIR naming a Qoder folder that has sessions in it, `magpie sessions` listed the developer's own Qoder and Qoder CN sessions beside the fixture's, and TestSessionsCmd failed on what it saw. Both are unset now, as the tui's home, sessions' setupCalls and the agent package's TestMain unset them. The agent package's is the weightier of the two, since what TestDriftUnwiredEveryAgent (internal/agent/applied_test.go:123) does with a folder it is pointed at is not read it but write it: wiring every agent it can through the gateway, it put magpie/fake/m1, the key magpie-qoder-cn and http://127.0.0.1:3425/v1 into that folder's settings.json — a developer's own Qoder, not a fixture. Measured both ways, the variables naming a folder of their own: on main the folder holds a settings.json afterwards, with the unset it holds nothing. TestSessionsCmd fails without the change and passes with it; the root package's suite passes with the variables naming a folder that has sessions in it, and with them unset. go vet, go test -count=1 . pass. |
||
|
|
a3704c422b |
tests: keep the suite out of a real DSH_HOME, as the other homes already are (#454)
DSH_HOME beats HOME in DshDir and in dsh's own dir, so a suite that sandboxes HOME still reads and writes the developer's ~/.dsh. |