31da93ccdca03073513d2e1d73efdfd50bd14f6a
954
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
3fd7e16983 |
agent: PenguinHarness is installed from the Agents page and served by magpie with nothing to set up
rankyurky asked on Discord #feedback for PenguinHarness (npm @prismshadow/penguin-cli, command penguin). Every value comes from Penguin's own source (0.2.17): - Config: $PENGUIN_HOME (else ~/.penguin/data, every OS) / $PENGUIN_PROJECT_ID (else default_project) /.project_config.toml. magpie writes [providers.magpie] (base_url, client_type, api_key), one [[models]] entry per magpie model (context_window, vision, max_tokens, [models.pricing] in usd_per_mtok) and default_model in Penguin's own inline spelling. Penguin's server reads the file again when its mtime changes, so no restart; a default naming no entry is refused by Penguin, so Check fails when one is missing. - A file magpie creates is 0600 in a 0700 folder, as Penguin keeps it. Disconnect restores the user's own default_model (or none), drops a magpie vision model, and removes the file when magpie made it. Penguin's own entries, providers and command_policy rules are kept. - A sync that changes nothing writes nothing (bytes and mtime kept), so Penguin's watcher isn't woken. - Install: curl -fsSL https://penguin.ooo/install.sh | sh, or irm https://penguin.ooo/install.ps1 | iex on Windows; update: npm, or penguin update --yes for the tarball, except on Windows where update.ts refuses it. - WSL: a penguin kind with no restart notice; the WSL test now expects an empty Notice for a kind with no restart. - agentenv: PENGUIN_HOME, PENGUIN_PROJECT_ID; the project id is in NotPaths, or appdir dropped a value like "work" as a relative path. - edit.SetTOMLArrayTables: replaces every [[name]] entry with key = value (with child tables) by blocks, or removes them; blank lines between replaced entries go with them, and an unchanged result isn't written. - GUI: penguin-color.svg icon; README (en, zh-CN), docs/reference.md and docs/subsystems/agent-wiring.md. Run (worktree at |
||
|
|
d9a8148d7c |
routing: Speed first sends a request to the provider or key that answered the model fastest lately
joeliu96872540 on X: when one model is reachable through several API
channels, they want an option that sends each request to whichever has
been answering fastest, because they compare channel speeds by hand
today. Speed first (`fast`; `fastest` and `speed` also work) is a new
routing beside Free first. It applies to a provider's keys and accounts
(provider editor › Routing) and to a group of one model on several
providers (Routing page › group › Routing).
How it decides. When a streamed answer ends, gateway/speed.go records two
numbers for that account or key and model (restID): the time to first
token and the output tokens per second, as usage.DecodeOf computes them
for the Requests page. Each is a decayed average with a 20m half-life.
After an hour with no answer the record goes stale, and the store holds
at most 4096 records. This is O(1) at the answer choke point, beside
servedCandidate. For a pool routed by BySpeed, weighRouted reads one map
entry per candidate, and only for that pool. The usage history is never
read on a request.
routes.Fastest ranks each awake seat by its estimated time to a
200-token reply: TTFT + 200/TPS. A seat that reported no TPS gets the
median TPS of the others. Seats within 10% of the fastest in their band
keep their listed order, so near-ties don't swap on every request.
Seats with no recent measurement go after the measured ones. One request
in five, counted per pool, goes first to an unmeasured seat, rotating
among them, so each gets measured again. Resting seats go behind the
awake ones, and used-up seats behind those. Rests and failover are the
same as for every other routing.
The request trace gets lateTtft and lateTps, and the row-story sentence
says "answered m fastest lately: first token in 0.8s, 60 tokens a
second". It has a variant for a probe turn and one for when no seat has
been measured yet. i18n covers zh, zh-TW, ja and de. Also updated: the
CLI (`magpie group|provider set <id> routing=fast`, plus a new
`routing=` pair on provider set that refuses manual), the TUI name, the
rotation plugin's Sub, docs/subsystems/gateway-routing.md,
plugin-runtime.md, docs/reference.md and site start.html (en, zh, ja).
There is no new layout: it is one more item in the existing pickers.
app.js stays under its budget with no raise.
Tests:
- routes/fastest_test.go:
- ordering: fastest first, slow writer loses, alike keep order,
resting and used-up, median pace, none measured;
- the probe turn at 5, 10, 15 and 20, rotating between seats;
- a resting seat never gets a probe turn.
- gateway/speed_test.go:
- decay, staleness and per-model records, with an injected clock;
- a group of slowv and fastv routed fast: after the speeds are
measured and seeded, the request goes to fastv with lateTtft set;
- the same group routed in order still goes to slowv.
- cli: parseRouting and the provider routing= pair.
- GUI routing-speed-first.test.cjs: the row story for measured,
no-pace, probe and none, in en, zh, zh-TW, ja and de, in chromium and
webkit: 40/40.
Broken by hand:
- Fastest returning the listed order: the routes tests and the gateway
group test go red.
- noteTrySpeed removed: "the streamed answer wasn't measured".
- The client.js case renamed: routing-speed-first 0/20 in chromium.
Run at b5a5caff2 (base
|
||
|
|
b5d17b26e0 |
gateway: Antigravity's 429 to Codex's GPT-5 prompt says why and rests nothing, on the web-search path too (Jodiezzzzzz on X)
From Codex, every call to antigravity/claude-opus-5-5 failed with "exceeded retry limit, last status: 429" while dsh worked on the same account. The call was an agent_created_thread, and the vendor said "Resource has been exhausted (e.g. check quota)". Cause: a Codex thread begun on a GPT-5.x model keeps "You are Codex, an agent based on GPT-5..." as its first developer message after /model, resume -m or a fork, and magpie lifts it into systemInstruction. Antigravity answers that line with a fake 429, whatever quota is left, as it does Claude Code's (#666). Codex also sends a web_search tool every turn, so for an Antigravity model magpie serves search itself (translate -> searchReply -> askTranslated), and that path passed the bare 429 back: no hint, no 400, so Codex retried to its limit. - antigravityTurnsCodexAway: the two Codex GPT-5 opening lines count as a turned-away prompt; antigravityHint picks the Codex hint for them. - antigravityRound wraps the search path's ask, so its 429 and an in-stream refusal get the same 400, hint and no rest as translate's. - antigravityForeseen returns the hint, so a group skips Antigravity for the next 6h saying which prompt. - The Routing page shows the new hint (routing/client.js HINTS) in en, zh, zh-TW, ja and de. - Rest: none. The refusal is about the prompt, not the account (Fail "prompt"); a second account answers the same. Plugins: middleware-antigravity-cloak 0.1.1 (plugins a52d1b3) breaks the two Codex lines with U+200B. Its body says "npm had 0.1.0": wrong, the package is not on npm; dist had 0.1.0 and now has 0.1.1 (6fd1438). No mover applies. Real account (owner's Antigravity, sandbox HOME copy, gateway built from this branch) and real Codex 0.162.1: - codex exec resume <a gpt-5.5 thread> -m antigravity/gemini-3-flash: before, 429 retried to "exceeded retry limit"; after, one request and a 400 with the Codex hint; route try (429, prompt), no rest. - A new Codex chat on the same model: 200. - The two lines with U+200B after the first letter: 200; whole: 400. Broken by hand: - antigravityTurnsCodexAway returning false: the Codex tests go red (Codex got 429; the group's skip doesn't say why). - The antigravityRound wrap removed: the search=true subtests go red ("Codex got 429"). Run: - go test -count=1 -timeout 45m ./internal/gateway/: ok (476s, at 865df2472; main's next three commits touch only GUI files). - go test -count=1 -timeout 45m ./internal/gui/: ok (230s, at the pushed tree on |
||
|
|
68ee4117af |
gateway: a Gemini model's untyped tool schemas go typed (Vertex refused cua-driver's drag)
kthink on Discord: dsh with cua-driver's MCP tools on Command Code's
google/gemini-3.8-flash (the commandcode plugin), every request 400
INVALID_REQUEST from Vertex: "`mcp__cua-driver__drag` functionDeclaration
`parameters.target` schema didn't specify the schema type field."
cua-driver's drag schema before cua's #4888 has target as an anyOf of an
untyped oneOf and null, and scope a const with no type. Command Code's
gateway turns JSON Schema into Vertex's Schema object, whose type is
required, and an untyped node stays untyped.
geminiToolTypes (forwardOnce, so plugin requests too) is keyed on the
model id (last '/' segment starts with "gemini"), not the provider:
each untyped schema under tools' function.parameters / parameters /
input_schema gets the type its enum/const, keywords or branches say,
null left out; {} or a description alone is a string, a tool root an
object. Mixed-type unions, unresolved $ref/unions and anything under
not/if are left as they came. Written in place after the brace, so the
rest of the body is unchanged. withTypes no longer writes a trailing
comma into an empty {} (it produced invalid JSON there).
Google's own Gemini API / Code Assist (parametersJsonSchema) and
Antigravity (plainSchema) bodies have no such tools and are not walked.
Run at this tree, rebased on origin/main
|
||
|
|
8f023b5119 |
pii: a long text goes to the masking model in overlapping pieces, a piece at a time, each kept (#3682)
A text over 12 KB was sent to pf-serve whole. On a weak GPU one such
text could take longer than classifyTimeout, so the request failed and
nothing was kept, and every other request waited behind it.
Now find.go cuts a long text into pieces of at most 12 KB (pieceSize).
Each piece overlaps the one before by up to 1 KB, cut after a line's
end where there is one, else after a space, else at a rune's start.
- Each piece is cached on its own, so a request stopped part way and
sent again asks only about the pieces not done yet.
- Spans are shifted to the text's offsets and merged: overlapping
spans become one with the longer one's label, and same-label spans
that touch are joined.
- pf-serve gets one chunk per call. The turn is given up between
chunks, so a short request waiting for the model goes next instead
of after the whole long one.
Run:
- go test -count=1 ./internal/pii/: ok.
- gofmt -l and GOOS=linux/windows go vet ./internal/pii/: clean.
- go test -count=1 -timeout 45m ./internal/pii/... ./internal/gateway/...
at f8b58fb48 (this change on origin/main
|
||
|
|
16f6e568f4 |
gateway: masking's time no longer counts toward the 2 minutes before routing (#3682)
yunwang2442-creator: a 480 KB request the local masking model takes 90s
over on an RX 470/580 (more on its CPU, and more behind the requests
ahead of it in the model's one turn) was answered 504 at unroutedMost,
2 minutes from its arrival, its masking cut off, and the same again
each time it was sent.
unroutedMost now counts the request's time other than masking: a
masking (noteMasking), its wait for the model's turn with it, is
tracked like the known waits, and most's timer (checkMost) looks again
when the last masking ends, with what is left. unroutedUnknown is as
before.
Reconciled with
|
||
|
|
dd5b0ab311 |
pii: a GPU too slow for one request is tried again, and a lost GPU comes back without a restart (#3682)
yunwang2442-creator's RX 470/580 (Vulkan): a 480 KB request ran past
classifyTimeout, magpie ended pf-serve, and classifyTurn set srv.cpu on
any GPU error. Nothing cleared it short of a restart of magpie, so every
request after it ran on a CPU about 3x slower. A slow request is not a
lost GPU.
Now:
- ended for taking too long on the GPU (h.slow), the try again is on
the GPU; a second one in a row is a lost GPU, and the CPU is tried;
- a GPU that dies answering, or whose load hangs (
|
||
|
|
7279bdc28b |
pii: pf-serve-vulkan runs its MoE in 2048-token chunks unless the user set PF_MOE_CHUNK (#3682)
yunwang2442-creator (#3682, Windows, RX 470/580-class 8 GB GPU through Vulkan, q8 model): with privacy-filter.cpp's default PF_MOE_CHUNK (4096) a 480 KB text took 159s and was killed at classifyTimeout's 150s; with 2048 it took 90s, and 2048 was 1.77x faster at every size from 24 KB to 480 KB and the fastest of 1024/1536/2048/2560/3072 on 48 KB. What PF_MOE_CHUNK is (privacy-filter.cpp at the pinned 735a6c286, src/model.cpp and docs/cpu-perf.md): the MoE FFN runs over the window's tokens in chunks of this many; per-token, so exact (no halo). Its default is the forward window (4096), where it is inert. So 2048 changes speed only, not what is found. Measured here, M4 Pro, Metal, the real pf-v2 pf-serve and q8 model run directly (not through magpie, ~/.config/magpie untouched), interleaved A/B, two rounds of two runs, at load ~250 from other sessions: 24 KB: 4096 0.40-0.43s, 2048 0.44-0.45s, 1024 0.49-0.66s 96 KB: 4096 1.86-1.92s, 2048 1.98-2.15s, 1024 2.22-2.27s spans the same (5) at every setting. So 2048 is ~6% slower on Metal: magpie sets it for pf-serve-vulkan only. macOS's Metal pf-serve and the CPU's keep the engine's default. A PF_MOE_CHUNK in magpie's environment (set, even empty) is the user's and is inherited by every pf-serve, never overridden (moeChunk). Run: go test ./internal/pii/ -run 'TestVulkanServeGetsMoEChunk| TestServeStartsWithoutResidency' (ok). The full ./internal/pii/... ./internal/gateway/... run is recorded on the last commit of this stack. Broken by hand: moeChunk ignoring the user's value -> the "user's own" case red (2048 where 3072 was set); moeChunk never matching Vulkan -> the "vulkan" case red. Not tried: a real Vulkan GPU (none here; the 1.77x is the reporter's measurement), an NVIDIA or Intel GPU through Vulkan, where 2048 may be slightly slower as on Metal. |
||
|
|
a6d7e02c77 |
gui: a page wheeled right after a click scrolls on macOS 13's WebKit too (issennknight on Discord)
issennknight (macOS, trackpad): every page scrolled again, but a saved profile opened on the Agents page and then scrolled through often stayed where it was. macOS 13's WebKit scrolls a view under wheels it never dispatches, so the view guard puts each such scroll back and takes three put back the same way within a second as the reader's run ( |
||
|
|
865df24727 |
gateway: a Chat stream's tool calls sent by turns are read by index, one call each
mysterious_dove (Discord, on |
||
|
|
5b4dec58e4 |
providers: a vendor's keys saved a provider each are one provider with those keys
yuluo_yx on X: "NVIDIA #595"…"#600" at integrate.api.nvidia.com and "Mistral #0001"… at api.mistral.ai were a provider each on the Providers page and a row each on Routing, and with thousands of keys magpie started slowly. They came from an app that keeps an entry a key (CC Switch) imported in one batch: ImportFromApps only offered "add as another key" against providers that existed before the batch, so each entry became a provider of its own (nvidia, nvidia-2…). Fold (internal/provider/fold.go): - FoldCopies runs in startUp, before anything lists the providers, so every user who has such copies already finds them folded. Automatic, not a one-click offer: they are the same account's keys at the same address, what the user wanted is one provider (zero-config rule), and nothing is lost: each copy's id goes in the provider's Was, so its calls count with it by key (ProviderKeyID is the key's fingerprint, unchanged) and a model picked by the old id still resolves. - Only copies by name fold at start-up: a base name and that name with a number after it (" #12", or freeName's " 2"), at least one numbered. They must also be alike in all but the key: the provider with id, name, keys and on/off left out, their per-model settings, and every place that names them (Visible, picked/hidden/ordered models, groups, fallbacks). A copy shown to one agent alone, given its own models or settings, or named by the user ("Home relay" / "Work relay") stays apart. Subscriptions, hidden ones, Vertex and StepFun-signed ones are never folded. - The first copy that is on takes the rest; it is named the base name ("NVIDIA") and its key keeps its old name. Others become keys in the providers' order, named as they were, off if they were off. - Group members, weights, rules, classifier, pick and fallbacks name the provider once; per-model settings and fetched lists of the folded ids go; balance and window history kept by their id moves to their key's name, where a provider with several keys reads it. - A providers.json that doesn't parse is left alone (read() would have given its .bak, and a fold would write that over it). - ImportFromApps folds what one import added by shape alone, whatever the entries are called. Routing needed no change: a provider's keys for one model already fold into one row ("2400 keys"), opened on click (FOLD_AT, #1319). Numbers, sandbox HOME with 2400 NVIDIA + 600 Mistral copies (gen.py, NVIDIA preset + 2 models, Mistral 15 models), `magpie web`, every outgoing request through a dead proxy: - before (origin/main |
||
|
|
9809a8ac9a |
gateway: Codex side calls go at an effort the model takes, and a refusal for no effort is asked again at low
cybercaius on Discord: Codex's side calls are meant to go at low effort,
but some went with none or no effort, and the upstream answered 400 as
the model needs one.
Cause, from Codex's source: a title asks low only on Codex's own title
model (gpt-5.6-luna, thread_title.rs `(model == THREAD_TITLE_MODEL)
.then_some(Low)`); on any other model, a magpie one included, it sends no
effort. The auto-review (guardian select_review_model) asks low only when
the model's preset lists low, else the preset's default, and codexcat
writes no levels and no default for a magpie model whose levels aren't
known, so it too goes with none. magpie fitted an effort asked to the
model's levels but never added one that was absent, and its off-effort
retry fired only for none/minimal refusals that list levels.
Fix:
- codexSideEffort: a title, description, summary, prediction, auto-review
or memory call on one of magpie's models whose levels are known, asking
no effort or an off one the model hasn't, is asked at its lowest on
level (onEffort: low where it has it). Groups, other efforts and models
with unknown levels go as asked.
- serve, forwarded and translated (Chat and Responses, not Anthropic):
a 400 whose body says an effort is required (effortRequired: "reasoning
effort is required", "missing required parameter: reasoning.effort",
"requires a reasoning effort", "reasoning cannot be disabled") to a
request that asked no effort or none is asked again once at onEffort.
Any other 400 goes back as it came, asked once; a none that was refused
is remembered (offRefused) as before. A no-effort refusal isn't
remembered, so a model with unknown levels pays the 400 each time.
Ran (at this head, rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/... ./internal/agent/...: ok (gateway 521s, agent 316s), at the pushed tree (2ca0da8e5 before this body was written), base
|
||
|
|
81a73c1c01 |
gateway: a Codex title that comes before its conversation's first turn follows the model just switched to
cybercaius on Discord: after switching Codex to another model, the first
new conversation's title was still written by the model before.
Cause: Codex writes a title on a temporary thread of its own
(tui/src/app/thread_title.rs, thread_source "thread_title"), with no
parent link to the conversation, started as the first message is sent and
so racing that conversation's first turn. codexLeads.of found neither a
parent nor its own thread and took the key's last turn, which, when the
title came first, was the previous conversation's, on the old model.
Composer predictions run on a fork and named it (forked_from_thread_id),
which of() never read, so they too took the key's last turn rather than
their conversation's.
Fix: of() reads the forked-from thread. The app's side turns (titles,
descriptions, summaries, predictions) read through codexLeads.sideOf: a
call tied to no thread magpie has seen, whose key's last turn is older
than 3s, waits for the next own turn (a channel saw() closes), up to 5s
or the request's cancellation, and takes that turn's model. Subagents and
memories keep codexSessionOf with no wait: they carry their lead's
thread. The auto-review follows the session only through codexcat's
per-entry override, and compaction goes on the conversation's own turn
model, so neither reads codexLeads.
Ran (at this head, rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/... ./internal/agent/...: ok (gateway 521s, agent 316s), at the pushed tree (2ca0da8e5 before this body was written), base
|
||
|
|
51202cd431 |
plugin: a check-in outcome magpie doesn't know names what the plugin said
A plugin check-in that answered an outcome not in the list, with a message, became failed with the plugin's message alone, so "the daily credits were refreshed" read as magpie's own failure reason. The reason now names the answer first: the plugin answered "yes": <message>. With no message it stays "the plugin answered no outcome" or the answer. Split out of skygunner's fix/usage-absent-used branch (#3650), which carried it beside the usage fix. Run: go test ./internal/provider -run TestPluginCheckinRunsAsTheBuiltinsDo ok. Broken by hand: host.js's old line makes it red (Msg was the message alone). Not tried: a real plugin answering an unknown outcome. Co-authored-by: skygunner <skygunner@users.noreply.github.com> |
||
|
|
9733ed1b4a |
usage: a plugin window that doesn't say used is no reading (#3650)
A plugin usage window that leaves out `used` was read as 0 in host.js
usageOf. The card then showed "100% left" (or NaN% once the GUI saw a
missing value), and allowanceOf ranked the account as the one with all
of its allowance left, so smart routing put spent accounts first.
Now a left-out used is null from the host, plugin.UsageWindow.Used is a
*float64, and quotaOfPlugin makes such a window Text and Aside: the card
shows its display (else "No allowance reported"), with no percentage and
no meter, and routing leaves it out. An account whose windows all tell no
share has no allowance and is not known to routing (routedAllowance), as
one never read: not preferred and not rested. A window that says used:0
is a reading at 0, as before.
Ported from skygunner's fix/usage-absent-used (6791aa99). Changed from
the branch:
- lastAllowances (the reading kept on disk) built an empty allowance for
such an account, which routing read as known with all of it left. Both
it and Allowances now go through routedAllowance.
- quotaText shows "No allowance reported" for a no-share window with no
display, rather than a blank.
- A host-level test (the bun host with the fake plugin) and the GUI test
widened to both engines, every language, 900 and 390px, used and left.
- The branch's check-in wording change is its own commit.
Note: an account whose windows are all aside or text was known with 0%
used before; it is now not known, so loginRoom won't pick it as the
next account with room.
Run at this tree (base
|
||
|
|
43001be863 |
gateway: a relayed Chat body's unpaired tool calls are paired before Kimi sees them
Paidaixinbao on X: Qoder through magpie on Kimi Code, a conversation forked at an earlier turn fails on every prompt while a new one works. A Chat client's body to a Chat upstream was relayed as-is, and only translated requests had their tool exchanges mended (pairToolMessages). A forked or stopped history can hold a call with no tool answer, calls split over two assistant messages, a user turn between a call and its answer, or an answer to no call. Kimi turns the whole request away with 400 "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'..." or "tool_call_id is not found". toolPairsOut now pairs such a body on the Chat relay (joining split calls, answering the unanswered, turning an orphan answer into user text); a paired body goes out byte for byte. Run: - Real Kimi Code API (kimi.com/coding/v1, 2026-10-26; the account's plan has lapsed, so a body past validation answers 403 and a refused one 400): unanswered call, split calls, user between call and answer, one of two answered and an orphan answer are each 400; every one of them after toolPairsOut is 403, past validation. A tool turn without reasoning_content, null content, repeated ids, out-of-order and double answers, prefill and a reasoning field all pass as-is, so they are not the cause and are left alone. - gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows. - go test -timeout 45m ./internal/gateway: ok, at this commit. - Two fixtures held an unpaired body only by accident and are paired now: image_input's chat-tool case (a lone tool message) and the large-chat upstream golden (its last call left unanswered); the new large-chat hash is the same on the old code. Broken by hand: without the toolPairsOut call all six subtests of TestChatRelayPairsToolsForKimi go red against a fake Kimi with Kimi's own wording; without joinSplitChatCalls the split case goes red; reading only string content in toolAsUser turns the parts case red. Not tried: the real Qoder app and the reporter's own forked history, so which shape their fork holds is not proven; Qoder's "unsupported request" text is not magpie's wording. A real Kimi model answer (the plan has lapsed, only validation was seen). A non-Kimi Chat upstream, though the rule is OpenAI's too and runs for every Chat relay. |
||
|
|
6e6aba51c8 |
providers: a key may be for another plan of its vendor, sent to that plan's endpoints
yckonnnn on X uses Volcengine's pay as you go and its Agent Plan, and wants a key of each in one provider. Each plan takes its own keys at its own endpoints (/api/v3, /api/plan/v3, /api/coding/v3), and every key of a provider went to the provider's one plan, so only one kind worked. A key now may say which of its preset's Regions it is for (KeyAccount.Plan; Provider.KeyPlan for the first key, as KeyProtocol). None, or the provider's own plan, is the provider's plan, stored as none: old configs read and write as before. Presets whose plans take keys of their own (PresetDef.KeyPlans): zhipu, zai, stepfun, stepfun-cn, xiaomi, baidu-qianfan, tencent-cloud, huaweicloud, volcengine, siliconflow. Not: yylx (one key everywhere), bailian-decision (decide only), bedrock and bedrock-mantle (regions of one account). Every reader of the region or a base URL, and what it does now: - WithKey (keys.go): moves the key's copy to its plan (atKeyPlan: Chat, Responses, Anthropic, Decide, KeysURL, Website, Catalog via atRegionOf; a provider at a host of its own keeps that host) and marks it keyView. Every gateway key path goes through it: chat, Responses, Messages, count_tokens, failover, embeddings (serveRetrieval via onKeys), drawing (drawOnAccounts via perKeyBarred), key tests (test.go), key_models.go, gui/groups.go, markedKey. - perKeyBarred (gateway/fallback.go): a key whose plan's list lacks the model (PlanServing) is not asked; only when no key's plan has it. - fetch / fetchPerKey / planOnly (models.go): a mixed provider lists each key's plan, a NoList plan from its preset list with no request, pay as you go from /api/v3/models with its own key. - planMedia (PlanEmbeddings, PlanDrawers, PlanVideos): every plan's. - PlanQuotas (planquota.go): each key read at its own plan's source. - volcPlanQuotas, tencentPlanQuotas: one view per plan (planViews). - KeyBalances (balance.go): each key at its plan's host (SiliconFlow). - startVideo / videoMaker (gateway/video.go): a mixed provider starts on a key whose plan makes the model (onKeys) and names it in the id (keyMark), so the poll goes to that key's plan. - GUI: POST /api/keys/plan (SetKeyPlan, then the lists are read again); the editor keeps KeyPlan with an unchanged first key, typed() clears it with a new one; KeepSecrets, AddCopy, backup's withoutKeys carry it. - app.js: planPicker, a plan chip in each key row (the app's own menu, openProtoMenu, through pickPill, which protoPicker now shares), shown for a KeyPlans preset while the provider has several keys or the key has a plan; i18n zh, zh-TW, ja, de. A key's plan is not guessed from the key: Volcengine's keys carry nothing that says their plan. Xiaomi's tp-, Tencent's sk-tp-, MiniMax's sk-cp- and Bailian's sk-sp- are noted in code but not used. Not done: a gateway key held to some keys (videoAsker) on a mixed provider's video may pick another key; a mixed provider whose own plan has no balance source while a key's plan has one is not read; keys left out for their plan don't show in the Routing trace; StepFun's plan windows are a sign-in per site, unchanged. Credit: yckonnnn on X (tweet 2114657701305487483). Run at this commit on origin/main |
||
|
|
1bb8143b37 |
gateway: thinking pi sends back in reasoning goes to DeepSeek once, as reasoning_content
ArvinCharl on X (tweet 2114658365963976779, v0.1.1560): pi on a
self-hosted DeepSeek through the Chat path keeps the thinking the server
returned in `reasoning` and sends it back there. withReasoningOnToolTurns
copied it into reasoning_content and left `reasoning` in, and the server,
which reads the two as one field, refused the request with "duplicate
field reasoning".
When magpie fills reasoning_content (asReasoningContent), the message's
`reasoning` is left out, so the thinking goes once. Sibling:
reasoningDetailsAsContent (Kimi, #1765) filled reasoning_content from
`reasoning` the same way and now leaves it out too. reasoning_details
stays on the DeepSeek path: it is a list of typed entries (an encrypted
one, a signature), not another name for the text, and an upstream that
refuses it already has it taken out (reasoningDetailsAsContent,
withoutMessageReasoning). A message with reasoning_content of its own is
left as the client sent it. Not changed: flattenContent (replies to the
client, typed thinking parts, no `reasoning` field added), buildChat
(writes reasoning_content alone), mistralThinking (drops all three).
TestChatToolTurnWithoutReasoningRelayed asserted the old duplicate on
its OpenRouter-field turn and now wants reasoning_content alone.
Run at 9df403f80 (rebased on origin/main
|
||
|
|
5a94eec3ae |
gateway: a request held 30s before routing in no known wait is answered then
sharwowwow on X: "转圈两分钟才报 504,这个超时阈值本身就很折磨人。网关要是能 早点失败、早点给明确错误,排查能省不少时间。" A request held before any route was answered 504 only after unroutedMost (2m), whatever held it. Now the time a request spends in a wait magpie knows of is added up as it happens (noteWait/waited, the union of overlapping waits), and a request held unroutedUnknown (30s) outside them gets the same 504 and message then. unroutedMost (2m) stays the cap for one in known waits. Known waits, each read from the code between counted and noteRoute: - the request's body arriving: r.Body is wrapped (waitedBody), so every read of it (keyLimited, requestBody, readRequestBody) counts; - masking (noteMasking); - System One's or the decision model's classifier (askWaited); - an image's description (seenBody); - Codex's auto reset before the route (autoReset); - plugins' gateway hooks / plugin host start (GatewayBegin) and JS gateway middleware (Begin, Request); - every notePhase (slot, rpm, upstream); these come after the route for watched requests today, so it only guards a future change. What is left is magpie's own work (catalog build, parsing, planning, affine, reading the usage log), ~8.5s at its slowest (a cold catalog sync); 30s is about three times that, with room for a loaded machine. The log says "30s of it in no wait magpie knows of". Run at this tree (rebased on origin/main |
||
|
|
ea1f9492bc |
cli: magpie tools lists, and magpie tool calls, the tools magpie's MCP servers give agents (iwinux)
iwinux on Discord (#feedback) wanted magpie's image generation, image recognition and web search without going through an agent's MCP, and had written a Python script for generate_image. magpie now has it: magpie tools [<name>] magpie tool <name> [--<param> <value>…] [<words>…] [-o <file|folder>] [--json] Both ask the running gateway's own MCP servers (gateway.OwnMCPServers: image, vision, web-search, plugin tools) over HTTP, with the local token and the magpie-tool/1 User-Agent, so the tools, schemas, models from Settings and usage counting are the ones an agent gets. Nothing is started besides (#3318: the cases sit before startUp, beside mcp). - Parameters are read against the tool's inputSchema: types (integer, number, boolean, array given once per item, object as JSON), enum, - and _ alike, --p v or --p=v. The words left over are the tool's one required text, else its prompt. An unknown flag or parameter, a missing required one, a bad value, a value given twice or both words and the same --param are refused with "nothing was called"; no request is sent. - A file path a parameter takes (its description says file and path) is made absolute, since the gateway doesn't know the current folder. - --help prints toolUsage (static): help is handled before anything runs. - A still-being-made answer is waited on with generation_result (1s between asks, 30 min at most). The gateway's image server now says so in _meta too: usemagpie.ai/pending is the id, usemagpie.ai/files the files made ({url, inline}); an older gateway is read from its text. - Images and videos are saved through imagemcp.Target (now exported): -o file or folder, else the current folder named from the prompt, numbered when more than one, never over a file that is there; a file not inline is downloaded by its path from the gateway asked (the token goes nowhere else). --json prints the raw answer and saves nothing. - No magpie at the address: "magpie isn't running at <url>: open the app or run magpie serve". MAGPIE_GATEWAY=<url> points at another. Docs: usage lines in magpie help, docs/reference.md (Use), the gateway routing subsystem page (_meta and the CLI), README en/zh, site docs start page en/zh/ja. Tests (internal/cli/tool_cli_test.go, never the network; every test sets MAGPIE_GATEWAY to its own httptest server): - TestToolsListsTheServersTools, TestToolReadsParameters, TestToolRefusesWhatItDoesntKnowAndCallsNothing (no tools/call, no file), TestToolHelpCallsNothing (no request at all), TestToolSavesTheImage, TestToolWaitsOnWhatIsStillMade (pending _meta, then the old text form, download with the key from the gateway asked, not the URL's host), TestToolErrorIsSaid, TestToolSaysMagpieIsntRunning, TestToolDrawsThroughTheGateway (the real gateway.New().Handler() with a fake vendor: lists, draws, saves the vendor's PNG). - TestImageMCPDrawsAndServesTheImage, ...SlowDrawingIsWaitedOn and ...MakesVideos now check the _meta. Red on the old behaviour: with withMeta setting nothing (what main answers) all three fail ("_meta map[], want pending img_…"). - Broken by hand: dropping the unknown-parameter check makes TestToolRefuses… red (the --model call was made); saving an inline image by its URL instead makes TestToolSavesTheImage red. Both restored. - TestHelpOnEveryCommandDoesNothing covers tool and tools. Run with this change on origin/main |
||
|
|
cebd0d4c35 |
pii: a hung GPU load moves to the CPU, a failure says what ended pf-serve, and a failing model holds requests back at once
lazyeo on Discord (Apple M2, 16 GB, macOS 27.0.1, since v0.1.1577): with
Settings → Privacy's local model on, every request, even the first after
a restart, waited out the gateway's 2-minute 504 ("still loading"), and
Settings showed "pf-serve ended: ggml_metal_device_init: tensor API
disabled for pre-M5 and pre-A19 devices … recommendedMaxWorkingSetSize".
Their goroutine dump has startOne(path, cpu=true): a GPU pf-serve had
failed and every request was loading the CPU one.
What was wrong:
- macOS had one pf-serve candidate, the Metal one; a load that hung on
the GPU waited out loadTimeout (3m) with no CPU to fall back to.
- The error was pf-serve's stderr, which on every pre-M5 Mac starts with
ggml's Metal init lines (the CPU mode too), so a kill by magpie's own
classify watchdog read as a Metal crash. On an M4 Pro the CPU mode
reads ~1.4 KB/s, below classifyTimeout's 4 KB/s, so a slower Mac's CPU
pf-serve is killed by magpie on larger requests.
- Each failed request left the next one to load again, so a model that
keeps failing held every request for its full 2 minutes.
Changes (internal/pii):
- candidates(): the GPU one (Vulkan, or macOS's Metal pf-serve), then
pf-serve with PF_DEVICE=cpu. A GPU load gets gpuLoadTimeout (40s, inside
the gateway's 2m); a GPU that fails or hangs moves the run to the CPU
and sets gpuLost, as one dying in classify already did.
- died(): "didn't answer in Xs (N KB on the CPU), so magpie ended it"
when the watchdog killed it, else "ended (exit status/signal)", then
the last 3 stderr lines that aren't ggml/Metal/Vulkan startup chatter
(a line saying error/fail/assert/abort is always kept).
- After a failure, FindContext holds requests back at once with that
error (before and after taking the turn), until a retry 30s later,
doubling to 10m while it keeps failing; a success or Stop resets it.
The request is still held, not sent masked by the rules alone; the
message says how to turn the model off.
- pii.go's comment and docs/subsystems/gateway-routing.md say so.
- Tests: a cleanup race in fakeInstall, and the seam above (cache.go
gets disk.saves).
Run (worktree at origin/main
|
||
|
|
d3191a51c8 |
gui: with Hide accounts on, an account's eye shows that one account in this window (yogurt36)
yogurt36 on Discord, for a screen share: with Hide accounts on, one
account should be readable while the others stay masked. Now an
account's name on the provider editor's row (accountNameButton and the
one-account line) and on its Usage card (quotaWho) has a quiet eye, in
sight on hover or keyboard focus, with an aria-label. A click shows
that account, its address and the name the user gave it together
(kin), everywhere the window draws it, tooltips included: the shown
set is skipped in hits(), which every mask goes through. It lives in
memory only. The tray panel keeps hiding it, and closing the window
hides it again: the page stays loaded while the window is hidden, so
hideMain runs mainClosedJS (hideAccounts.closed) first. With Hide
accounts off there is no eye. Strings in zh, zh-TW, ja and de.
Run (macOS, playwright 1.62.0, rebased on 630fd1d69; at push
|
||
|
|
05eeb4e1b9 |
gui: a recorded call's body viewer moves from app.js to the Gateway plugin's script
callBodyPanel and what only it uses (the JSON tree, the stream's events and reply, sseView/sseShown) move whole, unchanged, from app.js to the end of plugins/gateway/client.js. Nothing in the core called them: the Gateway page's recent calls, Usage's ledger and Routing's trace do, and every plugin's script is loaded by index.html whether the plugin is on or off, before any of them runs. app.js goes from 1,320,558 to 1,304,307 bytes; the budgets are not changed here. This makes room for the per-account eye in the next commit without raising a budget. Checked that the moved block is closed: none of its 12 names (and sseView, sseShown) is used in app.js outside it, or in context.js, plugins.js, kernel.js, pluginpages.js or start.js, and none is declared in another script. docs/subsystems/plugin-runtime.md says where it is. Run at this commit (Chromium + WebKit, NODE_PATH playwright 1.62.0): json-tree, recent-call-bodies, request-archive-usage, request-archive, routing-bodies, sse-body and i18n-keys: 58 pass, 0 fail. go test ./internal/gui -run 'TestCoreScriptBudget|TestBuiltinClientsLoaded': ok. The whole GUI suite and go test ./internal/gui ran with the next commit at the pushed head (see its body). |
||
|
|
630fd1d691 |
masking: Clear records… deletes what masking kept, after a confirm (maxyou2090)
maxyou2090 (#feedback) turned on strict masking and it recorded many
requests, with no way to delete them short of finding
~/.config/magpie/masking by hand.
Insights › Masking's list now ends in "Clear records…" (beside "Kept on
this computer for 30 days", shown while anything is kept). It asks first
with the app's confirm dialog (Cancel / Clear, red), then posts
/api/masking/clear and reads the page again: an empty list and card. A
clear that fails says why in the status pill and the list stays.
maskrec.Clear removes each day's file whole under the store's lock (a
day is removed, never rewritten, so there is no half-written file to
guard against), forgets each day's cached summary, and drops the text
around placeholders and the bodies kept in memory. A day it can't
remove stays, is still listed, and is named in the error. Keys keep
rising, so a record after the clear never takes an old key. What the
masker holds for each placeholder stays: a placeholder still in an
agent's context is put back in its answers. GET on the route does
nothing. Strings in zh, zh-TW, ja and de. gateway-routing.md says it.
Tests:
- internal/maskrec TestClear (three days and a stray file: the days go,
the stray stays, List/Sum/Get/SentOf are empty, keys keep rising, a
new Add counts) and TestClearSaysWhatStays (a directory it can't
write: the error names 2026-10-26.jsonl and the record is still
listed). With Clear stubbed to return nil both go red
(maskrec_test.go:220 "left in ...", :260 "err <nil>").
- internal/gui TestMaskingRecordsAPI: GET clears nothing, POST clears,
records/summary empty, record/sent 404. Red with Clear stubbed
(masking_test.go:127).
- GUI masking-records.test.cjs: "Clear records asks first, then
empties the page" in Chromium and WebKit, en/zh/zh-TW/ja/de, 1100 and
640px (Cancel sends nothing; Clear posts once; nothing wider than the
window; the click scrolls nothing; nothing left in English), and "a
clear that fails says why and keeps the list". Red on the old page.js
(the button never appears).
Run, at this commit (on origin/main 44a626bed; vet, maskrec, the gui Masking tests and the 22 new GUI cases again after that rebase):
- gofmt -l internal/maskrec internal/gui: clean. go vet on darwin,
GOOS=linux -tags nogui and GOOS=windows for both packages: ok.
- go test ./internal/maskrec: ok. go test -run 'Masking|Budget|Script'
./internal/gui: ok.
- GUI: masking-records.test.cjs whole and i18n-keys.test.cjs, both
engines: 86 pass, 0 fail (before the rebase onto
|
||
|
|
44a626bed3 |
gateway: an image's detail reaches a Chat or Responses upstream; Responses' original goes to Chat as high (mysterious_dove)
mysterious_dove on Discord (Codex): a Responses request translated to Chat Completions lost every image's detail, so detail=high and detail=original were dropped. The IR had no field for it: Part now carries Detail, read from a Responses input_image and a Chat image_url object, in message content and in a tool's output (toolOutput). - Chat (buildChat, chatImage/chatDetail): low, high and auto go as they came; Responses' original, which Chat lacks, goes as high; an image with no detail goes without one, as before. Both the message image and a tool's image (the follow-up user message) use it. - Responses (buildResponses and the orphaned tool output rewrite, responsesDetail): the sibling. A Chat client's low/high, and a Responses client's original, reached a Responses upstream as auto. They now go as sent; anything else, none included, is still auto (#1474's strict vLLM needs one). - Anthropic and Gemini have no such field; nothing is sent there. Ollama's native route has none either. buildChat/buildResponses are the one choke point for translations, plugins included. The GUI "downgrade list" with "图片 detail=high 降级:丢弃" named in the report isn't in magpie, the plugins repo or the site (grepped for the labels, 降级, detail=, downgrade): it is not changed here. Doc: docs/subsystems/gateway-routing.md gets a bullet beside the tool images one. Tests (internal/gateway/image_detail_chat_test.go): - TestResponsesImageDetailReachesChat: high, original, low, auto, none, and a function_call_output image with original -> high, high, low, auto, "", high. - TestChatImageDetailReachesResponses: low, high, none -> low, high, auto. Red on the old code (chat.go, ir.go, responses.go stashed): Chat images had detail "" for all four, Responses had "auto" for low and high. Broken by hand (chatDetail returning "original" for original): red with detail "original", want "high" on images 1 and 5. Run: - gofmt -l internal/gateway: nothing. go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok. - go test -tags nogui ./internal/gateway (sandbox HOME): ok 492s. - Full go test -tags nogui -count=1 -timeout 45m ./... in a sandbox HOME at 22a563c4f (this change on |
||
|
|
a6c808b688 |
hermes: every bot still on magpie's model follows the model magpie sets (tjhhhh_84378)
Hermes copies the launch profile's model block into a new profile
(hermes_cli/profiles.py _seed_model_config, or --clone's config.yaml) and
never reads the main config again. magpie put its provider into each
profile but left each profile's model alone, so after a model change in
magpie every other bot (profile) still opened on the model magpie had set
when it was made (tjhhhh_84378 on Discord, with the Hermes gateway closed).
Now picking a magpie model for Hermes also moves each other profile whose
model.provider is magpie and whose model.default (or model.model, which
Hermes reads with default unset) is the model magpie had set onto the new
one (hermesFollow). "The model magpie had set" is recorded in stash.json
(hermes:<path>:magpie.default); for a config connected before the record,
it is the connected config's own magpie model. A profile on any other
model, magpie's or its own, was set by its user and is left alone, also
when it is on a model magpie used before. Disconnect forgets the record.
A profile made after the change is seeded from the current config, so it
starts on the new model already. RenameProvider goes through the same
field Set, so a renamed provider moves the following bots too.
Test: TestHermesProfilesFollowMagpieModel (internal/agent): a seeded bot
and a model.model bot follow pro -> flash (no record yet) and, through an
own model on the main config in between, -> max; a bot on magpie's
deepseek/lite and a bot on its own provider stay; a bot its user moved
back to the previous magpie model stays. On the old hermes.go it fails:
hermes_test.go:613: flash: writer is on magpie/deepseek/pro, want magpie/deepseek/flash
Run:
- gofmt -l internal/agent: clean. go vet ./internal/agent on darwin,
GOOS=linux -tags nogui and GOOS=windows: ok, at this commit (rebased
onto origin/main 689cf4142; nothing under internal/agent changed in the
rebase).
- go test -tags nogui -count=1 -run Hermes ./internal/agent at this
commit: ok (33.6s). Whole ./internal/agent before the rebase: ok (307s).
- Full suite, go test -tags nogui ./... -timeout 45m -count=1, sandbox
HOME, at a57d2460b (this change on
|
||
|
|
6e96903346 |
codex: auto-review follows the session on a ChatGPT Free plan (cybercaius)
cybercaius on Discord measured codex-auto-review spending a Free
account's allowance ("实测在 free 账号不免费"). magpie left an unset
auto-review to Codex (codex-auto-review), and held such a call by no
usage cap, on #1593's finding that OpenAI counts it in no window; that
was measured on a paid account.
Decision: with nothing picked and Codex signed in to a Free plan (the
ID token's chatgpt_plan_type is "free"), auto-review counts as "Same as
the session", as Codex's other side calls do, so the review stops
spending the free allowance when the session is on one of magpie's
models. On Codex's own model nothing changes (its entries keep OpenAI's
reviewer). A paid plan, or a plan magpie can't read, keeps Codex's pick;
a pick in Settings always wins.
- codexcat.AutoReviewModel is the setting in effect; the plan comes from
provider.CodexSignInPlan (liveLogin, keychain read cached), read once
per model list, and the list tag already re-stamps on auth.json.
- freeOnChatGPT no longer exempts a Free plan's codex-auto-review call
from usage caps (capHeld).
- GUI tooltip says it (en, zh, zh-TW, ja, de); docs updated.
Run at the pushed tree (on origin/main
|
||
|
|
e0b39f7784 |
codex: titles, descriptions, predictions and memories follow the session's model (cybercaius)
cybercaius on Discord: after v0.1.1576 ( |
||
|
|
083a8a2d47 |
gateway: a failed Codex compaction says what failed, never "Unknown error" (outrageous_piglet)
outrageous_piglet on Discord (magpie 0.1.1575): Codex's compaction ended
"Error running remote compact task: unexpected status 502 Bad Gateway:
Unknown error". codex-rs says "Unknown error" of an error status whose
body is empty or whitespace (UnexpectedResponseError::display_body).
Every path a compaction reaches, probed with a fake upstream answering
502/500/503/405/501 with an empty body, an HTML page and {"error":{}}:
- a magpie model (codexCompact, through serve, every wire): always a
message, but a bare "Fake: 502 Bad Gateway" that doesn't say it was
the compaction or where it went;
- Codex's own model on /responses: an empty body was already said
(#409), a web page relayed as its markup;
- Codex's own model on /responses/compact (and compactOn's account):
relayed byte for byte, so an empty body reached Codex empty. This is
the path that gives "Unknown error".
Now:
- codexUpstreamOn says an empty or web-page error on /responses/compact
as on /responses (codexSaidNothing): the model, the status, who it went
to (Codex's sign-in, its API key, or the magpie account), and the page's
title. An error OpenAI says in JSON still goes as it came.
- codexCompact's relayed failure is said as the compaction's, with who
answered it (compactFailed), keeping the vendor's code, param and
Retry-After.
- 405 and 501 join 404 (lacksEndpoint): the summary is asked again as
text, then made locally, so a provider without the endpoint still
compacts.
The reporter's provider and model aren't known, and their URL is
/responses, where magpie at 0.1.1575 already says an empty body; the
only empty relay found is /responses/compact. A proxy between Codex and
magpie answering 502 itself would also read so; not ruled out.
Run: go test -tags nogui -run 'Compact|Codex|NotAnAPI|Empty'
./internal/gateway ok. New tests TestCodexOwnCompactFailureIsSaid,
TestCodexCompactFailureSaysCompaction and
TestCodexCompactNoEndpointCompactsLocally fail with codex_backend.go
reverted by hand; TestCodexOwnCompactErrorAsSaid guards the unchanged
JSON relay and passes on both.
Run at the pushed tree (on origin/main
|
||
|
|
634cbf587b |
agent: Claude Desktop on an imported profile for magpie's gateway is connected, and Reconnect keeps it
aa86222 on Discord: Claude Desktop's configuration (magpie's profile, with
the connectors added in it) exported on one computer and imported on
another becomes a new configLibrary entry under a random id Desktop makes
(createConfig in Desktop 2.7032's main process), applied beside magpie's
own. It points at this magpie's gateway, yet the Agents row said
"已不经过 magpie:配置已变更", since desktopCheck took any appliedId but
magpie's own as another gateway. Reconnect then applied magpie's own
profile, dropping the imported one with its managedMcpServers, and on the
old code a later switch-off applied the first entry left (CC Switch's).
Now an applied gateway profile whose inferenceGatewayBaseUrl is this
gateway (desktopIsOurGateway) counts as on magpie (desktopAppliedGateway).
Check reads its URL and key; Reconnect (desktopOn, when magpie's entry is
already listed) keeps it applied and leaves every setting in it as it is;
only a key this gateway would refuse (another magpie's named key) is set
to magpie's Desktop key, by Reconnect or by Sync at magpie's start
(desktopKeyApplied). magpie's own keys (gateway.Token, magpie-<agent>)
count as taken. A profile for another gateway (CC Switch) is still drift
and Reconnect still applies magpie's. The first switch-on still seeds
magpie's profile from an applied one (#2035, unchanged). appReads includes
the applied profile, so a key fix asks for Desktop's restart.
Run (macOS, sandbox HOME only, at
|
||
|
|
a7072926d6 |
agent: connecting Kiro Crew connects the harness it is set to (wuping9525)
wuping9525 (Discord, Windows): Kiro Crew's Agent Harness was Claude Code,
Claude Code was installed but not connected to magpie, and turning Kiro
Crew on refused with "connect Codex, Claude Code, ... first". On a Mac it
worked only because a harness (Codex/Claude Code) was already connected;
Crew's home is found the same way on Windows (USERPROFILE\.kiro\crew).
Now, when agent.acp_backend names one of magpie's harnesses (codex,
claude, opencode, pi, goose) and that agent is installed but not
connected, connecting Kiro Crew connects it in the same action and runs
Crew on it; the notice says so. The stash's kirocrew.joined records it.
Kiro Crew's Disconnect disconnects that agent again only if magpie
connected it and the user hasn't disconnected it since (kiroCrewUserLeft
in Agent.Disconnect); a disconnect the user made before stays recorded as
theirs. A failed Crew write undoes the join. config.local.json pins,
kas/kiro/deepseek and harnesses not installed behave as before.
Windows: the adapter search also tries npm's .cmd/.exe/.bat shim names,
and the app is detected by ~\.kirocrew-app\.venv\Scripts\kirocrew.exe.
New notice translated in zh, zh-TW, ja, de; docs/subsystems/agent-wiring.md
and docs/reference.md updated.
Run (macOS, sandbox HOME, GOMODCACHE/GOCACHE pinned), at base 11c3fbb19;
after rebasing on
|
||
|
|
56900e4845 |
agent: Claude Desktop on magpie gets the MCP servers the user added signed in (aa86222 on Discord)
aa86222 on Discord: Claude Desktop on magpie's gateway (3p mode) didn't sync its connectors. Two parts: - A claude.ai account's connectors can't reach 3p mode. Desktop calls them through claude.ai with the signed-in account (/api/organizations/<org>/mcp/servers/<id>/tools/call in Desktop 2.7032's main bundle, refused with no_active_org without an account), and 3p mode has none. Anthropic's 3p docs say "Made by Anthropic" connectors are only in standard Desktop; others reach 3p through managedMcpServers or plugins (claude.com/docs/third-party/claude-desktop/extensions). magpie doesn't answer or pass any of these: they never go to the inference gateway. - What magpie can do: 3p mode reads its MCP servers from Claude-3p/claude_desktop_config.json, a file of its own, so the servers added signed in (Settings -> Developer, in Claude/claude_desktop_config.json) were gone from the list. Switching on now copies each mcpServers entry Claude-3p has none of the same name for (desktopCarryMCP). One already there (the user's, or the Library's, which writes both files) stays. Sync does it once for a Desktop already on magpie (stash mark claude-desktop.mcp-seen), so a server the user takes out in 3p isn't brought back. Off takes back each copy still as copied (stash claude-desktop.mcp); one the user changed stays. Claude's own file is never written. Run, at this tree: - go test -count=1 -timeout 45m ./internal/agent ./internal/library ./internal/desktopdir: ok - gofmt -l internal/agent: clean; go vet ./internal/agent for darwin, GOOS=linux and GOOS=windows: ok - the built binary in a sandbox HOME (macOS): `magpie claude-desktop provider magpie` copied a filesystem server into Claude-3p's claude_desktop_config.json with Claude's file byte for byte; `provider ""` removed Claude-3p again, Claude's file unchanged. Broken by hand: desktopCarryMCP returning at once turns TestClaudeDesktopCarriesTheMCPServers, TestClaudeDesktopMCPKeepsThe3pServers and TestClaudeDesktopSyncCarriesTheMCPServersOnce red; desktopUncarryMCP returning at once turns the first two red (off left the copies); Sync carrying on every run turns the third red. Not tried: a real Claude Desktop reading the carried servers in 3p mode (it reads ~/Library, so the sandbox can't host it, and the live one is not touched); Windows and Linux folders (same code path through desktopSets); the reporter's own connectors, which weren't described beyond "can't sync" and are most likely claude.ai ones, which this cannot bring. |
||
|
|
4e5b2ad81c |
gateway: another magpie added by hand rests only the model it refused
lagrangepoint1813 on Discord: Pi on a magpie whose provider is another
computer's magpie got "Remote Magpie: Claude Code: You've hit your
session limit" for every model of it, whichever Pi was switched to.
remoteModelRest rests such a refusal by model (restID) only for the
Remote magpie preset; that magpie was added as an OpenAI-compatible
provider of the user's own name (preset null in providers.json, the
reporter found), so the 429 rested the whole key
(restKey) and quotaHeld answered every model of it from that rest for
the five hours it named. A magpie's reply names the provider that
answered or held it (X-Magpie-Provider), as no vendor's does: keepRetry now notes it as
answeredThereHeader (this magpie writes its own provider into the same
header of its reply, so it can't be read there; the note is kept from
the client), and remoteModelRest reads a refusal carrying it as another
magpie's model's, whatever the provider was added as. A quotaHeld or
verifyHeld answer now names its member too (noteMember), as an asked
one does, so a refusal the other magpie held is read the same. The
key's own limit there (remoteKeyLimitHeader) still rests it whole.
TestAnotherMagpieAddedByHandRestsTheModel (two gateways over HTTP; the
other magpie asking Claude Code, and already holding it): both subtests
red on the old code with the reporter's message, green with this
change; -count=3 with TestRemoteMagpie* and Verify* green. Broken by
hand: reading X-Magpie-Provider straight from the reply header rested
by model everywhere (TestOwnQuotaRest, TestVerifyRefusalRestsTheLastOne,
TestAntigravityQuotaStillRests, TestCodexCompactCutSummaryFailsOver,
TestOpenRouterFreeAccountRateLimitKeepsProviderRest went red, the header
being this magpie's own); without noteMember on the held answer the
held-there subtest stays red.
Run at this head (on origin/main
|
||
|
|
7c2f27ccdf |
gateway: a strict conversation keeps its member past a reply that broke off
imwhatiam123 on Discord: a routing group of Qoder CN and WorkBuddy AI set to Stays: Strict moved a session to WorkBuddy AI. A reply that broke off after its 200 (#733, common from a plugin-served provider) called unanswered, which forgot the stick, so the agent's retry was routed as a new conversation (why "first", kept null) from the top of the order. Strict promises the conversation never moves to another account, member or key, its failure going to the agent: the stick is now kept under strict, so the retry goes back to the same member, fails there while it fails, and goes on there once it answers. The member still rests for new conversations as before. Every other mode forgets the stick as before. TestStrictGroupKeepsItsMemberPastABrokenReply: red on the old code (the retry went to second), green with this change. Run at this head (on origin/main |
||
|
|
a1174674da |
codex: subagents and memories follow the session's magpie model; auto-review can too (cybercaius on Discord)
Codex's side calls ask for one of Codex's own models by its bare name
whatever the conversation is on: a subagent goes on the model the lead
names in spawn_agent, memories on gpt-5.6-luna/terra, auto-review on
codex-auto-review. With Codex signed in to ChatGPT and the conversation
routed onto one of magpie's models, each of those went to the ChatGPT
account instead (cybercaius: "can't pick follow the main model").
- gateway (codexFollowTo, codexLeads): a collab_spawn or memory call
that asks for a bare model, with nothing set for it (no magpie
subagent model, no [agents] default_subagent_model, no [memories]
extract/consolidation_model in Codex's config), goes on the model its
conversation's own turns go on (parent thread, own thread, else the
key's last turn), when that is a magpie model the key may use. A task
the ChatGPT backend sealed stays on ChatGPT. The trace shows a
subagent's pick as {asked -> to}.
- agent.CodexSideSet reads Codex's config.toml for those keys; an
unreadable config counts as set (leave as sent).
- Auto-review gets "Same as the session" (settings value "session"):
codexcat writes each magpie entry's own id as its
auto_review_model_override. Not the default: codex-auto-review runs
free on a ChatGPT sign-in (#1593).
- GUI: the option in all languages; Memories' default text says it
follows the session. app.js stays under its budget by folding five
identical writingPrefs then/catch chains into prefWrite.
Ran (sandbox HOME, -tags nogui -count=1 -timeout 45m):
- go test ./internal/gateway ./internal/agent ./internal/codexcat
./internal/settings ./internal/cli ./internal/gui: ok.
./internal/provider: FAIL with "close of synctest channel from outside
bubble" in filememo.Forget (TestUnreadLoginsWriteErrorsKeepCredentials),
which is #3632 on main; this change touches nothing there.
- TestCodexSubagentFollowsTheSession and TestCodexMemoriesFollowTheSession
go red with codexFollowTo returning "" (broken by hand).
TestCodexSideCallsKeepTheConfigsModel, TestCodexSideCallsStayOnChatGPT,
TestCodexSideSet, TestCodexAutoReviewFollowsTheSession pass.
- GUI (playwright 1.62.0, chromium + webkit): codex-auto-review (en, zh,
zh-TW, ja, de), codex-memories, codex-memories-settings, codex-titles,
codex-predictions, codex-descriptions, settings-general, agent-prefs,
i18n-keys: 120/120 pass. TestCoreScriptBudget passes, budget unchanged.
- gofmt -l clean; go vet -tags nogui for linux, windows and darwin ok.
Again after rebasing on origin/main
|
||
|
|
49f15d1244 |
masking: a record names the provider the request went to, not the group's first member (Max You and Linka on Discord)
Linka on Discord: Insights › Masking's records said WorkBuddy AI, the
first member of their auto group, for requests that Codex in the same
group had answered. Max You: providers no route sends to show up under
Privacy all the same.
Cause: serve() recorded the masking (noteMasked) as the route began,
with p.ID, the first planned provider, before any try. A request the
first member failed, or a member resting or unable to serve, went on
to the next, and the record (on disk, and counted into the flow and
the provider filter) kept the first. Embeddings recorded tries[0] and
video the same way.
Fix: maskrec.Hold keeps a record in memory at once (the route's badge
and the answer's Restored need its key) and writes it to disk only
when done is told the provider and model of the last try.
noteMaskedUntil wraps it, and serve, embeddings and video call done
in a defer with call.Provider and the model tried last. A request
that never reached a try keeps the planned one, as before. Since a
long request's line is now written after later ones, List sorts each
day's lines by key, so paging with before skips nothing.
Old records keep the name they were written with; there is no record
of which member had them. They leave with the 30 days.
Tests:
- TestMaskedRecordNamesTheProviderThatHadIt (gateway): a group a/m,
b/m, a answers 500, b 200, with Mask secrets on; chat and
embeddings. On the old code both subtests fail:
masked_sent_test.go:96: recorded on "a", the request went to b
- TestHoldNamesWhoHadIt (maskrec): the held record goes on disk with
done's provider and model, done's second call counts for nothing,
Sum counts that provider, and List pages a late-written record in
key order. With the sort taken out it fails on the first page.
Run at this tree (base
|
||
|
|
fed0055da8 |
plugin: a plugin stuck on its vendor no longer holds up the plugins loaded or listed with it
shualaitianduai on Discord: a plugin whose sign-in kept failing (401)
held up the plugins behind it. host.js loaded the plugins one after
another and answered init only when all were in, so a plugin function
that never returned held every other plugin until init's two-minute
deadline failed the whole host. providers() listed the providers one
after another too, so one stuck models hook held the whole list past
refreshDeadline (30s), and every provider's list went stale.
Now loadPlugins loads every plugin side by side, each given
pluginLoadWait (20s) for its import and plugin function, and each
config hook as long; one still loading is told as not loaded ("the
plugin's load didn't finish in 20s") and init answers with the rest.
Hooks are kept in the list's order, as before. providers() lists every
provider side by side and gives each models hook pluginListWait (20s,
inside refreshDeadline): one that hasn't answered is listed as fallen
back with that as its listError, so magpie keeps the list it had, and
that answer isn't kept for requests (keepInfo). Documented in
docs/subsystems/provider-plugins.md.
Run at this head (base origin/main
|
||
|
|
a1e91e5002 |
davsync: S3's If-Match/If-None-Match go outside the signature, so a kept ETag no longer turns a working key into 403 (CyberCaius on Discord)
CyberCaius on Discord: S3 backup works, then every sync fails with
"the S3 server refused the access key ID or secret (HTTP 403
SignatureDoesNotMatch)", and edits to the S3 settings "won't save".
The keys work in other S3 clients, and switching to WebDAV and back
to S3 fixes it until the next time.
Cause: the SigV4 signer signs every header on the request, and
7ab91961d's conditional requests added If-None-Match (GET, the ETag
kept in sync-state.json) and If-Match (PUT). SigV4 needs only host
and x-amz-* signed. A server, or a proxy in front of it, that checks
the signature over a condition as it reads it back rather than as it
arrived refuses a signed one with SignatureDoesNotMatch. The first
sync has no ETag kept, so it passes; from the second on every sync is
conditional and refused. WebDAV and back changes stateKey, so the
state starts again with no ETag and one sync works. "Won't save" is
the same 403: /api/davsync/save writes the settings and then syncs,
and the form stays open with the sync's error.
Fix: sendTo signs every header except if-*, and sets the conditions
after signing. The docs page says so.
Test: TestS3ConditionsOutsideTheSignature, where the fake S3 rereads
an If-* header without its quotes before checking the signature. It
syncs three times, saves a second provider and syncs again, and
checks that the conditional GET and PUT reached the server.
On the old s3.go it fails with the reporter's text:
s3_test.go:612: sync 2: the S3 server refused the access key ID or
secret (HTTP 403 SignatureDoesNotMatch)
Run at this head (base
|
||
|
|
e5dd86965b |
pii: the masking model's requests take turns without holding the status, Stop or a restart (#3682)
After a restart, with Settings → Privacy's local model on, every request
queued for minutes on srv.mu in classify. That lock was held across
start() (up to 3m loading) and the model's answer (30s and more), and
Now(), Stop() and the idle timer took it too. The user saw a 504
"held this request for 2m0s without routing it to any provider".
Now:
- pf-serve's requests take turns through a one-slot channel (`turn`),
so writes on its one pipe never interleave. srv.mu only guards state.
Now() never waits: it reports Loading and how many are Waiting. Stop()
never waits either: it kills a pf-serve that is loading or answering,
and the request on it fails with errStopped (no retry). Fetch's
upgrade stops pf-serve only once its turn is free (stopWhenFree).
- A request waits for its turn under its own context (FindContext). The
gateway passes the request's context through a new gwmw.ContextTeller,
so a client that went away, or a request the gateway answered 504,
leaves the queue. A turn already begun still finishes and caches.
- What Find learned is kept on disk (found-<model sha>.bin, beside the
model): a text's sha256 and its spans' offsets and labels, never the
text. Written via temp-and-rename. A bad, cut-short or over-long file
is read as empty, and a cached span that doesn't fit its text is
asked again. A restart no longer asks about every history again.
- A request waiting for its turn reads the cache again when it gets it,
so requests queued with the same history ask the model once.
- The guarantee stays: a request the model can't mask is held back, never
sent masked by the rules alone. A wait that ends panics inside
gwmw.Safely, as a failed model did, and the request fails closed.
- The 504 for a request held while masking says it waited for the local
masking model, what the model was doing (loading, or masking another
request with N waiting), that what it read is kept, and that the model
can be turned off in Settings → Privacy (unroutedMsg).
Tests (each red on the fix broken by hand, in the sandbox HOME):
- TestStatusAndStopDontWaitForARequest / ...ForALoad: red with Now()
taking the turn (Now waited), and the suite hung with Stop() taking it.
- TestWaiterLeavesWhenItsContextEnds: red with the waiter ignoring ctx.
- TestQueuedRequestReadsWhatTheOneAheadLearned: red without the re-read.
- TestRestartReadsWhatWasFound: red with loadCache a no-op. It also
checks the file never holds the text.
- TestBadCacheFileIsReadAsEmpty: red with a cut-short file's entries kept.
- TestCachedSpanOutsideItsTextIsAskedAgain: red without the fits check.
- gateway TestHeldForTheMaskingModelSaysSo: red with the masker handed
context.Background() (the wait never let go), without noteMasking, and
with the old message. TestUnroutedMsgNamesTheModelOnlyWhenItIsOn: red
with the old message.
- TestMaskingOnAndOff's panicky fixture embeds masking.Masker, which now
has the Context methods. It panics on those too, and still refuses.
Run at this head (base origin/main
|
||
|
|
13f9c7fca1 |
claude bridge: a caller elsewhere is told its environment is where the tools run
vv_nil on X: a Mac Claude Code through a Linux gateway's Claude subscription gets Claude Code's own prompt from the gateway's run, which names Linux and a temp folder, beside the caller's, which names the Mac and its project. The model spent extra tool calls finding out whether its environment had changed. A run that can't work in the caller's folder (the folder isn't on this computer, or Claude Code is in WSL) now has envElsewhereNote after the caller's instructions: the environment they describe is where every tool runs, and goes before one given earlier. Every tool of a run is the caller's, so that is true. The note names no app or vendor. A run in the caller's own folder, a lean run and a caller naming no folder are told nothing more. clientWorkDir is split so clientNamedWorkDir gives the folder named, wherever it is. Run: go test ./internal/gateway -run 'Claude|Bridge|Subscription|Lean|Vendor|Prompt' (ok, 49s), go vet for linux and windows, gofmt -l. TestClaudeCallersWorkDirElsewhereIsNotUsed now checks the note in both runs for a folder not here, a relative one and a Windows path, and not for no folder; TestClaudeRunsInTheCallersWorkDir checks a run in the caller's folder isn't told it. With envElsewhere forced false by hand the first is red (0 of 2 runs). Not tried: a real Claude Code run from a Mac client through a Linux gateway, so how many tool calls it saves is not measured. |
||
|
|
c2c88e85e9 |
redact: a date in the last year or ahead is not a birthday
JackyCcao on X: under Mask personal data the birthday rule took the day
the agent ran on, 2026-10-24, for a birthday in 122 requests. dateOK now
takes a date after 生日/DOB/born for a birthday only when it is over a
year before today (dateClock, held in the test). A date in the last year
or ahead is a run date, a deadline or a log's; a baby's birthday in a
prompt is far rarer than those. Older dates are masked as before.
Run: go test ./internal/redact (also TZ=UTC and TZ=Pacific/Kiritimati),
go vet for darwin, linux and windows, gofmt -l. TestBirthdayNotRecent
holds today at 2026-10-24 (today, yesterday, a year less a day, ahead,
each format) and then reads the real clock; with the year check taken
out by hand it is red ("生日:2026-10-27" masked). The GUI's
redact-kinds test only toggles the category and is unchanged.
Docs: gateway-routing.md and masking.html (en, zh, ja).
Not tried: the reporter's own request text (the screenshot shows only
the masked date), so which words were before it is not known.
|
||
|
|
7499ebb5ef |
gateway: magpie goroutines answers ahead of the locks a stuck request holds
Two users on X (v0.1.1549 to v0.1.1557, Windows, Codex routing) see /api/hello answer while /v1/models, Providers and agent requests hang. `magpie goroutines` ( |
||
|
|
3b717d5e0d |
affinity: a Claude Code subagent's answer no longer moves its lead off its account's cache
Claude Code sends its session's id (x-claude-code-session-id) with every
request of the session, its subagents' too; only x-claude-code-agent-id
says a request is a subagent's. Affinity kept one stick per scope and
session, so a subagent on the lead's model wrote its own answer over the
lead's stick. The lead's next turn was then judged by the subagent's cache
("no-cache" for a small one, "cold" for a 5-minute write past five
minutes) or kept wherever the subagent had gone, and with two Claude
accounts it moved to the other one: a new Claude Code there was told the
whole conversation and Anthropic wrote it all to that account's cache
again, at the 1-hour write price (slkassinthehood on X: two Pro accounts'
5 hours spent in ten minutes, ~318k tokens a request).
stickKey keeps a subagent's stick apart, by its agent id. The lead's key
is the session's, as before: sticks on disk are found after the upgrade,
and Codex's leadFirst, which reads a lead's stick by its thread id, is
unchanged. strictKeep reads the same key.
Run, at this commit's tree (base
|
||
|
|
5214d5114f |
claude: a run on a new account's first turn keeps its tool results
On the first request on a newly seen Claude sign-in, claude auth status
has no email yet, so the account is named from its plan ("Claude Max").
The bridged run's Claude Code then writes the profile, the account is
named by its email, and the turn's tool results came under another owner:
"tool results account changed", the run let go, and a new one told the
whole conversation (~8k more cache writes). Seen in a real run as
"claude\x00Claude Max\x00own" -> "claude\x00<email>\x00own".
- provider: Account.Unnamed marks the placeholder name;
ClaudeOwnName gives the own sign-in's name once it has one.
- gateway: the run's owner is an atomic pointer (owned()); an own,
unnamed owner ends in "\x00unnamed". takeNamedOwner lets such a run go
on as the same provider's own sign-in, named; every other owner change
still lets the run go. A turn that ends without a tool call takes the
name before its keys are made (nameOwner), so the next turn finds the
idle run.
- docs/subsystems/claude-subscription-bridge.md says so.
Run:
- TestClaudeToolResultsKeepTheSelectedAccount gains "named since" (kept)
and "unnamed, another account" (let go);
TestClaudeRunTakesOnlyItsOwnSignInsName; TestClaudeIdleRunKeptUnder-
ItsOwnSignInsName (named since / still unnamed); provider asserts
Unnamed on the plan-named account and not on an email-named one.
Broken by hand: without takeNamedOwner in serveSubscription "named
since" goes red (a new run replies); renaming any own owner goes red
(a@ -> b@ taken); without nameOwner the idle case goes red; with
unnamed never set the provider test goes red.
- Real run: sandbox HOME, dev build of this tree on 127.0.0.1:3741, the
owner's Claude Max sign-in with .claude.json and logins.json removed
first (auth status: no email), a real Claude Code 2.1.310 client in a
sandbox config asked to write, wc and read pelican.html. One Claude
Code pid for the whole turn, the log says the run "goes on as" the
email, no "account changed" line. Before this change the same setup
logged the owner change and "tool results account changed".
- gofmt; go vet darwin, linux -tags nogui, windows for gateway and
provider; go test ./internal/gateway ok 392.7s; go test
./internal/provider ok 89.3s with -skip TestUnreadLoginsWriteErrors-
KeepCredentials, which crashes the package on main alone (#3632,
filememo synctest, not this change).
- Full suite at this tree (
|
||
|
|
680b505687 |
claude: a run works in the caller's own folder, not magpie's temp folder
The bridged Claude Code told its model "Primary working directory:
<tmp>/magpie-claude-work-501", against the folder the client's own prompt
names. Under a real Claude Code client the model wrote pelican.html into
magpie's temp folder, through the client's tools, which run in the
client's folder.
startRun now runs Claude Code in the folder the caller names
(clientWorkDir): the last one in the system prompt or a non-assistant
message, as Claude Code ("Primary working directory:"), Codex (<cwd>),
OpenCode ("Working directory:") and pi ("Current working directory:")
write it, when it is an absolute path to a folder here. Otherwise (a caller
elsewhere, a WSL Claude Code, no folder named) the shared folder as before.
The caller's project's sessions are never swept; a run's session is still
removed by its id. CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS=1 keeps the
repository's status out of the prompt (setting sources and auto memory
were off already). The text sent upstream is unchanged apart from the
folder Claude Code reports itself.
Run:
- TestClaudeRunsInTheCallersWorkDir (Claude Code, Codex, OpenCode, pi,
named twice) and TestClaudeCallersWorkDirElsewhereIsNotUsed (missing,
relative, Windows path, none): red on the old code (the runs used the
shared folder). Broken by hand: sweeping the caller's folder goes red
("were swept"); dropping the env var goes red ("repository's status").
- Real run: sandbox HOME, dev build of this tree serving 127.0.0.1:3741 on
the owner's Claude Max sign-in (keychain linked in, login copies deleted
after), a client Claude Code 2.1.310 with its own CLAUDE_CONFIG_DIR,
ANTHROPIC_BASE_URL at the sandbox, run in $SB/wm and asked to write
pelican.html: it landed in $SB/wm; nothing new in magpie-claude-work-501
(its only pelican.html is the capture's, from before).
- go test ./internal/gateway at the staged tree (checkout-index), gofmt,
go vet; the full suite run is recorded in the next commit, at the pushed
head.
Not tried: a Windows client (a Windows path falls back, by the test), a
Claude Code in WSL (falls back by code).
|
||
|
|
a60493ab60 |
gateway: Codex run by Claude Code's Codex plugin is counted as Codex, not Claude Code
wyztony on X: "claude通过/codex skill时,用量不会记录codex的记录".
OpenAI's Codex plugin for Claude Code (codex-plugin-cc 1.0.6,
/codex:rescue and /codex:review) runs `codex app-server` with clientInfo
named "Claude Code". Codex 0.162.1 then sends "originator: Claude Code"
and "User-Agent: Claude Code/0.162.1 (...) (Claude Code; 1.0.6)", so
agentOf read every such turn as Claude Code's ("claude") and the Usage
page showed none of them under Codex.
agentOf now takes a "Claude Code" name back to Codex when the request
carries Codex's own turn headers (x-codex-window-id or
x-codex-turn-metadata), which Claude Code itself (claude-cli/...) never
sends. An app running Codex as its own engine under its own name (Lody)
keeps its name, as TestFromCodex already holds. fromCodex is unchanged,
so nothing sent upstream changes. Every path keyed on agentOf
(Codex subagent pick, spawn_agent models, drawing route, Codex backend
records, titles, search, active sessions, callerOf) follows.
Run:
- TestCodexPluginForClaudeCodeIsCodex: red on the old code with the
check turned off by hand ("plugin task: recorded as \"Claude\", want
\"codex\""), green with it. Cases: the plugin's captured headers,
originator only, claude-cli, the name without Codex's turn headers,
Lody with them.
- Real use in a sandbox HOME: codex-cli 0.162.1 wired to a sandbox
`magpie serve` on a fake Responses upstream, driven by the plugin's own
codex-companion.mjs (db52e28). Before: task and review rows were
"agent":"claude". After: both "agent":"codex". Plain `codex exec` (a
skill-folder /codex skill) was already "codex" through the gateway and
read from its rollout when direct.
- gofmt; go vet darwin, linux, windows.
- Full suite (go test ./... -timeout 45m, one suite on the machine) was
started at this tree and was still running at push; per the owner's
ship-at-once rule, a red it finds goes in its own commit.
Not changed, outside magpie: with Codex not routed through magpie,
/codex:review runs an ephemeral thread and Codex writes no rollout, so
there is nothing on disk for magpie to read; /codex:rescue writes one
and was already counted as Codex. Past rows stay under Claude Code.
|
||
|
|
41b0445ccf |
provider: a local server's address is a field shown first, and address= on the command line (LM Studio on another computer)
mengxiangziyou on X: "供应商里的LM Studio只能用本地的,怎么用局域网里其他机器 上的LM Studio, baseUrl 不能改". Moving a local preset (Ollama, LM Studio, oMLX, MLX-Serve) to another host has worked since #1165, but the window put the Address in a "Server address" fold under the key, while the Endpoints row showed http://localhost:1234/v1 as plain text. Reproduced in a sandbox: Add > LM Studio shows the URL and nothing to change it with unless the small fold is found. - GUI: the Server address field is shown first, above the key, never folded, for a new provider and a saved one alike (its label and hint are the strings the fold used, so no new i18n keys). Saving still sends the URLs moved only when the address was changed. - CLI: `magpie provider add|set <id> address=<host:port>` moves every URL the provider has (chat, Anthropic, Responses, decision), each keeping its path; from the preset's when it was saved with none, and `address=` alone puts a local server back at its preset's. A provider of the user's own moves its own URLs. Vertex refuses it as it does url=. Before, Ollama on another computer needed url= and anthropic=. - TUI: unchanged (asked on adding, `w` after). - docs/subsystems/providers-accounts.md: Local servers row. Security: only upstream URLs move. The gateway's own loopback/origin guards are about inbound requests and don't read them; the one rule that looks at an upstream being on the LAN (Unredacted) stays the user's own switch. Run at this tree (origin/main |
||
|
|
5be7d05d28 |
agent: Desktop on magpie offers its own import of the signed-in sessions (lambdua on X)
lambdua on X: "claude Code桌面端支持么? 我桌面端切换账号,对话都能全都不见".
Nothing is lost. Desktop on magpie runs in 3p mode, whose userData is
Claude-3p, a folder apart from Claude/. Desktop 2.7032 keys Code and
Cowork sessions by account and org (claude-code-sessions/<acct>/<org>):
in 1p the claude.ai login's, in 3p the install id in ant-did and a fixed
org. So the sessions made signed in stay in Claude/ untouched and show
again when Desktop is switched back; claude.ai chats are on Anthropic's
servers. magpie's on/off never writes or removes a session (desktopOff
removes only what magpie made, and only when empty).
Desktop has its own importer (Settings -> Import: the signed-in userData,
other Claude* folders, ~/.claude/projects; copies under new ids, originals
left), but in 3p only when the profile's claudeAiImport.enabled is true
(3p-only policy, default off, since 1.28929.0). magpie's profile now gets
"claudeAiImport":{"enabled":true,"bannerBehavior":"detect"} once per
folder set (desktopSeedImport, stash mark claude-desktop.import): on the
switch on, and from Sync at magpie's start for a Desktop already on
magpie. A claudeAiImport already there is kept; one the user removes is
not written back (the mark is read, never unstashed).
Run (suite at origin/main
|
||
|
|
07936ca890 |
gateway: a turn held before routing shows on Routing and is answered 504 after 2m
heyusaku6 on X: Codex desktop thought for over ten minutes on a model served through magpie (a routing group's DeepSeek, then Qoder CN's MiniMax, then GPT-6.1 Sol), the Routing page showed none of them, and only restarting Codex and magpie ended it. Codex waits for a reply's headers with no limit of its own, and a request shows on the Routing page only once a route is begun for it, so whatever held these requests held them before routing, in silence. The root cause was not found. Every pre-route wait read (the classifier, image description, plugin GatewayBegin, JS middleware, provider.Hold, the body read, pluginrt.Refresh, the trace lock) has a bound or follows the request's context. So this makes the stall visible and bounded instead, and records where it was held: - counted watches an agent's turn (Chat, Responses, Messages, Gemini generateContent, Codex backend /responses) while no route is begun for it (unrouted.go). After 15s a route of provider "magpie" shows it on the Routing page as routing; it gives way to the request's own route when one begins (noteRoute, trace.drop). - After 2m with no route and nothing written, the client is answered 504 in its own protocol, whole (Content-Length, Connection: close) so it has the error even if the handler stays stuck. The request's context ends with errUnrouted, its route ends with the error, and the log gets every goroutine's stack (at most once in 10 minutes), which says what held it next time. - The handler writes through heldWriter, which drops its writes once magpie has answered for it. A request waiting on another request's identical image description for over 2m is now answered 504 too; the retry finds the description cached. Run in the worktree at origin/main |
||
|
|
5df62c5cda |
pii: pf-serve is pf-v2, which holds the model once on a GPU (#3590)
pf-v2 is 642d430ec's pf-serve (weights-once.patch): on Metal and Vulkan the GGUF is read straight into the device's buffer instead of also kept whole in a CPU copy. serveSHA pins pf-v2's five zips, each checked against the release's SHA256SUMS. A user who turned the model on before has pf-v1 on disk, in a folder named for its tag. pf-v1 now still counts as installed and is run (oldTags), and starting it fetches pf-v2 in the background (upgrade): once fetched, the running pf-v1 is ended so the next request starts pf-v2, and pf-v1's folder is deleted. One that can't be fetched leaves pf-v1 running and is tried on the next start. A fresh download fetches pf-v2 and deletes an old tag's folder. Run: - go test ./internal/pii ./internal/redact (ok), -run TestLoopGuard ./internal/gateway and -run Privacy ./internal/gui (ok, the doc and the settings route); go build; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/pii; gofmt -l clean. - TestOldServeRunsUntilUpgraded and TestUpgradeThatFailsKeepsTheOld are red with `go upgrade()` taken out of start (not upgraded / never tried) and with binDir looking at serveTag alone (the old pf-serve not taken for installed). - Real: a sandbox cache with the released pf-v1 darwin-arm64 and the real model, pii.Find through it: pf-v1 answered, pf-v2 was fetched from the real release, pf-v1's folder deleted, the next request started pf-v2 (ps shows its path), 1664 MB phys_footprint idle. - pf-v2's released darwin-arm64 probed alone: 1680 MB idle (pf-v1 4777 MB), spans identical to pf-v1's; load ~1 s both, alternated 3 times. Not tried: the upgrade on Windows, where the old folder can only be deleted after its pf-serve ends (upgrade ends it first; a folder left is deleted on a later start). |