ee031e9539dde2bb42e2a5d5994e7fb4c5479f22
5843
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ee031e9539 |
gateway: a billion-context proxy in front of the provider gets the client's x-bili- headers (#3052)
What changed: forwardOnce copies the client's x-bili-* headers on to the request it builds for the provider, by a biliHeader predicate beside claudeCodeHeader and codexClientHeader — an x-bili- prefix, in the shape of the anthropic-, x-stainless-, x-claude-code-, x-openai- and x-codex- families already on the allowlist. The headers carry the cooperative plugin's name, conversation and context window, never a key; a header no family allowlists, and the client's own key, still stay off. Why: forwardOnce builds the upstream request from nothing and copies only allowlisted headers, so a client talking to a billion-context (bili) proxy put in front of its provider lost the x-bili- ones that name its cooperative session — bili then saw an anonymous session and injected a duplicate set of compression tools beside the plugin's own (#3052). Whether to generalize this into a per-provider "pass-through client headers" setting, beside PassUserAgent (#1851) and a provider's own Headers, is the maintainer's call; this change only admits the family the issue reports. Run: go test -run TestForwardOnceCarriesBiliHeaders ./internal/gateway fails on the baseline with the three headers empty and passes with the change (httptest, no network); ablation (product file back at baseline, test kept) fails again. gofmt -l clean; go vet ./..., GOOS=linux and GOOS=windows go vet -tags nogui ./... clean; native, GOOS=linux -tags nogui and GOOS=windows builds clean; go test -tags nogui ./internal/gateway green. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
f0ff905167 |
gateway: a compaction rule sees Alma's compaction ask (#2833)
What changed: compactAsks in internal/gateway/compacting.go gains Alma's compaction ask, "Merge the previous summary with the new conversation.", which opens the last user message of Alma's compaction request. A group's compact rule now matches it. No compactSystems entry was added: neither the repository nor the report carries the opening of Alma's compaction system prompt, so none is invented. Why: compacting.go matched the compaction prompts of Claude Code, Codex, OpenCode, Pi, Gemini CLI, Qwen Code, Minis and Kimi Code literally. Alma was not in the table, so its compaction fell through to the intent classifier and was routed by another rule's model, making every compaction cost more than the group's compact rule intended. The ask sits at byte 0 of the user message, well inside compactLead (2048), so one table entry recognises it. Test: TestRuleCompactAlma drives a group whose rule 1 is compact and rule 2 is tokens >= 1 through the gateway. With the fix the Alma request is answered by rule 1's member and X-Magpie-Model says a/small; without it the request goes to b/big. The same test asserts a long message that only quotes the ask past compactLead is not a compaction; raising compactLead makes that assertion fail, so the bound is what keeps notes from matching. Run: go test -tags nogui -count=1 -run 'TestCompact|TestCompacting|TestRule' ./internal/gateway/ (ok, 2.839s); go test -tags nogui -count=1 ./internal/gateway/ (ok, 344.144s); go test -race -tags nogui -count=1 -run 'TestCompact|TestCompacting' ./internal/gateway/ (ok, 2.172s); gofmt -l internal/gateway/ (empty); go vet -tags nogui ./internal/gateway/ and with GOOS=linux and GOOS=windows (all ok); go build -tags nogui ./..., GOOS=linux go build -tags nogui ./..., and GOOS=windows go build -tags nogui -o /dev/null . (all ok). Not tried against a real Alma client: the wording is quoted from the report. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
8ac1c7a563 |
catalog: a model's list price is looked for once a catalog load
The GUI's provider list prices every model of every provider on each
request of /api/providers: ListPrice asks catalog.PricedBy and
MakerPriced by every spelling of the id across every maker's catalog,
and a model none of them lists (most of a relay's) went through all of
them each time. In a CPU profile of the GUI's polls (drift, state,
providers, 40 rounds, a real-account sandbox) ListPrice was 14% of the
process's CPU, PricedBy and makerListPrice most of it.
What PricedBy and MakerPriced find depends on the loaded catalog, the
providers asked and the id, and nothing else, so pricedOnce keeps it by
those for the load's Reset count (gen), as priceIndexOf and AtEndpoint
keep what they build. A Reset (a new catalog synced) starts it again; it
holds at most 32,768 answers and starts again past that. find runs
without the memo's lock, as PricedBy calls itself for a renamed id.
Run on mote (macOS 27, Go 1.26.8) at this tree:
- gofmt clean; go vet ./internal/catalog on darwin, GOOS=windows and
GOOS=linux ok.
- TestPricedOnceALoad 3 of 3 alone, and with -race beside
TestPricedBy*/TestMakerPriced*: ok.
- Broken by hand: the memo never answering, TestPricedOnceALoad red
("looked for 20 times again at one load"); the memo not keyed by gen,
red (the old catalog's 0.15 after a new one's 0.2).
- go test ./internal/catalog ./internal/provider ./internal/usage ok.
./internal/gui: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners/macOS_26_SDK (#3949) red, the same two red with
the same output at origin/main
|
||
|
|
ccb75030aa |
gateway: a held request body is known by where it is, not summed again (#4371)
Each of the dozen decodes, topMember reads and validity checks a request
body goes through summed all its bytes with maphash to find what
validMemo knew of it: about 5% of the gateway's CPU on long Codex
requests (#4371). A body being served (holdBody) is not written while
held, so longBody and jsonValid now know it by its address and length,
check and split it once, and keep that in heldBodies.long until it is
released, as factsOf keeps its facts. Any other long body is summed as
before.
Run on mote at this tree:
- gofmt, go vet (darwin, GOOS=windows, GOOS=linux): ok
- TestHeldBodyIsNotSummed, TestHeldBodyNotJSON, TestDecodeJSON*,
TestRequestBodyRawValuesShareIt, TestTopMember*, TestWithoutTopMember*:
ok 3 of 3 alone, ok under -race
- go test -timeout 45m ./internal/gateway: ok (609s)
- Broken by hand: held lookup skipped -> "a held 84077-byte body was
summed 18 times"; release left the finds kept -> "a released body's
finds were kept".
- BenchmarkHeldBodyDecodes (1.8MB Responses body held, 12 decodes plus 12
topMember reads an op): 3.31ms/op before, 7.9us/op after, allocations
the same (24/op).
Real use: sandbox HOME copied from the owner's, real DeepSeek account,
deepseek-flash, four turns of a 115-123KB history through
/v1/chat/completions with masking on: every reply HTTP 200 (three "ok",
one empty at finish_reason length, the model's reasoning using
max_tokens, as on the old binary).
Not run: the full ./... suite; a real Codex account; Windows and Linux
runs of the tests.
Picked onto
|
||
|
|
9162277b91 |
routing: Until used up stays on the next account once the first is used up (dzxx0496)
dzxx0496 on Discord: with free accounts one after another, the first used
up, requests went to the second; when the first renewed they went back to
it ("如果第一个恢复了,它又优先用第一个了"). No routing did what they asked:
In order and Smart both put the first back first.
A new routing, Until used up (drain, 用完再换): requests stay on one seat
until its quota is used up, then go on to the next in the list and stay
there. A seat counts as used up when its known allowance is at 100% or
it was refused for quota or credit (failQuota / failCredit, routes.Drained
called where the rest is recorded, so a failover inside one request moves
the pool too). A rate limit or other failure only passes it over while
it rests, as In order does. Each pool (a provider, a group/<id>) keeps its
own place; routes.Forget clears it.
Offered wherever a routing is picked: the provider editor, a group's row
menu and editor (app menu, no native select), the TUI, `magpie group set
<id> routing=drain` and a provider's routing=drain. Nothing defaults to
it, so no saved setting changes. SpentShareOf is 100 for it, as for In
order. Words in en, zh, zh-TW, ja and de (i18n.js and the routing
plugin's own), docs/subsystems and the site's start page (en, zh, ja).
Tests:
- internal/routes/drain_test.go: stays on the next when the first renews,
through a rate limit, all used up, a seat gone, per pool, Forget,
Drained after a renewal.
- internal/gateway/drain_test.go: a real request path with a fake upstream;
k1 refused for quota, k2 takes over, k1 renews: drain stays on k2,
In order goes back to k1. Red without the Drained hook (request 3 went
to k1). A rate limit comes back to k1; drain is saved on a provider and
a group.
- routing-drain.test.cjs: the Routing page's why and mode line in 5
languages, 1100px and 420px, Chromium and WebKit; red on the old assets
(20 of 20).
- routing-group-strategy, routing-save, builtins: the menu has 11 routings.
Run on mote (macOS) at origin/main
|
||
|
|
72114566bf |
routing: an account's row says when it renews whatever it is doing (dzxx0496)
dzxx0496 on Discord asked for the reset time to stay on ("额度恢复时间能不能
常驻"). On the Routing page's stage a known allowance's row said when it
renews only while idle; answering, answered, kept for last or passed
over, the row's status took its place and the time was gone. It now
follows every such status ("· renews in 5 h 5 min"), once. A resting
row still says when it is back instead, a free model has nothing to
renew, and a status that already says it is not told twice.
routing-renews-stay.test.cjs: a request in flight over three known
accounts, one answering, two passed over; each row says its own renewal
once, in en, zh, zh-TW, ja and de, at 1100px and 420px, in Chromium and
WebKit, with no overflow. routing-behind-why.test.cjs's expectations
now carry the renewal on its answered and kept rows.
routing-renews-stay.test.cjs is 2 of 2 red on the old assets. Its
first row and routing-behind-why's answered row renew in 12 h 5 min:
under 10 h the time shows minutes, and a slow run turned 9 h into
8 h 59 min. With the fixtures' clock held back 2 minutes the old
values were 40 of 64 red, these 64 of 64 green.
Run on mote (macOS) at origin/main
|
||
|
|
4464a304fd |
gui: a model row's image chip is as tall as its other chips (nb5p)
nb5p on Discord: on the Gateway page's model list the image chip at a
row's end stood shorter than the reasoning chip ("低–ultra") and the
context chip ("272K"). The text chips are inline-flex with a 16px line;
the image chip holds only the 11px glyph (display:block), so it was 11px
tall. It now takes the text chips' 16px as its height.
modelInfo() is the one renderer of these chips. Its two callers, the
Gateway's model list and the routing group editor's member rows, share
the selector the fix is on. The provider editor shows images as a
checkbox and the Agents page and pickers show no such chip.
gateway-model-chip-height.test.cjs measures every chip of every row in
en and zh, light and dark, at 900px and 420px, in Chromium and WebKit:
same height, same centre line.
gateway-model-chip-height.test.cjs is red on the old CSS (the image
chip 11px against 16px) and green with it.
Run on mote (macOS) at origin/main
|
||
|
|
b2145eac1b |
redact: what the rules found in a long text is remembered by its hash (#4353)
An agent sends its whole history on every turn, so with masking on every
turn ran each rule's regexp over every message before it again; on a long
session most of magpie's CPU went there (#4353). ruleSpans now keeps what
the rules found in a text of 256 bytes or more, keyed by a SHA-256 of the
text, the day (a date over a year old can be a birthday), Secrets,
Personal, the kinds turned on and off and the user's own rules. Only the
hash and the places found are kept, no value. Two generations of 65,536
entries, as sentMemo keeps.
Run on mote at this tree:
- gofmt, go vet (darwin, GOOS=windows, GOOS=linux): ok
- TestRulesRunOnceAText and TestRuleMemoKeysWhatTheRulesRead: ok 3 of 3
alone; -race with TestMask*: ok
- go test ./internal/redact: ok; go test -timeout 45m ./internal/gateway:
ok (662s; run before the counter moved into ruleSpans' find, which no
gateway code reads)
- Broken by hand: memo bypassed -> "the rules ran over 41 texts for one
new turn"; day left out of the key -> line 74 red; kinds left out ->
line 69 red.
- BenchmarkMaskNextTurn (Codex history of 80 turns, then 81):
99.6ms/op before, 6.6ms/op after.
Real use: sandbox HOME copied from the owner's, masking on, real DeepSeek
account, deepseek-flash, four turns of a 115-123KB history with mails and
phone numbers. Masking took 22-24ms a turn before; after, 24ms for the
first turn and 1.7-2.1ms for each next one. Every reply HTTP 200 "ok"
(one empty reply at finish_reason length on each binary, the model's
reasoning using max_tokens).
Not run: the full ./... suite; Windows and Linux runs of the tests.
Picked onto
|
||
|
|
54087aa43d |
providers: a key's chips keep their whole text; what ends its row goes under it when it doesn't fit (young02036)
young02036 (Discord #feedback, zh, Windows) had a Remote magpie key row whose models chip「全部模型」was squeezed to「全」. The row also showed the protocol pick and the actions (停用 移除 设为首选). Now only the name and the masked key shrink. Every chip and button keeps its whole text. Switch off/on, Remove and First/Make first are held together in one .key-acts group at the row's right. When they don't fit, the group goes onto its own line, still at the right. A press there now keeps its row open (`held`) through the redraw the press brings, until the pointer moves off the row. Without that, a wrapped row drawn again after a click goes back to one line, slips out from under the pointer, and hides the button that was pressed. key-switch.test caught this at en/ja/de 900px. WebKit gets plain `:hover`/`.held` selectors, not `:is()`/`:not()` lists. Trade-off: in a narrow card, a hovered key row grows by one line. Not changed: account rows, which use the .acc-line/⋯ layout, and the gateway's caller-key rows, which ellipsize on purpose. New test: tests/key-row-chips-fit.test.cjs, 60 cases (2 engines x zh, en, ja, de, zh-TW x 6 widths down to 390px). It checks that no chip or button of a key row is cut, and that the actions stay on one line at the right. Run: - key-row-chips-fit + key-switch, Chromium and WebKit on Linux (WSL magpie-desktop): 40/40 each. key-row-chips-fit on mote: 60/60; on Windows (xiaomi-gpu): 30/30. - Whole GUI suite, WebKit, on mote at this commit (another session's suite ran there too, load 55 to 160): 8663 tests, 8489 pass, 174 fail, in 50 files. Each red file was then run alone at origin/main |
||
|
|
fa4704f060 |
gui: a test bounding allocations skips its bound under -race
Under -race sync.Pool lets a quarter of what is put in it go, so json's encoders and regexp's matchers are made again: four gui tests bounding what a path allocates went red under -race at |
||
|
|
0cc551c862 |
gui: the terminal-update test reads its child process under no race
TestUpdateInATerminalRestartsTheAppWithoutCuttingIt set `child` in the startBeside fake, which the restart runs on a goroutine of its own (restartBeside), while the test read it in eventually2 and its cleanup. Under -race it reported a DATA RACE on every run. The child is now an atomic.Pointer stored after Start, so a reader never sees it half set. TestRestartHandsTheGatewayOver's fake runs on the test's goroutine and has no race. Run on mote at this tree: - gofmt, go vet ./internal/gui, GOOS=linux go vet -tags nogui: ok. - -race -run the test, 3 times: ok, no race. At the base ( |
||
|
|
7da5b34aa4 |
sessions: Cindy's Pi sessions are read from its pi-agent-home (ldl123292 on X)
Cindy starts Pi with --session-dir <userData>/pi-agent-home/sessions
(resolvePiAgentHome in Cindy's app.asar), so its Pi sessions never
reached ~/.pi/agent and magpie showed none of them. They are read now from
the Cindy and CindyGlobal builds' folders and listed as Cindy's: list,
transcript, calls on Usage, Dirs, delete, and the gateway's own record of
a Cindy session merged with the file's.
Run (mote): go test ./internal/sessions ./internal/agent ./internal/usage
ok. go test ./internal/gui: two reds, both the same on origin/main
|
||
|
|
699ddf1524 |
gateway: a Codex account can spend its credits only after every other account, key and fallback (gokoshiki on Discord)
gokoshiki wants a Codex subscription first, then an OpenAI API key, then the subscription's credits. Until now an account at 100% that holds credits either kept its place and spent them there (on) or was held (off). This adds a third way per account, "last": - settings: CodexCreditsLast []string, empty by default, so a setting saved before it keeps its order. provider.CodexCreditsLast, CodexCreditsMode and SetCodexCreditsMode(user, on|last|off); SetCodexCredits(on) still means "in its place" and clears last. - gateway: candidate.creditsLast is true for such an account once a window for the model is used up and it is going on its credits (a call ChatGPT counts in no window stays in its place). restLast orders ready, then resting, then those, and marks Weighed.CreditsLast. restLast runs over the asides too, so such an account goes behind a provider's reserves (Accounts at once, |
||
|
|
fd70def825 |
gui: a Providers poll sums what it keeps while writing the answer
Each poll of /api/providers encoded the answer for the page and then
encoded the kept last-known list again only to sum it (keepProviders,
encodedSum): 32-34 MB of what forty polls allocated with real accounts.
writeProvidersJSON now returns the encodedSum of keptProviders(s), taken
from the same encoding, as writeStateJSON does for /api/state. A row
kept as it is (no headers, proxy, extra body or account proxies) is
encoded once into the answer and the sum; only a row with those is
encoded again without them. The head and tail of the kept file come
from marshaling it with no rows. A nil row list, or a head that doesn't
match, falls back to the old writeJSON and encodedSum. The other
keepProviders callers (after a save) are unchanged.
Run on mote at this tree:
- gofmt, go vet ./internal/gui, GOOS=windows go vet -tags nogui: ok.
- go test -run 'Providers|Kept' ./internal/gui 3 times alone: ok.
- New TestProvidersWriteSumsWhatIsKept: the sum equals
encodedSum(keptProviders(s)) for bigProviders, rows with each secret
field, gateway calls, moved models, and empty and nil lists. Broken
by hand twice: keepsAllOf always true (secrets summed) and the kept
tail left out of the sum. Red both times.
- go test ./internal/gui: only the known reds,
TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners (#3949).
- -race -run 'Providers|Kept': TestProvidersWriteGrowsNoBufferItsSize
red, and red the same way at the base (
|
||
|
|
c76bcaea7a |
gui: between reads the heap grows by half of what it holds, not all of it
The window and the app's page, resting on ~60 MB live, poll /api/state,
/api/drift and /api/providers and throw ~10 MB away a round. At Go's
default GOGC of 100 the heap grew to twice what it kept before each
collection, so the footprint stood at 121-135 MB and peaked at 136-138
MB for a ~60 MB heap.
steadyGCStart, run once with the warm-up, sets GOGC to half, or to what
lets the heap grow by 32 MB when that is more (never above 100), and
sets it again for the live heap after each collection, through the
retightenGC hook the tight reads already use. The usage and sessions
reads under a tight GC still set their tenth while they run, and the
steady value comes back after them. A GOGC the user set in the
environment is kept, and nothing is retuned. No memory limit (#2278).
Run (mote, at this tree):
- go test -count=1 ./internal/gui: ok except TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949), the known reds.
- -run 'GC|Steady|Tight' 3 times and once under -race: ok.
- Broken by hand: ignoring GOGC in the environment, TestSteadyGCKeepsTheUsersGOGC
is red ("GOGC=200 set by the user, magpie runs under 50"); with no
retune after a collection, TestSteadyGCRetunesAfterACollection is red
("GOGC after collections = 50, want 100").
- gofmt -l, go vet, GOOS=windows go vet -tags nogui ./internal/gui: clean.
- Real accounts, magpie web in a sandbox HOME, 40 rounds of the three
polls, twice each, alternating, v0.1.2507 against this change:
phys_footprint_peak 136 / 137 MB -> 115 / 116 MB
phys_footprint end 135 / 121 MB -> 96 / 94 MB
CPU of the polls 3.84 / 3.98s -> 4.05 / 4.24s
/api/state and /api/drift byte-identical.
GOGC=50 in the environment gave 107-108 MB at +9% CPU; the 32 MB room
keeps a small heap from collecting that often.
Not run: the desktop window (Wails) and Windows/Linux machines; the
tray app takes the same Handler path. A large usage history between
reads (~280 MB live) now grows by ~140 MB, not ~280, before a
collection; not measured here.
Picked onto
|
||
|
|
4179cf2d8f |
pii: a CPU without AVX2 runs pf-serve-base, and Rosetta Apple silicon's pf-serve
echo_yip on X: Settings → Privacy's model never started, "pf-serve
(Metal): signal: illegal instruction" and the same on the CPU. x86's
pf-serve needs AVX2, FMA, F16C and BMI2, which a Celeron, a Pentium or
a Mac before Haswell lacks, and so does Rosetta before macOS 15, where
the Intel DMG on Apple silicon ran the Intel pf-serve.
- arch.go: target() is darwin-arm64 for magpie's Intel build under
Rosetta (sysctl.proc_translated, rosetta_darwin.go), so Apple
silicon's pf-serve, with Metal, is fetched and run. The Intel one
already on disk is kept until the arm64 one is (tagDirs; start
fetches it first, for at most 5 minutes, and falls back), then
removed with the old tags.
- fullX86 asks golang.org/x/sys/cpu for AVX, AVX2, FMA and BMI2. Where
one is missing, candidates() runs only pf-serve-base, the SSE4.2
build the previous commit adds, when it is on disk.
- pf-v3 (privacy-filter run 41256502056 at
|
||
|
|
b62b914964 |
agent: Claude Code's model field joins its own models with magpie's list once
Claude Code's model field appended its own models to the list it keeps
of magpie's (claudeViaShared), a copy of the whole catalog on every
call, as withVia did for the other agents until
|
||
|
|
7e3cfa3442 |
provider: GroupFinder indexes the providers' models once, not for each group
GroupFinder reads every provider's models once for many lookups, but
each lookup's membersIn built entriesBy, a map over the whole list,
again. The Providers page looks up every group of every agent on each
poll: with real accounts, 40 polls spent 23.2 MB in GroupFinder, 13.6
MB of it in that index.
The finder makes the index with the list, and membersFound takes it;
membersOff, for one lookup, still makes its own. Members are unchanged.
Run on mote (macOS), at this tree:
- gofmt clean; go vet ./internal/provider for darwin, windows and linux.
- TestGroupFinderIndexesTheListOnce alone 3/3 ok (1744 bytes a lookup,
2000 models).
- Broken by hand (index made per lookup again): "a group looked up
again cost 198576 bytes: the list of 2000 models was indexed again".
- go test ./internal/provider ./internal/agent ./internal/gateway: ok.
- go test ./internal/gui: red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949), as before.
- Real-account sandbox, 40 window polls against v0.1.2505's tree:
GroupFinder 23.2 -> 12.6 MB; /api/state and drift output
byte-identical; phys_footprint_peak 135 MB.
Not run: the whole ./... suite.
Picked onto
|
||
|
|
697335d8ee |
native: each x86 target gets pf-serve-base, built for SSE4.2 alone
echo_yip on X: Settings → Privacy's model would not start, "pf-serve
(Metal): signal: illegal instruction" and then the same on the CPU.
pf-serve for x86 (darwin-amd64, linux-amd64, windows-amd64) is built
with GGML_AVX, AVX2, FMA, F16C and BMI2 on and GGML_NATIVE off, so on a
CPU without AVX2 (a Celeron or Pentium, a Mac before Haswell) and under
Rosetta before macOS 15, which has no AVX at all, ggml's first vector
instruction ends it with SIGILL. Two tries, Metal then CPU, are what
magpie's Mac start does, so this was a Mac: most likely the Intel DMG
on Apple silicon.
build.sh now also builds pf-serve-base for each x86 target, with SSE4.2
on and AVX, AVX2, FMA, F16C and BMI2 off, and puts it in the same zip.
The workflow's start check runs it too where the runner can. magpie
picks it on a CPU without them in the next commit; a pf-v3 tag
publishes these zips.
Run: privacy-filter workflow on pf/base, run 41255213505, green on
all five targets; darwin-amd64, linux-amd64 and windows-amd64 each
have pf-serve-base in their zip. objdump -d of the CI binaries:
pf-serve ymm 20613 / 12222 / 12230, vfmadd 859 / 714 / 686
pf-serve-base ymm 0, VEX-encoded xmm 0, vfmadd 0 (all three)
Linux box (magpie-desktop), the pinned model (sha256 80efc180...),
PF_DEVICE=cpu, qemu-x86_64-static 8.2 -cpu Nehalem (SSE4.2, no AVX):
pf-v2's released pf-serve: signal 4 (Illegal instruction), 132
this build's pf-serve: signal 4, 132
this build's pf-serve-base: {"device":"cpu",...}, exit 0 (135 s
under emulation)
Natively, pf-serve and pf-serve-base find the same spans in an
English, a Chinese and a secrets text (names, email, phones, address,
password).
Not tried: a real CPU without AVX2, and a Mac before macOS 15 under
Rosetta; qemu stands in for the first.
|
||
|
|
ce998057a7 |
gui: a provider row makes each model's provider/model ref once
providerInfoWith built p.ID+"/"+m.ID three times per model (same-as, desktop and price lookups) and again for every agent with a hidden list, per model. Now named makes it once and keeps it beside out.Models for the agents' loop. What the row says is unchanged. Run on mote (macOS), at this tree (with the previous commit): - gofmt clean; go vet ./internal/gui for darwin and windows ok. Linux vet of internal/gui needs cgo for Wails and wasn't run. - go test ./internal/gui: red only on #4514 and #3949, as before. - Real-account sandbox, 40 window polls: providerInfoWith 112.0 -> 104.1 MB; /api/state and drift output byte-identical. Not run: the whole ./... suite. |
||
|
|
ffc18a850d |
agent: an app folder is listed and an Info.plist read again only when it changed
The Agents page asks every desktop app whether it is installed, and its version, on each poll. Each ask listed /Applications and ~/Applications whole (os.ReadDir, for the one-level-down folders of #2325) and read every candidate bundle's Info.plist. With real accounts, 40 window polls spent 38.6 MB of allocations in Agent.Detected, 14.5 MB of it ReadDir. folderSubs keeps a folder's non-bundle subfolders while its modification time stays (adding, removing or renaming an entry changes it), and bundleInfo keeps what an Info.plist said while its size and modification time stay. A time under 2s old is never trusted, as git treats a racily clean index. macBundle and desktopApp.version read through bundleInfo; what each reports is unchanged. Run on mote (macOS), at this tree: - gofmt clean; go vet ./internal/agent for darwin, windows and linux ok. - TestAppFoldersReadAgainOnlyWhenChanged alone 3/3 ok. - Broken by hand: never trusting the kept list and plist -> "an unchanged app folder and Info.plist cost 1268 allocations a look"; trusting them whatever changed -> "Moved.app in a folder added since isn't found" and "Kept.app's Info.plist says another id now". - go test ./internal/agent ./internal/tui ./internal/cli: ok. - go test ./internal/gui (with the next commit's providers.go too): red only on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), as before. - Real-account sandbox, 40 window polls against v0.1.2504's tree: total allocations 509.9 -> 427.6 MB, Agent.Detected 38.6 -> 21.5 MB, os.ReadDir 14.5 -> 4.0 MB; /api/state and drift output byte-identical. phys_footprint_peak 139 MB (136 before; within run noise). Not run: the whole ./... suite; the Linux and Windows app paths (they don't reach these readers). |
||
|
|
cdfdb62c69 |
agent: a model field's list is joined with the catalog once while neither changed
Each agent's model field returned append(its own models,
viaMagpieShared(...)...), a copy of the whole catalog's options for
each field of each agent on every poll: Picks was 94.7 MB of 496 MB
over forty polls of the Agents page with real accounts. withVia keeps
the joined list per agent and prefix while the own models read the same
(sameOption, field by field) and the catalog's list is the very one
kept (same array), and joins it again when either changed. The list is
read only and clipped, as viaMagpieShared's is; every caller of a
field's Options reads it, Picks clones it before it drops anything.
The 52 `return append(own, viaMagpieShared(...)...)` sites call it.
omp's and Reasonix's planner edit the joined list after the append, and
Grok's writes Same into its copy, so they keep their own copies.
TestWithViaKeepsTheJoinedList: the same own models give the same array,
own models changed in a value or only an icon are joined anew, a
provider saved since is listed, and nothing joined is the catalog's own
list. TestSameOptionReadsEveryField sets each field of Option alone and
fails when sameOption doesn't see it. Broken by hand: never answering
from the kept list ("the same own models joined the catalog again"),
and FastFor left out of sameOption ("sameOption doesn't read
Option.FastFor").
Run on mote: both tests alone 3 of 3; internal/agent, internal/tui and
internal/cli ok; internal/gui red only on TestSettingsSaveKeepsWhatItDoesNotSend
(#4514) and TestMainWindowCorners (#3949); gofmt, vet and GOOS=windows
and linux vet clean. Real accounts in a sandbox HOME, forty polls:
Picks 94.7 MB -> 51.2 MB, state 190.8 MB -> 154.0 MB, state and drift
replies byte for byte the same as before. Footprint peak 136 MB.
|
||
|
|
d6aa9cdf60 |
provider: PeakOf checks a bill's models before it lists the provider's URLs
PeakOf built a slice of the provider's URLs (and their hosts) for every
bill and every model, before asking whether the bill named the model.
The Providers poll asks it for each model of each provider, 8 MB of
540 MB over forty polls with real accounts. The model is checked first
now, the URLs are listed once, when a bill needs them, into an array on
the stack.
TestPeakOfPlainModelsAllocateNothing: PeakOf of a model on an OpenCode
Go provider allocates nothing, glm-5.1 there has no peak,
deepseek-v4-pro there has one and so does DeepSeek's own provider.
Broken by hand (the URL list made on the heap again) it goes red,
"allocated 1 times".
Run on mote: the test alone 3 of 3, internal/provider ok,
internal/catalog ok, gofmt, vet and GOOS=windows vet clean. Real
accounts in a sandbox HOME, forty Providers polls: PeakOf gone from the
profile, providerInfoWith 137.7 MB -> 108.4 MB with the SameModel
change before it, state and drift replies byte for byte the same.
Footprint peak 138 MB. Not run: the GUI suite (no GUI file changed).
Picked onto
|
||
|
|
314940d2d6 |
catalog: SameModel leaves a plain model id as it is, without a regexp or a copy
SameModel ran modelGaps' ReplaceAllString and built a byte copy for every
id it was asked about, even one with nothing to change. The Providers
poll asks it for each provider's models, 21.5 MB of 540 MB over forty
polls with real accounts. An id with no underscore, whitespace or double
dash now skips the regexp, and one with no version dot to rewrite is
not copied.
TestSameModelPlainIDsAllocateNothing compares SameModel with the old
code over about 30 ids (underscores, tabs, no-break spaces, "--",
dotted versions, leading and trailing dashes) and checks a plain id
allocates nothing. Broken by hand both ways it goes red: allocations
back (4 to 5), and wrong answers with the plain-id check inverted.
Run on mote: the test alone 3 of 3, internal/catalog ok,
internal/provider ok, gofmt and vet clean. Real accounts in a sandbox
HOME, forty Providers polls: SameModel 21.5 MB -> 2.5 MB, state and
drift replies byte for byte the same as before. Not run: the GUI suite
(no GUI file changed).
Picked onto
|
||
|
|
27a0cbd178 |
zcode: the mover's min is 0.1.40, the plugin that holds two accounts at once
01huadalang on Discord (#feedback): three ZCode accounts used at once
from one address had the address refused with a 405. zcode 0.1.40
(magpie-community/plugins 26864ec) declares maxAccounts 2, which the
previous commit's Accounts at once reads; keepMovedCurrent now updates
every moved user's plugin to it.
npm view @magpie-community/opencode-zcode-auth --prefer-online: version
0.1.40, magpie { maxAccounts: 2, maxConcurrency: 3 }, checked when this
landed. Run: internal/provider at this head with the commit before
(see its body). Not tried: a real ZCode account's move (none used, per
the task).
|
||
|
|
b9ad353dbe |
gui tests: editor-advanced-align measures the editor drawn last, once its observer has seen it
Red in a whole GUI suite run on Linux and alone on mote, about 1 run in
8 at the accounts-at-once head (4 of 33), 0 of 31 at main
|
||
|
|
2c6b7c0632 |
gateway, provider, gui: Accounts at once keeps the first N accounts taking requests, the others in reserve
01huadalang on Discord (#feedback 1566170404542742740): three ZCode
accounts used at once from one address got the address refused with a
405; two were served. They asked for one account to be used until it
runs out, then the next. Even under "In order", ZCode's maxConcurrency 3
spilled a full lane onto the next account (laneMate) and rests spread
the load, so every account was in use at once.
A provider's MaxAccounts (the editor's Advanced → "Accounts at once",
beside Concurrency; `magpie provider at-once <id> [n|off|default]`) is
how many of its accounts or keys take requests at the same time.
provider.AtOnce() is the user's own value, else what its plugin
declares (maxAccounts on the auth hook or package.json magpie, read by
host.js atOnceOf), else no limit; the user's 0 is no limit over the
plugin's. perKeyBarred keeps the first N in the user's own order
(rank), preferring ones not resting, and keepAtOnce puts the rest after
everything as asides with candidate.reserve (Weighed.Reserve). So in any
routing mode a reserve is asked only once the kept ones failed or rest,
and a kept one that rests gives its seat to the first reserve next time.
Guards: laneMate never spills onto a reserve; a full queue (laneErr)
drops the provider's reserves (dropReserves) and turns the request away
with the 429; session affinity moves a conversation off a reserve once
the kept ones can take it (affine "reserve"; Strict still holds).
Routing says "in reserve · {n} at once" on the row and why in the
request's story. zcode 0.1.40 (plugins 26864ec, on npm) declares 2, and
its mover min is raised to 0.1.40 two commits on.
Known leak, in docs/subsystems/gateway-routing.md: a failure that rests
nobody (a 5xx on one try) still passes that one request to the reserve,
as it does to any next candidate.
Tests: TestAtOnceKeepsFirstInUserOrder (every routing mode, a dragged
order, a resting key handing over its seat), TestAtOnceFullLaneWaitsForTheKept,
TestAtOnceReserveTakesOverAndGivesBack, provider TestAtOnce, plugin
host maxAccounts (hook and package.json), gui TestAtOnceSave, cli
TestAtOnceCmd, provider-at-once.test.cjs (both engines, five languages,
900 and 360px).
Broken by hand, each red then restored: laneMate's reserve guard
removed (FullLane times out); affine's reserve case removed
(ReserveTakesOver answers on k3); keepAtOnce disabled (all three red);
dropReserves disabled (FullLane gets no reply); the Routing row's
reserve branch removed (provider-at-once's Routing test red in all 10
engine/language runs).
Core budget: the field adds ~530 bytes to app.js; the neighbouring
editor comments are cut to fit, so TestCoreScriptBudget passes with no
raise.
Run on mote, Go 1.26.8:
- full suite, -timeout 45m, at a7d4c662d (on origin/main
|
||
|
|
51f2f22ce1 |
gateway: the Qoder plugin's nameless tool call rests nobody (plugins#579)
Qoder plugin 0.2.51 answers 502 "the model's native tool call has no name; it is not sent on as a tool" when qfmodel twice began a native tool call without a name before anything of the reply was sent. That is the model's glitch, not the account's, but failure() read it as failOther and restAfterMarked rested the account for fallbackCooldown (a minute), so the user's next turn skipped it. cutWords now also matches that sentence, so the 502 takes the failCut lane the plugins' cut-short error already has (#2873): asked again once where it stood (cutReasks), then the next account or group member, with no rest and no failure counted. The match is the plugin's whole clause, not "has no name", so other bodies keep their lanes. Siblings: failCut is decided in failure() alone, and read by restAfterMarked (no rest) and the serve loop's retry (gateway.go); both take the new words through it. No other plugin in magpie-community/ plugins says these words (grep of packages/*.mjs at 5403c21). Run (on mote, at |
||
|
|
73b957069a |
provider: ModelAPI looks up the API set first, and counts what the provider speaks
The Providers page asks ModelAPI of each model of every provider's list, and it listed the protocols the provider speaks (Speaks, a new slice) each time, though it needs only whether there are two, and most models have no API set at all. With real accounts that was 12 MB of what forty polls allocated. ModelAPI now looks up the API set for the model first (apiSet) and, only with one set, counts the protocols up to two; apisAmong passes the count of the list it already has. The answer is the same. Run on mote at this tree (on 7087d92a0, the previous commit before it was picked): gofmt, go vet (darwin, windows, linux) of internal/provider and gui ok; TestModelAPIListsNoProtocols, TestNoAPIFindsTheProvidersAPIsOnce and TestClaudeSignedOutKeepsWhatItParsed alone 3/3 ok; broken by hand (Speaks listed again in ModelAPI) it fails "ModelAPI allocated 112 bytes, listing the protocols 112"; go test ./internal/provider ok (130.3s); go test ./internal/gui fails only TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), as on the run before this change. Real accounts, sandbox HOME, 40 polls (abr.sh), against the v0.1.2496 build: Provider.ModelAPI and Speaks gone from the profile (12 MB before); /api/state and the drift reply byte-identical. Footprint peak 136 MB (was 134-141). |
||
|
|
bbdd9eb551 |
provider: a saved Claude sign-in read before is not parsed again for each Providers poll
claudeSignedOut and claudeLoginVersion run for every saved Claude account
on each Providers poll (Logins, claudeStandIn), and each parsed the
sign-in whole through parseClaudeCredentials: a map[string]any, then a
Marshal and Unmarshal of claudeAiOauth. With real accounts that was
15.5 MB of what forty polls allocated. What they read of it, whether it
parses as a sign-in and its version, is now kept by the sign-in's bytes
(claudeAuthOf), at most 64; the bytes change only when the account is
signed in or refreshed, and a changed sign-in is read anew.
Run on mote at this tree: gofmt, go vet (darwin, windows, linux) of
internal/provider ok; TestClaudeSignedOutKeepsWhatItParsed alone 3/3 ok;
broken by hand (the kept read skipped) it fails "claudeSignedOut
allocated 8023 bytes, parsing the sign-in 7127"; go test ./internal/provider
ok (117.4s).
Real accounts, sandbox HOME, 40 Providers/Agents polls (abr.sh), against
the v0.1.2496 build: parseClaudeCredentials and claudeSignedOut gone from
the profile (15.5 MB before), provider.Logins 22.0 MB -> 11.0 MB, total
517 MB -> 504 MB; /api/state and the drift reply byte-identical.
Footprint peak 139 MB (was 134-141): this change doesn't move the peak.
Not run: the gui suite (no gui file changed).
Picked onto
|
||
|
|
2640ac0f03 |
provider: qoder's mover min is 0.2.51, where an unnamed native tool call no longer fails the turn (plugins#579)
qoder-cn/qfmodel now and then begins a native tool call and never names
it. Up to 0.2.50 the plugin ended the stream with "the model's native
tool call has no name", an error frame ZCode doesn't retry, and the whole
turn died with what had already streamed. 0.2.51 asks once more when
nothing was said before it (then a 502 before any byte, which the gateway
retries or fails over), and otherwise drops the call and ends tool_calls
or stop. keepMovedCurrent brings every moved user up to it.
npm: `npm view @magpie-community/opencode-qoder-auth version
--prefer-online` = 0.2.51 at this commit.
Run at this tree (
|
||
|
|
be689b8833 |
gateway: a made reasoning item says its text once, and an item with no summary key doesn't panic (#2855)
magpieMadeReasoning joined an item's summaries and its reasoning_text into the made summary. #2855's later rollout (lyufeng000, 10-31) has DeepSeek items whose content repeats their summary, so the made item would carry the words twice, and DeepSeek be handed them back twice (withReasoningText reads the summary). It now takes the text, else the summaries. It also ranged over item["summary"].([]any), a single-value assertion that panics on an item with no summary key; both reads now use the checked form. TestMadeReasoningSaysItsTextOnce. Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, #3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
4beb439919 |
gateway: a whole reply another filter held goes through the reasoning tidy too (#2855)
reasoningTidy sat between crArgs and ints in the stream loop only. The held bytes drained at the end skipped it: sign (tidy, whole, search, spaces) went crArgs then ints, and crArgs's own drain went to ints. A glm-5.3-flash replica's whole reply, which crArgs holds to its end (#4256), reached the client with the foreign reasoning item as it came, and the tidy's own drain went back through crArgs after crArgs was drained. Now sign and crArgs's drain go through the tidy, and the tidy's drain goes on through ints and sigs only. TestForeignSealedReasoningWholeReplyCarriesNoContent (deepseek-flash and glm-5.3-flash, stream false). Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, #3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
27099f9fc5 |
gateway: a vendor's named quota time replaces magpie's guess, though sooner (#3289)
ggbdpq's change keeps the later of two rests. That also kept a quota
rest magpie only guessed (a refusal naming no time: quotaRest's 15
minutes, asked again a minute on, askAt set) when the same refusal
came back naming its time, 2 minutes say: the account sat out the
guess. A guessed rest now gives way to the same kind's vendor-named
time ("resets" or "retry-after"); another kind's shorter rest (#3289's
429 minute beside a 402) still doesn't shorten it.
TestNamedQuotaTimeReplacesAGuess.
Reviewed and landed as one batch of 12 commits (gua's #4593, #3269,
#3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path
sibling, and four review follow-ups). Run for the batch, whose last
commit's tree is 5d58a75f3:
- Full suite before the rebase (base
|
||
|
|
60b2d94c4c |
test: #2718's rest tests wait for the renewal to be told, not 100ms (#2718)
TestReadingKeepsARefusalsRest and TestAutoVisionKeepsOffARefusedAccount slept 100ms "for the renewal to land" after the 80% reading, then watched the rest for 2s. They now arm a hook (provider.OnRenewed) that signals when the reading's renewal for codex's me@example.com is told, wait for that, and check once: the gateway's own hook is registered first (init) and hooks are told in turn, so by then the gateway's lifting has run, on a loaded machine too. Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, #3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
4d0bb7aeb7 |
provider: a key's elapsed reset is measured from its last good reading, not the read in flight (#2718)
readKeyAllowance sets e.at to now before it calls keep, and keep took e.at as the time the old allowance was read. So on the key path every "started again" check compared against now, and a reset that passed between two readings was never told: the rest a vendor timed stayed until it ran out, which is the half of #2718 the account path already fixed. keep now measures from aAt, the time the kept allowance was read, which only a successful reading moves; a failed read in between leaves it alone. noteKeyAllowance (the card's reading) sets e.at after keep for the same reason. Edward4226's fix (codex/issue-2718-elapsed-reset, d132dacb4 with f302d9312's deterministic test), which ggbdpq's comment on #2718 asked to carry with the rest-paths change. Their EVIDENCE.md is left out. Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, #3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
5032d3ade7 |
gateway: a reasoning item magpie hands Codex with its text in it becomes one of its own, a summary and nothing sealed (#2855)
What changed A Responses reasoning item that carries the model's reasoning as content parts (reasoning_text) — another vendor's shape; OpenAI's own items carry summaries — no longer reaches a client of magpie's as the upstream wrote it. It is made over into the item magpie makes of any other upstream's reasoning: its text (and its summaries) as one summary, an rs_ id, no content and no seal — in a reply translated for the client (magpieMadeReasoningRaw at the encoder's sealed item and the whole reply's renderer) and in one relayed as it came (reasoningTidy, a passthrough filter on Responses streams and whole replies, the item in output_item.added/done and in response.completed's output). The subsystems doc's rule is amended to say so. Why A Codex conversation that used OpenAI, went through magpie to DeepSeek, then had magpie disconnected again, was stuck: every later turn, the remote compact too, answered 400 "Invalid 'input[43].content': array too long. Expected an array with maximum length 0, but got an array with length 1 instead." The reporter's rollout forensics narrow it: the DeepSeek phase had left 25 reasoning items, each with its text in content parts and a 38-character encrypted_content of the vendor's own (not the gAAAA the thread's own GPT-phase items carry, which have no content), which Codex stores and replays to OpenAI. OpenAI takes a reasoning item sent back only with its content empty (#1411) and cannot open another vendor's seal, so such an item poisons the thread for OpenAI wherever it was planted — and once Codex holds it, no retry of magpie's can strip it: client keeps, and #2855 came with magpie out of the path entirely. A Chat-API upstream's turn has always translated to an item of magpie's own (an rs_ id and a summary, TestTranslatedChatReasoningCarriesNoContent pins it); the items the reporter held are a Responses wire's own, which both the translated and the relayed reply handed over as they came. What magpie hands a client must be re-sendable to a strict Responses upstream: the text is kept in the summary, so an upstream that wants its reasoning back still gets it (withReasoningText), and magpie's own OpenAI destinations keep the item out as they did (#1008, #1044, #1411). Run - TestForeignSealedReasoningGivenCodexCarriesNoContent (translated) and TestForeignSealedReasoningRelayedCarriesNoContent (relayed) fail on upstream/main with the issue's item handed over whole — content, empty summary and the vendor's seal in both output_item.done and response.completed — and pass with the change; TestTranslatedChatReasoningCarriesNoContent (a Chat upstream's reasoning, translated) is green without and with the change. - Restoring the three product files alone to upstream/main (tests kept) fails the two again; restoring them back passes. - Attaching content to the made item fails both again ("carries its text"), and dropping the made summary fails both ("carries no summary"). - go test -tags nogui -count=1 ./internal/gateway: ok 312.4s; -run 'TestTranslated|TestReasoning|TestSealed': ok 7.9s; go test -race -tags nogui -count=1 -run 'TestTranslated|TestReasoning': ok 9.4s. gofmt -l internal/gateway empty. go vet -tags nogui and go build -tags nogui -o /dev/null . on darwin, GOOS=linux and GOOS=windows: pass (a pre-existing cgo -Wenum-conversion warning in internal/gui/trayimage_darwin.go on darwin, untouched). Not tried against real OpenAI or DeepSeek accounts; the reporter's rollout reading is taken from the issue, not re-derived from a live thread. Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
78c92bb852 |
provider, gateway: a rest the vendor gave the time of keeps till it ends, and the reading that lifted it does not bring the image picker back to the account (#2718)
What changed:
A refusal that says when its quota comes back (ChatGPT's resets_at, or
a Retry-After: restAfterMarked keeps it by "resets" or "retry-after")
rested the account till then, but the rest did not keep. Every failure
asks the usage read again (staleAllowance), and when the reading came
back finding the window less than full — which the vendor's own usage
endpoint can say while its refusal stands — renewedFrom read it as full
till sooner, and renewed lifted the rest. The account went first in its
group and was refused again, every few minutes, all saying the same
reset: parkavenue9639 counted 11 such tries in 92 minutes, and 21 more
from magpie's own image descriptions, without one gaining anything.
What a reading may lift is now told from what only a window truly
starting again may. Allowances still tells renewed by renewedFrom, and
renewed lifts by it what no vendor gave the time of (by "quota",
"window"): unchanged. A new startedAgain says whether a window full at
the last reading — a pool of some models as much as the whole account's
— has its reset gone by, or stands a new, later cycle: the two ways a
window really restarted. Allowances tells that to a second hook
(OnStarted), which alone lifts what the vendor itself timed ("resets",
"retry-after"). A reset spent tells both hooks (renewedNow), and lifts
at once, as before. A Claude account whose /usage finds its five hours
started again before Claude Code's word said is told by the new read's
reset standing a new cycle, and its rest is lifted as it was. A key's
own readings tell the two the same way (keyAllowance's keep returns
both).
AutoVision needed nothing of its own: it has kept off a resting
describer since #1801 (spentModel counts a quota rest as spent, and
autoSpent asks none "until one is back"). Its 21 refusals in the report
were this lifting: the rest gone, the pick went back to the refused
account, and the next image asked it again. The test drives both: with
the rest standing, a reading that finds the window at 80% with the same
reset lifts nothing, and AutoVision keeps the other describer.
Run: TestReadingKeepsARefusalsRest,
TestAutoVisionKeepsOffARefusedAccount red on
|
||
|
|
18387b93be |
gateway: a shorter failure doesn't shorten the rest a longer one took (#3289, wjq990112)
Concurrent requests on one provider can fail differently: a 402 out of credit rests the account for half an hour, and a 429 answering at the same moment — the first request still holding the vendor's only slot — rests it for the minute a rate limit starts at. Whichever was written last won, so the 429's minute replaced the 402's half-hour, and the account was asked again as soon as it ended, refused, and rested again, round after round: sub2tok's account answered some 3,400 refusals in six hours, in bursts of two or three requests every few seconds. restAfterMarked now writes its rest only when nothing is resting there yet, or when the rest it took ends later than the one in place — the rule a rest narrowed to a model already keeps (narrowWhenRead), and the one a slow start's rest keeps since |
||
|
|
f1545e1477 |
gateway: a vendor's "model not served here" refusal fails a group over to its next member (#2887)
A routing group's first member answering ModelScope's 400 "Model id :
deepseek-ai/DeepSeek-V4.1-Flash , has no provider supported" ended the
group request: the words matched none of the refusal classes that make
a 400 retryable, so the client got the 400 and its own retries landed
on the same dead seat — the reporter watched 28 in a row, the later
members never asked.
What changed: unservedWords takes the vendor wordings that say the
model is served nowhere on this member — ModelScope's "has no provider
supported" (the report's usage.jsonl), and Azure OpenAI's for a
deployment its resource has none of, code DeploymentNotFound ("The API
deployment for this resource does not exist"; Microsoft Q&A, Stack
Overflow — its 404 fails over by status already, the wording covers the
400s a relay passes on). An unserved refusal keeps the poison pill's
line: a plain bad request ("Invalid parameter", "field required")
still ends the route, as it would fail on every member, and
shapeRefused still excludes these words — the seat rests on its
model's own key (restAfterMarked's unserved branch, the #1235
mechanism), so the key's other models stay live and the group's next
request passes the dead seat.
Run: go test ./internal/gateway/ (TestGroupFailsOverAModelWithNoProvider
red on upstream/main, green here; the family and the plain-400 guards
green); -race targeted; gofmt; vet darwin/linux/windows; builds
darwin, linux and windows (-tags nogui).
Reviewed and landed as one batch of 12 commits (gua's #4593, #3269,
#3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path
sibling, and four review follow-ups). Run for the batch, whose last
commit's tree is 5d58a75f3:
- Full suite before the rebase (base
|
||
|
|
e43d67d743 |
test(update): TestRelaunchOpenTriedAgain waits the relaunch out before cleanup (#3881)
The test's polling loop returned as soon as the fake open had written `opened`, but the relaunch's shell writes its note for that try only after open returns: under load the test could be gone and TempDir's RemoveAll with it while the shell was still appending that note to the log in the third TempDir, and the cleanup failed with "unlinkat .../003: directory not empty" (yetone, at machine load 50-95). Once the note for the open that went through is in the log, the shell has nothing left to write (it only exits), so the test now waits for it before returning, the way the gateway's tests wait out the writes of what they started (#1524, #1543). The cleanup assertion itself is untouched: it is what guards against a test leaving files behind. Run: with a shell made to write 20000 files into the log's TempDir between the open that goes through and its note, the test failed with the issue's "directory not empty" every time without the wait and passed 5 of 5 with it (the write-tail injection was for the runs only, not committed). Without it, -count=5 and the package's -tags nogui suite pass. Reviewed and landed as one batch of 12 commits (gua's #4593, #3269, #3881, #2887, #3289, #2718, #2855, Edward4226's #2718 key-path sibling, and four review follow-ups). Run for the batch, whose last commit's tree is 5d58a75f3: - Full suite before the rebase (base |
||
|
|
2c33db2499 |
agent: VS Code 1.139's versioned layout hides the launcher's marker
Tony-ooo's retest (magpie 0.1.2322, VS Code 1.144.0 on Windows): the false positive of #3269 is back — bin\copilot-shim on PATH, no ~\.copilot, and magpie ls still lists Copilot CLI. The marker check |
||
|
|
96a37ee5e3 |
usage: the vendor's own alias for a model isn't a swap (#4593)
A request via Top-API for deepseek-v4.1-flash answered under deepseek-flash was marked a swap. It isn't one: DeepSeek renamed its V4.1 Flash deepseek-flash (api-docs.deepseek.com/updates, 2026-09-10: "Change the model name to deepseek-flash to call the latest V4.1 Flash model"), and every exemption Swapped knows is structural - a dated or pinned tail, a Bedrock geography, a relay's word in front, a serving name - none of which an official rename reads as. VendorAlias reads a small table of rename pairs the vendor's own docs state (deepseek-flash is V4.1 Flash), both ways, over squashed bare names so case and separators don't matter; a bareModel'd name feeds it, so the dated spellings either side writes hit it too. Only pairs the docs state go in: a retired name routed elsewhere (deepseek-v4-flash) is another model, and catalog's SameModel keeps deepseek-flash an id of its own. The kept-row readers take the alias in beside the other exemptions, so rows recorded before it are read back as not swapped. Run (sandbox HOME, GOTOOLCHAIN=auto, -tags nogui): go test ./internal/usage -run 'TestSwappedVendorAlias| TestKeptRowVendorAliasNotSwapped' -> ok (base |
||
|
|
d8f7d089f1 |
agent: Claude Code's model field appends the kept list without a copy first
The model field (and a WSL Claude Code's, asleep) appended claudeViaMagpie's list to Claude Code's own models, which copies it, after claudeViaMagpie had copied it once already: 6.3 MB of forty polls with real accounts. claudeViaShared gives the list kept, read only, to such a caller; the append makes the field's list one of its own. claudeViaMagpie still gives every other caller a copy. TestClaudeViaMagpieKept now also writes into the model field's options and checks that neither kept list (folded or not) changes. Run on mote at |
||
|
|
9f75279e9b |
gui: Hide accounts keeps its old flex on Routing and Usage
|
||
|
|
2297597f03 |
gui: Hide accounts' comment cut, the core back under its budget
|
||
|
|
68ebd1ec4a |
agent: a provider's options an agent reaches on its own are kept
Goose's model field asked ownOptions each poll, for the picker and again for Drift, and each provider's models were made into options anew (catalog.Provider, options, group, its icon): ownOptionsFrom was 21.2 MB of forty polls with real accounts. For agents without a registry of their own (native == nil), each provider's options are now kept in ownBuilt per provider.StampNow (a minute at most) and copied into the caller's list; Pi's and omp's, which read their own registries, are built as before (ownProvider is the old loop body). TestOwnOptionsKept: a catalog of 200 OpenAI models; asking again takes a fifth or less of the allocations building does, a caller's write doesn't reach what is kept, and a model the catalog lists since is offered. Run on mote at |
||
|
|
5e0d4e1282 |
agent: Claude Code's magpie list is kept as viaMagpie is
Claude Code's model and tier fields asked claudeViaMagpie each poll, for the picker and again for Drift, and it built the list anew each time: 19.1 MB of forty polls of the Agents, Providers and Drift answers with real accounts. It is now kept in builtOptions per provider.StampNow (a minute at most), folded and not apart, and each caller has a copy of its own (buildClaudeVia is the old body). TestClaudeViaMagpieKept: a provider of 102 models; asking again takes a fifth or less of the allocations building does, a caller's write doesn't reach the kept list, the folded list is kept apart, and a provider saved since is offered. Run on mote at |
||
|
|
ef63ef4a22 |
provider: Codex's subagent models are kept while the catalog is held
Codex's Agents row asked CodexSubagentModels each poll, and each time it took a copy of Codex's whole catalog (CatalogFor) and made a list from it: 21.8 MB of forty polls of the Agents, Providers and Drift answers with real accounts. The list is now kept as the catalog is (keptOf, per provider.StampNow and keptFor), read from the catalog's own kept lists (catalogKept) without a copy, and clipped so a caller appending makes a list of its own. Its one caller, codex.go, only ranges over it. TestCodexSubagentModelsKept: 200 models of a relay under Hold; asking again allocates a quarter or less of what building them does. Run on mote at |
||
|
|
e4384fc3cd |
gateway: a Codex stream cut inside a line still has its failure read (#3377)
#3377's patch writes response.failed when the upstream cuts a Codex stream mid-reply. When the cut lands inside a line, the half line was still open, so the events streamError writes were read as more of that line's data and the client never parsed the failure. A blank line now goes first, ending the half event (as #2446 and #2580 do on the other relays). TestCodexStreamCutMidLineFailureParses cuts the stream inside a delta's data and checks every event the client reads parses, apart from the half line itself, and that response.failed is among them. Landing record (yetone): Run at the pushed batch head (tree a6b084d0b, on origin/main |