The panel's Allowances tab stood on skeletons until the whole /api/state
had been read and only then asked /api/usage/quotas: the request trace on
the old code shows the quotas GET starting after the state ends every
time (state 216+73ms, quotas at 321ms; a run whose state took 2704ms
asked at 2825ms). On a machine with many agents the state alone is
seconds, and the vendors' reads came after it.
- The panel keeps the allowances last read in its webview's storage
(magpie.panelQuotas) and draws them at once, each card's refresh
turning (.quota-refresh.reading) until the read lands in their place
(yiliang114's stale-while-revalidate, #3160). Kept cards wait for a
state, the kept ?last=1 one or the read one, to say which are hidden.
- The first load asks for the allowances beside the state, not after it
(panelQuotasNow, the same opened/not-opened rule as before, #1588).
- The core budgets go to the new size: the tray panel's, the core's own.
84c50f032 had left app.js 4 bytes over the budget on main
(TestCoreScriptBudget red there); the new size counts them.
Measured (sandbox HOME, deepseek's real key and balance, dev build of
the old and new code on their own ports, playwright opening
/?mode=panel on the Allowances tab at 360px, 14 runs each, old and new
interleaved, load ~180), median ms from DOMContentLoaded to cards drawn:
Chromium 347 -> 160, WebKit 723 -> 211
(whole open, dominated by script load at this load: Chromium 5049 ->
2646, WebKit 7282 -> 4507).
Run at this head (rebased on f1537d9f9; the budget test and
panel-quota-kept again after the rebase): panel-quota-kept 20/20 (Chromium and WebKit, en zh
zh-TW ja de, 440 and 360px); red on the old assets (TimeoutError,
nothing drawn) and red with the early ask taken out by hand (the
allowances asked before the state assertion). panel-quota-lazy and
panel-quota-refresh 40/40; every panel-* and quota-* file and
i18n-keys pass except quota-count-wrap's WebKit case, red the same on
origin/main 11907448e (#2228, #3404). go test -timeout 45m
./internal/gui ok; GOOS=linux and windows go vet -tags nogui ok;
gofmt clean.
Not tried: clicking the real tray icon (System Events scripting failed
here); the 53 other test files that open mode=panel (running after
push); a real Codex or Claude account (deepseek only); Windows and
Linux webviews.