d3db461bbb234cd1dfae034a17dd7dc1cbc707e3
4133
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d3db461bbb |
redact: the local model's secrets leave UUIDs, digests and paths, and client_metadata goes as written
The owner's masking records showed Codex's turn metadata with every id as
{{SECRET_…}}: installation_id, session_id, turn_id, window_id,
context_window_id, root_turn_id, and a skill's file path in the
instructions. The local model (OpenAI's Privacy Filter) labels a UUID a
secret: run on Codex's x-codex-turn-metadata it took each id, and on a
log it took a request id and "sha256 9b74…". The vendor and magpie's own
sessions match a turn by those ids, so masking them can break what
depends on them, and hides nothing worth hiding.
- modelTakes: a secret the model finds is not taken when it names a
thing (namesThing): a UUID, with window_id's ":0" after it too; a
digest with its algorithm's name; a file's path. A password or a key
it finds is still masked, and the rules' secrets (sk-…, password=…,
API_KEY: …) are unchanged.
- client_metadata is in defKeys: the client's ids, which no model
reads, go as written, as tools and stream_options do.
docs/subsystems/gateway-routing.md says both.
TestModelSecretIsNoID uses what the real model labelled "secret" on these
texts (pf-serve with the q8 model, run here): the UUIDs, the request id,
the sha256 digest, plus the reporter's path; the password and the
32-hex key beside them are still masked. Broken by hand: without
namesThing 5 values are masked, without client_metadata in defKeys a
user word in it is.
Run:
- At 3fff6c011 (on origin/main
|
||
|
|
1414705159 |
gui: the warm-up's read of the whole usage history runs under GOGC 25, so a cold start peaks ~130 MB lower
The warm-up's last big read, the Usage page's QueryPage over all time,
holds every row of the history unpacked at once (129 MB of rows, 271 MB
live at that moment for this history), and at Go's default GOGC the heap
grows to twice what is live before collecting: Activity Monitor's
footprint peaked at 555-587 MB there, on a magpie that rests at ~200 MB
once it is done. underTightGC lets the heap grow by a quarter during that
read and puts back what was set; a GOGC the user set lower, or off, is
kept. Holding fewer rows at once needs the page built in passes over
packed chunks (rowRef points into unpacked ones), which is the next step.
The whole warm-up under GOGC 25 gave the same peak for ~11 s more CPU, so
only that read is.
Measured with startheap-runs/fp.sh: cold start (calls and sessions caches
deleted) of a 6,437-file history, phys_footprint sampled every 2 s and
footprint's own phys_footprint_peak at the end, run until the caches stop
growing for 30 s; every run wrote the same 6,437 files / 70,069,451 bytes.
Machine at load ~85-140 from other sessions.
before (
|
||
|
|
1bd99194ea |
provider: Claude Code stays listed, signed out, when every saved account's sign-in is gone
LeeHom on Discord: two Claude Pro accounts vanished from Providers, and
signing one in again showed the other as "needs sign in again". While
Claude Code is signed out, the claude provider is built on
claudeStandIn's account. claudeStandIn skips an account whose sign-in
Claude Code let go of (claudeLoggedOut's claudeLogoutLapse) or that is
still Held. With every saved account like that, it returned "", no claude
provider was made, and the subscription and both accounts left the GUI,
the TUI and `magpie providers` at once.
claudeStandInAccount and Logins now ask claudeListed: the stand-in, else
the signed-out account seen last. A Held account is never listed this way,
because the sign-in Claude Code left on disk would then be served
(TestClaudeSignedOut still holds). The listed account's token still fails
with the lapse reason (claudeSavedDir), so nothing is served on it.
claudeStandIn itself is unchanged, since addLogin and logins_on rely on
it.
The app's row already said "{user} is signed out" when every login in use
had lapsed. Provider.SignedOut is that rule in Go. With it, `magpie
providers` says "○ <user> is signed out · sign in again" and the TUI says
"○ <user> is signed out", instead of a green "signed in". The CLI's key
column moved into keyColumn so it can be tested. The providers-accounts
doc row says this.
Tests:
- TestClaudeAllSignedOutStaysListed: signed in, a second account
logout-lapsed, then Claude Code signed out. It fails on the old code
("Claude Code left the Providers list with every account signed out:
false") and with SignedOut returning false (both broken by hand).
- TestProvidersSaySignedOut, in cli and tui: a signed-out account reads
as signed out and a signed-in one still reads as signed in.
Run: gofmt -l clean; go vet ./... (darwin), GOOS=linux go vet -tags
nogui ./..., GOOS=windows go vet ./...; go build for all three.
Then go test -timeout 45m ./... under a sandbox HOME at base
|
||
|
|
d771138c41 |
provider: WorkBuddy's mover min is 0.1.29, which sends a refused system prompt again as the user's instructions
Wing on Discord (10-21) got 400 11128 "Illegal API invocation from an unapproved channel" from WorkBuddy with an agent whose lines the plugin didn't reword. WorkBuddy checks only system and assistant messages, against lines it knows. Since 0.1.29 (magpie-community/plugins af360a5), a chat it refuses that way is sent once more with its system prompt moved into the first user message, inside <instructions> tags, and WorkBuddy's default system prompt in its place. The refusal still rests no account, as since |
||
|
|
c627652e9a |
settings: lightweight mode is off for a user who never chose
The owner, 10-21: "要默认关闭「轻量模式」,不然太卡了". With it on, the window is made again and its page loaded again on every opening, which is slow. |
||
|
|
1b9b97f8db |
gui: a provider's dialog grows out of its icon and name, as an add sheet tile's does
The owner, 10-21: the provider editor's opening was stiff ("太生硬"), and
the add sheet's, opening a vendor's tile, is the one to follow. Both run
through openModal's morph, but a tile is narrower than the dialog, so the
dialog starts shrunk to it (scale ~.4) and zooms out; a provider row is
wider than the dialog, so the scale stayed 1 and the dialog opened as a
full-size strip widening over the row, its text at full size from the
first frame.
A provider row is now measured as a tile: from its left edge to where
its name and host line's words end (rowOwnRect, the text nodes' extents;
a range over the block spans its whole width), the row's height. The
dialog grows out of that and folds back into it, as a tile's does.
Run on origin/main
|
||
|
|
3c38fe5c99 |
agent: Zoo Code (VS Code) through its autoImportSettingsPath (wani on Discord)
wani on Discord (#feedback) asked for Zoo Code (zoocode.dev), a fork of Roo Code for VS Code and JetBrains. Route: Zoo Code keeps its provider profiles in VS Code's SecretStorage, which magpie can't write. The one file it reads is the one its zoo-code.autoImportSettingsPath setting names. On every activation (src/utils/autoImportSettings.ts, Zoo Code 3.90.0) it imports that file as Settings → Import does (importSettingsFromPath). magpie writes <User>/globalStorage/zoocodeorganization.zoo-code/settings/magpie-import.json with one profile, "magpie": apiProvider openai on the gateway's /v1 Chat Completions, key magpie-zoo-code, the chosen model, and an openAiCustomModelInfo built from the catalog (contextWindow, else Zoo's own 128000 default; maxTokens only when an output limit is known). It points the setting at that file in the default settings.json and in each VS Code profile's. A value the user set themselves is stashed and restored by Disconnect. The file sits outside magpie's folder so that a sync keeps an address the user moved (kept.away skips magpie's own folder). Requests say "ZooCode/<version>", and usage names them zoo-code. Limits (also in docs/reference.md → Zoo Code): - Zoo reads the file only at start: the notice asks for Developer: Reload Window. - While connected, each start switches Zoo back to the magpie profile. - Disconnect stops the import but can't delete the imported profile from SecretStorage. The user switches away from it or deletes it in Zoo. - VS Code Stable only. JetBrains is not wired. Zoo Code for JetBrains runs the extension in its own extension host, which is handed an empty configuration on every start (RPCManager.startInitialize in Zoo-Code-JetBrains), so the setting never reaches it. Its secrets sit in ~/.zoo-code/secrets.json, an internal store with no lock and no documented format. Neither is a clean route. Tests (internal/agent/zoocode_test.go): - TestZooCode: connect, model switch, a stale key that Check reports and Sync fixes, and disconnect putting the user's own import path back byte for byte with the file removed. - TestZooCodeFresh and TestZooCodeProfiles: VS Code profiles, including one made after connecting. - TestZooCodeDetectAndUA: Roo alone is not detected; ZooCode/3.90.0 maps to zoo-code. Broken by hand (the restore disabled): TestZooCode and TestZooCodeProfiles went red. The generated file was checked with bun against Zoo's own zod schemas (providerSettingsWithIdSchema, isProviderName; zod 4.6.7 from its repo): valid, every field kept, current profile in apiConfigs. Run, set -o pipefail, GOMODCACHE pinned, sandbox HOME: - First full run, with this change on |
||
|
|
049040283e |
codex: a searched conversation under Codex's web.run isn't sent the hosted web_search beside it (Savin on Discord)
Savin (#help, magpie 0.1.1296, Codex 0.163.0-alpha.10.2, signed in with ChatGPT): the turn failed with the ChatGPT backend's "a single request can't contain both a client-declared function web.run and the hosted tool web_search". Who adds which: - web.run is Codex's own. codex-rs/ext/web-search (tool.rs) declares it as a function "run" in the "web" namespace, and spec_plan.rs's hosted_model_tool_specs leaves the hosted web_search out whenever web.run is registered: on a Responses Lite model (whose requests take no hosted tools at all), or with the standalone_web_search feature on. Codex never sends both itself. - The hosted web_search was magpie's. provider.DeclareSearch (#1270) adds the cached-only {"type":"web_search","external_web_access":false} to any ChatGPT-bound request whose input replays a web_search_call without declaring search. declaresSearch looked only for a web_search* type, so a conversation that had searched with the hosted tool and went on under web.run (a Lite model, a newer Codex, or magpie's own searcher's web_search_call items) got web_search added beside web.run, in the additional_tools item for Lite or in the tools. The backend then refused the turn. What changed: declaresSearch counts web.run as the conversation's search. It matches the namespace "web" holding a function "run", and a function named "web.run". DeclareSearch then leaves the body as Codex sent it. This covers both routes that call it: codexBody (a ChatGPT account in magpie) and codexUpstreamOn (Codex's own sign-in relayed). Nothing the client declared is dropped. web.run is the tool the backend serves this client (through /alpha/search), so magpie no longer adds the tool that conflicts with it. A namespace other than "web" with a "run" function still gets web_search declared. Not verified: whether the ChatGPT backend accepts a replayed web_search_call under web.run with no hosted tool. That is the request the official Codex client sends to it directly. It was not probed on a real account, and the test fake assumes it is accepted. Tests: - TestDeclareSearch: new cases cover web.run in Lite's additional_tools, web.run among the tools, the flat "web.run" function, and another namespace's run. - TestSearchedConversationUnderWebRun: protectedSearch now refuses a request that carries both tools, with Savin's error. The test covers Lite on Codex's sign-in (relayed byte for byte) and two turns on a ChatGPT account (Lite and tools). - On |
||
|
|
e68a0b1db5 |
sessions: a prompt's title reads only as far as it keeps, not through a regexp and runes of the whole prompt
title collapsed white space with regexp's \s+ over the whole prompt and
then made runes of all of it to cut at 160. A pasted file as the prompt
went through both whole: sessions.title was 0.45 GB of a cold start's
first 2 minutes (cxPrompt 334 MB, ccPrompt 112 MB). It now collapses and
counts in one pass and stops at 160 characters, then looks only for
whether anything but space follows. The result is the same: each run of
\t \n \f \r and space one space, Unicode space trimmed at both ends, a
byte not UTF-8 kept as it was in a short title and U+FFFD in a cut one.
The regexp `space` had no other user and is gone.
Run:
- TestTitleAsBefore (new): equal to the old code on the edge cases
(159/160/161 characters, \v and NBSP and U+0085 at the ends, invalid
bytes, CJK) and on 20,000 random strings of those runes.
- TestTitleOfALongPromptAllocatesItsTitle (new, a ~900 KB prompt): red
with title pointed back at the old code ("50 allocations"); green now,
at most 8 allocations and 4 KB.
- go test ./internal/sessions/ ok, and with -race ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ok.
|
||
|
|
4c0afc26d7 |
sessions: scan buffers and zstd decoders are kept on a small shelf across garbage collections, let go after 10 s unused
The line readers, long-line buffers and zstd decoders scans use were kept
only in sync.Pools, and a pool lets what it holds go at every second
collection. A cold start collects about once a second (155 GCs in its
first 2 minutes), so the pools were mostly empty when asked. A probe
build counted, in those 2 minutes: 611 new 1 MiB line readers, 205
long-line buffers taken from an empty pool (114 more from one too small,
833 MB in all) and 281 new zstd decoders (~3 MiB each).
A shelf keeps up to 4 of each (per line-reader size class; long lines up
to 4 MiB, longer ones still go to the pool), takes before the pool and
gives back before it, and lets everything go once nothing was taken or
given back for 10 s, so an idle magpie holds none of it. A full long-line
shelf keeps the larger buffer.
Run:
- TestLineReaderKeptAcrossCollections, TestLongLineKeptAcrossCollections
(new): with the shelves' takes removed both are red ("a 1 MiB line
reader was made again after three collections", "a 2 MiB long-line
buffer ..."); green now. TestShelfFullKeepsTheLarger,
TestShelfLetsGoWhenIdle (new, waits for the state, 10 s bar).
- go test ./internal/sessions/ ok; -race ok (the first try raced on a
test writing the idle time as a global under a live timer; it is a
field of the shelf now); -race -count=20 on the new tests ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ok.
- Cold start in a sandbox HOME (startheap-home, calls and sessions
caches removed), serve --web, run until the caches stop growing; both
wrote the same 6,437 files, 70,069,451 bytes. With this and the two
commits before (objectEnd, prefixHash), two runs each, alternating:
old: 12.57 / 11.92 GB allocated, 145 / 149 GCs, CPU 2:01 / 1:55,
settled at 213 / 192 s
new: 7.38 / 7.23 GB allocated, 85 / 87 GCs, CPU 1:52 / 1:50,
settled at 191 / 161 s
RSS at the end is unchanged (714-748 MB): the peak is the warm-up
listing holding every row, not these buffers.
|
||
|
|
002b4eb080 |
sessions: prefixHash reads into one pooled buffer instead of io.CopyN's
io.CopyN made a new buffer for every call, and for each of the 16
samples of a long file (64 KB a call). Every session and call log is
hashed this way on a cold start: io.copyBuffer via prefixHash was 0.78 GB
of 11.57 GB allocated in the first 2 minutes. It now reads into a pooled
64 KB array: ReadFull for a short prefix, ReadAt for each sample. A
sample short of its window is still unknown (""), as CopyN's error was.
The hash is byte-for-byte the same, so stored sample-v1 hashes still
match.
Run:
- TestPrefixHashUnchangedAndUnbuffered (new): equal to the old
CopyN code at 0, 1, 4095, 4096, 65535, 65536, 65537, 1 MiB and 3 MiB,
and "" past the end as before; with prefixHash pointed back at the old
code it is red, "hashing a long log allocated 65 KB"; green now (under
-race the pool drops some puts, 13 KB, so the bar is 24 KB).
- go test ./internal/sessions/ with -race ok; -race -count=5 on the new
test ok.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ok.
|
||
|
|
a0f3b33b1f |
sessions: a Claude reply's tool blocks and usage are decoded from their object, not by a decoder copying the rest of the line
ccTools and ccReply's usage each opened a json.Decoder over the rest of the line, and the decoder copies what it reads ahead into its own buffer. A long tool input was copied once per tool block and once for usage. In a cold-start heap profile (11.57 GB allocated in the first 2 minutes) this was the largest site: Decoder.refill, 1.6 GB, via ccReply/ccTools. objectEnd now finds the end of the object (brackets outside strings) and json.Unmarshal decodes only those bytes, which still checks them. Run: - TestClaudeReplyDecodesWithoutCopyingTheLine (new; a 1 MiB tool input plus a Skill tool through claudeLine): red on the old decoder path, "a 1024 KB reply allocated 4100 KB to read"; green now, under 256 KB. - TestObjectEnd (new): nesting, braces and escapes in strings, unterminated, a leading space, empty. - go test ./internal/sessions/ ok, and with -race ok (79s); -race -count=5 on the new tests ok. - gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ok. |
||
|
|
c79400556c |
agent: a Claude model on Bedrock runs to its own window in Claude Code, not 272K
划船不靠桨 on Discord (0.1.1306) asked why magpie sets CLAUDE_CODE_AUTO_COMPACT_WINDOW=272000 for a 1M model. writeCompact already skips the working window for Anthropic's Claude models and for routing groups made only of them (provider.ClaudeGroup). But the agent package's claudeModel only knew a name that starts with "claude", so a 1M Claude model listed under Amazon Bedrock's name (us.anthropic.claude-opus-…[1m]) was held to 272K, while a group of the same model ran to 1M. claudeModel now asks provider.ClaudeModel, which takes the vendor prefix off first. The reporter's own setup (a deepseek-v4-flash auto routing group of WorkBuddy, Qoder and a newapi relay) is not this bug. A probe in a sandbox HOME showed 272000 for group/auto-deepseek-v4-flash, its [1m] form and auto/deepseek-v4-flash, the group listed at its largest member's 1048576. That is settings.WorkingWindow, the default for any non-Claude model or mixed group over 272K ( |
||
|
|
e656888867 |
library: Library → Instructions gives Devin its global AGENTS.md (#3151, eqe365 on Discord)
eqe365 on Discord (#3151): Devin CLI reads AGENTS.md, but Library →
Instructions listed Devin as keeping no user-wide instructions file.
Devin's target had Skills and MCP and no Instructions.
Source: the docs Devin CLI 3000.11.92 ships with it,
share/devin/docs/extensibility/rules.mdx ("Rules & AGENTS.md" → Global
Rules). It reads global rules from ~/.config/devin/AGENTS.md
(%APPDATA%\devin\AGENTS.md on Windows) at the start of every session, and
the singular AGENT.md there too. Devin's folder (a.Dir) is already that
folder, so Instructions is AGENTS.md there, or AGENT.md when only that
one exists (firstThere). The GUI is data-driven and needs no change.
Test: TestDevinInstructions (internal/library/agent_skills_test.go)
checks:
- the target is AGENTS.md before the file exists;
- Save writes the shared block after the user's own text;
- with only AGENT.md present, that file is the target.
With targets.go reverted it fails: "Devin's instructions: "", want
.../.config/devin/AGENTS.md before the file is there".
Run with this change on origin/main
|
||
|
|
b855cfee9e |
redact: a file named like an address (…@2x.jpg) is not masked as an email (#3029)
vdxz on Pi with personal data masked: /Users/…/Pictures/261020_14-16-11@2x.jpg
went to the model as /Users/…/Pictures/{{EMAIL_…}}, and Pi could no longer
read the file. A Mac saves an image at twice its size with @2x before its
extension, which the EMAIL rule reads as user@2x.jpg.
realEmail leaves an address whose last label is a file extension no
top-level domain has (fileExt: jpg, png, gif, webp, svg, heic, pdf and
the like; py, md, sh, zip and mov are domains and stay out of it). The
local model's EMAIL spans pass the same check now (modelTakes), so it
can't mask the name the rule leaves. An address beside the file's name
is still masked.
TestFileNameIsNoEmail uses the reporter's path. Broken by hand: with
redact.go as on main the rule's half fails, with model.go as on main the
model's half fails.
Run at this head (on the #3143/#3144 commit, origin/main
|
||
|
|
88119d4f67 |
redact: Codex's tool server names, stream_options and snake_case words go as written (#3143, #3144)
Two reports from hibaliqya-yonma (v0.1.1306, Codex Desktop through
/backend-api/codex), each a 400 on every request until masking was
turned down:
- #3143: a user's word that is part of an MCP server's name went into a
Responses function_call's namespace as mcp__{{TERM_…}}. Codex checks a
namespace against ^[a-zA-Z0-9_-]+$, and the call is replayed every
turn. namespace is kept as name is, and so are the server's name in
its siblings: a Responses mcp_call's server_label, Anthropic's
mcp_tool_use server_name.
- #3144: the local model took stream_options.reasoning_summary_delivery,
"sequential_cutoff", for a name. stream_options is a request setting
now (defKeys, with reasoning and text), and the model's name is never
a snake_case word (snakeWord), wherever it is, so an enum or an
identifier in a tool's arguments or in code is not taken either.
The same word in the user's own message is still masked, and a name
beside it still is. docs/subsystems/gateway-routing.md says both.
Tests from the reporter's bodies: TestMaskJSONKeepsReasoningSummaryDelivery,
TestMaskJSONKeepsToolServerNames (namespace, server_label, server_name),
TestModelTakesNoSnakeWord. Broken by hand: with json.go and model.go as
on main, all three fail; with the change they pass.
Run at this head (origin/main
|
||
|
|
ba319a7587 |
gateway: the lone tool_choice none goes to the Grok plugin only (#3110)
|
||
|
|
19527ca8dd |
gateway: tools turned off with none declared reach a plugin as tool_choice none (#3110)
Cause: buildResponses wrote tool_choice only inside its tools block, so a
Chat "none", Anthropic {"type":"none"} or Gemini NONE with no tools was
dropped on the way to Responses. A provider plugin that adds a
server-side tool (Grok's x_search, plugins PR #263) couldn't tell
"tools off" from "no choice". The other builders (Chat, Anthropic,
Gemini, Code Assist) send no tool choice without tools, which is what
their vendors accept (OpenAI Chat refuses a lone tool_choice), so they
are unchanged.
Fix:
- buildResponses keeps a lone "none" (only "none"; "" and "auto"
still go unsaid).
- forwardTranslated strips it again for every non-plugin upstream, and
for a plugin on api.x.ai or Copilot (refusesLoneToolChoice, the #378
rule now shared with passthrough). A vendor never sees it.
- The grok plugin's body shaping (grokPluginBody) keeps a lone "none";
the built-in's grokBody still drops it. grok plugin 0.1.18
(magpie-community/plugins aee6b9d, on npm) drops any lone tool_choice
itself before Grok, so the mover's min goes 0.1.17 -> 0.1.18.
Run at this commit (worktree on
|
||
|
|
efd1b697e4 |
sessions: a cached file's calls are read into a slice made for them
loadCalls appended each decoded patch to a nil slice, so every cached
file's calls grew through append's steps. In a warm start's 30s
alloc_space profile (sandbox HOME, ~380k calls) that append was 509 MB,
the largest single site. Each frame now grows the slice once by its
patch count (slices.Grow), which a frame of new calls fills exactly.
TestLoadedCallsAreSizedOnce: 3000 cached calls came back in a slice of
3246 on the old code (red, run with the change stashed); 3006 now, the
allocator's size class. It also reads back a second appended frame.
go test -tags nogui ./internal/sessions/ ./internal/usage/: ok.
At 8b48dc5d6 (this commit and the two beside it, on
|
||
|
|
80d32fd609 |
usage: a Claude Code call skips the desktop-root path arithmetic
sessionResolver.desktopIdentity ran filepath.Rel and strings.Split
against every desktop root for every claude call, though only a file
under a root's local-agent-mode-sessions can name a desktop identity.
In a warm start's heap profile (sandbox HOME, ~380k calls) that was
178 MB from Rel and 98 MB from Split in the first 30s, about a fifth
of what gui.warmUp's first Requests read allocated. A path without the
folder name can't produce a Rel whose first segment is that name, so
the guard is exact.
TestDesktopIdentityOfCLICallAllocatesNothing: 6 allocs per call on the
old code (red, run with the change stashed), 0 now.
go test -tags nogui ./internal/usage/: ok, TestDesktopSessionAccountMetadata
unchanged.
At 8b48dc5d6 (this commit and the two beside it, on
|
||
|
|
16d20c0b3d |
usage: a packed block keeps its compressed bytes, not S2's worst-case buffer
s2.Encode makes its output MaxEncodedLen(len(src)) long, more than the
rows' own bytes, and pack kept the archive as a slice of it
(slices.Clip trims the capacity, not the allocation). Every cached
session block and every gateway log block (log_index.go) so held its
whole uncompressed size plus S2's slack, while Bytes counted only the
compressed length, so the cache budget undercounted it too. pack now
encodes into pooled scratch (the rows' bytes and S2's output) and
copies the archive out at its own length.
Measured on a sandbox HOME (a clone of a 23 GB Codex + Claude Code
history, ~380k calls), magpie serve --web, warm call caches, heap
profile from /v1/magpie/heap:
- at rest (2 min): s2.Encode's archives 17.2 MB -> 9.2 MB (slices.Clone)
- at the warm-up's peak (6 s): archives 45.3 MB -> 30.6 MB
- liveHeap at 30 s 96.1 MB -> 90.3 MB, footprint 213 MB -> 203 MB
TestPackedArchiveHoldsOnlyItsBytes packs 100 blocks of 2000 rows and
measures what stays reachable after a collection. On the old pack it
fails: "100 packed blocks hold 16035 KB for 3887 KB of archives"
(3 of 3 runs); with the change it passes, and blocks packed through
the same scratch read back their own rows.
At 8b48dc5d6 (this commit and the two beside it, on
|
||
|
|
a00900d642 |
provider: ZCode's mover installs plugin 0.1.20, a team's plan beside the account's own (plugins #285)
An account with a GLM Coding Plan of its own and a seat on a team's could
only reach its own plan through the plugin. zcode 0.1.20 (plugins
d87dd8f, on npm) adds "ZCode: a team's GLM Coding Plan", which signs in
to the team seat as an account of its own, "<email> (team)". Raising the
min lets keepMovedCurrent bring every moved user to it.
Run at the parent
|
||
|
|
5fadf6aceb |
gui: Settings' gateway row is titled an address, and says only its port is typed here (Chicring on Discord)
Chicring: Settings showed "网关端口" (gateway port), but the row showed
MAGPIE_ADDR's host:port.
What the field takes, from the code: renderPort posts to
/api/settings/port, and setPort (internal/gui/port.go) accepts only a port
from 1024 to 65535 (settings.CheckPort). The gateway listens on that port,
on 127.0.0.1, or on 0.0.0.0 while shared on the LAN. When MAGPIE_ADDR is
set, it is the whole host:port and comes first. The row then shows its
value and is disabled. So the row is the gateway's address, but only its
port is typed here; it isn't a second way to write MAGPIE_ADDR.
The row is renamed in every language: Gateway address / 网关地址 / 閘道位址 /
ゲートウェイのアドレス / Adresse des Zugangspunkts. The new hint says "Only
the port is set here, 1024 to 65535; MAGPIE_ADDR=host:port sets the whole
address instead. Agents magpie connected move with it. Now {url}". With
MAGPIE_ADDR set, the hint says "MAGPIE_ADDR={addr} sets the gateway's whole
address, host:port: unset it to set the port here". The CLI help (cpu,
healthcheck, heap, quota, statusline) and setPort's comment named
"Settings' Gateway port". They now say "the port in Settings' Gateway
address".
Test: gateway-port.test.cjs pins the new name and hints in en and zh. With
MAGPIE_ADDR set, it now also checks that the field shows 127.0.0.1:3426
and that the row's name and aria-label say the address. gui-zh-tw, gui-ja,
gui-de and i18n-keys cover the other languages. Broken by hand: on the old
app.js it is red, "not ok 1 - en expected: 'Gateway address' actual:
'Gateway port'", and zh red against '网关地址'.
What was run. The whole suites ran at dcf7eeae3, which was these two commits
on origin/main
|
||
|
|
4bea86d0a3 |
gui: a provider that asks its own decision models (OpenRouter, Ollama …) shows System One's endpoint, not Jev's (Outvi V on Discord)
Outvi V added OpenRouter and its editor named the decision address field "Jev 端点". The hint gave Cloudflare's …/accounts/<account id>/ai/run as the example. Cause: the title was "System One endpoint" only for a decide-only preset whose name had no "jev". Every preset that also serves conversations got "Jev endpoint". The hint gave Cloudflare's address to any preset without a workspace ID. The placeholder was already the provider's own Decide URL. Fix: only Jev's own decide-only presets (TypeSafe Jev, Jev · Vercel AI Gateway, Cloudflare Workers AI · Jev) keep the Jev title and the Cloudflare hint. Every other provider shows "System One endpoint" with a hint of its own: "The address its decision models are asked at, POST …/systemone under it". Every preset that reaches this path is covered: openrouter, opencode-zen, ollama-cloud, bailian-token-plan, ollama, omlx and mlx-serve, plus the decide-only bailian-decision and qwen-decision, which already had the right title. The new string is in zh, zh-TW, ja and de. Test: decide-endpoint-label.test.cjs opens each of the ten presets with a Decide URL from the add sheet, and edits a saved OpenRouter, in en, zh, zh-TW, ja and de. The three Jev presets must show Jev's title and the Cloudflare hint. The rest must show System One's title and their own hint, with no Cloudflare or Jev in it. The saved OpenRouter's placeholder must be https://openrouter.ai/api/v1. Broken by hand: - The old app.js line: red in every language, for example "expected: 'System One endpoint' actual: 'Jev endpoint'" and zh "'System One 端点' vs 'Jev 端点'". - Cloudflare's hint forced onto every provider: red, "expected: 'The address its decision models are asked at …' actual: \"The address Jev is asked at; …Cloudflare's…\"". At this commit alone, decide-endpoint-label, system-one, remote-magpie, i18n-keys, gui-zh-tw, gui-ja and gui-de passed in both engines: "# tests 42 # pass 42 # fail 0". What was run. The whole suites ran at dcf7eeae3, which was these two commits on origin/main |
||
|
|
5c557c793c |
usage: the allowance cards come in the Providers page's order (Zhenbao TONG on Discord)
Reported: Zhenbao TONG moved a provider on the Providers page, and the
tray panel's Allowances tab kept the old order.
Changed: provider.InProviderOrder(qs) (internal/provider/quotas.go) sorts
a copy of the quota cards, stably, by the provider's place in All().
Providers it doesn't know go last. Used by /api/quotas's two routes
(internal/gui/usage.go) and the TUI (internal/tui/pages.go). The app.js
comment says the order now comes from the server.
Test: TestQuotaCardsInProviderOrder (quotas_order_test.go). Broken by
hand:
- InProviderOrder as the identity: "as added: [a/a1 remote:x/r c/c1
b/pro a/a2 c/$1]".
- sorting without the clone: "Quotas' list was sorted in place".
Not covered: the /api/quotas wiring has no test beyond the function's
unit test.
Run, go1.26.8 darwin/arm64, sandbox HOME, private GOCACHE:
At this stack on origin/main
|
||
|
|
0084291888 |
gui: Hide accounts hides them in the whole window, Providers and its editor too (Zhenbao TONG on Discord)
Reported: Zhenbao TONG turned on Hide accounts to take a screenshot. The Providers page and its editor still showed account emails, because the mask covered only the Routing and Usage views. Changed (internal/gui/assets/app.js): the mask's root is body in every mode, so every page and sheet of the window is masked. It is turned on from #rtMask and #usageMask as before, and the panel has none. mask(root) takes a root, and the MutationObserver masks again only the roots that changed, not the whole body. Test: internal/gui/tests/window-mask.test.cjs, with Hide accounts on, on Providers, its editor and the other pages. 5 languages x widths 1000 and 420 x chromium and webkit. Broken by hand (the old app.js mask): chromium en and zh at 1000 red, waitForFunction timed out on `#view-providers .pii`. Run, go1.26.8 darwin/arm64, sandbox HOME, private GOCACHE: At this stack on origin/main |
||
|
|
0eb5cbe81a |
routing: the live view and Usage's Requested name a found group auto/<model>, not group/auto-<model> (未寒 on Discord)
Reported: 未寒 picked auto/claude-opus-5-5, and the Routing live view and
Usage's Requested column named it group/auto-claude-opus-5-5, an internal
id that agents never see.
Changed:
- internal/gateway/trace.go: GroupRef and SubGroup carry Ref
(Group.Ref(), the id agents pick the group by).
- internal/gui/trace.go: publicRoute rewrites a route's Model,
For.Model, Subagent.Asked/To and the group's and subs' Ref through
provider.PublicRef (memoised per answer). It copies the pointers
before writing, so the gateway's trace is left as it was.
- internal/gui/context.go: the Context page's model too.
- internal/usageapi/usageapi.go: the ledger page's Requested.
- routing/client.js: useName falls back to a sub's ref.
Test: TestRoutesNameFoundGroupsByTheirPublicID
(internal/gui/trace_publicref_test.go). Broken by hand, each one red:
- publicRoute made a no-op: red on model, group, subagent, For, Subs
and route.
- usageapi mapping removed: `the ledger's Requested:
["group/auto-claude-opus-5-5" "group/mine"]`.
- contextRoutes mapping removed: `the Context page's model:
"group/auto-claude-opus-5-5:high"`.
- Ref dropped from gateway/trace.go alone stays green, as expected:
publicRoute fills an empty Ref.
Not covered: the ledger's text search (usage.Filter.Query) still matches
the stored group/auto-… form, not the shown auto/… (package usage can't
import provider). client.js's ref fallback has no GUI test of its own.
Run, go1.26.8 darwin/arm64, sandbox HOME, private GOCACHE:
At this stack on origin/main
|
||
|
|
55b5eca055 |
gateway: a provider that searches for some of its models is offered as a searcher, with those models only (01huadalang on Discord)
Reported: 01huadalang has a Command Code plan, but web search offered no
searcher for it, although some of its models (gpt-6-luna) search on
their own. The picker counted a provider only when every model searched,
or when its host was a self-searching API.
Changed (internal/gateway/search.go, search_remote.go):
- partSearcher(p) holds for a provider with no Account and no
self-searching API host whose preset is in searchModels or whose base
host is in searchModelsHosts. modelSearchesAny(p, model) says whether
that model is one that searches.
- searchRank ranks such a provider 4 when one of its available models
searches. searcherReady keeps it. searchableModel offers only the
models that search, never e.g. claude-opus-5-5.
- docs/subsystems/gateway-routing.md says so.
Test: TestCommandCodeSearchesForOtherModels (search_models_test.go).
Broken by hand, each one red, then green when put back:
- search.go and search_remote.go reverted: "the picker offers [],
want Command Code's gpt-6-luna alone".
- partSearcher dropped from searcherReady's keep, and the
searchableModel case dropped: `Command Code searches with
"claude-opus-5-5"`.
Run, go1.26.8 darwin/arm64, sandbox HOME, private GOCACHE:
At this stack on origin/main
|
||
|
|
df6bd3efec |
routing: out of sight the page stops asking for the trace, and a waiting trace read gathers a burst of changes into one answer
The Routing page (and the tray panel's Routing tab) read /api/gateway/trace in a loop for as long as magpie ran, in sight or not. The read was already a long-poll, but each change woke it: a request's way is told in a burst (begun, a try sent, answered, its usage), so under traffic every open page was answered 4-8 times a second, hidden pages included, for nothing they drew. Server (internal/gateway/trace.go): once a change wakes a waiting Trace, it gathers for traceGather (250ms) before answering, so a burst is one answer; a read with nothing new still blocks until a change or the 25s wait. Every answer now also lists the ids of all the routes the trace keeps (TraceState.IDs, "ids"), changed or not; OwnerTrace passes them through from another magpie serving the gateway. Client (plugins/routing/client.js): after its first answer, poll() asks only while the page or the panel's Routing tab is in sight (document not hidden, and the view shown or the panel's tab picked). Out of sight it parks; start() (visibilitychange, focus, the view's hidden attribute) and panelRoutingShown resume it. The first answer after a resume is a catch-up: what came meanwhile is listed, and only the requests still under way fly (stage and panel), as #302 asks. A route last heard of as under way that is missing from "ids" (it ended and was trimmed while the page was away) is dropped, so it can't show as live forever. An answer with no "ids" (an older magpie) leaves the routes as before. Measured: - Hidden page, 2s with a request every 80ms (routing-hidden-stage, panel-routing-hidden): before, the trace was read 24-25 times in 2s by each of the main window (another page picked, or the window hidden) and the hidden tray panel; after, 0 times. - A burst of 4 changes 20ms apart (TestTraceWaitHearsABurstOnce): before, read in 4 answers; after, 1. Tests: - TestTraceWaitHearsABurstOnce (gateway, new): a waiting read answers a burst once, with all of it and the route's id in IDs. Broken by hand: no gather -> "a burst of 4 changes was read in 4 answers, want 1"; no ids -> "ids [], want [<id>]". - routing-hidden-stage and panel-routing-hidden now assert the page reads the trace at most once out of sight (was: at least 20), and shows the newest request once back. The mock is a clock-driven gateway (every change since `after`, at once). With the old client.js all 12 went red: "the trace was read 24/25 times out of sight", "... while hidden". - routing-busy and routing-flood's mocks answered one route per read; the gateway answers every change since `after`, so they do too now. routing-purpose-state sent one update while another page was shown and required a new read to start out there; that send no longer waits for one. Run at this commit's tree (go1.26.8 darwin/arm64, sandbox HOME): gofmt -l .: nothing GOOS=linux go vet -tags nogui ./...: ok GOOS=windows go vet -tags nogui ./...: ok go test -tags nogui ./internal/gateway ./internal/gui: ok go test -tags nogui -race -timeout 45m ./internal/gateway ./internal/gui: ok (gateway 1598s, gui 348s) set -o pipefail; go test -tags nogui -timeout 45m ./...: ok, every package (66 ok, 20 with no test files) GUI, playwright 1.62.0, chromium and webkit, every routing*.test.cjs and panel-routing*.test.cjs (97 files, 1204 tests, concurrency 4): 1203 pass, 1 red: routing-rule-remove "chromium en 390: a rule's ... is there to remove it" (routing-rule-remove.test.cjs:158, "1 !== 0", the rule count read right after a keyboard Enter). Its trace mock never answers a wait, so its polling is the same before and after this change; alone it passed 3 runs of 3 (60/60). The whole GUI suite (822 files) was still running when this was written. |
||
|
|
6a050eebe6 |
provider: the catalog a request built is kept for the next requests while nothing it is built from moved
heldEntries held the providers' catalog for heldFor (1s) after a request,
so an agent's requests a few seconds apart each built it again from
every provider's models and accounts (buildEntries via Resolve and
Served, ~725 MB of allocations in 300s of a gateway in use), and with it
the switched-off providers' models (heldOffEntries, entriesOf again), the
groups and the groups' entries (heldFrom). They are now kept across
requests (kept, hold.go) while provider.StampNow stays the same and for
at most keptFor (a minute), as the gateway's stamped does for model
lists: a provider, account or setting saved, a plugin's change, the
providers', settings' or catalog's file written by another process, or
another environment moves the stamp and the next request builds them
again. What moves no stamp (an account another program signed in to, a
model retired by its date) is seen within the minute. Only a request
that holds the catalog uses what is kept; a look outside one builds its
own, as before.
Measured with a gateway probe (5 providers, ~9.9KB settings.json; at the
parent commit -> this one), 40 requests 1.1s apart:
messages 675 KB/request, allProviders 1.02/request -> 285 KB, 0.00
chat 614 KB, 1.00 -> 245 KB, 0.00
responses 676 KB, 1.00 -> 297 KB, 0.00
and 200 back to back: messages 259 -> 234 KB, chat 211 -> 184 KB,
responses 253 -> 251 KB.
TestCatalogKeptAcrossRequests (heldFor 0, so each request is past the
last one's hold) counts builds. Broken by hand, it went red each way:
- kept never used: "20 requests with nothing changed built the catalog
20 times, want 0"
- groups not kept (heldFrom): "20 requests with nothing changed built
the groups 20 times, want 0"
- the stamp not checked: "relay2/m3 not in the served catalog after
the save"
- no time bound: "past keptFor: built 0 times in 2 requests, want one
each at least"
Run at this commit's tree (go1.26.8 darwin/arm64, sandbox HOME):
gofmt -l .: nothing
GOOS=linux go vet -tags nogui ./...: ok
GOOS=windows go vet -tags nogui ./...: ok
go test -tags nogui -race -timeout 45m ./internal/provider
./internal/gateway: gateway ok (2072s); provider red once on
TestSignInDoneOnceTheAccountIsBack, a data race between the test's
write of catalog.Changed (signin_removed_test.go:112) and a plugin
refresh goroutine left running by an earlier test reading it in
catalog.Touched (live.go:202, from plugin.tell). Neither side is
code this commit touches. It reproduces on origin/main
|
||
|
|
9329c89c95 |
settings: an unchanged settings.json is parsed once, and a gateway request reads the shared settings
settings.parse ran json.Unmarshal on every Load, and one gateway request
called Load six or seven times (Provider.Efforts, ImageOverride,
masking.options, withWires, redactionWanted, recordConversation,
namesMember). parse now keeps the last parsed value keyed by the file's
bytes, and hands Load a deep clone (internal/settings/clone.go), so every
caller still owns what it gets. settings.Shared() returns one read-only
value for the request path, its slices held at len==cap so an append
reallocates instead of reaching the shared array; the seven callers above
moved to it after checking none writes what it reads. A file that doesn't
parse is not memoized: it falls back as before (lastgood), and Shared
then returns that result, never the last good parse, so a failed read
can't keep a looser list. LoadChecked callers (allow list, image fetch
guard, disabled) stay on Load.
Measured with a 200-request probe through the gateway (5 providers, a
~9.9KB settings.json), before (origin/main
|
||
|
|
a8ecf4020e |
provider: a check-in file that can't be read or parsed stops the check-in
readCheckins, the reader every daily check-in shares (WorkBuddy, Trae CN,
MiniMax Code, Qoder and the plugins' own), took a file it couldn't read
or parse as empty. The next check-in then asked the vendor again for
every account and wrote its answers over the file: an account could be
checked in twice in one day, and the entries it couldn't read were lost.
readCheckins now returns an error for a file that is there but can't be
read, or doesn't parse into entries (cut short, zeroed, empty, `[]`,
`null`). A file not there is still empty. On the error:
- checkiner.checkinNow asks nothing and writes nothing. Each account it
would look at is `failed` with the reason (the path and why), so the
loop tries again after 30 minutes and a press (GUI, TUI, `magpie
accounts checkin`) says why. The error is logged once while it stays
the same.
- The readers that only show results (WithCheckins, *Checkins(),
PluginCheckins) go through shownCheckins, which gives what last read
from the file in this process, so a card keeps its last good data.
- adoptLegacyPluginCheckins' own strict copy of the read now uses
readCheckins too.
Docs: providers-accounts.md no longer lists check-in marks among the
caches written over; provider-plugins.md says the plugin file's case.
Test: TestCheckinUnreadableFileLeftAlone writes a cut-short, zeroed,
empty, `[]` and `null` workbuddy-checkin.json, runs the loop and a press
against a fake WorkBuddy, and checks no status or claim request went out,
the file is byte for byte unchanged, and the result says the path; a
folder in place of plugin-checkin.json does the same through a plugin
checkiner. TestCheckinMissingFileIsEmpty and
TestCheckinUnreadableKeepsLastGood cover the other two sides.
Broken by hand (checkinNow taking the error as an empty map again): the
test went red, every case claimed (Asked true), and green once restored.
Run in a worktree at origin/main
|
||
|
|
62a1df8010 |
provider: a plugin's daily check-in reaches every sign-in, also two that share a display name (plugins#254)
AutoClaw's plugin can hold several sign-ins under one default display name,
which AutoClaw doesn't let the user change. plugin_checkin.go keyed each
account's check-in on "<provider>|<AccountID>", the display name, so
checkinNow's per-key dedupe asked only the first sign-in of each name, by
the loop and by Check in now alike; the others stayed 今日未签 for good,
and Settings showed one row, and one Off switch, per name.
Each sign-in is now keyed on the key plugin-auth.json keeps it under
(pluginCheckinKey: "autoclaw|autoclaw", "autoclaw|autoclaw#x1y2z3").
Two sign-ins never share it; a refresh writes the same key, and signing
in to an account already signed in goes back to its key (host.js
settle). The display name is shown only. Cards, Settings rows,
CheckinOff and Check in now all read the same key, so app.js is
unchanged. An account without an AccountID already had this key.
Upgrade (adoptLegacyPluginCheckins, run when the plugin's accounts are
listed): an entry kept as "<provider>|<display name>" goes
- in plugin-checkin.json, to the first sign-in in use of that name (the
one the old key's check-in asked) and only to it, and the old entry
is dropped: it isn't asked again today, and its namesakes, never asked,
are;
- in settings.CheckinOff, to every sign-in of that name: the user turned
that name off and none of its sign-ins was checked in since, so the
upgrade switches none on (settings.EditCheckinOff edits that field
alone from what the file holds).
A plugin-checkin.json that can't be read or parsed is left as it is and
carried over once it reads; writes go through writePrivate
(temp-and-rename). Known gap: a sign-in made the same day after another
was signed out can take the freed key and that day's result.
The fake plugin's check-in now records a signed-in account as
name@fake/uid so two of one name tell apart in the presses.
Tests:
- TestPluginCheckinTellsSignInsOfOneNameApart: four sign-ins, A/u1, A/u2,
B/u3, B/u4 (the reporter's case). All four pressed once, none again
that day, four entries kept, four Settings rows, every card marked;
with A/u2 off, Check in now the next day presses the other three.
- TestPluginCheckinCarriesOverDisplayNameEntries: a plugin-checkin.json
with fakeco|A@fake and fakeco|B@fake claimed today plus another
plugin's entry, and CheckinOff ["workbuddy|123", "fakeco|B@fake"].
A's check-in goes to its first sign-in only, the old entries go, the
other plugin's stays, both B sign-ins are off and workbuddy|123 is
kept; the loop then presses only A's namesake, and a second look
presses nothing.
- TestPluginCheckinCarriesNothingOverAnUnreadableFile.
Broken by hand, each red:
1. key back on the display name: TellsApart pressed only A@fake/u1 and
B@fake/u3; CarriesOver kept the old entries.
2. adoption not called: CarriesOver ("A's check-in went to ... ok false").
3. record to every heir: CarriesOver ("carried to both") and Unreadable.
4. Off to the first heir only: CarriesOver (CheckinOff lacks one B).
5. old entry kept: CarriesOver and Unreadable.
6. parse error ignored: Unreadable.
Run at
|
||
|
|
fb371eaa1b |
provider: the Qoder mover's min is 0.2.25, where the international sign-in sends no redirect_uri (plugins #276)
qoder 0.2.25 (plugins f5548bd5) stops sending redirect_uri=qoder-app:// on
the international sign-in. Only Qoder's desktop app handles that link, so on
a Mac with Qoder.app installed the end of sign-in was handed to the app
instead of finishing in the browser tab. The plugin polls for the token and
needs no redirect, as Qoder's own CLI and the CN site already do. Raising
the min lets keepMovedCurrent bring every moved user onto it.
npm view --prefer-online --registry https://registry.npmjs.org
@magpie-community/opencode-qoder-auth@0.2.25 version -> 0.2.25.
Run at
|
||
|
|
0f044e9447 |
plugins: a GITHUB_TOKEN GitHub refuses is dropped for anonymous requests, not shown as an error (till on Discord)
till's Plugins page said "无法连接 GitHub: GitHub refused GITHUB_TOKEN (no GitHub token is set in Settings → Network and sharing)". ghtoken.Token falls back to the environment's GITHUB_TOKEN / GH_TOKEN, and a stale one there made every GitHub read fail, though GitHub serves the same reads without a token. ghtoken.Do now sends a GitHub API request with the token. When the token came from the environment and GitHub answers 401, it remembers that token as refused for the rest of the process (Token() skips it, so GH_TOKEN is still tried after a refused GITHUB_TOKEN, and Settings no longer shows it) and asks once more without Authorization, returning that answer. A token set in Settings is never dropped: its 401 is still Refused()'s error. An anonymous rate limit after the drop is said by LimitedBy as before. Every caller goes through it: plugin fetchJSONFrom (tagged-repo search, git plugin checks, githubHead) and getURLFrom (Bun), and library apiGet, skills fetch, skilltree fetchBlob and latestRTK via doGitHub. internal/davsync/github.go stays strict: its token is the one the user gave sync to write a private repo, outside ghtoken, and an anonymous retry can't write there, so it would only hide why sync failed. Tests (httptest only): ghtoken_test covers an env token refused then asked again without, not sent again (and GH_TOKEN tried next), a Settings token refused stays an error, an env token refused then an anonymous rate limit is reported, and another host untouched. plugin TestTaggedReposStaleEnvTokenDropped is till's case: TaggedRepos with GITHUB_TOKEN=stale-till lists 7 repos, no error. github_token_test and library TestGitHubRateLimitSaid now expect the env token dropped and the Settings token still refused. Broken by hand, each red: (a) no anonymous retry: every new env test, the plugin and library tests red, and TestTaggedReposStaleEnvTokenDropped shows till's exact error; (b) no memory of the refusal: NotSentAgain, the plugin and library tests red; (c) a Settings token also retried: SettingsTokenRefusedStaysAnError, the plugin and library tests red. Run on the commit before the rebase (base |
||
|
|
f21dd99f5a |
privacy: every masking is recorded, and Settings › Privacy shows it
What was masked is now kept, so the user can see it. Settings › Privacy opens on a summary card: how many values were kept from vendors over 1, 7 or 30 days, by kind, by finder (rules, your words, the local model, known values) and by where they went, with a day strip. The page is grouped into What to mask, How it's found (rules and the local model are layers, not a toggle: the model adds names and addresses rules can't see) and Sharing. A records view lists each masked request: its kinds, finders, placeholders and, while magpie runs, the line around each value. Gateway › Recent calls and the Routing log carry a masked-N badge that opens the record. Originals never go to disk. internal/maskrec writes day files under ~/.config/magpie/masking (0600, 30 days, 100MB at most) holding kinds, finders, placeholders, a first character or key prefix and a length. The lines around values are kept in memory for the last 400 records only, and /api/masking/value answers only while the masker remembers a placeholder. Nothing is written under MAGPIE_TEST_SANDBOX. A masker says what it masked through gwmw.Teller (JSONHits, TextHits, Value); a plugin masker that doesn't is counted only, so older redact plugins keep working. Every route that masks notes it: chat, Responses, Codex backend and search, embeddings, images, video, transcription, decide and the search MCP query. Masking still fails closed: a masker that panics on any path refuses the request (TestMaskingOnAndOff's fake now panics on JSONHits and TextHits too, since the gateway asks a Teller through those). app.js grows to 1,314,432 bytes, so its budget rises to 1,335,000 and the core's to 1,528,800 (+1.5%): Settings is the core's own page. Run at this head (rebased on origin/main |
||
|
|
a3ebed202e |
gateway: Codex's compaction back on its own model goes without another vendor's reasoning text, so the turn after DeepSeek isn't refused over input[n].content (jue on Discord)
jue (Codex app, GPT-6.1 Sol) set a DeepSeek model for Codex on the Agents page, went back to GPT, and the next turn sometimes failed with "[ArrayParam] [input[8].content] [array_above_max_length] Invalid 'input[8].content': array too long. Expected an array with maximum length 0, but got an array with length 1 instead." Cause: when the model changes (or the thread passes its auto-compact limit) Codex compacts the thread before the turn, and shows a failed compaction as the turn's error. Codex's /responses/compact for one of its own models went to the ChatGPT backend (Codex's sign-in, its sk- key, or a magpie Codex account through compactOn) with its input as sent. A reasoning item from DeepSeek's Responses API carries its reasoning_text in content, which OpenAI accepts only empty, so the whole compaction was refused. A turn on the same routes already went through codexInput(body, false), which drops such items; the compaction didn't. "Sometimes" is when Codex compacts first. Fix: codexBackend's own-model branch runs codexInput(body, false) on /responses/compact too, before any of the three routes. OpenAI's own sealed reasoning (encrypted_content, no text) stays; a summary magpie made goes as its text, as from a turn. DeepSeek still gets its reasoning text (withReasoningText). Siblings read: the translated Responses path sends back only sealed reasoning (sealedReasoning); passthrough strips reasoning text for openai.com, Azure and Codex accounts and retries on the refusal elsewhere (#1411). Not covered: a full restore that drops openai_base_url leaves magpie off Codex's path. Codex's base_instructions and prompts are untouched. Test: TestForeignReasoningNeverReachesOpenAI sends the reported thread (input[8] a DeepSeek reasoning item with one reasoning_text, input[3] OpenAI's sealed reasoning) on seven routes: turn and compaction on Codex's sign-in, its API key and a magpie account, and /v1/responses with codex/gpt-6.1-sol. The fake OpenAI refuses a reasoning item with text with the reported 400 byte for byte. On the old code the three compaction routes are red with that 400 and the four turns green; with the fix all seven are green. Broken by hand a second way (codexInput(body, true) on the compact branch): the same three red. Run at |
||
|
|
c922225f13 |
provider: TestPluginPicksComeBackWithTheirList waits for the full list to be taken, not a fixed 200ms (#3051)
After sending the full list, the test waited 200ms for "not asked again" and then read the picks. Under load KeepPluginsListed hadn't taken the list yet, so the picks still read [pool-a pool-b], set aside [qoder/claude-x kiro/claude-y]: red in the v0.1.1303 full suite and at load ~400 before. It now polls Find until the picks are back (10s bar), failing if the loop asks again meanwhile, then checks for 100ms that it isn't asked again soon. Waiting for the state is ggbdpq's idea on #3051. Run: a 300ms sleep injected into the fake relist before it caches the answer: the old test red 3 of 3 with the same message (plugin_delisted_test.go:130), the new one green (2.74s). Without it: go test -race -count=20 -run TestPluginPicksComeBackWithTheirList ok; gofmt -l clean. |
||
|
|
5daea73c6e |
gateway: whether a model is served is answered from catalog names kept while the catalog stays the same
unserved() built provider.Catalog() on every request to see whether the
asked id is a catalog name. In a 10-minute profile of a sandbox instance
(fake upstream, ~1,000 gateway requests plus the GUI's polls) that was
2.26GB of 9.8GB allocated. The id and model names are now kept in a
stamped set (provider.StampNow, at most a minute), so a saved provider is
seen at once.
Measured, gateway-only load for 300s on the same sandbox data (fixed
build also carries 0afeebd01's pooled zstd body decoders):
before: 3.9GB allocated for 434 requests (unserved 1.22GB, Catalog
1.26GB, zstd 863MB), numGC +52
after: 2.96GB for 443 requests (unserved 25MB, Catalog 57MB, zstd
body decode gone from the top), numGC +29
TestUnservedKeptWhileCatalogStays (a provider of 1,000 models) counts
two answers already given against one catalog build in the same run,
since the package's other tests leave background work allocating beside
it (an absolute bar of 2000 read 2733 in the full suite, 682 alone):
67985 allocations against a build of 33262 before (fails, needs under a
third), 1486 after; a provider saved afterwards is served.
Run: gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui
./internal/gateway/; go test -race -run
'Unserved|Desktop|StandIn|Science|ClaudeTier|Zstd' ./internal/gateway/ ok.
Full suite (go test -tags nogui -timeout 45m ./..., sandbox HOME, on
this commit's first test): 62 packages ok; gateway and agent hit the
45m timeout under machine load (no hung test: TestCachePartialUpdateMatrix
and TestSyncKeepsAnAddressOnAnotherMachine were at 0s), provider red in
TestPluginPicksComeBackWithTheirList (#3051, passes alone 3/3), and this
test's absolute bar read 2733, fixed above. Rerun at this head:
gateway ok 885s, agent ok 899s, provider ok 226s.
|
||
|
|
f962cfa75b |
agent: whether a model value is magpie's is kept while the catalog stays the same
isMagpie asked provider.Resolve, which outside a request holding the catalog built every provider's entries again. The window's drift poll (/api/drift, every 15s while the window is up) asks it for every detected agent's field values, and each poll built the catalog again: in the procmem profile (a sandbox `magpie web` on main with 17 providers, the GUI cycling its pages for 10 minutes) Drift's isMagpie was 235 MB of the 1.37 GB allocated, ~6 MB a poll, with nothing changed. Now isMagpie's answers are kept by value while provider.StampNow stays the same, for a minute at most and 4096 values at most, as the gateway's stamped lists are: a provider, account or setting saved, a plugin's change, a catalog sync, another process rewriting providers.json or settings.json, or a changed environment moves the stamp and they are asked again. A value with no "/" is no catalog reference and isn't asked at all, as before. Tested with TestIsMagpieKeptWhileCatalogStays: two answers already given take 1924 allocations before (fails), under 200 after; a provider saved since is magpie's at once. go test -tags nogui ./internal/agent passes (849s); -race on IsMagpie|Drift|GoProgram|GoMagic|Goose passes; gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent pass. The full suite is run before the push of this batch. |
||
|
|
077c472053 |
gateway: a zstd request body is decoded by a decoder kept between requests
Codex sends every turn's body zstd. decodedBody made a new zstd decoder
for each one, with the package's default concurrency: it started a
stream goroutine and allocated its window and block buffers on every
request. In the procmem profile (a sandbox `magpie web` on main, three
Codex-style sessions sending zstd /v1/responses every 2-4s plus Chat and
Messages traffic, ~1,000 requests in 10 minutes) that was 1.74 GB of the
9.8 GB allocated, all under zstd.(*Decoder).startStreamDecoder.
Now a sync.Pool keeps decoders (concurrency 1, the same 512 MB memory
bound), as sessions' packed reads do since
|
||
|
|
7e340036a7 |
agent: a goose on PATH is told apart from a Go program without parsing its symbol table
Telling Block's goose from pressly's Go migration tool (goProgram) called
buildinfo.ReadFile, which parses a binary's whole symbol and string tables
before it looks for Go's build info. For Block's goose, a 260 MB Rust
program, that was ~210 MB allocated on the first state the window asked
for (the procmem heap profile: 200 MB under debug/buildinfo, gooseIn,
goProgram, in the first 10 minutes of GUI use). It is kept per file
afterwards, but the heap had grown by it and kept the room.
Now the file is read through a 256 KB buffer for Go's build-info magic
("\xff Go buildinf:") first. A file without it is no Go program; one with
it is still asked of buildinfo, so the answer is the same as before.
Measured on the real ~/.local/bin/goose (260 MB, Rust): 214468 KB
allocated and 460 ms before, 256 KB and 244 ms after.
Tested with TestGoProgramReadsNoSymbolTable (a 40 MB Mach-O whose
LC_SYMTAB names 32 MB of strings: 186 MB allocated before, fails; under
4 MB after) and TestHasGoMagicAcrossReads (the magic across a buffer
boundary, zeros, this Go test binary). TestGooseDetectSkipsGoGoose (a
real Go goose is skipped, a script goose detected) passes. gofmt -l
clean; GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
pass. The full suite is run before the push of this batch.
|
||
|
|
592899467b |
gateway: Gemini's reasoning streams as it comes on the last candidate, so Codex isn't left with nothing for the whole of its thinking (LuckymanJC on Discord)
LuckymanJC and kkgg: through magpie the first turn of a Codex session on a Gemini model was very slow or seemed stalled. Measured with fake upstreams through the gateway (Codex Responses -> Chat DeepSeek, Gemini; OpenCode Chat; Anthropic passthrough), first content came within 1-50ms on every path but one: a Gemini model's reasoning was held even on the last candidate (`|| last && modelFamily(c.model) != ""` left Gemini out), so Codex got nothing at all, not even response.created, until the text began, while Claude's and GPT's has gone as it comes there since iTianbao's report. It was held there for #667, a reply that only reasoned being asked again. That re-ask happens in place in streamTranslated, keeping the reasoning the agent has, so it doesn't need the hold. But with the try passing, emptyRetries counted it as past the request's own re-asks and asked only streamRetries (2) times, and TestGeminiEmptyRepliesAskedAgain (three empty replies running) went red. A held try that went through on its reasoning alone (holdWriter.thoughtThrough) is now asked once more in place (streamRetries+1); a never-answering model still makes at most 4 calls (the test's bound is 6). Tests: TestThinkingStreamsWithNoOneElse gets "gemini" (Gemini upstream) and "chat gemini" cases, to Claude Code and Codex. With the old line restored they go red ("thinking held: first thought only 1.75us before the text"). With emptyRetries' new branch broken by hand (streamRetries+0), TestGeminiEmptyRepliesAskedAgain goes red with "an empty reply"; green with both. Run: go test -run 'TestGeminiEmpty|TestThinkingStreams|TestThinkingHeld|TestUncountedEmpty|TestReasoningLoop' ./internal/gateway: ok. Break check repeated at push: the old `|| last && modelFamily(c.model) != ""` turns TestThinkingStreamsWithNoOneElse/{gemini,chat_gemini}/v1/{messages,responses} red ("thinking held: first thought only 1.458µs before the text"). Full suite (go1.26.8 darwin-arm64, rebased on |
||
|
|
5206177704 |
agent: a 1M model Desktop lists by its [1m] id is told by its 1M, not a 272K GPT's beside it (dumplings on Discord)
dumplings (magpie 0.1.1295, Settings > 长对话 "完整窗口"): the provider
model showed 1M and its 1M variant was picked in Claude Desktop, but
Desktop's Code tab still showed 272K. With Desktop on magpie, claudePlan
tells Claude Code the largest window of every model it can run there
(CLAUDE_CODE_MAX_CONTEXT_TOKENS) and holds the smaller ones to their own
with modelSettings.<id>.autoCompactWindow. A model handed by a "[1m]" id
counted toward that largest only when it was Claude Code's main model,
so a 1M model Desktop lists by its 1M id (DesktopLongest) beside a 272K
GPT left 272K the value told, and with it alone nothing at all.
Now every [1m] model counts by its window (1M when unknown), and the GPT
beside it gets its own 272K entry. The `main` field it needed is gone.
Tests: TestClaudeDesktopContextWindow1M (rewritten: glm listed by its 1M
id alone tells 1M; beside a 272K GPT, 1M told and GPT held to 272000),
TestClaudePlan's [1m]-beside-272K case and its 500K->1M expectations.
Broken by hand (`case m.long && false:`): both go red
(TestClaudePlan "magpie's default: 500000", TestClaudeDesktopContextWindow1M
"glm listed by its 1M id alone: \"\""); green with the fix.
Run: go test -run 'TestClaudePlan|TestClaudeDesktop|TestClaudeContextWindow|TestBudget' ./internal/agent: ok.
Break check repeated at push: `case m.long && false:` turns
TestClaudePlan ("magpie's default: 500000") and
TestClaudeDesktopContextWindow1M ("glm listed by its 1M id alone:
\"\"") red.
Full suite (go1.26.8 darwin-arm64, rebased on
|
||
|
|
2201b66285 |
provider: the Qoder mover's min is 0.2.24, where Qoder's 400 "Error in upstream response" is a 502 (SlouchyQuill507 on Discord)
SlouchyQuill507 (Discord, qoder-cn) found Qoder's failures of the model's own vendor, "Error in upstream response", reaching magpie as a 400: the client's fault, never asked again or of another account. That runs in the plugin for moved users, so the fix is @magpie-community/opencode-qoder-auth 0.2.24 (plugins 4af310c, "qoder 0.2.24"), which answers it as a 502 and keeps genuine 400s (Qoder's request codes, other invalid requests) as 400. Raising the mover's min makes keepMovedCurrent update every moved user to it. tooLongUnsaid still tells an overflow that fails this way apart by its size, at 502 as at 400. npm view @magpie-community/opencode-qoder-auth@0.2.24 version --prefer-online: 0.2.24. The same plugins push has cline 0.1.10 (the plugin's side of |
||
|
|
4ae6c06dc3 |
docs: gateway-routing says how magpie's Codex compaction is made portable
The magpie1: item, the message codexInputAs sends for it, and sessions.PortCodexRollouts: what it changes, the writer-lock protocol, when it runs, what was tried (Codex 0.162.1 resume against an upstream that refuses magpie1: as OpenAI does) and what wasn't (a Codex in WSL). |
||
|
|
19901812e7 |
gateway: a ported Codex rollout reads the same through magpie as magpie's compaction item did
TestPortedCompactionReadsTheSame: codexInputAs sends the same input for magpie's item and for the message sessions.PortCodexRollouts writes in its place, for a magpie model (native or not) and for Codex's own. Run: go test ./internal/gateway -run TestPortedCompactionReadsTheSame. |
||
|
|
4896fc3ba1 |
codex: a thread magpie compacted goes on after magpie is quit or disconnected (LukeMa on X)
When magpie answers Codex's compaction itself (a magpie model, Codex's
own models through magpie's accounts, a CC Switch table), the item it
returns carries encrypted_content "magpie1:"+base64(summary). Codex keeps
it in the rollout (a response_item, and the compacted checkpoint's
replacement_history) and replays it with every later turn. Sent to the
ChatGPT backend directly, it is refused: "The encrypted content for item
cmp_magpie_1 could not be verified ... invalid_encrypted_content"
(probed with a real request on gpt-5.6-luna; the same summary as a user
message was answered).
Codex's remote compaction v2 keeps exactly one Compaction item, so magpie
can't answer with a plain message instead. sessions.PortCodexRollouts
writes each of magpie's items in a rollout as the message it stands for
(codexsummary.Message: Codex's summary prefix, a newline and the summary,
as a user message), which is what Codex's own local compaction stores and
what the gateway already sends in its place, so it reads the same through
magpie and goes on without it.
- Only magpie's compaction items change; other lines keep their bytes,
the file its line count, mode and time. An unreadable one is left out
of a list with its replacement_history_metadata entry, as Codex's own
ghost-snapshot strip does.
- Published as Codex publishes a compressed rollout: temp file and
rename, under thread-writer-locks/.coordination.lock and only with the
thread's lock free. A thread a Codex has open is left for a later pass.
A Codex home without thread-writer-locks is left alone.
- .jsonl.zst rollouts are read and written packed.
- Passes: 2 minutes after the GUI or magpie serve starts and every 10
minutes; on Codex Disconnect (3s); as the GUI quits (3s). The first
pass reads rollouts written since 2026-09-24; later ones only what
changed since the last whole pass, plus what was left held
(codex-portable.json in magpie's folder).
Run at this series' head (on origin/main
|
||
|
|
694674cf0d |
codexsummary: one owner for magpie's Codex compaction item and the message it stands for
The "magpie1:" mark, Codex's summary prefix and the reading of a magpie compaction as Codex's own local-compaction summary message move from the gateway into internal/codexsummary, so the rollout rewrite that comes next (internal/sessions, which the gateway imports) reads it the same way. The gateway's behaviour is unchanged. Run: go build ./internal/...; go vet ./internal/gateway ./internal/codexsummary; go test ./internal/codexsummary; go test ./internal/gateway -run 'Compact|CodexInput|Rewrite|Native|CallItem|Protection' (ok, 57s). |
||
|
|
4bb93b3255 |
gui tests: routing-wb-restricted waits for the posted lift instead of a fixed 300ms (#2658)
The test pressed Try now, paused 300ms and then read what its fake /api/gateway/unrest had received. On a busy machine the POST reached the fake after the pause and the list was still empty. It now waits up to 5s for the lift to arrive and then checks it. Red before: with a 600ms delay injected into the fake, the old test is 2 of 2 red (chromium en, 1100 and 420), the new one 2 of 2 green. Run (macOS, Playwright 1.62.0, chromium and webkit, every language and width the file runs): 20 of 20 green alone, and green in the --test-concurrency=6 run of the 37 reach/wheelTo files (590 of 590). |