2ff85f8a2bc33f87aa1fdfefce580433afff76e3
1202
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d4f1d6480c |
plugin: a program a plugin starts with no folder runs in plugin-work, not beside magpie's settings
jiakun_zhao on X asked whose page_<hash>.html, magpie_home.html,
magpie_install.sh and magpie_*.md files they had found after using the
chat page plugin (Magiczerowxy/magpie-chat). That plugin starts the
user's MCP servers from the plugin host with node:child_process spawn
and no cwd, and runs their tools for a model. The host runs in magpie's
config folder (~/.config/magpie), so every file such a tool saved by a
relative name went beside settings.json and providers.json, and a tool
told to write "providers.json" would have written over magpie's.
host.js's spawn wrapper (which already hands on the proxy and keeps
programs off the host's stdio) now starts a program that names no
folder of its own in <config>/plugin-work, created on first use, with
PWD to match outside Windows. A folder the plugin gives is kept.
Not the cause of files in the user's home folder: magpie's host never
runs in ~, and no magpie code names a file page_<hash>.html or calls a
user's MCP tool itself. Files in ~ come from a process whose folder was
~: the chat's server started by hand (node serve.mjs) from ~, or
another agent run there. Filed on magpie-chat for the plugin to give
its MCP servers a workspace of its own and tell the model where it is.
Run (mote, macOS):
- TestPluginProgramsRunInTheirOwnFolder (new; testdata/clicwd checks
child_process spawn, spawn with env, execSync and Bun.spawn, plus an
own cwd kept): ok. Red with origin/main's host.js put back by hand
(plugin-work not made; programs ran in the config folder).
- go test ./internal/plugin ./internal/agentplug ./internal/pluginrt
-count=1: ok (plugin 261s).
- go test ./internal/gateway -run Plugin -count=1 at
|
||
|
|
ca499953e7 |
gui: a plugin page with a host part starts the host when it opens
guesssssssswhat on X: the Magiczerowxy/magpie-chat page ("对话") sits
on its loading text and never opens. The page says hello and then
navigates its frame to http://127.0.0.1:3477, a server the plugin's
index.mjs starts inside the Bun host. The host was started only by a
call: at launch while providers are first read, and after a Restart
(a plugin installed, updated or set, a Bun update) or a crash only once
something asked a plugin again. With the host down, WebKit (the macOS
window's WKWebView, WebKitGTK) leaves a frame whose navigation is
refused on its old document with no error, and the hello had already
cleared the 10s broken timer, so the page waits forever. Chromium shows
chrome-error instead.
Now serving the entry HTML of a page or panel whose plugin is not
page-only starts the host if none is up (plugin.Warm), waiting at most
7s, then serves the page. Page-only plugins, and the page's other files
and the bridge, don't touch the host.
Reproduced on mote (sandbox HOME, magpie web on a free port, plugin
0.1.16 from GitHub): with its 3477 listener killed, old main's page
stays on "正在连接到本地对话服务…" in Playwright WebKit (chrome-error
in Chromium); the fixed build restarts the host on open and the chat UI
loads in both engines. In the real macOS app (wails://) the frame
reaches 127.0.0.1 (seen by a logging server). TestPluginPageStartsItsHost
is red with the pageHost call removed by hand.
Run at this head (
|
||
|
|
012c584cc1 |
usage: clear a model's usage, or all of it, from the Usage page
CrazyMouse_TT on X asked for a way to clear usage, all of it or one model's, to measure a local model fresh after deploying it. The Usage page's Models list has a "…" on each row (and a right-click menu) with "Clear usage…", and "Clear all usage…" sits under the lists below the "Counted from…" note. Each asks first, in a confirmation that says what is deleted, that it can't be undone, and that key spending limits and allowances still count the calls. A clear is a mark in settings (usageCleared: provider, model, unix ms), read at read time; usage.jsonl is never rewritten. The Overview hides calls up to the mark in summarizeFrom; the Requests page, heatmap and ledger/CSV hide them in Filter.keepsRow, their one choke point, and the request index's meta carries the marks so its cache is dropped. Key budgets, window holds and Codex reads go through usage.Visit and the raw log, so a clear never resets a key's spending limit or a quota. A later clear of the same model or of everything takes the place of an earlier one. The marks ride the settings part of a sync (sync-backup.md) and a save of the Settings page keeps them (api.go's keep list; the guard test TestSettingsSaveKeepsWhatItDoesNotSend caught it missing). gateway-sessions.md and sync-backup.md say so. Run on mote (mote-run) at this tree, rebased on origin/main |
||
|
|
4cc331bab4 |
gateway: a Chat relay's text-part contents go as a string (Atria on Discord)
tim072844 on Discord: a custom provider on OpenAI compatible (Atria,
Shanghai AI Lab's Intern discovery API, model Atria-Dawn) answered
DeepSeek Harness with 238 validation errors saying `input` must be a
string. That "input" is pydantic's wording for the value it rejected,
not a Responses field: DeepSeek Harness (pi-ai's openai-completions)
sends every user message's content as a list of text parts, the gateway
relays a Chat client's body as it came, and that server's Chat schema
takes content as a string alone.
passthrough's Chat case now runs textPartsAsString: a content list made
only of {"type":"text","text":...} parts goes as their text joined by a
newline (as vLLM renders such a list). A list with an image, a file, a
thinking part, cache_control or any other key stays as it is. Every
other byte of the body stays as sent, and a body with no such list
comes back byte for byte. This covers every Chat-protocol upstream, not
Atria alone; buildChat's translated requests already sent strings.
TestChatRelayLeavesOutEmptyAssistant's "blank parts" case now expects
the joined user text as a string, since the parts are flattened before
silentAssistantsOut joins the two user turns.
Run (on mote, worktree at this commit's tree):
- go test -run 'TestChatRelayTextPartsAsString|TestTextPartsAsStringOnlyPlainText|TestChatRelayLeavesOutEmptyAssistant' ./internal/gateway: ok
- go test -tags nogui -count=1 -timeout 45m ./internal/gateway: ok (553.6s); again after rebasing on
|
||
|
|
c2aad3db02 |
redact: a wallet address goes as written, and an IP as a documentation address the agent can use
0x0_air on X (10-28): with masking on, the agent stopped and asked again.
Their EVM address (0x89dfBD9b…, public) went as a secret placeholder and
the vendor's model told them to rotate it in case it was a private key;
the server IP they typed went as {{IP_…}} and the model refused to ssh
to it and asked for the real host.
- model.go: the local model's SECRET/ACCOUNT span on 0x and 40 hex
digits (evmRe) is left as written; no rule matched it, the model's
label did (the 0x prefix and mixed case got past hexRe). A 64-hex
private key is masked still, and so is a 40-hex value called a key
(secretCued).
- shape.go: an IP the IP rule masks goes as an address from the
documentation ranges (192.0.2/198.51.100/203.0.113 .101-.254, IPv6
2001:db8::/32), stable for the value, never shared by two values
(falls back to {{IP_…}} past 462 IPv4 ones), and put back only as a
whole address in replies and streamed tool calls (restoreAddr).
Preview shows the same stand-in.
- docs: gateway-routing.md, and masking.html in en/zh/ja.
Run:
- Real models through the local gateway, the screenshot's ssh prompt
with the placeholder vs a documentation address: with
{{IP_k3v9x2mq}}, deepseek-v4-pro, glm-5.3, kimi-k3 and
claude-sonnet-5-5 mostly searched ~/.ssh or asked for the real IP;
with 203.0.113.147 or 192.0.2.183 all 20 runs over 5 models ran ssh
at once.
- New tests (internal/redact/standin_ip_test.go): the screenshot's
message, the tool call restored whole and streamed cut at every byte,
boundary cases, IPv6, 472 addresses never sharing, the screenshot's
address under labels secret and account_number with every category
on, and a 64-hex key still masked. gateway TestRedactedKinds now
wants a documentation address upstream.
- Broken by hand: without the evmRe check TestEVMAddressGoesAsWritten
is red for every text and label; without restoreAddr the boundary
cases are red; without the IP stand-in all three IP tests and
gateway TestRedactedKinds are red.
- On mote at this head (rebased on
|
||
|
|
6a074fc132 |
pii: the default's local model reads what a request adds first, a backlog 4 KB a request, on 4 cores at most
shensmart and xinvxueyuan on Discord (10-28): with the local model on by
default, a long history kept the CPU high; the model off, 5-15%.
What was heavy (measured, TestLiveHistoryCost below): not re-reading.
A text read once is kept by hash (cache, on disk too), and a warm turn
costs what the rules alone do. The heavy case is a history the model
hasn't read (a resumed session, or one from before the model was on),
on the CPU path (Linux, Windows, Docker). Each request's 2 s wait was
spent reading that history oldest first on every core (threads =
GOMAXPROCS-1, windows at once = GOMAXPROCS), the newest turn last, and
the 12 KB chunk in flight was finished past the wait. A 32-core Linux
box spent 33-60 CPU seconds a request, 13 cores busy for as long as
requests came, and the backlog was still unread after 30 requests.
Nothing ran on after the last request (1 ms CPU in the 20 s after).
Now:
- guard.Cores: AstrLink Guard reads on half of GOMAXPROCS, 4 at most.
- backend.missing reads a request's unread texts newest first (the last
text, a long one's last piece, first).
- AstrLink Guard's chunk is 4 KB (backend.chunk), not 12 KB, so what a
request leaves the model finishing past its wait is about a second.
- pii.Bounded (masking's default, not a model the user turned on):
what a request went without reading is remembered by hash
(backend.sent); a request after it reads what it adds first, and that
backlog backlogCap (4 KB) at most, nothing found for the rest (the
rules mask it, as past the 2 s wait). The answer past the wait with
what was read is 874b86653's (pii.Partial), unchanged.
- A model the user turned on (strict) still reads everything, within
874b86653's strictWait.
- Not done: OS priority (nice) for the model's threads; the core cap
is the bound.
Measured, TestLiveHistoryCost (internal/masking, gated on
MAGPIE_GUARD_FILES, no network): a 2,041,658-byte Codex Responses
body (2,032,267 bytes at the rebased tree), 200 turns (repo files as tool output, doc paragraphs as answers,
Chinese names and an email every 10 turns), 30 requests 3 s apart, a
turn more each, model never having read it, then 20 s idle.
WSL2 Ubuntu 24.04 on xiaomi-gpu (32 cores, CPU path):
before: 33-60 CPU-s a request (44.0, 38.3, 50.4, 42.8, 54.3 ...),
session 23m16.8s CPU over 1m48s (1293% of a core),
wall median 2.759s, max 3.07s; 20 s after: 1 ms
after: 6.3-9.2 CPU-s a request, session 4m1.5s over 1m30s (268%),
wall median 2.389s, max 2.438s; 20 s after: 1 ms
warm turn after a full read: 876ms wall / 5.284s CPU before; after
the rebase the "full read" is strict and stops at 874b86653's
15 s, so that line is not a warm turn (2.41s / 7.9s); before
the rebase, at a full read, 1.28s / 3.04s (4 cores, not 31)
rules alone: 394 / 384 ms CPU
mote (M5 Pro, CoreML):
before: requests 1-3 2.2 CPU-s each, then ~0.45; session 18.7s CPU
over 1m30s (21%); warm 396ms / 380ms
after: request 1 2.12 CPU-s, then 0.44-0.62; session 17.2s CPU
(19%); wall median 562ms; warm 476ms / 465ms
On the CPU path a turn adds about 15 KB here, more than 4 cores read
in 2 s, so each request still spends its wait (now on 4 cores, newest
text first) and the backlog isn't reached until turns get shorter;
on CoreML the backlog is gone after the first request.
Tests, each red with its part of the change undone by hand:
- TestNewestTextReadFirst (pii): red on the old code as it stands
("read first: a a a ..."); red again with the last piece not first.
- TestBoundedReadsTheBacklogALittleARequest: backlog cap removed, the
second request read 75169 bytes.
- TestGuardReadsShortChunks: red with guard's chunk unset (12288).
- TestReadsOnFewCores (guard): Cores at 32 and 1 procs.
- TestDefaultModelIsBounded (masking): red with the default's ctx not
Bounded ("on by default, the model wasn't asked Bounded").
- TestJoinSplitsAtChunkSize now expects the newest-first order.
Rebased onto
|
||
|
|
874b86653d |
masking: the model the user turned on is waited 15s at most, and what it read is kept (xRayySummers on X)
xRayySummers on X (0.1.1877, Linux, AstrLink Guard turned on in
Settings -> Privacy): in one minute masking took 1.2s to 290s, and each
request whose wait ended was "gateway: masking failed, so nothing was
sent".
Cause: the model reads on the CPU one chunk at a time on one turn,
about 6 KB a second on 8 Linux cores. A burst of requests with text it
hadn't read (new tool results, subagents at once) queued behind each
other, and the turn goes round between chunks, so all of them finished
near the end of the burst. Turned on by the user, the wait had no
bound, and when anything ended it (the client, a deadline) masking.model
panicked: the request was held back whole, and even the finds already
cached for its history were thrown away (backend.find returned nil).
Not a reload (60-90ms) and not a lock in redact.
Now:
- pii.FindContext, when the wait ends, answers with what was known of
the texts (its cache: earlier turns' history, chunks read meanwhile)
and a *pii.Partial saying how many it hadn't read.
- masking.model waits at most strictWait (15s) for the user's model,
defaultWait (2s) for the default's as before. Past it, the model's
finds mask what it read and the rules mask the rest alone; the request
goes. Nothing the rules mask goes as written. Logged once a minute.
- A model that fails (not on disk, didn't load, held back after a
failure) still holds the user's requests back, as before: broken, not
busy.
- masking.find gives a model that doesn't stop for ctx 100ms (handBack)
to hand back what it knew, so a partial answer racing ctx.Done isn't
dropped.
- docs/subsystems/gateway-routing.md says so, with the numbers below.
Run:
- Reproduced with the real AstrLink Guard (guard-7216b6a3) on Linux
(wsl-run, magpie-desktop, GOMAXPROCS=8), a throwaway test not
committed: load 63-87ms, reload on a request 57ms, a 125 KB history
20.8s first read and 66us cached; six requests at once with 67-145 KB
of new text each took 62, 91, 92, 108, 108 and 110s on the old code.
With this change each went at 15.0s with the history's 14 finds and
the model's finds for 1 to 4 of its 9 texts.
- mote-run at
|
||
|
|
7c900f468f |
antigravity: a tier Google refuses in fetchAvailableModels is asked once a day and is no "Model list" row (ferock4669)
ferock4669 on Discord: with an Antigravity subscription, the Requests page filled with "Model list" (模型列表) rows for /v1internal:fetchAvailableModels, each answered 400. Cause. For an account loadCodeAssist gives a paid or non-free tier, magpie asks fetchAvailableModels first with entitlement.userTier named ( |
||
|
|
df9376592d |
routing: a group's member may offer several reasoning levels for the agent to pick among
Garydesu on X: "能不能让路由组里的模型设置多个可选推理强度,现在只能选一个或者整个 路由组的". A member was one fixed `:effort` or followed the group's levels. A member's suffix may now join several levels with "+", `provider/model:low+xhigh`, kept lowest first, each once. provider.MemberLevels splits it into Member.Levels and leaves Effort empty, so the member isn't fixed; one level is a fixed effort as before. The whole stays the member's id, so rules, fast, off, weights, share and the CLI key it as any member. The gateway fits the agent's ask to the member's own levels (groupLevels returns the candidate's levels first; ofMember, the quiet check and the trace see them), and the group lists them to agents (buildGroupEntries), intersected with the other members' as usual. In the Routing page's group editor the member's reasoning menu has "Several levels…", a menu that stays open with each level ticked or not; a fixed level picked from the first menu replaces the old one as before. i18n in zh, zh-TW, ja, de; CLI help and docs/subsystems/gateway-routing.md say it. Run on mote (mote-run). Rebased on |
||
|
|
25df3187bf |
gateway: a model whose upstream says thinking.type must be "enabled" is asked again thinking
cybercaius on Discord (#help), v0.1.1862: Claude Desktop's connection
check failed with 'Gateway rejected model
"magpie-0958175816.anthropic.claude-haiku-5-5[1m]" (HTTP 400)', the body
'天翼云: {"error":{"message":"{\"code\":\"400\",\"message\":\"thinking.type
must be \\\"enabled\\\" …","type":"upstream_error",…}}'. 天翼云 is his own
provider, a relay whose message is its own upstream's whole body.
What was sent: Desktop's check ({"max_tokens":1,"messages":[{"role":
"user","content":"."}]}, raised to 16) asks for no thinking. Relayed to
a Messages provider, a vendor's model gets thinking {"type":"disabled"}
(thinkingOffUnlessAsked) and a Claude-named one none; translated to Chat
it gets no reasoning_effort. Nothing today changed that: no gateway
commit since yesterday touches what thinking is sent. What changed is
where the check goes:
|
||
|
|
e296211b8b |
masking: the default's local model is waited for 2s at most, then the rules mask alone
shensmart on Discord (10-28, magpie in Docker on Linux, web UI remote): Codex's requests sat "masking…" on the Requests page from about ten minutes into use. |
||
|
|
51247a55b2 |
docs: one commit, one goal moves into the code standards (seen a third day)
LESSONS.md's "One commit, one goal" was seen on 10-05 and 10-06. On 10-28 |
||
|
|
a5315c70d5 |
redact: the local model doesn't read an agent's tool definitions (niuniu_8964 on X)
码妞 on X: the official container on a 4-core, 8 GB server, AstrLink Guard on, Claude Code's requests sat at 脱敏中 for minutes and timed out, load 1.78, a short conversation. |
||
|
|
25fc92d59a |
fallback: a model unchecked in its provider's list is not a fallback to go to (#3911)
The sibling of the group fix before this: a provider's Fallback list
resolved each entry with Resolve, so a fallback the user unchecked in
its own provider's list was still sent to, while the fallback editor
says "No provider serves {id} now; it is skipped". plan's fallbacks,
and the places that read the same list (carefulOf, native compaction's
carrier check, unredactedRoute, codexFallsBack), now resolve through
provider.ResolveRoute, which skips it. ResolveRoute scans the entries
once for the one model rather than building a map per request.
Test: fallback_unpicked_test.go, plan/m answering 429 with fallbacks
a/x (unchecked) and b/x goes to b and never to a.
Run (mote): red on the previous commit's tree ("from ka", a tried
[ka]); green with this one. Full suite as recorded in the previous
commit, which ran at this tree: 76 packages ok, internal/plugin's
TestGatewayHookMixedPiPackage red at load ~134 (#2865), passing alone.
go vet darwin/linux/windows clean.
Not tried: a real provider with a fallback in the app.
Co-authored-by: timonwong <timon86.wang@gmail.com>
|
||
|
|
f561cc5d9b |
groups: a model unchecked in its provider's list is not a member to route to (#3911)
timonwong (#3911, also on Discord #feedback): with a group of a/x and
b/x, unchecking x in provider a's model list struck a/x on the Routing
page, but group/<id> still sent requests to a. membersOff resolved each
member through resolveIn, whose provider/model step takes any model of
a provider that is on, so that a request can name a model its list
lacks.
membersOff now skips a member whose provider has picks and whose served
models lack it (unpicked), as timonwong's fork did (38615ca9). A
provider with no picks still routes a model its list lacks (#2642), a
decision model (never in the catalog) is still a decision group's, and
a request naming a/x itself still reaches a. Every route mode goes
through membersOff (ordered, weighted, rotate, manual, nested groups,
found groups, count_tokens' group lookup), so all of them get it. The
entries map is built only when a member's provider has picks.
The Routing card's memberInfo (gui/groups.go) used Resolve too, so a
manual group's pick row showed an unchecked member as ready; it now
asks provider.ResolveRoute, the same check, and the group is not ready
when its picked member was unchecked.
Tests: group_model_pick_test.go (ordered, weight, rotate; nested; a/x
named directly still served; checked again comes back; a decision
group keeps a picked decider) and gui's
TestGroupMemberUncheckedInItsProvider.
Run (mote, at this tree plus the next commit):
- Red on
|
||
|
|
d6df72a2ba |
redact: a disassembly's symbols (system@plt, foo@@GLIBC_2.2.5, system@got) are no email
ch35tnut_ on X: reversing, symbols like system@plt were masked as
emails, so masking had to be turned off for reverse engineering.
The rule's regexp already needs a dot and a mail TLD (mailTLD), so
system@plt, puts@got.plt and memcpy@GLIBC_2.14 went as written by it at
origin/main. The local model's EMAIL spans pass realEmail too, which
never asked for a dot: .got is an ICANN top-level domain, so a model
span on system@got (IDA's "; system@got") was masked. And a
foo@plt.got ends in .got with a dot, so the rule masked that too.
realEmail now asks mailHost first, for the rule and the model alike: the
host has a dot, every label is letters, digits and hyphens (or non-ASCII,
an IDN's), no label empty, the local part does not end in @ (foo@@VER),
and the host is not made of linker table words alone (plt, got, sec,
iplt, igot: free@plt.got, memcpy@plt.sec). A version with an underscore
(@GLIBC_2_2_5) or no dot (@Base, @GLIBC_PRIVATE) is no host.
TestSymbolIsNoEmail has objdump, readelf, nm, gdb and IDA lines as they
print them, for the rule and for a fake model flagging each symbol as
private_email, and checks that rina.k@fastmail.com in code and
ops@build01.acme.io beside a symbol are still masked by both.
Run at this head (origin/main
|
||
|
|
6e080ca044 |
gateway: every model in /v1/models says it takes tools, a routing group too
psikent on Discord: an SSH client judges what a model can do from its
list entry, and a routing group, whose id is the user's own name, said
nothing of tools, so the client handed it none. /v1/models and
/v1/models/{id} now give every chat row models.dev's tool_call: true
(beside the reasoning it already had) and OpenRouter's
supported_parameters (tools, tool_choice, and reasoning when it thinks),
which Kilo's and Cline's list readers use (kilo.go reads the same field).
magpie has no model that takes no tools (a call written as text is read
back as one), so a group's members all take them and the group says so.
No `capabilities` key: Cursor Private Inference reads it as an object,
Ollama and LM Studio as arrays of their own words; magpie's Ollama
/api/show already says "tools". Desktop's, Science's and the decision
models' lists are unchanged.
windy on Discord: a 1M DeepSeek group with a 128K Trae member. A group's
window and output stay its largest member's, images any member's, as
#712, #756 and ARNO's truncation report decided: the gateway sends a
longer conversation only to members with room (roomy, withRoom), and
Context: Smallest model's tells agents the smallest. The editor's Context
hint now names the member a longer conversation skips when the windows
differ ("…longer than 128,000 skips Trae CN · DeepSeek-V4.1-Flash…"), in en, zh, zh-TW, ja, de.
Compaction written to agent configs follows the same window (CompactFor,
CompactSet takes the smallest threshold the user set); unchanged.
Run (mote unreachable all session, so on the other test boxes):
- TestGroupListedTakesTools on Linux (wsl-run): green; red on the old
gateway.go (a/m, b/m, group/g and /v1/models/group/g: tool_call false,
supported_parameters []).
- group-context.test.cjs on the Windows box, Playwright 1.62.0,
Chromium + WebKit, en and zh: 4/4 green; 4/4 red with the old
routing assets (the hint named neither 128,000 nor the member).
- Every GUI file that opens the group editor (56) plus i18n-keys, both
engines, on Windows: 816 tests, 792 pass, 24 red (793/23 on the run
before the hint named a member's provider). The red files with the old
assets: the same tests red (25). They are #3402, #3412, #3789, #3096 and name-suffix-saved's
WebKit provider editor, not this change.
- Full Go suite, -tags nogui -timeout 45m, on Linux: all ok but
internal/agent (7 install-detection tests), internal/proc TestTreeRSS
and internal/gateway TestUploadStillUnderwayIsNotCutByHealthPing; each
red at origin/main
|
||
|
|
aca0f0d8a1 |
guard: a long text's windows are read at once, one a core (niuniu_8964 on X)
码妞 on X: on a 4-core server in the Docker image, with AstrLink Guard,
Claude Code's requests sat at 脱敏中 for minutes, load 1.78. Guard read a
long text's 510-token windows one after another, and split only each
window's matmuls and attention over GOMAXPROCS-1 goroutines; the layer
norms, biases, GELU and quantizing between them ran on one core. A
2-CPU container got one thread for all of it.
Find now reads every window's logits first, min(GOMAXPROCS, windows) at
once, each with GOMAXPROCS/that many goroutines of its own, then merges
them in window order as before, so what it finds is the same. A window's
procs are passed down (logits, encode, matmul, attention, parallel) in
place of the package's threads. CoreML (a Mac) still reads one window at
a time.
Measured on magpie-desktop (WSL, Ryzen AI Max+ 395), 69,495 bytes of
docs, 22,488 tokens, ~59 windows:
GOMAXPROCS=4: 23.86s before, 17.90s now
GOMAXPROCS=2: 48.8s before, 30.50s now
GOMAXPROCS=1: 50.0s before, 57.0s now (the same code path; noise)
Run:
- wsl-run with MAGPIE_GUARD_DIR at the pinned model (rev 7216b6a3):
TestWindowsAtOnceReadAsOneByOne (new: 200 synthetic contact lines, over
4 windows, read at GOMAXPROCS 1 and 4, spans DeepEqual), TestModelFinds,
TestKernelsMatchGo, TestTokenizerMatchesHF, TestDecodeBIO: ok.
- mote-run: go vet ./internal/pii/..., GOOS=linux and GOOS=windows go vet
of it, go test -race ./internal/pii/..., go test ./internal/pii/...
./internal/redact/...: ok.
- win-run go test ./internal/pii/guard: ok.
Broken by hand: swapping the first two windows' logits after the wait
made the new test red ("windows at once found 800 spans, one by one
800": the same count, different spans).
Not tried: the reporter's own server, or a real Claude Code request
through the Docker image; TestCoreMLMatchesGo (needs the model on a
Mac) was only compiled. The full suite wasn't run: nothing outside
internal/pii/guard calls what changed but Find.
|
||
|
|
eb6d1d8d97 |
redact: a colour or an ordinary word is no personal name (黄绿色, 关键词)
hh05928822 on X after v0.1.1850: names were found in ordinary Chinese, "黄绿色" the worst, with 边••, 应••, 关••, 尚• in the screenshot. wangjunxiao128: "关键词" taken for a name. Both ways a Chinese name is found (the model's PERSON spans in modelSpans, and the cue rules in zhNameSpans) now go through one check, zhWordNotName: a span that is an ordinary word is no name, unless a role before it or a title after it says a person is meant (客户方圆, 江山老师). A word is (zhWordShaped): - a colour: Han colour characters alone, or anything ending in 色 (黄绿色, 红色, 金黄色, 浅蓝色); - a two-character word starting with a surname, from zhWords or the new zhDict (边界, 应该, 尚可, 关心); - such a word with a noun ending after it (关键词, 关键字, 应用层, 毛利率, 时间戳, 文件名). zhDict is zhdict.txt, embedded: ~1,550 two-character words from jieba v0.42.1's dict.txt (MIT, in THIRD_PARTY_NOTICES), the first character a surname, frequency >= 100, tag not nr/nrt/nrfg, and a list left out by hand (陆游, 关露, 欧阳, 司徒...) in its header. The surname list keeps 黄, 关, 边: they are real surnames, so 黄晓明, 关羽 and 毛利兰 are still masked. modelTakes' own zhWords check moved into the shared one. Run on mote at |
||
|
|
6aa04f6e6a |
provider: a keyless relay on the user's own network imports and saves, as one on 127.0.0.1 does
iSnow_999 on X: their company's internal Codex relay is at
http://<LAN IP>:8080; imported from CC Switch, Codex couldn't reach it
through magpie. A CC Switch Codex entry with no key (requires_openai_auth
= false, auth {}) at a LAN address was listed as "it has no API key"
and left out, and the same provider couldn't be saved by hand ("needs an
API key"), while the same server at 127.0.0.1 was taken keyless.
keyOptional now also takes a host on the user's own network, read from
the URL alone (ownNetwork, no lookup since Ready asks often): a private,
link-local, loopback or carrier-grade NAT (Tailscale) address, or a
.local name, as netproxy's onLAN sends around a proxy. A keyless address
on the internet still needs its key. Every importer (CC Switch, Alma,
Codex, OpenCode) goes through imported(), and the editor, CLI and TUI
through Save, so the one rule covers them.
Ruled out against the code and on mote, sandbox HOME, fake relay on
mote's LAN address 10.0.0.116 at a free port, `magpie serve --web` built
from this tree, import through POST /api/importapps:
- a CC Switch Codex entry at http://10.0.0.116:<port>/v1 with a key
imports with port, path, key and Responses kept, and /v1/responses
through the gateway reaches the relay (Bearer sk-corp); with
HTTP_PROXY/HTTPS_PROXY/ALL_PROXY at a dead 127.0.0.1:9 too (onLAN);
- a request with Codex's User-Agent, originator and
x-codex-turn-metadata reaches the relay with them (sub2api's
codex_cli_only gate reads these; port 8080 is sub2api's default).
After the fix, the same run with a keyless entry: imported, served, the
relay sees no Authorization header.
Tests: TestKeylessRelayOnOwnNetwork (import of a keyless LAN entry,
Save + Ready at 192.168/10/172.16/100.64/.local/[fd00::] addresses, a
keyless internet address still refused) is red on the old provider.go
and green now.
Run on mote at
|
||
|
|
ae03279458 |
masking: the local model is on by default; the rules mask alone until it is downloaded
The owner's plan (10-28, after the xuanwo/_kaichen reports under the
masking demo): with AstrLink Guard picked, the Chinese-name heuristic
is off and only nicknames like 小王/老李 stay a rule; with Privacy Filter
it is as before; every format rule stays; the model is on by default,
masks with the rules alone until its download finishes, and no longer
answers 503 for it.
- masking.ModelWanted(st): on when the user turned it on, off when the
user turned it off (new RedactModelOff, set by SetRedactModel(false),
remove, and cancelling the default's own download), on when the
default's download finished (RedactModelAuto). A settings file from
before this, with a model name picked or files on disk and the model
off, reads as the user's off: magpie's default doesn't override it.
- Until the picked model is installed, requests are masked by the rules
alone and fetch starts its download (one try per model per hour,
never under testing.Testing(), nothing where the model can't run).
When it finishes, settings.UseDefaultRedactModel records the default
(it refuses when the user has set anything) and the model warms.
- model(..., strict): a model that fails holds requests back (503)
only when the user turned it on; under the default the rules mask
alone. The Privacy page says which ("…the rules mask requests alone"
in en, zh, zh-TW, ja, de; /api/privacy-model has `chosen`).
- redact.Options.NamesByModel (AstrLink Guard picked): zhNameSpans
keeps only zhNick candidates (小/老 + a surname).
- KeepOwn and POST /api/settings keep both new fields.
- Docs: gateway-routing.md, site masking docs (en, zh, ja).
Run (mote, Go 1.26.8):
- gofmt clean; go vet of masking, settings, redact, gui; GOOS=linux go
vet of masking, settings, redact; GOOS=windows go vet of the four.
(GOOS=linux vet of internal/gui needs cgo, as on main.)
- go test -count=1 -timeout 45m ./... at base
|
||
|
|
a1f06bd780 |
gui: a browser tab offers the fonts of the computer it runs on (Norcleeh)
Norcleeh (Discord #general): magpie in Docker, used through the web GUI,
Settings' font menu doesn't list the fonts he installed on his own
computer; the app does. Cause, confirmed in the code: a tab's list is
/api/fonts, the server's families (none in a nogui build such as Docker)
plus commonFamilies, filtered by what the browser draws. A family that
is only on the browser's computer was never offered, and a choice the
server doesn't list was dropped by desktopFonts.available.
Now (webfonts.js, which only a browser tab loads; the app's windows are
unchanged):
- Where the Local Font Access API is (Chromium on https or localhost),
the press that opens a family menu calls queryLocalFonts() once a
page, and at load when the local-fonts permission is already given.
The families join the list with their real styles ("SemiBold
Condensed Italic" -> weight 600, 75%, italic).
- Elsewhere (Safari, Firefox, a plain-http LAN address, a refused
permission) the menu's search says "Search or type a font name…" and
offers Use "name" for a family the list lacks, enabled when the canvas
probe says this browser draws it, greyed with "This browser can't find
this font" when not; Enter takes it.
- A chosen family the server doesn't list stays in the tab's list on
later loads while the browser draws it, so it keeps being applied.
- The app's menu (openProtoMenu), never a <select>. Strings in zh,
zh-TW, ja and de. docs/subsystems/gui-shell.md says so.
Budget: no raise. here() moved out of fonts.js into webfonts.js, which
isn't a core script: loadFonts import()s it in a tab only (the page has
no CSP). The core is 106 bytes smaller than origin/main's.
Run (mote-run). At this head on
|
||
|
|
7fcf642eed |
gateway: the request archive doesn't put an unmasked route back on masking (#3973)
wangbinyq (#3973, Discord #feedback): after v0.1.1840, with the request archive on, a request to a provider set to go unmasked was still masked whole before it was sent. |
||
|
|
aba11fc4de |
gateway: xAI's own API takes no null required in a tool's schema (#3392, kongkongklng)
The third round of #3392, after the reporter merged the system-turn fix: codex went through, but every Claude call still 400ed — xAI answers 'Invalid request content: Schema validation failed: [standard_violation] /required: null is not of type "array"'. A tool's schema said "required": null where none were (Claude Code's own tools, an MCP server's among them; Anthropic's API takes the null, xAI validates each schema as a JSON Schema). The relay forwarded it as sent. The key now goes wherever a tool schema leaves magpie for api.x.ai — input_schema (Anthropic), parameters (Responses) and function's parameters (the translated path), at the schema's root or nested; a real array of names stays as it came, and a body with no null required keeps its bytes. Replayed on a fake xAI by the reporter's wording: the claude call with a root and a nested null required goes through, Bash's real array and the schemas' contents beside them as they were; with the shaper off, both new tests go red. Full nogui gateway package: the four reds (TestClaudeClientCacheAbsentUnchanged, TestCodexFittedImagesPastTheBudget, TestMarshalRawIsEncodingJSON, FuzzMarshalRaw) match a clean-baseline run of the same branch in the same session; a fifth clean-baseline red (TestHandedOverGatewayFinishesItsStream, the known flake) passed here. gofmt / go vet clean, linux/windows/darwin nogui builds pass. Not tried against the real xAI API: no key here. From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25. |
||
|
|
d8938d2f00 |
gateway: xAI's own API takes neither a sealed item's null content nor a system turn in messages (#3392, kongkongklng)
The follow-up to 8ecab590, after the reporter merged it: the first Codex turn through an xAI key went through and every one after it 400ed "Could not decode the compaction blob. Ensure it is unmodified from the compact response." — Codex hands the sealed reasoning item back with "content": null beside its encrypted_content, which xAI's backend can't read. The Grok subscription's plugin already drops that null (grokShaped), but the xai preset shapes nothing, and the custom-tool refusal had only now let a second turn reach the API. And every Claude call 400ed "Invalid request content: Invalid message role.": Claude Code sends a system turn mid-conversation (Anthropic made them GA), a role xAI's Messages takes only as the top-level system. xaiBody (api.x.ai, shaped in passthrough and on the built body in forwardTranslated alike — a custom-tool refusal puts a Codex request on the translated path from the next turn on) drops a reasoning item's null content and folds each system turn into the top-level system, its text and blocks as they came. Nothing is learned: xAI takes neither at all. TestXAITakesCodexsSealedReasoningBack, TestXAILearnsCustomToolsThenTakesTheReplay and TestXAIFoldsClaudesSystemTurn replay the reporter's session on a fake api.x.ai and are red with the shaping off; the wording comes from the report. gofmt clean, go vet and the builds (native, linux nogui, windows) clean; go test -tags nogui ./... in a sandbox HOME: 66 packages ok, the same 7 test failures as the clean branch head baselined the same session (TestWriteAtomicReadOnlyHardLink, TestClaudeClientCacheAbsentUnchanged, TestCodexFittedImagesPastTheBudget, TestMarshalRawIsEncodingJSON, FuzzMarshalRaw, TestPluginSOCKSProxy, TestProgram). Not tried against the real xAI API: no key here. From skygunner's branch fix/issue-batch-1024pm; kongkongklng confirmed it on 10-25. |
||
|
|
1d7ca4c6b7 |
gui: every scroller in every stylesheet is held to keep the wheel; Safari 15 too
碳碳双键 (ysm119, Discord): a list scrolled to its top or foot by the wheel went on to scroll the page, "in many places". |
||
|
|
67c8f562cd |
codex: a subagent named a model goes on it with "Same as the lead" (mengxiao on Discord)
mengxiao left Codex's subagent model at "Same as the lead" in magpie, asked the lead for a subagent on GPT-6.1 Terra, and magpie put the subagent on the lead's model anyway. The cause was codexFollowTo (internal/gateway/codex_follow.go): on the ChatGPT-sign-in path, a collab_spawn request asking for one of Codex's bare models, with nothing set in magpie or [agents] default_subagent_model, was moved onto the model the conversation's own turns go on ( |
||
|
|
dfbd37eafc |
docs: a reporter's fix branch, patch or fixtures are credited in the commit
321sssrt-bit's analysis, fixtures and fix branch went into #3418, #1981 and #2033 with no co-author line. Now: a reporter's fork branch is merged with their commits as authored, anything else we use from them gets Co-authored-by, and a plain report is named in the body. Docs only; nothing reads this file's text. |
||
|
|
189db9ba5b |
redact: ids, digests and 毛利 go as written; the slider reaches known values; a user name goes as a made-up name
Reports on X under the masking demo (10-28):
_kaichen: "hash类型也会被过滤…长int,假如以1为开头的…会被当作电话被mask;
"毛利低"也会被当作人名被mask。即使把匹配拉到 0.95,也是一样行为".
- Hex digests: 16 to 31 hex digits in one case, with letters and digits
both (a cache key, a short commit), are ids now (digestShaped in
ids.go), like UUIDs and 32+ hex. The rules' SECRET keeps one only under
a credential's field or a CJK/prose key with no field word (密钥为…);
the model's SECRET is dropped under a field named for something else
(cache_key, commit, object, blob, file, content, revision, partition,
shard, bucket, dedup, lookup, row, sort) and on a JSON object's key
(nameOfField). A bare `key` after api/access/secret/private/signing/
license is still a credential (keyPhrase). The IBAN case kept its mask
through the letter/digit minimums.
- 11-digit 1x numbers (phone.go, phoneAt): a phone with +86/86, as the
value of a field whose name says phone (phone, mobile, tel, cell,
contact, 手机, 电话, `number`), or in prose with no id word right
before it (order, id, no., #, 订单号, 编号, 单号, 流水号…). Under
order_id/uid, after 订单号, or with a letter or digit against it, it
goes as written. PHONE and BANK_CARD are bounded by alnum, not digits,
in the rule and in known values.
- 毛利: zhWords gained 毛利, 毛重, 毛坯, 毛巾, 毛衣, so 毛利低 (a margin)
is no surname+name. The model still finds 毛利兰 (Guard). 毛利小五郎
(indekkusu141209) is masked by neither model nor the rules now.
- The slider: a value masked once was masked again as known whatever the
threshold. Each value now remembers the highest score it was found
with (rules count as sure, ruleFound), and knownSpans skips one under
Options.MinScore, which masking sets from pii.Threshold.
eerttreeeert: with mimo-v2.6-flash the home folder went as
C:\Users\{{USERNAME_…}}; the model took it for a temp folder and set out
to delete it. With the user name switch on, it now goes as a made-up name
of 8 lowercase letters (HMAC of the name, same every turn, standIn in
shape.go), restored in replies and tool calls like any placeholder;
Preview shows the same name.
Docs: docs/subsystems/gateway-routing.md masking bullets, and the site's
masking page (en, zh, ja) on mobile ids and the user name.
Run (mote, at this tree on base 6af83172d; rebased onto
|
||
|
|
ee6f8866f3 |
gateway: Claude Desktop's connection check goes to its default model
CyberCaius on Discord, v0.1.1838, after restarting Claude Desktop: as it
starts and from Test connection (Configure third-party inference ->
Gateway), Desktop said "Gateway rejected model
magpie-0958175816.anthropic.claude-haiku-5-5[1m] (HTTP 400)", the body
"AnyRouter: bad response status code 400". His default model in Desktop
is his routing group 天翼云; Routing showed leee/claude-haiku-5-5 sent to
AnyRouter gpt-6.1-sol.
Why
|
||
|
|
05ed578bdc |
gateway: a large body whose h2 ping was lost goes again unpinged (#3909)
yxd-ym, on a 2-10KB/s uplink: every large turn to a Google upstream (Antigravity, Vertex, AI Studio) failed with "http2: client connection lost" after 35-45s while its body was still uploading, and the group's failover uploaded the same ~680KB again to every member. A small turn on the same uplink was answered in 14s. Cause (skygunner's diagnosis): the vendor transport's HTTP/2 health check (netproxy.HTTP2Health, #2843) pings a connection with no frame received for 20s and drops it when no answer comes in 10s. The ping is written behind the body's own DATA, so on a slow uplink its answer can only come after the last byte, and the check closed a working connection. skygunner's branch (8eaf63866) sent every body of 64KB or more, or of no stated length, to a transport without the ping. That is most agent traffic, and it takes #2843's protection away from it: a silent connection whose kernel takes a body that fits the send buffer then waits the 10-minute header wait (TestLargeBodyOnSilentConnectionIsSentAgain below hangs to its 10s bound on that branch). The change keeps the ping on every request by default. A large body (uploading) whose try fails with Go's lost-ping error (lostPing, closeForLostPing's "http2: client connection lost") is sent once more, through GetBody (provider.SetBody keeps it until LetGo), through uploadTransport: a new connection, no ping, given up on when a write moves no bytes for a minute (WriteByteTimeout); the response header wait still ends a vendor that never answers. For 30 minutes after (slowFor, drawsApart.slow, per transport), large bodies go there at once, so a slow uplink loses one try per half hour, not one per turn. A connection that really was dead costs nothing more: the retry dials a new one either way. Small bodies and drawings are unchanged. Co-authored-by: vincent <vincent@users.noreply.github.com> Reported-by: yxd-ym What was run, on mote at origin/main |
||
|
|
bc3ddc661a |
redact: 文案 and words like it are no Chinese names (zeewell on X)
zeewell on X: tasks kept going wrong because 文案 was masked as a name,
so they turned names (and birthdays) off. 文 is a surname, and zhName
took a cue around 文案 that says nothing about a person. Probing words
that start with a surname (文档, 方案, 关键, 项目, 成本, 段落, 颜色, 查询,
时区, 简历, 林间, …, ~130 of them) in the places a prompt has 文案, about
110 were masked, through two cues:
- 一下 before it (改一下文案, 检查一下文案,) counted as "a person comes
next". 一下 follows any verb, so it now counts only after one that asks
a person (zhAskVerbs: 问, 找, 联系, 通知, 提醒, 回复, …): 问一下张伟
still is one, 改一下文案 is not.
- At a sentence's start, a word after it that any subject takes (已经,
明天, 今天, 昨天, 他, 她, 提交, 负责, 回复) counted alone: 文案已经改好了,
文案明天给你, 文案他们说. Those (zhAnyAfter) now count only with a
person's cue before (客户张伟已经到了). 说明, 说法, 讲解, 讲座, 讲义, 讲究
are words, not 说 (文案说明), but for 说明天 (张伟说明天来).
- zhWords gets ~150 more common words (文案, 文风, 关键, 项目, 段落, 林间,
…) for where a real cue is before a word (发给文案, 请文案), and is a
set looked up by a candidate's first two characters rather than a scan.
- The model's own PERSON span that is such a word whole (文案) is
dropped too (modelTakes), the other route a word reaches a name.
Old data: masked values are remembered in memory only, and 文案 (6
bytes) is under minKnown, so nothing stays masked after the update.
Fixtures are prompts with 文案 where the report gives no sentence (帮我
改一下这段文案, 文案:…, 把首页文案换成英文, ### 文案, 文案和图片, 文案已经改好了,
文案说明要简短, 这张图发给文案。), beside names in the same places that
still mask (问一下张伟,, 张伟说明天来, 客户张伟已经到了, 发给张伟。);
TestChineseWordsAreNoNames runs 25 listed words in 10 shapes plus the
model's label, and 5 unlisted ones (文创, 方位, 高铁, 安防, 林荫) through the
cue shapes alone. Every TestChineseNames case stays green.
Run (mote, mote-run, at this tree): go vet ./internal/redact for darwin,
linux and windows ok; gofmt clean; go test -timeout 45m of
internal/redact, masking, pii/..., otlp, sessions, settings, gateway
ok; internal/gui red on TestMainWindowCorners/macOS_26_SDK only, the
macOS 27 red filed as #3949 (no redact in it).
After rebasing onto
|
||
|
|
8edb9dbb75 |
gateway: a compaction a model answers with a tool call is asked again as text
Lucy on Discord (v0.1.1676, Codex, group/auto-deepseek-v4-1-flash): "compaction: group/auto-deepseek-v4-1-flash failed to summarise this conversation 3 times in a row (last: the model wrote no summary (it answered with reasoning, function_call exec_command))", so Codex could not compact at all with that group. Cause: the summary request offers no tools (tools [], |
||
|
|
ea53eb1262 |
gateway: a request to an unmasked route isn't masked first (#3973)
wangbinyq (#3973): with masking on, a request to a provider set to go unmasked was still masked whole before routing, then sent as the agent wrote it, so the masking was thrown away. In their log that was 97.9% of magpie's own time: median 560ms, p99 16s, max 219s. serve now masks after Resolve/FindGroup. When unredactedRoute holds and no body goes anywhere else (bodiesKeptAway: no observer wanting bodies, no request archive), masking is skipped. The redact writer goes under capture, an order that commutes with the old one. A turned-away request is logged masked (maskedCopy). count_tokens masks only when its route isn't unmasked. The context card's text stays masked: the kept body is masked when PromptText first reads it (keptBody.plain), not on the request's way. The log and recent calls keep the body as it went. Run on mote at this tree (base |
||
|
|
d74ef5e04c |
gui: an inner list wheeled to its end keeps the wheel; the page stays put
碳碳双键 (ysm119, Discord): wheeling the Usage page's request list to its top or bottom carried on into the whole page, and "this happens in many places". It is the class: every box that scrolls inside a scrolling page. app.js marks such a box `.holds` while it overflows vertically, on pointerover and on each wheel (the box under the pointer and its ancestors up to the .view), and app.css gives `:where(.holds)` overscroll-behavior-y: contain, which keeps the Mac's bounce on the box. Not one CSS rule for every overflow:auto box: in Chromium `contain` holds the wheel even in a box that doesn't overflow, or is overflow:hidden, or only scrolls sideways, so short lists and the heatmap's and ledger's sideways scrollers would have stopped the page. The .view itself is never marked. :where() weighs nothing, so .mchips in a short window (@media max-height 640px, #833) still passes the wheel on. The new test, inner-scroll-contain.test.cjs, wheels the Routing page's requests list past each end (en and zh, 900x560 and 1300x600, under "By session" / 未提供会话标识), and ten kinds of inner box, and asserts the page's scrollTop didn't move. A short list, heat-scroll, led-wrap and snip must still pass the wheel to the page. routing-scroll-end now wheels over the page's gutter: at its view centre the pointer sat on the requests' list, which now keeps the wheel at its end (600 of 1066). Run (mote, Playwright 1.62, Chromium and WebKit): - inner-scroll-contain 40/40. - 17 files: inner-scroll-contain, click-scroll, routing-scroll-end, routing-sessions, view-wheel-after-click/-after-redraw/-unheard, heatmap-scrollbar, ledger-hscroll, ledger-hscroll-foot, context-scroll-end, menu-scroll, provider-levels-scroll, panel-usage, panel-routing, qoder-cn-tile, agent-disconnect: 268/287. Reds were routing-scroll-end (this change, fixed above) and panel-usage webkit zh (#3311, commented). Rerun of routing-scroll-end, panel-usage and inner-scroll-contain: 66/66. - go test -tags nogui ./internal/gui ok (TestCoreScriptBudget passes at the rebased head: core under 1,526,556, app.js under 1,310,460; no budget raised). Broken by hand: the old app.js and app.css: the requests list and every held box red in both engines (mchips aside, it had contain already). Only the CSS rule removed: red, "the page didn't move" x8 plus each held box x2. Only the overflow check removed: a short rt-reqs red (Chromium), led-wrap and snip red in both engines. Not run: full GUI suite (mote was busy with another session's suite). Not tried: WebKitGTK on Linux, WebView2 on Windows, a real Mac's trackpad rubber band and momentum in the app, older macOS WKWebView, touch; zh-TW/ja/de (no strings changed). |
||
|
|
60520ddb3b |
moejs: v0.1.0-alpha.11, at its new module path github.com/MoeForge/moejs
Gateway middleware and agent plugins run on moejs. alpha.11 moves the
module to github.com/MoeForge/moejs; every other API change since
alpha.4 is an addition. What magpie gets: faster calls, loops, property
lookups and JSON.parse, allocation-free await, a bytecode verifier, a
correct default.pgo, and Intl / toLocaleString in plugin code.
Checked against both tags' source: every name magpie uses (NewRuntime,
Options, Compile, Link, Hook, Value, Arg, Undefined, NativeFunc,
Referrer, the Promise results, Exception) has the same signature, and
Options' defaults (shared frozen builtins, no timers) are unchanged.
fetch, Streams, URL, node:fs and node:buffer live in the separate
webapi and node packages, installed only on request; magpie installs
neither, so a plugin still reaches no network or file.
Intl's CLDR, Unicode, ICU and V8 material is compiled into every build,
and moejs asks a program that includes it to carry sections 1 to 4 of
its notices. THIRD_PARTY_NOTICES holds them verbatim. Release archives
ship no LICENSE today either; that is not changed here.
Doc and site links (docs/, site/public/docs/{,zh/,ja/}plugins.html)
point at the new repo.
Run on mote at this tree: gofmt; go build -trimpath -s -w (60,670,658
bytes on origin/main
|
||
|
|
58fb3a7786 |
redact: 关键发现, 易触发 and 和边界 are words, not Chinese names
xuanwo on X: with the model on, a report's words were masked as names, 关键 in "### 关键发现", 易触 in "`gh pr view` 易触发" and 边界 in "判断和边界,". Each starts with a surname (关, 易, 边), and zhName took a cue around it that was too weak alone: - 发 and 打 after it counted as the verb a person does. They now count only when no Han character follows, or one of 了个给过一 (发了个消息, 打给他); 发现, 打开 begin a word. - 和 and 与 before it counted as "a person comes next". They join like to like, so they now count only when a pronoun or what may be a name (a surname and 1-3 characters, no zhWords word) is before them: 吴敏和郑浩, 我和张伟, not 判断和边界. - A sentence started after any space or symbol. A space after a word or code is inside a sentence, so the start is now after punctuation (with spaces after it or none) or at the text's start; a backtick no longer counts. The fixtures are the reporter's literal lines, beside names around the same cues that still mask (### 张伟发了个消息, 我和张伟,, 这件事。 李娜说过). Run (mote, mote-run): go test ./internal/redact (TestChineseNames, TestMaskEval and the rest) ok; gofmt clean. Broken by hand, each red on its own case: the 和/与 rule off (边界), wordAfter off (关键发现), sentenceStart always true (易触发). Running as this is pushed: vet (darwin, windows, linux) of internal/redact and go test of redact, masking, pii, otlp, sessions, settings, gui and gateway. Not tried: the real model on the reporter's whole session; a name that starts after a space following a Chinese word (这件事 李娜说过) is now left, as one inside a sentence. |
||
|
|
a3ee00c05c |
codex: its own GPT models stay in Codex's list when kept for routing groups
士奇 (Discord, 10-28): with a routing group on, the Agents page's Codex list lost its Codex provider section and models, the model dropdown still offered GPT, but the Codex app had none; with the group off they came back. Cause: the codex provider's "Only through routing groups" (Provider.Unlisted, 只通过路由分组使用), or a group that lists itself alone (Group.Unlists), took the ChatGPT account's own models out of Catalog(), so out of Codex's own list too. With no Codex section, the own options were not magpie's, so the own-models switch showed and the picker kept offering GPT; meanwhile #1602 ( |
||
|
|
824100f30f |
gui: keep Windows modal backdrops responsive without blur
Disable full-window modal backdrop filtering in Windows desktop windows and tray panels, retaining the dimming veil. Browser pages and other platforms keep their existing blur through the existing win/web markers. Document the platform behavior in the GUI shell reference. On an affected 0.1.1805 installation with WebView2 155.0.4283.62 and Intel UHD D3D11, disabling the filter made provider tests visibly responsive. The reporter confirmed the improvement. Scripted scrolling measured roughly 67 to 165 rAF callbacks/s, not presented FPS. Verification: modal-backdrop.test.cjs fails on the original CSS in both Windows desktop Chromium cases (blur instead of none), with the other 10 cases passing. After the fix, 45 targeted tests pass across Chromium and WebKit: modal-backdrop, dialog-backdrop-drag, segment-press-dialog, gui-zh-tw, gui-ja and gui-de. node --check and git diff --check pass. The full GUI suite, Go vet/build/test matrix and native macOS/Linux tests were not run. |
||
|
|
c48fccfad7 |
plugin: the dist index is read from GitHub beside jsDelivr's copy, so a plugin npm doesn't have is offered its newer version
star21321321124 on Discord: CodeArts 0.2.3 showed "已自动更新", the page said
every plugin was up to date, and Update did nothing, with 0.2.4 on the
plugins repo's dist branch. npm has neither CodeArts nor River (E404), so
npmAsk's version is the dist index's latest. With the 「国内镜像」 switch on,
index.json was read from jsDelivr first, and a 200 from it was final. A
jsDelivr edge serves the branch as it was when it cached it (s-maxage=43200):
on 10-28 gcore.jsdelivr.net served the index with codearts latest 0.2.3
(age 6631s) while raw.githubusercontent.com, cdn and fastly had 0.2.4. So
the hourly update, Check for updates and Update all saw 0.2.3.
readDistIndex now asks raw.githubusercontent.com beside the mirror (with
the switch on) and merges the two copies: every version either names,
each package's newer latest. Each version keeps the sha512 its own copy of
the branch names, which installDist checks the tarball against as before.
GitHub is waited for 5s (distGrace) past the mirror's answer; unreachable,
the mirror's copy is read alone, as before. Switch off: one read, as before.
River: on dist at 0.1.0 only, nothing newer; the test holds it "current".
Run (mote, at this tree rebased on
|
||
|
|
f201183047 |
tune: the compact window is Long conversations, one value for both agents
7eleven (Discord #help): the Usage page's "Tuned for you" compaction
value and the agents' sheet "Long conversations" window were two values
that could disagree. Codex's tune wrote model_auto_compact_token_limit
into config.toml beside the catalog's context_window that Long
conversations writes; Claude's read its own env.
One source of truth: settings.CompactAt / FullContext. Tune's compact
row for Codex and Claude Code now has source "long": its Current is
settings.Compact(), Use calls provider.SetCompactAt (Sync writes Codex's
catalog and Claude's CLAUDE_CODE_AUTO_COMPACT_WINDOW as before), Undo
puts back the CompactAt/Full it stashed under tune.long.compact. So a
value set on either page shows on the other and writes the same config.
writeCompact marks claude.compact_long when the env value came from
settings, so Claude's row reads it as ours, not as the user's.
Migration (Codex Sync, local place): an old tune.codex.compact stash
whose limit is still the one tune wrote moves into Long conversations.
At default or Full it takes tune's value; with a value the user set it
takes tune's only when smaller. config.toml gets the user's earlier
limit back or loses the key; the stash is forgotten. A limit the user
changed after tune wrote it, or wrote themselves, stays and reads
Locked. A provider's Compact at or the user's own Claude env stays
Locked too.
Run (mote, at this tree):
- go vet on agent, provider, gui, tune; GOOS=linux go vet -tags nogui
./...; GOOS=windows go vet ./...; go build ./... and -tags nogui: ok
- go test -tags nogui ./internal/agent ./internal/provider
./internal/tune ./internal/gui: ok (TestCoreScriptBudget within the
budget, not raised; context.js is 33 bytes smaller)
- GUI: compact-one-value.test.cjs (new; Chromium and WebKit, en zh
zh-TW ja de) and context-tune: 104/104 at the rebased head
Broken by hand: the Codex long branch, the Claude long env check and
the Sync migration call each turned red TestClaudeCompactAt,
TestCodexHomeEnvTakesThePick, TestTuneCodexCompact,
TestTuneCodexOwnLimit, TestTuneCodexMigrate (4 subtests),
TestTuneClaudeLong and TestTuneCodexMigrateOnSync. Old context.js and
i18n.js turn compact-one-value red ("You set 272K").
Not run: full suite, Go or GUI (shipped at once per owner; the GUI suite
is still running on mote, reds get their own issues).
Not tried: a real Codex or Claude Code session reading the written
config; the migration on Windows/WSL places (it runs for the local
place only).
|
||
|
|
8c5c83c9fc |
gateway: a Responses client's cache marks to Claude last an hour (#3972)
7eleven (Discord #feedback, #3972): Codex routed to a Claude model on an Anthropic Messages upstream (an API key or a relay) had the cache marks magpie adds at Anthropic's default five minutes. Codex's turns are often further apart, so the thread's prompt was written again after each pause. Decided, zero config: the marks anthropicBody adds for a Responses client to a Claude model carry ttl 1h (addedMark, Request.hourMarks). - Price (claude-api skill, prompt caching): a 5m write is 1.25x input, a 1h write 2x, a read 0.1x (less on Opus 5.5 / Fable). In a busy loop the 1h marks cost 0.75x more on each turn's new tokens only; one turn after a 5 to 60 minute pause reads the prefix instead of writing it again (1.25x of the whole prefix), which pays for dozens of turns. - Codex's own vendor keeps a thread cached an hour (chatGPTCold); Claude subscriptions already go 1h through Claude Code (cacheMark1h). - No magpie setting exists for these marks: tune's cache_ttl and subagent_cache_ttl write Claude Code's own settings and don't apply. - The client's own say wins: prompt_cache_retention "in_memory" keeps 5m; marks a client placed itself are never touched (only magpie's added marks change). Every added mark has the same ttl, so none follows a shorter one. - A relay that answers 400 naming cache_control and ttl is asked again at 5m and remembered in unfit (hourMarksRefused). - Not changed: Chat clients' marks (OpenCode and one-off callers alike) stay 5m; left open on #3972. Non-Claude models on Messages unchanged. Tests: TestResponsesToClaudeMarksLastAnHour, TestHourMarksRefused. Broken by hand, each on mote: - addedMark always 5m: the four 1h subtests and both refusal cases red. - the refusal retry removed: "ttl refused" red (400 after 1 call). - in_memory ignored (hourMarks = true): "in_memory asked" red. Docs: gateway-routing.md, a bullet beside the Kiro cache marks. Run (mote, at this commit): go build -tags nogui ./... ok; go test -tags nogui ./internal/gateway ok (522.7s). Not run: full suite (pushed at once per the owner's rule). GOOS=linux and GOOS=windows go vet ./internal/gateway ok; gofmt -l clean. Not tried: a real Anthropic key or relay (no request was sent upstream), Bedrock or Vertex with ttl 1h (the refusal fallback covers a 400). |
||
|
|
02a328d86a |
gateway: Claude Desktop's model check goes to the session's model again
CyberCaius on Discord, after v0.1.1819: the startup error is gone, but
Desktop's check ({"max_tokens":1,"messages":[{"role":"user",
"content":"."}]} on the first haiku it is listed) now went to leee's
claude-haiku-5-5, another provider's Claude model, and spent its quota.
He wants it on the model or group his session uses.
|
||
|
|
6e331afb45 |
gateway: Claude Desktop's model check goes to the model it names; a relay gets a cache key
CyberCaius on Discord: Claude Desktop said at every start
'Gateway rejected model "magpie-<n>.anthropic.claude-haiku-5-5[1m]"
(HTTP 400)', body "Arouter: prompt_cache_key is required". His
Routing page showed leee/claude-haiku-5-5 served by AnyRouter's
gpt-6.1-sol, with a "." prompt.
Two causes:
- Desktop checks a gateway model as it starts (and from its settings'
Test) with {"model":<it>,"max_tokens":1,"messages":[{"role":"user",
"content":"."}]}, on the shortest id with haiku in it (lWt, JUt and
YT in its app.asar, 2.7032, read from the installed app). desktopTurn
took that small tool-less request for a session title and sent it to
the session's model, AnyRouter's gpt-6.1-sol, so a failure there read
as the haiku rejected. desktopProbe now knows the check, and it goes
to the model it names. Titles still go to the session's model.
- A request translated from an Anthropic client to a Chat or Responses
upstream never had a prompt_cache_key, and AnyRouter refuses one
without. ownCacheKey/cacheKeyOf give it one per conversation (a
hash, in a UUID's shape, of the client's session header, else of its
first user message; it names nothing of magpie) on OpenAI's API with
a key and on providers the user added by address. Presets, signed-in
accounts, plugins, Bedrock and Vertex get nothing new, nor does a
provider whose extraBody (#1604) names prompt_cache_key: the user's
value is the one sent. An upstream whose 400 names the field is asked
again without it and not sent it again (the existing path for Codex's
key); any other 400 is not asked again for magpie's key, so an
unrelated refusal is tried as often as before.
What is sent changes, on purpose, for those providers: the translated
bodies in testdata/upstream_bodies (anthropic-to-chat,
anthropic-to-responses, responses-to-chat and the large one's hash) now
carry the key.
Unticking AnyRouter's Claude models had no part in it: nothing went
to them. The probe was rerouted to the session's pick.
Tests: TestClaudeDesktopProbeAsked (a fake Anthropic "leee" and a fake
Chat relay that answers AnyRouter's 400 without a key: turn, probe of
the haiku alias, title, second turn keeps the key), TestDesktopProbe,
TestOwnCacheKey (scope, extraBody's key left to the user, and a relay
refusing the field asked twice once, then once).
Run (mote):
- go test -tags nogui ./internal/gateway/ -run the new tests,
TestUpstreamBodiesUnchanged, TestExtraBody*, TestOtherBadRequestNot-
AskedAgainAtLow, TestTranslatedEffortMinimalRefused, TestTooFew-
TokensSaidWithSigns, TestHighRiskErrorFallsBack, TestVertex*Retries*
and every *CacheKey* test: ok
- a full ./... run of the first draft at
|
||
|
|
5ced5b1aa0 |
routing: a wallet's row says what of it lapses first, as the Usage card does (#3964)
MYCF711's SuperMagic plugin (magpie-magicrew-auth daca18e) sends a balance window 积分余额 with runsOut, and 今日 / 限时 / 永久 as aside rows. The Routing page already showed all four rows, in the stage row's tooltip and the account list's .wins line, both through cardOf/winsOf (the Usage page's own readings). The row's own text said only "6,291 积分 left". For a wallet seat, quota() now adds the Usage card's runsOutText for the card's window of the same balance and unit: "6,291 积分 left · 185 积分 expire 23:59". It is client only. The Go side (allowanceOf, Weighed) is unchanged, because the aside rows are display only and routing weighs the total. Run (mote, at |
||
|
|
7b63feb908 |
gui: a browser tab's font rows show on a nogui magpie, and Text size no longer flashes
Norcleeh (Discord #general, after v0.1.1788): in magpie's web GUI the interface-font and code-font rows "flash once and disappear" on refresh. Cause, reproduced on a real nogui `magpie web` on mote in Chromium and WebKit, at 127.0.0.1, localhost and the LAN address: a nogui build (Docker, magpie-cli) has fonts.Available false, so boot.js carried no `fonts` flag and app.js never showed the font rows at all. What flashed was the Text size row: index.html shows it, and renderSettings hid it for a browser tab 40-120ms later (`#textSizeRow.hidden = web`). Fix: - A browser tab always gets the font rows. Its /api/fonts answers the server's families plus a common list (Arial, Menlo, Consolas, PingFang SC, Microsoft YaHei, Noto Sans CJK SC, JetBrains Mono, ...) and never errors for a tab; fonts.js keeps only what this browser can draw, and "System default" is always offered, so with nothing kept the rows still show with it. - The app-only rows (Text size, tray, login, tray usage) carry .app-only, which `body.web .app-only` hides before first paint, so none of them paints in a tab. - The boot `fonts` flag is gone. app.js and core both got smaller; no budget changed. - docs/subsystems/gui-shell.md "Desktop fonts" says so. Run (mote-run, at this head rebased on |
||
|
|
6f0e40572c |
gui tests: a plugin's words are its own when said as words (#3897)
yetone (#3897): i18n-keys' "a plugin's words are its own" is red on main since |
||
|
|
5ed6669cec |
sync: the account an agent is kept signed in to stays each computer's own
YsiCing on X: with only the library and usage ticked, the default account of a subscription with several followed the other computer: a personal one at home, a work one at the office, set again every day. The providers part always syncs, and provider.Mirror took the other computer's Provider whole, KeepLogin, KeepLoginAs and SwitchOnly with it. Mirror now keeps this computer's three for a provider it has, and a new one comes without KeepLoginAs (an account signed in over there). davsync's hashes blank the three, so changing which account is kept uploads nothing and two computers that differ only in it don't trade the part. The sign-ins themselves (logins.json) were never synced. A backup Restore is left as it is: it is asked for, and brings the backup's choice. Run on mote at this tree: go test -count=1 ./internal/provider ./internal/davsync ./internal/backup ok; go vet for darwin, linux and windows on both packages ok. Broken by hand: with backup.go and davsync.go reverted, TestMirrorKeepsKeepLogin and TestKeepLoginIsNoChange both fail. Not tried: two real computers syncing through a real WebDAV folder. |
||
|
|
396e0e4638 |
usage: a deleted provider's requests merged into another, or named, from the Requests filter
CyberCaius on Discord: a deleted provider's requests sat under its old id
("<date> 已删除"), and the only way to put them under a provider they
have was renaming that provider onto the old id. Now, with a deleted
provider picked in Usage › Requests' Provider filter, a "…" beside it
offers Merge into… (an app menu of the providers there are now) and
Rename… (the filter's button turns into a name field; Enter or leaving
it saves, Escape keeps it). With the merged-into provider picked, the
same "…" lists Separate <name> for each, the undo.
Nothing in the log is rewritten. Both live on the deletion's own record
in providers.json (Deleted.Into/MergedAt, Deleted.Label), so a provider
added later under the old id inherits neither: it is a different
provider, and its record of its own is what it has. Renaming the target
carries the merge (Rename rewrites Into); deleting the target ends it.
Renames.Both(id, time) gives the id a call is shown under and the one it
was made to (Own). Listing, filtering, the summary and vias go by the
shown id; pricing (Record.priceID, block_price's as), window holds and
the gateway's loggedAnswers go by the own one, so a merge moves no cost
or token, only whose name they sit under. The target's face lists what
was merged into it (Named.Merged). Routes: GET /api/usage/deleted/into,
POST /api/usage/deleted {id, into?, name?}; a field not sent stays.
Run (mote, at this tree on
|
||
|
|
77898391d5 |
code standards: a red's issue is read to its last comment, and a patch on it is taken first
Seen on 10-12 (#1794), 10-17 (#2444) and 10-28 (#3568, JoeyWu-tech's patch waited three days until
|