0f398c4895bb4560f2480dd079bd2f2f6a84fdff
744
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0f398c4895 |
gateway: a group member whose window can't hold the request isn't asked it (dgqyushen on Discord)
dgqyushen on Discord: OpenCode Zen's free DeepSeek V4.1 Flash (200K) first in a group and a 1M DeepSeek subscription second, so that the first 200K go free and past that go to the subscription. The gateway fell over only on a refusal it reads as too long (#700, withRoom/failOverflow, tooLongUnsaid past 1.2x the window). A vendor that refuses a request just past its window without saying why (between 1.0x and 1.2x) reached the agent as that error while the next member had room, and every doomed request spent one against the free tier's limits. roomy (fallback.go), in serve after rules, affinity, the image filter and pinTo and before probeOne, estimates the request as the overflow path does (estimate) and leaves out the candidates whose known window (windowOf: Contexts, the catalog, ContextOf) is no larger, and their order rows with them. It is a check before sending, not a retry. Kept: a window not known, a body that doesn't parse, a single model, and a request no candidate holds (the first is asked, its overflow told to the agent to compact). A conversation stuck to the small member by affinity moves once it outgrows it. count_tokens (a count on the first member) and System One's decision models don't go through serve's candidate path and are left alone; every generation route (middleware, classify, search, vision, codex titles/backend, auto groups) goes through serve. No UI change: a member left out is absent from the route's order. TestPayloadTooLargeOverWindowTriesMemberWithRoom now expects the members too small not to be asked at all (c only, one try). Run: - go test -tags nogui -p 1 ./internal/gateway -run 'TestMemberTooSmallIsNotAsked|TestConversationOutgrowingItsMemberMoves| TestRoomyLeavesWhatItCantJudge|TestPayloadTooLarge': ok - the overflow tests (TestPayloadTooLarge, TestOverflow, TestContextOverflow, TestEveryVendorsOverflow, TestCodexOverflowInGroup, TestStreamOverflow, TestRateLimitNotContextOverflow) with the new ones: ok - gofmt -l clean; go vet ./internal/gateway (darwin); GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean; go build darwin, linux, windows: ok. Broken by hand: the roomy call in serve commented out: TestMemberTooSmallIsNotAsked red (400 "FREE: Invalid request parameters"), TestConversationOutgrowingItsMemberMoves red (free 2, paid 0), TestPayloadTooLargeOverWindowTriesMemberWithRoom red (a 1, c 1, 2 tries); restored, all green. Not run: the whole internal/gateway package (the run failed to build, "no space left on device", the disk at 0 GB free) and the full suite (left to the batch's run). Not tried against the real OpenCode Zen. Known: the estimate is bytes/4, so mostly-CJK text counts high and a member may be passed over a little early. Full suite: SUITE_LINE |
||
|
|
0dbb1a8490 |
library: subagents are written once and given to every agent in its own format, with what each agent can't bind shown (#2283, chuanchinatest)
The Library has a Subagents tab beside Hooks. A subagent is a name, a
description, a prompt, and the library's skills and MCP servers it uses.
magpie writes it to each ticked agent's user-level folder in that agent's
format, rewrites it on every change, and takes back only files it wrote.
Where each one goes (syncSubagents, subagentSpecOf):
- Claude Code: ~/.claude/agents/<n>.md, with skills and mcpServers
- Codex: $CODEX_HOME/agents/<n>.toml (name, description, developer_instructions)
- OpenCode: ~/.config/opencode/agents/<n>.md (mode: subagent)
- Gemini CLI ~/.gemini/agents, Qwen Code ~/.qwen/agents, Grok ~/.grok/agents,
Cursor ~/.cursor/agents, Copilot CLI ~/.copilot/agents/<n>.agent.md
- Factory Droid: ~/.factory/droids/<n>.md, with mcpServers
Skills and servers are named only where the agent's file can name them.
The page says, per agent, which of the two it won't bind, and that only
the Cursor app reads ~/.cursor/agents (cursor-agent reads a project's only).
Agents in WSL and agents with no user-level folder are greyed out.
The user's own files: every file is recorded by the hash of what magpie
wrote (Applied.Subagents). A same-name file of the user's is never written
over (the agent gets a problem). A file the user edited is theirs from then
on: it is neither rewritten nor removed. A carried library doesn't carry
subagents yet (as with hooks).
The Library's tabs now wrap onto a second line rather than scroll a narrow
window sideways (eight tabs in German at 560px). library-servers-bulk's
window goes from 1000 to 1100px tall to keep its stated premise that the
whole list fits.
Run:
- gofmt -l, and go vet -tags nogui for darwin, windows and linux: clean.
- go test of internal/library, internal/gui and the packages that import
internal/library, at this head: green.
Full suite: SUITE_LINE
- New tests: TestSubagentsEachAgentsFile, TestSubagentsLeaveTheUsersFiles
(covers the user editing magpie's file and then a sync), TestSubagentCheck.
- GUI: library-subagents (new) passes in Chromium and WebKit, at 1100 and
420, in en, zh, zh-TW, ja and de. Also all library-*, gui-ja, gui-de,
gui-zh-tw, i18n-keys, images-library-way, skill-* and mcp-* tests pass.
Greying out the WSL agent was broken by hand, and library-subagents
went red.
- Real binaries in a sandbox HOME against a fake upstream: each one sees
the subagent magpie wrote.
- Claude Code 2.1.300: it is listed in the system prompt.
- OpenCode 2.0.25: debug agents.
- Grok 1.0.50: grok inspect.
- Codex 0.162.1: spawn_agent's roles, with --enable multi_agent_v2. v1
showed no spawn_agent with a custom provider.
- Gemini CLI 0.63.0: <subagent> in the request.
- Qwen Code 0.21.9: its agent types.
Not tried: Factory Droid and Copilot CLI (both need a sign-in; Copilot
stops on auth before it reads agents), and the Cursor app.
|
||
|
|
c14842fbb7 |
routing: a try the gateway went on from says it went on, not that the agent got it (#2281, xishuchkui-code)
xishuchkui-code's Antigravity account answered 502 with an empty reply,
which doesn't rest it; the gateway went on to the next account and that
one answered. The Routing page's story said "answered 502 — an error
another account wouldn't fix, so Claude Code gets it" (换账号也无法解决,
Claude Code 收到此错误), and the account's row said "502 · failed ·
passed to Claude Code". Both guessed the outcome from where the try stood
in the order (not last, no rest, no retry), not from what the gateway did.
What came of a try is now read from the record. The gateway appends a try
to Route.Tries only as it asks it, so a later try is the request going
on; with none, the error ended the request, the agent's once the route
is done. No marker was needed for that. The one case the record can't
show is the `other` hand-back: the last try left, out of its allowance
after an earlier failure that wasn't one, while the agent is told the
earlier error (Discord, waroy). That try is now marked Try.Earlier.
Siblings in trySaid that guessed the same way:
- a try that went on with no rest: "answered {status}, and the request
goes on to {next} … doesn't rest for it" (was "wouldn't fix … gets it");
- a resting try with nobody after it (the last key, #1772) said the
request goes on to "the next"; it now says nobody is left and the
agent gets the error;
- slow to begin with nobody left said it went on to the next; same;
- the Earlier try says the agent got the earlier try's error;
- a failed try with no next on a route still running says only what it
answered.
The account row: "passed to {agent}" only for the route's last try once
it is done; a try the gateway went on from says "{status} · {fail} ·
went on to the next". Usage's request detail only shows the gateway's
"answered on a retry" counts and the CLI/TUI don't tell tries, so neither
changes. 6 new strings, in en, zh, zh-TW, ja and de.
Run at this head (rebased on origin/main
|
||
|
|
0fe7892320 |
library: shared instructions can be given to Alma, after the profile in its ~/.config/alma/USER.md (#2315, Jie211)
Alma had no instructions target: the library said it "has no user-wide
place for instructions". Alma 0.4.164's own main process
(out/main/index.js in its app.asar) does read one. Its main chat puts
~/.config/alma/USER.md into the system prompt as "USER PROFILE (your
owner/primary user...)", or a workspace's USER.md in its place. Alma's
prompt calls the file "your owner/primary user's profile (name,
preferences, habits - editable)". Its leading front matter (name,
telegram_id, discord_id, matched with ^---\n...\n---) is who its bots
answer to.
So Alma's target gets Instructions = ~/.config/alma/USER.md and a new
Profile flag:
- magpie's part goes after the user's, so the front matter stays first
and Alma still finds its owner. Turning Alma off leaves the file as it
was. A USER.md magpie made holding only its part is taken away again.
- ImportInstructions refuses a Profile target. Moving the user's lines
out would take the front matter out of USER.md and put the owner's
telegram/discord ids into every agent's file. The page hides "Move its
own into the shared text" for it (AgentInstructions.Profile), and adds
an aside in en/zh/zh-TW/ja/de. The aside says the file is Alma's
profile of the user, and a workspace USER.md is read instead.
Not tried with the real Alma app. Its live ~/.config/alma was not touched.
What Alma reads was taken from its bundled source. Sub-agents are not
confirmed to read USER.md.
Tests (sandbox HOME, Jie211's own line as the shared text, a USER.md in
the shape Alma's setup writes):
- TestTakesAlma
- TestAlmaInstructionsKeepTheProfile: the front matter is still matched
by Alma's own regexp after the sync; turned off, the file is the same
bytes.
- TestAlmaInstructionsWithoutUserMD
- TestAlmaProfileIsNotImported
Broken by hand:
- the Profile check in ImportInstructions taken out:
TestAlmaProfileIsNotImported goes red;
- Alma's Instructions path taken out: TestTakesAlma and
TestAlmaInstructionsKeepTheProfile go red.
Ran (at the reviewed head, on origin/main
|
||
|
|
357ffac7be |
usage: a model's Same as prices its calls when no list does (#2344, liuweifeng)
A model a provider serves under its own id (a WorkBuddy kimi-k3-1, a relay's renamed gpt) had no price unless the user typed one, even when the user had already told magpie in the editor's "Same as" box which model it is. Its calls showed no API-price cost in Usage, window holds had no price to weigh, and `magpie model price` said unpriced. Now, when neither the user's prices, the provider's list nor models.dev's maker price covers a model, provider.SamePriceIn takes the maker's list price of the model it is the same as (settings.ModelSameAs), and the provider's price rate still applies. A price the user set, or a list that prices the model, always wins; nothing is inferred without a Same as. The same fallback is used by priceOf (Usage costs, re-priced when the ledger is read, so past calls pick it up), usage's apiPricer (window holds), the model editor's greyed list price, and `magpie model price`, which names where the price came from. The "Same as" tooltip says so in en, zh, zh-TW, ja and de. Run: - go test -p 1 -tags nogui ./internal/provider ./internal/usage ./internal/cli ./internal/gui (focused: TestSameAsPricesAnUnlistedModel, TestHoldsPriceTheModelItIsTheSameAs, TestModelEditorShowsTheSameAsPrice, TestModelPriceCmdSaysWhereThePriceCameFrom, plus the packages): ok - GUI (chromium + webkit): provider-same-as, i18n-keys, model-price-edit, 11/11 pass - gofmt -l clean; go vet -tags nogui for darwin, linux, windows: clean Broken by hand, each went red: - SamePriceIn dropped from priceOf: "kimi-k3-1 ... false; want $0.3" - usage's apiPricer fallback removed: "wasn't its API price: <nil>" - the GUI editor branch removed: "list <nil>" - the CLI source line disabled: TestModelPriceCmd... FAIL - the zh tooltip left untranslated: provider-same-as.test.cjs 0/2 A prefix-stripping branch passed when removed (MakerPrice already resolves vendor-prefixed ids like moonshotai/kimi-k3), so it was dropped. Not tried: a real WorkBuddy account's usage after the change. Full suite: SUITE_LINE |
||
|
|
0c0665126b |
quota: magpie quota --json and /v1/magpie/quotas tell each window's whole (holds / holdsWhy) as the Usage page does (#2333, zhenghaowen0967)
usage.WithWindowHolds reckoned a subscription window's whole (tokens, and cost at API list prices) from magpie's own calls, or why it can't, but only GET /api/usage/quotas and its refresh called it. magpie quota --json, GET /v1/magpie/quotas and its ?kept=1 list showed name, used, remaining and resetsAt only, so a script comparing plans had to rebuild the estimate from the log without its guards. Package provider can't import usage, so usage sets provider.ReckonHolds in an init (like the other provider hooks). quotaReport, which QuotaReport, KeptQuotaReport and RefreshReport share, runs it once over every card and QuotaSpan carries Holds and HoldsWhy. The log is read through usage's cached snapshot, so ?kept=1 (magpie statusline, every message) adds no full read after the first. A key held to a budget, models or accounts and told cards (#2216) is not told holds: they are reckoned from every call routed through the account, other keys' too, so quotaScope.quotas drops them; this machine and unheld keys get them. The Balance guard in holdsBounds (a Codex account holding credits gets no whole and no reason) is unchanged; it is answered on the issue. Docs: reference.md's /v1/magpie/quotas section names holds/holdsWhy and each reason; providers-accounts.md's Allowance row names the hook. Run (sandbox HOME, -tags nogui, -p 1): - New TestQuotaReportTellsWindowHolds (provider), TestQuotaReportsReckonByTheLog (usage, against a real usage.jsonl in the sandbox) and TestHeldKeyToldNoWindowHolds (gateway) pass. - Broken by hand: the ReckonHolds call in quotaReport skipped → provider test FAIL "reckoned 0 times over 0 cards"; Holds/HoldsWhy not copied into QuotaSpan → FAIL "5 hours told no whole"; usage's init removed → usage test FAIL "provider.ReckonHolds isn't set"; quotaScope not clearing them → gateway test FAIL "a held key was told 5 hours's whole". - go test ./internal/provider ./internal/usage ./internal/cli ./internal/gateway: ok. - gofmt -l clean; go vet -tags nogui darwin, GOOS=linux, GOOS=windows on provider, usage, gateway: ok. - Not run: the GUI suite (no GUI file changed), and against the owner's real accounts. Full suite: SUITE_LINE |
||
|
|
d8d52c6e97 |
agent: Raycast is an agent magpie connects: a magpie entry in its Custom Providers' providers.yaml, magpie's models in Raycast AI's picker (lx_78654 on Discord)
lx_78654 asked on Discord: "agents能否加一个raycast". Raycast AI takes models of the user's own as Custom Providers (Raycast Pro, "Available on: Mac, Windows"), from ~/.config/raycast/ai/ providers.yaml in the user's folder on both systems (https://manual.raycast.com/ai/custom-providers). Raycast watches the file, so no restart notice. What changed: - internal/agent/raycast.go: a new agent, "raycast". One field, provider: connecting adds an entry, id magpie, to the providers list: the gateway's /v1 (OpenAI compatible, no /chat/completions), an api_keys alias holding magpie-raycast (Raycast's User-Agent isn't known, so its key tells it apart), and one model per magpie model with name, context and all five abilities said (Raycast assumes tools and vision off when left out): tools and system_message on, vision for a model taking images, temperature off for one that refuses it, reasoning_effort for one with effort levels. ListsModels: the model is picked in Raycast. - The list is edited as a yaml node, so the user's other providers, the top-level tools block (anchors too) and comments stay. - A key the user adds to magpie's entry or to one of its models (include_user_email, a description) is kept on a sync; a model gone from the catalog leaves the list. A sync with nothing to change doesn't write. - Disconnect takes the entry out, the list when it was the only one, and a file left with nothing in it (Raycast's providers.template.yaml is never touched). A providers key that isn't a list is refused and the file left as it is. - Detected by Raycast.app (com.raycast.macos) or the ~/.config/raycast folder. - agents.go: registers it. - icons/raycast.svg: Raycast's mark from Simple Icons (CC0), currentColor. - docs/reference.md, docs/subsystems/agent-wiring.md, README.md, README.zh-CN.md: Raycast's row and its place in the agent list. What was run: - go test -p 1 -tags nogui ./internal/agent -run '^TestRaycast' in a sandbox HOME: ok. The fixture is the manual's LM Studio and tools examples, with comments and an anchor; the result is decoded strictly (KnownFields) into the manual's schema. Red by hand when I: - turned off the no-op check ("a sync with nothing to change wrote"); - replaced the merge with magpie's entry alone (the user's include_user_email and a model's description gone). - go test -p 1 -tags nogui ./internal/agentenv: ok. - The whole ./internal/agent package didn't finish here: the first run hit the 10m default timeout at TestInstalledVersion with the machine at load ~110 (other sessions' suites), the second (-timeout 40m) ran 20 minutes with no FAIL and then stopped on "no space left on device" when the disk filled (0 GB free, not this run's files). It needs a run on CI. - gofmt -l; GOOS={darwin,linux,windows} go vet -tags nogui ./internal/agent: ok. Not tried with a real Raycast. On Windows it is found by the ~/.config/raycast folder only (its install path isn't verified). WSL isn't covered. Full suite: SUITE_LINE |
||
|
|
ecaa7e7dd7 |
gateway: a decision provider of several keys asks the next when one is out of quota, at /v1/systemone and as a classifier, in its routing's order (fflake33 on Discord)
A TypeSafe Jev provider with several keys never left its first key when that one's quota ran out. serveSystemOne and the classifier (askClassifier → askJev) always sent to p.Key, with no rest and no rotation. Only a decision group failed over (serveDecisionGroup, askDecisionGroup). Now the single provider goes the same way as a group: - decideKeys plans its keys and accounts with s.plan, so Smart or In order, rests and barred keys apply. probeOne keeps only the resting one back soonest. - serveDecideTries and askDecideTries (the group's loops, pulled out) ask each in turn. A retryable failure that isn't the request's own rests it and the next is asked. - serveSystemOne keeps #905's limits. A gateway key held to some accounts is asked only on those (allowedCandidates), and gets 403 keyAccountsError when none serves the model. - A provider whose every key is set not to serve the model is refused 403 (barredError) instead of being sent on its first key. - decideSeat is gone; the trace lists every key tried. - docs/subsystems/gateway-routing.md says so. Run: go test -p 1 -tags nogui -run 'SystemOne|Decid|Decide|Jev|Classif| KeyAccount|KeyModel|Disabled|RemoteMagpie|Caller|Usage|Plugin.*Decide| Barred|Rest|Probe' ./internal/gateway (ok, 124s). TestDecisionProviderKeysFailOver (Smart and In order) refuses the first key 429 and checks: - /v1/systemone answers 200 from the second, the trace has two tries and the first rests, and one usage row goes to the provider; - the next request asks only the second; - the same holds through askClassifier. Broken by hand: with the old decide.go, decide_group.go and classify.go it fails "systemone: 429 no capacity for k1" in both. The first version of the reordering ran the barred check before the held-key one, and TestGatewayKeyAccountsSystemOne caught the changed 403 message. The held check now runs first. gofmt -l clean; GOOS=darwin/linux/windows go vet -tags nogui ./internal/gateway ok. Not tried against the real TypeSafe API. Full suite: SUITE_LINE |
||
|
|
e894443932 |
trae: a check-in Trae CN refused 9074 says Trae refused it and to check in in the Trae CN app, not that Trae pays only its own app (#1920)
#1920 showed Buddy Switch checking in third-party Trae CN accounts, so
"Trae CN only gives check-in credits to its own app" wasn't true. What is
known is that Trae CN answered the claim 9074 (当前参与用户太多). The
own-app outcome stays as it was (the day's answer, no Check in now), but a
Trae account (By "trae") now has its own text in every place it shows:
- GUI card and Settings line: two new keys in en, zh, zh-TW, ja and de
("Trae CN refused this check-in (9074: too many taking part); check in
in the Trae CN app" / "Trae CN 拒绝了这次签到(9074 当前参与用户太多),
请在 Trae CN App 里签到"). WorkBuddy keeps the shared own-app key.
- TUI line and cell, CLI: provider.TraeRefusedWords; the cell says
"签到 refused by Trae CN (9074) · check in in its app".
- trae_checkin.go, workbuddy_checkin.go and provider-plugins.md comments
and the claim's fallback message say the same. They also note the
plugin side: since @magpie-community/opencode-trae-auth 0.2.14 the
account the machine's own Trae CN client is signed in as checks in with
the client's device id, read only. No id is made up or rotated (#1705).
Ran (worktree at origin/main
|
||
|
|
fa725d47cd |
gateway: a rule naming a group in the group that shares its models with one ahead of it sends the turn there, in that group's own order, not unready (#2361, davisjiahao)
davisjiahao's Parent held First (Alpha, Beta) and Second (Beta, Alpha), with
a rule sending every request to group/second. Each request came out
"use=group/second, unready=true" and First's Alpha answered; with Beta
failing, Second's own failover (Beta, then Alpha) never happened, as Beta
was never asked.
membersOff walks the group down and keeps each provider/model/effort once,
where it meets it first (so a request never asks one model twice), and
dropped every later place of it. Second's models were all First's, so a
rule naming group/second (named, ruleMembers) found none of them.
Each member now keeps its later places in Member.Also, each with its own
path, way down, Fast and At (where the walk met it, so a group's own models
come in its own order). A model is still asked once a request. A rule
naming a group has the models as that group does (Member.In,
membersNamed), sorted by that group's order, for the rule's own and its
Then members. Further down the turn, nestedRules looks at the rules of the
group the rule chose (homed, at the top and at each nested rule naming a
group), Fast and the first token's wait go by it (homeCands), the length a
held rule outgrows (memberContexts) counts it, and the catalog's rule
capabilities (ruledEntry) find it. A pause rule naming the later group
still leaves a shared model to the group ahead of it, as before.
Tested, in the gateway through New().Handler(), the reporter's config
with a token rule in place of the agent one:
- TestRuleNamesAGroupSharingModelsWithOneAhead: all ready, Beta answers,
rule not unready; Beta 402, Beta then Alpha; both 402, two tries.
- TestRuleNamesAGroupSharingSomeModels: First (Alpha, Beta), Second
(Beta, Gamma): Beta, Gamma, then Alpha.
- TestRuleGroupSharingModelsKeepsItsRulesAndTurn: Second's own rule picks
Alpha (Nested shows second), and the turn's tool round stays there.
Broken by hand, each run with -run on the three:
- every source file put back: all three FAIL ("from ka", unready);
- no sort in membersNamed: WithOneAhead FAILs (Alpha first);
- nested rules given ms, not homed: KeepsItsRulesAndTurn FAILs (Beta,
Second's rule never looked at);
- dedup off (the later place appended as well): WithOneAhead and
SomeModels FAIL.
TestRuleNamesAModelAGroupInItHasToo (#625) passes. gofmt -l clean; go vet
-tags nogui ./internal/gateway ./internal/provider for darwin, linux and
windows ok. go test -tags nogui -p 1 -timeout 45m ./internal/provider ./internal/gateway: ok (263s, 518s, load ~30). A first run at the default 10m timeout ran out in internal/gateway under that load, in a TempDir cleanup, no test failing.
Not tried: an agent-matched rule against the installed binary (the rule's
match is the same code either way), and Fast differing between two groups
sharing a model end to end.
Full suite: SUITE_LINE
|
||
|
|
6e2aa8e321 |
agent: on Windows DeepSeek Harness is never taken for uninstalled by ~\.dsh alone, so it no longer shows "CLI not found" with no model to pick (#2300, yangkai2; #2304, wlj521)
From v0.1.1239 ( |
||
|
|
2a1637f4f6 |
agent: DeepSeek Harness Desktop is wired when installed but never opened, and found in any folder it was installed to on Windows (#2279, liangjinyuan-sihan)
DeepSeek Harness Desktop already reads magpie's route: its lib/main.js
(0.2.0-rc.2, the latest on its update feed, read from download.deepseek.com's
dmg and Windows installer) resolves $DSH_HOME, else ~/.dsh, and runs on
profiles/desktop, so the CLI's wiring applies. Three gaps remained:
- Installed but never opened, there is no ~/.dsh: the row wasn't listed,
and connecting wrote the legacy config.yaml the app never reads. magpie
now writes profiles/desktop/cordis.patch.yml from dsh's own template
(PROFILE_PATCH_TEMPLATE) with its routes; the app's initProfile writes
only missing files, so its first start keeps them. The notice says it
starts on this when first opened (noticeDsh5, in all 5 languages).
Disconnect before that first start removes what magpie made, when
nothing else is there; afterwards only magpie's entries go.
- On Windows the installer lets the user pick the folder and registers it
under HKCU\Software\1bf39983-50d0-5fe0-9ef4-cece76f67c5e InstallLocation
(read from the NSIS script of dsh-latest-windows-x64.exe). magpie reads
that, so a custom folder is found, and the Uninstall entry's
DisplayVersion gives the version shown.
Tests: TestDshDesktopNeverOpened (pick on a never-opened app writes the
desktop profile, a user's key in .credentials.yaml and the user's own start
survive Disconnect, the app's first start is told apart),
TestDshDesktopRegisteredFolder (registry stubbed; exe must be there; WSL
twin has none).
Run on this tree, rebased onto
|
||
|
|
7cad9a6185 |
agent: magpie's own files written during a sync with ~/.config a link are left alone, and the window's size saved after a resize no longer hangs the app for good (ylorn on Discord)
ylorn (v0.1.1250, macOS arm64, ~/.config a symlink): ~10s after every
start the GUI froze, beachball, CPU ~0, SIGTERM ignored. Their SIGQUIT
stack: the window's resize timer -> settings.Save (fileMu write lock) ->
edit.WriteAtomic -> the sync's filter keptAway -> gateway.URL ->
settings.Load -> fileMu.RLock, the same lock, forever.
Cause: edit.Filtered's filter sees every file written through edit while
a sync runs, from any goroutine, under whatever lock the writer holds.
keptAway read the settings (gateway.URL, and access.LANSecret through
ourToken) inside it, and skipped magpie's own files by a prefix check on
the unresolved ~/.config/magpie while WriteAtomic hands it the path
edit.Target resolved, so with a linked ~/.config settings.json fell
through to the settings read.
Fix (the class): what the filter needs of this magpie, the gateway's
address and the LAN key, is read before it is on (keeping(), kept.away,
kept.ours), so the filter takes no settings or access lock. magpieFile
compares magpie's folder as named and as EvalSymlinks resolves it, with
the written file's folder resolved too (for a file not there yet).
Siblings found: wslSaveLocked writes wsl.json under wsl's mutex, and the
filter's wslHost takes that mutex: with a linked config folder the same
self-deadlock on Windows (now skipped as magpie's own; the test covers
it). access.save writes keys.json under access.mu, which LANSecret took
inside the filter (now read before). No other prefix check against
provider.Path()/appdir gets a Target-resolved path; the filter is
edit.Target's only consumer of that kind. edit.Filtered's doc now says
the filter waits on nothing.
Run at this head (macOS arm64, go1.26.8, -tags nogui, -p 1):
- TestOwnWritesDuringASyncWithALinkedConfig (new; sandbox HOME with
.config a symlink): on origin/main
|
||
|
|
f15542d2ea |
sessions: OpenCode 2 subagents show their type, and a Kimi Code subagent opens on its task, not a context chip (#2290, infinitr0us)
OpenCode 2.0.29 keeps a child session's agent in session_v2.agent and
titles it with the task alone, so ocSubagentTitle found no kind and every
OpenCode subagent row showed only its title and time. The kind now comes
from session_v2.agent when set (ocV2DB.agent, kept once found; a missing
column or NULL reads as none and isn't kept), and the "(@agent subagent)"
title split stays the fallback for older versions.
A Kimi Code subagent's own wire.jsonl starts with the task its parent
gave it, a turn.prompt whose origin is {kind: system_trigger, name:
subagent}; the transcript folded every system_trigger as context. In a
subagent's own wire (not agents/main) that prompt now opens as its first
user message (kimiTask). Other system triggers, and a "subagent" one in
the session's main wire, stay folded.
Fixtures follow the reporter's described shapes: ocMakeV2's real
session_v2 schema with agent 'explore' and a task-only title beside a
child with no agent and an older suffixed title; a 1.5-shaped subagent
wire (agentId, promptId, turnId) with the subagent trigger, a reply and a
background_task trigger, plus a subagent trigger appended to main.
No real OpenCode child sessions or Kimi Code subagents on this machine.
No GUI change: the Sessions client already draws a subagent's kind.
Run: TestOpenCodeV2SubagentKind and TestKimiSubagentTask fail on the old
subagents.go/transcript_kimi.go (no kind; user/context first), and
TestKimiSubagentTask fails with the agents/main scope check dropped.
go test -p 1 -tags nogui ./internal/sessions/ ok at the rebased head;
gofmt -l clean; go vet -tags nogui ./internal/sessions/ for darwin,
GOOS=linux and GOOS=windows.
Full suite: SUITE_LINE
|
||
|
|
540454acec |
gateway: a turn on Codex's own ChatGPT sign-in is counted on that account, so the card's window holds see it (#2297, Edward4226, ggbdpq)
codexUpstreamOn wrote the relay's ledger row as Provider: call.Provider
("openai") with no account. The account card's window holds key rows by
codex + the sign-in's email (usage/window_holds.go), so every turn Codex
relayed on its own sign-in was left out: the reporter's 7-day window read
2.3M/$0.31 where its calls were 19.0M/$64.26.
codexServed (ggbdpq's patch) records such a relay as the codex account
signed in to, or the account compactOn signed it with. An API-key call
and a relay with no sign-in to name stay openai with no account. The
Routing view's seat stays OpenAI. loggedAnswers (#1367) still leaves the
relay out of a lead's answerers, as openai or as codex without a
"host as email". Rows already written are not rewritten.
On top of the patch: the relay goes out with the token Codex sent, which
is the sign-in magpie reads only when it is the same ChatGPT account. A
request whose chatgpt-account-id isn't the account auth.json here is
signed in to (a Codex in WSL, another CODEX_HOME) stays openai rather than
being put on this machine's account (provider.CodexSignedInAccount).
TestCodexServedNamesTheAccountThatSigned is back and covers it.
Run, go1.26.8 darwin/arm64, on
|
||
|
|
7faf55778a |
gateway: OpenCode's DeepSeek is sent no deferred-tool blocks, and an inline-only tool definition joins tools (#2338, Emaj77)
Claude Code's deferred tools put tool_addition / tool_removal / tool_reference blocks in a message. OpenCode Go's DeepSeek route answers one defining a tool with a bare 422 "Upstream request failed: Endpoint is unavailable.", which names nothing deferredRefused can learn from, so every turn went out the same way and failed the same way. The reporter checked it straight against opencode.ai/zen/go/v1/messages on 2026-10-15 (3/3 422 inline, 3/3 200 plain and with the definition in tools). forwardOnce now drops the blocks for a Messages request to an OpenCode host (p.IsOpenCode) whose model names deepseek, as it already did for Kimi (#2042). Other OpenCode models and every other provider are sent the blocks as Claude Code wrote them; no retry or fallback is added. withoutDeferredTools assumed every tool was also in the top-level tools. A tool defined only in a tool_addition's definition was dropped, so the model could no longer call it; that held for Kimi too. Such a definition now joins tools once, by name, a top-level definition of the same name winning; ToolSearch's tool_reference inside a tool_result stays. A later tool_removal is not applied to tools (out of scope, as before). Run (go1.26 darwin/arm64, sandbox HOME, -p 1 -tags nogui): go test ./internal/gateway -run 'TestOpenCodeDeepSeekInlineTools| TestDeferredInlineDefinitionPreserved|TestKimiIsSentNoDeferredToolBlocks| TestDeferredToolBlocksRefusedOnceLeftOut|TestOpenCodeGoModelsGoOnTheirOwnAPI| TestRefsOnly|TestRefsSaid|Deferred' -count=1 -> ok, 14 pass Broken by hand: - forwardOnce's condition put back to isKimi alone: TestOpenCodeDeepSeekInlineTools/go/deepseek-v4.1-flash fails with the reporter's 422. - withoutDeferredTools not writing tools back: both new tests fail ("inline definition was not preserved", "tools lost or duplicated"). gofmt -l clean. GOOS=windows and GOOS=linux go vet -tags nogui ./internal/gateway clean. Not run: other packages, the GUI suite (disk had under 1 GB free); not tried against the real OpenCode Go endpoint through magpie (the reporter's direct requests are the evidence). Full suite: SUITE_LINE Co-authored-by: cyh <2293985047@qq.com> |
||
|
|
5ca897690f |
library: an instructions set linked to the file an agent reads is read without magpie's part, so it isn't written into itself until gigabytes (#2349, eachann1024)
instructions.md linked to ~/.claude/CLAUDE.md (or both linked to one
dotfile) made the set's text the whole file, magpie's part included.
wanted() read it as is, syncInstructions wrote it into that same file's
part, and split() only knows the first begin/end pair, so the part never
matched and each sync nested the whole file in it again: the file doubled
at every sync. linkable() refuses an agent's own file for a set kept in
the user's file, but the default set's instructions.md being a link went
around it.
- setText reads a set's text with every magpie part taken out; used where
the set's text is read (wanted, the page, ImportInstructions, carry,
setup snapshot/compare).
- own() takes out every part, and the end lines a part nested in itself
leaves behind, so a file already grown comes back to the user's text.
- An agent whose instructions file is, links followed (realBelow), the
file the set on is kept in gets no part; one written before is taken
out, the file kept aside first. ImportInstructions refuses that agent.
- docs/subsystems/library.md: Instructions row.
Run (worktree on origin/main
|
||
|
|
1242367020 |
gui: the menu bar's idle tooltip splits today's tokens into input, output and cache (NextCommit on Discord)
With no cards ticked, the tooltip said only "Today: 6.3M tokens". It now says "Today: 6.3M tokens (912K in · 318K out · 5.1M cached)" over the cost and requests, as the usage:today card's tooltip has since #1984 (trayTokens, shared by both; cached left out when nothing was cached). Run: TestTrayIdleTip and the SNI tip case, updated. gofmt -l clean. Full suite: SUITE_LINE |
||
|
|
49d60394ef |
gui: the Mac's menu bar item shows its tooltip, which Wails never set there (NextCommit on Discord)
NextCommit (macOS, 0.1.1244) hovered the menu bar item for today's
tokens split into input, output and cache and saw nothing. Nothing was
shown at all: Wails v3.0.0-beta.24's macosSystemTray.setTooltip is a
no-op ("Tooltips not supported on macOS"), so neither the idle tip nor a
card's tooltip (usage:today already said "6.3M tokens (912K in · 318K
out · 5.1M cached)") ever reached a Mac. Linux has its own setTrayTip
(SNI); Windows keeps Wails'.
setTrayTip on the Mac now sets the status item's button toolTip on the
main queue (trayTipNative, mpTip in trayimage_darwin.go), returning false
while the item isn't up yet so it is tried again, as Linux's does.
Run: TestMacTrayTipIsSet (darwin, cgo): setTrayTip reaches the native
setter, false before the item is up, and a real NSStatusBarButton keeps a
multi-line tip whole. go vet: darwin (cgo, GUI) and -tags nogui for
darwin, linux and windows. Not tried: hovering the icon in a built app.
Full suite: SUITE_LINE
|
||
|
|
6f6b7d4077 |
gateway: a Codex request with web_search stays alive while its provider is queued, not cut at Codex's idle timeout (#2316, clxsh)
A request that offers web_search to a model that can't run it goes through
searchReply, which reads the provider's reply in rounds. That reader used
readSSE, so the provider's keepalives (": keepalive", response.in_progress)
were dropped, and relay waited for the first event past KStart before it
made the client's encoder. A provider queued for minutes sent the client
nothing but the holdWriter's comments, which Codex's idle timeout doesn't
count: it hung up at ~315s and asked again, losing its place in the queue.
The plain translated path has kept the client alive since #436.
Now askTranslated reads with readSSEAlive and, after keepaliveGap with
nothing else sent, hands its reader a KAlive event (nothing of the reply).
searchRounds passes it on without collecting it, the collector ignores it
(no reasoning block boundary moves), and relay takes it as the provider
being heard from: it begins the client's stream and sends the protocol's
own keepalive (response.in_progress, Anthropic's ping) when the client has
been quiet keepaliveGap. A provider that goes silent sends no KAlive, so
relayEvents' keepaliveLongest still ends the keepalives; an error before
any keepalive is still a status for the next account.
Test: clxsh's TestSearchQueueKeepsCodexAlive as filed (comments, progress,
cancel, silent). On the old code all four fail (pings=0 complete=false,
only comments reach the client); with the fix they pass, -count=3.
Run: go test -tags nogui ./internal/gateway -run
'Search|Keep|Alive|Relay|Zen|Draw|Probe|Held|Hold|Queue|Codex.*Stream|Translated'
ok (75s); gofmt -l clean; go vet -tags nogui ./internal/gateway on
darwin, linux, windows clean. Not tried against a real queued provider.
Full suite: SUITE_LINE
|
||
|
|
b9e5c28997 |
gui: a Library MCP server magpie can't check for a variable only its agent sets shows not checked, not a red error (#2308, ASD-max)
Codex's host-only codex_app (codex-app-tools, imported into the Library)
names ${CODEX_APP_TOOLS_PIPE_PATH} and ${CODEX_MCP_NODE_PATH}, which only
the Codex app sets when it starts the server. magpie's check expands them
from its own environment, finds them unset and returns novar before
starting anything. The page painted that red, the same as a server that
exited or doesn't answer, so a working server read as broken. Its tooltip
already said magpie can't check it there.
A novar result is now painted as not checked: a grey ring and muted
words ("CODEX_APP_TOOLS_PIPE_PATH, ... not set"), the same tooltip. Other
errors stay red. The check itself is unchanged: magpie doesn't start
codex_app with Codex's pipe, as the reporter's own probe shows Codex
turns away a peer that isn't its signed binary
(untrusted-code-signing-identity), and it doesn't learn the pipe's path.
Run: library-env-refs.test.cjs (Chromium and WebKit, en/zh/ja/de at
440px) now also checks the novar status isn't "err" and isn't the red
colour; with client.js put back to HEAD it fails. library-env-refs and
library-mcp-health pass (16). Go tests not run (no Go file changed; disk
under 6G free).
Full suite: SUITE_LINE
|
||
|
|
206dc24cd5 |
gui: with the Sessions page switched off, a latest session on Usage unfolds its details, not a click that does nothing (#2311, betacatZ)
Usage › Sessions' latest sessions open on the Sessions page. With that page switched off in Plugins › Built-in (the reporter's screenshot has no "All sessions" beside the search, which is hidden the same way), the row still looked like a link, with a chevron and a pointer, and a click returned without doing anything. Now, with Sessions off, the row is a button (aria-expanded) that unfolds the session's details in place, as a top session's do: time, folder, session id, the resume command, what each model spent, the file. One is open at a time, Enter and Space fold it, and nothing scrolls. With the page on, a row still opens there. Run: internal/gui/tests/sessions-usage-off.test.cjs (new, 12 cases: Chromium and WebKit, en and zh, 900 and 420px) passes; with page.js put back to HEAD its 4 Chromium "off" cases fail and the "on" cases pass. sessions-usage-open, sessions-paging, sessions-in-range, sessions-overview and builtins pass (84). Go tests not run here (disk under 6G free); no Go file changed. Full suite: SUITE_LINE |
||
|
|
75035fa202 |
gateway: Command Code's bare 400 (a trace id, no reason) hands a group's request to the next member, not ends it (#2313, lqisgod)
Command Code's Provider API answers some requests with
{"message":"invalid request error trace_id: <hex>","type":"invalid_request_error"}:
a 400 (a 422 the week before), no code, no param. retryable() read it as
the request's own fault, so a group stopped there and its later members
were never asked: six requests in a row on lqisgod's wb-flash group, while
the fourth member answered the same ~660K prompt that hour.
What it turns away is the request's size, not the key: lqisgod's A/B on
one agent conversation (~748K tokens of history and tool calls, same bytes
otherwise) answered 200 with max_completion_tokens 64000 and this 400 with
384000, the max output Command Code lists for the model, so history plus
asked-for output is over a limit below the 1M context it lists. Its own
tracker has more of the kind (CommandCodeAI/command-code#960, #976).
Another member whose model has room may take the same request, so it is
asked, as for a shape another API can take.
unsaidWords matches that message alone, as the vendor sends it, wrapped by
a client in front of it, or told on after a provider's name. It goes the
way shapeWords do (shapeRefused, retryable): the next member is asked once,
Command Code doesn't rest, and the last member's error reaches the agent.
No retry of the same member is added. Its overflow ("The input is longer
than the model's context length trace_id: …") and a refusal naming a param
aren't matched. The keyed "commandcode" preset and the moved plan go
through the same gateway decision.
Tested: TestGroupFailsOverCommandCodesBare400 (streamed group request,
reporter's literal body; the 422 and wrapped forms from #960/#952; overflow,
param and longer-message negatives). With fallback.go put back it fails:
"400 ... COMMANDCODE: invalid request error trace_id: ... (a 1, b 0)".
go test -run 'TestGroupFailsOver|Shape' ./internal/gateway passes.
Full suite: SUITE_LINE
|
||
|
|
94c70a2dd9 |
gui: the tray's Allowances cards say "Resets 14:26", not a bare ↻ that read as a button, and each card has the Usage page's own refresh (#840, hhh2210)
In the tray panel the first reset deadline was drawn as "↻ 14:26": text
with no click handler, which reads as a refresh to click (hhh2210 clicked
it). It now uses resetText, "Resets 14:26" / "重置于 14:26", as the
Usage page does; the other windows keep "Weekly Oct 31".
The tray cards also had no per-card refresh. They now get the main
window's quotaRefresh, the same single-card API and response-order
guard, at the start of the line under the account (the deadline, the
error, "Unlimited", or a balance's name): opened as the card is hovered
or the button is focused, spinning while it reads, closed taking no room
(the balance row's flex gap is closed with it). renderPanelQuota puts the
focus back on the button after the redraw. A failed read keeps the
figures and says the error in the footer, as on the Usage page.
Based on hhh2210's fork commit 9ea883ffb. Kept: the reset label, the
refresh on every tray card kind, the focus kept through the redraw, the
test's fixtures. Trimmed for the owner's UI restraint: the always-visible
24px button and the new "Updated N ago" row on every card (now hover-
revealed in the existing line, as on the Usage page), and the new status
texts (reading / cached, no new data / refresh failed / Claude's 30s
interval), which the Usage page's own refresh doesn't have either. No new
strings: "Resets {when}" and "Refresh this card" exist in every language.
Run (macOS arm64, Playwright 1.62.0, Chromium and WebKit):
- panel-quota-refresh.test.cjs, rewritten for this behaviour: 20/20,
en/zh/zh-TW/ja/de at 440 and 360px tray widths.
- Broken by hand, each red with its own message: the ↻ label back ("the
deadline says 重置于, got ↻ 14:31"); no refresh in the deadline line
("has its own refresh"); no focus restore ("the redraw keeps the
focus"); no .pq-card:hover rule (hover never opens it); the error card
without one ("kimi has its own refresh"); without the .pq-bn margin the
closed button moved the balance's logo ("relay's closed refresh moves
nothing").
- 68 GUI files that open the tray's Allowances or the Usage refresh
(every mode=panel file reading usage/quotas, usage-card-refresh,
quota-balance-error, usage-remote-*, quota-read-at): 943/944. The one
red, usage-fold chromium "the view didn't scroll" 184 !== 180, is red
alone on origin/main
|
||
|
|
ff2e6e2314 |
gateway: Cline's daily limit on one free model rests that model alone, until the time it names, not the whole key (#1398, wuasakura)
Cline answers a free model's daily cap with 429 "Daily free limit reached on model X. Try again in 23h 59m". failure() reads "daily" as quota, so the whole key rested for 15 minutes and every other free model on the account was refused without being asked; the reporter saw the account sent to the back of the list after one model's limit. The limit is per model by Cline's own words, and Cline's client treats it so (CLINE_FREE_MODEL_LIMIT_MARKER "free limit reached on model" and the "try again in" reset parse in cline/cline sdk errors.ts). So for a Cline provider (ClinePinnable: ClinePass, a cline.bot host, the Cline plugin) that refusal now rests restID() (that model) for the time it names (By "resets"). Another vendor's same words, and a Cline 429 that doesn't name a model's limit (5-hour/weekly, "Rate limit exceeded"), rest the key as before. No per-provider toggle: it would make account-wide 429s hit the account once per model, the risk-control pattern the gateway avoids. The Cline plugin's "usage limit reached: <body>" keeps the words (checked with node on its failure() for all three body shapes), so moved users get it too with no plugin change. Run on |
||
|
|
92ac1c878e |
search: the web search MCP server has a web_fetch tool that reads a page by its URL (#2286, blackrion)
An agent that mounted magpie's web search over MCP (Cursor, Claude Desktop) found pages it couldn't open: it has no fetch tool of its own. web_fetch (url, max_chars, offset) reads one. - The URL is the agent's, so the page is downloaded the way a caller's image is (publicClient): public addresses only, every resolved address checked and pinned, redirects (at most 5) checked the same, a request from this computer included; only http and https. 30 s and 5 MiB at most. - HTML is decoded from its charset (x/net/html/charset; golang.org/x/net added) and given as Markdown: title, headings, lists, links made absolute, code and pre; script, style, hidden elements dropped. Other text as it is; anything else, or a 4xx/5xx, is the tool's error. - 20000 characters by default (at most 100000) from offset, with the offset the rest starts at. - Each call reserves the gateway key's limit, as a search does. - The tool description is neutral (names neither magpie nor a vendor). - GUI: the MCP row's text names both tools (en, zh, zh-TW, ja, de). Docs: gateway-routing's MCP section, README (en, zh-CN). Run: go test -tags nogui ./internal/gateway -run 'WebFetch|SearchMCP'; GOOS=linux/windows go vet ./internal/gateway; gofmt -l clean. GUI: search-mcp, i18n-keys, gui-ja, gui-de, gui-zh-tw 32/32 (chromium + webkit). Broken by hand: webFetchClient = http.DefaultClient turns TestWebFetchOnlyPublic red (the local test server was reached). Tried by hand (a throwaway test, not committed) against go.dev/doc, en.wikipedia.org/wiki/Magpie and http://github.com/yetone (redirected to https; links come out by name, not the pinned address: the first try gave https://216.239.34.21:443/..., fixed by taking each redirect's URL from CheckRedirect), and an httpbin redirect to 127.0.0.1, refused. Full suite: SUITE_LINE |
||
|
|
ec13d1162a |
search: the search APIs are dragged into the order they are asked in, and each switches off without losing its key (#2286, blackrion)
The search APIs were asked in the order they were added, and the only way to keep one out of the chain (to try another alone, or rest one whose credit is nearly spent) was to remove it and paste its key again later. - provider: SearchAPI.Off; SearchAPIs() leaves an API switched off out, so neither a model's search nor the web_search MCP asks it. SwitchSearchAPI keeps key, URL and place; SetSearchAPI keeps Off. ArrangeSearchAPIs puts them in the vendors' order, refuses an unknown or twice-named vendor, and keeps one not named after them. RestoreSearchAPIs now puts a backup's APIs in the backup's order (one only here after them), so a restored order and Off come back as they were; sync already mirrors the list. - GUI: each API's row and its keys' row are one unit, dragged off its buttons with dragRows (as routing's groups, #779) or moved with Alt+↑/↓, renumbered at once, focus kept, redrawn as saved if the order is refused. A lib-switch per row posts {vendor, on}; one off is dimmed and says Off; Search first with counts only APIs that are on. The row's buttons wrap instead of running past a 420px window. - CLI: magpie search off|on <api>, move <api> <n>; the list says off. - POST /api/settings/search-api takes {arrange} and {vendor, on}. - Docs: gateway-routing "The search APIs' order, and one switched off", gui-shell, README (en, zh-CN). Run: go test -tags nogui ./internal/provider ./internal/cli ./internal/gui ./internal/gateway (TestSearch*) ./internal/backup ./internal/davsync; GOOS=linux/windows go vet of the touched packages; gofmt -l clean. GUI: search-order.test.cjs 16/16 (chromium + webkit, en/zh/ja/de, 1100/420), and search-api, search-first, search-instead, search-keys, search-mcp, searcher-pick, i18n-keys, gui-ja, gui-de, gui-zh-tw 100/100. Broken by hand: SearchAPIs without the Off filter turns TestSearchAPIOrderAndOff and TestSearchCLIOffAndMove red; the GUI counting off APIs for Search first turns search-order red. Full suite: SUITE_LINE |
||
|
|
4ad929fd4d |
gateway: a native compaction a fallback seals is recorded to it, and its next turn goes there with the compaction, not answered 200 without it (#2271, JasonBuildAI)
With native compaction on for a provider, Codex's compaction_trigger
goes to any candidate whose wire carries it, a fallback included. The
compaction watcher recorded the writer only when the candidate that
answered had native compaction on itself (`if s.compactsNatively(...)
{ sealedBy = &c }`), so a fallback's seal went unrecorded. The next turn
carrying it then either went to another provider, which refused the
foreign item, and magpie dropped it (withoutCompaction, guarded only by
`checkpoint == nil`) and answered 200 without the compacted history; or
went to the fallback translated, since keepsCompaction kept a sealed
compaction only for a provider set to compact natively, and the
translation left the item out.
Fix:
- the writer is recorded whoever answered: the watcher exists only when
the trigger was kept, so whoever answered sealed it;
- keepsCompaction also relays a sealed compaction to the provider
recorded as its writer (checkpointOf), whatever its own setting;
- checkpointError no longer says "native compaction is on for <writer>",
which isn't so for a fallback;
- docs/subsystems/gateway-routing.md says so.
Test: TestNativeCompactionFallbackSealStaysWithItsWriter (fa native,
falls back to fb, native off, which seals; a third provider). Broken by
hand, each part fails it:
- recording only native writers: the other provider answers 200 with
the seal dropped;
- keepsCompaction ignoring the record: the writer's next turn (Codex's
shape, offering web_search) goes translated without the seal;
- the old wording: the error says native compaction is on.
Run on the rebased head (origin/main plus #2274 and this):
go test ./internal/gateway/ -count=1, gofmt -l, go vet -tags nogui for
GOOS=darwin/linux/windows ./internal/gateway: see the ready note; all
green before this was handed over.
Full suite: SUITE_LINE
|
||
|
|
51d5b8d0b2 |
gateway: a Codex compaction's summary cut short or 429'd halfway fails over and rests the account, and one that keeps failing is held, not asked every 18s (#2274, huangzuomin)
Codex on antigravity/gemini-3.8-flash with context_management's
experimental mode asked magpie for 1169 summaries in 6 hours (8.44M
billed tokens), ending in 502 "compaction: the model wrote no summary".
Cause, in three parts:
- serve's holdWriter let the summary's stream through at its first
words, so Antigravity cutting it short ("the reply ended before it was
complete"), or a 429 "Individual quota reached" after some of it,
reached codexCompact as a 200 with an error: no failover, no rest.
- codexCompact took a summary that ended `incomplete`, or a body with
no response at all, as one.
- Codex's async compaction (codex-rs async_compaction) starts a
background compaction at every step while the conversation is over its
threshold and drops a failed one silently, so the history never
shrank and each step paid for the whole conversation again.
Fix:
- codexCompact marks its request askWhole; serve then holds the summary
stream to its end (holdWriter.wantWhole). A cut, an error event or
`response.incomplete` anywhere in it fails over to the next candidate
like a failure before content and rests the account as that would; a
model that reached its output limit rests nobody.
- With nobody left, the cut/incomplete summary is a 502 saying so, never
the words before the cut.
- compactFails (codex_compact_guard.go): after 3 failed summaries in a
row of one conversation (prompt_cache_key) on one model, each within
5 minutes, the next is answered 400 at once (Codex doesn't retry a
400) naming the last failure, until 5 minutes pass. A summary clears
it; 401/403 aren't counted. Decision: a 400 is the only answer Codex's
remote compaction stops on, and a per-conversation hold costs a user
whose model recovers at most 5 minutes, while the loop cost tokens.
- docs/subsystems/gateway-routing.md says so.
Run (worktree at origin/main
|
||
|
|
8a1b5916f3 |
sessions, usage, gui: one read of every call at a time, the Codex effort built once and kept, and the Sessions page asks for an overview once, so the app no longer grows to 85 GB (#2278)
On a long history (the reporter's: 68k call files in calls-v15, 415 MB;
42 MB usage.jsonl; 75k calls in 7 days), the app's main process grew to
85 GB in about 90 minutes and the gateway froze. `magpie serve` alone held
83-153 MB for 20 minutes (the reporter's follow-up), so the growth is in
the app's Sessions path:
/api/sessions/overview -> usage.CodexModelEffort -> LedgerOfAt ->
sessions.Calls(all history).
Why it grew:
- CodexModelEffort's cache key changes on every gateway write, and it
never kept an answer when usage.jsonl was missing or grew during the
build. So every /api/sessions, overview, /one and /manage ask with a Codex
session rebuilt the all-history ledger, gob-decoding every shard (only
64 stay in memory).
- Nothing joined concurrent asks.
- The page's 15s reload asked for an overview again while the last one
was still under way, so slow asks piled up.
What changes:
- sessions.Calls and the new AgentCalls go through sharedCalls. An ask
while the same read is under way waits for it and gets a copy, and
reads run one at a time.
- AgentCalls(since, "codex") reads Codex's files only. pruneCalls still
sees every file.
- CodexModelEffort is built from Codex's calls plus the gateway's records.
Only those name a Codex actor, and TestCodexModelEffortIsTheWholeLedgers
checks the answer equals the whole ledger's on a mixed Claude + Codex +
gateway fixture.
- One build per period at a time. An ask during a build gets the last
answer for the same home (root), or waits if there is none.
- The answer is kept when usage.jsonl is missing or grows during the
build.
- At most 8 periods are kept.
- page.js: sessOverview shares one promise per query, so the filter's ask
and the 15s reload's ask for the same overview send one request.
- docs/subsystems/gateway-sessions.md says this.
Reproduced (temporary test, not committed): a sandbox HOME with 62k
Claude Code session files, 5.9k Codex rollouts and 100k gateway records.
Sessions routes in-process, 4 rounds x 6 concurrent asks
(overview?days=0 and /api/sessions), a usage record appended every 300ms:
before (
|
||
|
|
d4244d5c19 |
gateway: a thinking budget the provider's Extra body adds is sent to Opus 5.5 as adaptive thinking, as an agent's is
forwardOnce turned a thinking budget into adaptive thinking for a Claude
that takes no budget (adaptiveThinking), then merged the provider's Extra
body (#1604). A budget written there, {"thinking":{"type":"enabled",
"budget_tokens":2048}}, went to claude-opus-5-5 as written, and Anthropic
answers that with 400. When the Extra body changed an Anthropic body, it
is fitted again (adaptiveThinking, then withoutRefusedShapes for the
display), so it goes as the agent's budget does. Found while looking into
(rc.44), not this.
TestExtraBodyBudgetFittedToAdaptiveModel: a fake that refuses
thinking.type enabled with Anthropic's words, Extra body with a budget,
a client sending no thinking. Broken by hand: with gateway.go reverted it
fails with that 400; with the fix, one request, thinking
{"display":"summarized","type":"adaptive"} and an effort.
Run at this head (rebased on origin/main
|
||
|
|
5ca37ef86b |
tray: Settings › Menu bar cost off shows magpie's today and 7-day totals as tokens alone, in the menu bar and its tooltip (BussanQ on Discord)
BussanQ asked for the menu bar's today card with the token count only.
A new Settings › Usage › Menu bar row, "Menu bar cost" (On by default,
segs, every OS, shown with or without cards since the no-card tooltip
says the cost too), saves settings.TrayNoCost. Off, trayMoney drops a
total's cost and its count of unpriced calls before trayTotalCard and
trayIdleTip see it, so the macOS cells and title, and the tooltip on
macOS, Windows and Linux, say the tokens and requests alone. A relay's
or subscription's balance card is money itself and stays. TrayNoCost is
per computer (KeepOwn, beside the other Tray* fields), and a change
redraws the tray (api.go). Translated in zh, zh-TW, ja and de.
Run:
- TestTrayNoCost (internal/gui): broken by hand (trayMoney a no-op) it
fails with label "Σ47M · $128 | Σ6.3M · $3.40+", want tokens alone,
plus the tooltip and idle tooltip.
- TestSync (internal/davsync) now sets TrayNoCost on one computer; with
TrayNoCost left out of KeepOwn it fails "b's menu bar: … TrayNoCost:true".
- tray-cost.test.cjs: Chromium + WebKit, en/zh/zh-TW/ja/de, widths 1100
and 420, Mac/Windows/Linux and no cards: 22/22 pass. With trayNoCost
dropped from the prefs it fails "a save of another setting keeps the
cost off". Also green: i18n-keys, tray-bird, tray-logos, tray-totals,
tray-usages, tray-usage-redraw, quota-pace, tray-inuse.
- gofmt -l clean; go vet ./... and -tags nogui for GOOS=darwin, linux,
windows clean.
- go test ./internal/tune ./internal/gui ./internal/settings ./internal/davsync
green at this head, rebased on origin/main
|
||
|
|
035c259a6d |
tune: Codex's compaction windows run to the model's own window or 1M, not the largest prompt seen (zhemu on Discord)
zhemu: Codex Desktop on a CLIProxyAPI provider's 1M GPT model, Settings ›
Long conversations at 750K; Usage › Context › "Other window…" stopped at
~412K. tuneOf took Codex's window as max(272K, the largest prompt seen),
so tune.Compact capped both the offered windows and the user's own value
at the largest prompt (~412K), whatever the model's window or the
user's setting.
Now codexWindow reads the window from magpie's catalog: a model with a
known window (typed or catalog) is offered up to it, and "now" is the
window magpie tells Codex (Settings' long-conversation value or the
model's own compaction, as codexcat writes it), 750K for zhemu. A model
whose window magpie doesn't know caps nothing short of 1M, and a mix
with one unknown is unknown. Codex's own models keep 272K or the
largest prompt. Claude Code is unchanged: only Claude models get the
advice, and other vendors' models use magpie's own window.
Run:
- TestTuneWindowsAreTheUsers (internal/gui), a custom provider with an
unknown window, 1M and 400K, on Codex and Claude Code. Old code:
"Codex on cpa/gpt-cpa-open: windows offered up to 410000; want
1000000" (and for 1m). Broken by hand: told dropped → "now 0, want
750000"; window=0 for unknown dropped → the mixed case fails.
- TestCompactUnknownWindowCapsNothing (internal/tune): old code "no advice".
- gofmt -l clean; go vet ./... and -tags nogui for GOOS=darwin, linux,
windows clean.
- context-tune.test.cjs (Chromium + WebKit): 70/70 pass.
- go test ./internal/tune ./internal/gui ./internal/settings ./internal/davsync
green at this head, rebased on origin/main
|
||
|
|
b00da3860c |
usage: a past cycle shows its own whole-window estimate, and a reset ends a dry run (#2009, #2010, NorethSea)
Ported from NorethSea's fork (abed2e224) and re-derived on main.
What it does:
- A known reset ends a dry run (a stretch where a window read 0% left), even
when the next poll sees the refill later. A stale dry reading taken after
its own reset no longer extends the run. Calls from the reset on are not
treated as "maybe paid from credits".
- A refill observed later than reset minus span
(QuotaPoint.StartsCycleAfter, the boundaries history sampling keeps)
starts what is reckoned. Calls before a fixed-deadline refill stay in the
cycle before it. A first reading is not a reset.
- Picking a past cycle in Usage > Allowances > Trends > Cycle asks
GET /api/usage/quotas/history/holds once per selection
(quotaCycleHoldsOf). The route asks no vendor. HistoricalWindowHolds
reckons each window at its own last reading in the cycle, using the
ledger and readings from before that reading. "Loading..." shows while it
is pending. An answer for a cycle no longer picked is dropped. The card's
Refresh, or an asked read, reckons again. The estimate's tooltip names the
window's start and the reading's time.
Changed from the fork:
- After a run closed at its reset, the fork reset lastLeft to zero. A
window that ran dry again before its next reset then opened a run from
time zero, which hid every window's estimate, the weekly one included.
The next run now starts no earlier than that reset.
TestWindowHoldsDryAgainAfterReset covers it (red with the fork's line).
- The fork narrowed the live card's Span to the observed refill. Span also
feeds provider.WithWindowStarts, so the window's Pace would have moved.
withSpansOf puts the card's spans back after reckoning. A span assertion
in TestWindowHoldsUsesObservedRefillStart covers it (red without it).
- The fork's historical snapshot dropped the card's Balance. That slipped
past the gate a live card has (holdsBounds), so a card that tells a
balance got past-cycle estimates. Balance is now kept. Covered in
TestHistoricalWindowHoldsUsesEachWindowsOwnReading (red without it). The
fork's fixture had a Codex card with a Balance, which no Codex card has.
- Main has since added HoldsWhy (#2045). The fork's own "Whole: not enough
reliable data" line and its .quota-holds-unknown CSS are left out. A past
cycle uses main's holdsUnknownLine and its reasons, as a live card does.
A window with neither an estimate nor a reason shows nothing, where the
fork showed its unknown line.
- withRecordedWindowStarts is ported to main's holdsBounds(start, end, why).
- quota-refresh-order.test.cjs's VM harness now stubs quotaCycleHolds,
which loadQuotas and quotaRefresh clear.
Left out: nothing else from the fork. Past prices aren't kept, so a past
cycle's cost uses today's API list prices (documented). Credits can't be
attributed per call, so none is attempted (documented).
What was run:
- gofmt -l: clean. go vet -tags nogui ./... for GOOS darwin, linux and windows.
- go test -tags nogui ./internal/usage ./internal/gui ./internal/provider:
ok.
- Each of the three fixes above was reverted by hand, and its test went red.
- GUI, Chromium and WebKit:
- quota-curve: 30/30. Also run at 1100 and 420 wide: 60/60 (all five
languages).
- Also: quota-*, i18n-keys, gui-de/ja/zh-tw, usage-card-refresh,
usage-refresh*, usage-stale-answer, usage-remote-cards,
usage-accounts*, usage-quota-head, usage-pack and usage-alert.
- Reds: quota-count-wrap and quota-name-translated are red in WebKit,
the same as on origin/main
|
||
|
|
758a4084ee |
sync: LAN sharing stays as each computer has it, so turning it on at home no longer turns it on at work (Lullaby on Discord)
Settings.KeepOwn now keeps LAN (sharing on the local network), AllowIPs (the addresses let in to it) and SessionTerminal (the Mac app a session resumes in) from this computer whenever a sync, a join, a Restore, an Undo or a backup file brings settings in. davsync's hashes blanks the same fields, so flipping sharing is no change to push. A backup restored onto a new computer leaves sharing off there: it opens the gateway to the network, so it is turned on by hand, like the port and proxy. The default sharing key is not per computer. It lives in the gateway-key store, which rides the settings part with LANKey and LANKeyID, so every computer holds the same key, and a second computer turning sharing on takes up that key instead of making another one (configureLAN finds it by LANKeyID or k.LAN). Audit of Settings, what stays synced and why: - already own: Window/WindowMaximised, UIFont/CodeFont, Proxy, Port, Dock/DockWindow, Lightweight, KeepAwake/KeepAwakeDisplay, Tray*, GatewayMode, NoWSLAgents, QuotaReads, NoAccountDiscovery, GatewayConversations. - made own now: LAN, AllowIPs (the address list belongs to the network this computer is on), SessionTerminal (another Mac may not have the app). - not in Settings: launch at login (internal/autostart, the OS's own setting) and the listen address (MAGPIE_ADDR, plus Port). Remote access through Tailscale etc. goes through those. - still synced: CORSOrigins (pages and extensions the user uses, and each still needs a gateway key), OTel, Redact*, update settings (NoAutoUpdate, AutoRestart, UpdateMirror, ChinaMirror), alerts, model and agent choices, Theme/Lang/TextSize. These are the user's preferences, not facts about one machine. Older magpie versions still take LAN from the bundle. Only new clients ignore it. Docs: sync-backup.md gets a "What stays on each computer" section, and gateway-routing.md says AllowIPs is per computer. README and site docs don't list what sync carries, and no GUI string does either, so they are unchanged. Run, on origin/main |
||
|
|
ef49011448 |
gateway: Stays: Auto keeps a conversation on Claude's 1-hour cache for the hour, not 5 minutes (#2302, j3r0lin)
affine called a conversation "cold" once its last reply was more than
cacheCold (5 minutes) ago, whatever the reply said of its cache. A Claude
reply that wrote with cache_control ttl "1h" (cache_creation's
ephemeral_1h_input_tokens, already parsed into Usage.CacheWrite1h; Claude
Code asks for it on a subscription) keeps that prefix for an hour, so the
next turn 5-60 minutes on lost its priority and could move to another
account or model that has none of the cache.
answered now keeps an hourCache on the stick: the tokens read plus the
1-hour write (Anthropic puts 1-hour breakpoints before any 5-minute one,
so what was read lies inside that prefix), and when. A later reply on the
same account and model that reads at least all of it starts the hour
again; one that reads less (moved, compacted) drops it. affine's "cold"
now needs both past 5 minutes and no warm hourCache (>= cacheWorth tokens,
within cacheHour). It is saved in affinity.json (cacheHour, cacheHourAt;
absent in older files, read as none). Sibling: keepsEffort, which lets a
group's effort drop only once the cache is lost, used the same 5 minutes;
turnRule now carries the same hourCache from ruleAnswered.
Vendors that report no 1-hour write never have an hourCache, so their
behaviour is unchanged; resting, spent, strict and the other reasons are
judged before this as before.
Tests: TestAffinityKeepsAnHourCachePastFiveMinutes (real server stack, an
Anthropic upstream reporting cache_creation: 1h write at 20 min -> cache,
at 59 min across a restart -> cache, at 61 min -> cold, 5-minute write at
6 min -> cold, a 1h write under cacheWorth -> cold), TestHourCacheAfter,
and two TestKeepsEffort cases. With affine's and keepsEffort's old
conditions put back, both fail ("an hour's write, 20 minutes on: ...
Why:cold, want cache"; "an hour's cache: warm at 20 minutes: false, want
true"); with the file's cacheHour left unread, the restart case fails.
Real data: the owner's usage.jsonl has 166 Claude subscription replies
with cache_write_1h > 0, e.g. cache_read 57901 + cache_write_1h 336, the
shape hourCache takes. Not tried live past 5 minutes against Anthropic.
Ran: gofmt -l, go vet -tags nogui for darwin/linux/windows on
internal/gateway, go test -tags nogui ./internal/gateway (full package).
Full suite: SUITE_LINE
|
||
|
|
3c921835d0 |
library: RTK switches on for OpenCode 2 with rtk 0.52 or newer, not "Not for OpenCode 2" (#2295, witt-bit)
The RTK tab blocked OpenCode 2 whatever rtk was installed: rtk's
OpenCode plugin used to be written for OpenCode 1 only, which OpenCode 2
refuses ("Plugin must export a default definition with an id and an
effect or setup function", rtk-ai/rtk#4311). rtk-ai/rtk#4187 (merged
10-12, first released in rtk 0.52.0, also in 1.0.0 and 1.0.1, the
reporter's) writes one default object with OpenCode 2's id and setup()
beside OpenCode 1's server(). Checked with gh: 0.52.0's and 1.0.1's
hooks/opencode/rtk.ts are byte-identical, 0.51.0's is the old named
export.
- openCodeBlocked: with OpenCode 2, blocked only when rtk is older than
0.52 or doesn't say its version; the reason now says to update RTK.
OpenCode 1 is unchanged with any rtk.
- openCodeHas: under OpenCode 2, an old plugin (no setup()) left from
before an rtk update counts as off once the rtk here is 0.52+, so
switching it on runs rtk init, which writes the new one over it. With
an older rtk it still counts as on, so it can be switched off.
- GUI: the OpenCode row's tag is "Update RTK" with OpenCode 2 reasons
(on: refuses this plugin, update or switch off; off: needs 0.52), in
en, zh, zh-TW, ja, de; the "Not for OpenCode 2" strings are gone.
- docs/subsystems/library.md says the same.
What was run:
- Real binaries in a sandbox HOME (throwaway test, not committed):
rtk 1.0.1 and 0.51.0 (aarch64-apple-darwin release tarballs) with the
real OpenCode 2.0.25 on PATH. rtk 1.0.1: row not blocked, SetRTK on
wrote an 8425-byte plugin with setup(), off took it out. rtk 0.51.0:
blocked "OpenCode 2.0.25 needs RTK 0.52 or newer, and this RTK is
0.51.0 …", SetRTK on refused, nothing written.
- Real OpenCode 2.0.25 in a sandbox HOME (its own service, stopped
after): rtk 1.0.1's plugin logs "loading plugin" with no error;
0.51.0's logs "failed to load plugin … Plugin must export a default
definition with an id and an effect or setup function".
- TestRTKOpenCode2 rewritten (fake rtk writes each version's real
plugin shape). Broken by hand three ways, each a FAIL: old rtk.go
(blocked: "RTK doesn't support OpenCode 2 yet …"), stale-plugin rule
dropped ("OpenCode 1's plugin under OpenCode 2 is listed as on"), gate
at 1.0 ("rtk 0.52.0 blocked for OpenCode 2").
- New GUI test library-rtk-opencode2.test.cjs: every language, 1100
and 420, on and off rows, Chromium and WebKit 21/21 each; red on the
old client.js/i18n.js. gui-de, gui-ja, gui-zh-tw, i18n-keys and all
library-*.test.cjs: 286/286 in Chromium and in WebKit.
- gofmt -l clean; go vet, GOOS=linux and GOOS=windows go vet -tags
nogui ./internal/library; go test -tags nogui ./internal/library
under a temp HOME with pinned caches, on the rebased head.
Full suite: SUITE_LINE
|
||
|
|
e679f1106f |
cli: magpie plugin lists a plugin's tools and its page
The list said a gateway module's hooks, routings and onUsage, but nothing
for a plugin that gives tools (P4b) or a page (P4c), so such a plugin had
nothing under its row. Found in the combined P4 real-use run.
Tools are listed by their names on the plugin tools MCP server
(gateway.ToolNames), a page by its title and what it may read.
Run: TestPluginListSaysToolsAndPage, and internal/cli whole (ok). gofmt
clean; vet darwin, linux -tags nogui and windows = 0. Broken by hand:
without the tools line the test goes red ("aren't listed"), and without
the page line too ("isn't listed"). A `!e.Off` guard on the tools line
didn't change the test, since the host loads no plugin that is off, so
it was dropped.
|
||
|
|
3f913b3de6 |
plugins: a JS gateway plugin serves routings (strategies) and watches usage rows (onUsage); plugins/middleware is "JS gateway plugins" (P4)
A plugin's gateway module (magpie.middleware, or its alias magpie.gateway,
or a *.gateway.js file) may now export, besides onRequest/onEvent/onResponse:
- strategies: {name: (pool, seats, options) => order}. Each is a routing
"<short name>/<name>", registered with routes.Register while the plugin is
on and loaded and removed when it goes off or reloads. Seats are
routes.Seat in camelCase JSON. 20ms each; it fails open: a throw, a timeout
or a result that isn't an order of the seats means the listed order. The
failure is counted and logged, rate-limited. A file's name is made into a
routing-safe prefix.
- onUsage(row, options): gets an allow-listed usage row (no bodies, prompts,
error text, sessions or request ids). The rows come from a bounded queue
(1024) with one worker, off the request path; a full queue drops the row
and counts it, and a request never waits. 250ms each.
plugins/middleware is renamed "JS gateway plugins", with a new Sub
(en/zh/zh-TW/ja/de). It registers usage.Observe(middleware.Points()). Off,
no JS hook, strategy or onUsage runs. InUse is unchanged.
providers.json keeps a routing of the form <plugin>/<name> as saved
(provider.PluginRouting) in provider and group Save, whether or not a
plugin serves it now. Before this, `group set g routing=pick/last`
stored nothing.
GUI: the settings state carries jsRoutings. Provider and group routing
pickers offer the served ones, marked data-feature=middleware. A saved
routing that no plugin serves now shows as it is, with a hint. The
Plugins page's line shows routings, how often they were asked, onUsage
rows and dropped rows. The CLI accepts `group set <id> routing=<plugin>/<name>`.
`magpie plugin` lists a module's routings and onUsage; a strategy-only
module had printed nothing after "gateway middleware".
Docs: docs/subsystems/gateway-middleware.md (Routings and usage rows,
limits, verification) and plugin-runtime.md (P4: community plugins at
every point). site/public/docs plugins.html in en, zh and ja has an
example: internal/middleware/testdata/spread.gateway.js, which
TestDocsExample runs.
What was run (worktree on 4df1ba0c6, -p 2):
- gofmt -l: clean. go vet on internal/{middleware,cli,gui,plugin,provider}
and plugins/...: darwin, GOOS=linux -tags nogui, GOOS=windows; all
clean, run after the last Go change.
- go test, after the last Go change: internal/middleware ok,
plugins/middleware ok, internal/provider ok (210s), internal/cli ok
(203s). Earlier in the work: internal/plugin ok (385s), internal/pluginrt
ok, internal/gui (Go) ok (320s), and plugins/... ok. The first
plugins/... run printed a bare FAIL line that `tail` cut off before its
cause showed. The rerun was all ok; the cause is unknown.
- GUI, both engines (routing-*, group-*, builtins, i18n-keys, gui-de/ja/zh-tw,
plugin-middleware): 1220 tests, 1204 pass, 16 fail.
- routing-manual (4): mine. A group's own "manual" was offered a second
time as a routing no plugin serves. Fixed in client.js withJS. The
coordinator is rerunning routing-manual, keys-fold, group-fold,
intent-entry and routing-js alone in both engines, so that rerun is
not recorded here.
- routing-model-rest: red alone too, and red on untouched 4df1ba0c6
(3/20). It is #2115; I commented there with the webkit cases.
- group-member-weight webkit de 420 is #2387.
- group-from-model-add webkit zh: it passes alone 2 of 2. Under load it
waits a fixed 2s for the save post. Filed as #2388.
- routing-keys-fold (webkit zh/ja/de), routing-group-fold (goto timeout)
and routing-intent-entry (browser launch timeout 180s) are load
timeouts. The coordinator is rerunning them alone.
- routing-js.test.cjs (new) passed in chromium en and zh, before the full run.
Broken by hand, each test went red, then restored:
- the permutation check: TestStrategyFailsOpen;
- the queue's non-blocking send: TestOnUsageNeverBlocks ("Ledger waited
2.04s");
- the allow-list: TestUsageRowAllowList;
- unregister on off: TestStrategiesServedWhileOn and
TestStrategiesStopWithServe;
- the CLI pattern: TestParseRoutingStays;
- Observe in plugins/middleware: TestOnServesStrategies;
- PluginRouting in provider.go and in group.go: TestPluginRoutingKept;
- the prefix sanitizing: TestRoutingFromFileName;
- the CLI list line: TestPluginListSaysMiddleware;
- the GUI's data-feature mark and its unserved-saved entry: routing-js.
Real use: a sandbox HOME, the gateway served on 127.0.0.1:3682 by a
-tags nogui build, a fake vendor on 3681, and providers fa (key ka) and
fb (key kb) in group g. pick.gateway.js has strategy last (reverse) and an
onUsage that logs.
- `group set g routing=pick/last` stored it.
- A request to group/g reached the vendor with Bearer kb, and the
"usage-row fb m in=5 keys=17" line was logged.
- `plugin off pick.gateway.js`: Bearer ka (listed order), no onUsage,
routing still pick/last.
- `plugin on`: Bearer kb and onUsage again.
- `plugin builtin off middleware` says "in use and stays on", as InUse
should.
- Not tried: the GUI against that gateway, or a real vendor account.
|
||
|
|
64b0f3a201 |
plugins: a community plugin's own page in magpie's window, shut in a sandboxed frame (P4)
A plugin's package.json may declare magpie.page {title, file, icon} and
magpie.permissions.reads. While the plugin is on, its page gets a tab in a
"Plugins" group after the built-in pages, drawn in an iframe sandboxed to
allow-scripts only (an opaque origin: no cookie, no storage, no parent).
Its files come from /_magpie/plugin/<token>/ (HMAC of the spec with a
per-process secret) under a CSP with connect-src 'none' and
frame-ancestors 'self'; a path that leaves the page's folder, a symlink
out, or an off plugin's token is refused. The window's postMessage bridge
answers only that frame (event.source checked) with theme and language,
the plugin's own options.get/set (throttled), and the reads it declared;
any other read is refused in the window and again by the server, and no
read carries a secret. /api refuses Origin: null and frame/iframe
fetch-dest requests (noFramedAPI), so the frame never reaches the GUI's
API even with the cookie. A page that throws or never says hello shows
the kernel's broken-page state with Try again. The Plugins page shows the
page and what it reads before the plugin is turned on.
Docs: gui-shell.md, plugin-runtime.md (P4 section), site docs en/zh/ja
with an example plugin; i18n zh, zh-TW, ja, de; fixture in
internal/gui/testdata/page-plugin.
Run (worktree at base 4df1ba0c6, -p 2, one package at a time):
- go test -count=1 -timeout 45m: internal/gui ok, internal/plugin ok,
internal/pluginrt ok, plugins/... (budget groups middleware otel redact
rotation search) ok.
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean.
- Playwright (chromium + webkit, 5 languages, narrow widths): plugin-page 4/4,
plugin-kernel 4/4, builtins 4/4, i18n-keys, gui-de, gui-ja, gui-zh-tw 3/3,
plugin-middleware 24/24, plugin-own-icon 22/22, plugin-options 22/22,
plugin-local 8/8, plugin-agent 22/22, click-scroll 22/22.
Broken by hand, each went red: CSP without connect-src; apiFramed always
false; the server's read check removed; the noFramedAPI wrap removed from
api.go (red through the real Handler); inside() letting every path
through; CORP same-origin re-added; in JS the client read check removed,
the ev.source check removed, and allow-same-origin added to the sandbox.
Without the Array.isArray guard on /api/plugin-pages, plugin-kernel,
builtins and plugin-middleware/own-icon/options went red (their mocks
answer a non-list) - that was found by the run, then fixed.
Real use: built magpie, `magpie web` on 127.0.0.1:3472 (gateway 3471) in a
sandbox HOME with the example plugin added. curl: the page file loads
with the CSP and no cookie, traversal and a bad token are 404, /api with
Origin: null or Sec-Fetch-Dest: iframe is 403 even with the cookie, an
undeclared read 403, a declared one 200. Chromium and WebKit at 1100 and
420: the page draws its declared read, the probe's fetch/absolute
fetch/top access/undeclared read are all refused, an <img> of /api is
refused, no page errors. Real use found that a
Cross-Origin-Resource-Policy: same-origin header blocked the frame's own
files (its origin is opaque); it is gone and a test guards it.
Not tried: the desktop (Wails) window. Market cards of plugins not yet
installed don't show a page's reads. The Playwright suite mirrors the
CSP in a mock route rather than the Go server (the Go tests and real use
cover the server).
|
||
|
|
6ac7032b4b |
plugins: a community plugin's tools reach every agent through magpie's MCP server /mcp/magpie/tools (P4 tool point)
A plugin's OpenCode `tool` hook ({tool: {name: tool({description, args,
execute})}}) used to reach no agent. Now the plugin host collects each
loaded plugin's tools, turns their zod args (v3/v4 shape or object; a
raw JSON Schema is kept) into JSON Schema, and runs one on a `tool`
call: arguments checked against the tool's own zod first (defaults
filled, a wrong one named), execute raced against ToolTimeout (55s,
ctx.abort fires), the answer as text.
The gateway serves them as an MCP server at /mcp/magpie/tools
(tools_mcp.go, guarded by serveMCP as the search one, 4 MiB body):
tools/list names each <plugin short name>_<tool>, at most 64 chars,
a shared name numbered _2; tools/call holds the call to the calling
key's limit through reserveFor and runs it with the calling agent.
The built-in plugin `tools` ("Plugin tools", Essential) serves
gwtool.PluginTools; off, nothing is listed, a call says the plugin is
off and the host isn't asked. InUse counts plugins that are on and
gave tools, from plugin-tools.json, which the host writes after each
load (whole, only on change), so it never starts Bun; the gateway's
KeepFresh watches that note too. Tool answers go to the calling
agent only, so masking doesn't apply (said in the docs).
The Plugins page lists an on plugin's tools by their MCP names, with
descriptions on hover and a button copying the server's address; a
plugin of tools alone has no Provider chip and isn't said to sign in
to nothing. Not done: a Library featured opt-in entry; wiring is the
copied address.
Docs: docs/subsystems/plugin-tools.md (new), plugin-runtime.md's new
"P4: community plugins at every point" section with the tool row, the
README index, usemagpie.ai/docs/plugins#tools in en, zh, ja with an
example. Strings in zh, zh-TW, ja, de. Example plugin:
internal/plugin/testdata/tools.
Run at this commit's tree (base 4df1ba0c6), each package alone, -p 2:
- gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows
over internal/plugin, gwtool, gateway, plugins/..., gui, pluginrt: ok
- go test ./internal/plugin -run Tool; ./plugins/...; ./internal/pluginrt;
./internal/gui -run 'Builtin|Plugins'; ./internal/gateway -timeout 45m
-run 'ToolsMCP|ServingGates|OwnMCPRejects|SearchOnAndOff|KeyLimitsOnAndOff':
all ok
- GUI, Chromium and WebKit: every plugin-*.test.cjs, i18n-keys,
builtins: 461/461 pass; plugin-tools.test.cjs (new) covers en, zh,
zh-TW, ja, de at 980 and 420 px
Broken by hand, each red, then restored:
- tools/list ignoring the gwtool gate -> TestToolsMCPOff
- tools/call ignoring the gate -> TestToolsMCPOff
- reserveFor removed -> TestToolsMCPHeldToKeyLimit (tool ran)
- collision suffix dropped -> TestToolsMCPServesPluginTools
- ToolsOn ignoring Off -> TestPluginTools
- host arg check removed -> TestPluginTools
- host timeout race not listening -> TestPluginTools (answered at
5.3s by Go's backstop; the test now bounds it at 4s, and the first
try at this break was a syntax error that proved nothing)
- GUI listing an off plugin's tools -> plugin-tools.test.cjs
Real use: a built magpie in a sandbox HOME (MAGPIE_ADDR 127.0.0.1:3491,
real Bun), the example plugin added with `magpie plugin add`. curl over
MCP: initialize, tools/list (4 tools, schemas), shout "HI HI (for
curl)", a missing argument as isError naming it, add {"sum":6.5}, fail
"it broke", a foreign Origin 403; plugin-tools.json written. Claude
Code (sandbox CLAUDE_CONFIG_DIR) `claude mcp add --transport http` +
`mcp list`: Connected. Not tried: a model calling a tool through a
real agent turn (no model in the sandbox). Binary and HOME removed.
|
||
|
|
2e2c890304 |
agent: Lody is detected by what Lody makes, its link only on loopback is guarded, and its row is tested in every language
Review of Leon Zhao's Lody import (the two commits before this):
- Detection: a bare ~/.lody or ~/.lody-oss another tool made counted as
Lody. Now the home folder counts only with an entry Lody makes there
(workspace-catalog.json, loro-repo, agent-binaries, code-collab-v2, all
in the owner's real ~/.lody). A Lody.app counts only with an ai.lody.
bundle id (the real /Applications/Lody.app is ai.lody.desktop, and
registers the lody scheme) or a plist that isn't XML. Electron's data
folder under os.UserConfigDir (Application Support / %APPDATA% /
~/.config, "Lody", "Lody OSS", "Lody Nightly") still counts as before.
A never-opened install on Windows or Linux has no folder and isn't
shown; said in agent-wiring.md.
- Security: TestLodyLinkCarriesNoSecret turns LAN sharing on and checks
the link holds magpie-lody and never the LAN key, every endpoint is
loopback http, and MAGPIE_ADDR pinned beyond loopback gives no link at
all (0.0.0.0, 127.0.0.1 and [::1] still give one).
- `magpie lody add` with no link (a LAN-pinned gateway) said it opened
Lody and opened ""; it now says why and opens nothing.
- Added *bool: every consumer re-read. The CLI and TUI use agent.Agent's
func (nil-safe), the GUI reads a.added == null, and Cindy's false is now
sent as "added":false. TestLodyImportHandoff also checks Cindy's row
says false and Lody's leaves added out; the handoff test's ~/.lody
holds a catalog file now and checks it is left byte for byte.
- The hint "Opens {name} to add magpie as a provider — confirm it there"
was already translated in zh, zh-TW, ja and de (the import button's
tooltip). import-row now runs in all five languages, asserts Lody's
exact translated line and that no added/not-added wording shows, and
checks both import rows fit a 420px window with no sideways scroll
(waiting for the header's segments to settle after the resize, which
overflow for ~300ms in WebKit en on main too).
Run (on origin/main
|
||
|
|
c6bd4e9707 |
agent: let Lody confirm local provider imports
Offer Lody a versioned import link for Claude, Codex, Pi, DSH,
Kimi Code, Grok and Bub. Export only loopback endpoints and the public
magpie-lody token. Leave Lody data untouched and show a confirmation hint
when the app exposes no public import-status reader.
Verified: go test -tags nogui ./... in a temporary HOME with pinned Go
caches; native, Linux nogui and Windows vet/build; gofmt and diff checks;
17 Chromium/WebKit import-row and locale checks. The actual Lody parser
accepted all seven targets with IPv4, localhost, IPv6 and canonical ports.
Negative controls: removing registration fails
TestLodyDetectionAndRegistration with "Lody missing from Agents";
removing URL handoff fails TestLodyImportHandoff with
"Lody import was not handed to the desktop". Restored tests pass.
Desktop launch and Linux/Windows runtime behavior were not exercised.
Cherry-picked onto main (
|
||
|
|
37fec12409 |
import: OpenCode's keys come in from its auth.json, Go's on OpenCode Go (@hu_xiaomi on X)
@hu_xiaomi on X asked whether magpie could pick up OpenCode Go's API key
by itself. OpenCode keeps what `opencode auth login` signs in to in
auth.json, in $XDG_DATA_HOME/opencode (~/.local/share/opencode when that
is unset, on Windows too). Its format and path were checked against
anomalyco/opencode v1.19.0, packages/opencode/src/auth/index.ts.
- OpenCode is now a source in the import picker (appReaders,
import_opencode.go). An "api" key comes in on the magpie preset with
the same id: opencode-go on OpenCode Go, opencode (Zen) on OpenCode
Zen, and a vendor's key (openai, anthropic, deepseek, openrouter, ...)
on that vendor's preset, the same way Alma's almaPresets work.
- auth.json keeps no address beside a key, so a key for a provider with
no preset is listed and skipped ("it has no base URL"). Sign-ins
(oauth: Claude Pro/Max, Copilot; wellknown: an enterprise server's
token) are listed and skipped with the reason the picker already
translates. No new GUI strings.
- OpenCode is read only when the user opens the picker. The Providers
page's automatic discovery leaves it out (DiscoverSources, the `asked`
flag), because the file holds every sign-in OpenCode has. magpie never
writes to it. OPENCODE_AUTH_CONTENT is not read.
- presetAt: the first preset at a host won even when a later one matched
the URL exactly. OpenCode Zen and Go share opencode.ai, so a Zen key
would have landed on Go. An exact match now wins.
- importSources: a source whose stat fails with anything but not-exist
(a folder magpie can't search) is found with an error, which means
unknown. Before, it read as "Not found".
- The picker's tab shows OpenCode's own mark (icons/opencode.svg).
- docs/reference.md describes the source.
Not added: an "use the key OpenCode has" offer in the OpenCode Go add
sheet, because no other app has one there (no sibling to follow).
Run (macOS, go1.26.8, worktree at
|
||
|
|
a1f7b8c13f |
plugin: gateway key limits are the Key limits plugin on the gateway's budget point (P3)
The last P3 point, after observer, router strategy, middleware and tool:
the budget point (internal/gwbudget). A plugin serves a Limiter while it
is on; the gateway asks gwbudget.Limiting before any request of a key held
to a limit goes to a provider (reserveFor: the chat APIs' keyLimited, the
search MCP server and the vision one). A request without a key, or of a
key with no limit, never asks it.
It fails closed. A key with a limit and no limiter served gets 503
gateway_key_limit_off, X-Should-Retry false, nothing sent, and a rejected
usage row. With none served, Limiting first asks the gateway's refresh
(pluginrt.Refresh, at most once a second, never from inside one), so a
limit set a moment ago turns the plugin on for the request that needs it.
A limit reached is the 429 gateway_key_limit with Retry-After and
X-Magpie-Limit-Reset, as before.
plugins/budget serves internal/budget's limiter (budget.Limiter). It is
Essential and in use while a gateway key has a limit, so it can only be
off while none has; a keys file that can't be read is an error, so it
stays on. KeepFresh watches the keys file too. What a key has used and
has left (/v1/magpie/limit, the Gateway page, the CLI) and budget.Append
stay in the core, so the ledger counts a key's use the same either way,
and the key editor's limit fields stay, since setting a limit is what
turns the plugin back on.
The builtins GUI test wheels to the Routing row as it did to Usage's: the
new row puts it below the fold in WebKit, where the page puts back a
scroll that isn't the reader's (scrollOnPurpose).
Run at this head (on origin/main
|
||
|
|
dd25997a45 |
codex: a client's access_programs and the account's extraBody reach the ChatGPT backend, and its refusal comes back as it said it (magpie-releases#18)
NonMirror (0.1.1239, OpenCode, codex/gpt-daybreak-blue-latest on a ChatGPT
sign-in): a top-level Responses access_programs never reached upstream,
and the codex provider's extraBody wasn't applied.
Cause:
- A Codex account is streamed upstream, so a whole (stream:false)
Responses request and every Chat or Messages request is translated
(parseResponses/parseChat -> Request -> buildResponses). Request had no
field for access_programs, so the rebuilt body dropped it. Only a
streamed Responses request, relayed through codexBody, kept it.
- WithExtraBody skipped every signed-in account, and withPicks didn't
copy the providers.json ExtraBody onto the account.
- writeError rewrapped every vendor error with code and param null, so
even a forwarded refusal lost what it was about.
- The backend refuses a program the workspace hasn't got inside a 200
stream (error event, invalid_request_error, access_program_not_enabled).
The whole-translated path answered that 502 api_error, and translated
streams wrote it as api_error, which holdWriter reads as 502: the same
request went three times, then to the other accounts, and every one
rested.
Fix:
- Request.AccessPrograms (Responses and Chat), built into the Responses
body as it came; a null is kept.
- A ChatGPT (Codex) account takes extraBody; store, tool_choice and
include stay magpie's (codexOwned). withPicks keeps ExtraBody.
- writeVendorError keeps the vendor's error.code and error.param on the
relayed, whole-translated and streamed-translated status-error paths.
- requestRefused: a Responses stream error/failed whose error type is
invalid_request_error carries status 400 and the vendor's error
(Event.Said). The whole path answers that 400 with code and param; the
Chat, Anthropic and Responses encoders write its type/code/param
(saidError). Read by the type, never by words.
- Codex CLI sends access_programs as a top-level object on its Responses
request (codex-rs ResponsesApiRequest.access_programs); OpenAI's Daybreak
guide documents the same field.
Run:
- New: internal/gateway/codex_access_programs_test.go
(TestCodexAccessProgramsReachBackend, TestCodexAccountTakesExtraBody,
TestAccessProgramsNullKept), passes -count=3.
- Broken by hand, each went red: buildResponses not emitting the field
(probe answered 200, the reporter's symptom); extraBodyTakes' Codex case;
withPicks' line; codexOwned emptied; writeVendorError ignoring the body;
the continuation site alone; retryable(400) true (asked twice, rested);
requestRefused returning nothing (502, asked 4 times, both accounts
rested); saidError a no-op (streamed: asked 4 times, rested); the whole
site back to 502 (same).
- go test -timeout 30m ./...: all 62 packages ok (gateway 1559s at load
~26; an earlier run at the default 10m timed out in gateway under that
load, not a failure). gofmt -l clean. GOOS=linux and GOOS=windows
go vet -tags nogui ./... clean.
Real account (sandbox HOME, own port 3486, copied auth.json with a dead
refresh token; owner's ChatGPT Pro account, model codex/gpt-5.6-luna):
- "__daybreak_forwarding_probe__": 400 invalid_value, param
access_programs.cyber ("Supported values are: 'standard',
'daybreak_blue', and 'daybreak_red'") on Responses whole and streamed,
Chat whole and streamed. The backend says invalid_value, not the
guide's invalid_access_program.
- standard: 200. null: 400 invalid_type.
- daybreak_blue (not enabled for this workspace): 400
access_program_not_enabled with param on Responses and Chat whole, the
error event with that code on Responses and Chat streamed; ~1s each,
one try (was 3 tries and a 502 before this change).
- The next plain request was served 200 by the same account: nothing
rested.
Not verified: the Daybreak model itself (not listed for this account),
so no 200 with daybreak_blue; OpenCode's own wire; the Messages route
against the real backend (fake backend only).
|
||
|
|
9d97fd0733 |
plugin: magpie's web search is the Search plugin on the gateway's tool point (P3)
The third P3 point after observer/rotation, groups and middleware: the
tool point (internal/gwtool). A plugin serves a tool by name while it is
on; the process serving the gateway gates on it (Gate in ListenAndServe),
and a process not serving the gateway (CLI, TUI) has every tool, as
before.
plugins/search serves gwtool.WebSearch. Off, magpie offers and answers no
search of its own: the stand-in web_search isn't given to a model that
can't search, the search MCP server and Codex's search in ChatGPT's place
say "turn the Web search plugin on", and neither a search API nor a Kimi
Code plan's own search service is asked. A vendor that searches by itself
is still sent its own web_search. It is Essential and stays on while a
search API is set up or a searcher is picked (InUse); a providers.json or
settings.json that can't be read counts as unknown, so it stays on.
Settings → Models' Web search section stays visible with the plugin off:
the plugin can only be off when nothing is set up there, and adding a
search API there is what turns it back on (as Privacy does for redact).
Run at this head (rebased on origin/main
|
||
|
|
35aa50cfb3 |
zhipu: a GLM Coding Plan key refused 200 in the platform's envelope reads as refused, in the test, the gateway and the quota card (@xanahopper on X)
On a Coding Plan with a key Zhipu refuses, Test showed OpenAI 401 and Anthropic 401 but Responses (https://open.bigmodel.cn/api/v1) a green check, and the 5h/weekly windows showed only "Allowance unavailable". Cause: /api/v1 (Zhipu's real Responses endpoint, docs.bigmodel.cn coding-plan/tool/codex) and /api/monitor answer a refused key HTTP 200 with {"code":1000,"msg":"身份验证失败。","success":false}. probe (endpoint Test, model tests, Detect) took any 2xx as ok, and the gateway handed the 200 to Codex as a reply, so no failover and no rest. - provider.ZhipuEnveloped: a 2xx JSON, non-stream, unencoded reply from open.bigmodel.cn or api.z.ai whose body is the envelope with success:false becomes {"error":{...}} under the status Zhipu's code table gives (1000-1005 401, 1113/13xx 429, 1220 403, 121x/1261/1301 400, else 502). Anything else passes through unchanged (64KB cap, body restored). Applied in probe and in the gateway's forwardOnce. - planquota: a refused key (envelope 1000-1005 or HTTP 401 from a Zhipu/Z.ai host) says "Zhipu didn't take this key (...): it has expired, was deleted, or is mistyped; paste a current one from <keys page>", and skips the team retry. The card shows it in en, zh, zh-TW, ja, de. - docs: providers-accounts and gateway-routing rows. Run at this head (before rebase, base |
||
|
|
03eb0633af |
library: an agent not installed is on no row but those of what it still has (@jiahao_jayden on X)
Library → Skills showed a chip for WorkBuddy on every row though it
wasn't installed ("一排有点密恐了"). WorkBuddy has no CLI and no detect
rule, so it counted as installed whenever ~/.workbuddy (or its
models.json) existed; that folder stays after the app is trashed, and
magpie itself writes models.json, mcp.json and skills/ there.
- agent: on a Mac WorkBuddy and WorkBuddy AI are detected by their apps,
each by its own bundle id (com.tencent.workbuddy.mac,
com.workbuddy.workbuddy-ai) in /Applications or ~/Applications
(macBundle). Off a Mac the folder still counts, as before.
- library: an agent that isn't a target but still has skills, servers or
hooks magpie gave it is held (Target.Gone). A sync takes edits from its
copies and then only takes things out of it; Read lists it with
gone: true while it has any, and not once it has none.
- GUI: a gone agent's chip is only on the rows of what it has, lit; a
click takes it away. All, the How-per-agent sheet and the pickers leave
it out; By agent lists it as "Not installed here" with Turn all on off.
No layout change. New strings in zh, zh-TW, ja, de.
Run at this tree (macOS, sandbox HOME, Go caches pinned):
- gofmt -l: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: clean. go build, GOOS=linux go build -tags
nogui, GOOS=windows go build: ok.
- go test -tags nogui -timeout 30m ./...: all ok (59 packages);
internal/gui rerun after the last string rename: ok.
- GUI: the 74 test files that open the Library, chromium and webkit:
563/563 each. library-gone-agents.test.cjs (new; 1100px and 390px, en,
zh, zh-TW, ja, de): 11/11 in both; i18n-keys.test.cjs: 3/3.
Broken by hand, each went red, then restored and green:
- old client.js: library-gone-agents fails "a chip for an agent not
installed on a row it has nothing on".
- workbuddyHere's Mac branch falling back to the folder:
TestWorkBuddyOnMacIsItsApp "no app, only the folders: WorkBuddy true,
WorkBuddy AI true".
- syncSkills' Gone guard off: TestGoneAgentListedToTakeOut "a sync gave
the gone hermes a skill again".
- held() returning nil: "hermes, holding a skill and a server, isn't
listed as gone".
- the gone sync steps skipped: "hermes, holding nothing, is still listed".
Not verified: the reporter's machine; WorkBuddy detection on Windows and
Linux (unchanged, still by folder); other agents detected by folder alone
(zcode, alma, grok-app, air, hanako, morph, grok) are unchanged. WorkBuddy
AI.app is installed on the owner's Mac without ~/.workbuddy-ai, so it now
shows as detected there.
|
||
|
|
01c41e8ba2 |
library: a skill probe's download goes when it is probed again or 15 minutes are up, and one a magpie that quit left behind goes at the next probe (#2321)
ProbeSkills kept each GitHub probe's download, a magpie-skill-* folder in
the temp dir, cached for 15 minutes. An expired one went only at the
*next* probe, so a magpie that quit, or a test that ended, left it there
for good. One go test ./internal/library left 22. This machine's temp dir
had 5477, and with old test homes they filled the disk under a full run
(gateway tests failed "no space left on device").
- keepProbe: each cached probe has a timer that removes its folder when
probeLife is up. A probe of the same input replaces it and removes the
old folder at once, outside the lock.
- sweepStaleDownloads, at each probe: a magpie-skill-* in the temp dir over
an hour old goes. No live one is that old, since a probe is kept 15
minutes and a fetch takes seconds.
- internal/library's TestMain gives the tests a temp dir of their own
(TMPDIR, and TMP/TEMP for Windows), ends the cached probes, and fails a
run that leaves a skill download there. A test binary started again by a
test keeps its parent's temp dir.
Run (on origin/main
|