pkh1585 asked for QwenPaw (AgentScope, github.com/agentscope-ai/QwenPaw)
on Discord. Read in its source, 2.2.2.post1, as data:
- Its folder is QWENPAW_WORKING_DIR, else ~/.copaw when that exists (the
old name), else ~/.qwenpaw; WORKING_DIR/.env is loaded without
overriding the environment. config.json's agents.profiles lists the
agents, each with a workspace_dir whose agent.json holds active_model
{provider_id, model}, read again on each message.
- Providers are no plain config: SECRET_DIR (QWENPAW_SECRET_DIR, else
"<WORKING_DIR>.secret") holds providers/{builtin,custom}/<id>.json,
read once at start. A plain api_key there is encrypted to "ENC:" at
start, so that is the place QwenPaw itself keeps keys.
What magpie does now:
- `magpie qwenpaw <model>` and the GUI: a row per QwenPaw agent
(qwenpaw#<id>, the default one as plain qwenpaw), skipping agents whose
backend is ACP (another CLI runs those) and agents turned off.
- Connecting writes providers/custom/magpie.json (mode 600, the gateway's
/v1 and the magpie-qwenpaw key, magpie's models as extra_models with
their window, output and tool use) and sets that agent's active_model
to {magpie, <provider>/<model>}. The old active_model is stashed as it
was and put back verbatim on disconnect, absent and null included.
The provider file is removed only when no QwenPaw agent still uses it.
- A sync after QwenPaw re-saved the provider (encrypted key, discovered
models, its own defaults) keeps what QwenPaw wrote and changes only
what magpie owns, so a second connect leaves the file as it is.
- The notice says QwenPaw reads providers at start-up: restart it once
after connecting and after magpie's models change. New text in every
locale.
- appdir: QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR take ~/ as QwenPaw's
expanduser does; agentenv clears them in tests.
- README (en, zh), docs/reference.md, agent-wiring.md, the site's agent
list and start pages (en, zh, ja), icon.
Run:
- internal/agent's QwenPaw tests (Connect, AgentsAreRows, SyncKeeps-
WhatQwenPawChanged, Check, NotStartedYet, Folders, OwnModelAfter-
Magpies, SyncAfterQwenPawSaved, NullModelRestored) on mote, and the
all-agent tests (applied, rewire, lan_kept, proxy_kept, spelled) with
a QwenPaw fixture.
- Broken by hand, each red: always rewriting the key
(SyncKeepsWhatQwenPawChanged), removing the provider while another
agent uses it (AgentsAreRows), no backend filter (AgentsAreRows lists
qwenpaw#coder), dropping the keep of QwenPaw's own fields
(SyncAfterQwenPawSaved), IsObject for Exists (NullModelRestored).
- Real QwenPaw 2.2.2.post1 (Python 3.12 via uv) in a sandbox HOME on
the Linux box (WSL magpie-desktop), magpie on 3741, a fake OpenAI
upstream on 3742: first start wrote config.json and agent.json;
`magpie provider add fake …`, `magpie serve`, `magpie qwenpaw
magpie/fake/echo-1`; after a restart QwenPaw encrypted the key (ENC:)
and `qwenpaw agents chat` answered "PAWPAW-OK from the fake upstream",
its log "built agent … model=magpie/fake/echo-1"; the upstream saw
/v1/chat/completions model echo-1 streamed, magpie's usage.jsonl
agent qwenpaw status 200. A second connect and `magpie models` left
the provider file unchanged. `magpie qwenpaw default` took
active_model back out (the only diff in agent.json) and removed the
provider; QwenPaw started clean after.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite on mote (go test -tags nogui -count=1 -timeout 45m ./...)
at 9554883db on d714c4216: 84 packages ok, internal/gui red on
TestSettingsSaveKeepsWhatItDoesNotSend only (SearchAll from
b09349d17, red on main, #4514). Rebased onto 15066f84f (an appdir
change among the four new commits): appdir, agentenv, agent,
filememo, gateway ok again, gui the same #4514 red; vet darwin,
linux and windows of agent, appdir, agentenv ok. Rebased again onto
dd7442f28 (edit, provider and agent changes): edit, provider, agent,
appdir, agentenv ok, vet linux and windows of agent ok. Rebased onto
6a23d9d75 (606743831's registry-following agent variables, which
QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR now follow as agentenv
vars): appdir, edit, agentenv, agent ok, vet linux and windows ok.
Rebased onto 61b536d78 (provider's model lists): agent, appdir ok.
- GUI on mote, the files this reaches (i18n-keys, gui-de, gui-ja,
gui-zh-tw, agent-connect, agent-layout, agent-notice-lang, brand,
builtins, desktop-lang, header-relang, icon-tile, icon-url):
Chromium 103/104, WebKit 59/60, the one red each gui-ja's ja for
removing an agent's only account (a7b47d57e, #4580). The whole GUI
suite wasn't run: mote had three other sessions' whole GUI suites
running (load ~130) and WSL one more.
Not tried: Windows, the macOS desktop app, QwenPaw in WSL wired from
Windows magpie, the ACP backend, QwenPaw's web console after connecting,
a real legacy ~/.copaw.
davisjiahao (#1985): Claude Code pointed by hand at a proxy in front of
magpie, magpie's key kept (a company's nginx, or a compliance proxy on
this machine every request must go through), is kept there once magpie
has answered at the proxy (surelyMagpie). That answer comes from a probe
a read starts in the background and never waits for, and every write to
Claude Code reads routed() first: in a magpie just started, the CLI's,
the first write found no answer yet and took the proxy for a relay of
the user's own. surelyMagpie's comment says a write waits for the
answer; none did. Codex's account failover does (codexProxyOK).
From the CLI, with the proxy (relay.py, answering GET / as magpie's
gateway does) taking 0.3s or 1.5s to answer, as one across a VPN can;
the same on 40b5c2da and on d970371e (#3480):
magpie claude fakeco/fake-3: ANTHROPIC_BASE_URL went from the proxy
(http://127.0.0.1:<port>/corp-relay) to magpie's own
127.0.0.1:<port>, and the haiku tier the user gave fakeco/fake-2
went to fake-3
magpie provider add …, whose sync rewrites Claude Code's lists: the
CLAUDE_CODE_AUTO_MODE_SERVER=0 magpie wrote went
magpie claude haiku fakeco/fake-3: "pick a model through magpie for
Claude Code first; haiku can then have its own"
magpie claude default (Disconnect): said "disconnected from magpie,
back to what it had before" and left the proxy, magpie's key and
magpie's tiers (fake-1 on all four) in, so its "opus" still named
fakeco/fake-1 through magpie; the endpoint and key the user had
before magpie (https://own.example/api, sk-own-user) were gone from
the stash
With the proxy answering at once, the probe a read started came back
first, and all of these held. magpie web's start held in my runs too
(0s and 1.5s first starts, a 1.5s restart): its sync runs after the
catalog's fetch and the vendors' lists (FetchNew).
Now every write to Claude Code (each field's Set, Sync, Unwire) asks
first (claudeAsk): where claudeProxied would ask the address (proxyBase,
not the gateway's own address, claudeKeyed) and magpie hasn't answered
there yet, magpieAsked asks it now and waits (probedNow, the probe's 3s
timeout). An answer had before, at any age, is what the write goes by,
as the reads do. Follow is left as it is: it writes nothing until
routed, and runs again as the Agents page is drawn. Reads still never
wait (TestReverseProxyTriedFirst).
Before and after, for a write while ANTHROPIC_BASE_URL is such an
address and magpie hasn't answered there in this process:
before: taken as a relay, as above
after: the address is asked (GET /) and the write waits for the
answer, then goes as it does with the answer in: a proxy to magpie
kept, a relay pointed away from
Not changed: an address sent a key of the user's own is never asked
(#3480); the reads; a write once the answer is in.
Cost: the first write of a process waits for one GET / at such an
address. The read before it has usually asked already, in the
background; this doesn't wait for that probe but asks again, as
codexProxyOK does (the proxy got 2 GET / where it got 1). A proxy that
doesn't answer holds that write up to the probe's 3s.
Left as it is: what Apply and Disconnect read before the write (was,
before) still sees the address unasked. After the CLI's Disconnect
behind the proxy at 1.5s, the record for reconnecting
(claude.reconnect) kept the model alone, without the haiku tier the
user gave fakeco/fake-2 in magpie, which the same Disconnect on
magpie's own address keeps.
TestClaudeFirstWriteAsksTheProxy: an nginx and a local proxy, magpie
just started, nothing asked yet (coldMagpie): a pick, a Sync, a tier,
Disconnect. With claudeAsk asking nothing, all 8 are red, each on what
it is there for (the pick wrote http://127.0.0.1:3425 over the proxy
and haiku went to fake/m3; the sync took out the review; "pick a model
through magpie for Claude Code first"; Disconnect left the proxy with
"magpie" and magpie's haiku tier). With Unwire's ask alone taken out,
the two Disconnects are red.
Verified at 57ae956b: the runs above, after, at 0.3s and 1.5s: every
case held, and Disconnect put back https://own.example/api and
sk-own-user with nothing of magpie's left. Both hand breaks as above.
go test -race -count=3 of the proxy, Codex proxy, review and sign-in
tests: ok. The agent package with magpieProbe made to panic: no test
reached it. gofmt clean; go vet ./internal/agent/ for linux, darwin and
windows: exit 0. go test ./...: 63 packages ok, 7 red with this box's
own reds alone: the proc.Look tick tests (#3141:
TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
TestOmpDetectedWithPiDir, TestZedAppPath), the Reasonix fixture builds
(a /tmp/.git that isn't magpie's), graftcp's
(TestCallbackGoesPastTheAgentsProxy,
TestClaudeToolCallbackOnANonLoopbackAddress,
TestGatewayHeldByAContainer, TestGatewayFixQuitsOnlyAMagpie), umask
077's (TestWriteAtomicReadOnlyHardLink, TestProgram/first) and Bun
1.3.11's (TestBunProxyLoginWithReservedCharacters, #3397).
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
zhangt2333 (#3480): magpie sent GET / (Go-http-client/1.1) about every
30s to the ANTHROPIC_BASE_URL in ~/.claude/settings.json of a Claude
Code it never connected, with nothing shown and nothing to turn it off.
Every read of Claude Code the Agents page makes (/api/state, /api/drift
each 15s) goes through routed(), which asked a base URL that can be
another way to magpie (proxyBase: an address on another machine, or one
on loopback with a path of its own) whether it answers as magpie, for
#1985's reverse proxy, whatever key Claude Code sends there. One read
pass asked it about 65 times; the probe cache sends that as one GET once
its answer is older than 20s (reachAge), every 30s on the page's poll.
The address is now asked only while what Claude Code sends is for magpie
(claudeProxied, claudeKeyed): a key the gateway takes (keyHolds, as
Check already asks of ANTHROPIC_AUTH_TOKEN), or none where it keeps its
claude.ai sign-in through magpie (claude.login, on a Claude Code magpie
wired, wired_at, which Disconnect forgets, where the gateway takes any
key). With a key of the user's own, the base URL is their endpoint, and
nothing asks it: the reads (routed), a pick (gwAt), Check (its managed
settings' and settings.json's URL), and a request's stand-ins
(claudeStandInAt, now given the place, and claudeClassifierIn), a WSL
distro's Claude Code's too. Check says such a Claude Code's address as
it is, unasked (whatsOff: wiringOff's words, without its probe; an
administrator's in managed settings too): with a model named as one of
magpie's there, as a relay can name its own, "Claude Code's
ANTHROPIC_BASE_URL (settings.json) is <its endpoint>, not magpie's
gateway at <the gateway>", or "is gone" with none, which main said of
it too once the address had answered as not magpie. #1985's proxy keeps
magpie's key, so it is asked and kept as before.
The key, not a record of what magpie wrote: wired_at is from 10-08
(#1218), so a Claude Code connected before it and not picked since has
none, and a Claude Code magpie wired and then moved to a relay of the
user's own (CC Switch, its own key) would still have that relay asked.
The claude.ai sign-in can lean on it: it came with it (#1218), and its
setting, on a routed Claude Code only, stamps it.
Before and after, for a read, a pick or a request's stand-in while
ANTHROPIC_BASE_URL is not the gateway's and proxyBase takes it:
before: GET <base>/ in the background, at most every 20s
after: the same while Claude Code sends a key the gateway takes or
keeps its claude.ai sign-in through magpie; otherwise never, and the
address is not magpie's
Changed with it: a Claude Code pointed by hand at a proxy to magpie with
a key of its own, drift on main too (its key "was changed"; now its
address), is no longer taken as routed there, so a pick writes magpie's
address and key, keeping its own for Disconnect, where it kept the
proxy.
Not changed: the other agents ask an address only from magpie's own
entry in their config, or once on one of magpie's models (T3 Code's
wired, Gemini CLI's isMagpie(model), Hermes's onMagpie and
providers.magpie, dsh's usesMagpie), so none asks one of the user's own.
A Claude Code magpie wired keeping its claude.ai sign-in, then moved by
hand to an endpoint of the user's own with an ANTHROPIC_API_KEY alone
and not disconnected, is still asked, as before: magpie reads no
ANTHROPIC_API_KEY of Claude Code's.
Cost: a never-connected Claude Code with its own key at such an address,
the case this reaches: a read pass took 5.5 to 6.0ms on origin/main and
9.4 to 9.8ms with this (three runs each, taking turns, 200 passes, at
load 46 to 50; the key's read and access.Authenticate at ~65 calls a
pass), on the 15s drift poll. A connected Claude Code (the gateway's
address) and one on Anthropic's own endpoint (no base URL) never get
there.
docs/subsystems/agent-wiring.md (Drift) says it.
What was run (tree c7f75f7a, on origin/main 74dcf40a, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
magpie web --no-open, built -tags nogui from origin/main and from
this, each in a sandbox HOME of its own (env -i), with a settings.json
on a local relay that logs what it gets
(http://127.0.0.1:<port>/corp-relay, a key of its own) and listens
before magpie starts, /api/drift read every 5s:
model opus, 120s: main, GET /corp-relay/ (Go-http-client/1.1) every
20s from the first read, 6 in all; this, none. Neither touched
settings.json.
model fakeco/fake-1 (a provider magpie has), 60s: main, 3 GETs;
this, none. Both said "Claude Code's ANTHROPIC_BASE_URL
(settings.json) is http://127.0.0.1:<port>/corp-relay, not magpie's
gateway at http://127.0.0.1:<port>" from the first read.
Run once more with magpie up before the relay listened: main 5 GETs
and 2, its first ask made before then, this none, the rest the
same.
magpie claude fakeco/fake-1, then its ANTHROPIC_BASE_URL moved by hand
to the relay answering GET / as magpie, magpie's key kept, 60s: both
asked it every 20s, 3 GETs, no drift. Both wrote settings.json again
at start with every key and value the same (a label's "·", which the
hand edit had escaped, now as is). Run once more with magpie up
before the relay listened: both drifted "… is <the relay>, not
magpie's gateway …" on the first read and took
CLAUDE_CODE_AUTO_MODE_SERVER out of settings.json, then asked it
every 20s with no drift, the address kept; main does it the same, not
this change.
TestClaudeOwnEndpointNeverAsked (nginx: its own key in
ANTHROPIC_AUTH_TOKEN; local: in ANTHROPIC_API_KEY) and
TestWSLClaudeOwnEndpointNeverAsked: pass. Broken by hand, each red:
claudeProxied without claudeKeyed: "never connected: asked
[https://relay.example/anthropichttps://relay.example/anthropic …]"
(and the WSL test)
Check's addresses asked whatever the key (keyed true): "a model of
magpie's name: asked [https://relay.example/anthropic]"
Check's address unsaid without magpie's key: "its own key, a model
of magpie's name: … ANTHROPIC_AUTH_TOKEN (settings.json) was
changed, so magpie's gateway won't take its requests" (nginx), "… is
gone, so Claude Code sends magpie its claude.ai sign-in …" (local)
the administrator's address asked whatever the key: "its own key, an
administrator's proxy: … ANTHROPIC_BASE_URL (settings.json) is
https://relay.example/anthropic, not magpie's gateway …"
claudeStandInAt, then claudeClassifierIn, on surelyMagpie alone:
"never connected: asked [https://relay.example/anthropic]" (and the
WSL test)
claudeKeyed with no claude.ai branch: "the claude.ai sign-in at the
proxy: drift … ANTHROPIC_BASE_URL (settings.json) is <the proxy>,
not magpie's gateway …" (and the WSL test)
its claude.ai branch without wired_at: local only, "asked after
Disconnect: [https://relay.example/anthropic …]"
its claude.ai branch on this machine's stash keys: the WSL test
alone, the same as with no claude.ai branch
agent-wiring.md's reverse proxy checks (TestReverseProxy…,
TestClaudeBehindLocalProxyKeepsIt, …), Drift, the sign-in's and
TestKeptAddress: ok, but for TestWSLColdPlaceOpensNothing (e54a7d50,
#3896: a stopped distro's rows read none of its files), red at
origin/main and with this change alike (#3924): the same eight looks
under .hermes/profiles, none under .claude
gofmt -l of every .go file: nothing. GOOS=linux, windows and darwin
go vet -tags nogui ./..., GOOS=windows go vet ./...: exit 0.
GOOS=linux and darwin go build -tags nogui ./..., GOOS=windows go
build ./...: exit 0. Untagged linux vet and build stop at pkg-config
(no libsoup-3.0 or gio-unix-2.0 here)
full suite, go test -tags nogui -count=1 -timeout 45m ./... (8m19s,
load 42 at its start, Bun 1.4.2 on PATH): 68 packages ok, reds in 8:
internal/agent TestInstalledVersion,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir (#3141); the two Reasonix tests (#3641);
TestCodexDriftReached (#3398); TestWSLColdPlaceOpensNothing (#3924,
above)
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram, umask 077 (#3640)
internal/gateway TestPluginToldWhereTheAgentWorks (#3675)
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie (#3649)
internal/proc TestEnvOfChild (#3906)
internal/provider: "fatal error: close of synctest channel from
outside bubble" in TestUnreadLoginsWriteErrorsKeepCredentials
(#3632), which ends the package's run
internal/tui TestTUIFetchesSubscriptionModels/agent (#3919)
On origin/main 1a804859, where #3924's fix is in, with this commit
cherry-picked (a scratch worktree, not this tree): go test
./internal/agent has the reds 1a804859 has alone, #3141's, #3398's
and #3641's, and TestWSLColdPlaceOpensNothing passes.
TestCopilotFolderFromAnIDEPluginIsNotTheCLI, TestInstalledVersion and
TestZedAppPath come and go here: -count=5, 12 of 15 red with this
and 11 of 15 at 1a804859.
Not tried: macOS, Windows, a real WSL distro (its Claude Code's stash
keys are only tested), Claude Code itself sending through the relay, a
company's real proxy.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
codexReached keeps its read of Codex's log while the database and its
-wal keep their size and modification time (84210ae7, #1665), for up to
reachedFor (15s). Both tests insert a request into logs_2.sqlite and ask
Drift at once, three or four times over. Two inserts inside one tick of
the file system's clock leave that stamp as it was, so Drift answers
from the read taken before the second insert. On this Linux box (ext4
under /tmp), 317 of 400 back-to-back inserts left a rollback-journal
database's size and time unchanged; in WAL mode 156 of 400 did, once
the -wal had wrapped and was written over in place. Codex's own
logs_2.sqlite here is WAL, with a -wal that stays at 4.4 MB.
On b437e4ad, -count=60 of the two tests:
TestCodexDriftReached red 11 times
applied_test.go:280: elsewhere: &{Kind:bypassed ... Detail:Codex couldn't reach magpie at 09:46 — magpie wasn't running then, ...} (5)
applied_test.go:284: reached magpie: &{Kind:bypassed ... Detail:Codex's last request (09:46) went to chatgpt.com, not magpie — ...} (6)
TestCodexBehindReverseProxy red 2 times
proxy_kept_test.go:293: to chatgpt.com: <nil>
Both tests are older than the memo; before it, each ask opened the log.
These tests are about what Drift says of each kind of request. When the
log is read again is TestCodexReachedReadsLogOnlyWhenItChanged's to
test. So each request they log now drops the kept read
(forgetReached), and the next ask reads the log.
What was run (tree d5c248e9, on b437e4ad):
the tick injected: after each insert, the database's time set back
to what it was before the insert (os.Chtimes), so every insert keeps
the stamp. -count=20 of both tests:
without this change: both red 20 of 20, at the elsewhere check
(applied_test.go:280) and the to chatgpt.com one
(proxy_kept_test.go:293)
with it: ok
-count=200 of TestCodexDriftReached, TestCodexBehindReverseProxy and
TestCodexReachedReadsLogOnlyWhenItChanged: ok
broken by hand, with this change:
codexReachedRead never records a refusal:
applied_test.go:277: refused: <nil>
applied.go's went-elsewhere case off:
applied_test.go:281: elsewhere: <nil>
proxy_kept_test.go:294: to chatgpt.com: <nil>
gofmt -l internal/agent: nothing
GOOS=linux, darwin, windows go vet -tags nogui ./internal/agent: exit 0
full suite, go test -tags nogui -count=1 -timeout 45m ./... (481s):
62 packages ok, the two tests above with them. 14 reds in 7
packages, none in a file this change touches, each red on b437e4ad
without it:
internal/agent TestInstalledVersion, TestHowInstalled,
TestOmpDetectedWithPiDir, TestCopilotFolderFromAnIDEPluginIsNotTheCLI
and TestZedAppPath: proc.Look keeps "not found" for a tool written
in the tick of its folder's last change (#3141). Alone on b437e4ad,
-count=10: TestHowInstalled red 3 times, TestZedAppPath 7.
internal/agent TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: their fixture build under
/tmp meets a /tmp/.git that isn't a repository of this user's
("error obtaining VCS status: exit status 128").
internal/claudebridge TestCallbackGoesPastTheAgentsProxy,
internal/gateway TestClaudeToolCallbackOnANonLoopbackAddress,
internal/gui TestGatewayHeldByAContainer and
TestGatewayFixQuitsOnlyAMagpie: the processes this run started had
their outgoing connections sent through a proxy (graftcp).
internal/edit TestWriteAtomicReadOnlyHardLink and internal/testenv
TestProgram: umask 077 here; the fixtures' own modes go through it
(0444 is written as 0400).
internal/netproxy TestBunProxyLoginWithReservedCharacters: Bun
1.3.11 on PATH names port 80 in the request line (#3397).
Not changed:
- The memo. In the app, a request Codex logs inside the tick of
magpie's last read (a connect and its refusal one after the other)
can reach Drift up to reachedFor late, which the memo allows for
already. A settle window like filememo's or codex_list_tag's would
see it at once, at the cost of a read per ask just after each of
Codex's writes, the reads #1665 took out.
- The fixtures' journal mode. A WAL fixture would pass these tests
only while its -wal grows, which stops once it wraps.
Landed by yetone in a batch of Coffemon's patches from the issues.
What was run, go1.26.8, on origin/main cc81ad4ea, then again at
70a0c387c (gofmt, the three vets, the changed tests, umask 077):
- mote (macOS 27): gofmt -l clean; go vet, GOOS=linux go vet -tags
nogui and GOOS=windows go vet ./...: ok. edit and testenv at umask
077; agent, provider, library and gateway with an empty .git above
TMPDIR; davsync, imagemcp, plugin, library, edit, testenv whole; the
changed tests in agent, provider, gateway and gui; the timing tests
-count=10 (gateway, davsync, imagemcp) and -count=5 (agent): all ok.
TestCoreScriptBudget ok: core 1,536,751 of 1,537,034, app.js
1,312,975 of 1,315,316, no budget raised.
- Red on the old code: on origin/main, TestWriteAtomicReadOnlyHardLink
at umask 077 and two Reasonix tests under an empty .git; on Linux
(wsl-run) TestProgram at umask 077 with the old program.go. With
each fix's code taken back to main's, the Gemini imageConfig tests,
TestPluginToldWhereTheAgentWorks, TestSkillRepoTraced,
TestTaggedHooksAlone, TestMainURL/TestMainView and update-auto,
plugin-github-hooks, plugins-more-discover, plugin-namesake were
red. Broken by hand: claudeKeyed always true (both
OwnEndpointNeverAsked tests red), claudeAsk a no-op
(TestClaudeFirstWriteAsksTheProxy red), GitAt taking any .git folder
(the three TestGitOnDisk tests red).
- GUI: 123 files (plugins*, update-*, panel/tray/start/context, i18n,
gui-zh-tw/ja/de and every file that evals app.js parts) in WebKit on
Linux (wsl-run). 11 files had reds (click-scroll, panel-fold,
plugin-card-update, plugin-github, plugin-move*, segs-glide,
tray-totals, update-*), and run again side by side they fail the
same on origin/main d80d75f30 (79 pass, 26 fail here; 78 and 27
there). They are click-scroll guards ("the click must not scroll
the page"), varying by language from run to run (#4385).
copilot-ghe's route-after-close red is #1949, seen on main 244d80e23
too. In Chromium on mote, Chromium segfaulted partway through files
(#4125): context-map, context-scroll-end and context-tune fail the
same on origin/main 0911a65e7, so the batch's own files
(plugin-namesake, update-auto, plugins-more-discover,
plugin-github-hooks) ran in Chromium on Linux: 62 of 62.
- Full suite (go test -tags nogui -count=1 -timeout 45m ./..., mote)
at 472a0608f (on 70a0c387c): every package ok but internal/gateway,
whose five reds were #4362's (Antigravity turned-away and
TestCodexSpentGrokFailingIsTold), fixed on main in d80d75f30. After
the rebase on 244d80e23 the five pass, and gofmt, the three vets
and the targeted runs above were run again: ok. In Linux the
sign-in, copilot, plugin-github*, plugins-more-discover,
plugin-namesake, plugin-gateway, update-auto, quota-refresh-order
and i18n files ran in both engines: 475 pass, 4 fail (copilot-ghe
#1949, plugin-github's click scroll, both red on main too).
- Rebased again on c7171a256, over its budget fix e94bf7a08: gofmt, vet of
gui, gateway, provider and plugin, TestCoreScriptBudget (core
1,536,265 of 1,536,586 with the batch's last commit, statusTErr and settingsErr), the Gemini,
GitOnDisk and plugin tests, and in Linux both engines i18n-keys,
update-mirror, plugin-namesake, plugins-more-discover,
plugin-github-hooks and update-auto (138 of 138): ok.
Not tried: the whole GUI suite (mote's WebKit wouldn't launch and its
Chromium segfaulted, #4125); macOS WebKit; the real app's window.
ffd077869 took the issue's nginx example (https://ai.corp.example/magpie)
and left loopback out as "magpie on an older port". The reporter's follow-up
on #1985 is the real case: a company-mandated compliance proxy at
http://127.0.0.1:8788/claude-code-anthropic/<route> in front of
127.0.0.1:3425, which every Claude Code request must go through. On
ffd077869 that was still "unwired", Reconnect and a pick wrote 3425 back
(bypassing the proxy), and the sync did too.
- reach.go: proxyBase also takes a loopback address with a path of its own
(loopbackWithPath). The gateway's own address, and so an older port's,
has none, so port moves still move those. surelyMagpie: magpie has
answered there (not merely untried), for writes.
- keptaway.go: the sync keeps such a route where magpie answered or hasn't
been asked; one where something else answered follows the gateway.
- claude.go: routed() and the written ANTHROPIC_BASE_URL (gwAt) keep a
proxy where magpie answered, so a model picked in magpie keeps the
proxy and a tier's own model; before the answer, or at a relay, a pick
points Claude Code at this magpie as before. claudeStandInAt too.
- codex.go: codexKeptGateway keeps a loopback route as well.
Run (sandbox HOME, worktree at origin/main + this):
- go test -tags nogui ./internal/agent: ok (471s).
- TestReverseProxyIsStillMagpie now runs every agent at the nginx address
and at the reporter's local route; TestClaudeBehindLocalProxyKeepsIt is
the reporter's case: no drift, a pick keeps the URL and a tier's own
model, the sync keeps it, a relay there is told and a pick re-points.
- Broke by hand, each red: proxyBase without loopback (claude,
claude-desktop... unwired), keptAway's loopback branch (every file back
on 127.0.0.1:3591), gwAt (pick wrote 127.0.0.1:3425), routed (haiku's
own model went), codexKeptGateway without loopback.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
Not tried: the reporter's real proxy daemon; other agents' picks still
point at this magpie (the sync and Reconnect keep the proxy for them).
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 12ecb6d8e.
Before the rebase only TestFolderVarsAreListed failed, fixed on main by
c6de0d2a5.
- New proxy_kept_test.go: every agent behind the proxy has no Check/
unwired drift, at a relay all but Codex are told, SyncCatalog keeps
https://ai.corp.example/magpie with its path in every file; Claude
managed settings; unknown-then-not-magpie; loopback not probed; the
real probe against httptest serving the gateway's handler under
/magpie/; Codex https kept address, Reached and lastSeen; signed-in
Codex via openai_base_url; awayPath table.
- Broke each fix by hand, each went red: wiringOff (claude, claude-desktop,
gemini, opencode... told), claude managed, reasonix, awayPath (every
synced file lost /magpie), bypassed host and lastSeen, unknown-as-drift,
codexKeptGateway http-only/no-path, viaBase.
- gofmt -l; go vet darwin, GOOS=linux -tags nogui, GOOS=windows.
Not tried: a real nginx (Host rewriting, auth in front of GET /), the
Windows box, a real CC Switch. No GUI change.