27ca0bef535dc280652e81bc2a6311dffcd21161
1036
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a7072926d6 |
agent: connecting Kiro Crew connects the harness it is set to (wuping9525)
wuping9525 (Discord, Windows): Kiro Crew's Agent Harness was Claude Code,
Claude Code was installed but not connected to magpie, and turning Kiro
Crew on refused with "connect Codex, Claude Code, ... first". On a Mac it
worked only because a harness (Codex/Claude Code) was already connected;
Crew's home is found the same way on Windows (USERPROFILE\.kiro\crew).
Now, when agent.acp_backend names one of magpie's harnesses (codex,
claude, opencode, pi, goose) and that agent is installed but not
connected, connecting Kiro Crew connects it in the same action and runs
Crew on it; the notice says so. The stash's kirocrew.joined records it.
Kiro Crew's Disconnect disconnects that agent again only if magpie
connected it and the user hasn't disconnected it since (kiroCrewUserLeft
in Agent.Disconnect); a disconnect the user made before stays recorded as
theirs. A failed Crew write undoes the join. config.local.json pins,
kas/kiro/deepseek and harnesses not installed behave as before.
Windows: the adapter search also tries npm's .cmd/.exe/.bat shim names,
and the app is detected by ~\.kirocrew-app\.venv\Scripts\kirocrew.exe.
New notice translated in zh, zh-TW, ja, de; docs/subsystems/agent-wiring.md
and docs/reference.md updated.
Run (macOS, sandbox HOME, GOMODCACHE/GOCACHE pinned), at base 11c3fbb19;
after rebasing on
|
||
|
|
56900e4845 |
agent: Claude Desktop on magpie gets the MCP servers the user added signed in (aa86222 on Discord)
aa86222 on Discord: Claude Desktop on magpie's gateway (3p mode) didn't sync its connectors. Two parts: - A claude.ai account's connectors can't reach 3p mode. Desktop calls them through claude.ai with the signed-in account (/api/organizations/<org>/mcp/servers/<id>/tools/call in Desktop 2.7032's main bundle, refused with no_active_org without an account), and 3p mode has none. Anthropic's 3p docs say "Made by Anthropic" connectors are only in standard Desktop; others reach 3p through managedMcpServers or plugins (claude.com/docs/third-party/claude-desktop/extensions). magpie doesn't answer or pass any of these: they never go to the inference gateway. - What magpie can do: 3p mode reads its MCP servers from Claude-3p/claude_desktop_config.json, a file of its own, so the servers added signed in (Settings -> Developer, in Claude/claude_desktop_config.json) were gone from the list. Switching on now copies each mcpServers entry Claude-3p has none of the same name for (desktopCarryMCP). One already there (the user's, or the Library's, which writes both files) stays. Sync does it once for a Desktop already on magpie (stash mark claude-desktop.mcp-seen), so a server the user takes out in 3p isn't brought back. Off takes back each copy still as copied (stash claude-desktop.mcp); one the user changed stays. Claude's own file is never written. Run, at this tree: - go test -count=1 -timeout 45m ./internal/agent ./internal/library ./internal/desktopdir: ok - gofmt -l internal/agent: clean; go vet ./internal/agent for darwin, GOOS=linux and GOOS=windows: ok - the built binary in a sandbox HOME (macOS): `magpie claude-desktop provider magpie` copied a filesystem server into Claude-3p's claude_desktop_config.json with Claude's file byte for byte; `provider ""` removed Claude-3p again, Claude's file unchanged. Broken by hand: desktopCarryMCP returning at once turns TestClaudeDesktopCarriesTheMCPServers, TestClaudeDesktopMCPKeepsThe3pServers and TestClaudeDesktopSyncCarriesTheMCPServersOnce red; desktopUncarryMCP returning at once turns the first two red (off left the copies); Sync carrying on every run turns the third red. Not tried: a real Claude Desktop reading the carried servers in 3p mode (it reads ~/Library, so the sandbox can't host it, and the live one is not touched); Windows and Linux folders (same code path through desktopSets); the reporter's own connectors, which weren't described beyond "can't sync" and are most likely claude.ai ones, which this cannot bring. |
||
|
|
4e5b2ad81c |
gateway: another magpie added by hand rests only the model it refused
lagrangepoint1813 on Discord: Pi on a magpie whose provider is another
computer's magpie got "Remote Magpie: Claude Code: You've hit your
session limit" for every model of it, whichever Pi was switched to.
remoteModelRest rests such a refusal by model (restID) only for the
Remote magpie preset; that magpie was added as an OpenAI-compatible
provider of the user's own name (preset null in providers.json, the
reporter found), so the 429 rested the whole key
(restKey) and quotaHeld answered every model of it from that rest for
the five hours it named. A magpie's reply names the provider that
answered or held it (X-Magpie-Provider), as no vendor's does: keepRetry now notes it as
answeredThereHeader (this magpie writes its own provider into the same
header of its reply, so it can't be read there; the note is kept from
the client), and remoteModelRest reads a refusal carrying it as another
magpie's model's, whatever the provider was added as. A quotaHeld or
verifyHeld answer now names its member too (noteMember), as an asked
one does, so a refusal the other magpie held is read the same. The
key's own limit there (remoteKeyLimitHeader) still rests it whole.
TestAnotherMagpieAddedByHandRestsTheModel (two gateways over HTTP; the
other magpie asking Claude Code, and already holding it): both subtests
red on the old code with the reporter's message, green with this
change; -count=3 with TestRemoteMagpie* and Verify* green. Broken by
hand: reading X-Magpie-Provider straight from the reply header rested
by model everywhere (TestOwnQuotaRest, TestVerifyRefusalRestsTheLastOne,
TestAntigravityQuotaStillRests, TestCodexCompactCutSummaryFailsOver,
TestOpenRouterFreeAccountRateLimitKeepsProviderRest went red, the header
being this magpie's own); without noteMember on the held answer the
held-there subtest stays red.
Run at this head (on origin/main
|
||
|
|
7c2f27ccdf |
gateway: a strict conversation keeps its member past a reply that broke off
imwhatiam123 on Discord: a routing group of Qoder CN and WorkBuddy AI set to Stays: Strict moved a session to WorkBuddy AI. A reply that broke off after its 200 (#733, common from a plugin-served provider) called unanswered, which forgot the stick, so the agent's retry was routed as a new conversation (why "first", kept null) from the top of the order. Strict promises the conversation never moves to another account, member or key, its failure going to the agent: the stick is now kept under strict, so the retry goes back to the same member, fails there while it fails, and goes on there once it answers. The member still rests for new conversations as before. Every other mode forgets the stick as before. TestStrictGroupKeepsItsMemberPastABrokenReply: red on the old code (the retry went to second), green with this change. Run at this head (on origin/main |
||
|
|
a1174674da |
codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").
- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
that asks for a bare model, with nothing set for it (no magpie
subagent model, no [agents] default_subagent_model, no [memories]
extract/consolidation_model in Codex's config), goes on the model its
conversation's own turns go on (parent thread, own thread, else the
key's last turn), when that is a magpie model the key may use. A task
the ChatGPT backend sealed stays on ChatGPT. The trace shows a
subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
codexcat writes each magpie entry's own id as its
auto_review_model_override. Not the default: codex-auto-review runs
free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
follows the session. app.js stays under its budget by folding five
identical writingPrefs then/catch chains into prefWrite.
Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
./internal/settings ./internal/cli ./internal/gui: ok.
./internal/provider: FAIL with "close of synctest channel from outside
bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
go red with codexFollowTo returning "" (broken by hand).
TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
codex-predictions, codex-descriptions, settings-general, agent-prefs,
i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.
Again after rebasing on origin/main
|
||
|
|
49f15d1244 |
masking: a record names the provider the request went to, not the group's first member (Max You and Linka on Discord)
Linka on Discord: Insights › Masking's records said WorkBuddy AI, the
first member of their auto group, for requests that Codex in the same
group had answered. Max You: providers no route sends to show up under
Privacy all the same.
Cause: serve() recorded the masking (noteMasked) as the route began,
with p.ID, the first planned provider, before any try. A request the
first member failed, or a member resting or unable to serve, went on
to the next, and the record (on disk, and counted into the flow and
the provider filter) kept the first. Embeddings recorded tries[0] and
video the same way.
Fix: maskrec.Hold keeps a record in memory at once (the route's badge
and the answer's Restored need its key) and writes it to disk only
when done is told the provider and model of the last try.
noteMaskedUntil wraps it, and serve, embeddings and video call done
in a defer with call.Provider and the model tried last. A request
that never reached a try keeps the planned one, as before. Since a
long request's line is now written after later ones, List sorts each
day's lines by key, so paging with before skips nothing.
Old records keep the name they were written with; there is no record
of which member had them. They leave with the 30 days.
Tests:
- TestMaskedRecordNamesTheProviderThatHadIt (gateway): a group a/m,
b/m, a answers 500, b 200, with Mask secrets on; chat and
embeddings. On the old code both subtests fail:
masked_sent_test.go:96: recorded on "a", the request went to b
- TestHoldNamesWhoHadIt (maskrec): the held record goes on disk with
done's provider and model, done's second call counts for nothing,
Sum counts that provider, and List pages a late-written record in
key order. With the sort taken out it fails on the first page.
Run at this tree (base
|
||
|
|
ef0a03e137 |
otel: Langfuse is set up from its host and the project's two keys
A user on X asked for Langfuse built in. magpie could already export to Langfuse over OTLP, but Settings › Observability had the user type the endpoint .../api/public/otel and a percent-encoded Authorization=Basic%20<base64(pk:sk)> header by hand. Settings › Observability now has a Collector row: OTLP or Langfuse. With Langfuse, the user picks the host (Cloud EU, Cloud US, or Self-hosted with an address, which also covers Langfuse's JP and HIPAA regions) and fills in the public and secret keys. Once both keys are there, magpie saves: - the endpoint <host>/api/public/otel; - Authorization: Basic base64(pk:sk), in otel.headers as before, so the secret is stored where it was and a backup without keys leaves it out; - on a first setup, also x-langfuse-ingestion-version: 4, metrics off and export on. langfuse.com/docs/opentelemetry/get-started (read 10-26) gives the same header for every region and for self-hosted, and says that without it OTLP data can arrive up to 10 minutes late. A Langfuse endpoint set up by hand opens in this view with its keys decoded into the fields. Opening it saves nothing. Changing a key or the host keeps the user's other headers, their metrics and export choices, and an ingestion header they set or left out. Switching from another collector leaves that collector's headers behind and does not send them to Langfuse. The Observability page moved from app.js into the otel plugin (assets/plugins/otel/page.js, with i18n.js for its words, in Client), because app.js had 13 bytes of budget left. The app.js and core budgets are lowered to what is left (1,321,319 and 1,537,645; app.js is 1,321,313 after rebasing on |
||
|
|
fed0055da8 |
plugin: a plugin stuck on its vendor no longer holds up the plugins loaded or listed with it
shualaitianduai on Discord: a plugin whose sign-in kept failing (401)
held up the plugins behind it. host.js loaded the plugins one after
another and answered init only when all were in, so a plugin function
that never returned held every other plugin until init's two-minute
deadline failed the whole host. providers() listed the providers one
after another too, so one stuck models hook held the whole list past
refreshDeadline (30s), and every provider's list went stale.
Now loadPlugins loads every plugin side by side, each given
pluginLoadWait (20s) for its import and plugin function, and each
config hook as long; one still loading is told as not loaded ("the
plugin's load didn't finish in 20s") and init answers with the rest.
Hooks are kept in the list's order, as before. providers() lists every
provider side by side and gives each models hook pluginListWait (20s,
inside refreshDeadline): one that hasn't answered is listed as fallen
back with that as its listError, so magpie keeps the list it had, and
that answer isn't kept for requests (keepInfo). Documented in
docs/subsystems/provider-plugins.md.
Run at this head (base origin/main
|
||
|
|
a1e91e5002 |
davsync: S3's If-Match/If-None-Match go outside the signature, so a kept ETag no longer turns a working key into 403 (CyberCaius on Discord)
CyberCaius on Discord: S3 backup works, then every sync fails with
"the S3 server refused the access key ID or secret (HTTP 403
SignatureDoesNotMatch)", and edits to the S3 settings "won't save".
The keys work in other S3 clients, and switching to WebDAV and back
to S3 fixes it until the next time.
Cause: the SigV4 signer signs every header on the request, and
7ab91961d's conditional requests added If-None-Match (GET, the ETag
kept in sync-state.json) and If-Match (PUT). SigV4 needs only host
and x-amz-* signed. A server, or a proxy in front of it, that checks
the signature over a condition as it reads it back rather than as it
arrived refuses a signed one with SignatureDoesNotMatch. The first
sync has no ETag kept, so it passes; from the second on every sync is
conditional and refused. WebDAV and back changes stateKey, so the
state starts again with no ETag and one sync works. "Won't save" is
the same 403: /api/davsync/save writes the settings and then syncs,
and the form stays open with the sync's error.
Fix: sendTo signs every header except if-*, and sets the conditions
after signing. The docs page says so.
Test: TestS3ConditionsOutsideTheSignature, where the fake S3 rereads
an If-* header without its quotes before checking the signature. It
syncs three times, saves a second provider and syncs again, and
checks that the conditional GET and PUT reached the server.
On the old s3.go it fails with the reporter's text:
s3_test.go:612: sync 2: the S3 server refused the access key ID or
secret (HTTP 403 SignatureDoesNotMatch)
Run at this head (base
|
||
|
|
e5dd86965b |
pii: the masking model's requests take turns without holding the status, Stop or a restart (#3682)
After a restart, with Settings → Privacy's local model on, every request
queued for minutes on srv.mu in classify. That lock was held across
start() (up to 3m loading) and the model's answer (30s and more), and
Now(), Stop() and the idle timer took it too. The user saw a 504
"held this request for 2m0s without routing it to any provider".
Now:
- pf-serve's requests take turns through a one-slot channel (`turn`),
so writes on its one pipe never interleave. srv.mu only guards state.
Now() never waits: it reports Loading and how many are Waiting. Stop()
never waits either: it kills a pf-serve that is loading or answering,
and the request on it fails with errStopped (no retry). Fetch's
upgrade stops pf-serve only once its turn is free (stopWhenFree).
- A request waits for its turn under its own context (FindContext). The
gateway passes the request's context through a new gwmw.ContextTeller,
so a client that went away, or a request the gateway answered 504,
leaves the queue. A turn already begun still finishes and caches.
- What Find learned is kept on disk (found-<model sha>.bin, beside the
model): a text's sha256 and its spans' offsets and labels, never the
text. Written via temp-and-rename. A bad, cut-short or over-long file
is read as empty, and a cached span that doesn't fit its text is
asked again. A restart no longer asks about every history again.
- A request waiting for its turn reads the cache again when it gets it,
so requests queued with the same history ask the model once.
- The guarantee stays: a request the model can't mask is held back, never
sent masked by the rules alone. A wait that ends panics inside
gwmw.Safely, as a failed model did, and the request fails closed.
- The 504 for a request held while masking says it waited for the local
masking model, what the model was doing (loading, or masking another
request with N waiting), that what it read is kept, and that the model
can be turned off in Settings → Privacy (unroutedMsg).
Tests (each red on the fix broken by hand, in the sandbox HOME):
- TestStatusAndStopDontWaitForARequest / ...ForALoad: red with Now()
taking the turn (Now waited), and the suite hung with Stop() taking it.
- TestWaiterLeavesWhenItsContextEnds: red with the waiter ignoring ctx.
- TestQueuedRequestReadsWhatTheOneAheadLearned: red without the re-read.
- TestRestartReadsWhatWasFound: red with loadCache a no-op. It also
checks the file never holds the text.
- TestBadCacheFileIsReadAsEmpty: red with a cut-short file's entries kept.
- TestCachedSpanOutsideItsTextIsAskedAgain: red without the fits check.
- gateway TestHeldForTheMaskingModelSaysSo: red with the masker handed
context.Background() (the wait never let go), without noteMasking, and
with the old message. TestUnroutedMsgNamesTheModelOnlyWhenItIsOn: red
with the old message.
- TestMaskingOnAndOff's panicky fixture embeds masking.Masker, which now
has the Context methods. It panics on those too, and still refuses.
Run at this head (base origin/main
|
||
|
|
13f9c7fca1 |
claude bridge: a caller elsewhere is told its environment is where the tools run
vv_nil on X: a Mac Claude Code through a Linux gateway's Claude subscription gets Claude Code's own prompt from the gateway's run, which names Linux and a temp folder, beside the caller's, which names the Mac and its project. The model spent extra tool calls finding out whether its environment had changed. A run that can't work in the caller's folder (the folder isn't on this computer, or Claude Code is in WSL) now has envElsewhereNote after the caller's instructions: the environment they describe is where every tool runs, and goes before one given earlier. Every tool of a run is the caller's, so that is true. The note names no app or vendor. A run in the caller's own folder, a lean run and a caller naming no folder are told nothing more. clientWorkDir is split so clientNamedWorkDir gives the folder named, wherever it is. Run: go test ./internal/gateway -run 'Claude|Bridge|Subscription|Lean|Vendor|Prompt' (ok, 49s), go vet for linux and windows, gofmt -l. TestClaudeCallersWorkDirElsewhereIsNotUsed now checks the note in both runs for a folder not here, a relative one and a Windows path, and not for no folder; TestClaudeRunsInTheCallersWorkDir checks a run in the caller's folder isn't told it. With envElsewhere forced false by hand the first is red (0 of 2 runs). Not tried: a real Claude Code run from a Mac client through a Linux gateway, so how many tool calls it saves is not measured. |
||
|
|
c2c88e85e9 |
redact: a date in the last year or ahead is not a birthday
JackyCcao on X: under Mask personal data the birthday rule took the day
the agent ran on, 2026-10-24, for a birthday in 122 requests. dateOK now
takes a date after 生日/DOB/born for a birthday only when it is over a
year before today (dateClock, held in the test). A date in the last year
or ahead is a run date, a deadline or a log's; a baby's birthday in a
prompt is far rarer than those. Older dates are masked as before.
Run: go test ./internal/redact (also TZ=UTC and TZ=Pacific/Kiritimati),
go vet for darwin, linux and windows, gofmt -l. TestBirthdayNotRecent
holds today at 2026-10-24 (today, yesterday, a year less a day, ahead,
each format) and then reads the real clock; with the year check taken
out by hand it is red ("生日:2026-10-27" masked). The GUI's
redact-kinds test only toggles the category and is unchanged.
Docs: gateway-routing.md and masking.html (en, zh, ja).
Not tried: the reporter's own request text (the screenshot shows only
the masked date), so which words were before it is not known.
|
||
|
|
7499ebb5ef |
gateway: magpie goroutines answers ahead of the locks a stuck request holds
Two users on X (v0.1.1549 to v0.1.1557, Windows, Codex routing) see /api/hello answer while /v1/models, Providers and agent requests hang. `magpie goroutines` ( |
||
|
|
3b717d5e0d |
affinity: a Claude Code subagent's answer no longer moves its lead off its account's cache
Claude Code sends its session's id (x-claude-code-session-id) with every
request of the session, its subagents' too; only x-claude-code-agent-id
says a request is a subagent's. Affinity kept one stick per scope and
session, so a subagent on the lead's model wrote its own answer over the
lead's stick. The lead's next turn was then judged by the subagent's cache
("no-cache" for a small one, "cold" for a 5-minute write past five
minutes) or kept wherever the subagent had gone, and with two Claude
accounts it moved to the other one: a new Claude Code there was told the
whole conversation and Anthropic wrote it all to that account's cache
again, at the 1-hour write price (slkassinthehood on X: two Pro accounts'
5 hours spent in ten minutes, ~318k tokens a request).
stickKey keeps a subagent's stick apart, by its agent id. The lead's key
is the session's, as before: sticks on disk are found after the upgrade,
and Codex's leadFirst, which reads a lead's stick by its thread id, is
unchanged. strictKeep reads the same key.
Run, at this commit's tree (base
|
||
|
|
5214d5114f |
claude: a run on a new account's first turn keeps its tool results
On the first request on a newly seen Claude sign-in, claude auth status
has no email yet, so the account is named from its plan ("Claude Max").
The bridged run's Claude Code then writes the profile, the account is
named by its email, and the turn's tool results came under another owner:
"tool results account changed", the run let go, and a new one told the
whole conversation (~8k more cache writes). Seen in a real run as
"claude\x00Claude Max\x00own" -> "claude\x00<email>\x00own".
- provider: Account.Unnamed marks the placeholder name;
ClaudeOwnName gives the own sign-in's name once it has one.
- gateway: the run's owner is an atomic pointer (owned()); an own,
unnamed owner ends in "\x00unnamed". takeNamedOwner lets such a run go
on as the same provider's own sign-in, named; every other owner change
still lets the run go. A turn that ends without a tool call takes the
name before its keys are made (nameOwner), so the next turn finds the
idle run.
- docs/subsystems/claude-subscription-bridge.md says so.
Run:
- TestClaudeToolResultsKeepTheSelectedAccount gains "named since" (kept)
and "unnamed, another account" (let go);
TestClaudeRunTakesOnlyItsOwnSignInsName; TestClaudeIdleRunKeptUnder-
ItsOwnSignInsName (named since / still unnamed); provider asserts
Unnamed on the plan-named account and not on an email-named one.
Broken by hand: without takeNamedOwner in serveSubscription "named
since" goes red (a new run replies); renaming any own owner goes red
(a@ -> b@ taken); without nameOwner the idle case goes red; with
unnamed never set the provider test goes red.
- Real run: sandbox HOME, dev build of this tree on 127.0.0.1:3741, the
owner's Claude Max sign-in with .claude.json and logins.json removed
first (auth status: no email), a real Claude Code 2.1.310 client in a
sandbox config asked to write, wc and read pelican.html. One Claude
Code pid for the whole turn, the log says the run "goes on as" the
email, no "account changed" line. Before this change the same setup
logged the owner change and "tool results account changed".
- gofmt; go vet darwin, linux -tags nogui, windows for gateway and
provider; go test ./internal/gateway ok 392.7s; go test
./internal/provider ok 89.3s with -skip TestUnreadLoginsWriteErrors-
KeepCredentials, which crashes the package on main alone (#3632,
filememo synctest, not this change).
- Full suite at this tree (
|
||
|
|
680b505687 |
claude: a run works in the caller's own folder, not magpie's temp folder
The bridged Claude Code told its model "Primary working directory:
<tmp>/magpie-claude-work-501", against the folder the client's own prompt
names. Under a real Claude Code client the model wrote pelican.html into
magpie's temp folder, through the client's tools, which run in the
client's folder.
startRun now runs Claude Code in the folder the caller names
(clientWorkDir): the last one in the system prompt or a non-assistant
message, as Claude Code ("Primary working directory:"), Codex (<cwd>),
OpenCode ("Working directory:") and pi ("Current working directory:")
write it, when it is an absolute path to a folder here. Otherwise (a caller
elsewhere, a WSL Claude Code, no folder named) the shared folder as before.
The caller's project's sessions are never swept; a run's session is still
removed by its id. CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 keeps the
repository's status out of the prompt (setting sources and auto memory
were off already). The text sent upstream is unchanged apart from the
folder Claude Code reports itself.
Run:
- TestClaudeRunsInTheCallersWorkDir (Claude Code, Codex, OpenCode, pi,
named twice) and TestClaudeCallersWorkDirElsewhereIsNotUsed (missing,
relative, Windows path, none): red on the old code (the runs used the
shared folder). Broken by hand: sweeping the caller's folder goes red
("were swept"); dropping the env var goes red ("repository's status").
- Real run: sandbox HOME, dev build of this tree serving 127.0.0.1:3741 on
the owner's Claude Max sign-in (keychain linked in, login copies deleted
after), a client Claude Code 2.1.310 with its own CLAUDE_CONFIG_DIR,
ANTHROPIC_BASE_URL at the sandbox, run in $SB/wm and asked to write
pelican.html: it landed in $SB/wm; nothing new in magpie-claude-work-501
(its only pelican.html is the capture's, from before).
- go test ./internal/gateway at the staged tree (checkout-index), gofmt,
go vet; the full suite run is recorded in the next commit, at the pushed
head.
Not tried: a Windows client (a Windows path falls back, by the test), a
Claude Code in WSL (falls back by code).
|
||
|
|
a60493ab60 |
gateway: Codex run by Claude Code's Codex plugin is counted as Codex, not Claude Code
wyztony on X: "claude通过/codex skill时,用量不会记录codex的记录".
OpenAI's Codex plugin for Claude Code (codex-plugin-cc 1.0.6,
/codex:rescue and /codex:review) runs `codex app-server` with clientInfo
named "Claude Code". Codex 0.162.1 then sends "originator: Claude Code"
and "User-Agent: Claude Code/0.162.1 (...) (Claude Code; 1.0.6)", so
agentOf read every such turn as Claude Code's ("claude") and the Usage
page showed none of them under Codex.
agentOf now takes a "Claude Code" name back to Codex when the request
carries Codex's own turn headers (x-codex-window-id or
x-codex-turn-metadata), which Claude Code itself (claude-cli/...) never
sends. An app running Codex as its own engine under its own name (Lody)
keeps its name, as TestFromCodex already holds. fromCodex is unchanged,
so nothing sent upstream changes. Every path keyed on agentOf
(Codex subagent pick, spawn_agent models, drawing route, Codex backend
records, titles, search, active sessions, callerOf) follows.
Run:
- TestCodexPluginForClaudeCodeIsCodex: red on the old code with the
check turned off by hand ("plugin task: recorded as \"Claude\", want
\"codex\""), green with it. Cases: the plugin's captured headers,
originator only, claude-cli, the name without Codex's turn headers,
Lody with them.
- Real use in a sandbox HOME: codex-cli 0.162.1 wired to a sandbox
`magpie serve` on a fake Responses upstream, driven by the plugin's own
codex-companion.mjs (db52e28). Before: task and review rows were
"agent":"claude". After: both "agent":"codex". Plain `codex exec` (a
skill-folder /codex skill) was already "codex" through the gateway and
read from its rollout when direct.
- gofmt; go vet darwin, linux, windows.
- Full suite (go test ./... -timeout 45m, one suite on the machine) was
started at this tree and was still running at push; per the owner's
ship-at-once rule, a red it finds goes in its own commit.
Not changed, outside magpie: with Codex not routed through magpie,
/codex:review runs an ephemeral thread and Codex writes no rollout, so
there is nothing on disk for magpie to read; /codex:rescue writes one
and was already counted as Codex. Past rows stay under Claude Code.
|
||
|
|
41b0445ccf |
provider: a local server's address is a field shown first, and address= on the command line (LM Studio on another computer)
mengxiangziyou on X: "供应商里的LM Studio只能用本地的,怎么用局域网里其他机器 上的LM Studio, baseUrl 不能改". Moving a local preset (Ollama, LM Studio, oMLX, MLX-Serve) to another host has worked since #1165, but the window put the Address in a "Server address" fold under the key, while the Endpoints row showed http://localhost:1234/v1 as plain text. Reproduced in a sandbox: Add > LM Studio shows the URL and nothing to change it with unless the small fold is found. - GUI: the Server address field is shown first, above the key, never folded, for a new provider and a saved one alike (its label and hint are the strings the fold used, so no new i18n keys). Saving still sends the URLs moved only when the address was changed. - CLI: `magpie provider add|set <id> address=<host:port>` moves every URL the provider has (chat, Anthropic, Responses, decision), each keeping its path; from the preset's when it was saved with none, and `address=` alone puts a local server back at its preset's. A provider of the user's own moves its own URLs. Vertex refuses it as it does url=. Before, Ollama on another computer needed url= and anthropic=. - TUI: unchanged (asked on adding, `w` after). - docs/subsystems/providers-accounts.md: Local servers row. Security: only upstream URLs move. The gateway's own loopback/origin guards are about inbound requests and don't read them; the one rule that looks at an upstream being on the LAN (Unredacted) stays the user's own switch. Run at this tree (origin/main |
||
|
|
5be7d05d28 |
agent: Desktop on magpie offers its own import of the signed-in sessions (lambdua on X)
lambdua on X: "claude Code桌面端支持么? 我桌面端切换账号,对话都能全都不见".
Nothing is lost. Desktop on magpie runs in 3p mode, whose userData is
Claude-3p, a folder apart from Claude/. Desktop 2.7032 keys Code and
Cowork sessions by account and org (claude-code-sessions/<acct>/<org>):
in 1p the claude.ai login's, in 3p the install id in ant-did and a fixed
org. So the sessions made signed in stay in Claude/ untouched and show
again when Desktop is switched back; claude.ai chats are on Anthropic's
servers. magpie's on/off never writes or removes a session (desktopOff
removes only what magpie made, and only when empty).
Desktop has its own importer (Settings -> Import: the signed-in userData,
other Claude* folders, ~/.claude/projects; copies under new ids, originals
left), but in 3p only when the profile's claudeAiImport.enabled is true
(3p-only policy, default off, since 1.28929.0). magpie's profile now gets
"claudeAiImport":{"enabled":true,"bannerBehavior":"detect"} once per
folder set (desktopSeedImport, stash mark claude-desktop.import): on the
switch on, and from Sync at magpie's start for a Desktop already on
magpie. A claudeAiImport already there is kept; one the user removes is
not written back (the mark is read, never unstashed).
Run (suite at origin/main
|
||
|
|
07936ca890 |
gateway: a turn held before routing shows on Routing and is answered 504 after 2m
heyusaku6 on X: Codex desktop thought for over ten minutes on a model served through magpie (a routing group's DeepSeek, then Qoder CN's MiniMax, then GPT-6.1 Sol), the Routing page showed none of them, and only restarting Codex and magpie ended it. Codex waits for a reply's headers with no limit of its own, and a request shows on the Routing page only once a route is begun for it, so whatever held these requests held them before routing, in silence. The root cause was not found. Every pre-route wait read (the classifier, image description, plugin GatewayBegin, JS middleware, provider.Hold, the body read, pluginrt.Refresh, the trace lock) has a bound or follows the request's context. So this makes the stall visible and bounded instead, and records where it was held: - counted watches an agent's turn (Chat, Responses, Messages, Gemini generateContent, Codex backend /responses) while no route is begun for it (unrouted.go). After 15s a route of provider "magpie" shows it on the Routing page as routing; it gives way to the request's own route when one begins (noteRoute, trace.drop). - After 2m with no route and nothing written, the client is answered 504 in its own protocol, whole (Content-Length, Connection: close) so it has the error even if the handler stays stuck. The request's context ends with errUnrouted, its route ends with the error, and the log gets every goroutine's stack (at most once in 10 minutes), which says what held it next time. - The handler writes through heldWriter, which drops its writes once magpie has answered for it. A request waiting on another request's identical image description for over 2m is now answered 504 too; the retry finds the description cached. Run in the worktree at origin/main |
||
|
|
5df62c5cda |
pii: pf-serve is pf-v2, which holds the model once on a GPU (#3590)
pf-v2 is 642d430ec's pf-serve (weights-once.patch): on Metal and Vulkan the GGUF is read straight into the device's buffer instead of also kept whole in a CPU copy. serveSHA pins pf-v2's five zips, each checked against the release's SHA256SUMS. A user who turned the model on before has pf-v1 on disk, in a folder named for its tag. pf-v1 now still counts as installed and is run (oldTags), and starting it fetches pf-v2 in the background (upgrade): once fetched, the running pf-v1 is ended so the next request starts pf-v2, and pf-v1's folder is deleted. One that can't be fetched leaves pf-v1 running and is tried on the next start. A fresh download fetches pf-v2 and deletes an old tag's folder. Run: - go test ./internal/pii ./internal/redact (ok), -run TestLoopGuard ./internal/gateway and -run Privacy ./internal/gui (ok, the doc and the settings route); go build; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/pii; gofmt -l clean. - TestOldServeRunsUntilUpgraded and TestUpgradeThatFailsKeepsTheOld are red with `go upgrade()` taken out of start (not upgraded / never tried) and with binDir looking at serveTag alone (the old pf-serve not taken for installed). - Real: a sandbox cache with the released pf-v1 darwin-arm64 and the real model, pii.Find through it: pf-v1 answered, pf-v2 was fetched from the real release, pf-v1's folder deleted, the next request started pf-v2 (ps shows its path), 1664 MB phys_footprint idle. - pf-v2's released darwin-arm64 probed alone: 1680 MB idle (pf-v1 4777 MB), spans identical to pf-v1's; load ~1 s both, alternated 3 times. Not tried: the upgrade on Windows, where the old folder can only be deleted after its pf-serve ends (upgrade ends it first; a folder left is deleted on a later start). |
||
|
|
642180a809 |
redact: Insights › Masking and Try it mark a made-up key as a placeholder (#3599)
With "Keep a key's form" on ( |
||
|
|
758be6d14e |
library: magpie-setup is first in the market's skills, so an agent can set magpie up as asked
Leyuu_5 on X: "功能越来越多,感觉可以来个skill让AI来帮设置需求了". The skill
lives in magpie-community/plugins (skills/magpie-setup, e513644) and
teaches an agent to turn a request into magpie's own commands. Listing
it in featuredSkills puts it first under Library › Market › Skills,
official, one click to add, with no setup.
What was run at this head:
- go test ./internal/library ./internal/cli: ok (library's first run
failed only with "no space left on device" while writing testlog.txt;
run again on its own: ok 193.7s)
- TestFeaturedSkills extended: magpie-setup first, quota second, both
Official/Featured with a description; "setup", "routing" and
"gateway key" find magpie-setup first, "quota" finds magpie-quota
and not setup. Red with magpie-setup taken out of the list.
- gofmt -l internal/: empty; go vet (darwin), GOOS=linux go vet -tags
nogui, GOOS=windows go vet on internal/library and internal/cli; go build
- library.InstallMarketSkill("magpie-community/plugins", "magpie-setup")
in a sandbox HOME against the pushed plugins repo: Installed
[magpie-setup], SKILL.md in library/skills/magpie-setup.
Not run: the full ./... suite (the disk had under 1GB free), the GUI
suite (no GUI asset changed; market-featured-skill.test.cjs fakes the
list).
|
||
|
|
30d3001a04 |
gui: a wheel or coast macOS 13's WebKit never tells the page of still scrolls the view (issenn on Discord)
issenn, on macOS 13.7.8 (system WebKit 18615, Safari 16.6's): no page of the window scrolls by trackpad or mouse wheel, the bar doesn't move, a forced trackpad scroll shakes and snaps back, and only dragging the bar works. Cause (hedged, not seen on a real WebKit 16.6): the view guard puts back every .view scroll outside a window the reader's own events open (wheel, touch, keys, scrollOnPurpose). The bar's drag goes past it (barDrag), which is why that alone works. WebKit 16.x can scroll a view under a wheel or a coast it never dispatches to the page (WebKit bug 256582, Safari 16.4.1: monitorEvents(window) showed no wheel over some elements). With no wheel heard, no window opens, and every reader scroll is taken as code's and put back. That is the shake, and the v0.1.1488 coast chain couldn't help, since it starts from a heard wheel. Fix, in puttingBack: three put-backs on one view in one direction within a second, with no click holding (held), are the reader's. They are given back, and the fling window opens. Each later put-back the same way within a second of the last is given back at once. So a wheel turned slowly, or one run broken on a loaded Mac, loses no step. A scroll by code happens once and makes no run: two at rest are still put back, and scrolls a click holds against still are. On a WebKit that does dispatch the wheel, nothing changes: the wheel opens the window first and nothing is put back. To stay under appScriptBudget with no raise, the guard header's click bullet was shortened, and its detail moved to gui-shell.md. Test: view-wheel-unheard.test.cjs (Chromium and WebKit, en and zh). A capture listener stops every wheel before app.js hears it. Then: - ten fast 20px wheels must move the view 190px or more; - five notches 400ms apart must land, down and back up; - six wheels up must bring it back; - two code scrolls at rest are still put back; - after a click on an agent row, a code scroll each frame leaves the row in place. Run: - At origin/main |
||
|
|
b30734f964 |
sessions: Antigravity CLI (agy) conversations are listed, with title, folder, tokens and resume (RickyWei, #1718)
agy's conversations were on no Sessions page: internal/sessions had no lister for them, only the calls reader of #2097. Now each ~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript_full.jsonl is a session (agy.go). Its steps give the start and last times, the first prompt (taken out of agy's <USER_REQUEST> wrapper), prompts, replies, tool calls, and tokens under the model "agy", since no step names one. A step written again replaces its tokens, read on or read whole. The title and folder come from the conversation's conversation_summaries.db row: title, and workspace_uris through agyFolder, which turns file:///C:/... and file:///c%3A/... into C:\... and a host into \\host\share on Windows. agy writes the title after the transcript, so the row is the file's rev. The database is read again only when it or its -wal changed, and a failed read keeps the rows read before. A row with conversations/<id>.db and no transcript (#1718's case) is listed from the row alone, with no tokens and no conversation to open. Resume is "agy --conversation <id>". When agy is set to use magpie, it is the agent's launch command (gateway variables and --model, the PowerShell form on Windows) with --conversation after it, through sessions.AgyStart, which package agent sets. The transcript (user text, thinking, text, tool calls, tool results) can be opened and searched. Format read from real files: agy 1.3.5 and 1.4.7 in a sandbox HOME against a fake Gemini endpoint, with plain replies, a read_file tool call with thinking, invalid tool calls, and a conversation picked up again with --conversation from another folder. testdata/agy-sessions is three of those conversations with paths rewritten to /work. Resume tried for real in the sandbox: `agy --conversation <id> -p again` from another folder appended steps 2-4 to the same transcript and kept the row's folder. Interactive `agy --conversation <id>` (in tmux) showed the earlier turns. Run at this tree, rebased on origin/main: - gofmt -l internal clean - go vet: darwin; GOOS=linux -tags nogui; GOOS=windows - GOOS=windows go build ./...; GOOS=linux go build -tags nogui ./... - go test -count=1 ./internal/sessions ./internal/gui ./internal/agent: ok before the row-only change. After it, sessions ok, and gui had one red, TestMainWindowCorners killed at its 40s deadline at load ~300 (#1936). It passes alone (47s). - GUI (playwright 1.62.0, chromium and webkit, en and zh): i18n-keys, gui-de, gui-ja, gui-zh-tw, session-terminal, sessions-bar-names, sessions-manage, sessions-talk, sessions-toolbar: 49 of 49. No GUI asset changed. Tab names come from the agent registry. Fails without the change (broken by hand, each one red): - agyFiles out of allFiles: TestAgySessions, TestAgyTitleLater, TestAgyTranscript - agy out of refresh's DBRevision check: TestAgyTitleLater - no dropUse of a rewritten step: TestAgyGrows (4510 input, want 3010) - AgyStart ignored: TestAgySessions (wired resume) - drive letter not handled: TestAgyFolder - agy out of HasTranscript: TestAgySessions, TestAgyTranscript - the row-only listing off: TestAgyRowOnly; readable() off: TestAgyRowOnly Not tried: agy on Windows. The Windows box (10.0.0.132) didn't answer ssh, so the Windows paths are covered by unit tests only (agyFolder, the Set-Location resume form). A wired resume through magpie's real gateway was not tried. Not done: subagents (parent_conversation_id), which I never saw agy write. The model name, which is only in conversations/<id>.db's protobuf (#3147). Deleting an agy session from magpie. agy in WSL: #3595. Side effect: agy's self-updater ran in the sandbox and replaced the live ~/.local/bin/agy, 1.3.5 -> 1.4.7. |
||
|
|
c888ef2725 |
routing: a rule's hours are kept in the zone they were set in (gaubeebangeel on X)
magpie on a cloud server in UTC read a routing group's rule hours on the
server's clock, so a Beijing user's 09:00-18:00 held at 17:00-02:00
Beijing time, with nothing saying so.
- provider.TimeWindow carries the IANA zone its hours were set in
("zone": "Asia/Shanghai", omitempty). Holds reads From, To and Days in
that zone (time.LoadLocation, cached; Go's embedded tzdata, so Windows
knows them too). A window with no zone, every one saved before this,
stays on magpie's own clock (time.Local) as before. A zone magpie
doesn't know is refused on save (clean); one in a file edited by hand
makes the window never hold, so the rule is as if absent, never always
on and never hours off. Text() adds " (Zone)"; Line() writes tz=.
- GUI: changing a rule's hours or days in the editor saves the browser's
zone (Intl resolvedOptions().timeZone); hours left alone keep theirs.
/api/groups gives magpie's clock (clock: zone, offset in seconds), and
when its offset differs from the hours' zone the Routing page tells the
zone beside them, on the group's rules and in the editor: "Asia/Shanghai
time" (zh "Asia/Shanghai 时间"), or "server time, UTC+0" (zh "服务器时间
UTC+0") for hours with no zone. Nothing is added when the clocks agree.
zh, zh-TW, ja, de.
- CLI and TUI: time=09:00-18:00@Asia/Shanghai or tz=Asia/Shanghai; with
none, this computer's zone ($TZ, time.Local, the /etc/localtime link)
when it has an IANA name, otherwise none (magpie's clock). An unknown
zone is refused with what one looks like; tz= alone needs time= or
days=. Usage text updated.
- docs/subsystems/gateway-routing.md: the zone rules.
Older magpie reading a shared or synced group ignores zone and reads the
hours on its own clock, as before.
Run in a sandbox HOME with pinned Go caches, first at base
|
||
|
|
a093e9c3a5 |
claude: a Claude Code run holding over its memory budget is let go after its turn, its session resumed (#3256)
claudeRoom bounded how many Claude Code processes run, not how large each one is. A run is kept for its conversation's next turn, turn after turn, and on a service never restarted one grew for days: a node-MainThread in magpie.service reached 8 GiB RSS on a 31 GiB host and the OOM killer took the machine down (#3256). Now each time a run's reply ends, its process tree's resident memory is read (proc.Tree.RSS: /proc VmRSS on Linux, ps on macOS, the working sets of its job's processes on Windows, so an npm claude.cmd's node counts) and logged with its pid. Over the budget (an eighth of memLimit on Linux, of the computer's memory elsewhere, 1 GiB at least, 4 GiB if unknown), a whole turn's run is not kept idle: its session is shelved and the next turn resumes it in a new Claude Code with --resume, told only the new messages. A run parked on tool calls is let go past 1.5x the budget (no session to shelve there; its results start a new run). Each Claude Code also logs pid and model at start, and run time, how it ended and peak RSS (ru_maxrss) at its end, so an OOM pid can be found in magpie's log. Budget on the reporter's 31 GiB host: 3.9 GiB. Run (worktree at |
||
|
|
4b1994ad31 |
agent: AionUi, added through its add-provider link
seven7032 on Discord asked how to connect AionUi to magpie. AionUi
keeps its providers in its own SQLite database
(<userData>/aionui/aionui-backend.db, WAL mode), each key encrypted, so
there is no config file for magpie to write. The one supported way in
is its deeplink. AionUi 2.2.2's main process parses it
(parseDeepLinkUrl), and its renderer opens Settings -> Model with the
add form filled in, which the user confirms:
aionui://add-provider?api_key=magpie-aionui&base_url=<gw>/v1&name=magpie&platform=custom
The AionUi row works the way Cindy's and Lody's do:
- Add magpie opens that link. /api/open allows the aionui://add-provider?
prefix only. `magpie aionui add` opens it from the CLI.
- The key is agentKeyAt("aionui"), so it becomes the LAN key while
sharing is on (added to TestPinnedGatewayKeyForEveryWriter).
- "custom" is AionUi's OpenAI-compatible platform. Its base URLs end in
/v1, as its own OpenAI preset's does.
- Added reads providers.base_url for the gateway's address without
touching the database (sessions.OpenUntouched, from the previous
commit). A database that can't be read is unknown, never "not added".
The last read is kept while the database and its log keep their size
and time, for 15s at most, so the Agents poll doesn't copy a running
AionUi's database every time.
- It is detected by userData/aionui (os.UserConfigDir()/AionUi on every
OS).
- As with Cindy and Lody, the TUI leaves the row out (nothing to pick).
Tests:
- TestAionUiLink: the link's exact bytes.
- TestAionUiLinkParsedAs2_2_2: runs the link through
testdata/aionui/deeplink-2.2.2.js, which is parseDeepLinkUrl copied
byte for byte from 2.2.2's app.asar (out/main/index.js 50995-51021)
plus the renderer's add-provider mapping and the form prefill. The
result is action add-provider, route /settings/model, and the form gets
platform custom, the /v1 base URL and the key.
- TestAionUiHas: a fixture database built from 2.2.2's real providers
schema (taken from the database 2.2.2 made at first start). It covers
none, another gateway, a row present only in the log of a running app,
and a closed app, and checks that AionUi's folder is unchanged each
time.
- TestAionUiUnreadableIsUnknown, TestAionUiStatusRereadsOnChange,
TestAionUiDetect, TestAionUiImportRow (GUI: the row, unknown status,
and /api/open refusing other aionui:// links).
- import-row.test.cjs gains the AionUi row (icon, known status in each
language, the click opens the exact link, and it fits at 420px), in
chromium and webkit across en, zh, zh-TW, ja and de. The same file
now waits for the rows to settle before its alignment check: under
load 105 one run caught Cindy's button mid-resize at 193.4px beside
the picker's 194.4px. The old file passed 3/3 alone, so it is a
timing assumption, not a layout bug.
Run at 18041fc5b (this change on origin/main
|
||
|
|
c26a418d23 |
agent: an import app's status magpie can't read is unknown, not "not added"
Agent.Added now returns (added, known). Cindy's reader turned any
failure (a locked, corrupt or unreadable cindy-local-v1.db) into "Not
added", which told a user who had added magpie that they hadn't. Now
an unreadable database is unknown: /api/agents leaves `added` out and
the row shows the "confirm it there" hint, as it does for Lody. A
stopped WSL distro's app is unknown too, not "not added".
Cindy's database is also read without writing beside it. A mode=ro
open of a WAL database while Cindy was closed made cindy-local-v1.db-wal
and -shm in Cindy's own folder. It now goes through
sessions.OpenUntouched, which is what the Cursor reader already did
(immutable with no log, from a copy with one), moved out of
openCursorStore so both share it.
The CLI's list still offers `magpie cindy add` when the status is
unknown; it never said magpie was missing.
Run: go test ./internal/agent ./internal/sessions ./internal/cli ok;
go test ./internal/gui -run 'Import|Lody|Cindy|Agents' ok.
Broken by hand: Cindy's reader put back on the mode=ro open made
TestCindyHasClosedWALAndUnreadable red ("Cindy's folder changed:
cindy-local-v1.db -> cindy-local-v1.db,cindy-local-v1.db-shm,
cindy-local-v1.db-wal"); api.go ignoring `known` made
TestImportStatusUnreadableIsUnknown red. Both restored, both green.
Not tried: a real Cindy install; the read is tested on fixture
databases only.
|
||
|
|
0152f66966 |
provider: a Remote magpie's model list follows the other magpie's, fetched every 10m (6igsteven on Discord)
6igsteven (Discord, 10-24/10-25): GLM-5.3-Trial and GLM-5.3-Flash-Trial are listed on the magpie that runs the ZCode plugin, and not on the magpie that uses it as a Remote magpie. The trial entries come from the ZCode plugin once it reads the account's gift (zcode 0.1.26), and the other magpie's /v1/models lists them as it lists every catalog entry. But a Remote magpie is a provider of keys: its list was fetched when it was added and then only when Fetch models was pressed in its editor (KeepListsFresh asks only providers with a RefreshEvery, FetchNew only accounts). So anything listed there later (the trial models, a new provider, plugin or routing group) never reached this magpie. A Remote magpie with no RefreshEvery now has a 10m schedule (RemoteMagpieEvery, RefreshSchedule), so KeepListsFresh refetches it through the same Refetch as Fetch models. `magpie provider refresh-every <id> off` on a Remote magpie is kept as "off" rather than "" so the user's off isn't read as unset. CLI show/refresh-every print the schedule in force. Other providers are unchanged: no schedule means only when asked. Run: TestRemoteMagpieListFollowsTheOtherMagpie (new) with TestKeepListsFreshFetchesWhatIsDue, TestParseRefreshEvery, TestSaveKeepsTheListsScheduleAndRules: ok, sandbox HOME, Go caches pinned. Broken by hand: RefreshSchedule returning RefreshEvery alone (the old behaviour) fails the new test with "asked [], want [office]"; restored, ok. gofmt -l clean. Then, at this commit: go test ./internal/provider ./internal/cli ok (140s, 58s); go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows ok; darwin, linux (nogui) and windows builds ok. Not run: go test ./... - the machine's disk had under 1GB free (other sessions' work) and load ~200, so a full suite would not fit. Not tried: a real two-computer setup with a live ZCode gift. A Remote magpie whose user curated its picks (left a listed model unpicked) still doesn't take new models by itself (withNewlyListed, by design). |
||
|
|
bea9f905d0 |
redact: a key can go as a made-up key of its own form, not a placeholder (Charles Cao on X)
Charles Cao on X (2114238140835844575) asked for a format-preserving
swap: sk_w3axCByTQgK1PxqPhfKTrJOLBqz6sbZv sent as another sk_ key of the
same shape and put back on the way home. With Mask secrets on, a key went
as {{API_KEY_xxxxxxxx}}, which a tool's check of the key's form fails
and a model may remark on.
Settings › Privacy has "Keep a key's form" under Mask secrets (shown only
while secrets are masked; off by default, so nothing changes for anyone
who doesn't turn it on). settings.RedactShape → redact.Options.Shape;
api.go keeps it when a page from before doesn't send it.
How (internal/redact/shape.go):
- Only a secret's kind, 16+ characters, all of [A-Za-z0-9-_.]. Personal
data, the user's words and anything else still go as placeholders. A
made-up key needs no JSON escaping.
- Prefix kept (sk-proj-, sk-ant-api03-, github_pat_, AKIA/ASIA, or up to
4 letters plus - or _), same length, separators in place, and each
other character a random one of the same class. A hex key stays hex
of its case. Random from HMAC(placeholder key, kind+value), so it is
the same every turn and a vendor's prompt cache still matches.
- Kept in values like a placeholder (makeRoom shared with placeholder),
so masking records, Value(), signed-thinking re-masking (the put
closure) and known-value re-masking work unchanged; kindOf reads it.
- restore() puts made-up keys back first, then placeholders.
RestoreJSON no longer returns early when one is in the body;
hasShapes copies nothing while none was made.
- A stream holds an event's end that may start a made-up key
(partialTail → shapeTail), but never one inside a key that has come
whole: a key ending in "s" is also the start of every sk_ key, and
without that its end was held and the key went out unrestored (found
as 1 in ~40 fresh processes; 0 of 150 after).
- apply() leaves a made-up key that came back unrestored alone
(outsideShapes), as it does a placeholder.
Tests: shape_test.go — form kept (the reporter's key, hex, ghp_,
sk-proj-), same fake twice, Restore; off is placeholders; email/short/
odd values not shaped; MaskJSON then RestoreJSON with escaped tool
args; signed thinking re-masked to the same fake; no re-mask of a fake;
a stream split mid-key, after one character, and a key ending as one
starts. GUI: redact-shape.test.cjs (both engines, 5 languages, 1100 and
640px; row under Mask secrets, Off by default, one save with the rest
kept, no scroll, a later save keeps it; no row while secrets are off).
redact-words-any-case now finds Mask personal data by place after the
new row, not by index.
Broken by hand, each red: no restoreShapes (KeepsForm, JSON, Stream),
no shapeTail (Stream), no outsideShapes (JSON), no hasShapes (JSON),
put ignoring Shape (all three), shapeTail without the whole-key bound
(Stream).
Budgets: app.js 1,321,994 → 1,322,289 and the core 1,529,542 →
1,529,837, the row's 295 bytes, Settings' own row, no room added.
Doc: docs/subsystems/gateway-routing.md, a bullet beside the other
masking options.
Run at
|
||
|
|
be7f174677 |
gateway: a key out of a guessed quota is asked again after one refusal, and held a minute (zoecats)
zoecats (Discord #feedback, 10-25): a local aggregator answers 429 insufficient_quota "quota exhausted" for the moment it switches upstreams, and the agent's retry and every request after it were answered by magpie itself, "out of its allowance: not asked again before …", Retry-After 900. v0.1.1488 ( |
||
|
|
defbb1a159 |
gateway: a Chat reply's cache read reaches the agent in OpenAI's names (B3TT3R on Discord)
B3TT3R (Discord #feedback, 10-25): DeepSeek Harness on DS-v4.1-Flash showed
"缓存命中 0%" over 1.2M input, and dsh's message usage carried only
inputTokens, outputTokens and totalTokens.
dsh reaches magpie through @deepseek-ai/dsh-llm-pi-ai with api
openai-completions, so its usage comes from pi-ai 1.4.0's parseChunkUsage:
cacheRead = prompt_tokens_details.cached_tokens ?? prompt_cache_hit_tokens
?? cached_tokens ?? 0, and nothing of Anthropic's. dsh's mapUsage drops a
0. magpie's Chat passthrough sent the upstream's usage as it came, so when
a provider told the cache only in another vendor's names (a relay giving
Anthropic's cache_read_input_tokens, or DeepSeek's prompt_cache_hit_tokens
or Moonshot's top-level cached_tokens beside a 0 in prompt_tokens_details)
the gateway counted the hit in its own usage log while the agent saw none.
Now chatTidy (stream) and chatWhole (whole reply) tell such a usage in
OpenAI's names too: prompt_tokens_details.cached_tokens, cache_write_tokens
when a write was told, and prompt_tokens counting both, with total_tokens
moved by the same amount. Every field the upstream sent stays. A usage in
OpenAI's names alone is never decoded (mayMendUsage looks for the other
names first), and one that already agrees comes back byte for byte.
Translated routes (Responses, Messages, Gemini) and plugin replies already
build the usage from cUsage and needed nothing.
Not proven: which provider B3TT3R uses. "DS-v4.1-Flash" is not how magpie
names a dsh model, and DeepSeek's own API sends both names, which pi-ai
already read right through magpie (checked live below). So this fixes the
case where magpie is at fault; if B3TT3R is on DeepSeek's own key the
cause is elsewhere and the reply asks.
Run, at this head (rebased on
|
||
|
|
4dfd88206e |
agent: Lody on Linux is run with its import link, which xdg-open turned away (Atlas on Discord)
Atlas (Discord #help, 10-25, Linux): Lody was running, and adding it
from magpie said "failed to open uri". magpie handed the
lody://provider/import link to xdg-open, as every OS's opener.
Cause, shown with the real Lody 0.108.1 AppImage in an amd64 Ubuntu
24.04 container (Xvfb, no update-desktop-database, as on many
desktops): Lody writes ~/.local/share/applications/ai.lody.desktop.desktop
with MimeType x-scheme-handler/ai.lody.stable and x-scheme-handler/lody,
but runs `xdg-mime default` for ai.lody.stable only. lody:// then rests
on the desktop database cache, which nothing built, so
`xdg-open lody://...` answers "gio: lody://...: Operation not supported"
(rc 4) while ai.lody.stable:// opens. With update-desktop-database run,
both open. The same on GNOME and XFCE with a fake handler at that entry.
Fix: on Linux agent.OpenLody runs what xdg-open would have run, the
Exec line of Lody's own desktop entry (ai.lody.desktop, then
ai.lody.desktop.nightly, then dev.loro.lody.oss; $XDG_DATA_HOME before
$XDG_DATA_DIRS, the first file of a name decides), with %U as the link.
An entry whose program is gone, no entry, or a start that fails falls
back to the opener as before. macOS (Info.plist claims lody:) and
Windows (Lody registers lody itself) are unchanged. The GUI's
/api/open and `magpie lody add` both go through it.
Tests: TestOpenLodyRunsItsDesktopEntry and TestDesktopExec
(internal/agent), TestLodyImportRunsLodyOnLinux (internal/gui, Linux
only). The GUI test is red on the old providers.go in golang:1.26.8
docker ("the link went to xdg-open: lody://..."), green on this one.
TestLodyImportHandoff now sets XDG_DATA_HOME/XDG_DATA_DIRS to its
sandbox, and XDG_DATA_DIRS is in TestFolderVarsAreListed's notAnAgent
(the system's data folders; the first run of internal/agent was red on
it until then).
Not covered, and Lody's to change: magpie on a machine Lody Desktop
reaches as a remote (Atlas's later detail: Lody on their own computer
connected to the host magpie runs on). Lody 0.108.1 imports only into
the desktop's own machine (the renderer writes the configs with
machineId = its local machine and needs __LODY_ELECTRON__), and the
link's payload takes only kind/id/name/auth/endpoints with a loopback
gateway, so no link names another machine. Lody Desktop opened on that
host shares the agent's ~/.lody/machine-id, so the import lands on the
same machine; docs/subsystems/agent-wiring.md says so.
Run:
- real Lody 0.108.1 AppImage in docker: agent.OpenLody reached a
running Lody (its log: "handleDeepLink accepted deep link {protocol
'lody:', host 'provider', pathname '/import'}", "sending deep link to
renderer") and a stopped one ("pending deep link sent to renderer
after did-finish-load"); xdg-open on the same link: rc 4.
- golang:1.26.8 docker, -tags nogui: agent and gui Lody tests ok.
- macOS: HOME=<sandbox> go test -timeout 45m -count=1 ./internal/agent
./internal/gui ./internal/cli: gui ok (124.9s), cli ok (48.6s), agent
FAIL on TestFolderVarsAreListed (XDG_DATA_DIRS, fixed here); agent
again after the fix: ok (213.5s).
- rebased on origin/main
|
||
|
|
c6768f06f6 |
providers: a provider of the user's can be set never to rest for a limit
zoecats (Discord #feedback, 10-25): a local aggregator answers "quota
exhausted" (429 insufficient_quota) for the moment it switches
upstreams, and magpie set its key aside for 30 minutes, answering every
request itself ("out of its allowance: not asked again before …").
A provider the user added now has, under the editor's Advanced fold,
"Set it aside when out of quota or rate limited" (Rests), ticked by
default, with a note. Unticked (provider.LimitRestOff, limitRestOff in
providers.json), restAfterMarked rests nothing, counts no failure and
sinks nothing for a refusal it reads as out of quota, credit or rate
limited, or any 429: by "off", and the next request is sent to it as
usual. restDrawer rests no image model of it either. A 401, a model not
served and a plain failure still rest it. The default is as before. The
editor offers it only to a provider the user added (custom); a Save that
leaves it out keeps it. A checkbox (tick), no native select; strings in
zh, zh-TW, ja and de. app.js's budget (and the core's) are raised by the
576 bytes the row adds, with no room, after the comment was cut.
Run on origin/main
|
||
|
|
67361b54fb |
routing: Try now from the editor reaches the Routing page, and puts a sunk key back
zoecats (Discord #feedback, 10-25, v0.1.1477): a local aggregator answered
"quota exhausted" while it switched upstreams; Try now in the provider's
editor left Routing showing 429 until magpie restarted.
Cause, in three holders:
- The Routing page kept lifts in its own liftedAt, filled only by its own
Try now. A lift from the editor (or anywhere else) never reached it, and
the kept routes' snapshots went on drawing the rest. The trace now
carries every rest lifted (TraceState.Lifted, from restingUntil.lifted,
kept up to longestMonthly), Unrest/UnrestAll/renewed wake the long-poll
(trace.lifted), and the page leaves out a rest, a sunk key and an
Accounts and keys count that a lift came after.
- With Sink on, a rate-limited key stayed at the back of the order until
restart: Unrest never cleared sunk. unsink(key) now does.
- The gate itself: checked on the old binary in a sandbox HOME (single key
over a fake answering 429 insufficient_quota "quota exhausted"). magpie
rests it 30 min and answers later requests itself ("out of its
allowance: not asked again before …"); Try now with the editor's key
lifted that and the next request reached the upstream (200), on
/v1/chat/completions and /v1/messages, streaming and not. So the stuck
state was the display and the sink, not quotaHeld.
Left alone, filed: #3555 (Try now lifts nothing when another magpie
serves the gateway, unrest 400) and #3556 (the held reply's
Retry-After, 900s here, outlives the lift for an agent that honours it).
Run at this change on its first base,
|
||
|
|
1b039a3c72 |
gui: a trackpad's coast after the lift is the reader's scroll, no longer put back (issenn on Discord)
issenn (v0.1.1472, macOS app): a page with a scrollbar wouldn't scroll by
trackpad. It shook fast and snapped back, and only dragging the bar
worked. Seen on Agents.
Cause: the scroll guard puts back any .view scroll that comes outside
a window the reader's own events open. A wheel opened 250ms. When the
fingers lift, WebKit on the Mac plays the coast itself, and the page
hears those scrolls with no wheel for each. Once the last wheel's 250ms
ran out, the guard put back every coast scroll. Each coast step moved
the page and each put-back moved it back, so it shook and came to rest
where the fingers lifted.
Fix: the wheel now starts the same chain a touch fling does (flings,
flingUntil). Each view scroll keeps the next one the reader's until the
coast rests, and a click still ends it (purposeUntil = flingUntil = 0).
A code scroll at rest is still put back. The code and the comment fit
the old app.js size; no budget raised.
Test: view-trackpad-coast.test.cjs, chromium and webkit, en and zh. It
does five trusted wheels, then a 1s coast the page plays each frame
with no wheel. The coast must reach its end, a code scroll at rest is
put back, and a click mid-coast stops the row under the pointer.
- On origin/main's app.js: red 6/6 ("lifted at 40, coast asked 166,
left at 101/105").
- Broken by hand, flingUntil not reset by a click: red 6/6 ("the row
was at 269 after the click, 140 once at rest").
- With the fix: 6/6.
Real WKWebView probe (a Swift app loading the GUI with synthetic
NSEvent scroll phases): with every momentum wheel delivered, old and new
both end at 277. With the wheels after the first 32 kept from the page,
standing in for the coast with no wheel, old ends at 249 and new at
277.
Run:
- click-scroll, view-scrollbar-drag, view-middle-autoscroll and
view-trackpad-coast: 44/44.
- Whole GUI suite (internal/gui/tests/*.test.cjs, chromium and webkit,
every language) through suite-lock: still running at push, no red in
its first 30 minutes; a red it finds gets a follow-up commit and an issue.
- go test -tags nogui -run Budget ./internal/gui: ok, run again after
the rebase.
- No Go changed, so no gofmt or vet.
Not tried: a real trackpad on the mac app. Synthetic NSEvents skip
WebKit's MomentumEventDispatcher, which swallows the system's momentum
and plays its own. That the page gets its coast with no wheel is the
best fit for the report, not something seen on issenn's hardware. Also
not tried: ProMotion 120Hz, and WebKitGTK and WebView2 with a real
touchpad.
|
||
|
|
b5a78fd8b5 |
routing: a group's rules are dragged into order
monkeyin_92 on X: "希望可以上下拖动规则". Rules are checked top first, so
their order matters, and it could only be changed a place at a time from
each rule's ⋯ menu (Move up / Move down).
A rule's number is now its handle, as a model's number is in the same
editor (memberHandle): drag it up or down (the shared dragRows, which
the members, groups and agents use), or focus it and press Alt+↑/↓. The
rules are renumbered at once and the keyboard stays on the moved rule's
handle. The grip beside the number shows only on hover, while dragging,
or from the keyboard; the dragged rule is lifted with a card background
and shadow, no coloured border. Move up and Move down stay under ⋯ and
now go through the same moveRule. Saved as the group's rules in their
new order. "Move rule {n}" in zh, zh-TW, ja and de; the title reuses
"Drag to reorder · Alt+↑/↓ to move".
Run at this head:
- routing-rule-drag.test.cjs (new), chromium and webkit, en, zh, zh-TW,
ja, de: 10 of 10. It checks the handles and their names, the grip hidden
away from the row and shown on hover, a drag of rule 3 above rule 1
with nothing opened by the drag's click, Alt+↓/↑ (past the end too)
with focus kept, ⋯ Move down, the page not moved, and the saved rules'
order with their conditions. Red on the parent (no .rt-rhandle): 10 of
10 in the parent's full run.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, both engines: 1321 pass, 55 red, all in files red the
same on origin/main
|
||
|
|
f99d27abc2 |
routing: a rule names several models, tried in order
monkeyin_92 on X: "can a rule take several models? Otherwise one rule
with several models is several rules." A rule now takes more than one
model (Rule.More after Rule.Use; `more` in the group's JSON, use=a,b
typed). They go first in that order: when the first fails or rests the
rule's next takes the request, ahead of the models the later matching
rules name and the group's others.
Every reader of Rule.Use goes through Uses/SetUses/MapUses/Without/Names
in grouprule.go:
- cleanRules: each must be the group's, each named once; a pause names one.
- gateway: ruleFor's turn hold, tool rounds and outgrown turns, compaction
(the rule's first that takes the summary, the others in Small),
ruleMembers/ruleOver/applyRule, nestedRules and ruleLed (the one a
nested group's turn stays on), modelRuled, ruleEffort (useEffort asked
of each), ThenUses (leaves out all of the rule's own). RuleHit.More is
in the trace; Instead from More has Unready false, one from a later
rule Unready true, as before.
- ruledEntry: what the group takes is what every one of them takes.
- provider rename, auto/ refs, groupfast, a member's removal (a rule
goes with its last), ShareGroup and its import (one this magpie hasn't
is left out of the rule).
- CLI `group rule add use=a,b` and its listing; `group models-=` keeps a
rule's other models. The TUI shows them joined and keeps the rule when
one is deleted.
- GUI (plugins/routing): a chip per model, a + for the next one, an ×
on each while there is more than one, a chip picks another in its place
(app menu, no native select); the card's tooltip and the trace's why
("…so c/mini, which the rule names after it, goes first"), nested too;
en, zh, zh-TW, ja, de.
Old data: a rule of one model writes no `more`, so groups saved before
read and save unchanged (TestRuleMoreOnDisk). An older magpie reads `use`
alone: its requests go to the first model, the others are plain group
members in group order; if it saves the group, `more` is dropped.
Tests: TestRuleSeveralModelsInOrder, TestRuleEffortReachesTheRulesNextModel,
TestRuleCompactPassesOverTheRulesSmallModel (gateway); TestCleanRulesSeveralModels,
TestRuleMoreOnDisk, TestRuleWithout, TestParseRuleSeveralModels,
TestThenUsesLeavesOutTheRulesOwn, TestRuledEntrySeveralModels,
TestSharedGroupRuleSeveralModels, TestRuleMoreRenamedAndKept (provider);
TestGroupRuleSeveralModelsCmd (cli); TestGroupTakeOutKeepsARulesOtherModels
(tui); routing-rule-models.test.cjs. Broken by hand: ruleMembers on Use
alone turns the first two gateway tests red.
Run at this head:
- gofmt -l clean; go vet -tags nogui clean with GOOS=linux and GOOS=windows
for provider, gateway, cli, tui.
- go test -tags nogui -timeout 45m: internal/provider, internal/cli,
internal/tui ok; internal/gateway ok (384s); the new gateway tests
again after; internal/gui budgets ok.
- GUI: every routing-*.test.cjs plus i18n-keys, click-scroll and
group-member-drag, chromium and webkit (en, zh, zh-TW, ja, de where the
file has them): 1319 pass, 57 red. routing-rule-models passes in both.
The reds are in files that are red the same on origin/main
|
||
|
|
75e78a5a04 |
tui: quitting hands the gateway to magpie's service on Linux
zaidu259434 on X: "启动codex这些cli连接会失败,AI分析没自动启动magpie的网关".
With magpie installed inside WSL (or on a server over SSH), nothing
opens magpie at login, and XDG autostart doesn't run there. So once
`magpie tui` quit, the agents it had connected asked a gateway that was
gone.
When the terminal quits having served the gateway with an agent
connected, on Linux and where magpie doesn't open at login, keepGateway:
- starts magpie's service (magpie daemon) when it is installed;
- installs it when the user never removed it (daemon.Removed: Uninstall
now leaves a daemon-removed mark, and Install clears it), so it starts
with the system or the login from then on, and says how to remove it;
- otherwise (no systemd, which is WSL's default, or the user removed it)
starts `magpie serve` in its own session, logging to magpie's cache,
and says so. In WSL it also says how to turn systemd on.
macOS, Windows, nothing connected, or magpie opening at login: the same
"gateway stopped" note as before. Docs: gui-shell.
Run:
- TestKeepGatewayAsTheTerminalQuits covers each of those cases, and
TestUninstallRecordsTheUsersNo checks the mark.
- go test -timeout 45m on the four packages, the same run as the
previous commit's: all four ok (gateway 428s, agent 255s, tui 23s, daemon 16s), at
|
||
|
|
a1c1b7053b |
gateway: WSL under NAT reaches the Windows gateway with sharing off
zaidu259434 on X (tweet 2114203077989527990): on Win11, Codex and the
other CLIs in WSL failed to connect to magpie. A distro in NAT
networking (WSL's default) reaches Windows at the address Windows has
on the WSL network (vEthernet (WSL), 172.17.32.1 on the test box), and
magpie wrote that address into the distro's agents. But the gateway
listened on 127.0.0.1 alone unless LAN sharing was on, so every request
from WSL timed out. Turning sharing on wasn't enough either: the WSL
adapter is in Windows' Public profile, and a Private-only allow rule
still keeps WSL out (reproduced on the box).
- gateway: while it listens on loopback alone, on Windows it also
serves at each address on a vEthernet (WSL...) adapter (serveWSL,
looked for again every 10s, since the VM brings its adapter up and
down). A request there counts as this computer's only when it comes
from that network to that address with the WSL key (fromWSL). The key
is `wsl-` plus 48 hex in magpie's folder (wsl-key, 0600), with
`-<agent>` after it optional. The request is then served as a
loopback one with the token (asFromLoopback). Anything else there is
judged as another machine's, so a Docker Desktop container on the
same network gets 403.
- agent: WSL twins at that address get the WSL key (keyAt, agentKeyAt,
ourKey and gatewayKey know it). Whether it answers is asked from
inside the running distro (reachFrom, wslReach: curl, wget or bash's
/dev/tcp), never from Windows, where the listener answers whatever the
firewall keeps out. A distro that can't connect is shown the firewall
rule that lets it in (Profile Any, vEthernet (WSL*), magpie.exe).
- The NAT notices no longer say it answers only while sharing is on (en,
zh, zh-TW, ja, de).
- Docs: gateway-routing (WSL under NAT) and agent-wiring.
Run:
- TestWSLCallerServedWithSharingOff and TestServeWSLListensBesideLoopback
(gateway), and TestWSLAgentsGetTheWSLKey and
TestWSLReachAskedInsideTheDistro (agent). All four were red with the
fix taken out: "403 magpie isn't shared on the local network",
"answers = false", the token given at the WSL address, and no drift.
- go test -timeout 45m ./internal/gateway ./internal/agent ./internal/tui
./internal/daemon: all four ok (gateway 428s, agent 255s, tui 23s, daemon 16s), at
|
||
|
|
15f0d4cdeb |
sessions: a Claude Code session goes on in Codex, and a Codex one in Claude Code
0xPlato on X asked for conversations to carry across agents, at least on
one machine. A session row's Continue in (换 Agent 继续) now offers Codex
for a Claude Code session and Claude Code for a Codex one, when the other
is installed. Picking it converts the session then: a new session in the
target's own store, which its own resume opens. Listing converts nothing.
- Claude Code to Codex: a rollout in CODEX_HOME/sessions/YYYY/MM/DD with
session_meta (model_provider from config.toml now, no
base_instructions, so Codex uses its own), response_items and the
event_msg user/agent messages the TUI shows. Codex indexes it on
resume itself.
- Codex to Claude Code: CLAUDE_CONFIG_DIR/projects/<cwd>/<uuid>.jsonl,
lines chained by parentUuid, assistant model "<synthetic>" so usage
counts no call for them.
- Carried: user and agent text, pasted images, shell calls natively
(Bash and exec_command) with their output, other tools as the agent's
text (name, input, result in fences, cut at 64 KiB). Dropped: thinking,
reasoning, signatures, encrypted content, Claude Code's own and Codex's
context messages. After a compaction only what replaced the history.
- The source is only read. The new file goes through temp, sync, rename
and never over an existing path. Asking again for an unchanged file
gives the same session (memo by path, target, size, mtime).
- POST /api/sessions/carry {agent, id, to, open}: copies the resume line,
or with open (Mac app) opens it in the session terminal. The details
pane's Continue in line converts from its copy button too.
- Read-only and WSL sessions get no offer. Pi, omp, OpenCode, Kimi,
Cursor and the rest are not converted.
Run (worktree at
|
||
|
|
46c4188327 |
gateway: Codex's access_programs goes to OpenAI alone, so OpenCode Go's DeepSeek and GLM answer (#3172)
csic21, HONGs23 and TimWongUp (#3172): a Codex subagent inherits
access_programs {"cyber":"standard"}, magpie relayed it to OpenCode Go,
and Go answered DeepSeek and GLM with 503 "Upstream request failed:
Endpoint is unavailable."; without the field, or with null, 200. Go's
Haiku took it.
Scope: Codex itself sends the field only with a ChatGPT sign-in, or an
API key on its provider named "openai" (codex-rs core/src/
cyber_access_program.rs, for_auth and for_provider; read at openai/codex
970111f6c). It comes to magpie because Codex thinks magpie is OpenAI,
the same reason forVendor takes OpenAI-only parts out (#292). So the
class is "only the upstreams Codex would send it to", not an OpenCode Go
rule: no other vendor has a Cyber program to read, and Go is the one
seen to refuse it. keepsAccessPrograms keeps it for a ChatGPT (Codex)
account, a host ending in openai.com, another magpie (IsRemoteMagpie,
whose own upstream decides) and a codexAsSent relay when Codex sent the
request. Every other Responses upstream, relayed or built (from Chat
too), plugins included, goes without it. A relay that fronts ChatGPT
loses it unless set codex=as-sent, as Codex with a custom provider
would send it none.
- forwardOnce takes it out before the user's extraBody is merged, so an
access_programs the user wrote there still goes (Edward4226's branch
did it after, which would override the user's own value).
- withoutTopMember (from Edward4226's branch, using longBody's spans on
a long body) removes the member, every one of that name, the rest byte
for byte; a body that isn't a valid object goes as it came. A
bytes.Contains check first, so a body without it costs nothing.
- Chat and Messages builds never carried it (now tested).
- Docs: gateway-routing.md, providers-accounts.md, ir.go comment.
Run:
- TestAccessProgramsGoToOpenAIAlone (new; fakes by the gateway client's
RoundTrip, no network): Go DeepSeek/GLM from Codex and from curl, null,
Chat built as Responses, Zen, a relay, codexAsSent with and without
Codex's headers, the user's extraBody, OpenAI (daybreak_blue, null,
from Chat), another magpie, a Chat and a Messages upstream.
TestWithoutTopMember (new). TestCodexAccessProgramsReachBackend,
TestAccessProgramsNullKept, TestCodexAccountTakesExtraBody pass.
- Broken by hand, each red: no strip (9 cases: Go, Zen, relay, extraBody);
IsRemoteMagpie out; openai.com out (3 OpenAI cases); codexAsSent out;
codexAsSent without fromCodex; Codex account out
(TestCodexAccessProgramsReachBackend red); strip moved after extraBody
(the user's value lost).
- gofmt -l clean; go vet -tags nogui ./... for darwin, linux, windows.
- HOME=<scratch> go test -tags nogui -timeout 45m ./internal/gateway/:
ok (414s), at
|
||
|
|
a2ff7e6cab |
plugin: add takes a community plugin's name (WorkBuddy, think-tags, qoder-cn)
Atlas on Discord (#help, 10-25, Linux): `magpie plugin add WorkBuddy`
said "isn't an npm package name". Worse, a bare `workbuddy` passed the
npm-name check and installed npm's unscoped workbuddy@latest, not
@magpie-community/opencode-workbuddy-auth.
plugin.Add, which the CLI, the Plugins page's field (/api/plugins/add)
and the movers all go through, now resolves a bare name first
(internal/plugin/resolve.go). Case aside, a name one community listing
goes by is its package, at the version given: the package or its bare
name, the short name (workbuddy, think-tags), the shown name (WorkBuddy,
Command Code), a provider id it serves or the subscription it replaces,
and a retired subscription's id through its mover (qoder-cn; provider
sets plugin.SubscriptionPlugin = MovePackage). The CLI says which
package it picked. A name two listings go by, or none that isn't an npm
name, is refused with the community plugins listed. A name no listing
goes by is npm's own package (opencode-gemini-auth keeps working), but
only when the list was fetched within the six hours: when the fetch
fails, the copy kept or built in may not name a newer plugin, so the
name is refused with why, and npm:<name> installs npm's package as
written. market() now says whether its list is a fresh fetch (marketErr).
Scoped names, paths and git specs are unchanged. A backup's or a sync's
plugins go in by their own spec (plugin.AddExact via addPluginExact),
never resolved, so a restore isn't held by GitHub being unreachable.
Update, Upgrade and InstallMissing use add with stored specs, unchanged.
Tests (fake registry over httptest, fake bun; no network):
TestResolveCommunityNames, TestResolveRefusesWhatItCantName,
TestResolveListUnread, TestAddByCommunityName. TestUpdateAllUpdatesAPinnedPlugin
adds an unscoped third-party name, so it now serves a registry.
Broken by hand: Add without resolve -> TestAddByCommunityName red with
the reporter's own error ("WorkBuddy" isn't an npm package name) and
workbuddy -> workbuddy@latest. The unread-list rule turned off (valid
name goes to npm regardless) -> TestResolveListUnread red.
Real use, sandbox HOME, built binary, real npm and GitHub:
`plugin add WorkBuddy` -> installed @magpie-community/opencode-workbuddy-auth@latest,
listed workbuddy and workbuddy-ai; `think-tags` -> middleware-think-tags;
`opencode-gemini-auth` -> npm's, google-plugin listed; `qoder-cn` with
MAGPIE_PLUGIN_MARKET=off -> opencode-qoder-auth; "Work Buddy Pro" ->
refused with the 38 community plugins listed; `twinz` with the list off
or at a dead URL -> refused, saying why and npm:twinz.
Run at this head (rebased on origin/main
|
||
|
|
42976f9a08 |
usage: a renamed provider is shown once, by the id it has now
cybercaius on Discord (#help, 10-25): "已经更改供应商 id 的也没有变更过来反而
分开显示了". Reproduced in a sandbox HOME (magpie web on 3582, fake upstream
on 3583): after renaming myrelay to newrelay in the editor, the Requests
page's provider list had both myrelay and newrelay, each named "myrelay",
because the model-list probe row was still under myrelay. The summary was
already folded; the probe chunk, the Sessions tab's vias and the gateway's
loggedAnswers (lead-first routing) were not renamed at all.
What changed
- provider.Renames (UsageRenames): Of(id, time) is the id a call recorded
under id at that time belongs to now. Every usage reader goes through it:
summarizeFrom (and its historical-key set), ledgerMatched, NewPricer,
NewCoster, the Requests page's gateway blocks, probe rows and other
computers' days, window holds and their history, buildVias, and
gateway loggedAnswers. Visit stays as recorded so Of is taken once.
The summary, Requests and vias caches key on Renames.Key.
- An id reused by another provider no longer pulls the new one's calls
into the old one. Rename onto, or Save of a new provider under, an id in
another's Was moves it into that one's Gave with the time (giveID):
calls before then stay the old provider's. freeID treats Was ids as
taken, so adding the vendor again gets "-2". Renamed() (refs) skips ids
a provider or subscription holds now.
- A providers.json that can't be read keeps the last renames read instead
of none (a failed read is unknown), so usage doesn't split meanwhile.
- History: nothing in usage.jsonl is rewritten. Calls from before this
release under a renamed id show under the new id at once. An id that was
reused before this release has no hand-over time, so its calls show under
whoever holds the id now, as before.
Siblings checked: budget keys by caller key; per-key limits, RPM and
concurrency count live requests by the current id; tray totals go through
QueryPage; codex_memory reads Requested refs. None needed a change.
Run at the tree before the rebase; rebased onto
|
||
|
|
769355ab93 |
library: an MCP server's startup timeout reaches Codex as startup_timeout_sec, a hand-written one stays (#3168, miaomiaozi)
The Library's MCP server editor has a "Startup timeout" field (seconds), shown when an agent that reads one is installed (AgentView.Startup; Codex only). It is written to Codex's [mcp_servers.<name>] startup_timeout_sec, user-wide and in a project's .codex/config.toml. Empty writes nothing, so Codex keeps its own 30s, as before. The key and its unit are from Codex's own source: RawMcpServerConfig in codex-rs/config/src/mcp_types.rs (cb2581dae8de) has startup_timeout_sec: Option<f64> in seconds, and the older startup_timeout_ms, which is read only when _sec is absent. A value the user wrote in config.toml is never written over. magpie records the value it last wrote (Applied.Startup per agent, Project.Startup per project file). A value in the entry that differs from that record, one there before magpie wrote any, or any startup_timeout_ms, is the user's (startupTheirs), and magpie leaves the key alone. Once the user takes theirs out, magpie's goes in. The TUI's server editor keeps the GUI-set value, as it does for OAuth. Other agents with a startup timeout (Grok Build, Hermes, OpenCode) and a `magpie mcp add` flag are #3536. Run, in a sandbox HOME with pinned GOMODCACHE/GOCACHE: - go test -tags nogui ./internal/library ./internal/tui: ok (162s, 16s). - New tests: TestCodexStartupTimeout, TestCodexStartupTimeoutKeepsUsers, TestCodexProjectStartupTimeout. Broken by hand, each red: every existing value counted as the user's -> "startup_timeout_sec = 120, want 45"; magpie always winning -> "= 20, want 90"; no encode (the old code) -> "= <nil>, want 120". - GUI: new mcp-startup-timeout.test.cjs, Chromium and WebKit, en zh zh-TW ja de, 1100 and 390px: 22/22; red on the old client.js (no field). The 59 GUI files the change reaches (mcp-*, library-*, i18n-keys, gui-de/ja/zh-tw, every editServer/lib-editor file): 935 of 937 pass. The red, library-row-remove's hook-row trash in Chromium, fails the same way on origin/main |
||
|
|
208bd5c48b |
gui: Settings descriptions wrap instead of ending in … (arculongus on Discord)
arculongus (English UI, screenshot) couldn't read many Settings rows: the
line under a setting's name ended in "…". The generic `.row .sub` rule holds
a row's line to one line with an ellipsis; a few Settings rows opted out
(`.wraps`) and the rest were cut, among them Image generation's ChatGPT
note, Image recognition MCP server and Web search's Searches for other
models.
Fixed for the class, not the rows in the screenshot: every setting row's
line (`.row.pref .sub`) now wraps whole beside its control. That covers
every Settings part, Plugins › Built-in and an agent's own settings (the
same rows). The control keeps its size (`.prefs .val` is `flex: none`,
max 60%), and nothing else in the layout moves. The window is never
narrower than 560pt, so a row stays a few lines at most. Lines elsewhere (provider
and account cards, chips, URLs) stay one line; their full text is already
reachable through the hover title.
Tests:
- New settings-lines-wrap.test.cjs checks every visible Settings part plus
Plugins › Built-in, in chromium and webkit, en/zh/zh-TW/ja/de, at
1000px and 440px. No row's line is cut or nowrap, each control stays
inside its row, and the page never scrolls sideways (more than 30 rows
checked). It also checks the three reported rows by name.
- Tests that assumed one-line rows now follow the taller rows:
- searcher-pick: the help wraps rather than ellipsizing with a title.
- settings-general: one line only at 1000px, never cut at either width.
- reader.cjs reach(): goes up to 8,000px, not 2,400.
- member-model-setting, turn-done, connect-address-kept, tray-cost and
tray-totals: wheel to the control with reach() before
clicking, not scrollIntoViewIfNeeded or Playwright's own scroll, which
the app undoes.
- update-download, update-restart and tray-totals: a click whose row
grows a line may scroll, but only to keep the clicked control under
the pointer (the app's hold, #2134). tray-totals allows 2px, because
WebKit's whole-pixel scrolls drifted 1.3px over four holds.
- mobile-web: compares against an origin/main baseline without this
change.
- Docs: gui-shell.md and gateway-routing.md.
Run (worktree from origin/main
|
||
|
|
73d17f90ce |
codex: every CODEX_HOME folder's sessions count, its account renewed there
phantom3792 on X: with several ChatGPT accounts kept the way Codex supports, magpie counted only the default profile's usage, and the accounts added from the other profiles read no quota. Codex's mechanism, from openai/codex at 970111f6cb62: - One sign-in per folder. In codex-rs/login/src/auth/storage.rs the sign-in is $CODEX_HOME/auth.json, or the keychain item that compute_store_key(codex_home) names. - Sessions live in the same folder. rollout/src/lib.rs writes sessions/ and archived_sessions/ under codex_home. - `--profile <name>` only lays $CODEX_HOME/<name>.config.toml over config.toml (config/src/loader/mod.rs), and the sign-in stays shared. So a second account is Codex run with CODEX_HOME=~/.codex-work, and magpie read only the folder it runs with. There were two causes: - Sessions: codexFiles() walked CodexDir() alone. The sessions list, traces and the usage ledger (sessions.Calls) never saw other folders' rollouts. - Quota: an account added by importing another folder's auth.json is refreshed from magpie's copy. The import rotates the refresh token, which leaves two holders of one token, and whichever refreshes first signs the other out. The saved account goes "sign-in has expired" and its quota read fails. The fix: - appdir.CodexHomes finds the folders: CodexHome first, then folders named codex* or .codex* in the home folder or beside CodexHome, or one level down in one (~/.codex-profiles/work), that hold auth.json or sessions/. - sessions: codexFiles and Dirs read every folder. - provider: rememberLogins saves each folder's account with Home set to it (codexHomeLogins). The one ~/.codex is signed in to stays that folder's. - renewSaved renews such an account where that folder's Codex keeps it (codexHeldIn, as heldByCodex does for ~/.codex). This one funnel covers quota, gateway, warm-up, keep-alive and revoked sign-ins. codexLoginAuth reads its expiry from the same place. - switchSavedLogin, NextLogin's spares and forgetLogin leave such an account alone. Their errors name the folder and the CODEX_HOME=... codex command. - docs/subsystems/providers-accounts.md gains a row. Run (worktree at |
||
|
|
402577c15a |
gateway: image generation is an MCP server on the gateway, /mcp/magpie/image
JonahFu on X runs magpie in Docker in gateway mode, so he has no Library and
no stdio Magpie Image server, while image recognition is an HTTP MCP server
on the gateway (/mcp/magpie/vision). Now image generation is one too, with
the stdio server's tools: generate_image, generate_video and
generation_result, drawing with Settings › Images › Image generation.
- image_mcp.go: served by serveMCP, so it is guarded as the vision server
is (local or a shared magpie's caller, a refused Origin 403, POST only,
the key's limit reserved per call). A drawing is s.images run in-process
on a clone of the request (caller and key kept), so routing, key models,
usage and the timeout setting are draw.go's own. It runs as a job (15
min at most); the tool answers within 20s or gives an id that
generation_result waits on. Images come back as MCP image content (5 MB
each at most) and at /mcp/magpie/image/files/<name>, kept in memory an
hour, 256 MB at most, readable only by the key that made them. Videos
go through videosCreate/videosGet in-process and are given as
/v1/videos/<id>/content. Image generation Off is a tool error naming
where to turn it on, before the arguments are read.
- Input images go through the vision server's reader, now mcpImageSrc
(vision_mcp.go), so a file path is read only for a local caller.
- The tool schemas live in the gateway (ImageToolProps, VideoToolProps,
ResultToolProps); internal/imagemcp takes them and adds only its path
argument. Its tools/list JSON was compared byte for byte with the old one.
- Settings › Models: #imageMcpRow under #visionMcpRow with the address and
a copy button; the gateway-mode Image generation sub now points at it.
en, zh, zh-TW, ja, de.
The two rows are drawn by one helper (mcpRow), which took the vision
row's own code, so the row costs 462 bytes of app.js.
- core_budget_test: appScriptBudget 1,321,336 -> 1,321,424 and
coreScriptBudget 1,528,525 -> 1,528,972, the exact sizes with the row,
with no room added (10-25). Nothing moved out: the row is Settings'
own, which the core draws.
- search-api.test.cjs: the new row pushed the search row partly below the
1400px window at 420px, where scrollIntoViewIfNeeded leaves it, and
magpie puts back a scroll the reader didn't make, so the test's
coordinate clicks missed. It now brings the whole row on screen with
the wheel and checks it is still there a second later. Red with the new
row before this, green after; green on origin/main's GUI either way.
- oneport_test knows ImageMCPPath and ImageMCPFiles (ClientPath covers
them).
Run (worktree at this commit, on origin/main
|
||
|
|
5b32b7ea80 |
plugins: a Bun Windows can't load (0xc0000139, before 10 1809 / Server 2019) says so and what to do (zgcwkj on Discord)
zgcwkj runs magpie-cli-windows-amd64.exe as a Windows service (nssm) and every plugin install failed with "bun add …: exit status 0xc0000139: (and from the community repo's dist branch: bun add ./dist/….tgz: exit status 0xc0000139: )". Why: 0xc0000139 is STATUS_ENTRYPOINT_NOT_FOUND, the loader refusing the exe before it runs. Reading the PE imports (debug/pe) of Bun's windows-x64(-baseline) zips: 1.3.14 and later, so magpie's floor 1.4.2 and the latest 1.4.4, import kernel32's CreatePseudoConsole, ClosePseudoConsole and ResizePseudoConsole, which Windows has from 10 1809 (build 17763) / Server 2019 on. 1.3.13 doesn't. Bun's docs say "Windows 10 version 1809 or later" (bun.com/docs/installation). So Windows Server 2016 and Windows 10 1507 to 1803 (LTSB 2015/2016) can't run any Bun magpie uses. 1.4.2's pinned SHA-256 matches the asset. What changes: - wontLoad (internal/plugin/bun.go) reads an exit of 0xc0000139 as "this Windows" and 0xc000001d or SIGILL as "this processor" (Bun's x64 build targets SSE4.2), as a *BunUnstartableError whose message says which, the versions Bun needs, and MAGPIE_BUN. - bun add, bun update, cantStart and whyDied (the host's start) wrap it. - An install no longer tries the dist branch after it: that bun add can't start either, and its error read as the dist branch's. - The GUI's fail() answers it with code bun_unstartable, bunWhy and said, an i18n.js key (bunSaid in api.go), which api() in app.js puts through t(): en, zh, zh-TW, ja, de, in the window and in magpie web. The sentences live in Go so app.js grows one line: with both in app.js, TestCoreScriptBudget was 128 bytes over app.js's budget and 487 over the core's, and no budget is raised here. TestBunSaidIsTranslated fails when a language lacks one. The CLI prints the English message. - No fallback to an older Bun: 1.3.13 is below BunVersion and Bun doesn't support that Windows, and the -baseline assets are now the same binary. - docs/subsystems/provider-plugins.md says all this. Run: - New tests: TestWontLoadSaysWindowsOrCPU (injected NTSTATUS exits, a real kill -ILL), TestInstallOnUnstartableBunSaysWhyAndSkipsDist (0 dist requests), TestHostOnUnstartableBunSaysWhy, TestFailSaysBun Unstartable, TestBunSaidIsTranslated, plugin-bun-unstartable.test.cjs (chromium and webkit, every language, window and web). - Real Windows (10.0.26200 box, a sandbox dir of its own): a windows/amd64 nogui magpie-cli.exe with a fake magpie-bun.exe that exits 0xc0000139, `plugin add @magpie-community/opencode-raccoon-auth` printed the new message, and no dist folder was made. - gofmt -l; go vet darwin, linux -tags nogui, windows; builds of all three. - Full suite (go test -tags nogui -timeout 45m ./..., through suite-lock, at |