f2eb56c6bbde1300dddc402861b59cd4e45e0215
5263
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f2eb56c6bb |
usage: a first start pairs the history a few weeks at a time, not at once (#2278)
With no sums on disk (a first install, or a version that counts rows
otherwise), the page's cells, the heatmap's days and Codex's effort
before the cut were built from one pairing of the whole history. Every
gateway block was priced, every session row's message id went into one
set, and every call into one match map. On the owner's history that
was ~212 MB of the warm-up's 341 MB in use and the cold start's peak.
coldSpans builds them as a day's start advances them (pageAdvance),
14 days at a time. A span pairs the chunks with a row from heatReach
before it to heatReach after. Each chunk's oldest row is kept by its
serial. A gateway block not priced yet is priced by a pricer of the
span alone, and its rows go back to the pool after the span. The
recent days are then paired as on any kept start.
The page's cells come out in another order (by span, then chunk), so
TestSettledCountedAsVersioned now sorts them before it hashes. The
sorted hash is the same for a pairing at once and in spans, so
settledCountVersion stays. Tests that count a pairing of every chunk
use pairAtOnce (coldSpan 0).
Run on mote at the pushed head (rebased on
|
||
|
|
b62fa332f3 |
provider: Send requests unmasked for subscriptions and plugin providers too (isee1_1)
isee1_1 on Discord uses a community translation plugin as a provider and asked why "Send requests unmasked" (请求不脱敏) isn't offered for it. |
||
|
|
7bc602236b |
library: the MCP hub is called the MCP router
The owner asked why it was a "hub". Composio calls the same thing a Tool Router; "router" says what it does (one server that routes each call to the right one), and "gateway" is taken by magpie's LLM gateway. Only the words change: MCP router / MCP 路由 / MCP 路由 / MCP ルーター / MCP-Router, "Router address", and the CLI's `magpie library mcp router on|off`, where `hub` still works. The URL /mcp/magpie/hub, the mcpHub setting, the servers/hub API and the Go names stay, so nothing a user or an agent config holds changes. docs/subsystems/mcp-hub.md moves to mcp-router.md and the pages that link it follow. #4382's new words follow too: "Through the MCP router", "Not through the router" and their hints in every language, and the CLI's `magpie library mcp router <name> shared|direct` (`hub` works there too; library_hub_test.go says router for direct, hub for shared). Run at e2583df31 (this stack on |
||
|
|
b78b1de003 |
library: magpie-image is behind the MCP hub, saving into the calling agent's project
magpie-image was the one MCP server the hub left out, because it saves what it makes on disk and needs to know whose project that is. The hub now serves its tools like any other server's and tells it where the caller works: 1. the hub answers a tools/call as SSE and asks the agent roots/list on that stream (3s), as Claude Code answers; 2. else Codex's _meta x-codex-turn-metadata.workspaces (git repos only); 3. else the Codex thread's cwd from its session file (sessions.CodexThreadCwd), only with session consent; 4. else none, and the image goes to ~/Pictures/Magpie as before. The hub passes `magpie/roots` and `magpie/client` in the call's _meta; imagemcp saves into the first root and names the agent on its usage row. Its result carries `magpie/model`, which the hub's own usage row takes, so the row says which image model drew it. A WSL agent keeps magpie-image as its own entry (the hub can't reach a path inside the distro). docs/subsystems/mcp-hub.md (mcp-router.md after the next commit), gateway-routing.md and gateway-sessions.md say so. It is rebased on #4382 ( |
||
|
|
d77da5bff3 |
claude bridge: a caller elsewhere whose environment is a message is told the last one given is where tools run
packinggoods on Discord, again after v0.1.2093: a Mac Claude Code through a Windows magpie's Claude subscription still has its commands wrapped in PowerShell. The bridge's run is the real Claude Code on the Windows box, and it puts its own environment (Platform: win32, its shell, a temp folder) in a <system-reminder> at the start of the run's first message. |
||
|
|
2570efb5f7 |
gateway: an image the picked model can't describe is described by the next model that sees (kelvinjason11 on X)
kelvinjason11 on X: "图片识别好像只支持一个模型识别 没有fallback". When
the describer (Settings' Image recognition model, or AutoVision's pick)
failed, the turn failed with it, though other models that see were there.
Now describeWith asks the pick first, always. When it fails for any reason
but the client's own cancel, magpie asks the next model that sees: the
first ready one of seersRanked, AutoVision's own order (ready, then
Claude account, Codex, API key, other, then cost), leaving out each model
already tried and each one that turned an image away (sightRefused). At
most 3 models (visionTries), and all of them within visionWaitMost
together: each try gets what is left of it, not a fresh visionTimeout.
- The text header names the model that described the image
("as other/bigeye describes it"), not the pick.
- The Routing row of the stand-in carries Instead, Why and Picked
(describingInstead, the same fields web search's searchingInstead
sets), and the Routing page says in every language that the pick
couldn't describe it, why, and which model did instead.
- When none answers, the error is the first failure as before, then
"nor could X, asked in its place: why" for each other model tried.
- Spent/allowance: each try goes through serve as before, so autoSpent
and spentModel judge every stand-in the same as they judged the pick.
- vision_mcp's describe_image tool gets the same fallback.
Cache (s.sights): a description is kept under the pick and the image,
whichever model described it, with the describer's name beside it. The
same image sent again asks no one, the stand-in's text is reused, and
its header still names the stand-in. A new image asks the pick first
again, so a pick that comes back is used at once. Failures are not kept.
Settings' text ("When the model in use can't see images, this one
describes them to it") is left as it is: the pick is still asked first
for every image.
Tests (internal/gateway/vision_fallback_test.go):
- TestPickedDescriberThatFailsGivesWayToTheNextThatSees
- TestAutoDescriberThatFailsGivesWayToTheNext
- TestNoDescriberAnswersNamesEach
- TestPickedDescriberThatAnswersIsTheOnlyOneAsked
- TestCanceledDescriptionAsksNoOther
TestDescriberThatCantSeeIsntAskedToDescribe now expects the next model
that sees to describe in place of a text-only pick, not a 502.
GUI: internal/gui/tests/vision-instead.test.cjs (every language, 1100
and 520 wide).
Run on mote at 45739f15b (this tree, on origin/main
|
||
|
|
74f1df8694 |
gui tests: agent-open-terminal's first load gets a minute too (#4470)
agent-open-terminal ( |
||
|
|
62c8d21ee5 |
gui tests: account-arrange acts once the allowances are drawn (#4468)
account-arrange's "account dragging uses the routing order in every mode"
was red alone in WebKit at
|
||
|
|
c124f87e2e |
gui tests: Settings rows are held once the last settings read is drawn (#4469)
images-library-way opened Settings › Models and waited for the Image
generation row, then screenshotted it. A page opened on Settings reads
/api/settings twice (go('settings')'s own read and load()'s), and each
answer draws the tab again, so when the second answer came late the row
it had waited on was replaced while Playwright held it: "element was
detached from the DOM" / a screenshot of a redrawn element (zh-TW 1100
in Chromium). The app's double draw is by design; the test was wrong to
hold the first one. It now waits with reader.cjs's watchSettingsReads and
settingsDrawn, as the other Settings files do, before taking the row.
proxy-test opens Settings › Network the same way and presses its Test
button after the first draw: it gets the same wait at both gotos.
What was run (WSL magpie-desktop, Playwright 1.62.0):
- By hand: the second /api/settings answer held 1.5s and a marker set on
the row first waited on. origin/main's images-library-way: zh-TW 1100
and 420 red, "the row held for the screenshot is the one drawn last";
this file 6 of 6 green, Chromium.
- images-library-way.test.cjs and proxy-test.test.cjs, Chromium and
WebKit, every language each file covers: images-library-way 62 of 62, proxy-test 22 of 22 green at load ~210 (nav-timeout green on this tree).
Not tried: the whole GUI suite; mote (#4125) or Windows.
|
||
|
|
ce8b67de37 |
gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called page.goto with no timeout of its own, so Playwright held the first load of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a busy box (a whole-suite run at load 130-160) that load took longer and goto timed out. The same pattern is in 988 GUI test files (1174 pages): every one of them now also sets setDefaultNavigationTimeout(60000) on the same page, right after its default, so goto, reload and waitForURL wait on the load itself with room, while clicks and waits keep their short bar. group-from-model-add's own 20s navigation bar is raised to the same minute. claude-switch-only also gives its first provider row (drawn from the page's first reads) a minute before clicking it. nav-timeout.test.cjs (no browser) reads every GUI test file and names each page given a default under a minute without a navigation timeout of at least a minute, so a new file can't bring the pattern back. What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from other sessions): - node --check on every file in internal/gui/tests: all parse. - nav-timeout.test.cjs against origin/main's test files: red (names the 1174 pages); against this tree: its only reds were my own probe copies of the old files, since removed. - By hand: claude-switch-only with app.js served 7s late (a busy box's first load), --test-name-pattern "1100 en": origin/main's file 4 of 4 red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green. - claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420: 32 of 32. group-from-model-add, usage-access-key-card and i18n-keys: green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red on a 5s waitForFunction at line 115 (a wait after load, not the navigation), at load ~230. Not tried: the whole GUI suite (about 1000 files; the change is one mechanical line per page), Windows or mote (mote's browsers, #4125). |
||
|
|
ef0a5c673a |
gateway: a web search is left out of a request relayed to a provider that runs none (mxmllln)
mxmllln (Discord #feedback, magpie 0.1.2219, Codex Desktop 0.166.0-alpha.5.1 with remote_compaction_v2): a thread on commandcode/deepseek/deepseek-v4- flash-vision-exp with 52 function calls and 8 web searches (magpie ran them for the model through gpt-6.1-sol) failed compaction with Command Code's 400 "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'", and every later message too. Cause: a Responses turn that offers web_search to a provider that runs no search is translated for magpie's search, and the translation leaves the web_search_call items out (searchedForIt, searchRoundsBack). A request that offers no web_search is relayed as Codex sent it, items and all: magpie's summary request for a compaction_trigger (tools: []), the summary request Codex makes itself (#1270), a turn with search off. Command Code's Provider API turns the Responses request into chat for DeepSeek, a web_search_call becomes an assistant tool call nothing answers, and DeepSeek refuses it. pairToolItems pairs function and custom calls only. Fix: the relay of a Responses request leaves the web_search_call items out when the provider doesn't search for that model (searchesModel), as the translation does. Kept as they were: a provider that searches itself (Codex and Copilot accounts, OpenAI, Command Code's gpt-6-luna etc. on Responses), a relay Codex's turns go to as sent (codexAsSent), and a native compaction (keepsCompaction). The item holds only the query and the page URLs, never what the pages said, so there is no result text to pair it with; the reply after it says what was found. Other routes checked: the Responses -> Chat and -> Messages translations already drop the item (or, for Claude's signed thinking, pair it with a result through searchRoundsBack); Chat and Anthropic clients send no web_search_call; magpie's plain-text summary retry (plainCompact) reads no web_search_call. count_tokens is Anthropic-only. Tests: search_relay_history_test.go. A fake Command Code that refuses a deepseek request holding a web_search_call with DeepSeek's message, the history built from searchedHistory (a real ChatGPT backend web_search_call, 2026-10-09) plus a function call and its output: compaction_trigger, Codex's own summary request and a turn with search off each answer 200, nothing sent holds a web_search_call, the call and output stay. gpt-6-luna on the same provider still gets its search. Unit test for withoutSearchCalls. Run (mote-run, at this tree): - go test ./internal/gateway -run 'TestSearchedThread|TestWithoutSearchCalls' -v: ok - go test ./internal/gateway -run 'Search|Compact|Compaction|Pair|ToolRun|WithoutSearch': ok - gofmt -l internal/gateway: clean Broken by hand: with the withoutSearchCalls call taken out of attempt, all three TestSearchedThreadCompactsOnARelayThatDoesntSearch subtests fail. Not tried: a real Command Code account (none here), Codex Desktop on Windows, the reporter's thread. Full suite and Linux/Windows vet run after the push. |
||
|
|
86fef947e8 |
gateway: a 200 stream ended with finish_reason "error" fails over (#2471)
What changed: a vendor that ends its 200 stream with finish_reason
"error" - WorkBuddy's and a DeepSeek harness's word for a turn it failed
rather than finished - had the chunk taken for content: the held stream
went to the agent, the try stood as a 200 success, and the group's next
member was never asked. streamEvent now reads the word as the failure it
says, held for the next candidate as an error event before content is;
in the candidate walk the try fails as an empty reply's or a cut-short
summary's does (#1221, #2274): the next is asked, and nobody rests, as
the reply's shape failed, not the account. Content already passed to the
agent can't be taken back, and is not touched.
Run: TestFinishReasonErrorFailsOver (new) red on
|
||
|
|
d965a239f5 |
gateway: a litellm relay's "'priority' is not supported for 'service_tier'" is asked again without the tier (#3978)
What changed: refusedOptional's recognizer (unsupportedOptionalField) gains
valueRejectedForField, for a vendor that names the field after the value it
turned away: litellm's "'priority' is not supported for 'service_tier' on
this model", handed to the agent as a plain 400 today, on both shapes the
relay sends — the bare prose (0.1.1330) and the backend's JSON embedded in
litellm's message (0.1.1829, unwrapped by the existing structure-first
walk). The name after "for" is what separates the field's refusal from a
value's ("... is not supported with this model"), which still reaches the
client as it came.
Both readers of refusedOptional take it, so the tier is dropped, the
request is asked again, and the provider isn't sent it again: a relayed
Chat or Responses request that carries the field (#393's path), and the
agent's own request on a provider the user added by its address (OwnTier),
which forwards the tier on purpose (chat.go, responses.go) and asks again
without one that turns the field away.
Run: TestRefusedOptionalNamesOnlyUnsupportedFields gains two rows (the
prose and the JSON-embedded shape, each under the direct, litellm and
openrouter wrappers) and TestServiceTierRefusedForTheValueRetried (a fake
upstream answering the issue's body) fails without the change — turn 1:
400 after 1 calls, want 2 — and passes with it: two tries, the second
without the tier, and the provider marked unfit for it. The value rows
(unsupported-value, tier-value) stay nil/pass. gofmt -l clean; go vet,
GOOS=linux go vet -tags nogui, GOOS=windows go vet ./... pass; go build,
GOOS=linux go build -tags nogui, GOOS=windows go build pass. In
go test -tags nogui ./... every package passes but three tests that fail
the same way on the unmodified base (
|
||
|
|
460687ff57 |
gateway: Azure's "invalid encrypted summary" reads as foreign reasoning (#3994)
What changed: a Codex thread the ChatGPT backend served, resumed on a
relay in front of an Azure OpenAI deployment, is refused there with
{"error":{"message":"invalid encrypted summary",...}} - wording the
foreignReasoning table didn't read, so withoutReasoning was never tried
and the 400 reached Codex on every turn of the thread. The refusal is
spelled with spaces, says summary instead of content, and names no item,
so none of the table's branches took it. An alternative
invalid[ _]encrypted[ _](summary|content) now sits beside
invalid_encrypted_content; the named-item reader (unreadableItem) is
untouched, as this refusal names none, which withoutReasoning already
covers by leaving out the whole reasoning set. The ChatGPT-backend
reader (withoutUnreadable) shares the table and takes the same turn.
Run (base
|
||
|
|
7da972969b |
provider, gui: a listing's budgets add up, and one provider's fetch models no longer re-lists past them (#4065)
What changed
The budgets a listing of the plugins' providers is made of added up past
the budgets its callers set: the host let one provider spend listWait
(20s) on its models hook plus the wait for a due renewal (RENEW_WAIT,
15s) before it, and a provider with two accounts spent them back to
back. One provider could be allowed 35s (40s with a second account) —
past the 30s refreshDeadline the background refresh asks under and past
the editor's own 20s — so pressing Fetch models, or a refresh, died with
a bare "context deadline exceeded" while no vendor had failed: every
provider is asked side by side, and the sum of the budgets was the only
thing over.
Now the host's own bounds hold by construction:
- host.js info(): the wait for a due renewal (fresh) spends the models
hook's own budget — the hook is given what is left of listWait, and
the renewal wait can no longer be added on top of it.
- host.js providers(): a provider's accounts are listed side by side
(the first no longer waited for before the rest), so one provider
costs one listWait, not one per account.
- gui/providers.go, case "models": the editor's budget is 30s, the same
the host bounds one providers RPC with, instead of 20s — shorter than
even one provider's worst case under the old arithmetic.
A provider whose renewal is slow then lists late (its hook given up on
alone, said so in listError as any other stuck listing) instead of
taking the whole listing past the caller's deadline (#4065).
Run
- TestProviderListCoversAccountsSideBySide, two accounts whose hooks
each take 3s under a 4.5s caller budget: with the product files at
the base (
|
||
|
|
50816ce024 |
library: turning RTK off matches the hook Claude's settings actually holds (#2879)
What changed: taking RTK out of Claude Code now drops its hook entries
from hooks.PostToolUse and hooks.SessionStart in ~/.claude/settings.json
beside hooks.PreToolUse, matching the same "rtk hook claude" mark.
Why: magpie says Claude Code has RTK by searching the settings file
whole for "rtk hook claude", but its remover only looked under
hooks.PreToolUse. rtk 1.0.1's installer writes that command under
hooks.PostToolUse too, when the user's rtk pipeline has after_tool rules
(rtk:posthook; src/hooks/init/claude.rs), and rtk's own uninstaller
sweeps PreToolUse, PostToolUse and SessionStart alike. With an entry
under another event, switching RTK off in the Library removed the
PreToolUse entry, found the command still in the file, and failed with
"rtk's hook is still in Claude" — the reported bug: the row stayed on
and the hook had to be taken out by hand. The user's own hooks under
those events are kept, as the PreToolUse ones already were.
Run: go test ./internal/library/ (ok, 75.6s); the new
TestRTKRemoveClaudeOtherEvents fails on the base with "rtk's hook is
still in Claude Code" and passes with the fix; gofmt -l clean; go vet
clean on darwin, linux and windows; the package builds on all three.
Review (magpie): checked against rtk v1.0.1's own claude.rs, which
writes and sweeps PreToolUse, PostToolUse and SessionStart; the other
agents' single key is unchanged. Run on the Mac mini: go test
./internal/library -count=1 ok; TestRTK* on the Windows box ok. Broken
by hand: rtk.go at the base - TestRTKRemoveClaudeOtherEvents red
("rtk's hook is still in Claude Code"). Not tried: the reporter's ask
to roll the switch back in the UI when a removal fails.
Generated-by: GLM-5.3-Flash (ZCode)
|
||
|
|
a5ccf3f23f |
plugins: an update of an unfixed git source re-resolves the branch, not the lock's old commit (#2954)
What changed - Before Bun resolves a git plugin's spec, the branches and tags of its repository are fetched into the bare clone Bun keeps in its install cache (refreshGitCache in gitrev.go): best-effort before install's bun add (a remote that can't be reached leaves the install to what the cache has), an error before reinstall's bun update (an update that didn't happen is not reported as done). - When bun update exits 0 but the plugin is still behind the commit the update checks saw the repository at, reinstall says so instead of claiming the update. - A spec that names a commit (#<sha>) is left alone: nothing is resolved for one, and its pin stands. - docs/subsystems/provider-plugins.md: this git update path. Why A plugin added from an unfixed git+https://... URL could not be updated (#2954): plugins/package.json named no commit, but Bun resolves a git spec through its own bare clone of the repository in the install cache, whose refs stay at the first install - a fetch there moves FETCH_HEAD, not the clone's refs/heads. Every resolve after the first, bun update as much as a bun add after a remove, therefore named the old commit again, bun.lock re-recorded it (name@git+...#bb961b2...), and the update said it had installed while node_modules kept 0.1.3. The lock is the record of that resolution, not its cause. Verified with Bun 1.4.2 (the version magpie runs) against a local git+file:// repository: after the branch moved, bun update my-plugin answered "no changes" and exited 0, and so did bun install with the lock entry dropped, bun update --force and bun install --force; with the clone's refs fetched, the same bun update installed the branch's commit now. Run go test ./internal/plugin/ -count=1 (ok; new: TestGitUpdateInstallsTheBran chsCommitNow and TestGitUpdateKeepsACommitPin on the bun on PATH against a local git+file:// repository, TestGitUpdateSaysWhenItDidnt with the fake bun keeping the lock's commit, TestRefFixed, TestSameRepoAndCloneOrigin) go test ./internal/cli/ ./internal/provider/ -count=1 (ok) gofmt -l (clean); go vet ./internal/plugin/ on darwin, linux and windows (ok); builds of darwin and of windows (CGO_ENABLED=0 -tags production, as the Makefile cross-compiles it) and of the 79 Linux packages that don't need Linux GTK cgo (the GUI and cli are built natively per machine, as the Makefile says). Review (magpie): patch sha256 checked against the issue; read whole. Run at the batch head on the Mac mini: go test ./internal/plugin -count=1 ok, the real-Bun git e2e among them (not skipped); on the Windows box TestGitUpdate* pass. Broken by hand: store.go at the base - TestGitUpdateInstallsTheBranchsCommitNow ("still at 1.0.0, want 2.0.0") and TestGitUpdateSaysWhenItDidnt red; only install()'s refresh removed - "installed again: 2.0.0, want 3.0.0". Not tried: a real plugin from a real GitHub branch. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
0fcb3acb3f |
gateway: the 24MB CR test reads a mended line (#4256)
TestCRTidyTwentyFourMBLine's "one call mended" case never mended
anything. Its line ended its output array with a trailing comma, so the
JSON could not be read and crTidy passed it as it came. Its want was
strings.Replace(line, `x\ry`, `xy`), but on the wire the escape is
`x\\ry`, so the Replace changed nothing either. Both sides equalled the
input, and the subtest passed while timing a failed parse.
The fixture now joins its items without the trailing comma. The mended
case reads the output back: the line is still one data line, fc_1's
arguments are {"a":"xy"}, and every text item is there. The healthy case
is still compared byte for byte.
Run on mote (macOS), go test -tags nogui -count=1 -v -run
TestCRTidyTwentyFourMBLine ./internal/gateway/:
- the healthy 24MB line ~25ms, the mended one ~280ms (a whole decode and
marshal, only on glm-5.3-flash* lines that carry a \r escape);
- with crTidy.responses' item mend turned off by hand, the mended case
is red ("arguments ... want {"a":"xy"}"); it was green on the old
fixture.
|
||
|
|
dd279e9314 |
gateway: the CR a glm-5.3-flash* replica stitches into tool-call arguments
Yetone's review of the two earlier rounds (#4256): the cure changed healthy replies and cost the relay hot path. This one keeps to the routes the defect was seen on, and holds a cut escape the way the encoders do: - The cure runs only on glm-5.3-flash* routes (glmFlash, the way grokModel scopes its rule): a relay installs crTidy for those models alone, translate sets Request.CR the way it sets Request.Grok, and the encoder wrapper crEncoder and the whole-reply pass crResult hang off that flag. Another model's reply goes as it came, healthy or not. - The relay's mends wait per call (crTidy.calls, by Chat's tool_calls index, Messages' block index, Responses' item id), so a \r\n cut across two fragments arrives as the pair it is; a \r the next fragment does not answer with \n is the defect, and goes. A line's end is looked for in the new bytes of a read alone, and a region without the escape is said from where it lies: a 24MB line in 32KB reads costs a scan (23ms here; the round-2 way took 2.45s). - The events whose delta is an argument are read from the event's own type or shape: a text delta that only mentions the arguments' event names stands, \r and all. - A custom tool's raw input (Codex's apply_patch) is read as bytes: the CRLF pair is the line ending it says, a lone CR goes. - The encoders' dropper is said at a call's end: a lone \r goes, a bare \ is said as it came (crEncoder.say). Refs #4256 (kept open for the reporter) Run: go test -tags nogui ./internal/gateway/... (ok). The healthy split-CRLF relays of all three protocols, the custom input's, the text delta's and the scope's tests fail on the round-2 branch and pass here; unwiring the flag reds the cure tests again. Landed by yetone on origin/main |
||
|
|
f45c3c96b6 |
usage: a day's first start advances the kept sums from the last cut, not a pairing of all history (#2278)
The page's cells, the heatmap's days and Codex's effort before the last
days are kept on disk (page-v1.json, heat-v1.json, effort-v1.json) under
a key that names the cut, today minus two days at midnight. The cut moves
each midnight, so each user's first start of a day found none of them,
and paired the whole history again three times. On the 240k-row bench
history that peak was 506-538 MB, against 235-325 MB for a start of the
same day.
Each file now also holds the cut and since its sums were counted at.
When the current key misses, the file's sums still stand if the key at
their own cut is the same: the chunks are split again at that cut, named
as heatSettledKey names them, and compared with the file's key. Then
only the chunks of the days since that cut are paired. The rows between
the two cuts are added to the kept sums, and the sum is written under
the current key. The heatmap also drops days before a since that moved
forward a week. A full pairing is left for a first install, a raised
version, or a settled chunk that changed.
settled_version_test blanks a page's cut and since, as it blanks its key
and at. They say when the cells were counted, not how, so
settledCountVersion stays at 1. Files written before this commit have no
cut, so the first day change after the upgrade still pairs everything
once.
Run at 9cd9cfed0 (rebased on
|
||
|
|
e2d7d1f54a |
gateway: a body still arriving at the 2m cut-off is answered 408, and its read ends
heatonz on Discord (Hermes Agent to magpie v0.1.2237 in Docker): about
half the requests to a nested group were stopped after 2m0s "without
routing it to any provider". The held report's one wait was "body 2m0s
(under way)", and 7 handler goroutines sat in net/http body.Read under
waitedBody, idleBody and readSized.
The body read has its own idle limit: 60s with no byte, renewed on each
byte (idleBody), which answers 408. That limit never fired, so bytes were
still coming in gaps under 60s, and the time added up to unroutedMost
in the "body" wait. The watch then answered 504 and blamed routing, and the
handler kept reading the body after the answer until the body ended or
went idle.
Now, when the cut-off lands while the body is being read:
- the answer is 408, saying the body was still arriving from the client,
how much of it had come and when the last byte did; OpenAI's and
Anthropic's SDKs send a 408 again at once;
- the read ends with the answer (deadline now, waitedBody refuses further
reads), so the connection closes with it;
- the held report says "stopped it with 408" and has a "body read: X of
Y, the last Ns ago" line, which tells a trickle from a stall.
Not changed: the 60s idle limit. The report shows it never fired, so a
shorter one would not have been sure to catch this case, and an
upload that keeps progressing is the client's, not magpie's. The 2m bound stays,
so a trickling client can't hold a handler forever.
Run (mote, at this head on
|
||
|
|
f03ed8c26e |
agents: Open in terminal on a Mac's Agents row (coolmantou)
coolmantou on Discord asked to start an agent from magpie's Agents list.
In the Mac app's window, an agent row's menu (openRowMenu, the one the
grip and a right-click open) now has "Open in terminal". This includes a
row under Not set up. Clicking it posts POST /api/agents/open with only
{agent: id}. The server finds that exact id in agent.Detected() (not
agent.Find's prefix match) and builds the line itself: the agent's
Launch() where it has one (agy, Claude Science, Cursor local), otherwise
its program's path, single-quoted (BinPath, new in internal/agent).
openTerminal then opens that line with the user's Session terminal
choice. The command never comes from the page. Other systems, the web
build, WSL agents and desktop apps with no program are refused, and
their rows have no item (agentJSON.terminal). The tray panel's rows don't
have the item either. The label is "Open in terminal", not "Terminal",
because the user's terminal can be iTerm or Ghostty. The string is in
en, zh, zh-TW, ja and de. Windows and Linux are #4474.
The core budget had 39 bytes left on main, so no budget was raised.
Instead:
- the item says nothing on success; the terminal opening is the answer,
and a failure goes to statusErr;
- the omp roles' comment above OMP_UNSET was cut to what OMP_UNSET's
values don't already say.
app.js is now 22 bytes under main's size.
Run:
- go test ./internal/gui ./internal/agent on mote (macOS) and in
magpie-desktop (Linux, -tags nogui), both ok.
- TestAgentOpenRunsOnlyTheAgent puts claude in a folder named
"it's a' $(touch made1) `touch made2`; touch made3 #". It posts the
ids "claude; touch made4", "claude'$(touch made5)'" and "cl"; none
of them opens anything. It then runs the line made for claude
through /bin/sh and checks that only the program ran.
- After the rebase onto origin/main
|
||
|
|
505d9f6a21 |
provider: Kiro's mover min is 0.1.22 (plugins#538)
opencode-kiro-auth 0.1.22 sends xhigh and max as Kiro's own effort levels on a model whose catalog lists them with adaptive thinking (additionalModelRequestFields, as Kiro IDE sends them), and puts a trailing system message (Claude Code's environment context) in a turn before the question instead of into it. npm view --prefer-online gives 0.1.22. Run (on mote): gofmt -l internal/provider clean; go vet ./internal/provider for darwin, linux and windows; go test ./internal/provider -count=1: ok. Not run: the full suite. Two other sessions' full suites were running on mote, and this change is the min string alone. |
||
|
|
261117363e |
plugin host: a sign-in again joins its account when an older plugin named it another way (#4473)
officeace-auth 0.1.14 to 0.1.17 kept an account as accountId = the masked
phone ("189****8051") and uid = the Huawei domain id. The CodeArts
plugin's OfficeAce card (plugins#522) names a new sign-in by the domain
id, uid the same. settle joined a new sign-in to an old record only on an
equal account id, so signing in again added a second row (fakeco#xxxxxx)
and left the old one "Sign-in required", holding the user's name, proxy
and gateway keys.
settle now also joins two records with the same uid when one of them is
named by that uid (renamedBy): then the uid is the account's own id. The
joined record keeps the old record's accountId, since the user's name,
proxy and gateway keys are kept by it (#4416), as the CodeArts plugin's
renewals already keep a stored accountId.
The issue suggested joining on any equal uid. That is not safe: Kiro
keeps how an account was signed in to as its uid ("google"), so two
different Google sign-ins share one. The test signs in two such accounts
and checks they stay apart; with a uid-only rule they were joined.
Not covered: a re-sign-in where neither record is named by its uid (a
WorkBuddy nickname changed at the vendor) still adds a row; nothing in
the records proves those are one account.
Run:
- Reproduced first on origin/main's host.js: TestPluginReSignInJoinsAnOldIDShape,
with the old record as officeace-auth 0.1.14's callback and
credential.mjs write it (read from the npm tarball), was red: the
sign-in again went to "fakeco#9oncv2" beside the old record.
- Broken by hand: renamedBy on uid alone -> red (two Google accounts of
uid "google" joined); joined without keeping the old accountId -> red
(accountId became the domain id). Green with the fix, and
TestPluginSameNameOtherUID (#413) still green.
- Full go test ./... -timeout 45m on mote was still running at push
(pushed without waiting, per the owner's rule); a red it shows that
isn't on origin/main gets its own issue.
Not tried: a real Huawei Cloud sign-in in a running magpie; the CodeArts
plugin with the OfficeAce card is not on npm yet (plugins#522 is open).
|
||
|
|
06d36d4142 |
gateway: Stays: Session spreads new sessions over the accounts (connor_yang)
connor_yang on Discord: three sessions on one provider's three accounts,
Stays: Session (整个会话), ended up on two accounts. Under Smart routing a
conversation nobody had answered yet went wherever routing put first,
whatever other sessions were on; only In turn counted the sessions each
account holds (leastHeld, #946).
Kept for the whole session (Stays: Session or Strict) under a routing that
picks by what is left (Smart, Least used first, Weekly pace;
spreadsSessions), a new conversation now goes to the key, account or
group member the fewest other conversations of the last 30 minutes are on.
It passes over one routing keeps new conversations off (readyForNew:
resting, an aside key, a fallback while the provider's own model leads,
one used past lowShare), counts leads only, and keeps routing's order on a
tie. A Claude Code subagent's first request goes to its lead's account
(withLead), not to another as a session of its own. An answered
conversation is kept as before, and resting, spent and the rest/quota
fallback are unchanged. In order, By weight, Free first, Speed first,
Cheapest, Manual and plugin routings keep their order. Docs: reference,
gateway-routing, site start.html (en, zh, ja).
Run (mote, at this head on
|
||
|
|
2604d68db0 |
routing: the live card stays on the request it tells of while others come at once
qiang2040 on Discord ("狂闪", a screen recording): with Codex
conversations sending at once on group/glm-5.3-flash-free and
group/deepseek-v4.1-flash, the Routing page's top card (head, story,
context window) jumped to the newest request on every trace update,
and to "magpie hasn't routed this request yet" for each new one.
told() picks the request the card tells of: it stays on the one it
shows until that one is done, then goes to the newest, and a newer
request routing hasn't picked for yet doesn't take it from one that
was routed. play(), resume(), the live poll and rebuild() use it;
requests that come meanwhile still fly on the stage, without a caption
of their own. Pinned, replay and day views are unchanged.
Run:
- routing-concurrent-hold.test.cjs (new; two conversations interleaved,
every frame's head watched; en, zh, zh-TW, ja, de): red on the old
code in Chromium (mote); green on this code in Chromium (mote and
WSL) and WebKit (WSL).
- Broken by hand: told() returning newest() -> 6 of 6 red in Chromium
and WebKit (WSL), "the card stays on 101 while it is under way".
- routing-* and panel-routing* in both engines on WSL, against a base
worktree at origin/main: the reds are the same on base. row-swap is
red 3/3 on base too (#3799); live-patch's folded sample caught a
count-up mid-way once (129K vs 130K, the right request; #2174); the
rest are WSL WebKit reds under #4121.
- go test ./... -timeout 45m on mote: 80 packages ok; internal/gui's
10 real-window AppKit tests were killed at their deadlines (mote's
pboard/launchd state, #4125; also #2645, #1936). This change is
JavaScript only.
- The whole GUI suite (node --test, both engines) is still running on
WSL at push time; reds it shows that aren't on file get issues.
- At the pushed head (rebased on
|
||
|
|
59bdd4dbc3 |
routing: a group's pattern members can be put in order by hand (usrname1833)
In a routing group, members a pattern added followed the catalog's
order. The editor gave them no grip or Up/Down, and the gateway tried
them in that order. Now every row gets the same grip, Alt+arrow and
Up/Down that named members have. Matched rows still have no Remove,
since the pattern decides those.
The order is stored as Group.Placed, keyed by provider/model as Members
spells them. It is nil while the order equals the default (named, then
matched in catalog order), so existing groups.json files don't change.
Read (withMatches -> placedIn): members follow Placed. A model matched
since goes after them, and one no longer matched drops out. The gateway
tries members in the order the group is read, so it follows the editor.
Saved (SaveGroup -> placedOver): Members orders the named members, and
Placed (sent, or the stored one when a save doesn't send it) places the
matched ones. A save that doesn't know Placed (card routing, the CLI's
models+=, TUI, import) keeps the matched where they were, and a model it
names newly goes after the last named one. A provider rename, fold,
group rename and RenameMember carry Placed along.
Run:
- go test -timeout 45m -count=1 ./... on mote: 80 packages ok.
internal/gui fails 10 AppKit window tests at 30s (TestDockJoinLeadsCommandTab,
TestPanelCloseHidesIt, TestMainWindowCorners, ...). On a fresh origin/main
|
||
|
|
a45a0f1c5d |
signin: Settings can keep sign-in pages out of the default browser (max2020)
max2020 on Discord signs in from a separate, fingerprint browser so the vendor never sees their default one. Every waiting sign-in already shows its link with Copy link (since |
||
|
|
3b5dccd527 |
accounts: a plugin account goes by its usage's name, not its id (#4416)
A Huawei Cloud CodeArts account is kept by its accountId, an IAM id (iam::<domain>:user:<name>), and every list showed that id while its quota card showed the masked phone the plugin's usage() names it by. Display only: an account now reads as the name the user gave it, else the `user` its plugin's last usage read gave (PluginUserOf: the in-memory read, else quotas.json), else its id. The id stays the key everything is kept by; nothing stored changes or migrates. A read that fails keeps the last good name; nothing read yet is the id, never blank. One rule in provider (AccountShown, AccountShownOf, AccountLabelOf), used by every list: cards' Alias (Usage page, tray panel, /v1/magpie/quotas, magpie quota), magpie accounts, magpie providers, the TUI's Providers rows and quota titles, usageapi's Account filter, the quota alert. The GUI gets it as /api/providers' accountUsers (accountShownOf in app.js): the editor's account rows (the id in the tooltip), the per-account proxy lines, Routing's userShown, the Providers search, Hide accounts. app.js's account lookups share one helper, so the core stays in its budget (1,536,561 of 1,536,586), with no room added. Run: - go test ./... -timeout 45m on mote at |
||
|
|
0621e70fb9 |
routing: leave a provider out of the groups magpie finds
chenxiang0010 on Discord asked to keep a provider or a model out of the auto-created routing groups. A model could already be kept out (remove its found group; magpie keeps it removed), but a provider could only be turned off per group or everywhere. Now Routing -> Groups, under "Find groups on their own", has "Leave out a provider..." (app menu, saved when it closes) and `magpie group auto skip <provider>...|none`. The providers chosen (providers.json autoGroupSkip) join no found group; a group the user made or changed keeps them, a found group left with one provider goes away, and a request for it is served by AutoStandIn from a provider still in, and agents on it are reseated (agent.Reseat). A rename carries the id along. en, zh, zh-TW, ja, de. Run at 383947fce (this change on origin/main |
||
|
|
31728e29a8 |
routing: the German connection-check note names {agent} as often as the English one
The sibling of ec5571d6f's ja fix: da3c5e0c0's de string for "{agent}
checked that magpie answers ..." had a third {agent} too, so gui-de's "de
has every zh string, with its placeholders and tags" was red on main. "Das
Modell dieser Prüfung wählt {agent} selbst" now reads "wählt es selbst";
the sentence opens with {agent} already. zh and zh-TW had two.
Run: wsl-run gui-de, gui-ja, gui-zh-tw, i18n-keys: 13/13; gui-de alone
before this change: red, this test. Found in the whole GUI suite run
after v0.1.2228 (
|
||
|
|
65c7924108 |
cli: TestProviderAddressMovesALocalServer adds LM Studio in a folder of its own
The test added lmstudio in the package's shared config folder, so a
second run (-count=2 and up) found it there, added "LM Studio 2"
instead, and read the old provider back at localhost🔢 red on
origin/main
|
||
|
|
380032cda1 |
providers: Send requests unmasked is the user's switch at any address, with a caution while on for one not local (AcMilan)
AcMilan (Discord) runs a vLLM at http://llm.corp.lan:8000, and the editor never offered "Send requests unmasked": the switch showed only for a localhost, *.local or private-IP address. Asked, he said the choice should be the user's for each provider. provider.SkipsRedaction is now: Unredacted, no signed-in account, not another magpie, and at least one address. Nothing is looked up on the request path. The editor shows the row for every provider but an account or remote magpie. While it is ticked, an amber caution under it names an address not on this computer or the local network (awayHost). A name of the user's own DNS is asked about, only while ticked, through POST /api/local-hosts (provider.LocalHost -> netproxy.LocalName: every address loopback, private or link-local, 400ms lookup, kept 1 minute). That answer only words the caution. CLI help and `provider show` say the same. The 'away' i18n line is in zh, zh-TW, ja and de. To stay inside the core script budget, a few nearby editor comments were cut down (no raise). Run (logs in the worktree's logs/): - Full Go suite on mote at base |
||
|
|
995f84a0f9 |
codex: how early an expiring reset is used is a setting
A Codex reset card that would run out unused was spent 30 minutes before it expired, a fixed resetExpiryLead. Now the lead is codexResetLead in settings.json (minutes, 15 to 1440). Unset, out of range or unreadable reads as 30m, never 0, and magpie never writes it unless the user does. - settings: CodexResetLead and Settings.ResetLead(); the menu's values are 15m, 30m (default), 1h, 2h, 3h, 6h, 12h, 24h. - provider: the spend (expiringResetSpent) and routing (Allowance.Restarts, through nextResetLook) read the same resetLead(), so they still agree (#717, #718). The "near" look cadence follows it: lead + 30m, at least 1h, so a look lands inside a long lead. - GUI: Settings > Usage, under the Codex auto-use rows, a row "Codex: how early before one expires" with an app menu (no <select>), and the sub text says spending earlier loses what the windows have left. The four "before it expires" strings say the chosen lead. POST /api/settings/codex-reset-lead; the general save keeps the field. en, zh, zh-TW, ja, de. - CLI: magpie quota auto-reset lead [30m|3h|<minutes>|default]. - app.js budget: the auto-use rows moved out to lazy autoresetown.js (painted in the same draw once loaded), so app.js and the core script stay under their budgets with no raise. The button sizes to its widest label (a grid of every label), so picking one never rewraps the row. Run (all on mote through mote-run): - go vet: darwin, GOOS=linux -tags nogui, GOOS=windows; nogui build. - go test -tags nogui -timeout 45m ./... at 3955adccf (this change before the paint and sizer fixes, which touch only GUI assets): 81 ok. go test ./internal/gui at this head: ok. - GUI, Chromium: codex-reset-lead, codex-auto-reset, codex-auto-reset-settings, segs-press-redraw, i18n-keys: 62/62. WebKit: every case of those files failed at browserType.launch (180s timeout) before a page loaded, both runs; mote's browser launches hang under #4125 (load ~26), so WebKit is not run. - Rebased onto |
||
|
|
b889ffe813 |
library: a server can stay each agent's own entry with the MCP hub on (#4382)
cuipengcx90's #4382, Option A's first step (nifengfanpan asked on Discord): with the MCP hub on, every Library server went behind magpie's one entry, so a server that reads its project from the folder it starts in, or keeps a session's state, resolved the wrong repository or shared state across agents. A server now has a hub policy, Server.Hub ("hub" in library.json): "" (shared, the default, so nothing changes for existing users; "shared" is saved as "") or "direct". A direct server is left out of the hub through inHub, the test that already keeps magpie's own image server out, so each agent given it keeps its own entry written as with the hub off, beside the hub's entry for the rest. An agent whose every server is direct gets no hub entry. The hub neither lists nor runs a direct server, at /mcp/magpie/hub either, and hubPrune ends one it held. Switching goes through change(), so the agents are written again at once and the entry from the other policy is removed. An unknown policy is an error. - GUI: with the hub on, the server editor has a "Through the MCP hub" switch (role=switch, not a <select>; not shown with the hub off or for the image server), a direct server's row has a "Not through the hub" tag, and the hub's line and the Connect sheet name the direct servers with the image server as given directly. Strings are in zh, zh-TW, ja and de ("MCP 聚合" as the core uses it). - CLI: magpie library mcp hub <name> shared|direct (ServerHub), and magpie library marks a direct server. - TUI: an edit keeps the policy. - Not done: Option B (per-roots/project backends behind the hub, keying hubPool by roots). It is left for later; #4382 stays open for it. Run: - TestHubDirectServer (internal/library) and the extended TestLibraryMCPHub (internal/cli) on mote. Broken by hand: inHub back to !isSelf(s) makes TestHubDirectServer red ("codex with the hub on: [magpie], want [index magpie]"). - Real configs in a sandbox HOME on mote (fake claude on PATH, the real binary built from this tree): mcp add index + web for claude and codex, hub on, hub index direct, shared, then both direct. The direct index entry was in .claude.json and .codex/config.toml beside magpie's; with every server direct both files were byte-for-byte as with the hub off (json.tool diff and diff); shared again removed the index entry. - Full Go suite (-tags nogui -timeout 45m ./...) on mote at this tree rebased on origin/main |
||
|
|
62a1dcdd79 |
usage: a start's log blocks are of log-v1.bin's pages, not the heap (#2278)
logDiskRead read log-v1.bin whole with os.ReadFile, and the kept blocks' Archives were slices of that copy, so a 240k-call history held ~7 MB of file bytes in the heap for good. GOGC then let the heap grow by about as much again. Where the system maps the file, the blocks are now of its pages, the same way requests-v1.bin's blocks already are (diskMapping, readMapped, m.read()). Elsewhere it is read into the heap as before. Run at the pushed head, on mote, through mote-run: - go vet ./internal/usage: ok. GOOS=linux and GOOS=windows go vet ./internal/usage: ok. - go test ./internal/usage: ok. go test ./internal/usageapi: ok. - New TestLogDiskBlocksMapped: 2 full blocks plus a tail are written, the log is restarted and read again, and each full block's Archive must be inside the mapping. Broken by hand (c.mapped = m dropped): red, "block 0: read from the file into the heap". Green again restored. - go test ./internal/gui: FAIL on the AppKit window tests only (TestDockJoinLeadsCommandTab, TestPanelCloseHidesIt, TestMainWindowCorners and 7 others), killed at their deadline on mote under load ~24. These are #4125 and #2645, and the same tests fail without this change. Bench on mote, with the real 240k-row history: a warm restart while the Sessions tab polls, and the heap profiled at 200 s. - In use: 174.1 and 175.0 MB with this change, 187.6 MB without. - Footprint at 200 s: 290 and 297 MB with it, 297 MB without. mote's load (~24) makes this ±20 MB, so the footprint gain is not resolved. Not tried: Windows, where the file is still read into the heap. |
||
|
|
4a440560b9 |
gateway: an image server file link opens without a header, by its own signed token
dhanyqaz on Discord (gateway in Docker on a VPS behind a tunnel, one gateway key per client): the Image MCP server's file URL /mcp/magpie/image/files/<name> opened only with the key that made it, so a link a model relayed to a person was always refused in a browser (no key 401, another key 404). The URL handed out now carries ?t=<exp>.<sig> (imageFileToken): HMAC-SHA256 of the file's name, its expiry (the same hour) and the making key's id, under a secret made at the first file and kept only in memory, so a restart, which loses the files, loses the links. It names neither the key nor its id. lanGuard lets a keyless GET or HEAD of a file path with a t through (imageTokenAsked), after the allow list and sharing are judged; imageMCPFile serves it only when the token is that file's, unexpired, and its key still on (access.On, read outside the store lock). Anything else is the 401 a keyless request gets; a wrong key with a token is still 401, a web page's Origin still 403, POST still refused, the header-key path as before. Rotating a key keeps its id, so its links stay good for the rest of their hour (they never held the secret); turning it off or removing it ends them at once. The URL's base is imageMCPBase as before (MAGPIE_PUBLIC_URL, else the request's host). Docs: gateway-routing.md's image server section. Not changed: generate_video's /v1/videos/<id>/content still needs the key; same class, filed as #4462. Run at fe3ad3917 on mote: gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./... ok; go test -tags nogui -count=1 ./internal/gateway/ ./internal/access/ ok (497s, 2s). New TestImageMCPFileLinkOpensWithoutKey; TestImageMCPGuarded and the draws test now check the bare URL keeps the old rules. Broken by hand (red each): no lanGuard pass-through (no header -> the reporter's 401); no expiry check (an expired token opened it); no key-on check (a turned-off key's link opened); key id left out of the HMAC (another key's token opened it). Dropping the handler's own sharing check stays green: lanGuard refuses unshared first, so it is defence in depth only. Real run (before the rebase, same change) on mote: sandbox HOME, fake upstream on 3561, magpie serve on 0.0.0.0:3562 with MAGPIE_PUBLIC_URL, an image made through the MCP generate_image call. The tool gave https://<public>/mcp/magpie/image/files/<name>.png?t=…, no key in it. curl to the LAN address and with a tunnel header: link, no header 200 (bytes = upstream's PNG), HEAD 200, another key + link 200; bare URL: own key 200, no header 401, other key 404; tampered sig, moved expiry, token on another name, POST, wrong key + link 401; foreign Origin 403; after `gateway-key remove` 401. Full suite not run at this head; runs after push. Not tried: a real browser click, and the reporter's Docker + tunnel setup itself (the tunnel was a forwarding header). |
||
|
|
482e883142 |
update: a Windows magpie on the Desktop leaves no magpie.exe.new or magpie.com there
nianshou5 on Discord (#help, Windows): magpie.com and magpie.exe.new showed on the Desktop and came back after being deleted. Both were written beside magpie.exe: - magpie.exe.new is the update the GUI downloads as soon as it is out and swaps in at the next restart. StageBinary put it beside the program whenever that folder was writable, so it sat on the Desktop until a restart, and a deleted one was downloaded again by the next check. - magpie.com (#3737) is written at every start while the app's folder is on PATH, and Settings > Command line's Add puts that folder on PATH, so deleting it on the Desktop lasted until the next start. Now: - StageBinary downloads into magpie's cache, in a folder of this program's own (update/<hash of the exe path>), when a rename from there reaches the program's folder (renamesInto, a real probe: the swap must stay one rename on one volume). With the cache on another volume it goes into a hidden .magpie-update folder beside the program (FILE_ATTRIBUTE_HIDDEN on Windows). A folder magpie may not write is unchanged (cache, moved in as administrator). The stage folder is removed after the swap or a failed download. - At start RemoveStaleNew looks in every place a download may be, magpie.exe.new beside the program included, and removes one no newer than the running version (same bytes, or an older file version); a newer one stays, as before. - Settled (the installed copy opened from a Desktop/Downloads one) also removes the update downloaded for that one, which nothing will put in now. - In a download folder (Desktop, Downloads, a temp folder, as isDownloadFolder already says) a start only keeps an existing magpie.com up to date and never writes a missing one; Add still writes it. Any other folder on PATH is as before. A Desktop magpie.exe that opens the installed one (Settle) already wrote none. Run: - Windows (win-run, xiaomi-gpu, sandbox HOME from testenv), a repro test with the running test binary standing for magpie.exe on a Desktop on PATH: at origin/main |
||
|
|
d6beb9975a |
agent: T3 Code gets magpie on Codex too, picked in T3's model picker
karissasel_ on X: T3 Code through magpie could only run Claude Code; the
harness couldn't be chosen. T3 runs a thread on the driver of the provider
instance its model is picked under, and magpie wrote only a claudeAgent
instance. It now also writes `magpie-codex` ("magpie · Codex", driver
codex) in ~/.t3/userdata/settings.json. Its config.launchArgs (T3's
CodexSettings key, passed to `codex app-server`, and its -c pairs to
`codex exec`) are Codex's own -c overrides: model_provider=magpie, the
same model_providers.magpie table codex.go writes, and model_catalog_json
pointing at magpie-codex-models.json beside settings.json. Values are
quoted for T3's tokenizeCliArgs. ~/.codex/config.toml is not written. A
binaryPath/homePath the user gave T3's own codex instance is carried over.
The user's name, on/off and unknown keys are kept; launch args and catalog
are magpie's, and Check says when they no longer reach the gateway
(the base_url read back through T3's tokenizer; a reverse proxy to magpie
the user put there counts, reachesMagpie, as for every agent). An
older Claude-only wiring gets the instance once on Sync; one the user
removed stays removed (stash t3code.codex) until magpie is turned on for
T3 again. Turning magpie off removes both instances and the catalog. The
option's note says where to pick (4 languages); reference.md and
agent-wiring.md describe it.
Run (on mote, the tree as committed):
- real end to end, sandbox HOME (~/t3e2e/home): settings written by this
code, magpie serve on 127.0.0.1:47811 with a fake Responses upstream,
T3 Code server 0.1.5 (npm t3) and @openai/codex 0.165.0.
`t3 thread start . "Reply with the word pong." --provider magpie-codex
--model fake/fake-model --wait` answered PONG-T3-CODEX; the upstream saw
POST /v1/responses, model fake-model, stream true, with the provider's
own key (sent by magpie's gateway).
- go test -tags nogui ./internal/agent -count=1 -timeout 45m: ok
- gofmt -l; go vet (darwin, GOOS=linux, GOOS=windows) ./internal/agent
- node --test internal/gui/tests/i18n-keys.test.cjs: ok
Broken by hand, each red then restored: no escaping in t3Arg
(TestT3CodeCodexInstance red); Sync without t3CodexSync (both new tests
red); no stash check (TestT3CodeCodexInstanceAddedOnce red); t3CodexOff
never reporting (TestT3CodeCodexInstance red). The first full run
was red in TestReverseProxyIsStillMagpie, Check comparing the launch
args by string; that red is the break for the proxy rule.
Not tried: T3's desktop app window (the server CLI is what it runs); the
Windows quoting on a Windows box; a real vendor upstream (fake one only);
T3's other drivers (cursor, opencode, pi, grok, ...), which are off by
default in T3 and not wired.
|
||
|
|
b5aa56e42d |
providers: a model test fails fast on an unreachable host and can be stopped (RIck)
RIck (Discord #feedback): after pressing 测试模型, the error took too long
to show, and the test couldn't be cancelled.
Fail fast. Each probe now has 10s (connectWait) to get a connection,
traced through httptrace's GotConn. If it doesn't get one, the error says
"couldn't connect to <host> in 10s". In the past a refused, unresolved or
silent host waited out the whole 20s probe, or TLS's own timeout, once for
every model. TestModels keeps the hosts it couldn't reach for the run
(withUnreached). Once one model on a host fails to connect, the rest of
that host's models fail at once with the same error, so they don't each
wait 10s in turn, four at a time. The 20s per-probe bound and the GUI's
3m/25s bounds are unchanged. A stream that breaks off before the model
answers is now a failure ("the stream broke off before the model
answered"), not a long wait. Plugin and account transports don't get the
connect bound, since they dial for themselves.
Stop. While a provider has a test running, its Test models button (the
model editor), its endpoints' Test, and a chip's own right-click test all
read Stop (停止 / 停止 / 停止 / Stoppen). Pressing Stop aborts the fetch
and posts provider/teststop with the run's token. The handler keeps each
run's cancel in testRuns, so the vendor's request ends on the server too.
This matters on WebView2, where a fetch abort never reaches the request's
context. The status line then reads "Test stopped". Every entry point goes
through one helper (provTest, testButton), so they behave the same.
app.js fits its budget with no raise. The helpers are compact, and three
comments in the editor's Fetch models were cut down.
Tests:
- TestTestModelsUnreachedHostFailsOnce: a listener that accepts and never
speaks TLS, connectWait set to 200ms and 8 models. Every model's error
must be "couldn't connect", and the listener may get at most 4
connections.
- TestStreamAnswerBrokenOff.
- TestProviderTestStops (models and endpoints): a fake vendor holds the
request until its context ends. The test waits for the request to
arrive, posts teststop, and waits for the reply to say canceled and for
the vendor's request to end. It waits on that state, not on a duration.
- model-test-stop.test.cjs: all three buttons read Stop, teststop is
posted with the run, the labels come back, the status reads Test
stopped, there is no left-border accent, and nothing overflows at
560px. It runs in Chromium and WebKit, in en, zh, zh-TW, ja and de.
Broken by hand (each one went red, then the fix was restored):
- the GUI test against origin/main's app.js;
- teststop's post removed ("Stop posted no teststop");
- teststop not cancelling ("the test went on after Stop");
- dead.Store removed (8 connections);
- the connecting wrap removed (TLS handshake timeout after 10s).
Run:
- At the pushed head:
- mote: TestCoreScriptBudget, TestProviderTestStops, the i18n Go tests,
TestTestModelsUnreachedHostFailsOnce and TestStreamAnswerBrokenOff:
ok.
- wsl-run (load 179): model-test-stop 10/10 and i18n-keys 4/4.
- model-test-one: webkit zh was red, "model-c moved on its right-click",
445.37 vs 444.89. origin/main's app.js was red the same way 3 of 6
times, in en and zh. That file is on #4218.
- provider-typed: 4 red (locator.fill 5s); see #4461.
- On the change before its last rebase:
- gofmt clean. GOOS=windows go vet and GOOS=linux -tags nogui go vet:
ok.
- Full Go suite on mote (-timeout 45m, tee'd): 79 packages ok.
internal/gui failed only on the ten AppKit window tests #4125 names.
- Whole GUI suite on Linux WSL (both engines, every language): 15,767
tests, 502 red across about 125 files, at load 160 to 175. The 8
provider-editor files gave the same pass and fail set at fresh
origin/main
|
||
|
|
72ed121fd2 |
agent: the Codex row asks for a reopen only when Codex's models change
Qyburn3 on X ("为什么我每天好多次要重启"): the Agents row of a Codex
app already connected said 已接入 · 退出并重开 Codex 应用后生效 several
times a day.
Cause: StaleCopies counts a running copy as behind when a digest of
what magpie writes for Codex changed after it started. That digest took
magpie-desktop-models.json byte for byte. Beside the ChatGPT sign-in
(since
|
||
|
|
4f2d5fc7e0 |
routing: a group can put its cheapest member first, by each one's price at that hour
liyuanzheng (#general) and lam_em (#feedback) both asked for the same thing. Off-peak, DeepSeek's own API should come first for deepseek-flash. At DeepSeek's peak (weekdays 01-04 and 06-10 UTC, billed 2x since v0.1.2173), another provider should come first, Ollama say. A schedule editor would make the user copy DeepSeek's hours into magpie. Instead, a group gets one more routing, "Cheapest first" (`cheap`). Each request sorts the members by what they cost right then: input + output price per million, at the peak rate when it is peak hours. A tie goes to the lower cache-read price. Free models count as 0. A member with no known price keeps its listed place after the priced ones. Prices come from the same priceOf the usage ledger bills with, so the user's own ModelPrices, list prices and maker prices all count, and so does a provider's rate windows. - routes: Seat carries Priced/Cost/CacheCost; Strategy.ByPrice; Cheapest is a stable sort, so equal prices keep the user's order. - gateway: weighRouted prices each seat at priceClock() (time.Now; a test holds it) through the new provider.PriceAt. The trace's Weighed row gets a price (input/output/cacheRead/peak) so Routing can say why. - It is a group's alone, like Manual. A provider saved with it drops it, and `magpie provider set … routing=cheap` refuses it. Groups take it in the GUI menu (one more item, no new controls), the TUI and `magpie group set <id> routing=cheap` (aliases cheapest, price, cost). - Routing's mode line says why the first one is first, e.g. "Cheapest first: deepseek-v4-flash costs least on ollama-cloud now — $0.150 in, $0.600 out a million tokens.", with peak and unpriced variants. en/zh/zh-TW/ja/de. - Docs: gateway-routing, plugin-runtime, reference (it also points at Time window and Pause rules for a fixed schedule) and the site's start pages (en/zh/ja). Run, at |
||
|
|
ccbefe2a28 |
provider: trayKind is named as the GUI's own in the quota span guard (#4457)
|
||
|
|
f7f2d75f2c |
gateway: nested routing groups share one classifier wait, not one each (heatonz)
heatonz on Discord (v0.1.2215): requests through nested routing groups often failed after 120s with 504 "magpie held this request for 2m0s without routing it to any provider". The 2m is the unrouted watch's bar for known waits, and the wait was the decision model: the top group's ruleFor and each ruled nested group's (nestedRules) asked its classifier with a whole classifyTimeout() of its own, one after another, before the route was begun. With classifiers that don't answer, N ruled levels held a request N waits (60s x 2 is exactly the 2m). Jason's fix shared one wait across a decision model's key failover (askDecideTries); the levels were the sibling it missed. Now a request has one classifier wait, from the first classifier asked (Server.askWaited), shared by every group it goes through: - a level asked with time left gets only what's left (askClassifierIn, askChat, askDecider/askDecisionGroup/askDecideTries take the wait); - a level asked once it is spent isn't asked: it goes by its group's order at once, as for a classifier that didn't answer, and its Classified.Error says "spent by the routing group above"; - a classifier or decision key cut short by the shared wait (waitSpent, cutShort) is not rested (classifyRest, decideFailed): it had less than its own wait, and nothing says it is down. docs/subsystems/gateway-routing.md says so. Nothing from v0.1.2215 to origin/main |
||
|
|
59109044c6 |
provider: the ZCode mover's min is 0.1.39, gift plans are also claimed from the ZCode app's banner feed (plugins#503)
Plugin 0.1.39 (magpie-community/plugins 2e580cf) reads the ZCode app's claim banners from GET /api/v1/marketing/touch as well as billing/preview. A banner plan (ZCODE WEEKEND BUILD, 10-30) is in neither billing list while the app shows it, so the daily check-in said there was nothing to claim (kongbai01203's capture on plugins#503). The claim itself is the same POST /billing/claim; a list that doesn't read is a failed check-in, asked again later. keepMovedCurrent brings every moved ZCode user to it. Run on mote, worktree at origin/main |
||
|
|
5bb252c8f3 |
usage: a poll's small pairing lets a whole history's scratch go (#2278)
The matcher, the response picks and visibleLocal's set of ids seen are kept for the next pairing, and each pairing that puts one back holds it scratchLinger more. A poll's pairing of its last few days put back the scratch the cold start's pairing of the whole history made, sized for every call, so ~140 MB of maps and slabs stayed while the window polled: the heap profiles at 44, 50, 56, 62 and 68 s were alike to the MB, all of it under codexEffortOfIndex, with no pairing of the history running. Each scratch now records the rows of the largest call it served, and a call over a quarter of that or less (and over 4096 rows' floor) makes its own; the large one goes with the collection. A call alike in size takes what is kept, as before, so the polls while an agent works still reuse it. holdBigBuild counts its rows through the same rowsOfAll. Run on mote at this head (parent |
||
|
|
7d4a631480 |
tray: pick which of a subscription's windows the menu bar shows (StrikingRaw on X)
Claude Pro's menu bar card drew its 5-hour and 7-day windows as two
small stacked numbers, and the user wanted one of them alone. Settings ›
Usage › Menu bar windows (under Allowances in the menu bar) lists a pill
per ticked subscription with two or more windows ("Claude Code · All
windows"), opening the app's menu: All windows, then each window. The
choice is settings.TrayWindows, by provider id (every account of it, the
in-use "|*" card too) and by window kind from the span ("5h", "1d", "7d",
"month", "15m", "name:<name>" when the span is unknown), so a vendor
reordering windows changes nothing. Unset shows every window as before;
a pick whose windows are all gone shows every window again, never an
empty card. Only the bar's rows and the Linux label are filtered; the
tooltip still says every window. One row draws at mpRowFont's 11pt
single-row size. Hidden on Windows (its tray shows no text). Per
computer through KeepOwn. The GUI learns kinds from trayKind on
/api/usage/quotas (withTrayKinds; model and aside windows get none). The
row's code is a lazily imported traywindows.js, so the core script
budget is not raised (app.js +4 lines for the call and the prefs keep).
Run:
- mote (macOS): go test -run 'TrayWindow|TrayUsage|WithTrayKinds|
CoreScriptBudget|AppScript|TrayImage' ./internal/gui/ ok;
./internal/settings/ ok; davsync TestSync ok. TestTrayImageOneWindow
draws through AppKit: Claude's card one line ("42%"), both windows two;
the PNGs were looked at.
- mote: gofmt -l empty; go vet ./..., GOOS=linux go vet -tags nogui
./..., GOOS=windows go vet ./... ok; go build, GOOS=linux go build
-tags nogui, GOOS=windows go build ok.
- magpie-desktop (Linux VM), --test-concurrency=1, BROWSER=chromium and
webkit: tray-windows (en, zh, zh-TW, ja, de; picking All; hidden on
Windows / single-window / no cards; 360px narrow), i18n-keys,
old-webkit, tray-usages, tray-logos, tray-cost, quota-pace: 43/43 each.
After rebasing on
|
||
|
|
ec5571d6f2 |
routing: the Japanese connection-check note names {agent} as often as the English one
da3c5e0c0's ja string for "{agent} checked that magpie answers ..." had a
third {agent}, so gui-ja's "ja has every zh string, with its placeholders
and tags" was red on origin/main (
|
||
|
|
8921ef8056 |
provider: the Command Code plan prices DeepSeek V4.1 Flash, with its peak hours (treeman on Discord)
treeman_26897 (#help): in the price editor the Command Code plan's
deepseek/deepseek-v4.1-flash showed empty boxes, and typing a price lost
the peak/off-peak split.
What was wrong, on the plan (served by its plugin since the retire):
- No price at all. models.dev's DeepSeek now lists V4.1 Flash only as
deepseek-flash, by the dated canonical deepseek/deepseek-v4.1-flash-1017,
so no maker price matches the undated id, and the plugin's own model list
gives cost 0 (none). Its calls were counted unpriced, at nothing, and the
editor had no list price to show. models.dev's own "commandcode" catalog
does list it ($0.15/$0.60, cache read $0.003); the Command Code API-key
preset already read it through its endpoint, the plan didn't.
ListPrice now falls back to that catalog for the plan (vendorListPrice),
after the maker's price, so a model DeepSeek prices keeps DeepSeek's.
- No peak hours. PeakOf judged the vendor by the provider's URLs, and a
plugin provider's are plugin://, which matched nothing. plugin:// URLs
are now left out, so the plan is told by its id as before.
- A user's own price was flat at every hour. It is now the off-peak base,
doubled in the peak hours of a vendor that bills by the hour (DeepSeek,
Command Code's DeepSeek V4, OpenCode Go's two), as the vendor does to
its own price. Chosen over a second "peak price" field: smaller, no new
UI. The editor's hint says it ("Off-peak price, the list's or one set
here: ... doubles it", en/zh/zh-TW/ja/de).
Behaviour change for existing users: a price already set on such a model
now counts double in those hours on the Usage page. It was not left
alone because the vendor itself doubles whatever the off-peak price is;
a price set for every other model is unchanged (tested: OpenCode Zen and
an OpenAI model hold at every hour).
Tests:
- TestCommandCodePlanPrice (new, models.dev's bytes of 2026-10-30): the
plan's plugin provider lists 0.15/0.6/0.003, 0.30 at peak; DeepSeek V4
Pro keeps DeepSeek's 0.66; a set price is 0.1 off-peak, 0.2 at peak; a
relay doesn't take Command Code's catalog.
- TestPeakOf: the plan with plugin:// URLs, its flash-fast, another plugin.
- TestPriceOfPeak: a set price doubles at peak; Zen and OpenAI set prices
don't.
- model-price-edit.test.cjs: the hint names a price set here.
Broken by hand (each red, then put back):
- peak.go at origin/main: TestPeakOf plugin case and four
TestCommandCodePlanPrice checks red.
- vendorListPrice off: "list price ... false", "unpriced".
- the user price's Peak line removed: TestPriceOfPeak (3 keys) and
TestCommandCodePlanPrice (2 keys) red.
- origin/main's app.js with the new GUI test: model-price-edit red.
Run:
- mote-run go test ./... -timeout 45m -count=1 at
|
||
|
|
2df46e3c87 |
gateway: Claude's thinking around magpie's search goes back where Claude wrote it (oreoft)
oreoft on Discord: Codex Desktop on a Claude model (Responses translated
to Messages) on a Bedrock-backed line. After a turn with reasoning and a
web_search_call, the next turn got 400 "messages.N.content.1: thinking or
redacted_thinking blocks in the latest assistant message cannot be
modified", Codex retried it ~6 times, then "stream disconnected".
Cause: on a line that doesn't search by itself, magpie runs the search
(searchRounds). Claude writes the reply as two messages: [thinking A,
text, web_search tool_use], then after magpie's tool_result [thinking B,
answer]. Codex keeps only the items: reasoning A, message,
web_search_call, reasoning B, message. parseResponses dropped the
web_search_call, so the next turn sent one message [thinking A, text,
thinking B, answer]. Each block kept its exact text and signature
(claudeseal), but B had moved, which Bedrock checks and direct Anthropic
lets pass.
Fix: parseResponses keeps a web_search_call as a Search part.
searchRoundsBack splits an assistant run that holds Claude's signed (or
redacted) thinking at each search into magpie's web_search call (named as
searchTool names it) and a result with the query and the pages found,
since what the search said was never kept. The latest assistant message
is then [thinking B, answer], as Claude wrote it. A search with no
Claude thinking beside it is left out, as before, and a history with no
web_search_call is untouched (direct Anthropic with valid signatures and
no search: same body as before).
Run:
- TestClaudeThinkingAroundMagpieSearchGoesBackAsWritten (new): a strict
fake Messages upstream refuses, with Bedrock's words, a latest
assistant message whose thinking blocks aren't one it wrote at the
same places. The test runs Codex's two turns through /v1/responses with
a fake Tavily, streamed and not. TestSearchWithoutClaudeThinkingStaysOut
(new). Both pass, with the focused Search/Codex tool-loop tests, on mote.
- Broken by hand (claudeSigned always false, i.e. the old drop): red with
"400 (refused 2) messages.1.content.1: thinking ... cannot be
modified", the reporter's error, after Codex-style retries.
- Full suite go test -tags nogui -count=1 -timeout 45m ./... on the Linux
box (mote had three other full suites running): every package ok except
internal/agent's TestInstalledVersion, TestGrokInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI and TestOmpDetectedWithPiDir.
These are #4033 and #3548, red at main on that box, in a package this
change doesn't touch. After the rebase onto
|