Files
magpie/internal
yetone c2b8814e75 gui: the tray panel keeps the latest height it asked for, its fits sent one at a time (robot_yz on X)
robot_yz on X (11-05, v0.1.3005): the menu-bar panel had become short,
and the Allowances tab's one card, Zhipu GLM (max, rings 5h 7%, 7d 18%,
MCP 1%, a curve), was cut off by the foot.

Cause: Wails v3 serves each request from the page on a goroutine of its
own (application.go, `go a.handleWebViewRequest(request)`), so two
window/fit requests sent together reach fitPanel in either order. In a
real WKWebView under Wails on mote, 69 of 400 pairs of fetches sent
together reached the handler the wrong way round. When an older, smaller
height lands last, it stays: fit.last in app.js and the panel's own
panelHeight both take the newer height as done, so nothing asks again
until the content's height changes. Since 2ba044aa6 (v0.1.2913) every
Mac panel open runs load(true), and renderAgents and renderPanelQuota
each fit in the same task. A boot asks 122, 306, 566 and 291 within
about 120ms (setPanelTab, renderAgentsLoading, the routing panel, its
poll), which is likely why it showed after the update. fit(), panelFrame,
panelRoom and fitPanel haven't changed since 10-20/10-26, and go.mod's
Wails hasn't changed either.

Fix: fit() sends through fitSend. A fit asked while one is on its way
waits for it, and only the latest of those goes next, so the panel always
ends at the height asked last.

Test: panel-fit-order.test.cjs sets up panel mode with the reporter's
case: one Zhipu GLM allowance with its 5h, 7d and MCP windows and the 5h
curve, 15 agents, and the Allowances tab. The fake panel holds the first
fit until the page has drawn the card and stopped asking. The test
asserts that the panel ends at the last height asked, that the card's
bottom is inside the view, and that the tab doesn't overflow.
Chromium and WebKit, en, zh, zh-TW, ja and de.

Rebased on 4e85cac01 and run again on mote at this head: go test ./internal/gui -run Budget ok; panel-fit-order, account-models-available and i18n-keys, 94 pass, 0 fail (on ea3d1c62e: every panel-* file too, 300 pass).

First run on mote (mote-run), at base 0e55a7593:
- panel-fit-order.test.cjs: 10 of 10 pass.
- Every panel-*.test.cjs and quota-*.test.cjs file plus i18n-keys.test.cjs
  (47 files, --test-concurrency=2): 534 tests, 534 pass, 0 fail.
- go test -timeout 45m ./internal/gui: FAIL, one red,
  TestMainWindowCorners/macOS_26_SDK ("a toolbar doesn't change the
  corners in this design, yet the main window's was taken off"). The
  same test alone on origin/main 2260390a0 (fetched just before) fails
  the same way. It is #3949 (macOS 27 on mote), and this change touches
  no Go. Every other test in the package passed.

Broken by hand: the new test run against origin/main's assets
(git archive of internal/gui/assets) is 0 of 10, each one "the panel
ended at an older height than the page asked for last (asked 122 306
566 291, applied 306 566 291 122)". The panel was left at 220 and the
card was cut off.

Not tried: the real tray panel by hand on a Mac with this build. The
reporter's own overlapping fits weren't seen either; the reorder was
measured with Wails and WKWebView on mote, not on their machine.
2026-11-05 11:59:50 +08:00
..
…
…
…
…
…
…
…