4794de398ea8337d223a91e207181c56fcf4ad76
33
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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. |
||
|
|
64262a19f0 |
agent: Prime Agent is an Agents-page row, wired like Pi into ~/.prime/agent, and Disconnect puts its files back (#1528, takltc)
What changed
- internal/agent/primeagent.go: Prime Agent (PrimeIntellect-ai/prime-agent,
CLI prime-agent) through the piLike path, as OmO was added. Its folder is
~/.prime/agent or PRIME_AGENT_CODING_AGENT_DIR (~ expands, as upstream's
agent_dir does; appdir now lets that variable carry ~). models.json and
settings.json were checked against upstream v0.10.0 (pa-core settings and
models registry): Pi's camelCase fields, the same thinking levels and
enabledModels rules. Connect writes providers.magpie, defaultProvider and
defaultModel and keeps the user's providers and settings. Only the global
settings.json is written; allowedModels and subagentDefaultModel are left
alone.
- Prime Agent sends no User-Agent, so its provider block carries the key
magpie-prime-agent and the usage log names it (piLikeKeyed). The block is
Pi's otherwise, compat.sendSessionAffinityHeaders included (Prime Agent's
openai_completions honours it), kept as the user set it (piBlockKept).
- Disconnect restores both files byte-for-byte: before magpie's first write
a copy is kept (*.before-magpie, or a note that the file was absent), and
Disconnect puts it back when nothing else changed since (Agent.Restore). A
file changed while connected is left with only magpie's part taken out.
- WSL kind, agentenv, the icon, PICKS_ITSELF in the GUI, docs and READMEs.
Run
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/agentenv
./internal/library ./internal/usage; the new tests went red with the key,
the restore, the ~ expansion, PICKS_ITSELF and the icon each taken out.
- pi-default-note.test.cjs in chromium and webkit.
- Real use: prime-agent 0.10.0 installed into a sandbox HOME, a sandbox
gateway on 127.0.0.1:3651 and a fake upstream on 3652. The interactive
TUI with no flags started on magpie/fake/echo-1, the fake got the request
and usage.jsonl recorded agent "prime-agent". `magpie prime-agent default`
put models.json back byte-for-byte; settings.json got its values back, but
Prime Agent rewrites the whole file when it runs (every key, nulls), so
that file is equal in content, not bytes. Reconnecting over that
null-filled file and disconnecting again left it byte-identical. After
the rebase onto
|
||
|
|
4e584faa51 |
agent: a Codex the user disconnected stays disconnected through restarts and updates (paynezhuang)
paynezhuang on Discord: magpie's first start pointed Codex at the gateway by itself; they switched Codex on, chose "Disconnect from magpie", and after each update and restart config.toml had openai_base_url again. Cause: Codex's Sync runs at every start (SyncCatalog) and calls failover(), which writes openai_base_url whenever Codex is signed in to ChatGPT and another of the user's ChatGPT accounts is on in magpie. Nothing told it the user had taken magpie out. The same Sync's #701 branch (sign-in "magpie API" on one of Codex's own models) wired a disconnected Codex again too, and with magpie API Disconnect itself left failover's base URL behind (its own model Set ran failover). Fix: Disconnect marks the agent disconnected in the stash (<id>.disconnected) before it writes anything; connect() and an Apply that leaves the agent wired take the mark out. Codex's failover treats a marked Codex as having no other account on (and takes out a base URL it owns), and the #701 re-wire skips it. Failover for a Codex never disconnected, and a base URL written by hand (#856), are as before. Siblings: TestDisconnectStaysThroughSync connects and disconnects every non-WSL agent with fields, then runs SyncCatalog and dsh's KeepDshWired round twice: none is wired again and no file outside magpie's own changes. It passes on the old code too (only Codex had the problem); it guards the class. Cursor, Copilot CLI and Devin can't be connected in the sandbox and skip; Native (Aside) and Launch agents don't Sync wiring. Run: - TestCodexDisconnectStaysWithAccountsOn (ChatGPT and magpie API) and TestCodexAPIDisconnectStays fail on the old code ("start 0 after Disconnect wired Codex again", "disconnect left magpie in") and pass now. - go test -tags nogui ./internal/agent ./internal/gui . (sandbox HOME): ok - gofmt -l, go vet, GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent: clean - Real magpie (nogui build, `magpie web --gateway`) under a scratchpad HOME, gateway 127.0.0.1:3481, web 3482, fake ChatGPT auth.json plus a second ChatGPT login on: old build re-wrote openai_base_url 2s after a restart following Disconnect. New build: first run wires (failover), connect, disconnect, restart as 0.1.99998, then start as 0.1.99999 (last-version moved): config.toml byte-identical to after Disconnect, no failover; connecting again wires it and a restart keeps it. |
||
|
|
a5114d931f |
agent: Claude Desktop from its MSIX isn't said to be off magpie when the package's copy is emptied, and Reconnect puts its gateway back (dumplings)
dumplings (Windows, Desktop 2.31226.0 from the MSIX) saw "Claude Desktop
已不经过 magpie:配置已变更" while Desktop ran on magpie, and Reconnect
didn't clear it; switching Desktop's provider off magpie and back did.
Two causes:
- Check went over both sets of folders magpie writes for a packaged
Desktop (the package's LocalCache and the real ones, as which build
is installed can't be told) and failed when either was off magpie.
2.31226 reads the real %LOCALAPPDATA%\Claude-3p (bg5eau, already in
desktopdir), so the package's copy, emptied, isn't Desktop off
magpie. desktopRead now judges only the set whose Claude-3p Desktop
ran in last ("Local State", desktopdir.LastRun), every set when it
ran in none, as before.
- Reapply on an unwired drift re-set the field drift shows on and
fields on magpie's models. Desktop's drift shows on a tier (sonnet,
on a magpie model), and its provider field ("magpie") isn't a model,
so the gateway was never written back. Reapply now also re-sets a
field whose value is magpie itself, as Wired already counts it.
The reporter's analysis said 2.31226's AppxManifest excludes
Claude-3p from virtualization; that manifest wasn't seen here (the
Windows box has no MSIX Desktop), the fix rests on Desktop reading the
real Claude-3p, which bg5eau's case showed.
Run: TestClaudeDesktopMSIXChecksTheFoldersDesktopRuns (MSIX layout:
package Roaming\Claude and Local\Claude-3p with an older Local State,
the real Claude-3p newer); red with Check over every set, and red
with Reapply without the magpie-valued field. go test -tags nogui for
internal/agent, internal/desktopdir, internal/gui, internal/library;
the agent package's TestClaudeDesktop* built for windows/amd64 and run
on the Windows box, all pass; gofmt -l; go vet -tags nogui on darwin,
GOOS=linux and GOOS=windows for internal/agent, internal/desktopdir.
|
||
|
|
0bf9d77d3f |
agent tests: TestDriftBypassed's request reaching the gateway is kept to its run, so -count=2 passes
The test stood for a request with usage.Saw("codex"). Saw's record lasts
the process, which the gateway relies on (LastSeen answers from it before
a request is written to the log), so a second run started with a request
seconds old, newer than its prompt five minutes back, and found nothing
bypassed ("bypassed: <nil>", also on origin/main).
Drift reads LastSeen through a package variable the test replaces with its
own clock; production still reads usage.LastSeen. That Saw is LastSeen's
answer at once moves to usage's own TestSawIsLastSeen, which removes its
record afterwards.
-run 'TestDrift|TestSawIsLastSeen' -race -count=5 passes; before, -count=2
failed.
|
||
|
|
99f07249e8 |
agent: Claude Code's tiers and subagents following a main model moved onto the model magpie gave them aren't "changed outside magpie" (#1050, cjyrainbow: Claude Code · WSL Ubuntu 已在 magpie 之外换掉 claude/claude-sonnet-5-5[1m])
With the sonnet tier and the subagents on Sonnet 5.5 and the main model on Opus 5.5, moving the main model to Sonnet 5.5 in Claude Code's own /model left the two following it: they read as empty, and Drift took that for the agent's default replacing the Sonnet 5.5 in applied.json. Drift now reads an empty field that follows another (Follows) as on that field's model, so the usual rules apply: a move between magpie's models isn't drift, the main model taken off magpie still is. The subagents field now says it follows the main model, and a stopped WSL distro's agent keeps Follows too. TestClaudeFollowerOnTheMainModelIsNoDrift and TestWSLClaudeFollowerOnTheMainModelIsNoDrift (running and stopped distro) build #1050's record through Apply and the switch through /model + Follow. Without the change both fail with "replaced Field:sonnet Now: Want:anth/claude-sonnet-5-5[1m]"; without the wsl.go line the stopped distro still does. go test -race ./internal/agent ./internal/profile pass. |
||
|
|
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. | ||
|
|
6f391bc8f2 |
provider, agent, cli: a routing group's id carries Claude Code's [1m] mark (#1000)
wherever a ref is read back from an agent's settings An agent on a routing group is shown, on the Providers page, on each of that group's providers — the row's middle holds one button per agent, and `uses` is what the Routing page's "n agents routed through it" counts. A group whose model has a 1M window is written into Claude Code's settings with the mark Claude Code itself puts on it (`group/auto-deepseek-v4-1-flash[1m]`), and GroupFor takes the mark off for the gateway; the rest did not. So the group was not found, and an agent Claude Code had on it was listed on none of the group's providers, while every request it made went through them. Four places read such a ref back: - provider.GroupFinder, which the Providers page asks (agentUses) - agent.sameModel, which moves an agent whose group is gone to the same model from a provider still serving it — the mark left on made the comparison against AutoGroupOf find nothing, and the agent stayed on a group nobody serves - agent.groupNamed, which says whether two values of a field reach the same group, one of them read back from the agent's own settings - the CLI's groupUses, which lists "← agent" beside a group: the marked id was filed under one no group has, and Claude Code was on no row Each takes the mark off, as GroupFor does. A group's own members are not touched: those are the group's structure, never a ref from an agent's settings, and a [1m] there is a model's, not the group's. group_uses_test covers the page (a group found with and without the mark, and the row naming the agent on the group's provider); applied_test covers groupNamed; reseat_test covers the move (the marked group ref finds the same model elsewhere, and a group that is nobody else's still gives nothing); groups_cli_test covers the CLI, with Claude Code's settings.json as the reporter's reads. Each fails without its fix. go build, go vet pass; go test ./internal/agent/ passes, and the failures that remain are the ones a clean origin/main has too (Aside's symlinks, ~/.codex dependence, VSCode's launchers, a flaky Zed case). Co-authored-by: wizzy-yang <wizzy-yang@users.noreply.github.com> |
||
|
|
ab47042ba8 |
agent: Codex on one of magpie's models beside its ChatGPT sign-in stays connected when Codex writes one of its own models back, and connecting keeps the model it was on through magpie where it can't join (#940, xybio)
Picked "via magpie" on a ChatGPT-signed Codex, a magpie model is set beside the sign-in: openai_base_url to the gateway, the magpie table, no model_provider. When Codex itself (its /model, or a Codex app still running on its old pick) then wrote one of its own models back (gpt-6.1-sol), Wired found nothing to say magpie had put it there, so the row read Not connected while its config still pointed at magpie's gateway. Set so, Codex keeps a codex.beside mark (gone when magpie becomes its provider, on a pick of its own through the picker, or on disconnect), and Agent.Beside makes Wired true on it; the model written back is still told as a change from outside (#750's drift stays). Connecting where Codex can't join (its ChatGPT allowance used up, or a model_provider of its own) went to the first of magpie's other models (Grok 4.7, "magpie doesn't serve the model it was on"), since Codex's field leaves out magpie's codex/* models: Agent.OwnVia now finds the model it is on as magpie serves it on the user's ChatGPT account (codex/gpt-6.1-sol), and Connect keeps it there. TestCodexOwnPickAfterMagpieModelStaysConnected and TestCodexConnectKeepsItsOwnModelThroughMagpie are new; with the change taken out the first reads the reported config (model gpt-6.1-sol, openai_base_url, [model_providers.magpie], no model_provider) as not connected and the second connects to fake/m1 "first". Tested in temp HOMEs only. go vet, go build (GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (internal/proc TestUserPath timed out waiting on a login shell under load once, and passes on its own). |
||
|
|
58ecd4454c |
davsync, agent: sync turned off and on again to the same server keeps what changed here, and an agent shown only routing groups connects on the first (#939, aiirobyte)
Off deleted sync-state.json, so turning sync on again made this computer a new one: the first sync brought the server's whole setup in over it, and every agent changed while sync was off went back to the server's older fields. Off now keeps what this computer last synced (dropping only the error, notice, undo and usage state), so it resumes: changes here go up. TestOffAndOnAgainKeepsChangesHere fails without it (Codex's model went back to "gpt-old"). The Agents switch said "magpie has no models Codex can use" when the only models shown to the agent were routing groups (its own ChatGPT account's are left out of Codex's list), while `magpie codex group/folia-1` worked. Connect now falls back to the first routing group. TestConnectOnARoutingGroupAlone fails without it. |
||
|
|
b2a3449021 |
gui, agent: the models picked for a WSL agent are the ones its picker, its own menu and the gateway list, and a model taken out leaves the picker at once (#927, cjyrainbow)
Claude Code · WSL Ubuntu's model list kept what it picked under its row's id, claude@wsl:Ubuntu, while everything that lists models for it reads claude's: the default-model picker (claudeViaMagpie), the models written into its settings and the gateway's /v1/models for its key (magpie-claude). The line said 2 models; the picker and Claude Code's own menu had them all. Agent.ListsFor is the id a row's models are kept and read under, the Windows twin's for a distro's agent, and the Agents page's model list and line use it (Codex · WSL's order too). Closing the list wrote the hidden set and refreshed the state afterwards, but the click that closed it was the one on the model picker, which opened on the row's old options. The row's pickers now drop what was taken out as the list closes; what was put back comes with the state. TestAgentModelsWSL (FakeWSL distro with Claude Code) and agent-models-picker.test.cjs (Chromium, WebKit, en, zh) are new and fail without the change. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass; the agent-models*, click-scroll, codex-model-order and agent-model-groups GUI tests pass. |
||
|
|
528d6c12dc |
agent, gui: Codex left on model_provider = "magpie" with no [model_providers.magpie] loads its config again, and connecting with nothing in magpie says what to do, in the reader's language (Tystem on Discord) — the Codex app said "无法加载 config.toml … Model provider magpie not found", magpie showed Codex as not connected on "deepseek-flash", and its switch answered only "Codex can't be connected to magpie", in English. Codex looks model_provider up in [model_providers.*] as it loads config.toml (codex-rs: "Model provider {id} not found"), so the key without the table keeps it from loading any config, a new thread too, not just an old one. magpie never writes one without the other: it takes model_provider out whenever it steps out as the provider (disconnect, Unwire, a model of Codex's own, Join) and keeps the table so the threads started on magpie still open. That is unchanged, and TestCodexSteppingOutLeavesNoHalfState now covers it. Another tool or a hand edit had taken the table away. Sync, at magpie's start and whenever the catalog changes, now writes the table back whenever the config names magpie as its provider, at the top or in a profile, and has no table, whether Codex is connected or not. Check reports that state too. A config magpie can't parse is still only reported, never written to. A Connect that finds none of magpie's models because no provider or subscription has been added answers agent.NoModelsError, "Add a provider or subscription in magpie first, then connect Codex". /api answers it with code no_models and the agent's name, which app.js says through t() (en/zh/ja/de). docs/reference.md no longer says the table goes with a native model. TestCodexProviderWithoutTable (top and profile: Check says so, Sync writes the table) and TestConnectWithNoModels in internal/agent, TestAgentConnectNoModels in internal/gui, and agent-connect-no-models.test.cjs (WebKit, en/zh/ja/de: the toast in the reader's language, the switch back off, no scroll, no native dialog) are new and fail without the change; the latter's en case passes either way, as the server's message is English. Chromium wouldn't launch on this machine for this test or the existing agent-connect.test.cjs. TestCodexSyncAddsBaseURLToProvider now expects the table added to a hand-made provider that had none. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. In the first full run, internal/gui's TestProvidersAnswerWhileListsComeIn and internal/proc's TestUserPath failed under load; both passed alone and in the second full run.
|
||
|
|
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. |
||
|
|
2880b95b60 |
settings, gateway: the gateway's port is set in Settings › Network › Gateway, and every agent magpie connected moves with it (Magic_zero on Discord: 能否添加自定义端口号 — 3425 is taken on their machine, and they want a port of their own that is easy to remember and tell apart)
Before this, only MAGPIE_ADDR could move the gateway, and the app on a Mac or one started from the Start menu has no easy way to set an env var. The setting: - Settings has a Gateway port field. Any port from 1024 to 65535 can be typed, then applied with Apply or Enter. - The port is saved in settings.json and kept on this computer (KeepOwn), so a backup or WebDAV doesn't carry it across. - MAGPIE_ADDR, where it is set, still comes first. The field is then off and says so. - A port out of range is refused in the page. - A port another program listens on is refused: "port N is in use by another program: pick another one". The gateway stays where it was. - With another magpie serving the gateway, the field says to set the port there. On a change: - The listener moves live (Relisten listens on the new port before closing the old one). - When the old port had been taken by another program and nothing served, the gateway starts on the new one. - Every agent connected to magpie has its config rewritten with the new URL (agent.OnGateway before the move, agent.Rewire after): - each one whose wiring is now "unwired" is set again; - Codex signed in with ChatGPT is joined again and keeps its own model; - Cursor Private Inference's variables and dsh's routes follow. - What each agent had before magpie (the stash) is kept through this. Before, setting an agent again on the old URL would have written magpie's old URL and token over it. - The page says how many agents moved. What follows the saved port (through gateway.Addr()/URL() and settings.GatewayAddr): - the CLI and healthcheck; - Running(); - LAN sharing (Port); - the drift check for the installed magpie, from beside a MAGPIE_ADDR one; - importapps' "is this entry magpie's own" check. zh, ja and de strings. Tests, all failing on the old code: - TestPortMovesEveryAgent: every agent with a config file is connected at 3591 and moved to 3592. No file keeps 3591, and none is off afterwards. - TestPortMovesJoinedCodex. - TestPortLeavesAnUnwiredAgent. - TestPortKeepsWhatAnAgentHadBefore: the relay URL and own token come back on disconnect. - TestDriftInstalledMagpieOnItsPort. - TestSetPortMovesTheGateway, through the API: taken, out of range, moved, the old port silent, POST /api/settings keeps it, MAGPIE_ADDR refused. - TestSetPortServesWhenTheOldOneWasTaken. - TestGatewayURLOnSettingsPort. - gateway-port.test.cjs on WebKit, en and zh: - out of range, taken (translated), applied by Enter, the agents counted, the new URL shown; - the MAGPIE_ADDR state; - no select, no left border, and the page never scrolls (the row is swapped whole, or WebKit laid the list out empty and the view jumped). Sandbox run (own HOME, settings port 3591, magpie web on 3593): - Claude Code (over a relay with its own token) and Codex were connected at 3591. - POST /api/settings/port: - 3594, held by another program: refused, in use; - 80: refused; - 3592: moved [Claude Code, Codex]. - Both configs then say 3592. The gateway answers on 3592 and not on 3591, and `magpie healthcheck` exits 0. - `magpie claude default` gave back https://relay.example and own-token. lan-docker, settings-sections, settings-groups, click-scroll, gateway-caller-keys, gui-ja, gui-de and webdav-settings-refresh pass on WebKit. go vet, the builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. |
||
|
|
165fee0df5 | agent: an agent's own provider named as one of magpie's isn't magpie's, in every agent that spells a model provider/model (the rest of #835) — OpenHanako's own deepseek/deepseek-v4-pro read as magpie's deepseek, and so did a model of any agent's own provider whose name magpie has a provider by: Pi's, Crush's, Hermes's, OpenCode's relay/glm-4.6 with magpie's relay had the row connected on the agent's own model, and Disconnect from magpie put that model back and left the row connected. An agent says how magpie's values are spelled in it (Spelled, replacing #835's Prefixed): magpie/<ref> for Antigravity CLI, Pi, OmO, Aside, Goose, Zed, VS Code, Crush, DeepSeek Harness, Command Code, fx, omp, Hermes, Mister Morph, Kimi Code, Empryo, MiniMax Code, Droid, Qoder, Qoder CN, Grok Build, AtomCode, Cline and OpenHanako, whose every Get spells magpie's so (a sandbox Set of magpie/relay/glm-4.6 read back as that in each); for OpenCode, MiMo Code and OpenChamber also a provider of the config's own that sends to magpie's gateway, as openCodeRef names a model there. A stopped WSL distro's agent keeps its live one's. Left as they are: Claude Code, Claude Desktop, Codex, Gemini CLI, Cursor, Copilot, Devin (magpie's are bare refs there), Muse Code (a model with / is magpie's by design: Meta's have none), Alma (its own are providerId:model), Air (magpie's only). TestOwnProviderNamedAsMagpies (26 agents: own relay/glm-4.6 not connected, Connect, Disconnect puts it back and the row is off) fails on the old code in each; TestOpenCodeGatewayProviderIsMagpies. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
b590edb5ef | agent, gui: Claude Code taken off magpie by Default goes under Not set up and says Default (EZN7L2C3, #834 on v0.1.920) — picking Default and confirming Use default left the row up among the connected ones while it said Not connected, its model read Pick a model and its list had magpie's models alone. Default takes Claude Code's tiers and subagent model out with magpie's endpoint; Apply recorded only the field picked, so those read as changed outside magpie (replaced drift) and the drift kept the row up. Apply now records every field magpie set before that the change moves too. An agent not connected whose list has models of its own (Claude Code's, asked of Anthropic directly) now says what it is on, its Default or its own model, and lists everything as when connected: Default, its own models, magpie's. TestClaudeDefaultLeavesNoDrift (fails on the old code: drift replaced opus; a tier changed outside magpie is still said to be); claude-default-off.test.cjs (WebKit, en and zh: folded under Not set up, switch off, Default shown, Default current with the direct and via-magpie models listed, no scroll; fails on the old code: Pick a model / 选模型). agent-path-same, agent-leave-magpie, claude-picker-fold, claude-direct, agent-start-pick, model-rate, unlisted-models, agent-connect, agent-field-names, pi-default-note, click-scroll, desktop-model-menu, model-pick, favorite-star, agent-disconnect, agent-layout, gui-ja and gui-de pass on WebKit. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
6fb05259d7 | agent: OpenHanako's own provider named as one of magpie's isn't magpie's, so Disconnect from magpie takes it off and the row says Not connected (Hu9956, #835) — OpenHanako spells every model provider/id, its own providers' as magpie's (magpie/<ref>), and a value of its own DeepSeek, deepseek/deepseek-v4-pro, read as magpie's deepseek/deepseek-v4-pro because magpie has a provider of that name. So the row stayed 已接入 on it: Disconnect put back the model the agent had before (its own deepseek/deepseek-v4-pro), took magpie's provider out, and the row still read as connected, on and on. An agent can now say what each of magpie's values in it starts with (Prefixed, magpie/ for OpenHanako); a value without it is the agent's own, never magpie's. TestHanakoOwnProviderNamedAsMagpies (own relay/glm-4.6 with magpie's relay: not wired, Connect, Disconnect puts it back and the row is off) fails on the old code. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
2a4042a94d | perf: magpie opens and shows the Agents page in a fraction of the time it took (Junjie Zhou on Discord: 8 个 agent 30 个 provider … 每次我打开的时候都会很慢,要好几秒。setting 页面秒进后 我切换到 agent 就有问题) — at start, writing the agents' model lists (agent.SyncCatalog) built every provider's catalog thousands of times with nothing held, each build reading migrations.json, settings and groups again: 6000+ file reads and ~8.5s of CPU in the first 8s with the owner's 30-odd providers, all competing with the first /api/state and the Agents page. Now SyncCatalog, magpieModels and main's start-up moves run under provider.Hold, migrations, groups, settings and a provider's fetched models are held for a second like the rest, and filememo.Hold lets a GET /api/* not stat a file it confirmed unchanged within the last second (any magpie write, Changed() or a recent mtime still reads it again). A big ~/.codex/config.toml parsed in quadratic time (the TOML parser's Shape counts newlines from the start for every key): a 3 MB one took 5.4s, now 0.04s (tomlShaper). theInstalled reads through edit.Read's memo. Measured with a copy of the owner's magpie config and agent configs under a sandbox HOME, the real server in WebKit: CPU in the first 8s 8.59s → 0.39s, page up 475 → 75ms, Agents rows drawn 775 → 325ms after start; the agents' written model files are unchanged (pi byte for byte, opencode the same models). TestTOMLShaperMatchesParser, TestTOMLBigFileParsesInLinearTime (fails on the old code), TestHold (filememo), TestHoldReadsMigrationsOnce. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass. | ||
|
|
2dc8e249cb | agent: dsh on a DeepSeek model picked in its own /model stays connected while magpie's route is in its list (Fate on Discord: DSH went back to Not connected) — magpie connects dsh by putting its route among dsh's custom providers and starting it on one of magpie's models; a model of DeepSeek's own picked in dsh is saved in its settings.yaml over the patch list, and the Agents page, which called an agent connected only when its model field was magpie's, showed it Not connected, though the route, its key and magpie's models in dsh's /model were all still there. dsh now has Joined (the first profile's patch list has magpie's route), as Codex signed in with ChatGPT does, so it reads Connected · pick magpie's models with /model, and a pick off magpie while joined isn't drift ("changed outside magpie"). Disconnect in that state has an Unwire that takes the route, the start magpie wrote and the key out of every profile and .env and leaves the model picked in dsh; on one of magpie's models it does nothing and the model set back does it all, as before. TestDshOwnPickStaysConnected (connect, a DeepSeek pick in settings.yaml: wired, no drift; Disconnect: the template as it was, no key, the pick kept) fails on the old code. go vet, builds (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. | ||
|
|
7cc44b68a9 | agent: Codex on a routing group's model name is still connected, not "switched off it outside magpie" (#750, Windows 11, magpie 0.1.812, Codex 0.160.0: Codex set to group/auto-gpt-6-1-sol in magpie, its config.toml then reading model = "gpt-6.1-sol" with openai_base_url still magpie's gateway, and the Agents page kept saying 在 magpie 之外被从 … 切走了 with 重新接入, coming back a while after each reconnect) — the gateway takes a model's name without a provider in it as the group of that model (provider.GroupFor: gpt-6.1-sol is group/auto-gpt-6-1-sol), so Codex's requests still went to the group; but Drift compared the field with what magpie recorded setting (applied.json) by string, and gpt-6.1-sol is neither that nor one of magpie's models by magpieValue (isMagpie wants a provider/model id, and Codex's options list it as its own or not at all), so it read as "replaced". What writes gpt-6.1-sol into config.toml is not magpie (no agent path writes a group's model name; set writes the group id as picked) and wasn't found — the Codex app persisting its thread's model by its own name is the likely one — which is why it came back after each reapply. Drift now passes over a field whose value and magpie's recorded one reach the same routing group, one by the group's id and one by its model's name (sameGroup, groupNamed: a group/… id as it is, "magpie/" taken off, else GroupFor); Codex's internal wired() and Agent.Wired (through a new Agent.Routed hook, Codex's routed(): openai_base_url or magpie as its provider) count the group's model name as magpie's only when magpie set that group on the field and Codex's config still sends its model to the gateway, so a Codex taken off magpie on gpt-6.1-sol is not connected, and a Codex's own gpt-5.5 that happens to have an auto group is no more magpie's than before (failover's base URL is untouched). Disconnect takes the field off the group's model name as it does off the group's id (back to Codex's default), rather than leaving Codex asking OpenAI for gpt-6.1-sol. Another group's model (gpt-6.1) or one no group has (gpt-5.5) is still "replaced". The reporter's ask to say which setting differs: the drift's detail already names it ("model is …, not … as magpie set it", the base URL or provider table for unwired) in the status line's and the Apply again pill's tooltip; that is left as it is. Tests: TestCodexGroupByItsModelName (two providers serving gpt-6.1-sol and gpt-6.1, signed in with ChatGPT and with an API key: group/auto-gpt-6-1-sol set, then config.toml's model rewritten to gpt-6.1-sol — Wired and no drift; no route to magpie — not wired; gpt-6.1 and gpt-5.5 — replaced) and TestCodexGroupByItsModelNameDisconnect fail on the old code (not wired, drift replaced, gpt-6.1-sol and the base URL left after Disconnect) and pass. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried on Windows or with the reporter's Codex and groups; not checked: what in Codex rewrites the model to gpt-6.1-sol. | ||
|
|
b56e1ff931 |
agent: a model picker says which way each model goes, a pick that takes a connected agent off magpie is asked first, and the switch says what it started the agent on (#726, EZN7L2C3 on v0.1.804: with Claude Code connected, Opus 5.5 moved it under 未设置 with 接入 off, Sonnet 5.5 turned it back on, and neither said "via magpie") — the connected Claude Code picker lists Claude Code's own Anthropic models (claudeOwn, direct "Anthropic") under the "Claude Code" header with nothing saying they are not through magpie, and the ones on its own account through magpie fold into "N models via magpie"; the reporter's Opus 5.5 was the own one, and Set with a model not magpie's unroutes Claude Code (unroute puts back the pre-magpie endpoint and token), so Wired() went false and the row folded under Not set up as v0.1.798 does with an agent not on magpie — what was written and the grouping agreed, nothing said why. Not connected, the row's picker lists magpie's models only, and picking one connects first (Agent.Pick), which is why Sonnet 5.5 turned 接入 on; that pop is the narrow one, where "<email> · via magpie" could be cut off at the end (the reporter at 00:56: the 未设置 dropdown did say via magpie).
Now each row in a field that mixes the two carries a tag: "via magpie" (经 magpie) on magpie's, "direct, not via magpie" (直连,不经 magpie) on the agent's own, and "off magpie" (不经 magpie) on Default where picking it takes the agent off; the note no longer ends in "via magpie", so it is said once and never cut. A pick in the field an agent is connected through that takes it from one of magpie's models off magpie — one of its own models, or Default — (leavesMagpie) opens a confirm as the switch's off does (askLeave, the disconnect-ask dialog, Cancel focused): it says what the pick does, that 「接入」 goes off (and the row goes under Not set up when other agents are on magpie), and that running copies take it once reopened. Default's offers Disconnect and restore beside Use default, the two not being the same: Default leaves the agent as installed (magpie's endpoint and models out, its own default model) and neither puts back what it had before magpie nor keeps the models for the next switch-on, which Disconnect does. Confirmed, it is written as before (setPick, the old commit body), Default saying "no longer goes through magpie · on its own default".
Switched on, the status says what model the agent was started on and why: agent.ConnectHow returns a Connection (how: kept, again, joined, magpie, same, alike, default, first; field; value) from the rule Connect follows (reconnect's memory; Codex on ChatGPT joined, its own last pick kept and magpie's models in its /model; else the model it was on through magpie — its own account, a subscription, a key — or its alias family, or with none set its catalog's first; else the first on its own account, the first subscription, the first), POST /api/agents/connect/{id} returns it as state.connected, and app.js says e.g. "Claude Code is connected to magpie · on Claude Sonnet 5.5 through magpie: it had no model set, so the first of its own". Connect is ConnectHow without the answer. New strings have their Chinese.
TestConnectSaysHow (alike for {"model":"opus"}, kept when connected, again after a disconnect, first for a model magpie doesn't serve) and agent-leave-magpie.test.cjs (the tags in a long-noted pop, Opus asked with nothing posted until Use, Cancel leaving it connected, Default's ask offering Disconnect and restore, a pick within magpie's and one connecting an unconnected agent not asked, the switch's how in the status, no click moving the page, en and zh) fail on the old code (ConnectHow undefined; no .badge.path) and pass; claude-picker-fold's note expectations drop "· via magpie" and it checks the tags. go vet, builds (nogui, GOOS=windows, GOOS=linux nogui), go test -tags nogui ./internal/agent ./internal/gui under a temp HOME, and the agent-*, claude-*, click-scroll and show-unset-agent GUI tests in WebKit pass; the rest of the suite fails as on HEAD (cli-update's tight row and others), and Chromium doesn't start in this sandbox. Not tried with the reporter's accounts or in the desktop window.
|
||
|
|
df27f0882a |
agent: the 接入 switch and a model picked in the row, both (owner: 对于那种想在 magpie 中一键设置 Agent 模型的用户能否也兼容一下,鱼和熊掌都要兼得); a row opens in place and slides as on iOS (owner: 展开的时候,上/下 padding 变了,导致抖动;展开和折叠都没有 iOS 那种丝滑优雅精致的动画)
Every agent row keeps its 接入 switch and now has its model picker beside it. Picking a magpie model on an agent that isn't connected connects it first (agent.Pick, used by /api/set), so one pick sets the agent up; disconnecting still puts back what the agent had. The intro line says both ways. An opened row shook: the connected row centred its lines in its 56px min-height, and the 3px row-gap couldn't be folded away, so opening moved the name and the switch and changed the space under them. The first line now has its own height and isn't centred, the row-gap is 0 with the spacing in margins, and the opened part starts where the shut row ended (56/56 at 980px, 90/90 at 560px; the name at 8px and the switch at 19px open and shut). Opening and closing animate the part's height, padding, margin and border on iOS's sheet curve cubic-bezier(.32,.72,0,1), 460 ms open and 340 ms shut, and what's in it fades in from 6px above; a row already open slides shut before another opens. With reduced motion it opens at once. Gemini CLI's .env made by magpie for its key was left holding a newline after a disconnect (main too): DelEnvFile now removes a dotenv file once the deleted keys were all it held. TestPickConnectsFirst, the only.env case in TestEnvFile, agent-start-pick and agent-expand-steady (name and switch unmoved, the opened part's top at the shut row's end, at least 3 heights between on the way open and shut, growing/shrinking only, chromium and webkit at 980 and 560px) fail on the old code and pass. Tests that open rows wait for the slide. In a sandbox HOME with real accounts: Claude Code and Gemini CLI picked while not connected answer PONG and disconnect back to what they had; Goose's pick → disconnect round trip is byte-identical (goose itself stops at a Linear MCP OAuth, so no request). go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui for edit, agent and gui under a temp HOME pass; GUI tests that fail here fail the same on 82340f41 (account-arrange, cli-update, mobile-web, provider-levels-scroll, provider-proxy, redact-rule-row, routing-compact, provider-detect-models, plugin-move). |
||
|
|
42a2b1113a | agent: switched off and on again, an agent is back on the magpie models it was on, and Goose keeps its own model through a round trip — found running connect/disconnect twice for every agent against real configs in a sandbox HOME: turning one on again picked magpie's default instead of what the user had picked (OpenCode's model and small_model, Codex's model and effort, Pi, dsh, Hermes, Grok), and Goose lost GOOSE_PROVIDER/GOOSE_MODEL (its field clears both keys; on main too). Disconnect now stashes what it took off (<id>.reconnect: the values, which were routed through magpie, and what it left), and Connect puts them back when the agent is still as Disconnect left it — models on magpie first, so Gemini's model signs it in before its provider, and a value the model brought along (Codex's effort) is recorded as magpie's; changed since, Connect picks as before. Connect stashes what the agent was on (<id>.connect.was), and Disconnect sets back a field it left empty when that was the user's own (Goose's anthropic/claude-opus-5-5). TestReconnectKeepsTheLastPick, TestGooseRoundTripKeepsItsOwnModel and the new reconnect check in TestGeminiConnectRoundTrip fail on the old code and pass. Sandbox matrix: all 20 agents with a switch connect, disconnect and reconnect twice with the right state, every disconnect preview line is in the real change; 13 CLIs (claude, codex, gemini, opencode, pi, goose, crush, droid, grok, cline, omp, agy, commandcode) answer through the sandbox magpie. | ||
|
|
661d27b560 | agent: the disconnect preview right on Windows, and the Codex panel says what connecting does (owner: 去 Windows 测试机上测一下 / 是不是需要界面上解释一下现在的逻辑) — on the Windows test box Claude Code's and OpenCode's disconnect previews were empty though both were connected. Claude: the dry run's temporary home has no ~/.codex/auth.json, so a codex/… model wasn't magpie's there; the magpie asking now writes the providers it has on into that home and the dry run takes their models as magpie's (TestDryRunKnowsTheAskersProviders). OpenCode: magpie/codex/gpt-6.1-sol, a model its copy of magpie's list didn't have yet, read as not connected and Disconnect left it on magpie; a magpie/… value whose model magpie routes is magpie's (TestOpenCodeOnAModelNotInItsList). The preview pairs a line going back only with one as deep (Claude's model, not a modelPicker row) and doesn't mask …_TOKENS counts. The Codex panel, joined: 「重开 Codex 后,/model 里自己的模型照旧,magpie 的模型也在里面。」, and 新会话默认 says 「和 Codex 的 /model 是同一个选择,在哪边改都行」 rather than 「不设就用 Codex 自己上次的选择」 beside a value (/api/state: joined). On Windows (sandbox USERPROFILE/APPDATA, real accounts): previews for Claude, OpenCode, Codex and Gemini; disconnecting all four restored them (Claude back to opus, Gemini to Google sign-in, Codex keeps its [model_providers.magpie] by design), real ~/.claude untouched; real Claude Code requests via yylx/claude-opus-5-5 and codex/gpt-5.5 answered. The new tests fail on the old code. go vet, builds (darwin, GOOS=linux, GOOS=windows), go test -tags nogui -count=1 ./... under a temp HOME and the 34 agent GUI tests pass but cli-update, menu-scroll and old-webkit, which fail on main too. | ||
|
|
c47fee0b26 |
agents: Codex keeps its own last pick when connected, and every connected line starts 「已接入 ·」 (owner: 让 Codex 记住上次的选择,要统一)
Connecting Codex wrote a start model (it picked stepfun/step-1-32k, a dead one, for a ChatGPT sign-in). Signed in with ChatGPT, Codex now joins magpie by the base URL alone (Agent.Join): openai_base_url to magpie's gateway, magpie's provider table for the threads started on it, CC Switch's tables taken over, the models cache aged — and model untouched, the one last picked in its /model. Agent.Joined keeps it Wired while it is on a model of its own; failover leaves a joined Codex alone; a model of its own picked in magpie keeps it connected; Disconnect leaves Codex on the model it is on rather than the one before connecting. An API key or a provider of its own still connects on one of magpie's models, as its own can't be reached through magpie's provider. The connected line for agents picking in their own list (Codex, OpenCode, …) read 「120 个模型在 OpenCode 的 /models 里」; now 「已接入 · OpenCode 的 /models 里有 120 个模型」, as the others. TestCodexConnectKeepsItsPick fails on the old code (connected on fake/m1). Real Codex in a sandbox HOME with the owner's ChatGPT account: connect left model = "gpt-5.4" (Codex's), wired, no drift; codex exec on gpt-5.5 and on deepseek/deepseek-v4-flash both answered through magpie. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass; agent GUI tests pass but cli-update, menu-scroll and old-webkit, which fail on main too. |
||
|
|
d0d098c69f |
agents: the 「接入」 boards filled in — the opened row as designed, real accounts tried
- The opened row follows the boards: what to do in the agent, running copies with the old list, Claude Code's tiers (each with its own effort beside its model again, #536), the model list by whose models they are with what's hidden, the model new sessions start on, what connecting costs (Gemini's Google sign-in), and the files put back on disconnect, shown line by line. - Disconnecting asks first and shows the lines it puts back. Secrets are masked, and a config of tens of thousands of lines diffs in a fraction of a second. - Connecting prefers the agent's own subscription when magpie serves it (Claude, Codex). - The dry run goes through proc. - Every model hidden still keeps the row connected, with the way back to the list (#356). - Routing groups are named in Chinese. - Phone widths: the pickers and squares wrap inside the opened row, and the name stays beside its logo. GUI tests moved to the new rows: connected fixtures carry refs and open the row from its link. tier-effort and mobile-web each found a real gap and now guard the fix. Tried in a sandbox HOME with the owner's real accounts: - Claude Code: connected, a request answered, and disconnect restored the settings exactly. - OpenCode: a request answered. - Gemini CLI: connected. - Codex: connected. - Model list picks were saved. go vet, builds (darwin, GOOS=windows, GOOS=linux -tags nogui) and go test -tags nogui ./... under a temp HOME pass. The agent GUI tests pass except cli-update's tight-row case, menu-scroll and old-webkit, which fail on main too. |
||
|
|
90d884ee60 | agents: a switch connects an agent to magpie, and its models are picked in the agent (prototype, the owner: 在 agent 页面不应该是为 agent 选择某个模型,而是应该有个「接入」的开关) — agent.Connect sets the agent's main field to one of magpie's models (the one serving the model it is on now, else the first) or to magpie itself for an app whose one setting is magpie as its provider; that writes the provider and the whole catalog, so the agent's own list has every model. POST /api/agents/connect/{id}. Each row with magpie models to offer gets a switch and a line under its name (已接入 · 在 Codex 里用 /model 选 magpie 的模型 / 未接入 · Codex 用它自己的设置); off goes through the existing Disconnect dialog. Claude Code's /model lists only its tiers, so while routed magpie also writes modelPicker (2.1.287) with every magpie model, taken out on disconnect; one the user wrote is left alone. Checked in a sandbox HOME against a fake upstream: Codex 0.160 /model lists and uses magpie's models, OpenCode models, Pi --list-models, Crush's providers, Claude Code /model after connect; disconnect puts Codex back on gpt-5.4/high. | ||
|
|
dfc074afdb |
agents: Disconnect from magpie takes out everything magpie wrote into an agent's config and puts back what it had before (Fate on Discord: 移除由Magpie写入的配置,也就是重置功能,这个好像不是很明显。初步体验好像是选择默认就会清除写入的配置吗?希望能有一个更直接的交互动作,来代表移除由Magpie写入的配置。) — there was no one action for it, and picking Default isn't it: Default is the agent as installed, and for Codex, Claude Code and Gemini CLI it also forgets the stash, so the user's own provider or relay (model_provider + its table, ANTHROPIC_BASE_URL/AUTH_TOKEN, GOOGLE_GEMINI_BASE_URL/GEMINI_API_KEY and sign-in) was lost rather than put back. agent.Disconnect reuses each agent's own restore path: a new Agent.Unwire, for those three, runs the unroute their own-model pick already used (codex.go and claude.go have it pulled out of set as unroute; gemini.go's was there) and then forgets the stash, and every other field magpie set — each one reading a magpie value, or the value applied.json recorded and Unwire left — is set to "" through its own Set, which for every other agent unstashes what it had. applied.json forgets the agent (Keep), so no drift says it was switched off magpie. Agent.Wired (magpie or a magpie model in any field) goes to the GUI as agentJSON.wired; an agent magpie isn't in is left byte for byte. POST /api/agents/disconnect/{id} runs it under edit.Atomically as Sync and the fields' Sets are.
In the GUI, an agent magpie is in has "Disconnect from magpie" (断开 magpie(还原配置)) in its row's menu (its logo, or a right-click; beside Apply again), with a tooltip saying what it does, and in its model picker right under Default, so the two aren't taken for each other; the logo's title says the menu has it. It asks first in the app's own dialog (askDisconnect, as askReset and askForgetSaved do; no native confirm), and the row is then drawn from the answer: the model the agent had, no longer wired, and the status line says so. Every new string has its Chinese. The drag grip stays hover-only; no click moves the page. What it leaves: Codex keeps magpie's [model_providers.magpie] table, as its own-model pick does, for threads started on it; with several ChatGPT accounts in magpie, Codex failover may write openai_base_url again on a later sync. A relay's own ANTHROPIC_MODEL in Claude Code's env was never stashed, so it doesn't come back; modelSettings effort entries for magpie models may stay in settings.json. Tests: TestCodexDisconnect (own provider, own provider signed in, nothing set: the top keys as before, the user's provider table untouched, no subagent model, no catalog file, no stash, not wired, no drift), TestClaudeDisconnect (own relay and nothing set: settings.json as before), TestGeminiDisconnect, TestDisconnectUnwiredLeavesConfig, TestAgentDisconnectAPI; internal/gui/tests/agent-disconnect.test.cjs (WebKit, English and Chinese: only a wired agent has it in the menu and the picker, the in-app dialog, Cancel posts nothing, Disconnect posts and the row shows the old model, no native dialog, the page doesn't move). click-scroll, agent-grip, agent-layout, agent-models, agent-model-groups, model-pick, favorite-star, claude-picker-fold and panel-effort pass under WebKit; menu-scroll fails on /api/plugins/updates unmocked, as it does on main. 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. Not run against a live agent config. |
||
|
|
1ec5495b26 |
agents: omp's roles pick their own models (subagents, smol, slow), keep their thinking level, and get back what they had before magpie (#325)
* agents: omp's subagents and small role pick their own models, through magpie too * agents: omp keeps a role's thinking level and the model it had before magpie, and offers the slow and designer roles A role set to "anthropic/claude-opus-5:max" and switched to a magpie model lost its ":max", and resetting it deleted the key rather than putting the user's model back. The level now goes with the new model (omp clamps one the model lacks, never fails), the model the role had before magpie is stashed and restored, and the reviewer's @slow and the designer's @designer roles are fields beside subagents and small. * gui: omp's slow and designer roles follow the model, as its subagents do Unset, both roles take the session's model, yet the picker offered them omp's Default and no typed model. They are now squares beside subagents, with Same as model first and a model typed in taken as it is. * agents: omp's thinking level no longer hides a role's model from magpie, and the model alone clears it — magpie omp magpie/x/y:high is taken, a role moved back to omp's own is drift, a list of models comes back on reset, and designer (gone in omp 18.1.5) goes A role on "magpie/deepseek/pro:max" matched the picker only through the option offered for its level beside the model, and only for the value in the file now. So the CLI refused a model typed at a level, a recorded value at a level the current one didn't share wasn't known for magpie's (no "replaced" drift), and a level could never be taken away: a model picked without one took the old one on. An agent may now say what it keeps after the model (Agent.SplitSuffix; omp's is its level). Drift, Reseat, RenameProvider, Spell and the CLI's field-for-value match the model and put the suffix back after the one they move to; agents without it are unchanged. The option at the level stays: it keeps the level. Another model keeps it too; the same model picked alone clears it. A role omp falls back through (a YAML list, or the comma list omp joins it into, settings.ts modelRoleValueFromUnknown) read as nothing, so it wasn't stashed and a reset deleted it. It reads as that comma list now, is stashed and comes back; a list has no level of its own. omp 18.1.5 removed the designer role (CHANGELOG), so its field goes. The smol role, like task and slow, gives its agents the session's model when unset; its field is labelled smol, as omp names it, so the GUI can show it as the others without touching other agents' "small". * gui: omp's smol role follows the model as its subagents and slow role do, and designer goes smol unset gives omp's scout and sonic the session's model, so it is a square after the pickers with "Same as model" first, as subagents and slow are (a feather). Its label is smol, not small: OpenCode's, Crush's and OpenChamber's small model stays a picker. designer, a role omp 18.1.5 removed, leaves FOLLOWS_MODEL, the glyphs and i18n. * agents: the note on omp's fallback chains says their keys are roles, and from omp 18 models too ompRefKeys' comment had retry.fallbackChains keyed by model. omp 16.3.5 takes only a role's name there (session/agent-session.ts: "a mapping of role names to selector arrays"); omp 18.4.4 takes a role's name or a model selector (session/retry-fallback-chains.ts). Walking the keys stays: a role's name is no magpie model and is passed over. Follow-up to the review of #340. * agents: omp reads whether it is on magpie one way, and a role at a level that a fallback chain names too is renamed once in each Rebased on #340, one scan over omp's config (ompRefs) answers both questions: magpie's provider stays in models.yml while anything under ompRefKeys is on magpie, as #340 has it, and Check looks at the wiring while any role under modelRoles is, as this PR had it; a fallback chain or enabledModels alone keeps the provider without being checked. A provider renamed moves a role at a thinking level through SplitSuffix first, then RenameRefs the rest, which finds no old name left in the roles: each place moves once, the level kept. * agents: a fallback chain alone on magpie has omp's wiring checked, and a role set off magpie mends it Check now reads the same keys dropMagpie does (ompRefKeys: every role, retry.fallbackChains, enabledModels, task.agentModelOverrides): whatever keeps magpie's provider in models.yml has its baseUrl checked, so a chain on magpie whose wiring something else moved no longer fails its fallback silently. Applying again sets the model role, which may be omp's own; a role set off magpie while something else still names it now writes magpie's provider afresh instead of leaving it as it is, so that mends the wiring. Review of #325. * agents: an omp role that is a list of models stays the user's own, even starting on one of magpie's, and comes back as it was written A role omp falls back through ([magpie/deepseek/flash, openai/gpt-6], or the same as a comma-separated string) was taken for one of magpie's models because it started with magpie/: magpie taking the role over stashed nothing, and a reset deleted it. Only one model, no comma, is magpie's now: SplitSuffix answers whether a value is one model, and Spell, drift (magpieValue), Reseat, RenameProvider and the CLI's fieldForValue leave a list alone. The stash keeps a YAML list as the YAML it was written in (edit.GetYAMLText), and a reset puts it back so, flow or block; a comma-separated string comes back a string. A provider renamed moves the names inside a list through RenameRefs, once, and in the lists the stash keeps too. Review of #325. * gui: a test holds omp's subagents, smol and slow roles as squares that follow the model, and OpenCode's small model a picker omp-roles.test.cjs, in Chromium and WebKit, English and Chinese, API faked: the three roles are squares after the model's picker, unset named "same as model" (「同主模型」) and set naming their model; smol's picker opens on "Same as model" with the model beside it, and a pick sends it and shows it. OpenCode's small model stays a picker. With smol and slow taken out of FOLLOWS_MODEL it fails at "small is a square". Review of #325. * gateway: a Claude Code run whose subagent ended on StructuredOutput is let go, and runs left waiting on tool calls are bounded (#345) — a workflow's subagents end on StructuredOutput, which the client answers itself, so the bridge's claude -p waited 30 minutes for a result that never came, one process per subagent. Such a run now waits 30s (for a schema error the client sends at once) and ends; of other runs waiting 5 minutes or more on their caller's tools, 16 are kept, the longest waiting let go first (one that then gets its results starts anew with the whole conversation). TestClaudeRunEndsAfterStructuredOutput and TestClaudeParkedRunsAreBounded fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. * plugins: a built-in moved onto its plugin looks and works as it did (你确保插件版的订阅 provider 和其对应的内置的…都保持一模一样了吗?) — moved onto its plugin, a built-in lost pieces: its tile's name, icon, plans and risk note went to the plugin's own, "Add account" still opened the built-in's sign-in (in the app, on the server and in `magpie accounts add`), an agent's own sign-in the built-in still found showed a second usage card of the same account, the account's plan badge went, WorkBuddy's daily check-in stopped, the provider's icon and site were the plugin's, WorkBuddy AI's card was named WorkBuddy, and Devin, which had no card of its own, lost the plugin's. Now a moved built-in keeps its tile and risk sheet and signs in through its plugin; its cards take the built-in's place and name, and it has none of its own; the plan the plugin tells stays with the account; WorkBuddy checks in through the plugin, which signs the call; a card is left out only where its built-in's slot showed it. TestMovedBuiltinQuiet, TestWorkBuddyCheckinThroughPlugin, TestMoveToPlugin (Devin-like card) and TestPluginUsage (plan kept) fail without the change. Command Code and Devin moved and back in a sandbox HOME: one card each, plan, name. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; plugin-move, plugin-signin, commandcode-risk, old-webkit pass; click-scroll's WebKit fails the same on origin/main under this load. * provider: the Providers and Gateway pages no longer wait on `claude --version` (deluxe on Discord: on Omarchy the two pages never loaded) — on Omarchy `claude` is a mise wrapper that installs or updates Claude Code before it answers, which on a slow network takes minutes or never ends; magpie asked it with no limit and with a lock held, so /api/providers (fetching the Claude account's models) and every Claude request waited with it. The CLI is now asked in the background, given a minute, and a caller waits at most 3s before the version it has stands in; a late answer is taken once it comes. Reproduced on an Omarchy VM (/api/providers unanswered after 100s on v0.1.516, 3.7s with the change). TestClaudeVersionDoesNotWaitForAStalledCLI and TestClaudeVersionTakenWhenItComes fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. * plugins: a plugin's account behaves as its built-in's (the user: 插件版的订阅 provider 和内置的…保持一模一样了吗) — a plugin's failed sign-in now says why ("the sign-in failed: the sign-in page expired") instead of a bare failure; a plugin account the provider refuses with 401 is marked lapsed, "<user>'s <provider> sign-in has expired — sign in again", beside the account and on its usage card as a built-in's is, and the mark goes when it answers again or is signed in anew; a Devin or Command Code account taken from the agent's CLI moves to the plugin marked as the CLI's and back as the agent's own, so the one it follows stays the one the CLI is signed in to. TestPluginProvider (lapsed), TestMoveSideState (cli) and TestPluginSignIn (reason) fail without the change. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass. * agents: "Hide all" in an agent's model list keeps its line, and an uninstalled Gemini CLI goes from the Agents page (#356, #230) — the line under an agent ("Showing 0 / N models") came only when a picker still listed one of magpie's models, so hiding them all took away the one way back; it now stays while any is hidden. Gemini CLI was taken as present from what it leaves in ~/.gemini (settings.json, .env, installation_id…), which stays after it is uninstalled, so its row stayed, offering to set up a CLI that can't run; it is now its gemini binary. TestAgentModelLineAllHidden and TestGeminiNotAntigravity fail without the change; agent-models-all-hidden.test.cjs (Chromium, WebKit, en/zh) added. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./internal/agent ./internal/gui ./internal/library ./internal/provider pass; agent-models, click-scroll, old-webkit pass. * gateway: Codex's Responses Lite tools reach SuperGrok and every other backend, and a group moves on when a member can't read a request (#350) — Codex sends a Lite model's tools as an additional_tools input item, its own functions in a "functions" namespace; magpie relayed the item to xAI, which 422s on it (unknown item type), and translated routes (Cursor, Anthropic, Chat…) dropped it, so the model had no tools. Outside OpenAI the item's tools now go in tools, the functions namespace opened into plain tools and earlier calls un-namespaced; OpenAI and the ChatGPT account still get Codex's own form. A 400/422 over the request's shape (failed to deserialize, unknown item type/parameter…) now moves to the group's next member, each asked once, the member not resting; the Routing page says so. TestAdditionalToolsRelayed, TestAdditionalToolsTranslated and TestGroupFailsOverARequestShape fail without the change; routing-shape.test.cjs (Chromium, WebKit, en/zh) added. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build, go test -tags nogui ./... pass; click-scroll, old-webkit, routing-wb-refused pass. --------- Co-authored-by: yetone <yetoneful@gmail.com> |
||
|
|
f7e38d0d2e | agents: a magpie on a port of its own (magpie-dev, a sandbox) takes an agent wired to the installed magpie's gateway (127.0.0.1:3425) for that one's, not drift — the two took turns flagging Codex with Apply again, each rewiring it to itself | ||
|
|
a9aeb4d45f | agent(codex): a Codex that couldn't reach magpie says so — the Codex app writes no history.jsonl, so a Codex it started while magpie wasn't running (the gateway refused it, and it built its model list without magpie's) or before magpie set it up (its requests still went to chatgpt.com or an old port) looked fine; magpie now reads the newest model request Codex logged since it was set (logs_*.sqlite, read-only, a day at most) and shows Apply again with the time and why, and to quit and reopen Codex | ||
|
|
1b5d1f87db | agent: every agent on a magpie model says when it was taken off magpie behind its back, not only Codex — each checks what magpie wired into it to reach the gateway (Claude Code's env base URL and token, and a managed-settings base URL that wins over them; Gemini CLI's .env and its auth type; OpenCode, Pi, Crush, Command Code, Hermes, omp and Grok Build's magpie provider; DeepSeek Harness's llm-deepseek entry and its key in .env), and one pointed elsewhere or gone shows Apply again with what is off in its tooltip; Claude Code, like Codex, is also said to be bypassed when it was used and nothing of it reached the gateway (its history.jsonl), and slash commands no longer count as use. A test takes every such agent off the gateway and back | ||
|
|
04302b1e63 | agent(codex): a Codex taken off magpie behind its back says so, with Apply again — something else rewriting config.toml (another switcher, an installer, a profile of its own) left the row showing a magpie model while Codex asked OpenAI for it, and the user blamed magpie; magpie now remembers what it set on each agent (applied.json) and tells three kinds of drift apart: the wiring gone (the provider table, catalog or base URL, or a profile overriding them), a magpie model replaced by one of Codex's own, and a Codex used since with none of its requests reaching the gateway (history.jsonl against when the gateway last saw it — an old process on an old config). A drifted row carries a coral Apply again pill on its name's line (a badge on the logo in the panel), the reason in its tooltip, Keep current settings in the row menu; the window asks /api/drift every 15s, so it shows without a reload |