31da93ccdca03073513d2e1d73efdfd50bd14f6a
4659
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
31da93ccdc |
gui: pick the local model from the app's menu (#3578)
Settings → Privacy's "Find with a local model" row gets a picker
beside its switch, the app's own menu (openProtoMenu), not a select:
AstrLink Guard ("Chinese and English, few false alarms in code") and
Privacy Filter ("OpenAI's, masks more ordinary values in code"), each
with its size and whether it is downloaded. It shows only when there
is more than one model. Progress and Cancel follow whichever model is
downloading. Words in zh, zh-TW, ja and de.
privacy-model.test.cjs's new test opens the menu in chromium and
webkit, every language, at 1100 and 640px: both names, the note
translated, the one in use ticked, the menu inside the window, the
pick posted as pick astrlink-guard, and nothing scrolled.
Run at the pushed head: privacy-model and i18n-keys (48/48); mask-*,
masking-records, privacy-*, redact-*, text-size and click-scroll
GUI files in both engines (248/248); TestCoreScriptBudget and the app.js budget
pass without a raise.
|
||
|
|
a019f4ffc0 |
masking, settings, gui: the local model the user picks (#3578)
settings.RedactModelName holds the pick ("" for none, read by
pii.Choose), this computer's own like RedactModel, kept by KeepOwn and
by the GUI's settings save. /api/privacy-model returns the chosen
model's status and every model's, and takes {do: pick, model}: picked
while off it is saved for the next On; picked while on it is
downloaded, and once on disk it is saved and the other model stopped.
Remove deletes both. masking runs the picked model.
TestPrivacyModelPick and TestMaskingUsesThePickedModel fail on the old
code (no pick; Privacy Filter always).
Run: go test ./internal/settings ./internal/gui ./internal/masking
./internal/gateway -run 'Mask|Redact|Privacy|PII|Unmasked'
./internal/gwmw at the pushed head.
|
||
|
|
0db804999e |
pii: AstrLink Guard as a second local model (#3578)
pii.Model is a local model (ID, Supported, Installed, Size, Find, Now,
Download, Cancel, Warm, Stop, Remove); pii.Models lists Privacy Filter
and AstrLink Guard, pii.Of finds one by id. pii.Choose decides which
one runs: the user's pick; else Privacy Filter for a user who has it on
or downloaded, so no one's model changes under them; else AstrLink
Guard, the default for everyone who turns the model on from now on.
Why AstrLink Guard as the default. On 234 segments of real code and
config (131 KB: Go, TS, lockfiles, go.sum, CI and agent configs),
Privacy Filter found 100 spans in 26 segments, 39 after redact's checks
(38 go.sum hashes and "Zed"); AstrLink Guard found 2, 1 after the
checks. On the masking eval (42 values to mask, 113 to keep), the
model alone: Privacy Filter 40/42 and 47/113 wrongly, AstrLink Guard
38/42 and 3/113; with the rules and checks both are 41/42 and 1/113.
It is 39 MB, not 1.6 GB, runs on any CPU in magpie's process, and
needs no native helper.
Its three files come from Hugging Face at revision 7216b6a3 (v0.1.3),
each checked against the sha256 in the publisher's SHA256SUMS:
int8/model_int8.onnx 0a070d31…, int8/model_int8.onnx_data 0ba34216…,
int8/tokenizer.json 0cf3b235…; from hf-mirror first in China, as
Privacy Filter's are. It is loaded on the first request and let go
after 10 minutes with none; a failure holds requests back with the
same backoff as Privacy Filter's. Its labels are named as Privacy
Filter's, so redact's checks read both alike.
TestGuardFilesAreThePublishers holds each pinned path and sha256 to
the publisher's SHA256SUMS lines (testdata); it is red with the
tokenizer at the repo root, which is a 404 (found by a real download).
Run: go test -race -count=2 ./internal/pii ./internal/source; a real
download from huggingface.co into a sandbox HOME through
Of(Choose("", false)).Download (8.7s), then Find: 张伟, 13800138000,
zhangwei@example.cn, 北京市朝阳区建国路88号 and an sk-proj key found,
nothing in a go.sum line or "gpt-5.1-codex, go 1.26.8, README.md";
load 104 ms, three texts in 177 ms. All at the pushed head.
Not tried: a real download on Windows or Linux.
|
||
|
|
27b4f41264 |
pii: a model's find, cache and download as a backend of its own
No change in behaviour: Privacy Filter's turn, waiting count, answer cache, on-disk found file and download state move into a backend and a dlState, so a second model can have its own of each. Run: go test -race -count=3 ./internal/pii at the pushed head. |
||
|
|
6e9820a3a4 |
pii/guard: run AstrLink Guard's int8 model in Go (#3578)
AstrLink Guard (QuantumNous/astrlink-guard, Apache-2.0, on Microsoft's MIT Multilingual-MiniLM-L12-H384) is a 36.9M-parameter BERT token classifier for Chinese and English: 21 BIO labels (email, phone, account, payment_card, ip_address, url, common_secret, private_address, private_date, private_person), 512-token windows overlapping by 128, a 0.8 score floor. Its int8 ONNX is 37 MB. This package runs it with no new dependency and nothing native: an ONNX protobuf reader for the graph and its external data (onnx.go), the XLM-R Unigram tokenizer from tokenizer.json (tokenizer.go), and the encoder with int8 x int8 matmuls (bert.go) on NEON/SDOT kernels on arm64, SSE2 on amd64 and Go elsewhere (kernel*). Word embeddings stay quantized (15 MB in memory, not 61 MB). uax29 moves from an indirect to a direct requirement for the tokenizer's pre-split. Checked against onnxruntime on the publisher's files: the same spans on 69 of 71 eval texts, 232 of 234 real code segments and 24 of 25 positive samples; the rest differ by a span edge at the score floor. One 512-token window takes ~0.5s CPU on arm64 and ~1.2s under Rosetta on amd64, on a box at load ~100. Run: go test ./internal/pii/guard (kernels against the Go reference, tokenizer against the publisher's tokenizer on testdata/tokens.json), gofmt -l, go vet, GOOS=linux go vet -tags nogui and GOOS=windows go vet on amd64 and arm64, at the pushed head. |
||
|
|
e1709ab42e |
usage: Append makes the log's folder only when it is missing (#3725)
Every request appends one line to usage.jsonl, and Append ran os.MkdirAll on the folder first each time: a stat, and on its error path a walk up the tree. Now the file is opened first, and the folder is made (then the open tried again) only when that open says it doesn't exist. Measured with a scratch benchmark (not committed) at |
||
|
|
1360689ef2 |
provider: Served is shared while a request holds the catalog, not copied for each look (#3725)
Served built a fresh copy of the whole catalog on every call: the
unlisted groups' entries plus every provider entry. An Entry is ~1.3KB,
and a request looks at Served from outputLimit, userOutput, askedOutput
and windowIn, so with 12 providers of 20 models each look copied ~380KB
and a request ~800KB, all garbage by the reply.
Served now goes through heldFrom like providerEntries: one slice, built
once while a request holds the catalog and kept across requests until a
file it is built from changes. It is clipped, so a caller's append makes
its own copy and never reaches the next caller. The four gateway loops
take each entry by pointer instead of copying 1.3KB a step. Every
caller of Served (gateway, gui, cli, tui, agent, provider) was read for
writes into the slice or its entries; all only read.
Measured on BenchmarkZZIO (12 providers x 20 models, an 8KB request,
not committed): 1.57MB allocated per request before, 640KB after.
TestServedSharedWhileHeld: under Hold two calls give the same backing
entry, and an append to one doesn't show in the next. Red on the old
code (a new copy each call), green now.
Run at
|
||
|
|
b3b0e1649f |
gui tests: routing-live-patch's folded bar counts the skills part
|
||
|
|
f2aa7fe346 |
plugin: HasGateway looks at the plugins once a second, not on every request (#3725)
Every agent request asks plugin.HasGateway (gatewayHooks, and GatewayBegin again when on). It read plugins.json through lastgood and steady, cloned the list, and stat'ed and read every enabled plugin's package.json. With 12 plugins installed and none with hooks: Windows (Ryzen AI MAX+ 395, Defender on): 457µs, 51KB, 360 allocs macOS (M4 Pro): 251-286µs, 36KB, 260 allocs per call. It now keeps its answer for a second, keyed on plugins.json's path and filememo.Gen, as middleware.current does: magpie's own writes (plugin add/remove/on/off all go through save, which calls filememo.Forget) are seen at once, another program's within a second. Now 0.5µs/640B on Windows and 0.3-0.85µs/208B on macOS. Run at |
||
|
|
3fd7e16983 |
agent: PenguinHarness is installed from the Agents page and served by magpie with nothing to set up
rankyurky asked on Discord #feedback for PenguinHarness (npm @prismshadow/penguin-cli, command penguin). Every value comes from Penguin's own source (0.2.17): - Config: $PENGUIN_HOME (else ~/.penguin/data, every OS) / $PENGUIN_PROJECT_ID (else default_project) /.project_config.toml. magpie writes [providers.magpie] (base_url, client_type, api_key), one [[models]] entry per magpie model (context_window, vision, max_tokens, [models.pricing] in usd_per_mtok) and default_model in Penguin's own inline spelling. Penguin's server reads the file again when its mtime changes, so no restart; a default naming no entry is refused by Penguin, so Check fails when one is missing. - A file magpie creates is 0600 in a 0700 folder, as Penguin keeps it. Disconnect restores the user's own default_model (or none), drops a magpie vision model, and removes the file when magpie made it. Penguin's own entries, providers and command_policy rules are kept. - A sync that changes nothing writes nothing (bytes and mtime kept), so Penguin's watcher isn't woken. - Install: curl -fsSL https://penguin.ooo/install.sh | sh, or irm https://penguin.ooo/install.ps1 | iex on Windows; update: npm, or penguin update --yes for the tarball, except on Windows where update.ts refuses it. - WSL: a penguin kind with no restart notice; the WSL test now expects an empty Notice for a kind with no restart. - agentenv: PENGUIN_HOME, PENGUIN_PROJECT_ID; the project id is in NotPaths, or appdir dropped a value like "work" as a relative path. - edit.SetTOMLArrayTables: replaces every [[name]] entry with key = value (with child tables) by blocks, or removes them; blank lines between replaced entries go with them, and an unchanged result isn't written. - GUI: penguin-color.svg icon; README (en, zh-CN), docs/reference.md and docs/subsystems/agent-wiring.md. Run (worktree at |
||
|
|
d9a8148d7c |
routing: Speed first sends a request to the provider or key that answered the model fastest lately
joeliu96872540 on X: when one model is reachable through several API
channels, they want an option that sends each request to whichever has
been answering fastest, because they compare channel speeds by hand
today. Speed first (`fast`; `fastest` and `speed` also work) is a new
routing beside Free first. It applies to a provider's keys and accounts
(provider editor › Routing) and to a group of one model on several
providers (Routing page › group › Routing).
How it decides. When a streamed answer ends, gateway/speed.go records two
numbers for that account or key and model (restID): the time to first
token and the output tokens per second, as usage.DecodeOf computes them
for the Requests page. Each is a decayed average with a 20m half-life.
After an hour with no answer the record goes stale, and the store holds
at most 4096 records. This is O(1) at the answer choke point, beside
servedCandidate. For a pool routed by BySpeed, weighRouted reads one map
entry per candidate, and only for that pool. The usage history is never
read on a request.
routes.Fastest ranks each awake seat by its estimated time to a
200-token reply: TTFT + 200/TPS. A seat that reported no TPS gets the
median TPS of the others. Seats within 10% of the fastest in their band
keep their listed order, so near-ties don't swap on every request.
Seats with no recent measurement go after the measured ones. One request
in five, counted per pool, goes first to an unmeasured seat, rotating
among them, so each gets measured again. Resting seats go behind the
awake ones, and used-up seats behind those. Rests and failover are the
same as for every other routing.
The request trace gets lateTtft and lateTps, and the row-story sentence
says "answered m fastest lately: first token in 0.8s, 60 tokens a
second". It has a variant for a probe turn and one for when no seat has
been measured yet. i18n covers zh, zh-TW, ja and de. Also updated: the
CLI (`magpie group|provider set <id> routing=fast`, plus a new
`routing=` pair on provider set that refuses manual), the TUI name, the
rotation plugin's Sub, docs/subsystems/gateway-routing.md,
plugin-runtime.md, docs/reference.md and site start.html (en, zh, ja).
There is no new layout: it is one more item in the existing pickers.
app.js stays under its budget with no raise.
Tests:
- routes/fastest_test.go:
- ordering: fastest first, slow writer loses, alike keep order,
resting and used-up, median pace, none measured;
- the probe turn at 5, 10, 15 and 20, rotating between seats;
- a resting seat never gets a probe turn.
- gateway/speed_test.go:
- decay, staleness and per-model records, with an injected clock;
- a group of slowv and fastv routed fast: after the speeds are
measured and seeded, the request goes to fastv with lateTtft set;
- the same group routed in order still goes to slowv.
- cli: parseRouting and the provider routing= pair.
- GUI routing-speed-first.test.cjs: the row story for measured,
no-pace, probe and none, in en, zh, zh-TW, ja and de, in chromium and
webkit: 40/40.
Broken by hand:
- Fastest returning the listed order: the routes tests and the gateway
group test go red.
- noteTrySpeed removed: "the streamed answer wasn't measured".
- The client.js case renamed: routing-speed-first 0/20 in chromium.
Run at b5a5caff2 (base
|
||
|
|
78a0dbdd29 |
gui: a download the network broke off says so, not the signed address
AIMetaPhD on X: Settings › About read "0.1.1618 下载失败 · https://github.com/
…/magpie-windows-amd64.exe: Get \"https://release-assets.githubusercontent.com/
…?sig=…&jwt=…\": EOF". The text was hundreds of characters of signature and
token, and it said nothing about what to do.
/api/update now carries network: true when update.Network(err) is true
(the previous commit's NetError, after its own tries). The Version row
then says "{v}'s download broke off, a network problem. Click Check to
try again, or download it from the release page", translated into zh,
zh-TW, ja and de. The raw error stays in the tooltip. The release page
button the row already had stays. A mirror's failure keeps its own text
(#893). begin() clears the flag along with the mirror.
Run: GUI tests (Playwright 1.62.0, Chromium and WebKit):
update-*.test.cjs (16 files, the new update-network among them) and
i18n-keys, 266 of 266 pass. go test ./internal/gui (ok, 224s); go
test ./internal/update ./internal/cli (ok, previous commit); gofmt -l
clean; go vet; GOOS=windows go vet; GOOS=linux go vet -tags nogui
(./internal/gui ./internal/update).
After rebasing both commits onto origin/main
|
||
|
|
6335625a60 |
update: a download that breaks off is tried five more times, from where it stopped
AIMetaPhD on X: on Windows, 0.1.1615 couldn't download 0.1.1618;
GitHub's asset host dropped the connection ("EOF"). The download was
tried three times, two and four seconds apart, each time from byte zero,
and then it gave up. The error also carried the full signed redirect
URL, which the GUI showed.
Now a try the network breaks off (the connect, or the body part way) is
tried again after 2, 4, 8, 16 and 30 seconds. Each later try asks with
Range for the bytes still missing. A host that sends 200 instead has the
file written again from the start, and a 206 whose Content-Range doesn't
start where the file ends is refused. The SHA-256 from the feed is
checked over the whole file read back from disk, so the bytes from
earlier tries are covered. A failure that isn't the network's (a 404, a
checksum mismatch, a write that fails) is not tried again, and the file
is removed. The error is a NetError that names the file and the cause
("the download of magpie.exe.new broke off (EOF)"), never the address.
Release timing was checked and is not the cause. v0.1.1618's
magpie-releases release was created at 16:32:48Z, its assets were
uploaded from 16:36:13Z to 16:36:17Z, and it was published at
16:36:18Z. The feed reads only releases/latest, which skips drafts, and
needs SHA256SUMS, so it couldn't name 1618 before its files were there.
The URL in the screenshot is the asset host's redirect, which exists
only for an uploaded asset.
Run: go test ./internal/update ./internal/cli (ok); gofmt -l clean;
GOOS=linux and GOOS=windows go vet ./internal/update. New tests run on
httptest servers: a body cut mid-stream twice (resumed with
bytes=102400- and bytes=307200-, file and progress whole), a resume
with the wrong bytes (checksum fails, nothing kept), a connection hung
up before any answer behind a redirect to a ?sig=&jwt= URL (six tries,
and the error holds no URL), and a 404 (one try).
Broken by hand: without the Range header the resume test is red
(ranges "" "" ""); with the NetError keeping the url.Error the address
test is red (the signed URL in the text); with three tries it is red
(tries = 3, want 6).
Not tried: a real self-update on this machine or the Windows box, or a
real cut connection to GitHub. The China mirror and the user's
UpdateMirror get the same Range header; a mirror that ignores it sends
200 and the file is written again from the start.
|
||
|
|
b5d17b26e0 |
gateway: Antigravity's 429 to Codex's GPT-5 prompt says why and rests nothing, on the web-search path too (Jodiezzzzzz on X)
From Codex, every call to antigravity/claude-opus-5-5 failed with "exceeded retry limit, last status: 429" while dsh worked on the same account. The call was an agent_created_thread, and the vendor said "Resource has been exhausted (e.g. check quota)". Cause: a Codex thread begun on a GPT-5.x model keeps "You are Codex, an agent based on GPT-5..." as its first developer message after /model, resume -m or a fork, and magpie lifts it into systemInstruction. Antigravity answers that line with a fake 429, whatever quota is left, as it does Claude Code's (#666). Codex also sends a web_search tool every turn, so for an Antigravity model magpie serves search itself (translate -> searchReply -> askTranslated), and that path passed the bare 429 back: no hint, no 400, so Codex retried to its limit. - antigravityTurnsCodexAway: the two Codex GPT-5 opening lines count as a turned-away prompt; antigravityHint picks the Codex hint for them. - antigravityRound wraps the search path's ask, so its 429 and an in-stream refusal get the same 400, hint and no rest as translate's. - antigravityForeseen returns the hint, so a group skips Antigravity for the next 6h saying which prompt. - The Routing page shows the new hint (routing/client.js HINTS) in en, zh, zh-TW, ja and de. - Rest: none. The refusal is about the prompt, not the account (Fail "prompt"); a second account answers the same. Plugins: middleware-antigravity-cloak 0.1.1 (plugins a52d1b3) breaks the two Codex lines with U+200B. Its body says "npm had 0.1.0": wrong, the package is not on npm; dist had 0.1.0 and now has 0.1.1 (6fd1438). No mover applies. Real account (owner's Antigravity, sandbox HOME copy, gateway built from this branch) and real Codex 0.162.1: - codex exec resume <a gpt-5.5 thread> -m antigravity/gemini-3-flash: before, 429 retried to "exceeded retry limit"; after, one request and a 400 with the Codex hint; route try (429, prompt), no rest. - A new Codex chat on the same model: 200. - The two lines with U+200B after the first letter: 200; whole: 400. Broken by hand: - antigravityTurnsCodexAway returning false: the Codex tests go red (Codex got 429; the group's skip doesn't say why). - The antigravityRound wrap removed: the search=true subtests go red ("Codex got 429"). Run: - go test -count=1 -timeout 45m ./internal/gateway/: ok (476s, at 865df2472; main's next three commits touch only GUI files). - go test -count=1 -timeout 45m ./internal/gui/: ok (230s, at the pushed tree on |
||
|
|
68ee4117af |
gateway: a Gemini model's untyped tool schemas go typed (Vertex refused cua-driver's drag)
kthink on Discord: dsh with cua-driver's MCP tools on Command Code's
google/gemini-3.8-flash (the commandcode plugin), every request 400
INVALID_REQUEST from Vertex: "`mcp__cua-driver__drag` functionDeclaration
`parameters.target` schema didn't specify the schema type field."
cua-driver's drag schema before cua's #4888 has target as an anyOf of an
untyped oneOf and null, and scope a const with no type. Command Code's
gateway turns JSON Schema into Vertex's Schema object, whose type is
required, and an untyped node stays untyped.
geminiToolTypes (forwardOnce, so plugin requests too) is keyed on the
model id (last '/' segment starts with "gemini"), not the provider:
each untyped schema under tools' function.parameters / parameters /
input_schema gets the type its enum/const, keywords or branches say,
null left out; {} or a description alone is a string, a tool root an
object. Mixed-type unions, unresolved $ref/unions and anything under
not/if are left as they came. Written in place after the brace, so the
rest of the body is unchanged. withTypes no longer writes a trailing
comma into an empty {} (it produced invalid JSON there).
Google's own Gemini API / Code Assist (parametersJsonSchema) and
Antigravity (plainSchema) bodies have no such tools and are not walked.
Run at this tree, rebased on origin/main
|
||
|
|
8f023b5119 |
pii: a long text goes to the masking model in overlapping pieces, a piece at a time, each kept (#3682)
A text over 12 KB was sent to pf-serve whole. On a weak GPU one such
text could take longer than classifyTimeout, so the request failed and
nothing was kept, and every other request waited behind it.
Now find.go cuts a long text into pieces of at most 12 KB (pieceSize).
Each piece overlaps the one before by up to 1 KB, cut after a line's
end where there is one, else after a space, else at a rune's start.
- Each piece is cached on its own, so a request stopped part way and
sent again asks only about the pieces not done yet.
- Spans are shifted to the text's offsets and merged: overlapping
spans become one with the longer one's label, and same-label spans
that touch are joined.
- pf-serve gets one chunk per call. The turn is given up between
chunks, so a short request waiting for the model goes next instead
of after the whole long one.
Run:
- go test -count=1 ./internal/pii/: ok.
- gofmt -l and GOOS=linux/windows go vet ./internal/pii/: clean.
- go test -count=1 -timeout 45m ./internal/pii/... ./internal/gateway/...
at f8b58fb48 (this change on origin/main
|
||
|
|
16f6e568f4 |
gateway: masking's time no longer counts toward the 2 minutes before routing (#3682)
yunwang2442-creator: a 480 KB request the local masking model takes 90s
over on an RX 470/580 (more on its CPU, and more behind the requests
ahead of it in the model's one turn) was answered 504 at unroutedMost,
2 minutes from its arrival, its masking cut off, and the same again
each time it was sent.
unroutedMost now counts the request's time other than masking: a
masking (noteMasking), its wait for the model's turn with it, is
tracked like the known waits, and most's timer (checkMost) looks again
when the last masking ends, with what is left. unroutedUnknown is as
before.
Reconciled with
|
||
|
|
dd5b0ab311 |
pii: a GPU too slow for one request is tried again, and a lost GPU comes back without a restart (#3682)
yunwang2442-creator's RX 470/580 (Vulkan): a 480 KB request ran past
classifyTimeout, magpie ended pf-serve, and classifyTurn set srv.cpu on
any GPU error. Nothing cleared it short of a restart of magpie, so every
request after it ran on a CPU about 3x slower. A slow request is not a
lost GPU.
Now:
- ended for taking too long on the GPU (h.slow), the try again is on
the GPU; a second one in a row is a lost GPU, and the CPU is tried;
- a GPU that dies answering, or whose load hangs (
|
||
|
|
c84f859dd0 |
pii: the GPU tests start pf-serve-vulkan off macOS, so they pass on Linux (#3741)
TestFindJoinsTextsAndMapsBack, TestGPUDeathMovesToCPU, TestServeStartsWithoutResidencyHeartbeat and TestWarm were red on ubuntu CI (run 40351272355 at |
||
|
|
7279bdc28b |
pii: pf-serve-vulkan runs its MoE in 2048-token chunks unless the user set PF_MOE_CHUNK (#3682)
yunwang2442-creator (#3682, Windows, RX 470/580-class 8 GB GPU through Vulkan, q8 model): with privacy-filter.cpp's default PF_MOE_CHUNK (4096) a 480 KB text took 159s and was killed at classifyTimeout's 150s; with 2048 it took 90s, and 2048 was 1.77x faster at every size from 24 KB to 480 KB and the fastest of 1024/1536/2048/2560/3072 on 48 KB. What PF_MOE_CHUNK is (privacy-filter.cpp at the pinned 735a6c286, src/model.cpp and docs/cpu-perf.md): the MoE FFN runs over the window's tokens in chunks of this many; per-token, so exact (no halo). Its default is the forward window (4096), where it is inert. So 2048 changes speed only, not what is found. Measured here, M4 Pro, Metal, the real pf-v2 pf-serve and q8 model run directly (not through magpie, ~/.config/magpie untouched), interleaved A/B, two rounds of two runs, at load ~250 from other sessions: 24 KB: 4096 0.40-0.43s, 2048 0.44-0.45s, 1024 0.49-0.66s 96 KB: 4096 1.86-1.92s, 2048 1.98-2.15s, 1024 2.22-2.27s spans the same (5) at every setting. So 2048 is ~6% slower on Metal: magpie sets it for pf-serve-vulkan only. macOS's Metal pf-serve and the CPU's keep the engine's default. A PF_MOE_CHUNK in magpie's environment (set, even empty) is the user's and is inherited by every pf-serve, never overridden (moeChunk). Run: go test ./internal/pii/ -run 'TestVulkanServeGetsMoEChunk| TestServeStartsWithoutResidency' (ok). The full ./internal/pii/... ./internal/gateway/... run is recorded on the last commit of this stack. Broken by hand: moeChunk ignoring the user's value -> the "user's own" case red (2048 where 3072 was set); moeChunk never matching Vulkan -> the "vulkan" case red. Not tried: a real Vulkan GPU (none here; the 1.77x is the reporter's measurement), an NVIDIA or Intel GPU through Vulkan, where 2048 may be slightly slower as on Metal. |
||
|
|
b9ab172318 |
routing: a seat whose model costs nothing says free, not "100% used" (#3763)
On the Routing page a seat serving a model its vendor gives away (Weighed.free, OpenCode Zen's *-free models under Free first) read "100% used" with a full bar: the account's windows are what the rest of it costs, not this model, so the one seat that can always answer looked spent. Its row now says "free · costs nothing" (zh, zh-TW, ja, de too) and draws no bar. A resting free seat still says its rest first, and a paid seat beside it still says its share. MYCF711's patch (pr/free-seat) built the case on free seats with no routing, which the gateway never sends: .free is set only where weighRouted weighs by it, so a real free seat always carries its routing and read "100% used", not "all but used up". The test is built on that real shape. Not taken from the patch: the green status colour (UI restraint; the word says it) and the `low` change, which no real free seat reaches. Their German string would have failed their own test's /verbraucht/ check; this one is "kostenlos · zählt nicht zum Kontingent". Run: tests/routing-free-seat.test.cjs (new), chromium and webkit, en/zh/zh-TW/ja/de at 1100px and 420px, 22/22. go test ./internal/gui -run 'CoreScriptBudget|I18n|Strings|Plugin' ok. The routing, panel-routing and i18n GUI files ran at concurrency 6 under load 280-300 from other sessions: 49 timeouts in 12 files, none of whose fixtures has a free seat, and the run was stopped there. Those 12 files again, one at a time: 50 ok, 5 red in two files: routing-intent-entry's "Add a rule makes a rule by intent" at 1100px (red the same alone on origin/main |
||
|
|
a6d7e02c77 |
gui: a page wheeled right after a click scrolls on macOS 13's WebKit too (issennknight on Discord)
issennknight (macOS, trackpad): every page scrolled again, but a saved profile opened on the Agents page and then scrolled through often stayed where it was. macOS 13's WebKit scrolls a view under wheels it never dispatches, so the view guard puts each such scroll back and takes three put back the same way within a second as the reader's run ( |
||
|
|
ca9b5048e3 |
routing: a request tried on many keys keeps its steps in a box of 200px, so the list below stays where it was (#3764)
A trace tried on 40 keys says a line or two a key, so .rt-steps grew to ~2500px and pushed the request list a screen down; clicking between it and a one-key request moved the list by that much each time (hheei's analysis in #3764). The list now holds at most 200px (eight or so steps) and scrolls in itself; short stories start at its top as before. jayswu's patch (their branch gui/cap-routing-steps-height, ported here since the repo takes no outside PRs). One change to it: a different request's story starts scrolled to the top, and that reset now runs before renderSteps' "nothing changed" return. In the patch it ran after, so two requests whose stories read alike (the same keys refused the same way) kept the first one's scroll. Run at base |
||
|
|
7395b7b77e |
gui: magpie's "API key" and "Signed in" labels aren't hidden as accounts
outloudvi on Discord: with Hide accounts on, the Plugins page blurred
"API key" in Kiro's summary ("…or an API key"). A plugin's account with
no name is labelled "API key" or "Signed in" by pluginLabels (with
" (2)" for a second one), and every account name was hidden wherever it
appeared, so any sentence with those words was blurred too. They are now
in NOT_ACCOUNTS, the " (n)" slot suffix stripped before the check. A
key's tail ("API key …abcd") is still hidden.
Run:
- account-mask.test.cjs, with Kiro accounts "API key" and
"Signed in (2)" and a sentence holding both words: 4/4 (chromium,
webkit, en, zh). On the old app.js it is red 4/4.
- privacy-hides-accounts, account-eye, window-mask, mask-emails and
account-alias: 68/70 at load ~200. The reds were different webkit
subtests each run (5s timeouts in account-alias and account-eye), so I
counted them as load and didn't file them.
- i18n-keys 4/4; go test ./internal/gui -run Budget ok.
Not run: the whole GUI suite, and the change in the real app.
|
||
|
|
865df24727 |
gateway: a Chat stream's tool calls sent by turns are read by index, one call each
mysterious_dove (Discord, on |
||
|
|
d157700a0a |
gateway: a request naming no reply limit asks DeepSeek, and a translated one any vendor, for the model's own
xuanwo on X (tweet 2114748847167815951): Codex on DeepSeek kept ending
"stream disconnected before completion: Incomplete response returned,
reason: max_output_tokens". Codex names no max_output_tokens, magpie
relayed its turn to DeepSeek's /v1/responses as it came, and DeepSeek
reads no limit as 8K without thinking and 64K with it (its
create-chat-completion docs: "When not set, the default is 8K in
non-thinking mode, 64K in thinking mode"), where deepseek-flash and
deepseek-v4-pro give 384K (393216, its /v1/models and pricing page).
Reproduced on api.deepseek.com with the owner's key: deepseek-flash,
effort none, no limit: status incomplete, reason max_output_tokens, at
8192 output tokens; with max_output_tokens 393216: completed at 17602.
- Relayed or translated, a request naming no reply limit, to DeepSeek's
own API (api.deepseek.com, shortByDefault), is sent the model's own
limit (askedOutput: the user's Max output, else the vendor's list or
models.dev, within the window), in the client's words: Responses
max_output_tokens, Chat max_tokens, Gemini generationConfig.
maxOutputTokens. A relay serving DeepSeek's models elsewhere goes as
it came: its default isn't DeepSeek's.
- Translated onto a vendor's Chat or Responses (fillsOutput), a request
naming none is sent the model's own, as on Anthropic's since #1792:
the client's API reads none as the model's whole, a vendor's needn't.
Not for an account's own backend (the ChatGPT one turns
max_output_tokens away) or another magpie (it fills its own). A
vendor that turns the filled figure away ("max_tokens" in a 400/422
that isn't the window) is asked again naming none, and from then on
(outputFillRefused).
- The window: DeepSeek counts the reply asked for in its 1M window. The
existing room retry (replyLeft) asks again for what the window left;
withReplyCap now also adds the field to a Gemini body, which it
couldn't before, so a Gemini client's long conversation isn't
refused where DeepSeek's default fitted.
- A limit the client named goes as it is, everywhere. A reply DeepSeek
cuts on length still reaches Codex as incomplete / max_output_tokens
(relayed as DeepSeek says it; translated by responses.go's length
stop), unchanged.
Tests: TestShortDefaultAsksTheModelsOutput (DeepSeek relayed on
Responses and Chat, the client's own limit kept, a Gemini client
translated, and a relay's Responses and Chat with the same model sent
no limit), TestTranslatedAsksTheModelsOutput (Codex onto a Chat-only
vendor: the catalog's 65536; the client's 700 kept; a vendor refusing
past 32768 is asked again naming none, and not filled again).
Broken by hand: withOwnOutput returning the body as it came turns the
two DeepSeek relayed cases red; fillsOutput false for Chat/Responses
turns the translated case red; the refusal retry off turns the refusal
case red (400 to the client).
Real run (sandbox HOME, only the owner's DeepSeek provider copied, this
build serving on 127.0.0.1:3481): a streamed Codex-shaped Responses turn
to deepseek/deepseek-flash naming no limit, asking for ~17K tokens:
response.completed, 17602 output tokens (8192 and incomplete before, as
above). A 699015-token Codex turn: DeepSeek refused 393216 against its
1M window, magpie asked again with max_output_tokens 349561 (the window
left), response.completed.
Run: gofmt -l clean; go vet ./internal/gateway on darwin, linux and
windows; go test ./internal/gateway (whole package) -count=1
-timeout 45m: ok (465s) at base
|
||
|
|
479de89001 |
gateway: Codex's model list is asked of the backend once for every app-server, and kept, so it comes within Codex's 5 s (#3734)
#3734: with ~20 Codex app-servers starting together, Codex logged "failed to refresh available models: request timed out" 1,906 times a day, fell back to its default metadata for magpie's groups (no supports_search_tool), and inlined ~1,075 Apps tools: ~500K input tokens a turn. Each /backend-api/codex/models asked the ChatGPT backend on its own, and gave its ask up at codexModelsWait (3 s). Measured with a minimal gateway (gateway.New().Handler() alone, sandbox HOME, no providers), 20 lists at once with a real ChatGPT sign-in's headers, as app-servers ask: - |
||
|
|
80857a66c9 |
provider: a window's runsOutAt reaches /v1/magpie/quotas and magpie quota --json (#3762)
QuotaWindow has carried RunsOutAt/RunsOut (when the soonest of what is left is lost apart from the reset, and how much) since WorkBuddy's credit packages, but quotaReport builds each QuotaSpan field by field and had no such fields, so the report /v1/magpie/quotas and `magpie quota --json` tell dropped them. A free WorkBuddy account, whose credits have no reset at all, said nothing there of when they end. The issue also says the Usage page and tray miss it. They don't: the GUI reads /api/usage/quotas, which sends SubscriptionQuota/QuotaWindow as they are, so its card already had runsOutAt. The affected surfaces are the quotas API and the CLI's JSON. The CLI's text table still shows no run-out column; not changed here. TestQuotaSpanCarriesEveryWindowField walks QuotaWindow's JSON fields: each is on QuotaSpan or named as left out on purpose (resetSecs, family, credits, capped, capsSome, capId, startsAt, each with why), and a window with every field set comes out with every QuotaSpan key set. A field added to QuotaWindow can't be dropped again without a decision. Run: go test ./internal/provider/... (ok, with TestUnreadLoginsWriteErrorsKeepCredentials skipped: known synctest crash #3632, crashed the same way unskipped); go test -run Quota ./internal/gateway/ ok; gofmt -l clean; GOOS=linux go vet -tags nogui and GOOS=windows go vet ./internal/provider/ clean. Broken by hand: quotas.go at origin/main: both new tests FAIL (field missing). Fields on QuotaSpan but not copied in quotaReport: both FAIL ("quotaReport leaves it empty"). Not tried: a real WorkBuddy account; the fixture is the plugin's window shape from the issue (workbuddy 0.1.35, free plan). Co-authored-by: MYCF711 <MYCF711@users.noreply.github.com> |
||
|
|
5b4dec58e4 |
providers: a vendor's keys saved a provider each are one provider with those keys
yuluo_yx on X: "NVIDIA #595"…"#600" at integrate.api.nvidia.com and "Mistral #0001"… at api.mistral.ai were a provider each on the Providers page and a row each on Routing, and with thousands of keys magpie started slowly. They came from an app that keeps an entry a key (CC Switch) imported in one batch: ImportFromApps only offered "add as another key" against providers that existed before the batch, so each entry became a provider of its own (nvidia, nvidia-2…). Fold (internal/provider/fold.go): - FoldCopies runs in startUp, before anything lists the providers, so every user who has such copies already finds them folded. Automatic, not a one-click offer: they are the same account's keys at the same address, what the user wanted is one provider (zero-config rule), and nothing is lost: each copy's id goes in the provider's Was, so its calls count with it by key (ProviderKeyID is the key's fingerprint, unchanged) and a model picked by the old id still resolves. - Only copies by name fold at start-up: a base name and that name with a number after it (" #12", or freeName's " 2"), at least one numbered. They must also be alike in all but the key: the provider with id, name, keys and on/off left out, their per-model settings, and every place that names them (Visible, picked/hidden/ordered models, groups, fallbacks). A copy shown to one agent alone, given its own models or settings, or named by the user ("Home relay" / "Work relay") stays apart. Subscriptions, hidden ones, Vertex and StepFun-signed ones are never folded. - The first copy that is on takes the rest; it is named the base name ("NVIDIA") and its key keeps its old name. Others become keys in the providers' order, named as they were, off if they were off. - Group members, weights, rules, classifier, pick and fallbacks name the provider once; per-model settings and fetched lists of the folded ids go; balance and window history kept by their id moves to their key's name, where a provider with several keys reads it. - A providers.json that doesn't parse is left alone (read() would have given its .bak, and a fold would write that over it). - ImportFromApps folds what one import added by shape alone, whatever the entries are called. Routing needed no change: a provider's keys for one model already fold into one row ("2400 keys"), opened on click (FOLD_AT, #1319). Numbers, sandbox HOME with 2400 NVIDIA + 600 Mistral copies (gen.py, NVIDIA preset + 2 models, Mistral 15 models), `magpie web`, every outgoing request through a dead proxy: - before (origin/main |
||
|
|
13cca81099 |
codex: /fast reaches a group or model whose fast mode isn't a ChatGPT account's
cute_lynx_36404 (Discord #feedback): turning on GPT fast mode (/fast, 加速)
inside Codex did nothing through magpie; only the Routing page's fast
default worked.
Cause: Codex sends service_tier only on a model whose catalog entry lists
it (codex-rs ModelInfo::service_tier_for_request drops any other).
provider.CodexTiers listed Fast on a routing group only when a member was
a ChatGPT account's gpt- model, and on a model of its own only for
codex/gpt, a relay's GPT (OwnTier), another magpie and plugin tiers. A
group whose fast members are an OpenAI or Anthropic key, Cursor, a
plugin's priority model or a relay's GPT, and an Anthropic key's Opus on
its own, were offered no tier, so Codex never sent one. The gateway
already takes the client's service_tier per request and says it in each
member's words (priority on OpenAI/ChatGPT/relays, speed fast for Opus on
api.anthropic.com, Cursor's fast variant, a plugin's tier) or drops it
where the member has no fast mode; the Routing default went another way
(the member's own fast), which is why only it worked.
Now a group with any provider.CanFast member is offered Fast through
m.Tiers ("priority"; m.Fast still means a ChatGPT member, which also
drives MultiAgent v1), and so is a model of its own that CanFast and no
tier above names. codexcat uses the named tiers for a provider added by
address when Codex's own entry has none for it (Opus behind an address
on api.anthropic.com). The served tier is recorded as before
(TierAsked/TierSent/TierServed); magpie prices no tier differently, by
the Routing default or by the client, which this doesn't change.
Run:
- TestCodexFastOfferedWhereAMemberHasIt (new, internal/gateway): red with
CodexTiers reverted (group/hard and an/claude-opus-5-5 list no tier),
red with only the codexcat line reverted (an/claude-opus-5-5); green
now.
- go test ./internal/codexcat; -run 'Tier|Fast|Codex.*Catalog|CodexList'
in internal/provider, internal/agent, internal/gateway: ok.
- Real codex-cli 0.162.1 in a sandbox HOME/CODEX_HOME, model_provider
magpie on a fake Responses upstream, catalog from codexcat.Catalog:
group/hard (Fast listed) with service_tier="fast" sent
service_tier "priority"; without it, none; group/cheap (no fast
member) with fast on sent none.
- go test ./internal/gateway/... ./internal/agent/... ./internal/provider/...
./internal/codexcat/... -timeout 45m at this tree, on origin/main
|
||
|
|
834935149a |
routing: a request still going is patched in its row, not made again, so the page holds still under traffic (#3731)
gpboyer2 (#3731, v0.1.1579): with requests coming, the Routing page kept redrawing, its stage, caption and request list jumping so nothing could be read; idle it was still. Measured on main |
||
|
|
e9c1066c4b |
gui test: the README bird's leave is measured at the swap
TestPluginReadmeBird read the leaving box and the README's top after
"Paragraph 11." showed. By then the dialog had moved some frames on
its spring (holdModal) while the box stays where it was, so the two
were 4.5 to 5.5px apart in webkit, over the 4px bar: 1 of 6 alone on
origin/main
|
||
|
|
2bde657591 |
gui test: a gateway key's narrow check waits for the header to fit
TestGatewayKeyLimit read scrollWidth right after setViewportSize. The
header's tabs are fitted by fitTop from a ResizeObserver, a moment
later, so the read could still see the 1100px layout's nav.seg
(right edge 597 in a 560px window). webkit en was red 3 of 3 alone on
origin/main
|
||
|
|
ed5cc959a7 |
gui: every slow page's skeletons get magpie's bird hopping bar to bar
The owner, after the Plugins page's README bird ( |
||
|
|
9809a8ac9a |
gateway: Codex side calls go at an effort the model takes, and a refusal for no effort is asked again at low
cybercaius on Discord: Codex's side calls are meant to go at low effort,
but some went with none or no effort, and the upstream answered 400 as
the model needs one.
Cause, from Codex's source: a title asks low only on Codex's own title
model (gpt-5.6-luna, thread_title.rs `(model == THREAD_TITLE_MODEL)
.then_some(Low)`); on any other model, a magpie one included, it sends no
effort. The auto-review (guardian select_review_model) asks low only when
the model's preset lists low, else the preset's default, and codexcat
writes no levels and no default for a magpie model whose levels aren't
known, so it too goes with none. magpie fitted an effort asked to the
model's levels but never added one that was absent, and its off-effort
retry fired only for none/minimal refusals that list levels.
Fix:
- codexSideEffort: a title, description, summary, prediction, auto-review
or memory call on one of magpie's models whose levels are known, asking
no effort or an off one the model hasn't, is asked at its lowest on
level (onEffort: low where it has it). Groups, other efforts and models
with unknown levels go as asked.
- serve, forwarded and translated (Chat and Responses, not Anthropic):
a 400 whose body says an effort is required (effortRequired: "reasoning
effort is required", "missing required parameter: reasoning.effort",
"requires a reasoning effort", "reasoning cannot be disabled") to a
request that asked no effort or none is asked again once at onEffort.
Any other 400 goes back as it came, asked once; a none that was refused
is remembered (offRefused) as before. A no-effort refusal isn't
remembered, so a model with unknown levels pays the 400 each time.
Ran (at this head, rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/... ./internal/agent/...: ok (gateway 521s, agent 316s), at the pushed tree (2ca0da8e5 before this body was written), base
|
||
|
|
81a73c1c01 |
gateway: a Codex title that comes before its conversation's first turn follows the model just switched to
cybercaius on Discord: after switching Codex to another model, the first
new conversation's title was still written by the model before.
Cause: Codex writes a title on a temporary thread of its own
(tui/src/app/thread_title.rs, thread_source "thread_title"), with no
parent link to the conversation, started as the first message is sent and
so racing that conversation's first turn. codexLeads.of found neither a
parent nor its own thread and took the key's last turn, which, when the
title came first, was the previous conversation's, on the old model.
Composer predictions run on a fork and named it (forked_from_thread_id),
which of() never read, so they too took the key's last turn rather than
their conversation's.
Fix: of() reads the forked-from thread. The app's side turns (titles,
descriptions, summaries, predictions) read through codexLeads.sideOf: a
call tied to no thread magpie has seen, whose key's last turn is older
than 3s, waits for the next own turn (a channel saw() closes), up to 5s
or the request's cancellation, and takes that turn's model. Subagents and
memories keep codexSessionOf with no wait: they carry their lead's
thread. The auto-review follows the session only through codexcat's
per-entry override, and compaction goes on the conversation's own turn
model, so neither reads codexLeads.
Ran (at this head, rebased on origin/main):
- go test -count=1 -timeout 45m ./internal/gateway/... ./internal/agent/...: ok (gateway 521s, agent 316s), at the pushed tree (2ca0da8e5 before this body was written), base
|
||
|
|
e52a5e50ba |
redact: a request opens by its key again; the key goes to the GUI as a string
The owner opened the newest masked request and got "This request's
record is gone: records are kept for 30 days", and a request opened from
the list said its whole text was no longer in memory. A record's key is
its time in nanoseconds (~1.79e18), past 2^53, so JSON.parse rounded it
to 256ns: /api/masking/record?key= and /api/masking/sent?key= looked up
a key no record has. A list row worked only because it carried its
record. Every way in by key failed: the Gateway page's and tray panel's
masked badge, ?key= in the address, and each request's sent text; the
list's before= paging was off by the rounding too.
gateway.Masked's key and /api/masking/record(s)' key now go as JSON
strings (",string"); records on disk keep their number. The page keeps
the key a string (no unary +), and a refresh compares keys as BigInt.
Tests: TestMaskedRequestIsRecorded and TestMaskingRecordsAPI check the
key is a string, and masking-records' fake API uses 19-digit string keys
in place of 1001-1005, which no rounding touched.
Broken by hand: with the Go change out, both Go tests fail ("key not a
string"); with the page.js/client.js change out, "chromium: a masked call
on the Gateway page, and a key in the address, open its request" fails.
Run: go test ./internal/gui (twice ok; a first run under load ~180 went
red with its log cut by tail, so the test is unnamed; two reruns with
the whole log were ok), ./internal/gateway ok, ./internal/maskrec ok;
GOOS=linux/windows go vet ./internal/gateway ok; GUI masking-records,
routing-bodies, i18n-keys: 96 of 96 ok, both engines.
Not tried: the real app with a real masked request.
|
||
|
|
29f1a5a717 |
redact: a request's steps are joined number to number, not by a dash before each
The owner's screenshot of a masked request showed a short dash left of steps 2 to 5. The connector (li + li::before) was 10px wide at left -10px, so it covered only the grid gap, and read as a stray dash beside each number. It now runs from the number before to this one, 6px clear of each (columns are equal, 10px apart, numbers 20px). masking-records' request test measures each line's ends against the two numbers: 6px from each. Run: masking-records.test.cjs whole (both engines, every language, 1100 and 640px), 82 of 82 ok. At 640px (container under 760px) the lines stay hidden, as before. |
||
|
|
51202cd431 |
plugin: a check-in outcome magpie doesn't know names what the plugin said
A plugin check-in that answered an outcome not in the list, with a message, became failed with the plugin's message alone, so "the daily credits were refreshed" read as magpie's own failure reason. The reason now names the answer first: the plugin answered "yes": <message>. With no message it stays "the plugin answered no outcome" or the answer. Split out of skygunner's fix/usage-absent-used branch (#3650), which carried it beside the usage fix. Run: go test ./internal/provider -run TestPluginCheckinRunsAsTheBuiltinsDo ok. Broken by hand: host.js's old line makes it red (Msg was the message alone). Not tried: a real plugin answering an unknown outcome. Co-authored-by: skygunner <skygunner@users.noreply.github.com> |
||
|
|
9733ed1b4a |
usage: a plugin window that doesn't say used is no reading (#3650)
A plugin usage window that leaves out `used` was read as 0 in host.js
usageOf. The card then showed "100% left" (or NaN% once the GUI saw a
missing value), and allowanceOf ranked the account as the one with all
of its allowance left, so smart routing put spent accounts first.
Now a left-out used is null from the host, plugin.UsageWindow.Used is a
*float64, and quotaOfPlugin makes such a window Text and Aside: the card
shows its display (else "No allowance reported"), with no percentage and
no meter, and routing leaves it out. An account whose windows all tell no
share has no allowance and is not known to routing (routedAllowance), as
one never read: not preferred and not rested. A window that says used:0
is a reading at 0, as before.
Ported from skygunner's fix/usage-absent-used (6791aa99). Changed from
the branch:
- lastAllowances (the reading kept on disk) built an empty allowance for
such an account, which routing read as known with all of it left. Both
it and Allowances now go through routedAllowance.
- quotaText shows "No allowance reported" for a no-share window with no
display, rather than a blank.
- A host-level test (the bun host with the fake plugin) and the GUI test
widened to both engines, every language, 900 and 390px, used and left.
- The branch's check-in wording change is its own commit.
Note: an account whose windows are all aside or text was known with 0%
used before; it is now not known, so loginRoom won't pick it as the
next account with room.
Run at this tree (base
|
||
|
|
43001be863 |
gateway: a relayed Chat body's unpaired tool calls are paired before Kimi sees them
Paidaixinbao on X: Qoder through magpie on Kimi Code, a conversation forked at an earlier turn fails on every prompt while a new one works. A Chat client's body to a Chat upstream was relayed as-is, and only translated requests had their tool exchanges mended (pairToolMessages). A forked or stopped history can hold a call with no tool answer, calls split over two assistant messages, a user turn between a call and its answer, or an answer to no call. Kimi turns the whole request away with 400 "an assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'..." or "tool_call_id is not found". toolPairsOut now pairs such a body on the Chat relay (joining split calls, answering the unanswered, turning an orphan answer into user text); a paired body goes out byte for byte. Run: - Real Kimi Code API (kimi.com/coding/v1, 2026-10-26; the account's plan has lapsed, so a body past validation answers 403 and a refused one 400): unanswered call, split calls, user between call and answer, one of two answered and an orphan answer are each 400; every one of them after toolPairsOut is 403, past validation. A tool turn without reasoning_content, null content, repeated ids, out-of-order and double answers, prefill and a reasoning field all pass as-is, so they are not the cause and are left alone. - gofmt -l clean; go vet ./... on darwin, GOOS=linux -tags nogui and GOOS=windows. - go test -timeout 45m ./internal/gateway: ok, at this commit. - Two fixtures held an unpaired body only by accident and are paired now: image_input's chat-tool case (a lone tool message) and the large-chat upstream golden (its last call left unanswered); the new large-chat hash is the same on the old code. Broken by hand: without the toolPairsOut call all six subtests of TestChatRelayPairsToolsForKimi go red against a fake Kimi with Kimi's own wording; without joinSplitChatCalls the split case goes red; reading only string content in toolAsUser turns the parts case red. Not tried: the real Qoder app and the reporter's own forked history, so which shape their fork holds is not proven; Qoder's "unsupported request" text is not magpie's wording. A real Kimi model answer (the plan has lapsed, only validation was seen). A non-Kimi Chat upstream, though the rule is OpenAI's too and runs for every Chat relay. |
||
|
|
de54b4ff99 |
codex: threads started on OpenAI are listed while magpie is Codex's provider
notnico64 on Discord (Linux, magpie desktop): with Codex connected to
magpie, `codex resume` said "No sessions yet". Codex's resume picker
(tui/src/resume_picker.rs picker_provider_filter) lists only threads
whose model_provider is the one Codex is on now, with no opt-out, and
the filesystem scan checks each rollout's session_meta, not just the
state DB row. With no ChatGPT sign-in (also an API key, magpie API, an
account out of allowance, another machine/WSL) magpie writes
model_provider = "magpie", so every thread started on "openai" vanished
from the list. Nothing in it is Linux-only; macOS does the same.
Now, when magpie becomes Codex's provider and Codex was on OpenAI
before (not on a provider of the user's), the threads on "openai" move
to "magpie": the state DB row and the rollout's session_meta, rewritten
in place (both ids are 6 bytes), the file's mtime kept so the picker's
order holds, with no trash copy. At the Disconnect bringBack relabels
them back the same way before its usual mover. Threads Codex has
already packed (.zst, a week after the last turn) are left alone:
rewriting gigabytes of history at a switch isn't worth it (the owner's
~/.codex/sessions is 51GB, 11,591 of 12,255 rollouts packed). Files
written within ActiveWindow, outside this Codex home, or without their
id in the name are skipped too.
Run:
- Real Codex 0.162.1 in a sandbox HOME/CODEX_HOME (never ~/.codex):
without model_provider the picker listed only the openai thread;
with model_provider = "magpie" only the magpie one (the report).
After RelabelCodexThreads(home, "openai", "magpie") the same picker
listed both threads.
- TestCodexThreadsFollowMagpieIn (new) is red on the old code:
"connected: thread ...c1 on "openai", want "magpie"".
- go test -tags nogui -timeout 45m ./internal/agent ./internal/sessions
at this head: ok agent 480s, ok sessions 41s (rebased on
|
||
|
|
9298d2a7c3 |
cli: prompts read the stdin Windows' console init reopens, not the one package init saw
tom047784 (Discord, Windows desktop build): `magpie plugin login` in a
terminal failed with "read /dev/stdin: The handle is invalid". The
desktop build is a GUI-subsystem binary; console_windows.go's init
attaches the parent console and reopens CONIN$/CONOUT$ into os.Stdin,
os.Stdout and os.Stderr. But `var stdin = bufio.NewReader(os.Stdin)` in
backup_cmd.go is a package variable, set before any init runs, so it
kept the invalid handle.
That one reader serves every CLI prompt, so all of them broke the same
way: plugin login (askPrompt, askNumber, the code and pasted callback
lines), backup/WebDAV passphrases and passwords piped in (secret), the
library and quota confirmations. stdin is now a func that makes the
reader over os.Stdin as it is when read, and remakes it if os.Stdin
changed; one reader still serves a run, so a second piped secret is
still the second line.
Sibling of the same class: lipgloss's default renderer (termenv's
default output) is made over os.Stdout at its package init, before the
reattach, so the desktop build's CLI printed every style without colour.
The init now points that renderer at CONOUT$ in place; the styles made
at package init hold it. A grep for package-level os.Stdin/os.Stdout/
os.Stderr found no other one in the repo (writers like fmt.Println and
json.NewEncoder(os.Stdout) inside functions resolve at use time).
webdav_cli_test's piped() swapped both os.Stdin and the reader, which is
why no test caught this; it now swaps os.Stdin only.
Run (at this tree, worktree off origin/main
|
||
|
|
b3729b8d56 |
redact: a model's or a toolchain's name the local model takes for a secret goes as written
The owner's 脱敏 page showed groqAPIModel = "llama3-70b-8192" masked as
a secret by the local model. The real model, asked again, also takes
claude-3-5-sonnet-20241022 beside it for one. namesThing now holds
modelName: lower-case words joined by dashes with a size part (70b,
8x7b, 32k), an eight-digit date part (20241022) or a yyyy-mm-dd date
(nightly-2026-09-01). A diceware passphrase (correct-horse-battery-
staple) or maple-4-river-77 has neither and is still masked.
The page's other value, nightly-2026-09-01 as a name, was recorded by
the running v0.1.1370 (10-24). The model labels it private_person, and
main already drops it (a name with a digit, a word in lower case, since
|
||
|
|
4e3078ee47 |
agents: a Codex thread started on any provider table goes through magpie when reopened, not only CC Switch's
A report the owner relayed from WeChat (10-26): in Codex, with apikeyfan's gpt-6.1-sol on, an old thread failed every turn with "unexpected status 404 Not Found: Model "apikeyfan/gpt-6.1-sol" is not supported by any configured account in this group, url: https://slb.apikey.fan/responses". A new thread worked, and updating magpie didn't help. The url is Codex's own call: Codex reopens a thread on the provider it was started on, and that thread's table pointed straight at the relay (no /v1, so not a table magpie wrote), so the magpie model id went to the relay. |
||
|
|
4a33cf0a98 |
update: a Stable channel in Settings → About, and magpie update channel
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading.
Settings → About → Update channel (zh: 更新渠道, 稳定版 / 每个版本) picks
Every version, the default and today's behaviour, or Stable: one version
a week, the newest that had been out three days as the week began
(Monday 00:00 UTC), and an urgent release at once. usemagpie.ai chooses
it from the release list (the previous commit); a release is urgent when
a line of its notes starts with "**Urgent release:**", which
magpie-releases' release run writes from an `Urgent: <why>` trailer
(magpie-releases 73f6cff).
- settings: updateChannel, "" or "stable"; anything else is refused.
- update: on Stable the feed is asked with channel=stable; What's new
shows every release since the installed one (up to 1500) instead of
the newest 40, so a week's notes read as one list.
- gui: the row is segs, never a <select>; a save that doesn't send the
channel keeps it; switching asks the feed again at once, and a
download from every version newer than Stable's pick is dropped,
never restarted into. What's new's notes are kept per channel.
- cli: magpie update channel [stable|every] ("all" too), and it says
which with nothing after it.
- docs: reference.md's Update channel (the rule and the marker); the
privacy pages (en, zh, ja) name ?channel=stable on /api/latest.
The full Go and GUI suites were not run: the disk was at 3 GB free and
other sessions had GUI suites and a 45-minute gateway run going the
whole time.
Run, at this tree before the rebase:
- gofmt -l (clean); go vet on darwin, GOOS=linux -tags nogui and
GOOS=windows for ./internal/update/... ./internal/cli/...
./internal/settings/... ./internal/gui/.
- go test -count=1 ./internal/update/... ./internal/cli/...
./internal/settings/...: ok. ./internal/gui -run
'TestUpdateChannelSwitch|TestWhatsNewKeyedByChannel|TestCoreScriptBudget':
ok (the app.js budget passes).
- GUI, chromium and webkit: update-channel (22: en, zh, zh-TW, ja, de at
900 and 420 wide: default lit, Stable saved, kept by another save,
kept over a reload, Every saved back, no click scrolls, no sideways
scroll at 420), i18n-keys, gui-ja, gui-de, gui-zh-tw and every
update-*.test.cjs: 253 of 253 pass.
- The live feed: /api/latest?channel=stable answers 0.1.1327 (out
2026-10-22 21:55 UTC, the last before Friday 10-23 00:00) with 15
assets after the first real cron run filled the ledger (400 releases
back to 10-10); /api/notes 0.1.1200..0.1.1327 gives 124 notes, none
empty (1213 and 1218 were never published).
After rebasing on
|
||
|
|
8f4469954e |
site: a Stable update feed, a release a week and an urgent one at once
ssharpcc on X reads every changelog before updating, for fear of a ban
when behind, and with many releases a day that is a lot of reading. This
is the feed side of Settings' Update channel: /api/latest?channel=stable.
How Stable is chosen (stableOf, from the release list, never by hand):
- as each week begins (Monday 00:00 UTC), the newest release that had
been out three days by then (published <= Monday - 3 days);
- an urgent release is Stable as soon as it is out, until a weekly pick
passes it.
A release is urgent when a line of its notes starts with
"**Urgent release:** <why>" (quoted or not). GitHub releases are not
marked pre-release for any of this.
GitHub's newest 100 releases are about a day of magpie, so a KV ledger
(LEDGER, usemagpie-ledger) keeps 45 days of {version, published, urgent}
and each day's notes, filled by a cron every 15 minutes: the API's first
page (the releases feed when the API says no, keeping the ledger's dates
and API notes), the pages after it while there is a hole, and on back to
21 days, at most four API asks a run, writing only what changed. A
ledger that can't be read is never written over. /api/notes reads a
range older than the newest 100 on from the ledger, so a Stable app's
week of notes comes as one list. Without a ledger reaching the week's
cut, the stable feed answers 503 (no-store) rather than guess. The
default feed, and any other channel value, is unchanged.
Run: node --test site/*.test.mjs (stable.test.mjs 14 new, every clock
held: weekStart, the cut to the second, a week held and moved on, urgent
before/after its time, unknown, the ledger's paging, hole, ask cap,
broken KV, API-limited feed fallback, notes past the 100 newest; the
existing worker and install tests 31 pass). wrangler deploy --dry-run
shows the LEDGER binding.
Broken by hand, each red: no soak, a rolling 3 days instead of the week,
urgent ignored, no ledger notes, a broken read taken as empty, the
feed's date or notes over the API's, notes bucketed by the feed's date,
no hole mending, no ask cap, the index always rewritten, the marker
matched mid-line.
Not tried: a real cron run before this deploy; the anonymous API's
60/hour limit under the cron's asks beyond reasoning (one ask a run once
the ledger is deep).
Requested by ssharpcc on X.
|
||
|
|
afc99490f2 |
plugin: a fetch's body goes to the host in one line made for it (#3472)
Each plugin request was copied several times before it reached the plugin: - pluginFetch read the body with io.ReadAll, which grows from 512 bytes, so a 1 MB body was some 3 MB read. It now reads into a buffer of the request's Content-Length. - Fetch marshalled a map holding the FetchRequest and the body as []byte, so encoding/json base64'd the body into its own buffer and then copied it into the line, and enqueueOwned appended the newline in another copy. fetchLine now marshals the request without the body (FetchRequest.Body is json:"-") and appends the base64 body and window into one slice sized for the whole line; enqueueLine sends it as is. The frame is byte for byte what it was: TestFetchBodyWireIsUnchanged compares it with the old json.Marshal of the map, field order included (request fields, body, window). BenchmarkFetchBodyProd B/op, before -> after: 1 MiB 1,516,234 -> 1,411,609 8 MiB 14.4 MB -> 11.2 MB 16 MiB 29.7 MB -> 22.4 MB Through the gateway with the previous commit (probe, 60 requests of ~938 KB, per request including the test's client and fake vendor): /v1/chat/completions 21.2 MB -> 17.3 MB (24.4 MB before both, -29%) /v1/messages 33.7 MB -> 29.3 MB (39.8 MB before both, -26%) Server.serve's own share on /v1/messages: 29.1 -> 19.0 MB (-35%). What is left on top is buildChat's json.Marshal of the outgoing body, which the upstream byte fixtures pin; not changed here. Run at this head (base origin/main |
||
|
|
9a888323a2 |
gateway: a Chat or Messages request is read for its folder and turn without its history (#3472)
A plugin's request is read for its work folder on every try (tellWorkPlace -> readFacts -> parseIn(proto, body, true)). Only the Responses reader had a facts mode (#3394); Chat and Messages parsed the whole conversation, copying every assistant turn, tool call and tool output, to learn a folder and whether the last turn was a tool's answer. On a long conversation that history was most of what each try allocated. readChat and readAnthropic now take facts, as readResponses does: they decode with decodeJSONView, keep an assistant message as its role alone and a tool result as its kind and call id, and keep the system and user text that workPlace reads. parseChat and parseAnthropicRequest are readChat/readAnthropic with facts off, unchanged. Numbers (1.3 MB body, least of 3 runs, TotalAlloc): Chat facts 980 KB, whole parse 4.5 MB Messages facts 1.08 MB, whole parse 5.3 MB Through the gateway on the plugin path (probe, 60 requests of ~938 KB, counting the test client and fake vendor), per request: /v1/chat/completions 24.4 MB -> 21.2 MB /v1/messages 39.8 MB -> 33.7 MB Retained heap is unchanged (~15-19 MB); this is churn, which is what the reporter's heapSys grows from. Tests: - TestChatAndMessagesFactsAsTheWholeParse: facts give the same folder, turn and tool-answer facts as the whole parse, over the real fixtures (workdir/pi-1.1.0, claude-code-2.1.296, context/claude-code, the upstream_bodies chat/anthropic families), a large conversation and hand cases (model and tool both spoke; answered then a tool; answered then nothing; a tool's result alone). - TestChatAndMessagesFactsLeaveTheHistory: facts allocate under a third of the whole parse. - TestReadersOfAHeldBodyParseItOnce's last check now counts readFacts calls through the factsParsed hook instead of allocation, which the cheaper facts no longer show. Broken by hand, each red then green: dropping the assistant message in Chat facts; keeping only role-less messages in Messages facts; facts off in parseIn (the allocation test); a held-facts lookup matching any entry. Run at this head (base origin/main |
||
|
|
6e6aba51c8 |
providers: a key may be for another plan of its vendor, sent to that plan's endpoints
yckonnnn on X uses Volcengine's pay as you go and its Agent Plan, and wants a key of each in one provider. Each plan takes its own keys at its own endpoints (/api/v3, /api/plan/v3, /api/coding/v3), and every key of a provider went to the provider's one plan, so only one kind worked. A key now may say which of its preset's Regions it is for (KeyAccount.Plan; Provider.KeyPlan for the first key, as KeyProtocol). None, or the provider's own plan, is the provider's plan, stored as none: old configs read and write as before. Presets whose plans take keys of their own (PresetDef.KeyPlans): zhipu, zai, stepfun, stepfun-cn, xiaomi, baidu-qianfan, tencent-cloud, huaweicloud, volcengine, siliconflow. Not: yylx (one key everywhere), bailian-decision (decide only), bedrock and bedrock-mantle (regions of one account). Every reader of the region or a base URL, and what it does now: - WithKey (keys.go): moves the key's copy to its plan (atKeyPlan: Chat, Responses, Anthropic, Decide, KeysURL, Website, Catalog via atRegionOf; a provider at a host of its own keeps that host) and marks it keyView. Every gateway key path goes through it: chat, Responses, Messages, count_tokens, failover, embeddings (serveRetrieval via onKeys), drawing (drawOnAccounts via perKeyBarred), key tests (test.go), key_models.go, gui/groups.go, markedKey. - perKeyBarred (gateway/fallback.go): a key whose plan's list lacks the model (PlanServing) is not asked; only when no key's plan has it. - fetch / fetchPerKey / planOnly (models.go): a mixed provider lists each key's plan, a NoList plan from its preset list with no request, pay as you go from /api/v3/models with its own key. - planMedia (PlanEmbeddings, PlanDrawers, PlanVideos): every plan's. - PlanQuotas (planquota.go): each key read at its own plan's source. - volcPlanQuotas, tencentPlanQuotas: one view per plan (planViews). - KeyBalances (balance.go): each key at its plan's host (SiliconFlow). - startVideo / videoMaker (gateway/video.go): a mixed provider starts on a key whose plan makes the model (onKeys) and names it in the id (keyMark), so the poll goes to that key's plan. - GUI: POST /api/keys/plan (SetKeyPlan, then the lists are read again); the editor keeps KeyPlan with an unchanged first key, typed() clears it with a new one; KeepSecrets, AddCopy, backup's withoutKeys carry it. - app.js: planPicker, a plan chip in each key row (the app's own menu, openProtoMenu, through pickPill, which protoPicker now shares), shown for a KeyPlans preset while the provider has several keys or the key has a plan; i18n zh, zh-TW, ja, de. A key's plan is not guessed from the key: Volcengine's keys carry nothing that says their plan. Xiaomi's tp-, Tencent's sk-tp-, MiniMax's sk-cp- and Bailian's sk-sp- are noted in code but not used. Not done: a gateway key held to some keys (videoAsker) on a mixed provider's video may pick another key; a mixed provider whose own plan has no balance source while a key's plan has one is not read; keys left out for their plan don't show in the Routing trace; StepFun's plan windows are a sign-in per site, unchanged. Credit: yckonnnn on X (tweet 2114657701305487483). Run at this commit on origin/main |