85e4c693ee3ec96fc230bdd181eebe490888b366
1911
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9bbe177c6d |
gui: app.js's budget holds the Providers page's last list and the Routing trace's account names
TestCoreScriptBudget was red on this batch: app.js is 1,272,726 bytes
over origin/main's budget of 1,271,000 (
|
||
|
|
9d78a95ef8 |
routing: a flight's arc is laid again only when its ends move, and account names are read from answers without Object.entries (#1481)
Two smaller sources of the Routing page's steady garbage were left once the rows were kept. Both were measured with CDP sampled allocation at one request a second: - via's j laid the arc through magpie on every frame of a flight: a new path string and its control points sixty times a second, though its ends had not moved. It now keeps the ends it laid and returns when they are the same. That path was 10-13 MB/min and is now ~5. - noteAccounts walks every API answer (Routing's trace once a second) to learn account names for Hide accounts. Object.entries made an array for each object and one for each key, ~7-8 MB/min on Routing. It now walks with for...in and Object.hasOwn, so the same keys are visited. Routing ~100 -> ~86 MB/min (from ~149 before the previous commit). As with the previous commit, the WebKit WebContent footprint did not change in a 12-minute A/B (119 -> 260 MB before, 117 -> 257 MB after). Test: routing-steady-garbage.test.cjs, in chromium and webkit, en and zh. It counts the arc's d writes against the frames drawn while a request flies, and counts Object.entries calls while noteAccounts reads 50 routes. It also checks that all 50 accounts are still found. On HEAD's client.js the arc was laid 32 of 41 frames, and on HEAD's app.js Object.entries ran 201 times: both red. Run: the 117 GUI files these changes reach (routing-*, panel-routing*, and every file that drives the Routing page or noteAccounts), chromium and webkit, their languages and widths, at concurrency 4 on a machine at load average 500-860 from other sessions: 1520 tests, 1402 pass, 118 fail. Of the 118, 74 are page.goto timeouts and most of the rest locator timeouts. The 37 red files were run again at concurrency 2: 726 tests, 45 fail. The four files red each time were run with HEAD's app.js and client.js (these changes taken out) and are red there the same way: group-new-head (4 of 4), routing-bodies (10 of 10), routing-keys-fold (8) and routing-model-rest (load-dependent, 4 to 12). On origin/main d9c6a60d8's GUI tree routing-bodies and routing-keys-fold are red too; group-new-head passes there and goes red with 4b000ecc2 (its rowClock throws "Invalid time value" on a route with no time), which is on this branch and not part of this change. routing-request-metrics fails waiting for the metric menu's Cost item on this tree (3 of 4 alone), on HEAD (4 of 4) and on origin/main (2 of 4). The other reds were page.goto or locator timeouts under this load. The two new files passed 4 of 4 each in the full run. No Go changed. Not tried: real WebView2 on Windows, and the real macOS app. |
||
|
|
da058fc995 |
routing: a request's row is worked out once for each route the trace sends, not again on every update (#1481)
A trace update replaces only the routes that changed (poll's routes.set), yet every update worked out every row in sight again: outcome, requestMetrics with tokenBreakdown, reqTitle and the JSON signature. That made the Routing page the one view whose JS garbage was an order above the others. Measured with CDP sampled allocation (collected objects included) on a sandbox magpie at one request a second, 30s per view: Agents 10, Providers 12.7, Usage 9.3, Sessions 7, Library 8.8, Plugins 10.4 MB/min, and Routing 143-157 MB/min. Chromium's post-GC heap stayed near 10 MB throughout, so this is churn, not a leak: it costs collector work and gives the engines' allocators more to hold on to. rowSays keeps what a row says in a WeakMap by route object. It is worked out again only for a new route, or when the language, the metrics shown, the agent's name or icon, or the cost's wording (currency) changes. The selection stays outside it. Measured: Routing ~149 -> ~100 MB/min with this alone. What this does not fix: the WebKit WebContent footprint. A 12-minute A/B on Playwright's WebKit (footprint -p, one request a second, Routing open) went 119 -> 260 MB before these changes and 117 -> 257 MB after both commits. Agents in the same run grew ~4 MB/min, Routing ~8 MB/min, and nearly all of it is in footprint's "WebKit malloc" category, not the JS heap (Chromium's heap and DOM node counts stay flat). Its cause is still unknown. Readings near 1 GB taken earlier were inflated by the method (a 400 MB marker array used to find the pid) and are not quoted here. Test: routing-row-reuse.test.cjs counts the token breakdowns worked out while three requests come in over forty listed, in chromium and webkit, en and zh. It also checks that a request answered after it was under way redraws its row, and that a new language redraws the rows. On HEAD's client.js it is red: 295 breakdowns where now there are at most a few. Run: the 117 GUI files these changes reach (routing-*, panel-routing*, and every file that drives the Routing page or noteAccounts), chromium and webkit, their languages and widths, at concurrency 4 on a machine at load average 500-860 from other sessions: 1520 tests, 1402 pass, 118 fail. Of the 118, 74 are page.goto timeouts and most of the rest locator timeouts. The 37 red files were run again at concurrency 2: 726 tests, 45 fail. The four files red each time were run with HEAD's app.js and client.js (these changes taken out) and are red there the same way: group-new-head (4 of 4), routing-bodies (10 of 10), routing-keys-fold (8) and routing-model-rest (load-dependent, 4 to 12). On origin/main d9c6a60d8's GUI tree routing-bodies and routing-keys-fold are red too; group-new-head passes there and goes red with 4b000ecc2 (its rowClock throws "Invalid time value" on a route with no time), which is on this branch and not part of this change. routing-request-metrics fails waiting for the metric menu's Cost item on this tree (3 of 4 alone), on HEAD (4 of 4) and on origin/main (2 of 4). The other reds were page.goto or locator timeouts under this load. The two new files passed 4 of 4 each in the full run. No Go changed. Not tried: real WebView2 on Windows, and the real macOS app's WebContent. The numbers are from Playwright's WebKit build and Chromium. |
||
|
|
20c0688316 |
gateway: Claude Code processes are held to what the machine's memory holds; a full room is a 503 the next provider takes (#2956)
Cause: nothing bounded how many Claude Code processes magpie runs for
Claude subscriptions. Busy runs had no limit, idle ones were capped at 6
and parked ones at 16 per bridge, and one-off tests, warm-ups and /usage
reads were counted nowhere. The reporter's 512 MiB systemd service had 2
busy runs and 14 starting at once when the memory cgroup's OOM killer
ended them.
Measured (Docker arm64, real Claude Code 2.1.303):
- one idle run holds about 205 MiB RSS, 86-112 MiB of it anonymous;
- six runs under a 512 MiB memcg gave oom_kill 2 and a peak of 512 MiB.
Fix: claudeRoom (claude_room.go). Every Claude Code takes a place before
it starts and frees it when its process exits. That covers startRun and
runClaudeTree (tests, warm-up, /usage).
How many may run:
- the user's claudeRunsMost (`magpie claude-code runs N|auto`). It is
machine-local (KeepOwn), and the Settings page's save keeps it.
- otherwise, on Linux, (limit - 256 MiB) / 128 MiB, at least 1. The limit
is the least of MemTotal, cgroup v2 memory.max and memory.high up the
tree, and cgroup v1 memory.limit_in_bytes. The reporter's 512 MiB
cgroup gives 2, and 1 GiB gives 6.
- otherwise no bound: macOS, Windows, or limits that can't be read.
A full room first lets go of the oldest idle run. Its session is
shelved, so the next turn resumes it. Next it lets go of a run parked
past parkLongest. Busy runs are never let go. Otherwise it waits up to
2 minutes, then answers 503 with the reason and the command.
Routing treats that 503 as protected. No Claude account is rested or
asked next, since each would wait for the same room, and another
provider in the group answers.
Tests (each run red by hand on the broken code):
- TestClaudeRunsHeldToTheRoom: 6 conversations at room 2. With take
forced to always admit: "6 Claude Code processes were alive at once,
2 may be". Fixed: at most 2, and all 6 answer 200.
- TestClaudeRoomLetsAnIdleRunGoAndItResumes, TestClaudeRoomFullIs503 and
TestClaudeOneOffsTakeRoom went red with take forced open.
- TestClaudeNoRoomPassesOnAndRestsNobody went red with the routing
exemption off: both Claude accounts were tried and rested.
- TestClaudeMemRunsFromTheCgroup uses the reporter's literal meminfo,
cgroup path and memory.max.
- TestClaudeCodeRunsSetsTheUsersOwn went red with validation loosened.
- TestClaudeRunsMostIsMachineLocal went red without the KeepOwn line.
- TestSettingsSaveKeepsWhatItDoesNotSend (internal/gui guard) caught a
Settings page save clearing the value. It is kept now.
Run at this tree (macOS, go1.26.8):
- go test -timeout 45m -count=1 ./... with pipefail, under a load
average of 650-800 from other sessions: 61 packages ok. Three were not:
- internal/agent and internal/gateway hit the 45m timeout mid-test.
The stacks show no hang. Re-run at -timeout 120m: agent ok (2779s).
- In gateway, TestClaudeAccountsSpentFallBackToCodex hit its 30s wall
bound. No room wait was logged before it, and it passed 5 of 5
alone.
- In the same run TestClaudeRoomLetsAnIdleRunGoAndItResumes was red
because of its own check: a random request id in the fake's log
spelled "a1". It now reads only the fake's "told" lines. Flipped to
"a2", it goes red.
- internal/gui: TestPanelJoinsFullScreenSpaces (a macOS window test)
passes alone. TestSetAnswersWhileDevinAndProvidersHang has a 10s
bound, and at the base commit under the same load it failed 2 of 3.
- The touched packages again, -count=1: settings, cli and gui ok.
gateway: the room tests and TestClaudeAccountsSpentFallBackToCodex
ok at -count=5.
- gofmt -l: clean.
- GOOS=linux and GOOS=windows go vet -tags nogui ./...: clean.
Not tried:
- the Docker 512 MiB reproduction re-run with this build against real
Claude Code. The fix is shown with fake runs only.
- a real cgroup v1 host.
- the site's docker docs (en/zh/ja) don't mention `claude-code runs` yet.
|
||
|
|
92fbabb47e |
gui: the Providers page draws the last list at once and the fresh one behind it
#1519 (fatkun): the Providers page asked /api/providers each time it opened, and after a start that read takes seconds (every account's sign-in, every agent's model), so the page showed skeletons that long. Now, as the Agents page draws the last state: - the app reads /api/providers once in the background after the start (prefetchProviders), and the page's first opening uses that read, or waits on it, instead of asking again. The sidebar's gateway line reuses the same read (sideGwRead), so a start still makes one read. - the server keeps the list it last built in the cache folder (providers-state.json, 0600; lastproviders.go) without the gateway's recent calls and lanes or any provider's headers, proxy or extra body. /api/providers?last=1 serves it at once; the page draws it while the fresh read is out, and the fresh one replaces it. - a row clicked on a kept list waits for the fresh one rather than opening an editor that would be drawn again under the reader's hands. Tests: - TestLastKnownProviders (internal/gui): red when the stripping of Headers/Proxy was broken by hand ("the kept list holds hdr-secret-1519 / proxy-secret-1519"), green restored. - providers-last-known.test.cjs (new): the kept list drawn before the fresh read answers, then replaced; a row click waits. With kept.last = false by hand the row-click case was red in all 5 languages. - sidebar.test.cjs: the narrow case now guards one /api/providers read in total, still one after widening to 1200px (the sidebar reuses it). Red on the old assets (0 reads), green on the new, both engines. Run: go test -timeout 45m ./internal/gui ok github.com/yetone/magpie/internal/gui 528.667s gofmt -l internal/: nothing; go vet ./internal/gui, GOOS=linux and GOOS=windows go vet -tags nogui ./...: exit 0 GUI, chromium and webkit, every language, wide and narrow: providers-last-known 20/20, sidebar 8/8, provider-proxy 4/4, agents-last-known 3/3, last-page 1/1 in each engine. provider-advanced-fold: 1-3 of 25 red per run, the same on the old assets (#2552). Chromium full GUI suite (before the kept.last and sidebar-test edits), under load ~200: 5681 tests, 55 red in 23 files; each was rerun alone and either passed or was as red on the old assets. routing-model-rest runs, old vs new: old 4, 2, 7 red, new 3, 3 red; routing-request- metrics two runs: old 1, 0 red, new 0, 2 red, each red at 23-29s (load ~240; the same test red on old). Not verified: a real cold start on Windows; the webkit full suite (59 provider/sidebar/start files run: 516 tests, the reds there pass alone or are #1863). |
||
|
|
92cb1f03a5 |
routing: a request whose time isn't a date draws its row with no time, not an error
28e3378c3 (#2524) formats a row's time with one Intl.DateTimeFormat. Its
format throws a RangeError on an invalid date, where the old
toLocaleTimeString said "Invalid Date", so one such request threw out of
drawList and the list wasn't drawn. group-new-head's fixture gives its
requests `at`, not `time`, and went red in all 4 cases on 28e3378c3
("Invalid time value" twice, from rowClock ← reqRow ← drawList); it is
green on origin/main
|
||
|
|
a8224019af |
routing: a day of thousands of requests draws only the rows in sight, and its numbers are measured again on a new width only (#2524)
UNscientific-9 (#2524): picking a day on Routing's request list froze the page for seconds with thousands of rows. renderLog built a row for every request of the day (~20 elements each, up to 2,000 a day) and put the new ones in among the old row by row, so both days' rows were in at once. Beside that, metaFit was run by a ResizeObserver on the column's every change of size; the meta-under mark it sets changes the column's height, which measured every row's numbers again (the reporter saw 8 runs in 8s, ~200ms each). Now: - A list of 300 or more items is windowed: only the rows in and near sight are drawn, between two aria-hidden gaps as tall as the rows above and below. A drawn row's height is measured and kept; one never drawn counts as the average. Scrolling or a resize draws the rows then in sight, once a frame, and the first row in sight stays where it was. - The columns stay as wide as before: for each shape of row not drawn (its time's digits, model and kind, its numbers), one unseen, inert zero-height probe row stays in the grid, so the auto columns size by it. The digits are tabular, so a probe stands for its shape. - A list made mostly anew (another day) is put in with one replaceChildren, not row by row among the old ones. - metaFit runs on a change of the column's width only. When it moves the numbers under or back, the list is drawn again for the new heights. - A row's clock uses one cached Intl.DateTimeFormat. Under 300 items the list is drawn whole, as before. Not done here, from the reporter's list: drawAll still runs renderHist on a static day at each poll. Measured with a live request arriving every 250ms while a 2,000-row day was shown (scratchpad dayidle.cjs, chromium, 4s): frame callbacks 330 / 211 ms total / 9 ms longest before, 90 / 52 ms / 4 ms after. A guard there would have to know every input of renderHist (now(), lifted rests, names), so it was left out. Trimming prompt.parts from the payload is on the server, not here. The renderer crash on repeated switches was not reproduced. Measured (scratchpad dswitch.cjs, 2,000 rows a day, 1280x900, five day switches each, wall ms / longest block ms, load average ~220-290): - chromium before: 379/304 454/374 452/374 474/389 427/376, rows=2000, ~39,740 elements - chromium after: 56/22 61/20 56/19 74/21 410/17, rows 17-21, ~1,520- 1,600 elements (the 410 is wall time under load; its longest block 17) - webkit before: 565/461 624/493 639/526 625/516 616/516, rows=2000 - webkit after: 117/37 95/25 93/30 128/26 138/25, rows 17-21 - same grid columns and list height after as before, in both engines: chromium "89.4375px 94.1875px 661.078px 181.297px", scrollHeight 61602; webkit "89.4375px 94.1875px 641.078125px 181.296875px", 61602 Run: - tests/routing-day-window.test.cjs (new), chromium and webkit, en zh zh-TW ja de, 1280px and 420px: 30 tests, 30 pass. It picks a 2,000-row day, checks the rows drawn are bounded and the list is as tall as all of them, scrolls to a wide model far down (columns unchanged, not cut), holds a row still across frames mid-list, reaches the last row and picks it, switches day, and goes By session to the list's foot. The second test grows the column taller three times and counts reads of the numbers' boxes: 0, and >0 on a new width. - Same test on the old assets (MAGPIE_ROUTING_ASSETS, the routing client.js/css before this change), chromium en: 3 fail, "a day of 2000 put 2000 rows in the list" (both widths) and the measure test (12000 reads, not 0). - Broken by hand: WIN_MIN 300 -> 300000 fails "a day of 2000 put 2000 rows in the list"; the width guard taken out fails "156 !== 0" in both engines. Both restored. - tests/routing-sessions.test.cjs: its 2,001-request history test now scrolls to a session's group instead of expecting all 2,001 rows in the DOM. 8 pass, 0 fail (chromium and webkit, en and zh). - routing-*.test.cjs, panel-routing*.test.cjs and every other GUI file that reads the request list (claude-auth-status, claude-subagent-tag, dates-gui-lang, click-scroll, codex-subagent-model, codex-credits, desktop-subagent-model, key-nourl, phone-rows, reasoning-speed, remote-group-served, purpose-filter, search-instead, rest-try-now, search-mcp, vision-mcp), both engines, every language, concurrency 4: 1412 tests, 1390 pass, 22 fail. 18 of those are routing-bodies, routing-keys-fold, routing-model-rest, routing-request-metrics and routing-wb-restricted, which fail the same way on the old assets (#2658, #2559). The other 4 (rest-try-now chromium en 1100 and ja 420, routing-log-icons webkit zh, routing-time-went chromium de) pass when their files run alone: 64 tests, 64 pass. Not tried: WebKitGTK and the Windows WebView2 app (where the reporter's seconds-long freeze was on Windows); the numbers above are Playwright's Chromium and WebKit on macOS. |
||
|
|
ac3a2a3df5 |
routing: the page asks for frames only while its stage moves, and the live dot pulses only while a request is under way (#2827)
zhang-4411 (#2827): under xrdp/X11 with no GPU the Routing page's web process took 459%-830% CPU. Beside compositing (27353a952), the page itself drew on every frame while nothing moved: its frame loop asked for the next frame forever once Routing was shown, and the live dot's rtlive pulse ran with no request under way. On llvmpipe each of those frames is rasterised on the CPU. Now the loop stops once nothing on the stage moves and is kicked again by what makes something move (a request arriving, a replay, the page shown again). The dot pulses (.rt-livedot.on) only while a request is live. With no request, the page asks for no frames. Measured in the GUI harness (scratchpad measure.cjs, 4s windows, Playwright on macOS, load average ~200): - chromium, Routing idle: before 70 ms CPU/s, 60.3 rAF/s, 1 running animation (rtlive); after 4 ms CPU/s, 0 rAF/s, 0 animations - webkit, Routing idle: before 62 rAF/s, 1 animation; after 0 rAF/s, 0 animations (WebKit's per-process CPU reading was negative under this load, so only frames are given) - Routing busy (requests moving) is unchanged: chromium 176 -> 186 ms CPU/s, ~64 rAF/s both Run: - tests/routing-idle-frame.test.cjs (webkit, en and zh, as the file runs): 9 pass 0 fail. It now also counts the frames asked for with nothing moving and checks the dot's animation; MAGPIE_ROUTING_ASSETS points it at an older asset tree. - Same test on the old assets (9fd80b212's, MAGPIE_ROUTING_ASSETS): FAIL "the Routing loop kept asking for frames with nothing on its stage moving (26 frames in 400ms)". - Broken by hand (animation back on .rt-livedot): FAIL "the live dot pulsed with no request under way". Restored. - Routing GUI files, chromium and webkit, every language: 1104 tests, 1086 pass, 18 fail. Every one of those 18 fails the same way on the old assets in the same run (base 22 fail, new 20 fail on the reruns): routing-bodies "opens to its request and response", and under load routing-model-rest, routing-keys-fold, routing-request-metrics and routing-wb-restricted. All are in #2658 (and #2559). The one red only on the new side, routing-wb-restricted zh-TW 420px, passes rerun alone in both engines. Not tried: WebKitGTK, xrdp or llvmpipe. Playwright's WebKit is not WebKitGTK, so the CPU the reporter sees is not measured here. |
||
|
|
2d12ce98be |
gui: on Linux without a GPU WebKitGTK draws without accelerated compositing (#2827)
zhang-4411 (#2827): under xrdp/X11 with no GPU the Routing page's web process took 459%-830% CPU, and 23% with WEBKIT_DISABLE_COMPOSITING_MODE=1, looking the same. With no render node EGL can open, WebKitGTK's compositing falls back to Mesa's llvmpipe, which rasterises and blends every layer on the CPU with a thread per core. webkitDefaults already turned compositing off under Wayland (myxxts's flicker). It now does so under X11 too when gpuReachable finds no /dev/dri/renderD* this process can open (none there, or each refused: the xrdp user outside the render group). X11 with a GPU is left as it was, and a user who set WEBKIT_DISABLE_COMPOSITING_MODE or WEBKIT_DISABLE_DMABUF_RENDERER keeps what they set (WEBKIT_DISABLE_COMPOSITING_MODE=0 turns compositing back on). Run: - gofmt -l internal/gui: nothing - go vet ./internal/gui; GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet -tags nogui ./...: clean - go test -tags nogui ./internal/gui -timeout 45m (macOS): ok github.com/yetone/magpie/internal/gui 1013.214s - webkit_linux*.go build only on Linux, so the tests ran there: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go test -c -tags nogui, run in docker golang:1.26.8: TestWebkitDefaults and TestRenderNodeOpens PASS. - Broken by hand (gpu() || true in webkitDefaultsFor): FAIL "x11 without a gpu (xrdp): WEBKIT_DISABLE_COMPOSITING_MODE="", want "1"". Restored. Not tried: a real xrdp session, llvmpipe or WebKitGTK. gpuReachable was not run on a machine where the render node is refused; the CPU figures are the reporter's. |
||
|
|
67f8dbb16c |
routing: the hidden tray panel no longer draws its Routing tab for every request (#2515)
The tray panel is hidden nearly all the time, yet renderPanel put up a
new head, stage and row list for every trace update (about 200 a minute
under 1 request a second), whichever tab was picked. A hidden page draws
no frames, so the infinite CSS animations on what each draw replaced
(.rt-livedot in the head, .pr-req.wait .pr-to > i on a waiting row,
.ps-dst.wait > i on the stage) were never dropped from the document's
timeline, and each held its detached tab, rows and all.
On the Windows box (WebView2, where a hidden panel reports
visibilityState "hidden"), magpie-gm sandbox, base build
|
||
|
|
60a42875cd |
gui: a Linux alert closed with its × no longer opens the main window over the desktop (#2513)
Wails beta.24's Linux notifications report a notification the user closed
(NotificationClosed reason 2: its ×, or cleared from the list) as
DefaultActionIdentifier, the same id a click on its body gives. magpie's
response handler opened the main window (ShowMain("usage"): Show + Focus)
on any response to an alert, so on Linux dismissing a usage/balance/reset
alert raised the main window, maximised if it was left so, on top with the
input focus. On X11 with a panel that reserves no space that is a
1920x1080 borderless window at 0,0, _MOTIF_WM_HINTS 0x2,0x0, holding
_NET_ACTIVE_WINDOW: the signature in #2513.
On Linux an alert is now sent under a category whose one action has id
"default". Wails reports a category action under its own id, so a body
click comes back as "default" while a dismissal stays
DefaultActionIdentifier, and only the click opens Usage (opensUsage).
macOS and Windows are unchanged. A turn's end still opens nothing.
Not proven: that the reporter's window came from a dismissal rather than
a window they maximised themselves. Done on Linux (WSL Ubuntu 24.04,
Xvfb 1920x1080 + kwin_x11, sandbox HOME):
- double-clicking the main header maximises it to exactly 1920x1080 @0,0,
_MOTIF 0x2,0x0, focused; the panel only gets there by WM fullscreen,
which magpie never asks for.
- a Wails probe against a fake freedesktop daemon (dbus-python):
plain notification: dismiss -> DEFAULT_ACTION, click -> DEFAULT_ACTION;
under the category: dismiss -> DEFAULT_ACTION, click -> default.
- xfce4-notifyd drew no popup under Xvfb, so no real daemon's UI was
tried, and not KDE Plasma's rendering of the "default" key.
Tests: TestDismissedAlertOpensNothing, TestLinuxAlertSentUnderClickCategory.
Broken by hand (Linux branch back to `return true`):
--- FAIL: TestDismissedAlertOpensNothing
quota_alert_notify_test.go:29: opensUsage(linux, magpie-alert-1 DEFAULT_ACTION) = true, want false
Restored: green.
Run at this head:
- gofmt -l: clean
- go vet ./internal/gui/ (darwin); GOOS=windows go vet ./internal/gui/: ok
- GOOS=linux go vet -tags nogui ./...; GOOS=windows go vet -tags nogui ./...: ok
- WSL: go vet -tags gtk3 ./internal/gui/: ok
- WSL: go test -tags gtk3 -run 'TestDismissedAlertOpensNothing|TestLinuxAlertSentUnderClickCategory|TestAlertText|TestReminderText' ./internal/gui/
ok github.com/yetone/magpie/internal/gui 0.056s
- go test -timeout 45m ./internal/gui/ (darwin):
ok github.com/yetone/magpie/internal/gui 1350.238s
|
||
|
|
28bec1507c |
settings: lightweight mode is on for a user who never chose it, and off for one who turned it off
The owner: 改成默认开,只对没设过的用户. A webview kept for good holds what
its page drew while hidden, which grew ~20 MB a minute on Windows under
steady requests (#2515); lightweight mode lets it go.
- settings.Lightweight is a *bool: nil (never chosen) is on, false is
off, true is on. LightweightOn() says which; gui/lightweight.go reads
it. KeepOwn still keeps this computer's value on a sync or a restore.
- app.js shows On unless lightweight is false, and the prefs save sends
s.lightweight as it is: unchosen stays out of the JSON, so saving
another setting doesn't choose it.
Caveat: until now Off was a bool with omitempty, so it was never stored.
A user who chose Off before this can't be told from one who never chose,
and gets On. Only choices made from this release on are kept.
Tests:
- settings TestLightweightKeptAndOwn: on when unset, Off saved reads back
off, another save keeps it off, KeepOwn keeps this computer's Off over
the other's On, and an empty one stays unset. Broken by hand
(`!= nil && *`) it fails "off for a user who never chose".
- lightweight.test.cjs: On shown for a user who never chose; another
setting's save posts no lightweight; Off posts false and shows Off;
another save keeps false; On posts true; nothing scrolls. Its viewport
is 1200 tall: rows added above had put Off under the window's foot
(y≈1008 of 1000), where the mouse click did nothing.
- segs-glide and segs-press-redraw start from a user who turned it off,
so On is still a pick away; README's lightweight line says the new
default.
Run at this commit's parent (the #2683 test fix on origin/main
|
||
|
|
031715d5e4 |
gui tests: segs-glide names each control by the nearest id above it and brings an option wholly into view (#2683)
segs-glide was red 20 of 20 on origin/main. Two causes, both in the test:
- It named a control by its parent's id, or else its options' kind.
Full window's and Codex async's controls both sit in a .compact-at
with no id, so both were "off|on", and Codex async's 38px thumb was
compared with Full window's 118px one: "off|on's thumb moved
(2.0/38.0 → 2.0/118.0)". A control is now named by the nearest id
above it, and oneWay fails when two controls share a name.
- Behind that, en 440px failed "a click never moves the page" (160 vs
150): reveal stopped once the option's middle was on screen, with its
foot cut by the view's (button bottom ~979, view bottom 972), and
Playwright's click scrolled it in by itself. Pressed by hand (mouse
down/up, no locator.click) nothing scrolled. reveal now waits until
the whole option is inside #view-settings.
Run at origin/main
|
||
|
|
75e769a9f9 |
routing: Free first spends the models that cost nothing before the ones that spend (#3054)
A provider or group can be routed `free`. Seats whose model the vendor serves at no cost to the allowance or credits go first, in listed order. The rest follow, also in listed order. Free means the vendor's own catalog.Model.Free word, or else a $0 list price on every count (provider.FreeModel). A pool with no free model behaves as In order. routes.Seat gains Free and Strategy gains ByFree. weighRouted works Free out only for a strategy that weighs by it, so other routings never read a model list for it. It is wired through every list a routing appears in: - both save whitelists; - plugins/rotation's Builtin; - app.js's ROUTINGS (appScriptBudget 1,269,000 → 1,271,000 for the description) and the Routing page's options, hints and trace text; - zh-TW, ja and de strings; - the TUI's routings; - the CLI's aliases (free, free-first). Written by keeuu (issue #3054, three commits), squashed onto |
||
|
|
588f87a126 |
gui: the Routing page measures a path again only when it moves (yg6888 on X: "打开页面很卡")
yg6888 on X: the Routing page lags, with 29 accounts in a group, nested
sub-groups and three agents sending at once.
Cause: every frame posed every flight, and each pose measured the paths
it flies along and the wire ends it meets with getTotalLength and
getPointAtLength, again on every frame. Each render also re-set every
via's "d" and formatted every row's token counts with a new
Intl.NumberFormat (toLocaleString).
Fix:
- measure() keeps a path's length in a WeakMap and measures again only
when its "d" changes.
- tip() keeps its result.
- A via's "d" is set only when it changed.
- pointAt() reads points measured every 8 px along a path, cached per
"d", and interpolates between them. The chord is off by under a
pixel.
- ledNum uses one Intl.NumberFormat per language.
- metaFit runs only when rows were redrawn.
Numbers: CPU profile of the page for 40 s under a busy sandbox gateway,
machine load ~250:
main thread rAF calls per call getPointAtLength getTotalLength ledNum
before 28.0 s 4047 6.9 ms 5.58 s 5.04 s 1.13 s
after 15.9 s 3635 4.4 ms 1.50 s 0.50 s 0
The GUI test counts per frame: ~15 lengths and ~27 points before, ~4
lengths and 13-16 points after. Paths still move during the rows' FLIP
slide and the agent tick, and they are measured again then.
renderHist's own time (~1.8 s) and getBoundingClientRect (~1.2 s) are
not changed here.
Test: routing-busy-frames.test.cjs, in Chromium and WebKit, en/zh/de.
It pumps three agents' requests and asserts fewer than 8 lengths a
frame, fewer than 200 formats, and token titles grouped in the page's
language. Red on the old client.js and app.js. Example green:
"chromium en 382 frames, 1519 lengths, 4864 points, 0 formats".
Run record, the three commits on origin/main
|
||
|
|
d9c6a60d8a | Merge commit '791604559' into pf/serve | ||
|
|
7916045591 |
library: RTK's tag for Grok Build and Grok App gives their own reason and rtk-ai/rtk#2136, not DeepSeek Harness's (新v学员 on Discord)
Every agent RTK has no hook for got dsh's tooltip on the RTK tab: "{agent}'s
hooks can only allow or deny a command, not change it" with
rtk-ai/rtk#3847 ("FR: Support DSH"). For Grok Build that is wrong twice:
the issue is dsh's, and Grok's PreToolUse hooks can rewrite a command
(updatedInput, shown on rtk-ai/rtk#1890). What holds is that rtk init has
no Grok agent (src/hooks/init in rtk v1.0.1 has none), and
rtk-ai/rtk#2136 is the open request for Grok Build (#4513 was closed as
its duplicate). Each link was checked with gh issue view; the others in
rtk.go (#3847, #3934, #4311, #3898, #4187, #3404) are right.
rtkNoHookWhy in plugins/library/client.js gives each agent its own reason:
dsh keeps its text and #3847, Grok Build and Grok App cite #2136 (Grok App
runs Grok Build), and an agent with no entry gets a reason with no link.
New strings in zh, zh-TW, ja and de. rtk.go's grok and grok-app reasons,
which the CLI shows, cite #2136 too.
TestRTKNoHookIssuesAreEachAgents fails when an rtkNoHook agent has no page
reason (or the reverse), when the page and rtk.go cite different issues,
when two agents cite the same issues without a reason in sharedRTKIssues,
or when the fallback carries a link. library-rtk-nohook.test.cjs checks
Grok Build's tag says #2136 and never #3847, DeepSeek or "hook".
Run in a worktree rebased on origin/main
|
||
|
|
fb101b0d57 |
plugins: a GitHub list that couldn't be read says why with Try again, instead of the section vanishing (till on Discord)
till (Windows, v0.1.1293, Belarus network) saw no "Unofficial plugins ·
GitHub" section in Plugins › Discover; a magpie in Japan shows it. On
v0.1.1293 the section shows its loading skeleton and then disappears
whenever GitHub can't be read: plugin.TaggedRepos returned the last list
(or nothing) with no error when the topic search failed, and an empty
list with no error when the search answered but every package.json read
from raw.githubusercontent.com failed or timed out. /api/plugins/github
answered 200 {repos:[]}, and the page showed ghFailed only on an HTTP
error, never in a search, and never once a list had been had.
Now:
- TaggedRepos returns the error with what it has. A failed search keeps
the last list and says why (held a minute, like before); repositories
the search found but that couldn't be read come back as a
*TaggedMissing with their count and the last read error.
- /api/plugins/github sends error and missing beside repos; ?again asks
GitHub again at once when the last answer had an error.
- The page shows the reason and Try again: in place of the section when
nothing could be read (in Discover and in a search), and as a line over
the cards when some were read or an older list is kept. Try again keeps
the cards while it asks. zh, zh-TW, ja and de strings added.
No Windows-only cause was found in the code: the fetch goes through the
same netproxy on every OS (a PAC-only system proxy isn't read anywhere).
The likely cause is the network reaching api.github.com or
raw.githubusercontent.com, or the unauthenticated search limit; the page
now names which.
Run (worktree on
|
||
|
|
5e30d5b5ae |
autostart, gui: Open at login says when the Mac's own switch for it is off (#2120)
Anoninz on #2120: Settings said Open at login was On while System Settings › General › Login Items › Allow in the Background had magpie switched off, so magpie never opened at login. autostart.Enabled now returns a State: off, on, or needs allowing. - macOS 13+: with the plist present, Enabled asks Background Task Management through SMAppService statusForLegacyURL: (cgo, ServiceManagement weak-linked, minos stays 12.0). RequiresApproval reads as needs allowing. Any other answer, a failed ask (-1), macOS 12 or a build without cgo (the darwin CLI release) leaves the plist alone deciding, as before: a failed read is never "off". launchctl print-disabled did not follow the switch on macOS 26.2, so it isn't used. - BTM matches the item by the plist's Label, not its path: the tests ask about a label of their own, and TestMain stubs the ask so no test reads the user's real item. - GUI: Settings › General keeps On and adds one line, "Switched off in System Settings’ Login Items…", with an "Open Login Items" button that opens x-apple.systempreferences:com.apple.LoginItems-Settings.extension through /api/open (that one URL is allowed; other x-apple URLs aren't). The window's focus reload clears it once switched back on. The row is hidden in magpie web, as before. Strings in zh, zh-TW, ja, de. - CLI `magpie autostart` says where to switch it on. The daemon counts a held-back record as on (it is the user's choice, held by the system). Part B (SMAppService.mainApp) is not in this commit: it can't be verified here without registering in the user's real login items and logging out to see a login launch stay tray-only. Run: - go test ./internal/autostart (cgo and CGO_ENABLED=0), cli, daemon, gui after rebasing on origin/main |
||
|
|
40d1661852 |
Merge remote-tracking branch 'origin/main' into pf/serve
# Conflicts: # internal/gui/core_budget_test.go |
||
|
|
2fd5529479 | gui: the core script budget makes room for Settings › Privacy's local model, and a Settings save keeps it (#1977) | ||
|
|
9588501c02 |
provider: Ollama's and Ollama Cloud's decision models classify routing groups through System One (Nanka on Discord)
Ollama 0.35.0+ (0.40.5+ for cloud models) serves System One at
POST /v1/systemone, locally and at ollama.com with a key. Its body and
answers are System One's, so magpie's request is sent unchanged (a real
answer adds prompt_eval_cached_count, which is ignored). Its /v1/models
lists the decision models (Tev, Nimble, Clef) among the chat models with
nothing to tell them apart, so clef:27b showed up as a chat model on
Ollama Cloud. /api/tags, asked with the same key, gives each model
capabilities: "decision" (and "vision" for Clef).
- Both presets get Decide = their chat base, and a saved Ollama or
Ollama Cloud provider is backfilled with its chat base, as oMLX and
MLX-Serve are.
- ollama_decide.go: the decision list is /api/tags filtered by the
"decision" capability (ollamaDecides, listedOllamaDecide), kept under
<id>.decisions. Images come from "vision". The window is the list's
context_length, else the cloud's 65,536 from Ollama's docs. An Ollama
older than System One lists no capabilities, so none, and no Jev is
made up.
- decide.go: oMLX's, MLX-Serve's and Ollama's mixed-provider checks now
share serverMarksDecisions.
- internal/gui/local_address_test.go: an Ollama added at another address
moves its decision URL with it, as oMLX's does.
- docs/subsystems/providers-accounts.md says so.
Run, at origin/main
|
||
|
|
e5b57794e2 |
routing: a rule's agent picker lists agents heard from and takes a typed User-Agent name (raikyou on Discord)
A rule can match a client magpie doesn't know, such as SillyTavern or someone's own app with its own User-Agent. The gateway already names such a client by its User-Agent's product name (usage.AgentOf), and a rule compares agents in lower case (cleanRules, MatchesBesidesIntent, Pauses). Until now the editor's agent picker listed only the agents magpie knows. The picker now lists the agents magpie knows, then the agents /api/usage?period=30d heard from that it doesn't know, leaving out "other" and magpie. The note on those reads "heard from in the last 30 days". The usage call is made once per editor and reads the cached SummarizeTop. A name typed in the filter is read the way the gateway reads a User-Agent: the text before the first "/", space or comma, in lower case. "MyApp/2.0 (Linux)" is myapp. A typed name that is already an agent's id is that agent. The picked name shows in the chip as the others do and is saved in agents:[…]. app.js's openPicker gains field.placeholder and field.typed for this; other pickers are unchanged. zh label: 筛选,或输入 Agent 名称… (notes: User-Agent 开头的名称, 近 30 天有请求). Strings are added in en, zh, zh-TW, ja and de. No backend change. The TUI takes rules as text (agents=…), so it already accepts any name. A typed alias of a known agent (claude-cli) isn't mapped to its id in the picker. Only an exact id is. Run at |
||
|
|
81a24cf8fe |
groups: a found group is listed as auto/<model id as the vendor spells it>
ZeroClover asked on X: Auto Group ids group/auto-<slug> can't be looked
up on models.dev. A found group is now listed and written as
auto/<model>, e.g. auto/claude-opus-5.5: /v1/models, the catalog, agent
configs, the GUI's Routing page and the CLI. Context and output limits
come from the model's metadata as before.
What stays the same:
- The internal id is still group/auto-<slug> (Group.Ref() gives the
public one). Every old form is still accepted as input forever:
provider.CanonicalRef turns auto/<model>[:level][[1m]] into it at the
gateway (validateModel), keys, stats, affinity and usage, so both ids
route to the same group and count as one.
- A key's model list allows a model by either id, group/* included
(allows() in key_models.go).
- Hand-made groups stay group/<id>.
- A provider whose stored id is "auto" keeps its models: while one
exists, found groups are listed by their old id (AutoRefsOn) and
auto/<x> means that provider's model. Documented in
docs/subsystems/gateway-routing.md.
Agent configs: SyncCatalog rewrites a field that holds a found group's
old id (renameFoundGroups), but only while the value is still what
applied.json says magpie wrote; a value the user set stays. A pick by
the old id written now is written as auto/<model> (Apply). Hidden,
picked and ordered model lists saved by the old id hold for the new one
(visible.go), and a bare model id still reaches its found group (bare.go).
Claude Code is given a dotted Claude version dashed (ClaudeSpelled), so
auto/claude-sonnet-4.5 sits in its settings as auto/claude-sonnet-4-5.
That routes to the same group, but with found groups off nothing reads
it back dotted, and Reseat took the field for changed and left the agent
on a group that was gone. Reseat now compares a group pick by its
canonical id (samePick). The old ids had no dots, so this is new with
auto/<model>.
Run at this tree (sandbox HOME, caches pinned):
- gofmt -l: clean. go vet ./...: clean on darwin, GOOS=linux -tags
nogui, GOOS=windows.
- go test -p 4 -timeout 45m ./...: every package ok except agent and
gateway, whose failures were the tests' expected ids (updated here)
and two regressions now fixed (bare ids; desktop models hiding groups
by prefix). Every failing test passes on rerun. Load average was
~210-290 from other sessions throughout.
- Reruns: provider, cli, codexcat ok. internal/gui: only
TestSetAnswersWhileDevinAndProvidersHang fails (set slow/slow-1 took
10.19s), and it fails the same in a git-archive export of
|
||
|
|
ef655acb40 |
gateway, gui: a console shows the routing of the magpie that serves the gateway (#2606, fatcutegg)
fatcutegg's patch (fatcutegg/magpie 40ceb22df). The routing trace is held
by the process that serves the gateway. A second magpie on this computer
(`magpie web`, or the app while a launchd `magpie serve` holds the port)
showed none of it. Now its console reads the serving magpie's
GET /v1/magpie/trace (and /v1/magpie/concurrency for the lanes) over
loopback, and plays that trace as its own. The heading names which magpie
is routing ("serve (pid N) is routing").
Reviewed as a community change. A trace names accounts and emails, session
ids, a folder's last two parts and error text. It holds no prompt text and
no key. The endpoint answers local(r) alone: a request from another address
gets 403, and so does a loopback request carrying a proxy or Tailscale
header, or a LAN request while the gateway is shared, whatever key it holds.
lanGuard and corsGuard stop rebinding Hosts, Origin: null and *.localhost
first, as on every route.
Changed on top of the patch:
- A gateway key held to a budget, models or accounts is refused with
KeyHeldCode (refuseHeld), as concurrency and quotas refuse it.
- The console reads loopback alone (ownerURL). A non-loopback MAGPIE_ADDR is
never asked, and 0.0.0.0, :port, [::] and localhost are read at
127.0.0.1.
- OwnerTrace lets a hung magpie go at wait+5s (was +20s). OwnerLanes waits
700ms like ServedBy (was 2s) and is asked only when a magpie answers.
- `/` tells pid and serves to a loopback request alone. A plain `magpie`
that opens the TUI reports itself as "tui".
- Takeover: in the real two-instance run, after B took the gateway over the
hub still read "serve (pid A) is routing", from the providers state. Now
the trace carries `by` (pid, serves), and the page names the router from
it. When `by` changes, the page drops its routes and reads the new
magpie's whole trace, so route ids from two magpies never mix. The
label's full text is in its title, because the node cuts it with an
ellipsis.
- Trace's doc comment, which the patch had orphaned, is back on it. Docs
(gateway-routing.md, gui-shell.md) say all of the above. Issue
references are #2606 (were #110).
- Tests: a proxy-header subtest, TestOwnerReadOnLoopbackAlone, the trace
added to TestHeldKeyToldNoAccounts, and `by` / pid / serves asserted in
both packages' peer tests.
Run:
- Each guarantee broken by hand, and its test went red: refuseHeld removed,
ownerURL returning MAGPIE_ADDR, local(r) replaced by a RemoteAddr check,
pid/serves dropped from the answer, `by` dropped in OwnerTrace, and the
console's OwnerTrace fallback turned off.
- A real sandbox (own HOME, ports 3591-3593, fake upstream on 3564):
- A `magpie serve`, B `magpie web`. B's Routing page played A's routes
live (the long poll counted 3 requests through A).
- Probes of A's /v1/magpie/trace. 200 from plain loopback. 403 for
evil Origin, Origin: null, evil.localhost, a rebound Host with and
without Origin, x.localhost Host, X-Forwarded-For and
Tailscale-User-Login.
- A LAN-shared instance answered 403 from 10.0.0.111 even with a valid
key, and gave no pid on `/`.
- Killed A: B took over in ~11s. The hub dropped the "is routing" label,
and the next request through B showed as a fresh trace (1 request).
- Chromium and WebKit screenshots at 1280 and 390 wide, in en, zh and ja.
No horizontal scroll.
- gofmt -l clean. go vet darwin, GOOS=linux -tags nogui and GOOS=windows
pass, and all three builds pass.
- go test -timeout 45m ./... at this tree (sandbox HOME, load 250-400):
every package ok except four.
- agent, gateway and library hit 45m in TestClaudeTierPickedAsTheMainModelStays,
TestQueuedStreamKeptAliveOnceSentToItsVendor and TestWellKnownKitGrouped.
- plugin failed TestGatewayHookMixedPiPackage (#2865).
- Rerun alone with -p 1: plugin ok (464s). gateway finished in 45m with
one red, TestRequestBuildsProvidersOnce, a 900ms/1s timing window under
load. It is 8/8 green alone here and on origin/main
|
||
|
|
b0b0764210 |
gui: a routing rule's ⋯ is always shown, and a rule Save refuses for having no condition says so under it, with how to add one or remove it (ppBruce on Discord)
ppBruce (v0.1.1290): in a routing group's editor "once a rule is added there is no delete button, and a rule with empty conditions can't be saved". Two causes: - The rule's ⋯, the only way to Remove rule (and move a rule), was opacity 0 unless the row was hovered or focused ( |
||
|
|
084c2275d1 |
gui: a model chip picked or unpicked keeps its size (frankdeng on Discord)
frankdeng (#general, 10-19): the model list is too narrow, and picking a model shifts the layout. A picked chip (.mchip.on) was drawn bold, so it grew a few pixels and every chip after it on the line moved, and some wrapped to the next line. A chip that toggles (.mchip.pick: the provider editor's chips, the detect sheet's and an account's) now keeps a ✓ slot that is hidden until it is picked, and stays at the normal weight when picked. The accent and the ✓ say it is picked, and the width never changes. Chips that only show a list keep their old look. Too narrow: the list already spans nearly the whole sheet, so the width stays. Its box was capped at min(132px, 28vh), about five lines at the 660x600 default window, so a long list scrolled in a small box. The cap is now min(240px, 40vh) (MCHIPS_MAX and drawFold's fold follow it). There is no other layout change. Run (tree 831f9d48e, then rebased onto the tree below): - model-chip-steady.test.cjs, new: a Relay provider with 30 models, with some picked and with none picked. It clicks chip 1 twice and chip 2 once, and after each click every chip's rect, measured in the list (scrollTop added), is unchanged. 60/60: chromium and webkit, en zh zh-TW ja de, 900px and 420px. - Broken by hand: the whole fix taken out -> red; only the bold .on put back, ✓ slot kept -> red (chips after the clicked one moved). Restored, green. - model-first-pick checks that the ✓ is visible. provider-add-models expects class "mchip pick on". Both are green, as are models-fold, provider-advanced-fold (one red under load is #2552; its fixture has one model) and model-same-name-tell. - gofmt -l clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows clean. - Whole GUI suite at 831f9d48e (both commits, before the previous commit's Routing key fix): 2009 subtests in about 4h at load ~300-400, files a to j, 19 red. None of them was in a file this commit changes. group-new-head (4) was the previous commit's, and is fixed there. The rest are filed: #2624, #2960, #2370, #1949. The files after j ran in an earlier whole-suite run of both changes. - go test -timeout 45m ./... at 831f9d48e: 59 ok, 5 red. agent, gateway and library timed out at 45m under load (#2544, #2870, #2853), gui TestSetAnswersWhileDevinAndProvidersHang (#1375), plugin TestPiPackage (#2869). Rerun at -timeout 90m: agent, gateway, library and plugin ok; gui red again on #1375. internal/gui alone at ea7f6d39e (both commits on |
||
|
|
a77ecbf8a1 |
gui: models of one provider named alike say what tells them apart (sunset on Discord)
sunset (#feedback, 10-19): with the Our Free Model plugin the provider editor's chips read "DeepSeek-V4.1-Flash · x0.1" three times over; the ids (buddy/…, cline/…, kilo/…) told them apart only in the tooltip. modelTells(items, label, id, key) finds, among the models of one list (and one group, for a picker), those that would show the same label, and gives each the part of its id that tells it from the others: the segments left after the ones all of them share at the front and back are taken off, the whole id when that isn't enough or is empty. A label no other model has gets nothing, so every list that was fine is drawn exactly as before. The tell is quiet secondary text after the name (.mtell, muted, never the accent of a pick); where only plain text fits it is " · tell". No new control. Where: the provider editor's model chips, the detect sheet's chips, an account's model chips, the fallback list and its suggestions, every openPicker list (agents' model menus, Settings' model pickers, Routing's member and classifier pickers; worked out per group, so one name under two providers says nothing), and the Routing page's member names and labels (routing/client.js). Routing keys its groups by the model's provider, or its provider's name where a list carries only that, so one name under two providers says nothing there either. Run (tree at 818007045 on |
||
|
|
f73378365f |
gui: a filter a click set on Usage's Requests goes when they are left (TJHHHH on Discord)
TJHHHH: after a jump to Codex's requests on the Usage page, every later
visit listed only Codex's. The Requests' filters are module state in
plugins/usage/page.js and nothing ever reset them, so a click on Codex in
the ranking split by agent stuck for the app's lifetime.
Now a filter a click lent the Requests (a ranking click on an agent,
provider, model or gateway key, a chart day, the address's ?agent= and
the like, a route from Routing) is remembered in ledLent and given back
by ledLeave when the reader leaves the Requests: for another Usage tab
(renderUsageTab), or another page through a new page hook, `leave`, that
show() calls on the page it leaves. A filter picked in its own menu or
typed in the search stays, as a menu choice does in a Mac app. A route's
saved filters keep their lent marks, and leaving with a route on gives
back the route too. Docs: plugin-runtime.md's Usage hooks.
Siblings judged and left: the tray panel's Usage tab ranking (its own
view, not the page's Requests), the Sessions reveal (per agent, no "all"), the KPI
failed/retried jumps (shown in the status segment, read as own picks).
Test: tests/usage-ledger-leave.test.cjs, chromium and webkit, en zh
zh-TW ja de: ranking click leaves for a page and for a tab, menu pick
stays, ?agent= goes, a route goes. On the old app.js/page.js/client.js
it is red, 20 of 25 in chromium ("back from another page: last asked
period=today&agent=codex"); only the menu-pick case passes there.
Green with the fix, in both engines.
Run at
|
||
|
|
197849ad4d |
gateway: image generation's timeout is a setting, 1 to 60 minutes
neighbads on X: a slow image endpoint needed more than the fixed 5 minutes. Settings > Images > Image generation timeout (imageTimeout in settings.json, 5 when unset, 1 to 60 accepted, anything else a 400) now gives every drawing that long, on each route it takes: - drawTimeout() reads the setting; drawWithin marks the context as a drawing and sets its deadline. Error texts say the time it was given (givenTo), ModelScope's task polling too. - A marked drawing goes through a vendor transport with no ResponseHeaderTimeout (drawsApart), since an images API sends its headers only once it has drawn; everything else keeps the 10-minute upstreamHeaderWait, so a 30-minute setting isn't cut at 10. - An image answered as a link is downloaded within the same time (imageLongest, never under ImageLongest). - Videos keep 5 minutes per call (videoTimeout): a video is made between its calls, so the setting isn't theirs. - magpie mcp image waits on a call up to callLongest (2h1m, past the 60-minute bound twice over), since it may not read the settings (WSL); ToolTimeout, which agent configs carry, is unchanged. - The plugin path: Bun 1.4.2's fetch has no 5-minute cap (tried against a server answering after 330s), so nothing changes there. - api.go keeps the saved value when a page doesn't send imageTimeout; prefsKeep carries it on every other Settings save. GUI: a segmented row under Image generation (5, 10, 15, 30, 60 min; a value set by hand gets its own segment), in en, zh, zh-TW, ja and de. Three GUI tests clicked controls the new row pushed under the window's foot or past the viewport; they now wheel to them with reader.cjs's reach (disabled-models, search-api, refusal-retries-setting). searcher-pick checks the help has no title before reach's pointer passes over it (the app's mouseover sets one on cut-short text). Run, at |
||
|
|
dd70c5e6ae |
provider: ClinePass's Upstream tick pins GLM models to Z.ai too (sdytman on Discord)
sdytman (#feedback, 10-19) asked for GLM to have what DeepSeek has: with
Upstream ticked, a cline-pass/glm-* request goes only to Z.ai. ClinePin
now reads a maker table (deepseek -> deepseek, glm -> zai) and appends
providerOptions.gateway.only = ["zai"] for a GLM model, at the body's end
as before so the cached prefix is unchanged. cline-free/ models are never
pinned, other makers are unchanged, and a client's own providerOptions is
kept as sent. The tick stays one control; its label and hint now name
DeepSeek and GLM in en, zh, zh-TW, ja and de.
The slug: Cline routes through Vercel AI Gateway. Vercel's provider table
lists Z.ai as slug "zai" (name "Z.AI", website z.ai), and
ai-gateway.vercel.sh/v1/models/zai/glm-*/endpoints gives provider "zai".
sdytman called the upstream "z.ai", Z.ai's site and shown name; the
routing slug Vercel takes is "zai". Not tried with a real request: there is no
Cline account here, and both gateways answer 401 without a key.
The Cline plugin got the same change in
@magpie-community/opencode-cline-auth 0.1.9 (plugins ff13aac). There is
no cline mover, so no min to raise.
Run at
|
||
|
|
b749cffbb1 |
gateway: a reply asked past what the window leaves is asked again for what it leaves, not failed as too long (molvqingtai, da34, Jeremy.Zhou on Discord)
DeepSeek counts the reply asked for (max_tokens) in its 1M window with the prompt: "maximum context length is 1000000 tokens. However, you requested N tokens (P in the messages, C in the completion)". Since |
||
|
|
9fd80b2128 |
library: skills install from any git repository, GitLab and a company's own among them (sunset on Discord)
ProbeSkills took only a GitHub source or a folder. It now also takes any
git repository's address: https/http on gitlab.com or a self-hosted
server (any depth of groups), a GitLab or Gitea page of a folder
(/-/tree/<ref>/<path>, /-/blob/..., /src/branch/...), ssh://,
git@host:group/repo.git, a bare host.name/group/repo, and file://.
Such a source is kind "git" (gitSource, skillgit.go).
It is fetched with the user's own git (proc.FindTool), so their
credential helpers and SSH keys reach an intranet host: git init, then
fetch --depth 1 --no-tags -- <url> <ref|HEAD>, checkout FETCH_HEAD into
a magpie-skill-* folder, .git removed; the same keepProbe/maxFetch path
GitHub's tarball takes.
What the user typed is data: an address starting with - and any
transport:: address (ext::, fd::, file::) are refused before git runs;
the address follows --; git runs with protocol.ext.allow=never and
core.symlinks=false, no shell, GIT_TERMINAL_PROMPT=0, and ssh -o
BatchMode=yes unless the user set their own SSH command (GIT_SSH,
GIT_SSH_COMMAND, core.sshCommand), so a sign-in it can't make fails
instead of waiting. An address with a password or token in it is
refused: library.json is shown and backed up. Git missing, a sign-in
refused, an unknown host key, a missing branch and an unreachable host
each say so plainly (gitError).
Updates: Commit keeps the repository head the skill was fetched at. A
check runs git ls-remote; another head is fetched (once per repository
and ref) and the skill's folder hashed, so a commit elsewhere in the
repository leaves it current and moves Commit on. UpdateSkill and the
edited-skill refusal work as for GitHub; EditedError and the page's
Changed here / Update / replace question name the repository instead of
GitHub. findNew, Group again, icons and the market stay GitHub's only
(documented).
Page, TUI and docs: the add box's placeholder in en/zh/zh-TW/ja/de
(zh: owner/repo、GitHub 或 GitLab 链接、任意 git 仓库地址,或本机上的文件夹),
a git skill's source shown as a link (https) or text (SSH), its own
Update and Check for updates; the TUI's prompt; library.md's Skills and
Skill updates rows. GIT_SSH/GIT_SSH_COMMAND are listed in agentenv's
notAnAgent (TestFolderVarsAreListed).
Tests (fail on the old code: gitSource/gitPath don't exist there, and
skill-git-source.test.cjs fails on the old assets' placeholder, checked
by stashing client.js/i18n.js): TestGitSourceReads,
TestInstallFromGitRepo (a local bare repo over file://: probe, install,
check finds an update, update, a commit elsewhere stays current, an
edit here is refused naming the repo), TestGitTreeURLInstallsFolder,
TestGitMissingSaysSo, TestGitSignInRefusedSaysSo (a local httptest 401,
GIT_CONFIG_NOSYSTEM so no Keychain), TestGitRefusesOptionsAndTransports,
TestGitErrorsSaid. No test reaches the network.
Run (worktree at origin/main
|
||
|
|
eb3f174289 |
agent: Claude Code's auto mode classifier model is set on its Agents row (Linka on Discord)
Claude Code 2.1.302 reads CLAUDE_CODE_AUTO_MODE_MODEL for the model its client-side auto mode classifier checks each action with. It doesn't change server-side auto mode, and a classifier model Anthropic sets for the account comes first. The installed 2.1.303 binary has the variable: unset, Claude Code picks the sonnet tier's model, else Sonnet. It refuses claude-sonnet-5-5, claude-opus-5-5 and claude-opus-5 with a warning and uses its own pick instead. - Claude Code gets an "auto mode" field (key auto_mode, Quiet, follows nothing). It can be set only while Claude Code is routed through magpie, only to one of magpie's models, and is written dashed like the other model keys. Its options leave out the three models Claude Code refuses, and Set refuses them too. - A value the user had before magpie routed Claude Code is stashed with their tiers (claudeOwnEnv). It is taken out while wired in and comes back on Disconnect or Claude Code's own model, unless they have set one again since. The restore loop now skips any claudeOwnEnv key the user wrote again. - magpie's own value goes when magpie steps out. A value the user sets while wired in is never touched. - GUI: an "Auto mode" line in the opened row's Tiers, after Subagents, using the app's model picker. Default is noted as Claude Code's own pick. Strings are translated for zh, zh-TW, ja and de. - Docs: agent-wiring.md and reference.md. Run, in a worktree at origin/main |
||
|
|
ab7ec8c657 |
gui: Manage agents' names sit beside their icons, not at the row's far end
The owner's screenshot (zh, a wide window): each row's name was pushed to the right edge, next to 未隐藏, far from its icon. A row is a <label>, so .editor label, a form field's label rule (text-align: right, 12px, padding-top 5px), reached it and outranked .ag-manage-row; under 560px another rule set labels left, which is why the narrow tests never saw it. The row's rule is now .modal .editor label.ag-manage-row, left-aligned, 13px in the text colour, with its own padding back. Run: - agent-bulk-visibility.test.cjs, which now measures each name's text against its icon at 1240 and 560 wide in every language: 10/10 (Chromium, WebKit; en, zh, zh-TW, ja, de). With the old app.css 0/10, "name beside its icon at 1240: 424,410,435,427". zh screenshots at both widths looked at. - agent-visibility-saving 12/12, panel-fold 6/6 (the other files that open this sheet). The selector matches only .ag-manage-row, which app.js makes only in this sheet, so no other page can reach it. Not tried: the real app window. |
||
|
|
65f5f0153d |
gui: a sign-in's field and its button are one height, 8px apart
The key field in a sign-in (a plugin's key, Copilot GHE's address, a pasted callback, the proxy ask) was 30px tall with its button at the button's own ~24px and 4px beside it: a short button jammed against a tall field (the owner, on OpenCode 2 Free's key). The field is now 28px with no vertical padding, its button 28px with the same 7px corners, 8px apart. Measured (plugin key form, Chromium and WebKit): zh 1100 and en 900: field 28, button 28, gap 8, one row, button's right edge at the form's; de 420: both 44 (the narrow-width touch height), gap 8. Run: - Full GUI suite (2156 tests at ~load 100): red only in codex-predictions (10, the same 10 on origin/main |
||
|
|
33dbdcc529 |
plugins: Sign in on Installed takes the reader down to the plugin's sign-in
Sign in on Plugins › Installed (or a plugin card) opens the Providers add
sheet with the plugin's sign-in drawn at the sheet's foot, under every
tile. With many plugins the sheet is taller than the window and the reader
was left at its top, the sign-in out of sight: the click seemed to do
nothing (the owner, on magpie-intelligence-check).
The click now passes its event, so pluginSignIn scrolls the sign-in into
the middle of the view on purpose. In WebKit that alone didn't hold: the
list show() loads redraws the sheet after the scroll, WebKit pulls the view
to 0 while it is drawn, and inside the purpose window that 0 was taken as
the reader's, then backToReader returned there. arrived(v) ends the
purpose window once the scroll is done and keeps where it left the view as
where the reader is, so the redraw is put back to the sign-in.
Run:
- plugin-signin-scrolls.test.cjs (new; 24 signed-in plugins and one
signed out, 900x560, Chromium and WebKit, en and zh): 6/6 pass. On
origin/main 0/6 ("the page went down to the sign-in"); with the scroll
but without arrived(), Chromium passes and WebKit fails 2/2.
- GUI: plugin*, *scroll*, *signin*, builtins: 1033 pass, 0 fail.
- go test -tags nogui ./internal/gui: ok (script budget, guard tests).
No Go changes.
|
||
|
|
865b618086 |
gui: a gateway session is listed without its days, which only the stats read (#2776)
gatewayExternal copied every gateway session's days into the
ExternalSession it hands the Sessions list, each agent's manage page
and a session's detail. MergeExternal, which all three go through,
never reads them; only MergeExternalStats does. The Sessions list asks
for every session, so each poll of an open page copied every gateway
session's days. After the Vias fix (the commit before this one), that copy was the
largest allocation an idle open page makes: 5.11 GB of 9.14 GB in 6
minutes on the 720k-call sandbox.
gatewayExternal now leaves the days out, and the stats add them
through gatewayDays. Each model list is made at its size.
TestGatewayListCopiesNoDays lists a session with 365 days: no days in
the listed copy, and gatewayDays has all of them. With the days copy
put back in gatewayExternal by hand: red, "a listed session copied 365
days". TestGatewaySessionHistoryAndCalendar still sees each day's
output in the stats.
720k-call sandbox, idle with an open page's polls every 15 s, this and
the build before it side by side for 10 minutes, load ~190-210, 12
poll rounds each. Allocated from minute 2 to minute 8: gatewayListed
5,440 MB before and 1,000 MB after, the Sessions list handler 5,820 MB
and 2,970 MB, the manage page 2,220 MB and 1,850 MB. The live heap at
the snapshots ran 393-857 MB before and 389-889 MB after, and RSS
406-1176 MB and 357-934 MB, with no trend in either over the 10
minutes.
Run: go test -p 4 -count=1 ./internal/gui/ ./internal/sessions/: ok.
Full suite on this series' final tree (aa678b482 before this note was
added), rebased on origin/main
|
||
|
|
6359b2c27c |
usage: Vias hands every caller the one copy it keeps, and a session's list is copied only when read (#2776)
Vias cloned every session's list for each ask, from a cache built for
exactly this. The Sessions list, the manage pages and a session's
detail each asked, and read the lists of the sessions they show, or of
one. Over ~720k calls one ask was ~66 MB.
Vias now answers a ViaIndex over the kept map. Of(key) is a session's
list as a copy of its own, so a caller still can't change the kept
one; Len is how many sessions have one. The three GUI callers and the
tests read through Of.
TestViasHandOutTheKeptCopy writes 20,000 sessions and asks 20 times,
reading one list each: 2,590 bytes an ask. With the clone of every
list put back by hand (under ViaIndex): red, 3,817,492 bytes an ask.
It also changes a list read through Of and checks the next ask still
says 1 call.
Full suite on this series' final tree (aa678b482 before this note was
added), rebased on origin/main
|
||
|
|
c483feadfd |
usage: OpenCode Zen's card says OpenCode tells no key its balance, and Go at /inference/go gets its plan card (ttmrmx on X)
ttmrmx on X: "magpie 里 OpenCode Zen/Go 这个供应商的余额卡片不显示". Cause, two parts: - An OpenCode Zen key (opencode.ai/zen, /inference) had no balance source, so KeyBalances skipped it without a word and the Usage page drew no card. OpenCode has no balance a key can read. In sst/opencode, packages/console/app/src/lib/inference-proxy.ts serves only the model routes. /zen/v1/balance, /zen/v1/credits, /zen/v1/usage and /zen/v1/billing all 404, and billing.mdx shows the credits only in the console (Overview -> Credits, to owners and admins). No endpoint was invented. - planQuotaSourceOf matched only /zen/go. models.dev now gives Go as opencode.ai/inference/go/openai/v1, so a Go provider saved there got no plan card at all. openCodeGateway() now tells go/zen/other (custom is the user's own) for both URL shapes, and Go at either one reads https://opencode.ai/zen/go/v1/usage. What changed: - A Zen key's card now carries errOpenCodeNoBalance and seeAt (https://opencode.ai/console). It reads "OpenCode doesn't tell an API key its balance — see Zen's credits in the OpenCode console, Overview → Credits", with an "Open the console ↗" button. That is one button with the needsAccessKey "Open settings" one (#1821), so the bytes stay small. - A provider with its own BalanceURL is still asked that URL. - Strings are in zh, zh-TW, ja and de. - coreScriptBudget: rebased onto |
||
|
|
f76201a84a |
plugins: a sign-in page the plugin's CLI opened isn't opened again, Grok's opened twice on macOS (andyfmyth on X)
"magpie里的grok 登录验证 在mac下 似乎每次都会弹两次验证, 在浏览器窗口里". Grok's plugin signs in through `grok login --device-auth`, and Grok Build (1.0.50, the webbrowser crate) opens the device page itself, through NSWorkspace on macOS and ShellExecuteW on Windows. Neither reads $BROWSER; the macOS binary has no "BROWSER" string. magpie then opened the same URL from /api/plugin-signin (desktop), startPluginSignIn/followSignIn (a browser tab) or `magpie plugin login`. Reproduced in a sandbox HOME/GROK_HOME: grok's device-code tab appeared in Chrome with magpie not involved, with and without SSH_CONNECTION. Built-in grok is retired ( |
||
|
|
cfbd321fc4 |
gui: the start's warm-up reads Codex's per-thread effort when there are Codex sessions (#2776)
The first Sessions page after a start that showed Codex rows read usage.CodexModelEffort cold, from the whole ledger, while the page waited. The warm-up now reads it as its last step, after the stats it already warmed, and only when those stats hold a Codex session; every later ask is answered from what CodexModelEffort keeps per period. The steps move into warmSteps() so a test can run them. TestWarmUpReadsCodexEffort: with Codex keys in the stats the step reads the effort once, with none it reads nothing. With the step removed: red, "read 0 times, want 1". Measured on the same sandbox as the commit before (600k gateway calls, ~4,600 sessions), base |
||
|
|
2ceff7370f |
gui: the window back reads the state once, not once for visibility and again for focus
A window shown again hears visibilitychange and focus together, and each called load(true): two reads of /api/state (every agent's config), with loadCLIs, loadInstalls, the providers and the Usage refresh after each. Under focus-follows-mouse every pointer crossing into the window was one more. loadBack now joins a return to the read asked under a second ago; a return while an older read is still out gets one read after it, however many came meanwhile. Numbers (sandbox HOME, 16 agents, 1230 catalog models, dev build): /api/state is 2.28 MB and ~55 ms of CPU per read (20 reads: 1.11 s). Reads per window return: before 2, after 1. The core's scripts were 1,446,845 bytes, 155 under their budget; loadBack adds 523. Every page needs it, so it is the core's own: coreScriptBudget goes to the new total, 1,447,368, plus 1.5% (1,469,000), as the budget's own rule says. Test: internal/gui/tests/window-back-once.test.cjs counts /api/state reads for a return, a later return, and returns during a held read. On the old app.js: 8 of 8 red, "shown again ... actual 2, expected 1". Run at this head (load average ~500, nine sessions' suites at once): node --test window-back-once.test.cjs, Chromium and WebKit, en and zh, window and panel: 8 of 8 ok. TestCoreScriptBudget ok. GUI files that fire focus or visibility (15 files, both engines): 194 of 196 ok. claude-usage-asked webkit en passes 9 of 9 alone. tray-cell-click webkit zh is red alone 3 of 3, on 1a3b92688's own app.js too: #2686, output added there. go test -p 4 ./... -timeout 45m (HOME a sandbox): 59 packages ok, and: - internal/gui: TestCoreScriptBudget red, fixed here (budget above); TestSetAnswersWhileDevinAndProvidersHang red (13.8s sets), ok alone (12.6s) and the whole package ok alone (391s): #1375, output added. - internal/plugin: TestGatewayHookMixedPiPackage red ("starting plugins: context deadline exceeded"), ok alone (110.8s): #2865, output added. - internal/agent, internal/library, internal/gateway: timed out at 45m. agent timed out alone too (2701.5s): #2544, output added. library is #2853 and gateway #2870. Neither was rerun alone, to keep load off the machine. go vet on darwin, linux (nogui) and windows: clean. gofmt -l: clean. |
||
|
|
3608ed782e |
gui: WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS reaches magpie's WebView2 on Windows again (#2753, LuYquan)
The reporter's Nahimic DLL gets WebView2's renderer killed by code
integrity and the window goes black; the usual workaround,
WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--disable-features=RendererCodeIntegrity,
never reached magpie's renderer. The cause is not WebView2 skipping the
variable because magpie passes its own arguments: Wails v3.0.0-beta.24's
loader blanks the variable in its package init
(webviewloader.preventEnvAndRegistryOverrides), before any magpie code
runs. Seen on the Windows box: a debug build's windowsOptions read "".
- internal/webview2env reads the variable at init. It imports only
syscall, so by Go's init order (first ready package by import path)
it is initialized before os, and so before Wails' loader, which needs
os.
- windowsOptions sorts it into Wails' DisabledFeatures, EnabledFeatures
and AdditionalBrowserArgs. Wails writes msSmartScreenProtection plus
the user's features as one --disable-features (Chromium keeps only
the last of two), one --enable-features, and the rest as written.
A list given twice is merged, each feature once.
- Nothing is added by default: RendererCodeIntegrity stays on unless
the user asks.
ProcessFailed: not done. Wails' edge.Chromium has a ProcessFailedCallback,
but setupChromium never sets it, the package is under wails/v3/internal
(not importable) and a window's chromium is unexported; Wails has no
public event for a dead renderer. Reloading on renderer death needs a
change in Wails.
Run:
- gofmt -l: clean. go vet darwin, GOOS=linux -tags nogui, GOOS=windows:
clean. Builds for the three.
- go test ./internal/gui -run 'TestWebView2|TestWindowsOptions' on
macOS, and the windows/amd64 test binary on the Windows box (sandbox
dir, my own process name): TestWebView2ArgsSurviveWailsInit passes
there with os="" (Wails blanked it) and disabled=[RendererCodeIntegrity].
- The real app on the Windows box (portable sandbox, MAGPIE_ADDR :3481,
USERPROFILE/APPDATA/LOCALAPPDATA redirected) started with
"--disable-features=RendererCodeIntegrity --enable-features=msTestFoo
--lang=de": every msedgewebview2.exe of it carries one
--disable-features with both features, --enable-features=msTestFoo
and --lang=de. Before, the same launch showed only
--disable-features=msSmartScreenProtection and --lang=zh-CN.
Broken by hand:
- windowsOptions reading os.Getenv instead of webview2env.Args: on the
Windows box TestWebView2ArgsSurviveWailsInit goes red
(os="" disabled=[]).
- webView2Args ignoring the env (""): TestWebView2ArgsMergeTheUsers red
in "the reporter's" and "twice".
- --disable-features treated as an other argument: red in three cases,
including the one-switch count.
Full suite at origin/main
|
||
|
|
81029fc63c |
sessions: the overview's stats and their native sessions come of one pass over the files (#2776)
combinedSessionStats, behind /api/sessions/stats and /overview (each
range read again in the background when its memo is over 10 s old, so
on every 15 s poll of the Sessions page), took sessions.StatsFor and then
sessions.List(All) only for the agent|id set that keeps a gateway session
the agent keeps too from counting twice: two passes over every agent's
files, each refreshing them all. sessions.StatsAndNative gives both from
StatsFor's one pass: the same set, a session List would list (one
nothing was said in still left out, as before), but with no 5000 limit,
so a gateway session whose native one is among the oldest of a long
history is no longer counted again.
Test: TestStatsAndNativeOnePass: one pass over the files (filesHook, new),
and the same keys as List(All) on the fixtures. Red with StatsAndNative
written as the old pair of calls: "2 passes over the files".
Measured on the synthetic sandbox HOME (3000 Claude Code, 1500 Codex,
2000 Hermes sessions), combinedSessionStats warm after a restart, CPU
time (load average ~250, wall times noisy), parent 8e2b1dce6 against
this change, 4 rounds each:
days=30 94-99 ms -> 57-62 ms CPU
days=0 107-130 ms -> 68-74 ms CPU
first after a restart (days=30) 558 -> 510 ms CPU
Run at this commit (the series' last; it covers 0179cef63, bbee24810
and 8e2b1dce6 too), on a machine at load average ~250-500:
- go test ./... -timeout 45m: 60 packages ok, sessions (869.8s), usage
ok. Red only under that load, all green when run again:
- internal/agent and internal/gateway timed out at 45m in tests that
don't touch sessions (TestPiOffersItsOwnOpenAICodexModels,
TestVisionSettingPicksTheDescriber). Run again with -timeout 90m:
agent ok (1394.2s), gateway ok (1546.9s).
- internal/gui TestSetAnswersWhileDevinAndProvidersHang: set took
44.6s under load; it is #1375. Alone: ok.
- internal/plugin TestGatewayHookMixedPiPackage: "starting plugins:
context deadline exceeded" after 718s (bun's install cache was slow).
Alone: ok (163.6s). No issue found for it.
- gofmt -l: clean.
- GOOS=windows go vet ./...: ok.
- GOOS=linux go vet -tags nogui ./...: ok. Without the tag, vet stops in
wails v3's own linux files (undefined: pointer, cgo off when vetting
across OSes from macOS); go.mod is untouched here.
- No GUI assets changed, so the GUI suite was not run.
|
||
|
|
38f6bee23e |
sessions: the manage page reads its agents' files once, and only the agents it shows (#2776)
GET /api/sessions/manage went over every agent's session files three
times: sessions.Agents() for the counts, sessions.List(All) only to build
the set that keeps a gateway session its agent keeps too from being
counted twice, and sessions.ListAgent for the list. List(All) also read
every agent's changed files again and put every session together, prices
and titles included, to take its id. So a page showing Claude Code's
sessions parsed Hermes's and Codex's writes too.
sessions.Manage now does it in one pass over the files, under one hold
of the locks: the counts, the ids of the sessions of the agents that have
gateway sessions (nativeIDs: the id from the file's key, or from its
parse for the agents that write it inside the file, idInFile, which are
the only ones read), then the picked agent's list. The handler's pick
runs as a callback so the counts can include the gateway sessions. A
change to an agent not shown and with no gateway sessions waits for a
page that shows it. assemble's id rule moved into sessionID, which both
use.
That set was also wrong in two ways. List leaves out a session nothing
was said in and stops at 5000 (All), while the list beside it keeps
every one, so a gateway session whose agent's file was empty (or among
the oldest of more than 5000) was counted twice and listed once. The
set is now every native session, the same as the list's, and
POST /api/sessions/delete, which tells a listed gateway session from a
native one, uses it too (sessions.NativeIDs).
docs/subsystems/gateway-sessions.md says so.
Tests:
- TestManageReadsOnlyTheAgentsItShows: Codex's files changed, Claude
Code's page parses none of them; asked for Codex's ids it reads them;
the native ids equal the list's, the empty session included. Red with
Manage reading every file as List(All) did ("read 2 of them").
- TestManageCountsAGatewaySessionTheAgentKeepsOnce: a gateway session
whose Claude Code file has nothing said in it is counted once. Red on
the old handler: "one session listed, counted [{claude 2}]".
Measured on the synthetic sandbox HOME (3000 Claude Code, 1500 Codex,
2000 Hermes sessions; no gateway sessions), CPU time of the request
(load average ~250 from other sessions, so wall times are noisy), the
parent bbee24810 against this change, the same run of each:
first manage?agent=claude after a restart 2164 -> 627 ms CPU
(15697 -> 10554 ms wall)
warm manage?agent=claude 173-222 ms -> 64-88 ms CPU
warm manage?agent=hermes 176-243 ms -> 56-70 ms CPU
warm manage?agent=codex 237-269 ms -> 155-162 ms CPU (after its
first, which reads Codex's model/effort)
Run: go test ./internal/sessions -count=1, go test ./internal/gui -count=1;
gofmt -l clean; go vet. Full suite and cross-OS vet are recorded on the
last commit of this series.
|
||
|
|
07ecdda10f | gui: Settings > Privacy turns the local model on, and says where it runs (#1977) | ||
|
|
d783df46cb |
plugin: a plugin's page adds items to a provider's and an agent's row menu (P6)
package.json's magpie.actions: [{id, menu, title, titles}] puts items in
the row menus magpie draws, after its own: a provider row's (right-click)
and an agent row's (its handle, or right-click). Picking one opens the
plugin's page and posts it {event: "action", data: {id, provider|agent:
{id, name}}}, nothing else of the row; the bridge's magpie.onAction(fn)
gets it, and an action picked before fn was given waits for it.
- plugin.Window reads them (page.go): menu one of ActionMenus (provider,
agent; a session's menu is left out, its title is user content), id
^[a-z0-9][a-z0-9-]{0,39}$, an id given twice is the first's, 8 at most,
none for a plugin with no page.
- /api/plugin-pages carries them on the page; a missing title is the
page's, in each language (pluginpage.go).
- pluginpages.js: magpie.actions(menu, context) gives the row menu's
items; openRowMenu draws a plugin's name as written (literal), not
through t().
- The Plugins page says which menus a plugin adds to (actionsLine),
translated in zh, zh-TW, ja and de.
- Docs: plugin-runtime.md's P6 section and verification; the site's
plugin docs (en, zh, ja) gain "Items in magpie's menus".
- The core's budget (TestCoreScriptBudget) is not raised (#2710): with
P6 the core came to 1,447,648 bytes, 648 over. pluginpages.js's header
now says P5's and P6's part in one paragraph and points to
plugin-runtime.md, which says it in full, and plugins.js's panels and
actions lines share whereLine: 1,446,845, 155 under.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|
||
|
|
8e44c2f351 |
gui: the dot on Plugins says what it is, and leads to the plugins with an update
The owner, on the sidebar's dot beside Plugins: no one can tell what it means, and once they click it, they should see which plugins need updating. It meant "a plugin update is waiting", said only in a hover title, and Plugins opened on whatever tab was last open. - Sidebar: under Plugins, Installed reads "1 update" / "N updates" in the dot's colour in place of its count, with a title saying where to update. - Opening Plugins while an update waits lands on Installed. - Installed names the plugins with a newer version in a bar above the list, with Update all beside them (moved there from the footer). Each row still shows its own "vX out" and Update. - Strings in zh, zh-TW, ja and de; the docs (en, zh, ja) say the same. Run: - plugin-updates.test.cjs: chromium and webkit, en zh zh-TW ja de, at 1024 (sidebar) and 600 (tab bar), 22 ok. Also ok in both engines: plugin-git, plugin-update-button, plugin-check-updates, plugin-card-update, plugin-prerelease, nav-sub-unroll, sidebar, builtins, i18n-keys. go test ./internal/gui/ -run 'TestCoreScriptBudget' ok. - Broken by hand, each red: no sidebar label (the 1024 cases), no jump to Installed, no bar (every case). - Looked at in WebKit screenshots, zh at 1024 and de at 600. Full run, with the rest of its series: this series (P5, the Plugins dot, the probe test, P6, and a built-ins-on commit since dropped for main's own |
||
|
|
b9f790d37b |
plugins: panels in magpie's pages, a page that replaces a built-in one, titles in the window's language, and a look that matches
P5 of the plugin runtime (docs/subsystems/plugin-runtime.md):
- Panels (magpie.panels): a plugin draws a frame into a slot of a
built-in page (a provider's editor, Settings, Usage); magpie.context
says where it is, and the frame is as tall as what it draws.
- A page can replace a built-in one (magpie.page.replaces); show() opens
it in that page's place, and the sidebar row goes to it.
- page.titles and a panel's titles name it in the window's language
({"zh": …}); a malformed map is dropped, the title kept
(TestWindowTitles).
- main's #2501 already names wails:// in the policy of a page in the
desktop window (through ownWindow), which is why the usage page drew as
bare HTML from v0.1.1259. TestPluginPageLoadsItsFilesInTheWindow loads
a page through ownWindow in a real WKWebView, which Playwright on http
can't; the subsystem page says how.
- The bridge adds magpie's look for what a page leaves unstyled, every
rule in :where() so any rule of the page's wins, and the theme's
colours as --magpie-* variables.
One commit: the panels, the replacing pages and the titles share hunks
in page.go, pluginpage.go, pluginpages.js and the docs, and couldn't be
split cleanly.
Run:
- Full: this series (P5, the Plugins dot, the probe test, P6, and a
built-ins-on commit since dropped for main's own
|