377e3ca6e8a898d0691a44df17656fa0dcc78e0a
6076
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
377e3ca6e8 |
site: the Google Search Console verification tag on the home page
Search Console verifies https://usemagpie.ai/ by this meta tag and checks it again later, so it stays. Run: on mote, node --test worker.test.mjs install.test.mjs from site/: 54 of 54 pass. |
||
|
|
ad53a23dc8 |
gateway: X-Magpie-Account takes a percent-encoded name (plugins#615)
StockRabbit (magpie-community/plugins#615, Magpie 0.1.2587, Windows): pinning the Fingerprint page to the WorkBuddy account 北冥 failed every sample with "Header 'X-Magpie-Account' has invalid value". A header value is ASCII on the wire and fetch refuses any other, and the gateway matched the header only against the account's user (北冥) or its trace id (workbuddy@北冥/…), so no ASCII form could name that account. pinTo now matches the value as written or percent-decoded (pinnedName: url.PathUnescape, kept only when it decodes to valid UTF-8). The trace's Pinned, the call's error and the 404's "no account %q" name it decoded. gateway.go:2701 is the one place that reads the value; codex_backend.go, codex_relay.go and gateway.go:2523 test only that it is present, so they need nothing. docs/reference.md and the gateway-routing page say how to send such a name. Run at this head (rebased on |
||
|
|
c3048cd266 |
site: a sitemap, robots rules, a searchable title and canonical docs pages
usemagpie.ai had no sitemap, a robots.txt with Cloudflare's comments
only, a home page titled just "magpie" in every language, and docs
pages with no canonical or x-default.
- public/sitemap.xml lists the home page in en, zh, ja and de and every
docs page by its clean URL. A test fails when a docs page on disk is
missing from it, or it lists one that isn't there.
- public/robots.txt names the sitemap and keeps crawlers off /api/,
/go/, /r/ and /download, so a crawler's fetch isn't counted as a
download or a partner click.
- The home <title>, og:title and twitter:title name the agents
("magpie: one model switcher for Claude Code, Codex and Gemini CLI"),
translated by worker.js like the rest (meta.title, meta.locale in
i18n.js). og:type, og:site_name and og:locale are added, plus JSON-LD
for a free, MIT-licensed SoftwareApplication and the WebSite.
- Each docs page has rel=canonical to its own clean URL and an
x-default alternate to the English page, plus og:site_name. A test
checks each one, and that every hreflang alternate is a listed page.
Run: on mote, node --test worker.test.mjs install.test.mjs from site/
at this tree: 54 of 54 pass. Broken by hand in a copy: a docs page
without its canonical, and the sitemap without docs/zh/docker, each
turns the sitemap test red.
Not tried: Google's Rich Results test; the live check is after deploy.
|
||
|
|
6247086fe9 |
agent: Alma's providers are decoded once per answer kept
A heap profile of the live magpie (v0.1.2646, 37 minutes, the owner's real accounts) had almaProvidersSeen decode Alma's whole /api/providers answer 390MB worth: the Agents page's model field (almaGet, 221MB) and Alma's check (alma.func1, 167MB) each decoded the answer almaSend already kept for 5s, every poll. almaProvidersSeen keeps the slice it decoded beside the bytes it decoded it from, and gives it again while almaSend gives the same kept bytes. A new answer (5s on, or any change sent to Alma, which forgets the kept ones) is decoded anew; a failed read is an error, never the last good answer. Its three callers only read what it gives. Run on mote (macOS 27.2): - TestAlmaProvidersSeenDecodeOnce (new): 400 known models; 10 allocs or fewer a look, one ask of Alma, the new models after a PUT, an error with Alma gone. With the bytes check turned off by hand: "a look at the answer kept allocates 6833 times", red. Restored: ok. - The owner's real Alma answer (227KB with keys blanked, 11 providers, 539 models; probe not committed): a look 1,182,317 B / 30,690 allocs before, 48 B / 1 after. - go test ./internal/agent: ok (161.6s); -race -run TestAlma: ok. - gofmt -l clean; go vet, GOOS=windows and GOOS=linux go vet: ok. |
||
|
|
78cbb711d9 |
agent, codexcat: a poll asks Vision once per stamp and reads Codex's cache levels once per change
A heap profile of the live magpie (v0.1.2646, 37 minutes, the owner's real accounts) had buildModels allocate 1288MB. 553MB of it was the gateway's seer, asked once per list build (provider.Described), and 238MB was codexEfforts -> TakesEffort -> CacheEntries, which decodes the whole Codex models_cache.json for each model asked. - buildModels asks describedNow(), kept per provider.StampNow() in a stampedLists like the lists themselves, so every agent's list of one stamp shares one answer, and a change (a provider saved) asks again. - TakesEffort reads a slug's default level from cacheLevels(), a filememo.Read of the cache file by its stat: the decode keeps only each model's level, and runs again when the file changes. magpie's own added entries are skipped as CacheEntries skips them. Run on mote (macOS 27.2): - TestListsAskVisionOnce (new): pi, claude, codex, opencode, droid and dsh lists ask Described once; after a provider save, once more, and a "no" reaches the new list. With buildModels asking Described itself (put back by hand): red. Restored: ok. - TestTakesEffortReadsTheCacheOnChange (new): a 300-model cache, levels for a slug and codex/<slug>, the default for magpie/x and an unknown one, 20 allocs or fewer a look, and the new level after a rewrite a minute later. With TakesEffort on CacheEntries again (by hand): red. Restored: ok. - go test ./internal/agent ./internal/codexcat at this tree: ok (162.5s). ./internal/gateway and ./internal/gui at the tree before the test's last fix (only the new test changed since): ok but TestCodexPoolSaysTheClientsVersion (#4807, red in a full gateway run on mote, untouched here) and TestMainWindowCorners/macOS_26_SDK (#3949, red on macOS 27). - gofmt -l clean; go vet, GOOS=windows and GOOS=linux go vet of both packages: ok. Not tried: a heap profile of a live build with this change. |
||
|
|
7e201ce20d |
browser: one tool, browser, whose action says what to do
magpie-browser listed 17 tools (11,483 bytes of schema in every request); it now lists one, browser, whose action picks what to do (4,087 bytes). The old tool names are still accepted on tools/call, and text the extension writes about browser_X now says "the X action". Any action takes screenshot: true and returns the page after it, as a 1024px-wide JPEG (q70), so an agent sees the page without a second call. Run on mote at this head: go test -tags nogui -run Browser ./internal/gateway/ with a real Chromium: ok, including TestBrowserToolActionsInARealBrowser. TestBrowserToolCallsTheExtensionsTool went red with the name rewrite taken out by hand and with the downscale taken out (2880x1800 stays 2880x1800). gofmt clean; go vet -tags nogui for darwin, linux and windows ok. Not tried: Claude Code and Codex using the one tool against a live gateway. |
||
|
|
da23fcb169 |
browser: frames from other sites are read and acted on; failures say their kind
A page's cross-site iframes (out-of-process frames) were missing from the
snapshot: Page.getFrameTree on the parent doesn't list them, so a checkout
form or a login inside such a frame couldn't be read or clicked. The
snapshot now adds each frame whose session was auto-attached under its
parent (t.frameOf), and actions on its refs go to that frame's session.
A failed action now says its kind (STALE_REF, DIALOG_OPEN, LOAD_FAILED,
PAGE_BLOCKED, WAIT_TIMEOUT, OUTCOME_UNKNOWN, BAD_ARGS ...) with what to try next, and an action
settles on the DOM going quiet before it says done. Extension 0.1.3.
Run on mote at this head: go test -tags nogui -run Browser
./internal/gateway/ ./internal/browserext/ with a real Chromium
(MAGPIE_BROWSER_CHROME, Chrome for Testing 1234): ok, including
TestBrowserFramesAndFailuresInARealBrowser. Red on the old code ("no
textbox Card"); the settle taken out by hand made it red ("doesn't say
done"). gofmt clean; go vet -tags nogui for darwin, linux and windows ok.
Not tried: a real site's payment iframe in the owner's own Chrome.
|
||
|
|
35c47f762f |
agent: the window's drift poll parses dsh's YAML once per change, not per field and per look
The window asks /api/drift every 15s. On the owner's live magpie a heap profile showed Drift and Values allocating ~3.3 GB in 37 minutes, most of it DeepSeek Harness: settings.yaml (80 KB) parsed again for each field GetYAML read (465 MB of it), and each profile entry's YAML parsed again on each of dshCheck's looks (dshHomeHas, dshOver, dshConfigIndex, dshRoutesIn, dshConfig). - edit.loadYAML memoizes the parsed root through filememo, keyed by the file's stat, and shares it with GetYAML, GetYAMLMap, GetYAMLList and GetYAMLText, which only read it. Writes go through their own parse as before. BlockList skips the decode for a text that starts as a block list (blockSequence), which every dsh patch list does. - dshNodeShared parses an entry's text once and shares the node with the read-only lookers (dshConfig, dshConfigIndex, dshRoutesIn, dshOver's patch side). The writers (dshOver's base, the route and start writes) keep dshNode's own copy. 512 entries kept at most. Run on mote (macOS 27.2): - Probe on copies of the owner's real ~/.dsh (settings.yaml, config.yaml, the desktop and web profiles; probe not committed, copies deleted): a.Values() + a.Drift() per poll, 20 polls: 16381 KB / 223788 allocs per poll with the edit change alone -> 4355 KB / 2588 allocs. - TestGetYAMLParsesTheFileOnce (new): a look at a 3000-entry file allocates under a tenth of its size; sees SetYAML, another process's write, a removed file and a list-topped file. TestBlockSequenceAgreesWithADecode (new): ~24 texts against yaml's own decode. - TestDshLookParsesAnEntryOnce (new): with dshConfig and dshConfigIndex put back on dshNode by hand: "27388 allocations, want a few", red. Restored: ok. It also checks a writer's change never shows in a look. - go test ./internal/agent ./internal/edit: ok (164.2s, 5.9s). go vet both: ok. gofmt -l: clean. Not tried: the full suite (only internal/agent and internal/edit call these); a live window poll after the release. |
||
|
|
f1eeeb8fd5 |
sessions: a Codex session's window lives an hour past its last change, not five minutes (#4369)
A Codex rollout's summary and its calls each keep an index of what they read (the Codex window) so the next lines are read on from where the last read ended. A window was let go five minutes after its file last changed (revisionIdle), so the turn after any longer pause (a long think, a meeting, a review of the diff) read the whole rollout again from its first line, for the summary and the calls alike: on #4369's real rollouts, 21.5 MB read twice for one line. revisionIdle is an hour, as a working Claude window's already is (revisionWorking). What can be held is bounded as before: revisionFiles (8) windows within revisionEntries, and revisionActiveFiles (2) past it up to revisionActiveEntries each, so the most held is what working sessions held already; an idle one is held longer. A session left over an hour is read whole once on its next turn, now in one pass for both readers (the commit before). Run on mote (macOS 27.2): - TestCodexSessionReadOnAfterAPause (new): a 40-call rollout last changed ten minutes ago is read (calls, then List), a turn appended: no scan of it from 0, 41 calls. With revisionIdle back at five minutes: "the turn after a pause read the rollout from its first line: [0 0]". Restored: ok. - go test ./internal/sessions -run "Pause|Revision|Settled|LongCodex|PlainRollout": ok. - go test -timeout 45m ./internal/sessions ./internal/usage ./internal/gateway ./internal/gui: ok for sessions (11.3s, -race 56.2s, at this tree), usage (30.2s), gateway (575.6s); internal/gui: ok but TestMainWindowCorners/macOS_26_SDK, red on macOS 27 as #3949 records (same message), untouched here - TestIdleWindowsYieldToRecentWork's ten-minute pause was written -2*revisionIdle (ten minutes at five); it is ten minutes as written, since at an hour it was a two-hour pause, past revisionWorking. - gofmt -l: clean. Not measured: RSS over an hour of real Codex use with several sessions open; the bound is the count above, not a measurement. |
||
|
|
2140f5b935 |
sessions: a plain Codex rollout read from its start has its calls read on the summary's pass (#4369)
A start parses every changed session file for Sessions (refresh ->
parseWith), then reads every changed file's calls for Requests
(ReadCallSource -> readCalls). callsAlong already let a packed rollout
and an unread Claude session be read once for both; a plain .jsonl
rollout was read twice. On copies of the owner's real ~/.codex and
~/.claude (1.7 GB), a cold start scanned 931 times, 3.49 GB, every large
rollout x2.
callsAlong now takes a plain rollout too, when both reads start at its
first line: the summary it goes on from has no Codex window (nothing
kept, or kept on disk, which holds none), and parseWith lets the ride go
when either read goes on from an offset (calls.st.Off as well as s.Off),
so a read on from where it was is two incremental reads, as before. A
summary that still has its window is passed in so such a file's calls
shard isn't loaded only to be let go.
keepCalls names the root when none is named yet. A ride keeps a
rollout's calls (Codex window and all) during the Sessions parse, before
any Requests read has called pruneCalls; pruneCalls took the empty root
for a moved one and dropped everything kept. The shard on disk has no
window, so the next line read the rollout whole again (in the same run,
seconds after the start). TestHistoricalClaudeFilesDoNotDisplaceActive
Windows went red on exactly that ("rebuilt active call shard" for its
Codex rollout) until this.
TestWarmReadsOnlyInItsSlots' calls phase found nothing left to read,
since the index phase now reads every file's calls along; it appends a
line to each source first, so the calls have reading of their own.
Tests' forget (in the new test, claude_ride_test.go and
codex_zst_warm_test.go) calls Reset before removing the cache file:
Reset writes a save still pending, which put back the file just removed,
and the next List then went on from disk states (no window), red 1 in
~40 under -race. TestHistoricalClaudeFilesDoNotDisplaceActiveWindows
waits for the save (saved()) before writing its marker onto a cached
state the save's goroutine was encoding (a DATA RACE under -race).
Run on mote (macOS 27.2):
- TestPlainRolloutReadOnceForSessionsAndCalls (new): 3 plain rollouts.
Nothing kept: each scanned once, from 0. Read, kept on disk, the long
one grown and Reset: that one scanned once, from 0. An append in the
same run: no scan from 0 (with keepCalls' root line removed by hand:
"an append: the long rollout read again from its first line:
[213219 0]", and the Historical test red as above). Calls, List and StatsAt reflect.DeepEqual to
a calls-first read without the ride in each case. With plain rollouts
kept out of callsAlong by hand: "first read: ... scanned from [0 0],
want once from 0" for all 3. Restored: ok. -race -count=80 with
the Packed, ClaudeSessionReadOnce, CodexSessionReadOn, Historical and
WarmReads tests: ok (108.8s)
- Real data (copies of 1.7 GB of the owner's sessions, probe run
sessions.List(200), usage QueryPage Today and Week; probe not
committed): cold 931 scans / 3.49 GB -> 718 / 2.10 GB, no rollout read
twice; no change 0 / 0; the first line appended to the newest rollout
after the cold read: read whole by both readers -> read whole once
(1 scan, 10.8 MB; the before run's newest was a 21.5 MB one, read
twice). It is read whole at all because it was last changed on 10-31,
past any window's idle time: a session left that long is read whole
once on its next line, now in one pass. Later lines: 2 scans, 0 MB.
- go test -timeout 45m ./internal/sessions ./internal/usage
./internal/gateway ./internal/gui: ok for sessions (11.3s, -race 56.2s, at this tree), usage (30.2s), gateway (575.6s); internal/gui: ok but TestMainWindowCorners/macOS_26_SDK, red on macOS 27 as #3949 records (same message), untouched here
- GOOS=windows and GOOS=linux go vet ./internal/sessions: ok. gofmt -l:
clean.
Not tried: a packed rollout's path is unchanged (it rode before).
|
||
|
|
01d4489a28 |
routing: the trace says what a classifier answered when no rule matched
95cf9d86d (ggbdpq, #4598) records a classifier's answer as it said it (classified.said), even when no intent came of it. The Routing page still showed every such turn as "said none". Geidorf's report was about that page: a turn routed with "no rule matched" and nothing saying why. When a decision model names a choice that no rule's intent came of (its own "none of these", or a kind under the sure-enough bar), the trace now says "answered “…”, which is no rule's intent". A chat model's 0 is none and still says so. The new words are in zh, zh-TW, ja and de. Run (mote, at this commit's tree, chromium and webkit): routing-classifier-said (new), routing-intent-fallback, routing-smart-intent and i18n-keys: 104 of 104 pass. Broken by hand: with the answer not read (answered = ""), the new file is red in 20 of 30: every "answered" case in both engines, five languages and two widths. The "0 still says none" cases stay green. Not tried: the real app with a real decision model's answer; the rest of the GUI suite (text only, no layout or API change). |
||
|
|
06faf449af |
gateway: a relayed Responses stream's sequence numbers keep counting up
257b9ad49 (ggbdpq, #4743) makes a relayed Responses reply's text calls into function_call items. It held the message's done events while it read the text and numbered the events it made on from the last number the upstream sent. The held done events then went out after the calls with their older numbers, and the completed event kept its number, below the calls' numbers. A client that orders a stream by sequence_number saw the stream go back. Everything the relay sends now goes through numbered(). An event whose number is at or below the last one sent goes out as one past it, and an event already past it keeps its number, so a stream nothing was made in is sent as it came. This also removes responsesToolNames, which nothing called: the wiring reads the names with chatToolNames. Run (mote, at bfa911da8 on origin/main |
||
|
|
50be0751ff |
library: a skill lock entry doesn't take over a folder of the user's own
51be9afb0 (ggbdpq, #4645) lets a skill the skills CLI installed be updated from where ~/.agents/.skill-lock.json says it came from. The lock is matched by name and by the folder's write time, and lockOrigin asked nothing about the skill's own source. A skill the user installed from a folder of their own, under a name the lock also has (grill-me from their own skills folder and a lock entry for mattpocock/skills), showed GitHub as its origin, and an update replaced it with the repository's copy. lockOrigin now follows lockRepo's grouping rule: it is the origin only of a skill with no source, or one whose folder is in ~/.agents/skills. Run (mote, at this commit's tree): go test -tags nogui ./internal/library ok, with TestSkillLockOriginUpdates, TestSkillLockOriginStale and the new TestSkillLockOriginLeavesUsersFolder. Broken by hand: without the guard, TestSkillLockOriginLeavesUsersFolder is red: "origin https://github.com/mattpocock/skills" and, after the update, the source is the GitHub tree, not the user's folder. Not tried: the skills CLI itself; the lock is written by hand in the test. |
||
|
|
50d9add249 |
netproxy: the global proxy's move is read from the shared settings
5a26a6af4 (ggbdpq, #4523) checks on every request whether the global proxy changed, through settings.Load(), which reads and parses settings.json each time. Every other per-request read of the settings goes through settings.Shared(), which parses again only when the file changed, so this one does too. Run (mote, at this commit's tree): go test -tags nogui ./internal/netproxy ok; TestGlobalSwitchDropsTheOldProxyConnections passes with Shared, so a switch written to settings.json is still seen on the next request. Broken by hand: none for this line itself (it changes cost, not behaviour); the patch's own test goes red with the move check off ("1 connections through A, 0 through B"). Not tried: a real proxy switch in the app. |
||
|
|
20f27f5148 |
fix(gateway): a relayed Responses or Gemini reply's text is read for the calls written into it (#4743)
What changed - textcalls_relay.go: responsesTextCalls reads a Responses reply relayed as it came — a Codex turn to a provider that speaks Responses itself. Text from where a call is written into it is held from output_text.delta on; the part's output_text.done, content_part.done and the message item's output_item.done wait with it; at response.completed the held calls become function_call items (added, arguments deltas, done) and the completed output says them too. A reply that came whole is read over its output's message items. - geminiTextCalls does the same over candidates[].content.parts: text parts held or trimmed as the chunks come, the held calls functionCall parts at the candidate's finishReason; a whole generateContent reply (Vertex AI) the same. A reply that made calls itself (native) goes as textCallTidy lets a Chat one: only tags left in its text go. - gateway.go: both wired into the relay funnel beside textCallTidy and anthropicTextCalls; geminiToolNames reads a Gemini request's functionDeclarations. Run - go test ./internal/gateway/ -run TestInvokeReported -count=1: the two new passthrough cases red before, green after; the package's full run green. |
||
|
|
c57ac416d3 |
fix(library): MCP writes to Claude Code's .claude.json take its save lock (#4747)
What changed: the Library gave Claude Code its MCP servers by reading ~/.claude.json (or $CLAUDE_CONFIG_DIR's) and writing it back with no lock held, while Claude Code saves the same file often (project state, tips, usage counters) under a lock of its own, <the file's real path>.lock: a save of its own between the Library's read and write was lost. The lock helpers move out of internal/provider into a small claudelock package (the mkdir lock Claude Code 2.1.316 takes, stale after 10s for this file), putClaudeLogin keeps its #4532 behavior through wrappers, and the Library's mcpFile.putEntry and mcpFile.del take <file>.lock around the .claude.json read-modify-write: they wait while Claude Code holds it, take over one left stale, and fail the server's write with nothing changed when it holds one past 20s. A WSL distro's copy is left as it was: the Claude Code there saves under a lock in the distro's own files. Run (mote, -tags nogui): - TestClaudeJSONMCPWaitsForClaudeCodesLock and TestClaudeJSONMCPTakesAStaleLock (internal/library): red on the old code (saved while Claude Code held the lock; a stale lock left behind), green now. - go test ./internal/library ./internal/provider -tags nogui: both packages green, the #4532 lock tests among them (TestClaudeSwitch… refresh/legacy/config, stale takeover, held past the wait). - race on the lock tests of both packages; go vet on the three touched packages for darwin, linux and windows; gofmt clean; go build -tags nogui for darwin, linux and windows. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
a4c74a059e |
fix(gateway): Copilot's Gemini takes Codex's disjoint unions as oneOf, its Grok the custom tools as functions (#4374)
What changed: Codex Desktop through Copilot failed on every tool-bearing turn, on two wires at once (#4374). The Gemini models, served on chat completions alone, answered 400 "invalid request body" to a turn whose whole content was "hi" — the tool schemas' anyOf of object branches is what Copilot's Gemini rejects, as #3931's comparisons showed (the same request with the unions as oneOf came back 200). A union whose branches are provably disjoint now goes as oneOf, renamed in place: both branches require a string field whose enum or const values never meet, or one requires a field the other forbids through additionalProperties: false. A union that can't be proved stays an anyOf, Copilot's other models are untouched. Grok 4.7, served on /responses, answered 422 "422 Unprocessable Entity: Unprocessable Entity" six requests in a row: xAI behind Copilot takes no custom tool (#3392), and Copilot's answer in front of Grok says no more than the status (#378), so the refusal-learner that serves the vendors whose answer names them (#2656) has nothing to read. A Codex turn with a custom tool to a Grok model on Copilot is translated from the first ask, as a learned refusal does elsewhere. Run (go test -tags nogui ./internal/gateway): - TestCopilotGeminiTakesCodexUnionsAsOneOf: a fake Copilot refusing a tool schema with an anyOf, word for word as #4374's Gemini record, is answered; the union goes out as oneOf - TestCopilotGeminiKeepsUnprovenUnions: a union no one can prove stays an anyOf and the refusal still reaches the client - TestCopilotGrokTakesCustomToolsAsFunctions: a fake Copilot whose Grok refuses a custom tool with #2951's bare 422 is answered; apply_patch goes as a function, GPT on the same /responses keeps it as it came - RED on the parent commit: the first and third fail with the refusals named above; the second holds before and after — it guards that only what is provable is renamed Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
e02bc8c49b |
fix(agent/codex): keep the user's model_provider over a takeover or reset (#4347)
What changed: the beside wiring of a Codex takeover took the top-level model_provider down silently whenever a magpie model was picked beside the ChatGPT sign-in — a provider of the user's (CC Switch's custom, an older takeover's) went with it, and every Codex thread saved with that provider stopped resuming (modelProviderMismatch: Codex falls back to its built-in openai, the threads name the provider they were started on, #4347). The wiring now steps beside only from a provider magpie puts back itself (its own, none, CC Switch's mirror of OpenAI, as Join already has it); over a provider of the user's the takeover names magpie instead and keeps the user's spelling in the stash, for Unwire to put back, as any takeover does. A reset leaves the line where the user put it too: it takes magpie's keys out, not theirs. Run: go test -tags nogui -run 'TestCodexTakeoverKeepsUserProvider|TestCodexResetKeepsUserProvider' ./internal/agent/ (both fail on the parent, pass here); go test -tags nogui ./internal/agent/ passes. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
0639fdd8f9 |
fix(gateway): a Grok key relay's compaction-blob refusal now strips the sealed reasoning and asks again (#4412)
What changed: foreignReasoning — the words that mark a vendor's refusal of sealed reasoning it cannot read, and put the conversation on the asked-again-without-it path (strip, retry, and the seal left out of later turns up front) — gains one alternative for xAI's "Could not decode the compaction blob. Ensure it is unmodified from the compact response." A key relay that proxies Grok (an opencode-go-style member, no account, any base URL) hands back exactly that for the reasoning item Codex writes with "content": null beside its encrypted_content, and until now the 400 went to the client after a single try: the #3392 shaping (xaiBody's null-content removal) never runs on such a relay because its host is not api.x.ai, and the refusal named no item and nothing of encrypted content, so foreignReasoning passed it by. The wording anchors on "could not decode/decrypt ... compaction blob", so a refusal at fault some other way still is not taken for one. Run: go test ./internal/gateway/ -run 'TestForeignSealGrokRelayCompactionBlob|TestForeignReasoningWords' -tags nogui (both fail on the parent, pass here; the ablation — reverting internal/gateway/affinity.go alone — turns both red again); go test ./internal/gateway/ -tags nogui; gofmt clean on both files; go vet -tags nogui on internal/gateway for darwin, linux and windows; go build -tags nogui for all three. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
6803d7d51c |
fix(library): update skills the skills CLI installed from where its lock says (#4645)
What changed: A skill installed with the skills CLI (npx skills add) and brought in or handed over kept only a From label in library.json, so `magpie library skill update` said it "isn't from GitHub or a git repository" and the check for updates skipped it. The lock that named its repository for grouping now names it for updating too: lockOrigin (the lock entry's sourceType is github, the lock says when it wrote the folder, and the folder is the one it wrote, madeBy) is asked where CC Switch's record is, in updatable and prepare. Updated that way, the skill carries the source in library.json from then on, as one installed from GitHub does. A lock entry that says no time, or a folder the CLI didn't write, only groups, and stays as it is. Run: go test ./internal/library/ -run 'TestSkillLockOrigin' -count=1 -v go test ./internal/library/ -count=1 -tags nogui Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
f73b780422 |
gateway: a group's trace says what its classifier said, as it said it (#4598)
What changed: Classified keeps the classifier's answer as it said it
(said): the number a chat model answered with, 0 for none, or the choice
a decision model named, "none of these" included. readIntent gives the
number back, readJev keeps the choice, and the trace's rule.classified
carries the said on. An answer that named no rule's intent — a chat
classifier's 0, a decision model's own none-of-the-kinds option, a kind
named under the sure-enough bar — all read "said none" in the trace
before, so a group's fallback kind ("not any of the above") that never
matched looked the same as an answer no rule could take.
The matching itself is as it was: a classifier that answers the
fallback kind's number still routes by that rule, which a test now
holds (it passes unchanged); the said is only what the trace tells.
Run: go test -tags nogui ./internal/gateway (pass; without the change
TestClassifiedSaysTheClassifiersAnswer fails "the classifier said 0,
the trace says \"\"" and TestClassifiedSaysWhatJevChose fails "Jev
chose \"none of these\", the trace says \"\""); gofmt -l prints
nothing; go vet and GOOS=linux/windows go vet on the package pass;
go build on darwin, linux (-tags nogui) and windows pass.
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
49c99e18d1 |
provider: quota history draws measured windows set aside for routing (#4612)
chowyuan1314: the Cursor plugin marks its Weekly window aside when on-demand or free credit can pay, and Grok Bot always — using them up doesn't stop the account, so routing sets them behind — and both carry a real percentage. pointOf refused every window set aside that wasn't a pool's, so quota-history.json took no point for them and the card had no curve, while the same account's Codex windows drew theirs. The aside check predates the pools' (#651); the pools' own exception ( |
||
|
|
dd809ea60f |
gateway: an input item's id longer than the 64 an upstream that checks ids takes goes shorter, as its kind's prefix and the sha256 of the whole of it (#4525, #4527)
Codex carries every id an earlier turn came back with, and Copilot gives its items ids hundreds of characters long: 420 as isnine's sessions each showed (#4525), 444 as ghjkllasdf-fake's approval session and its guardian review did (#4527), all of the characters OpenAI takes an id of. plainItemIDs checked the characters only, so every later turn went to Copilot as it came and was turned away 400 "Invalid 'input[N].id': string too long. Expected a string with maximum length 64, but got a string with length 420 instead." — the conversation stuck, a tool call never answered, Codex's automatic approval review failing over it. An id longer than the 64 goes as its kind's prefix ("msg_", "rs_") and the sha256 of the whole of it, cut to fit: the same id to the same shorter one every turn, and no two ids land on one, where a plain cut could (ids of a vendor can begin alike). Copilot's own reasoning, overlong but of the right characters, keeps its place with its seal — an upstream that checks ids made that one, its encrypted_content is its to read, unlike another vendor's, which still goes as it did. A call's call_id was bound already (BoundCallID); one shorter than 65 goes as it came. What changed - gateway: itemIDCap (64) and boundItemID, and plainItemIDs bounds an input item's id at them, on every relay that checks ids as OpenAI does — Copilot's /responses among them (validatesItemIDs) - tests: an id checker that turns an overlong id away word for word as isnine got it; Codex's turn over a Copilot conversation of overlong ids asked twice, the same bound each turn; the 64/65 boundary, determinism, idempotence, two ids that begin alike going to two; the parity harness holding plainItemIDs to it beside what it was Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
cb35d2fa94 |
fix(netproxy): a switch of the global proxy drops the old proxy's idle connections (#4523)
What changed - Dispatch now remembers the proxy setting each request left under and, when it moves, closes the idle connections it kept (base's and every provider clone's), so the request after a switch dials through the proxy in force. A transport pools by target host, and its HTTP/2 connections by the authority alone, so until now a Test after the switch rode the old proxy's connection and left by the old exit while the new proxy was the one shown. Run - go test ./internal/netproxy/ -run TestGlobalSwitchDropsTheOldProxyConnections fails on the parent (1 connection through A, 0 through B after the switch), passes here; the package's full suite passes (-tags nogui). Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
a73df419d8 |
davsync: a GitHub blob POST on a slow but live line is no longer cut off at 30 s
What changed: the stall watchdog saw a request as one whose body may outlast the whole metadata limit only by method (GET, PUT), and gave every other request a flat 30 s (#657's rule held for WebDAV and S3, whose remaining requests move a few KB at most). GitHub's uploads ride a POST: each blob POST hauls up to 16 MiB of file as about 21 MB of base64, and a flat 30 s needs 550 KB/s to get one part through (#4576: on a slower line the sync failed on the same POST at every attempt, automatic, at start and manual, and never recovered -- the usage day file froze in the morning while the machine kept working). A request hauling a big body (64 KiB or more) now gets the same moving-aware budget as a PUT: the watchdog is put back each time bytes move, and after the body is all handed over the answer gets 60 s on top of as long as the write took. The metadata requests (the GitHub tree, commit and ref POSTs and PATCH, WebDAV PROPFIND/MKCOL/MOVE/DELETE -- kilobytes at most) keep their 30 s in all. Run: TestGitHubSlowBlobUploadIsNotCutShort (a 272 KB base64 body through a line at 320 KB/s, watchdogs shortened to 1 s/300 ms) fails on the old code with "the server didn't answer in 300ms (POST)", the shape of #4576's error, and passes now; TestGitHubSmallPostKeepsTheLimit pins the small POSTs to the old limit either way. go test -tags nogui ./internal/davsync, vet and builds for darwin, GOOS=linux and GOOS=windows pass. Not tried against a real slow line to GitHub. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
3b7fe8e5f3 |
fix(cli): visible <agent> all clears the models taken out and the only-picked switch
What changed: `magpie visible <agent> all` took only the visibility narrowing out, leaving HiddenModels and PickedModels in place. An agent shown none of them — shown only the models picked for it with none picked, then switched to --show-new, which keeps what it is shown by taking the rest out — stayed none through `all`, the very recovery `magpie models` and the gateway's refusal to name a model point at; only deleting hiddenModels.<agent> from settings.json brought the models back (#4587, a DSH behind a Docker gateway saw an empty model list; #3432, closed as not planned, the same for an only-picked agent). `all` now takes the hidden models and the only-picked switch out together with the narrowing, and its usage line says so. Run: go test ./internal/cli/ -run 'TestVisibleAll' -tags nogui — two new tests fail before the change and pass after it. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
611ce90d15 |
agent: OpenBot, magpie's models in its model picker (jiezhengj)
OpenBot (nightly-labs/openbot, openbot.run, v0.58.0) is a new row on the
Agents page. jiezhengj on Discord asked for it: today they type magpie's
address into OpenBot by hand and add each model one at a time.
OpenBot lists the user's own OpenAI-compatible endpoints from
openbot-custom-providers-v1.json in its userData folder:
~/Library/Application Support/OpenBot, %APPDATA%\OpenBot, or
~/.config/OpenBot. Connecting adds an entry with id "magpie" pointing at
the gateway's /v1 and holding the models picked for OpenBot, with
secret null. OpenBot seals an entry's key in safeStorage, which magpie
doesn't open, so the entry has no key. OpenBot hands it to OpenCode
keyless, and the gateway accepts it as a request from this computer.
What the entry keeps to:
- OpenBot's decoders drop the whole list over one bad entry. So the entry
has at most 64 models, only ids OpenBot accepts as magpie/<id>, and a
context window only inside 1,024 to 100,000,000.
- The user's other entries stay. The name, harness and secret they give
magpie's entry in OpenBot stay too.
- A sync with nothing to change doesn't write.
- A file whose version isn't the number 1, or whose providers isn't a
list, is one OpenBot refuses itself, so magpie leaves it alone.
- Disconnect takes out magpie's entry, and the file too when only the
version and an empty list are left.
OpenBot reads the file at start, so while it runs, a notice says to
restart it. The notice is in every language.
OpenBot is detected by its userData folder, OpenBot.app
(app.openbot.desktop), or OpenBot.exe under %LOCALAPPDATA%\Programs or
%ProgramFiles%. Docs updated: agent-wiring.md, reference.md, and both
READMEs.
Run at the pushed head, on mote:
- gofmt -l: clean.
- go vet -tags nogui for internal/agent and internal/gui, and for ./...
with GOOS=linux and GOOS=windows: ok.
- go test -tags nogui -count=1 -timeout 45m on internal/agent and every
package that imports it (., backup, cli, davsync, gui, library,
profile, stats, tui, uninstall, plugins/...): ok.
- GUI: agent-notice-lang, i18n-keys, header-relang and about-notices in
Chromium and WebKit: 58 of 58 pass.
After rebasing on
|
||
|
|
d20caffae1 |
release: notes written again on magpie-releases are copied here each hour
GrayRabbit on Discord (11-02): the "更新内容" dialog in Chinese listed v0.1.2634 on as raw English commit subjects. magpie-releases' release runs got "Insufficient Balance" from DeepSeek for both the changelog and its Chinese since v0.1.2634, so those releases went out with the commit list and no <!-- lang:zh --> part, as v0.1.1233 to 1242 did (#2122). magpie-releases b90a82b now writes such notes again each hour (notes.yml) once DeepSeek answers. - notes-mirror.yml, hourly at :53 and by hand: a release here still without the zh marker gets magpie-releases' notes of the same tag once those have it, with the mirror's footer. The app reads magpie-releases through usemagpie.ai, so this is the GitHub page. - release.yml's notice on #2260 names insufficient_balance_error as a DeepSeek top-up and says the notes are written again by themselves. v0.1.2634 to 2644's notes were written by hand from their commits, in English and Chinese, on both repos' releases. Run: actionlint 1.7.7 (mote) on notes-mirror.yml and release.yml: nothing but release.yml's existing unknown runner labels. No Go or GUI code changed. Not tried: notes-mirror.yml on GitHub's runners before this push. |
||
|
|
e87140242b |
settings: Check in now for one account, its switch left as it is (xiaowu_95660)
xiaowu_95660 (Discord #general) asked for a way to check in one account
right now where its daily check-in switch is, without turning the switch.
- provider: a checkiner can be held to one account (`only`), and
CheckInAccount(ctx, by, key) runs the same claim path once for it, for
WorkBuddy, Trae, MiniMax, Qoder and every plugin with a check-in.
CheckinOff is not read or written.
- gui: POST /api/usage/checkin-account {By, Key}. Settings' daily check-in
group (built-ins and plugins) gets a "Check in now" row under its
accounts. One account checks in at once; several open the app menu to
pick one. The line says done, already checked in, not eligible,
inactive, captcha, own-app or the failure. Only quotas reload, so
Settings isn't redrawn under the button.
- The row and press live in the lazy checkinnow.js (core budget unchanged,
three check-in comments cut). Once loaded it draws at once, so a redraw
by the switch doesn't shorten the page for a moment.
- Strings in zh, zh-TW, ja, de. provider-plugins.md says how it works.
Run at befdfa72b (on origin/main d89f03aa9;
|
||
|
|
9f1734645a |
appdir: exports go to the Downloads folder the system keeps, not home/Downloads
1Shin on Discord (#feedback, 11-02): an export (Settings' backup, a
request saved from the archive, a session as Markdown, the usage file)
joined $HOME/Downloads, which is wrong when Downloads was moved: Windows'
known folder (to another drive or OneDrive) or the XDG one on Linux
(~/下载 on a Chinese desktop).
appdir.UserFolder(kind) asks the system: SHGetKnownFolderPath
(FOLDERID_Downloads/Desktop/Documents, KF_FLAG_DONT_VERIFY) on Windows,
used when magpie's home is the profile Windows keeps it for (a home given
of its own, as a test's, keeps home\Downloads); $XDG_CONFIG_HOME/
user-dirs.dirs on Linux and the BSDs, read as xdg-user-dir does ("$HOME/x"
or "/x", quoted, backslash escapes, the last line wins); ~/Downloads on a
Mac. A failed lookup is home/kind, as before. gui's downloads() tries it,
then home/Downloads, then home. appdir's sharedFolder (a data folder
beside magpie there isn't portable data) adds the system's folders to
home's, and Cursor's AppImage is looked for in the system's Downloads too.
update's isDownloadFolder already asked Windows for its known folders and
is unchanged.
Run at this head (rebased on origin/main):
- mote (macOS): gofmt -l clean; go vet ./internal/appdir ./internal/gui
./internal/agent; GOOS=windows go vet of those and ./internal/update;
GOOS=linux go vet -tags nogui of the three; go test ./internal/appdir ok,
-run "Backup|Export|Archive" ./internal/gui ok, -run
"Cursor|Desktop|Sandbox" ./internal/agent ok.
- wsl-run (Ubuntu 24.04): appdir's UserFolder/SharedFolder/ResolveDownloads
tests and gui's TestExportGoesToTheSystemsDownloads,
TestBackupLibraryRoundTrip and the session exports pass. Against the real
xdg-user-dir in a sandbox HOME, "$HOME/下载", "/mnt/d/My Downloads" and
"$HOME/a \"b\"" read the same; "$HOME/" gives home without the trailing
slash.
- win-run (Windows 11): the appdir tests pass, and
TestKnownFolderIsExplorers checks the known folder against Explorer's
User Shell Folders value (read only). Windows expands that value's
%USERPROFILE% once a process, with the first call's environment, so the
check runs in a child of its own. The real profile gives
C:\Users\yeton\Downloads, Desktop and Documents.
Broken by hand: no user-dirs.dirs read, or no profile check on Windows:
TestUserFolderXDG, XDGLines, XDGConfigHome and TestUserFolderWindows go
red. gui's downloads() without the system's folder:
TestExportGoesToTheSystemsDownloads red in WSL (saved in ~/Downloads, want
~/下载).
Not tried: a Downloads really redirected on Windows (to D:\ or OneDrive).
Moving it means writing the user's own User Shell Folders on the test box,
so the redirect is a faked known folder in TestUserFolderWindows only. Not
run: the GUI suite (no GUI file changed) and a full go test ./....
|
||
|
|
4ffd5b96dc |
provider: the Cursor move asks for plugin 0.2.36 (plugins#550)
Cursor plugin 0.2.36 (magpie-community/plugins@24cd0b9, on npm, checked with npm view --prefer-online): a stateless Run whose step sent its calls and then only heartbeats, with no tool count, hands the calls that came to the caller 60 s after Cursor's last non-heartbeat frame instead of waiting 240 s to go quiet. Windsland52's fifth wire trace: a native stall pushed the retry onto the stateless path, where two calls and no count cost another 4 minutes. keepMovedCurrent updates moved users. Run at this head (mote): go test ./internal/provider -run "Mover|Moved|Migrat|Retir|Plugin|Min": ok. GOOS=linux and GOOS=windows go vet ./internal/provider: ok. gofmt -l: clean. The plugin's own run is in its commit (bun test packages/cursor: 380 pass). Not tried: a real Cursor account on the plugin. |
||
|
|
d89f03aa92 |
settings: trayNoNumber is a key magpie settings sets, and GET /api/quit is the window's own (#4793, #4794)
|
||
|
|
3f393a4fae |
redact: a user name is not masked where code has the same word as a name (Tomyu_2034 on X)
Tomyu_2034 on X: "magpie 里面的 masking 很容易把参数变量名当成 user name
给 mask 掉". No sample was given, so the class was measured: with "User
name in home folders" and "User and computer names" on, two finders took
names in code for the user's.
- Known values (known.go). A user name the home rule found once
(/Users/developer/…) is known from then on when it is 8 bytes or more,
and standsAlone's default bound is a letter or a digit only, so it was
masked wherever the word stood between anything else: def
run(developer, developer_dir), developer_mode = True, const developer
= 1, {"developer": true}, - developer_count := 0 in a diff, a tool
call's old_string. A user name such as developer or workspace1 is a
word code has too.
- The "User:" line rule (more.go). Its unquoted value was any
login-shaped word, so user = current_user, user: UserInfo, login =
loginName, username = target_name, a Go struct's "\tUser UserProfile"
and a TS interface's "user: CurrentUser" went as made-up names.
nameAlone now decides a known USERNAME: it is the user's name as a word
of its own in text (a path's part, name@host, --author=name, ls -l's
owner, uid=501(name), prose, a quoted string, chown name:staff), and
code's where it is joined to another part (_ $ a letter or digit beside
it, or a . or - with one past it), declared (const/let/var/def/func/
class/return/import…), assigned or called (name =, name(, name[,
name :=, x = name), a JSON key ("name":), or a parameter ((name, ,name)
name: str, name string), but for id's 501(name)). Nothing is exempted
by a key's name: a tool call's arguments are read by the same rule as
any text, and a quoted value in them is masked as before. The "User:"
rule leaves an unquoted value made of two or more words (split at _ .
and camel humps) one of which says it holds a user (identParts: user,
name, login, current, target, info, obj, id…); a quoted one, and a
login of words of its own (deploy_bot, john_doe), are masked still.
The boundary costs this: prose that puts the name alone in a list
"(developer, alice)" or before "=" now goes as written; such text reads
as code to this rule. A name under 8 bytes was never matched as known,
so for those only the "User:" half changes anything.
Tests (identname_test.go), with "developer" (a common word) and
"rinakato" (a handle), known from a working directory first:
- TestUserNameInCodeIsNoUserName: a Python and a JS file read, a JSON
file, Go code, a diff and an edit tool call's arguments go as written;
a home path, --author=, ls -l, uid=501(), prose, a quoted string, a
JSON value, chown and a bash tool call's ~name go as the made-up name.
- TestUserLineInCodeIsNoUserName: seven code lines unmasked; User:
deploy_bot, USER=rinak, user: "current_user", ssh config's User and
user = john_doe masked.
Broken by hand: with more.go and known.go as on main both tests are red
(12 and 7 failures); with standsAlone's USERNAME case returning true,
TestUserNameInCodeIsNoUserName alone is red.
Run at this head (on origin/main 89ffc58f5; nothing since touches
internal/redact or the doc), on mote:
- gofmt -l clean; go vet ./internal/redact ./internal/masking, and
GOOS=linux -tags nogui and GOOS=windows go vet ./internal/redact: clean.
- go test ./internal/redact ./internal/masking ./internal/otlp
./internal/pii ./internal/sessions ./internal/settings: ok.
- go test ./internal/gateway -run '(?i)mask|redact|privacy|personal|
standin|restore': ok.
- go test ./internal/gui: TestMainWindowCorners/macOS_26_SDK red, the
AppKit title bar on mote's macOS 27 (#3949, open); nothing else.
Not tried: the full internal/gateway package and go test ./... (the
gateway takes ~45 min; pushed at once per the owner's ship rule); the
local model's PERSON finds, which already leave snake_case and
lower-case words (modelTakes, programWords); the home rule's
"/home/<segment>" in a web route ('/home/dashboard'), which reads as a
home folder and is unchanged; a real request with the reporter's code.
|
||
|
|
a8e98e1abb |
gateway: a Claude Code run that exits mid-reply is a failure, not a 200 (#4822)
A Claude subscription run whose Claude Code exited after its reply began, with no message_stop nor a result (only the message_start, or part of the text), closed its segment as if the reply had ended. The client was answered 200 with nothing or the words so far, and the agent took it as a finished turn. - readOutput: at the end of Claude Code's output, a reply begun on the open segment (KStart, tracked in emit as unended until a KStop or KError) ends with a KError, 502, "Claude Code exited before it ended its reply" and the end of its stderr. -p and the interactive mode share this path. - relay, not streamed: any error is a status, words said before it too (was: a 200 with the partial reply), as a translated reply cut short is (errEndedShort). The try's usage is kept as before ( |
||
|
|
89ffc58f5b |
gui: a card's Refresh says the read's failure, and Claude Code's first-run screens say what to do (#4817, uiuing)
From uiuing's branch (1eeb8928b, 66818dbf6), adapted. A usage card's
Refresh showed nothing when the read came back as a card with an
error: only a thrown request reached status. quotaRefresh now says the
refreshed card's error through quotaError, for a single account and
for a provider whose cards were replaced (the one kept in quotas).
quotaError reads the helper's new "stays on its first-run screens" and
an older magpie's "shows its first-run notes" as "Finish Claude Code's
first-run setup, then refresh", in en, zh, zh-TW, ja and de. Comments in
quotaError and quotaRefresh were cut so the core scripts stay in their
budget (1,533,732 of 1,533,802; main was at 1,533,780), with no raise.
Run at the pushed head, on mote: node --test of claude-quota-onboarding,
quota-refresh-order, usage-card-refresh, usage-refresh,
usage-refresh-flight, account-refresh, editor-quota-quiet,
usage-no-reading, usage-remote-cards, tray-usages, glm-quota-error,
claude-usage-asked, allowance-open-read, api-key-usage,
key-balance-card, copilot-signed-out-account, signin-again, plugin-git
and i18n-keys (chromium and webkit, every language each file runs, 440px
where it sets it): 287 of 287.
go test -run 'Budget|I18n|Lang' ./internal/gui ok.
go test -run "Claude|TUI" ./internal/gateway ok. The full
./internal/gateway (-timeout 45m, before the rebase onto
|
||
|
|
af4ff747bc |
claudetui: Claude Code's first-run screens are gone through as a person would, not the run's end (#4817, steven_4422 on Discord)
With "runs as" Interactive, a Claude Code whose onboarding was never finished (no hasCompletedOnboarding in the state file: steven_4422's every request 502'd, uiuing's /usage read in #4817) stopped on the "Security notes" screen, and |
||
|
|
62ffc40169 |
gateway: a waiting request goes to an account back from rest (01huadalang)
01huadalang on Discord (11-01): three ZCode accounts, three requests at once each. The first two got a 405 and rested, so every request went to the third, and those over its three waited in its lane. Once the first two were back, the waiting ones stayed on the third, behind its long turns, until its requests were cut by hand. Same under Smart, In turn and Stays off. Cause: a request that queued in a lane (lanes.take) waited only for that lane's turn. Nothing looked again when another lane gave a slot back or a rest ended. With ZCode's maxAccounts 2, the third took a seat while the first two rested and was a reserve again once they were back, but the requests already waiting for it stayed. laneMate also gave way to a mate resting, because ready() checks only lane and RPM room. Change: - lanes.take takes a move func. While waiting (lanes.await), it looks again when any lane gives a slot back, when a rest is lifted (Unrest, UnrestAll signal lanes.freed), when the soonest rest among the others ends, and at least every 5s (laneRecheck). waitMate finds the first candidate after it in the planned order (then those probeOne left out for resting) of the same provider, or any member of a group, that has a free slot with no queue (tryTake), minute room, isn't resting, didn't give way, and isn't a reserve as keepAtOnce stands now. The request then leaves its queue (errMoved) and serve runs that candidate with the slot already taken for it. A fallback provider is never one. Strict stays leave no other candidate, so nothing changes there. - laneMate skips resting mates. - docs/subsystems/gateway-routing.md Limits row says so. Tests: - TestWaitingRequestGoesToAccountBackFromRest: 3 keys, cap 3, MaxAccounts 2, k1 and k2 resting (405), 9 requests. 3 go to k3, 6 wait for it, and none reach the resting two. Then the rests are lifted (Unrest) or run out (300ms), and the six go to k1 and k2 while k3's three are still out (9 at once). Run under Smart and Rotate, with Stays default and off. - TestWaitingRequestTakesSlotGivenBackElsewhere: 2 keys, cap 1. A third request waiting for one key goes to the other when that one's request ends, under default, order, rotate and usage routing. - TestFullMemberGivesWay updated. c, waiting for first, now goes to second once second's b ends. d (first's fallback is second) still waits for first. Run on mote (mote-run), rebased on |
||
|
|
6b3a6d42c0 |
agent: VS Code's Agents window (vscode_agent_host) counts as VS Code, its turns as Codex's
justruman on Discord (#general, 11-01): VS Code's Agents window showed
in Usage as a raw "vscode_agent_host" row, 23 calls, 7 failed, beside
the "VS Code" row.
Why: VS Code's agent host runs `codex app-server` with clientInfo
{name: "vscode_agent_host"} (microsoft/vscode main at 8fb6054,
src/vs/platform/agentHost/node/codex/codexAgent.ts CLIENT_INFO; it
bundles @openai/codex 0.163.0). Codex sends that name as its
originator and at the head of its User-Agent, and it reads the user's
~/.codex config, so with Codex connected to magpie its turns come here
under VS Code's name. No agent's UA list had it.
- Usage: vscode_agent_host is in VS Code's UA list
(vscodeAgentHostUA), so those calls are VS Code's. Records are named
again at read time (ReportedAs -> AgentOf), so calls already logged
under the raw name fold into VS Code too. Insiders' and VSCodium's
agent host send the same name and are counted as VS Code (Stable):
nothing in the request tells them apart.
- Routing: fromCodex also takes vscode_agent_host (hostedCodex), so
every Codex rule holds for those turns. The one that fails without
it: one of Codex's own models asked there, which no account in
magpie serves, was answered 404 "magpie knows no model" instead of
going on Codex's sign-in (codexOwnOffMagpie). Also now applied:
spawn_agent's model list, compaction told in the stream on a byte
cap/overflow, Codex's headers to a keyed Codex-only relay.
- A test asked as Codex keeps only Codex's own names (codexNamed) as
Codex's shape: the agent host's headers never become it.
- VS Code's Copilot-proxied names (vscode_codex, vscode_claude_code) go
to GitHub, not magpie, and are not matched.
- docs/subsystems/gateway-routing.md says so.
Run on mote at this change rebased on origin/main 16ce5ed23; the
one commit since,
|
||
|
|
e65bc84731 |
plugins: a git plugin updated past the commit the look found waits no more (#4802)
matrix0487 (Discord, #4802): github:faithleysath/magpie-oh-my-aihub, unpinned. The look at 14:38:55 wrote {version: fdaa691, latest: 3b411a5}; the repository moved on to ba898e7 twenty seconds later, and Update installed ba898e7. The dot, "Update all (1)" and the row's New commits stayed until the next hourly look, and every Update after said only "is up to date". Cause (checked against the source, as the reporter traced it): - PendingUpdates kept a git entry until the commit installed was the recorded latest (GitBehind is installed != head, not "behind"), so a commit newer than latest kept it forever. The npm branch compares versions in order and was right. - Upgrade, Update and add never touched plugin-updates.json; only the next CheckUpdates/CheckNow rewrote it. - The page kept /api/plugins/git's old head (3b411a5) in its heads map, and merge() put it over the plugins' own fresher head after the update, so the row's New commits and Update all stayed even with the file right. Changes: - waitsNoMore (shared by PendingUpdates and the new settleWaiting): a git entry also waits no more once the commit installed is not the one the look saw installed (Version). - settleWaiting rewrites plugin-updates.json without what waits no more, after add (every install, npm Upgrade, Update's pinned path), a git Upgrade, Update (Update all) and InstallMissing. Checked time is kept. - reinstall's #2954 "left it at X" error now needs the commit to have stayed: a moved install that can't ask the repository again (rate limit, offline) isn't reported as stuck on the look's older head. - plugins.js: an action on a plugin (Update all: on every one) drops the page's cached head for it, so the plugins' own head is drawn; a git Update whose commit moved says "{name} updated to {commit}" (zh, zh-TW, ja, de), and the Up to date chip's tooltip prefers the row's head over the check's. Siblings: npm (version order already right; now also rewritten on file), a commit pin (dropped once at the pin: test case), Update all (same flow as Upgrade: test case), the toast (above). CheckNow/CheckUpdates rewrite the file as before. Tests (reporter's literal fdaa691 / 3b411a5 / ba898e7): - TestGitWaitingGoneOnceUpdatedPastTheLook: installed ba898e7, 3b411a5, another commit, still fdaa691 (waits), and a pinned spec. - TestSettleWaitingRewritesTheRecord: git + npm entries gone from the file. - TestGitUpdatePastTheLookWaitsNoMore: fake bun + fake GitHub; look, push, then Upgrade / Update / Upgrade with GitHub down after; nothing waits on file or in PendingUpdates, and the update isn't an error. - plugin-git.test.cjs: the repository moves on after Check for updates; Update installs ba898e7, no New commits, no Update all, toast names it. Run at the pushed head (rebased on |
||
|
|
16ce5ed232 |
usage: an account whose longer window is used up adds no headroom to the all-accounts sum (#4791)
hayden4608 (Discord) and handong66 (#4791) have four Codex accounts. Three show 5 hours 100% left with 7 days 0% left, and one shows 5 hours 0% left with 7 days 22% left. The All accounts strip read "5 hours 75% left", but none of those three can spend its 5 hours until its week starts again. The right figure is 0%. mergeQuotas (quotaall.js) is the one place that sums windows across accounts. It feeds the Usage page's strip, the tray panel's strip and the Routing groups' line. The native menu-bar tray, the TUI, the CLI and /v1/magpie/quotas show one account at a time and are unchanged. The GUI's JSON doesn't carry Aside, Model or the matches, so the call is made in Go. provider.WithHeldWindows marks a window heldBy another window of the same account when that other window: - stops the account for every model, by routing's rule: not aside, no model, no matches, used >= 100, reset not passed, and not Codex credits that go on; and - starts again after this one (by reset times, else by span). So 7 days used up holds 5 hours, but 5 hours used up doesn't hold a week with 22% left. /api/usage/quotas and its refresh apply it. mergeQuotas counts a held share window as 100 used and a held counted one as its limit, and the strip's tooltip says how many were counted that way (en/zh/zh-TW/ja/de). The account cards still show the vendor's own figure. Run on mote (macOS) at this head's parent tree: - go vet for darwin, linux (nogui) and windows: ok; gofmt -l: none. - go test -count=1 ./internal/provider ./internal/gui, before the quota_span leftOut line and an i18n comment fix. The provider package's only red was TestQuotaSpanCarriesEveryWindowField, which wanted heldBy named, and it is now named. internal/gui's only red was TestMainWindowCorners/macOS_26_SDK, which is #3949. - GUI, chromium and webkit, every language, 440px and 360px: quota-*, usage-* (all-accounts, merge, accounts, fold, refresh and more), panel-usage/quota/switch-accounts/balance-order, routing-quota-left, routing-group, tray-usage, i18n-keys, gui-de/ja/zh-tw, old-webkit: 704 of 707. The reds were i18n-keys (a quoted "All accounts" in window_held.go's comment, fixed here) and usage-fold's "17 subscriptions and 29 accounts" in both engines, which is #4790 and is red at origin/main too (see below). At the pushed head, rebased on |
||
|
|
99d9016fd9 |
provider: Devin's mover min is 0.1.32, so a system notice mid-conversation keeps its place (plugins #599)
devin 0.1.32 (plugins 17525a7, leosocy) sends a role:"system" notice that comes partway through a conversation as a user prompt, in its place and with its cache mark. Before, the notice was lost. A notice that arrives while tool calls are still waiting for results goes after those results. keepMovedCurrent now updates every moved Devin user to it. npm has 0.1.32: npm view --prefer-online @magpie-community/opencode-devin-auth version. Run on mote at this tree: gofmt clean; go vet ./internal/provider on darwin, linux (nogui) and windows; go test -count=1 ./internal/provider ok. In the plugins repo, at 647039a merged with main: bun test packages/devin 182 pass, and 4 of the new tests fail on the old index.mjs. Not tried: a real Devin account. |
||
|
|
eb3b9376ea |
plugin load: a model listed by another id gets its plugin's load (axelburks)
axelburks on Discord: a plugin reports a model's load through
input.magpie.load by its own model id. A model the user lists in magpie
under another id (Listed as, settings' ModelIDs) showed no load on the
Providers page, and with Busy models last on it was never judged busy;
models whose id wasn't changed worked. The reporter's reading was right:
plugin.ModelLoad keeps the load by the plugin's id and both callers asked
it by the listed one.
Both call sites of plugin.ModelLoad (grep: there are only two) now map the
listed id back through Provider.OwnModelID first:
- internal/gui/providers.go providerInfoWith (models[].load), which
already computed OwnModelID for models[].vendor; it is now read once
and used for both.
- internal/gateway/fallback.go busyOf (restLast's busy ordering and the
trace's busy).
A listed id whose own id is a model@size (grok -> grok-4.7@256k) still
falls back to the model's load inside ModelLoad. The provider-plugins
subsystem page says the lookup is by the plugin's own id.
Tests:
- internal/gui TestModelLoadListedAsAnotherID: a plugin provider with
fast -> big and grok -> grok-4.7@256k listed, loads noted for big,
grok-4.7 and small; models[].load must be 87.4 / 60 / 12 for fast /
grok / small and absent for quiet.
- internal/gateway TestBusyModelListedAsAnotherID: busyOf at 80 judges
fast, grok and big busy, and an unreported model not.
Run at the pushed head on mote (mote-run):
- at base
|
||
|
|
d2a83de612 |
gateway: a try billed before it failed and handed on keeps its usage row
A Claude subscription run that fails after Anthropic's message_start
(an overload, a dropped connection, a cut stream Claude Code gave up on)
is a 502 so another account can take over. That account is a new Claude
Code told the whole conversation, and writes it to its own cache again.
The first try's usage was dropped twice over: relay threw away the reply
start's usage on that path, and serve wrote a usage row only for the
request's last try (and for refusals). The Usage page counted the second
account's tokens alone, with "2 tries" on the row as the only sign that
the conversation went out twice (hhxk233 and Kayrainforest on X).
- relay keeps the usage of the head's KStart/KUsage events on a failure
before content (streamed), and the collector's usage (not streamed).
- serve writes a handed_on row for any failed try that billed something
and handed the request on, to another account or member or the same
one again. The row is written when the next try begins. The refusal
and turned-away paths keep their own row, and a failure that billed
nothing still has none. Totals count a handed_on row's tokens, not a
request, as for refusals. The Usage page already shows such a row as
"<status> · handed on" with its tooltip in every language.
No same-account double send was found: a fake Claude Code breaking its
stream in nine ways (error before or after message_start, a 529 or 500
result, a cut then an error or an exit, text then an error or an exit),
streamed and not, starts one run per account at most. A failure before
content goes on to the spare once. A failure after text ends the
request with no other run.
Run, at this tree on origin/main
|
||
|
|
de7953e3b8 |
browser: browser_evaluate calls an async()=> function and awaits it
The check that tells a function from an expression wanted a space after
async, so `async()=>{…}` was evaluated as an expression: the function
itself came back, serialized as {}, and its body never ran. And a
parameter list could hold parentheses, so `(async()=>{…})()` counted as
a function and its promise was called ("is not a function"). async may
now touch its parameters, and a parameter list holds no parentheses.
The extension goes to 0.1.2.
Found driving X through magpie-browser from Claude Code.
Run on mote (Chrome for Testing 1234):
- MAGPIE_BROWSER_CHROME=… go test ./internal/gateway -run
'TestBrowser.*InARealBrowser' -count=1: ok (46.5s). Five new evaluate
cases: async()=>, async () =>, async function, an async IIFE and
Promise.resolve, each answering "awaited".
- Broken by hand: with origin/main's background.js the test is red at
the first case (async()=>… doesn't say "awaited").
- go test ./internal/browserext: ok. gofmt -l: clean.
Not run: the full suite; not tried in Edge or Firefox.
|
||
|
|
ccd746e039 |
claude: /usage is read in the interactive mode, typed in it, not through -p
With the interactive mode on, the plan's allowance (the Claude account's
usage card) was still read by `claude -p /usage`, the one -p run left
beside a request. Claude Code 2.1.316's -p /usage also tells only the
session's cost, no window. Now claudeUsage, with claudeTUIOn, runs the
interactive mode's helper (claudeUsageTUI) and gives it a line
{"type":"command","command":"/usage"}. The helper types /usage, waits for
the panel to settle (a "N% used" and a second without change, or three
seconds of anything else, 20s at most), closes it with Esc, and tells
what was drawn as -p's lines say it (usageText: "Current session: 0% used
· resets 5am (Asia/Shanghai)"), so parseClaudeUsage reads it unchanged.
No model is asked. The helper types no other command. The machine
reasons a request is refused for (no shim, OS, missing, off) refuse the
read the same way. Turned off, -p runs it as before.
Run (mote, at this tree on origin/main
|
||
|
|
a25d3d0815 |
claude: a JSON schema is answered in the interactive mode, through an answer tool
With the interactive mode on, a request with a JSON schema was refused
with a 400 since v0.1.2592: interactive Claude Code takes --json-schema and does nothing
with it, its StructuredOutput tool being -p's alone. It now runs in the
interactive mode like any other request.
- serveClaudeSubscription compiles the schema (santhosh-tekuri/jsonschema
v6.0.3, draft-07 unless it says otherwise, as -p reads one; a $ref
outside the schema is refused, never fetched) and adds an answer tool,
StructuredOutput or a numbered name apart from the client's tools, with
the schema as its input schema, through the bridge's MCP server. A
schema that can't be compiled is a 400 before any run.
- mcpCall checks each call against the schema: one that doesn't fit is
told why (isError) to be made again, as -p's is; one that fits is kept.
- At the turn's result the kept input is the reply's structured output.
A turn that ended with no call is told once to call the tool, and
fails "no answer fitting the schema" if it still doesn't. Neither the
call nor the words around it reach the client.
- claudePrint no longer lists the schema. The two refusal tests
(TestClaudeTUIOnRefusesPrint, TestClaudeTUIRefusalIsNoAccountsFault)
now use the case that is still refused before any run: an image by
its URL that can't be downloaded (127.0.0.1, which magpie never
fetches).
- The provider editor's card no longer says -p takes "a JSON schema"
the interactive mode can't (en, zh-CN, zh-TW, ja, de).
- docs/subsystems/claude-subscription-bridge.md: the refusal list, and
how a schema is answered.
Run:
- A real run, haiku, the test account in a sandbox HOME, real Claude
Code 2.1.316 through the helper with --json-schema and a stdio MCP
server named magpie serving the answer tool and its description: the
result's structured_output was null (the premise), and the model
called mcp__magpie__StructuredOutput at once with
{"color":"Sky blue","hex":"#87CEEB"}, which fits the schema's
pattern. 7.2s, one turn. Not run: the whole gateway path with a real
account (the unit tests drive it with Claude Code's real transcript
rows).
- mote, at this tree (base
|
||
|
|
14e3513780 |
claude: Claude Code in WSL runs interactively when Windows can't read its transcripts
With the interactive mode on, Claude Code in WSL was refused with a 502
in two cases: the distro user's own folder unreadable from Windows
(\\wsl$ needs the 9P redirector, which a session over ssh hasn't;
"wslread") and a distro whose home the probe didn't find ("wsl-home").
Both now run interactively: the helper reads the transcript inside the
distro.
- claudetui/wslread.go: before Claude Code starts, a shell run through
wsl.exe notes how much of $HOME/.claude/projects/*/<sid>.jsonl is
there (a resumed session's earlier turns), says "ready", then tail -F's
the rest; the helper copies it to a file of its own and tails that as
any transcript. When Claude Code ends it waits for the copy to stop
growing (settle), then closes the shell's stdin, which ends it.
- claudetui.WSL gets Distro (Projects omitempty); the gateway's tuiWSL
sets it when Windows can't read the folder or the home is unknown.
- the wslread and wsl-home refusals are gone (claudeTUI, claudeWhy,
claudeNotTUIWhy); the GUI's "wsl-home" reason and its 4 strings too.
- docs/subsystems/claude-subscription-bridge.md says how it is read.
Run, at origin/main
|
||
|
|
2739626c38 |
provider: the ZCode mover's min is 0.1.41, nothing to claim is asked again in half an hour (plugins#600)
zcode 0.1.41 (magpie-community/plugins#600) gives a daily claim that
found no gift plan an `until` half an hour out, so magpie asks again
through the day and a plan ZCode drops into its feed later (the weekend
plan from 19:00 Beijing) is still claimed. keepMovedCurrent now updates
every moved user's plugin to it.
npm view @magpie-community/opencode-zcode-auth version --prefer-online
--registry https://registry.npmjs.org: 0.1.41, checked when this landed.
Run on mote (mote-run) at base
|
||
|
|
ff65ebd142 |
provider: Zed's plugin is 0.1.14 at least: a Gemini model's efforts are keyed lowercase and its thinking level goes to Zed uppercase (plugins#215)
Zed's /models now lists a Gemini model's supported_effort_levels
uppercase (LOW/MEDIUM/HIGH), so the plugin keyed its variants LOW and
magpie's pi profile, which maps efforts by key, marked every thinking
level unsupported for zed/gemini-* (Yezike-yyy on plugins#215). And a
thinking level reached Zed lowercase, which its serde enum refuses:
400 "unknown variant `low`, expected one of `MINIMAL`, `LOW`,
`MEDIUM`, `HIGH`" (iron-water, plugins#215). zed 0.1.14
(magpie-community/plugins 3618bf9, from ump45nose's #587) keys the
variants lowercase whatever case /models uses and uppercases the level
only on the wire. The mover's min is raised to it, so keepMovedCurrent
updates every moved user.
npm view @magpie-community/opencode-zed-auth version --prefer-online:
0.1.14 at landing.
Run on mote at
|
||
|
|
59fdab0af7 |
gateway: a caller's folder the user hasn't trusted runs in magpie's, not a 502 (lwjef on X)
lwjef (X, 2116867007799030000): a cwd Claude Code hasn't trusted hangs the interactive-mode bridge (paseo chat). Cause: in the user's own account the helper leaves the trust question to the user (no MAGPIE_CLAUDE_TUI_TRUST) and ends at once saying so. Up to 11-01 that run became -p; since |