ccb75030aaba3cf7359ea2dd784c00ecc7e80c19
2579
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
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 ( |
||
|
|
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
|
||
|
|
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. |
||
|
|
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
|
||
|
|
9f75279e9b |
gui: Hide accounts keeps its old flex on Routing and Usage
|
||
|
|
2297597f03 |
gui: Hide accounts' comment cut, the core back under its budget
|
||
|
|
3f2faef620 |
gui: the Providers page has its own Hide accounts switch
Routing's Hide accounts (账号打码) also masked the Providers page, where nothing showed it was on or let you turn it off (Discord #feedback, 1566189346665799752). The Providers page now has its own switch beside its search box, placed and drawn like Routing's (.rt-mask moved from routing.css to app.css), and each page follows its own switch: Routing, Usage and the tray panel follow magpie.maskEmails, Providers follows magpie.maskProviders. The user's own choice is kept: when maskProviders was never stored, it is seeded from maskEmails and written at once, so someone who had masking on stays masked on both pages after the update, and someone who turned it off stays unmasked. A switch with a stored choice is not changed by Mask personal data's follow(); turning Mask personal data on still masks both (hideAccounts.set(true, true), in app.js and plugins/redact/page.js). show() asks hideAccounts.page() to re-mask when the page in sight follows the other switch. No new strings: the button reuses Routing's translated label and title. app.js 1,310,438, core under its budget, no raise. Run: - New internal/gui/tests/provider-mask.test.cjs, both engines, all 5 languages, at 1000 and 420 wide, plus the touched window-mask, account-eye, privacy-hides-accounts, mask-emails, plugin-name-unmasked, masking-demo-unblurred: 134/134 on mote. At the rebased head (origin/main |
||
|
|
3cfba2e376 |
test(gui): deprecated-subscriptions times the page's boot as its navigation (#3484)
Follow-up to ggbdpq's change before this one. Looking for an app-side cause behind the WebKit zh red found none. With ?view=providers the view comes before lastView, and renderProviders draws #movable synchronously once /api/providers is read. Run alone, the notice is up 20 to 40ms after the load event. What the 5s wait covered is the boot that follows goto's load event: /api/state, then /api/providers, then the rows. Under the whole suite's load that boot ran past a limit meant for one action on a loaded page. ggbdpq's 15s had no basis beyond being longer. The boot is the second half of the navigation, so it gets the navigation's minute, which #4470 gave every page.goto. The waits inside a loaded page keep 5s. The pageerror filter matched "due to access control checks" anywhere, in either engine. It is now anchored to WebKit and to "Fetch API cannot load …", as title-bar-tools and usage-fold have it (#1350). Broken by hand on mote: with /api/providers held 6s in the test's serve, webkit zh is red at a 5s wait ("locator.waitFor: Timeout 5000ms exceeded … #movable .deprecation") and green at this 60s. Run at the pushed head on mote (load ~115): - deprecated-subscriptions.test.cjs, chromium and webkit, en and zh: 4/4 (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main |
||
|
|
f802fc3301 |
test(gui): the deprecated-subscriptions waits after a page load get 15s
Under the whole suite's load, webkit zh once waited past the 5s default for the deprecation notice after the reload of Providers (#3484): a page load serves the files one by one, then /api/state is read before /api/providers before the rows, and the red passed alone right after. The notice and badge waits after a load get 15s; a load itself now has the 60s navigation timeout (#4470), and the waits inside a loaded page keep the quick 5s. The injected 6s /api/providers read that reproduces the red also showed a second snag on the same path: a reload kills the page's own background reads (the web update poll, What's new), and webkit reports each killed fetch as a page error on the page it leaves, which the errors assertion would have tripped on in just such a slow run. With every response faked here, that wording only ever means a killed read, so it is not counted as a page error. Landed (yetone): the next commit times the boot as the navigation and anchors the filter to WebKit's wording. Generated-by: GLM-5.3-Flash (ZCode) |
||
|
|
9c8636a351 |
gui: a proxy typed outside Settings takes its login in fields (#3382)
Settings' proxy row keeps a proxy's login in fields of its own, so a
password with @ : / % # or a space survives. The three places that ask
for a proxy of their own still took one line, and the same login had
to be percent-encoded by hand. Those places are the provider editor's
row, each account's and key's line, and the sign-in box's typed proxy.
Each now splits a pasted URL the way Settings' proxyFields does: the
login lands in the fields and the box keeps the address. What the
fields hold is joined back as it is typed, so the value saved (or sent
to a sign-in) is the address Settings would save for the same login:
userinfo in the address, the saved format unchanged. A field left as it
was split keeps its escapes, so a saved login with non-UTF-8 bytes
opens decoded, still works, and saves again byte for byte. A pasted URL
keeps working.
The layout question the issue leaves open ("an account line with two
more fields is wide"): the fields stack under the row, 140px each, so
an account line is no wider. A mode pick that doesn't ask for an
address dims them with the row's own "off", keeping their room, as the
address box always did. proxyLoginRow is the one helper, drawn by all
three places. Settings' own row is untouched. signin-proxy.test.cjs
pins the form's address as its first input, with the two new fields
beside it.
Changed in landing (yetone):
- The fields show for every scheme, as Settings' do. As first written
they showed only for a SOCKS address, but the split ran on any
pasted URL, and join skipped hidden fields. So a pasted
http://name:pw@host lost its login on save. With this change's first
app.js the new HTTP case is red: it saves "http://proxy.example:8080".
- The core budget is not raised. Comments were trimmed to bring the
core to 1,532,444 of 1,533,105.
- The test sets the navigation's minute, as the #4470 guard asks.
Save and the sign-in wait on the post itself, with 30s of room, not
a fixed 2.5s or 2s cap. The sign-in no longer clicks "Sign in
anyway": on main a sign-in again goes straight to the browser.
Broken by hand on mote, chromium en and zh: with app.js and app.css at
origin/main, proxy-login-fields is red 6/6; with this change's first
app.js, its provider case is red 2/2 on the HTTP login.
Run at the pushed head on mote (load ~115):
- proxy-login-fields.test.cjs, chromium and webkit, en and zh: 12/12.
- The same run took signin-proxy, account-proxy, provider-proxy,
provider-many-keys-proxy, provider-advanced-fold, nav-timeout and
i18n-keys in both engines (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main
|
||
|
|
fcf87a7853 |
test(gui): four pages with a 5s default get the navigation's minute (#4622)
nav-timeout.test.cjs, the #4470 guard, is red on origin/main |
||
|
|
573b21f4b0 |
gui: the Providers answer is written a provider at a time
Each poll encoded /api/providers whole, growing json's buffer to the
answer's size once the GC had emptied its pool. writeProvidersJSON
writes the same bytes with each provider's row encoded alone, as
writeStateJSON does for agents; every handler that answered
writeJSON(rw, providersState()) uses it.
Real accounts (sandbox copy of the owner's HOME, network blocked), 40
polls,
|
||
|
|
616405061a |
gui: a provider row's models and agents are made once at their size
providerInfoWith grew a row's model list by append for the decision models the vendor list lacks and for the picks it lacked, then grew it again with slices.Insert to put those picks in front, and grew Agents one append at a time. The rows are now counted first and each list is made once at its size, in the same order as before. Real accounts (sandbox copy of the owner's HOME, network blocked), 40 polls of /api/state, /api/providers and drift, pprof alloc_space between the two heap snapshots, v0.1.2484 (mhost) vs this (mrows): providerInfoWith flat 50.7 MB -> 38.5 MB, cum 164.9 MB -> 138.8 MB providersState cum 273.2 MB -> 270.5 MB (the total is noisy +-25 MB from the state encoder's pooled buffers: 621 vs 637 MB) /api/state and drift bodies byte-identical; /api/providers equal but for `fetched` and one login's `lapsed`, set by a refused refresh in the blocked sandbox when a token came due during one of the runs (logins_on.go), a path this change doesn't touch. TestProviderRowListsMadeAtTheirSize: 107 rows from 100 listed models, 7 picks the list lacks plus one it has, 3 agents; picks in front in their order, cap == len for Models and Agents. On the old providers.go (at HEAD) it fails: "models made for 219, 107 rows". Forcing growth by hand in the new code fails it the same way. Run on mote at this tree: gofmt, go vet, GOOS=windows go vet ok; the new test and the model-order tests 3/3 ok; go test ./internal/gui: only the known reds TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949) failed. Not run: the full ./... suite. |
||
|
|
5bfa9f0762 |
gateway: a group's backup gives the conversation back once the member listed ahead of it is ready again (01huadalang on Discord)
01huadalang on Discord, after |
||
|
|
6a7a690be0 |
gateway: the Providers page's drawers come from the list it has
Each /api/providers poll asked gateway.Drawers for each provider's image
models, and Drawers read the provider's model list again (p.Available)
though providerInfoWith already had it in the kept Listing. In a
real-account heap profile (20 warm rounds of drift, state and providers)
Drawers was 14.4 MB of what was allocated.
DrawersOf takes the list as a func, called only on the paths that read
it (a Google sign-in's, a plugin's), and the Providers page passes its
Listing's Available, which is p.Available() kept (Provider.Listing).
Drawers itself is DrawersOf(p, p.Available) for every other caller.
Real use: the owner's real-account sandbox, offline (proxy to :9), 20
warm rounds of /api/drift, /api/state and /api/providers, at this head:
- Drawers 14.4 MB -> DrawersOf 3.1 MB.
- /api/state and /api/drift bytes identical to 6712e367e's (cmp);
/api/providers differs only in each provider's "fetched" time.
Run on mote (mote-run, Go 1.26.8):
- gofmt clean; go vet ok, also GOOS=windows and GOOS=linux.
- TestDrawersOfTheCallersList alone, 3 times: ok.
- Broken by hand (DrawersOf reading p.Available()): red, "drawers [],
want gemini-3.1-flash-image alone".
- go test -timeout 45m ./internal/gateway: ok (669s). ./internal/gui:
FAIL on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners (#3949), both red on main and filed. That run
was at dd7442f28; this head is it rebased on
|
||
|
|
41b5c0f19a |
accounts: Claude Code stays on the account it moved to till that is spent too (hxy920830 on X)
hxy920830 on X wants Claude Code to use one account to 98%, move to the next and use that one to 98%, not jump back the moment the first resets. No setting gave that. NextLogin (#408) signed the agent back in to the first account as soon as it was under 90% again, under every routing. KeepLogin pins one account, In order goes back too, and switch only went back as well. Where the sign-in is what spends the accounts (Claude Code, whose own requests never pass the gateway, and Codex under switch only), the sign-in now stays on the account it moved to until that one is spent or fails, then moves on to the next ticked account with room. It goes back to the first only where the user said the first comes first: routing In order, or KeepLogin. Codex through the gateway keeps going back, because Smart routing sends its requests to the first account (#209) and the sign-in follows it. This is returnsToFirst in codex_switch.go. The return record is still written, so turning In order on later goes back as before. An old record is ignored otherwise, and its "First again" label (logins.go) is hidden. No user setting is overridden: In order and KeepLogin keep their meaning. GUI: the Routing note for Claude Code (and Codex under switch only) now says it stays on the account till that one is 98% used too. The two switch-only tooltips no longer promise going back. New and changed strings are in zh, zh-TW, ja and de. app.js lost a 3-line comment so the core script budget holds without a raise (core 1,531,108 of 1,533,105). Run on mote at 94cd5edde (base |
||
|
|
d307aa6485 |
gui: /api/state is written one agent at a time, for the page and the kept sum at once
Each poll of the Agents page encoded the whole state (1.3 MB with real accounts) into json's buffer, and the GC between polls empties the pool that buffer comes from, so it grew to the state's size again each poll: 48 MB of what twenty rounds allocated (v0.1.2477 build, real-account sandbox), and 68 MB at v0.1.2463. writeStateJSON encodes the state without its agents twice (as sent, and as keepState keeps it, without the settings), and each agent once, straight to the response and to keepState's sha256, through one encoder. keepState is split so the handler hands it that sum (keepStateSummed). When the splice can't be made (no agents, or a field put before "agents"), it writes and sums the state whole, as before. Measured on this Mac with the real-account sandbox (abr.sh, 20 rounds of drift + state + providers): - v0.1.2477: writeJSON under /api/state 48 MB, 511 MB in all. - this change: writeStateJSON 15 MB, 477 MB in all. The /api/state bytes are identical to v0.1.2477's (cmp). Run on mote (mote-run, Go 1.26.8): - gofmt clean; go vet ok, also GOOS=windows. - TestStateWrittenAsEncoded (same bytes as Encode, same sum as keepState, for a large state, an empty agent list and none) and TestStateWriteGrowsNoBufferItsSize, with TestKeptState* and TestLast*: ok 3 of 3. - Broken by hand (the whole-state path always taken): red, "writing a 1614586-byte state allocated 4207139 bytes, want under half its size". - Not run before this push: the full internal/gui package; it runs next. |
||
|
|
93879515a0 |
agent: QwenPaw, each of its agents' active_model one of magpie's (pkh1585 on Discord)
pkh1585 asked for QwenPaw (AgentScope, github.com/agentscope-ai/QwenPaw)
on Discord. Read in its source, 2.2.2.post1, as data:
- Its folder is QWENPAW_WORKING_DIR, else ~/.copaw when that exists (the
old name), else ~/.qwenpaw; WORKING_DIR/.env is loaded without
overriding the environment. config.json's agents.profiles lists the
agents, each with a workspace_dir whose agent.json holds active_model
{provider_id, model}, read again on each message.
- Providers are no plain config: SECRET_DIR (QWENPAW_SECRET_DIR, else
"<WORKING_DIR>.secret") holds providers/{builtin,custom}/<id>.json,
read once at start. A plain api_key there is encrypted to "ENC:" at
start, so that is the place QwenPaw itself keeps keys.
What magpie does now:
- `magpie qwenpaw <model>` and the GUI: a row per QwenPaw agent
(qwenpaw#<id>, the default one as plain qwenpaw), skipping agents whose
backend is ACP (another CLI runs those) and agents turned off.
- Connecting writes providers/custom/magpie.json (mode 600, the gateway's
/v1 and the magpie-qwenpaw key, magpie's models as extra_models with
their window, output and tool use) and sets that agent's active_model
to {magpie, <provider>/<model>}. The old active_model is stashed as it
was and put back verbatim on disconnect, absent and null included.
The provider file is removed only when no QwenPaw agent still uses it.
- A sync after QwenPaw re-saved the provider (encrypted key, discovered
models, its own defaults) keeps what QwenPaw wrote and changes only
what magpie owns, so a second connect leaves the file as it is.
- The notice says QwenPaw reads providers at start-up: restart it once
after connecting and after magpie's models change. New text in every
locale.
- appdir: QWENPAW_WORKING_DIR and QWENPAW_SECRET_DIR take ~/ as QwenPaw's
expanduser does; agentenv clears them in tests.
- README (en, zh), docs/reference.md, agent-wiring.md, the site's agent
list and start pages (en, zh, ja), icon.
Run:
- internal/agent's QwenPaw tests (Connect, AgentsAreRows, SyncKeeps-
WhatQwenPawChanged, Check, NotStartedYet, Folders, OwnModelAfter-
Magpies, SyncAfterQwenPawSaved, NullModelRestored) on mote, and the
all-agent tests (applied, rewire, lan_kept, proxy_kept, spelled) with
a QwenPaw fixture.
- Broken by hand, each red: always rewriting the key
(SyncKeepsWhatQwenPawChanged), removing the provider while another
agent uses it (AgentsAreRows), no backend filter (AgentsAreRows lists
qwenpaw#coder), dropping the keep of QwenPaw's own fields
(SyncAfterQwenPawSaved), IsObject for Exists (NullModelRestored).
- Real QwenPaw 2.2.2.post1 (Python 3.12 via uv) in a sandbox HOME on
the Linux box (WSL magpie-desktop), magpie on 3741, a fake OpenAI
upstream on 3742: first start wrote config.json and agent.json;
`magpie provider add fake …`, `magpie serve`, `magpie qwenpaw
magpie/fake/echo-1`; after a restart QwenPaw encrypted the key (ENC:)
and `qwenpaw agents chat` answered "PAWPAW-OK from the fake upstream",
its log "built agent … model=magpie/fake/echo-1"; the upstream saw
/v1/chat/completions model echo-1 streamed, magpie's usage.jsonl
agent qwenpaw status 200. A second connect and `magpie models` left
the provider file unchanged. `magpie qwenpaw default` took
active_model back out (the only diff in agent.json) and removed the
provider; QwenPaw started clean after.
- gofmt -l clean; go vet darwin, GOOS=linux and GOOS=windows -tags nogui.
- Full suite on mote (go test -tags nogui -count=1 -timeout 45m ./...)
at 9554883db on
|
||
|
|
323159f1cc |
usage: a Codex reset's confirmation picks which of the account's resets is used (01huadalang)
01huadalang on Discord: resets were used only automatically, or by hand
the one that runs out first. Which account was already the user's to pick
(each account's card has its own Use); which of its resets was not.
- Usage card's "Use a reset" and the menu bar panel's "Use one...": when
the account holds two or more resets listed with their ids, the
confirmation has a "Reset to use" pop-up (the app's menu, not <select>),
soonest first and picked unless another is. Once another is picked it
names the account and that reset ("The one used is me@'s reset that
runs out ..."), and says the sooner one is kept and lost if unused.
Escape closes the open menu first, not the confirmation.
- POST /api/usage/codex-reset takes an optional credit. The server reads
the account's resets again and spends that credit only if it is still
held; a gone one is refused and no other is spent in its place. With no
credit it is as before (the soonest). Auto-use is unchanged.
- ResetCard carries the credit id; `magpie quota reset --card n` is the
CLI's sibling, its prompt naming the reset.
- askReset's dialog moved out to resetask.js, imported when Use is
pressed (like signsheets.js), so the core's scripts are 1,530,733 bytes,
under the 1,533,105 budget with no raise (the pick alone took it 2,068
over). Five keys in zh, zh-TW, ja, de.
Run on mote (mote-run), at the base
|
||
|
|
0aafcc0fd0 |
provider: which models a provider has no API for is found once per list
NoAPIFor found the protocols the provider speaks for every model it was asked about, and APIs did again through ModelAPI, so a list of N models built 2N Speaks slices. The providers' page, ExposedOf and servable ask it for each model of each provider: 16 MB of what twenty window polls allocated with real accounts (m2463 profile). NoAPI() finds the protocols once and gives a func for each model; APIs and ModelAPI take them through apisAmong and modelAPIAmong. NoAPIFor, APIs and ModelAPI answer as before. Test: TestNoAPIFindsTheProvidersAPIsOnce. 100 models of a relay, half listed on chat: Speaks looked up once (5 at most, for another test's look), the chat half kept, NoAPIFor the same for each. Run on mote, at this tree: - gofmt, go vet (darwin, windows, linux): ok - the new test with TestExposedOnlyOnTheAPIsTheProviderHas and TestListedAPIsCost, 3 times: ok - broken by hand (NoAPI back to a per-model NoAPIFor): red, "100 models looked up the provider's APIs 200 times" - go test ./internal/provider: ok - go test ./internal/gui (before the apisAmong step, which touches internal/provider only): every test ok except the known TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners (#3949) and TestColdTurnsTaken (#4510) Not run: an A/B with the real-account sandbox for this change alone. |
||
|
|
6a23d9d755 |
gui: the kept state and providers are marshaled only when they changed
keepState and keepProviders ran json.Marshal on every /api/state and
/api/providers poll to compare the answer with the one kept on disk.
They now keep a sha256 of what was written and hash the new answer
into it with an Encoder; only a changed answer is marshaled and
written. json.Marshal there was 38.6 MB (keepState 25.9 MB,
keepProviders 12.7 MB) of what twenty window polls allocated with
real accounts (m2463 profile).
Test: TestKeptStateMarshaledOnlyWhenChanged. Twenty identical keeps
marshal nothing, nor does a keep after the file is read again; a
changed state is marshaled once and read back.
Run on mote, at this tree on
|
||
|
|
a38a0d7794 |
gui: a provider's models are put in order once, not copied for each pick put first
providerInfoWith grew each provider's Models from nothing, and put each model the user picked that its vendor no longer lists at the front with an insert, a copy of the whole list each time. In twenty polls of the Providers page with real accounts that was 13 MB of copies and 22.6 MB of growth. The list is now made at its length, and the unlisted picks are put in front with one insert, in the order they were before. TestUnlistedPicksShownFirst: Available a, b and Exposed a, x, y, z show as z, y, x, a, b with four exposed, as before. Run on mote (macOS 27): - gofmt, go vet ./internal/gui (darwin, windows, linux): ok - the new test alone, 3 runs: ok - broken by hand (the reverse taken out): red, "models shown as [x y z a b], want [z y x a b]" - go test ./internal/gui: ok but for two reds already filed and red on main: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949) Not run: the whole suite; this changes one function of internal/gui. |
||
|
|
f598edf6d5 |
providers: a provider's model lists are kept across polls with the catalog
The Providers page's state built each provider's Available,
ExposedOf(Available) and NewestInFamily(Available) lists again on every
poll. Over twenty polls of the real-account sandbox that was 159 MB of
the 371 MB providerInfoWith allocated (Available 72, NewestInFamily 60,
ExposedOf 27). provider.KeptListing keeps the three lists in keptOf, the
cross-request cache that drops them when the catalog, providers.json,
settings or a plugin changes (StampNow) and after keptFor, and only while
a request holds. providersState passes the kept Listing; providerInfo,
for one provider after an edit, still builds a fresh one. The lists are
clipped, so an append makes the caller's own.
TestProvidersListingKeptAcrossPolls: twenty polls with nothing changed
build the listing 0 times and match a fresh Listing; after a Save of the
provider's models the next poll shows the new ones. With keptOf swapped
for a direct call by hand it is red: "built the listing 20 times, want 0".
Run on mote at this tree (on
|
||
|
|
05f6ca39b3 |
provider, gui: settings only read go through the shared copy
settings.Load clones the whole Settings, every provider's model prefs included. CompactsOf, OutputsOf, ModelNames, ModelEfforts, settings.SavedAddr and the GUI's providerInfoWith only read it, and providerInfoWith took a copy for each provider: 16 MB of what twenty window polls allocated in a real-account sandbox, more with each model a user has set prefs for. They read settings.Shared() now. ModelEfforts hands back a clone of the slice it finds, so a caller's change never reaches the shared settings. TestModelPrefsReadTheSharedSettings: 3000 other models' prefs; the values are right, a caller's change to ModelEfforts' list doesn't reach the settings, and each look allocates at most a tenth of Load's. Red on the old code: ~6058 allocations a look against 6056 for a Load. Run at this head on mote: go vet (darwin, GOOS=windows, GOOS=linux without the gui package) ok; go test ./internal/settings and ./internal/provider ok; ./internal/gui red only in TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red on main. |
||
|
|
019bfc951b |
gui: a page of accounts builds the agent list once, not once a row
accountLabel and the excluded-agents loop called agent.Find for each row,
and Find builds All() again each time: about 3,300 allocations a call.
Over 20 window polls that was 58 MB of the 1.4 GB a magpie allocated.
provider.Held keeps All() for the request that holds it (the gui's held
middleware holds every /api/ request), and agent.FindIn looks the name up
in that list. Outside a hold Held builds it as before, so a caller with
no request in hand gets the same answer.
TestAccountLabelsBuildTheAgentsOnce (sandbox HOME): outside a hold the
label's name and icon are the same; under Hold a row allocates 3 times
against 3302 to build every agent. Broken by hand on mote (agentNamed
back to agent.Find) it is red at 3305 a row.
Run on mote at this tree (on
|
||
|
|
3182a66586 |
provider, gateway: OpenRouter's decision model picked with a variant (inception/mercury-decide:free) is a decision model, never sent to chat/completions
coeo91 on Discord (2026-10-31): inception/mercury-decide:free, picked by
hand into a group used as smart routing's decision model, failed with
"OpenRouter: inception/mercury-decide:free is a decisions model and
cannot be used with the chat/completions endpoint. Use the
/api/alpha/decisions endpoint instead."
Cause: magpie already reads OpenRouter's decision models from its own
list (/models?output_modalities=decisions: output_modalities
["decisions"], endpoints ["/api/alpha/decisions"]) and asks them at
/api/v1/systemone. That list names each model once, without variants,
so the hand-picked ":free" id was taken for a chat model. Its group was
a chat group and the classifier asked it in words on chat/completions.
Now a variant of a model OpenRouter's decisions list names (base id
before the last ":", OpenRouter providers only; Ollama's :tag stays a
name of its own) is a decision model (openRouterVariant):
- it is kept from agents' model lists, and its group is a decision
group, asked at /api/v1/systemone (classifier, RouteDecider);
- an agent's chat naming it gets magpie's 400 "only decides", with
OpenRouter not asked;
- count_tokens naming it, or its decision group, gets the same 400
(count_tokens had no decision guard and forwarded upstream);
- test-models sends it the System One yes-or-no, and the provider
editor marks it as a decision model (/api/providers deciders).
Not done: an /api/alpha/decisions client. OpenRouter's /api/v1/systemone
(what magpie uses) answered the same model the same way as the alpha
path in a real probe (200, identical System One shape), so the alpha
endpoint adds nothing but an alpha contract.
Real probe (owner's OpenRouter key, 2026-11-01): chat/completions with
inception/mercury-decide:free gives the reporter's 400 word for word;
/api/v1/systemone and /api/alpha/decisions give 200 for
inception/mercury-decide and 404 for :free ("This model is unavailable
for free... use this slug instead: inception/mercury-decide"). So
after this change the reporter's group is asked the right way, and
OpenRouter's own 404 says to pick the paid slug.
Tests (fixtures are OpenRouter's real list and answer bytes):
TestOpenRouterDecisionModelVariant (provider),
TestOpenRouterDecisionVariantNeverChats (gateway: classifier group asked
at /systemone, chat and count_tokens refused, OpenRouter asked once),
TestOpenRouterDecisionVariantPicker (gui). Each is red on the old code
(provider: "taken for a chat model"; gateway: the reporter's 400 as the
classifier's error; gui: deciders without the variant), checked at
|
||
|
|
e6b595e1ab |
claude: Interactive only, a setting under which a model request never runs as claude -p (_yuchanns_ on X)
_yuchanns_ on X, on the interactive mode falling back to -p: for people
who stayed off magpie's Claude subscriptions because of -p, a fallback
is a time bomb. Settings › Models › Replies › Claude Code's interactive
mode now has three choices: Off (always -p), On (the default, falling
back to -p as before) and Interactive only.
With Interactive only (settings.ClaudeTUIOnly; ClaudePrintMode set too
wins):
- a run claudeTUI would make -p is not started; the request fails with
the reason and the setting (claudeOnlyErr, claudeNotTUIWhy);
- the helper is handed MAGPIE_CLAUDE_TUI_ONLY=1 (claudetui.OnlyEnv,
claudeCLI.tuiEnv). Where it would exec -p (no start, sign-in, first-run
notes, untrusted folder, 45s timeout) it exits with the reason
(fallBack in Run), and it ignores the broken mark;
- a helper that never answers initialize ends the turn with an error,
not a -p retry, and `broken` isn't counted (claudeMachineWhy), so the
next run tries the interactive mode again;
- the model test's and warm-up's "hi" (askClaude) runs through the
helper (askClaudeTUI) in stream-json, its stdin closed at the first
result. The helper command and env are built in one place now
(tuiCommand, tuiEnv) for both.
Reading the plan's allowance (/usage) asks no model and stays -p; the
setting's text says so. Docs: claude-subscription-bridge.md.
Provider editor, on e8347401f's "Claude Code runs as" pill
(ClaudeMode.Only): with the interactive mode in use and no last
request, it says a request it can't take fails, and the card's foot says
nothing runs as -p. Where the interactive mode can't run, the pill names
Interactive only, never claude -p, the line says "Claude requests fail:
<why>", and Change in Settings goes to the row. A request refused this
way never ran, so it isn't noted as the last request (noteClaudeRun
comes after the refusal).
app.js: the Replies rows share one helper (segRow, which waitRow uses
too), so app.js is 530 bytes under main's with the third choice; no
budget raise.
Tests: TestClaudeTUIOnlyRefusesPrint, TestClaudeTUIOnlyHungHelperNoPrint,
TestClaudeTUIOnlyTellsHelper, TestAskClaudeTUIOnly (gateway);
TestShimOnlyNeverPrints (claudetui: fake fail/trust/login/notes each
exit with an error and no -p, a marked-broken run still interactive);
claude-tui-setting.test.cjs (three choices, Only saves claudeTUIOnly with
claudePrintMode false) and claude-mode.test.cjs (Only in use, and Only where it can't run).
Broken by hand, each red, then put back: the startRun gate off
(RefusesPrint 200); start()'s Only check off (HungHelper 502 without the
Only reason); tuiEnv's OnlyEnv off (TellsHelper); askClaude's branch off
(AskClaudeTUIOnly); the helper's fallBack ignoring only (4 subtests);
BrokenSince's `&& !only` gone ("marked broken"); the save without
claudeTUIOnly (16 of 16 setting tests) and claudemode.js's m.only
branches gone, rebuilt on e8347401f's file (10 of 10 Only tests,
Chromium).
Run on mote at
|
||
|
|
f1d6f4137c |
gui: a provider's row reads the vendor's list once
providerInfoWith read p.Available() four times for one row: for the picks (Picks), for what is exposed (Exposed, twice: the exposed set and the picks the list doesn't know) and for the newest of each family. Each read builds the list whole with its names, levels and plugin models. In a profile of v0.1.2432 against the owner's real config (20 rounds of the window's polls), providersState was 1.34 GB of 2.62 GB allocated, Exposed 390 MB, Picks 155 MB and the row's own Available 146 MB of it. Provider gains ExposedOf(avail) and PicksOf(avail), Exposed and Picks of a list the caller has read already; Exposed and Picks call them with p.Available(), so every other caller is unchanged. The row reads the list once and hands it to both. TestProviderInfoReadsTheListOnce: a 2000-model catalog provider with three picks, one of them unlisted, read the way the page's request reads it (provider.Hold and filememo.Hold). The row's Chosen equals Picks(), its exposed count equals len(Exposed()) and the unlisted pick goes first. A row takes 28.6 MB against the list's 8.0 MB (each model's own price, window and protocol look-ups besides); on the old code 54.4 MB, red at the 5x bar. Run on mote at 27401edd6 (go test -timeout 45m): internal/provider ok 161s. internal/gui: three reds, each already filed and failing the same on main: TestSettingsSaveKeepsWhatItDoesNotSend (#4514), TestMainWindowCorners (#3949), TestColdTurnsTaken (#4510). go vet darwin and windows ok, gofmt -l clean. |
||
|
|
e1aec53895 |
routing: each session sending at once has its own context window, named by its title (tjhhhh on Discord)
tjhhhh runs several agent sessions at once. The Routing page's context
window card followed whichever request came last, so it jumped from one
session's prompt to another's. The card still tells of the request it
picked. Under it, while two or more sessions are live, a strip now
shows one small block per session (renderCtxSessions):
- keyed as the card's line of prompts is (sessionKey, else the
conversation);
- named by the agent's title for the session (sessionName), else its
folder's last level, never a bare id;
- holding that session's newest reading through context.js's stack bar,
exported as window.ctxStack.
A session is live while a request of it is under way, or while its
newest request is within 15 minutes of the newest overall. At most six
blocks show, newest session first. A block keeps its place while the
sessions take turns, because blocks are ordered by each session's first
request. The block the card tells of is lit (aria-pressed), and a click
on a block picks that session's newest request. The card's footer names
the session by its title too. New words are in every locale in
plugins/routing/i18n.js. The strip reuses the card's tokens: no select,
no coloured border, no gradient.
The strip sits under the card, not over it. Over it, the strip's first
appearance moved the card, and routing-ctx-still ("the cache kept its
place") went red in both engines. It is green at base
|
||
|
|
e8347401fe |
providers: Claude Code runs as is a pill above the accounts, its hover card saying what TUI and -p each are and are good for
The owner asked for this design, and for it to replace the row |
||
|
|
0e90572274 |
browser: Magpie Browser, agents use the user's own browser and its sign-ins
The owner asked for a browser-use MCP of magpie's own, so an agent's browser keeps working when Claude Code switches accounts, and asked that it act in the browser the user uses every day: a fresh Playwright profile is signed in to nothing. Magpie Browser is an MV3 extension (internal/browserext, ID dmlhojidlfnkgamkekjhacgkpanbkeko, pinned by its key) that the user loads once in Chrome, Edge, Arc, Brave or another Chromium browser. It holds a WebSocket to the gateway's /v1/magpie/browser/extension and carries out each tool call with chrome.debugger (the DevTools protocol) in the user's own tabs. The socket is taken only from this computer, with a loopback Host (no DNS rebinding) and the extension's own Origin; a page or another extension that connected in its place would be handed every call. Agents reach it at /mcp/magpie/browser (Streamable HTTP) or through `magpie mcp browser` (stdio), and the Library's MCP market lists it as Magpie Browser, opt-in. Like the image server it is magpie's own, but it is never served to another computer, shared and with a key or not, and never to a web page, since it acts as the user wherever they are signed in. 17 tools: navigate (url, back, forward, reload), snapshot (an accessibility tree with refs, interactive-only on ask), click, type, press, select, hover, drag, upload, scroll, wait (text, gone, seconds), dialog, evaluate, text, screenshot (page, full page, element; JPEG or PNG), console and tabs (list, new, select, close). Each agent session goes on in its own tab; a link that opens a tab is followed, and a dialog a click opens is said in the reply. The Library's sheet for it has Set up the extension…, which writes the extension to ~/.config/magpie/browser-extension pointed at this gateway and shows the folder, the three steps to load it, and whether the browser is connected, polled while the sheet is open. Run: - TestBrowserToolsInARealBrowser: the extension magpie writes, loaded in a real Chrome for Testing 141 (Playwright's chromium-1234, headless=new) with --load-extension, connects, and all 17 tools act in a real tab of a fixture site. Green on mote (macOS 27), on xiaomi-gpu (Windows 11, win-run) and in magpie-desktop (Ubuntu 24.04, wsl-run). Under a test HOME Chrome needs --use-mock-keychain / --password-store=basic, or the extension's storage waits on a keychain and it never connects. - go test ./internal/gateway -run 'Browser|ReadOnly|Image', ./internal/ browserext, ./internal/browsermcp, ./internal/library, ./internal/gui -run 'Library|Browser', ./internal/cli on mote. - GUI: library-browser-setup.test.cjs (new) in Chromium and WebKit, en, zh, zh-TW, ja, de, at 1100 and 420 wide: 22/22. With i18n-keys and every library*.test.cjs: 915 pass, 1 fail, i18n-keys' "Unmarked", red on main since |
||
|
|
80af3b86a4 |
context: the card's head names the agent and the model's lab
The owner asked for the agent's name and the model's icon on the context window card, and picked design A from a mock-up: in the head, right of the title and before the state pill, [agent icon] Claude Code › [lab icon] anthropic/claude-sonnet-5-5 - context.js: the head's model is now a route (.ctx-route): the agent's icon and name (agentIcon, agentLabel, as the Usage page names it), a ›, then the model's lab icon before its id. labIcon picks the lab from the id after its provider prefix (Claude, OpenAI's gpt/o-series/codex, Gemma, Gemini, DeepSeek, Qwen, Kimi, GLM, Grok, MiniMax, Doubao, Mistral, Llama, MiMo, Step, Hunyuan); an id it doesn't know gets no icon, so a wrong logo never stands for a model. - context.css: the name in --fg-2 at 500, the › in --faint, the agent's icon 14px and the lab's 12px; the model id keeps its ellipsis. In a card 420px or narrower the agent's name and the › go and its icon stays; folded and that narrow, the model goes as it did before. - core_budget_test.go: lowered to 1,532,958, the core after this and the text viewer's move to ctxtext.js (the commit before), on origin/main |
||
|
|
9a9967ac28 |
context: a part's text viewer is loaded when a part is first opened
The context window card opens a part to the text the request sent there (readText, longText, picture, pieceView, openCtxText). That viewer is a dialog the user opens by a click, yet its 7KB were in context.js, which index.html loads on every page as part of the core. It moves as it is to ctxtext.js, which context.js imports on the first open, as signsheets.js and navlamp.js are imported; the card hands it the helpers it shares (fmtK, partName, itemName, itemLabel, tagOf). A failed import says so in the status line. The core is 7,005 bytes lighter, which makes room for the next commit (the card's head naming the agent and the model's lab); the budget is lowered there, to the total after both. old-webkit.test.cjs lists ctxtext.js among the scripts loaded later. Run at this tree ( |
||
|
|
20482d71ff |
library: a skill by a name the library has from elsewhere goes in beside it
mora1n on Discord: anthropics/skills' skill-creator and openai/skills'
are two skills by one name, and only the first could be added; the
second was skipped as "another skill called skill-creator, left as it
is". The library keyed being had by name in every place that asked.
Now being had is decided by source (hadSkill): the same source under any
name here, or a skill with no source (taken in from an agent's folder)
by that name with the very same files. Another skill from GitHub or a
git repository whose name is taken goes in beside it as
<name>-<owner> (skill-creator-openai), then owner-repo, repo, a number,
at most 64 bytes (freeSkillName in skill_beside.go). The library's copy
of its SKILL.md gets that name in the front matter's top-level name:
line (nameSkill), so no agent sees two skills by one name; Skill.Called
keeps the name it came with, and the carried bundle carries it. Its hash
is of the renamed copy, and checks (GitHub and git) and updates compare
what they fetch renamed the same way (fetchedHash), so it doesn't read
as edited and an update keeps the name.
The class: probe (Candidate.Have now means this skill; Candidate.As is
the name it has or would get), installFrom (listed and unlisted folder
by that name), the new-skills check (no longer drops a skill because
its name is taken), the market's had check (by name only for a skill
with no repository: none or a folder), carry, the TUI's probe list and
the GUI's probe list ("adds as {name}" with why in its title, "In the
library as {name}"; zh, zh-TW, ja, de; the tag is cut short in its row).
Old data: nothing is renamed. A skill already in the library keeps its
name, folder, SKILL.md and agent links; library.json without "called"
reads as before. Only a skill added from now on can get another name.
Not changed: a folder of the user's own is linked as it is and its
SKILL.md can't be named apart, so one by a taken name is still skipped,
now saying to rename it in its SKILL.md; and an agent's own skills
folder still holds one skill per name (an agent's own skill by the
library's name is settled by Use library / Keep agent's as before).
Run (mote, at c6fd4b37c on origin/main
|
||
|
|
76e4494dbd |
gateway: In turn passes over a provider's fallback while the provider is ready (01huadalang)
01huadalang on Discord (#feedback, 10-31): once the main provider has quota again, requests keep going to the fallback model, which is only meant for emergencies. Cause: a provider routed In turn treated its fallback rows as more of its own keys. A new turn went to the row after the last answerer (after), which past the provider's last key is the fallback, and a new conversation went to the row the fewest conversations held (leastHeld), which is the fallback nobody is on. Both happened while every key of the provider was ready. The session spread already skipped fallbacks (readyForNew); rotate's after and leastHeld(ready=false) did not. Fix: standsIn(order, i) marks a fallback row when the plan's first row is the provider's own. after, leastHeld and readyForNew all skip it, so a fallback takes a new turn or conversation only when nothing ahead of it can. Within one turn (tool results) a conversation still stays on whoever answered, because of sealed reasoning. Stays: Strict is the user's own choice and is not changed. A conversation it keeps on the fallback stays there. The trace now names the provider's ready first row (Affinity.Main), and the Routing page says why: the provider is ready again, Strict never moves a conversation, and new conversations go to the provider (en, zh, zh-TW, ja, de). Tests (internal/gateway/affinity_fallback_paths_test.go): - TestRotatingProviderKeepsItsFallbackForEmergencies (1 and 2 keys) - TestFallbackGivesBackAcrossRoutings: auto, in turn, in turn+session, least used+session, stays turn, and a group fallback with auto, in turn and session - TestStrictKeepsTheFallbackAndSaysTheMainIsReady On the old code, the rotate provider's new turn went to spare-key (Why new-turn), and in turn+session's new conversation went to the fallback (Why first). Broken by hand: with after's standsIn removed and Strict's Main dropped, the rotate test, the in-turn cases and the Strict test go red. session_spread_test's fallback case pinned the old In turn pick; it now expects k2. GUI: routing-affinity-order has a "strict" case. Run (via mote-run unless noted): - go test -tags nogui -count=1 -timeout 45m ./... at b08f35fcc (this change on |
||
|
|
0fe9f97c13 |
gui: an agent's model count is kept while nothing it counts changed
Every poll of the Agents page (agentModelCount, per agent per state)
counted each agent's model list anew: provider.ListedFor built whole,
with prices and groups, for a number and five names. On a real config
that was 0.27 GB of the 2.6 GB twenty polls allocated.
modelCount now keeps each agent's count under provider.StampNow (the
providers, settings and catalog files, filememo's generation and the
environment) for a minute at most, as agent's magpieModelsFor keeps
the agents' lists, and hands each caller its own copy of By and Names.
The stamp is read before the count is made, so a change while it is
made is counted on the next call.
TestModelCountKeptWhileNothingChanged: a kept count takes under a
twentieth of a count's bytes, a caller's write doesn't reach the next
caller, and a provider saved and a model hidden since are counted at
once. Red with modelCount counting each time ("a count already made
took 8223892 bytes, counting 8225345", 300 models).
Run at
|
||
|
|
6a900e0d04 |
gui: a poll of the Agents page no longer drops every cached model list
/api/state keeps the state it built in agents-state.json, written only
when the bytes change. They changed on every poll: a stale copy's start
is now less how long it has run, two clock reads apart, so it moved by
microseconds each time (on a real config, only
/agents[1]/staleCopies[i]/since differed between two polls). The file
was written through edit.WriteAtomic, whose write calls
filememo.Forget(). That bumps provider.StampNow, so every 15s poll threw
away each agent's model list and picker (magpieModels, viaMagpie) and
every provider's kept catalog, and the next look built them anew.
- StaleCopies' since is truncated to the second (the check against
magpie's change still uses the exact time).
- keepState writes through steady.WriteFile (temp, flush, rename), which
leaves filememo alone: nothing a request reads is built from this file.
Not changed: on Linux and WSL the process list gives a run time in whole
seconds (ps etime), so a copy's since can still move by a second between
polls there; macOS reads the exact start from sysctl.
Run on mote at
|
||
|
|
535371c8f3 |
providers: a Claude subscription says whether it runs as Claude Code's interactive mode or claude -p, and why
The owner: the Claude Code provider page should say whether its runs go through the TUI or the CLI, and what tells them apart and what each gains. Under a Claude subscription's accounts a row now says "Running as Claude Code's interactive mode (TUI)" (a green dot) or "Running as claude -p (CLI)" with why: turned off in Settings, failed to start lately, Claude Code in WSL whose home wasn't found, not installed, or a system with no interactive mode. Under the TUI it says which requests still run as -p (safeguards, a JSON schema, an image by URL, a first message over 400KB). "TUI or -p?" opens what each is: entrypoint cli, the plan counting a request at about half; entrypoint sdk-cli, about twice. "Change in Settings" opens Settings › Models at the interactive mode's row. Only switch, which serves nothing, shows no row. The mode comes from GET /api/claude/mode (gateway.ClaudeModeNow), read as the editor opens and kept 30s, never in /api/providers' polls. Its machine-wide reasons are claudeMachineWhy, which claudePrintWhy now calls first, so the row and the gateway's own choice can't disagree. The row is drawn by claudemode.js, which app.js loads with that first read, so it weighs nothing on the core: after a rebase on origin/main |
||
|
|
c30d3b7b63 |
plugin pages: a page the reader left is told, and let go after 10 minutes unless it keeps itself
A plugin's page kept its frame, with its scripts, timers and
connections, for as long as the window was open once it had been
looked at: show() only hid its view, and a frame in a hidden view isn't
hidden to itself (its visibilityState doesn't change), so a page
couldn't even pause on its own. Asked by the owner: is that by design?
Only the lazy first load was.
- The kernel's leave hook now reaches the page part: the page is told
{event: "visibility", data: {visible}} as the reader leaves and comes
back. The bridge has magpie.visible and magpie.onVisibility(fn); hello
carries visible, for a page left before it said hello.
- A page left 10 minutes (IDLE_MS) has its frame removed and loads again
when next opened. Back sooner, it is the same frame. Its hello timer is
cleared, so nothing says it broke.
- magpie.page.keepAlive: true (plugin.PageSpec.KeepAlive, keepAlive in
/api/plugin-pages) keeps a page however long, for one that works while
no one looks at it. Anything but true is false, read as raw JSON so a
wrong type never drops the package's page.
- plugin-runtime.md's page row says so.
Run on mote. The Go suite and most GUI files ran at this change on
|
||
|
|
b75fa328ce |
gui: the ban warning is said once, not again beside accounts signed in
The owner, on Claude Code's editor with four Claude accounts in it and "Claude 账号可能被封禁" shown on Add another: "这里就不要显示可能被封禁了". A subscription that warns before a sign-in (Claude, Antigravity and the plugin-served ones with risk) now warns only while it has no account signed in, and never to sign one of its accounts in again. startSignIn asks hasLogins(agent), and its o.user, before the risk step. The import box keeps its note. What goes with it: Factory's warning offered "Use an API key instead…". Factory is retired and the Add sheet leaves it out with no account, so that warning was reachable only beside an account, and no longer is. Its accounts list's "Add an account by API key…" row still offers the key; factory-key.test.cjs now starts there. signin-close and signin-proxy no longer click "Sign in anyway" in editors with accounts. claude-risk.test.cjs: a new case opens a Claude editor with an account, clicks Add another, and wants the sign-in asked at once with no warning (chromium and webkit, en and zh). The first-account case is unchanged. Run, on the Linux box (magpie-desktop): - Broken by hand: the old app.js with the new test: red in both engines, nothing asked. - All 46 GUI files that reach a sign-in or the warning, plus i18n-keys: 739 ok, 2 red. login-import chromium en timed out waiting on its import box, then passed 4 of 4 alone. i18n-keys' "a plugin's words are its own" is red the same at origin/main |
||
|
|
fb29cd30f9 |
tray: the Mac's menu bar figures are regular weight, a lone one in the menu bar's own font (qingnianxiaozhe on X)
Beside Surge's speeds and another app's stacked "0 KB/s", magpie's
"93% / 98%" read visibly bolder, and a lone "98%" too small and too
heavy, so the reporter kept it out of the menu bar. mpRowFont drew two
stacked rows in 9.5pt semibold and one row in 11pt medium, both since
|
||
|
|
59ea5dc8f8 |
gateway: a failure with this computer off the network rests nobody (usrname1833)
usrname1833 on Discord: with the computer offline, a routing group's
members failed to connect one after another, each rested, and the first
stayed behind the others once the network was back.
A 502 whose error says no connection was made (dial, lookup, refused, no
route, TLS handshake timeout, and Bun's ConnectionRefused / ENOTFOUND
for a plugin's fetch) now asks whether this computer has a network,
unless any upstream answered in the last 15s: no interface up with a
global address means none; otherwise up to three hosts of the user's
other providers (not p's own, not proxied ones, not localhost / LAN) are
dialled at once (2s), and none taking the connection means offline. The
verdict is kept 5s and asked by one request at a time. Offline, the
member is passed over as a down proxy is (failProxy): no rest, no count,
the trace says Fail "offline". One provider that can't connect while
another's host takes a connection, or while replies came lately, still
rests as before.
Covered where every rest passes: restAfterMarked (so decide_group's and
count_tokens' rests too), the serve loop's next-member path, and the last
member's label. Routing page: "network down" tag and a story for the
next-member and last-member cases, in zh, zh-TW, ja and de.
Run (mote, at this tree):
- gofmt -l clean; go vet ./internal/gateway on darwin, GOOS=linux,
GOOS=windows: ok
- go test -run 'TestOfflineRestsNobody|TestProxyDownDoesNotRest' -v
./internal/gateway: ok; go test -timeout 45m ./internal/gateway:
ok (708s)
- GUI: routing-offline.test.cjs (new) 10/10 and routing-proxy 4/4,
Chromium + WebKit, en zh zh-TW ja de. Every routing-*.test.cjs at once
(load 30-44 on mote): 1997 pass, 29 fail. The untouched base
|