Skip to content

gui: make the Routing context lazy and align wide cards - #1354

Merged
yetone merged 4 commits into
yetone:mainfrom
Nxir:codex/routing-details-layout
Oct 14, 2026
Merged

yetone merged 4 commits into
yetone:mainfrom
Nxir:codex/routing-details-layout

Conversation

@Nxir

@Nxir Nxir commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Routing's expanded context window can consume the space needed for the request list. This change uses a single context header that builds the grid and content rows only when opened, and aligns the stage/story and overview/contents columns within the page's existing width cap.

Following the Oct 13 review, this PR now contains only the context header and wide-card layout, rebuilt on main e1b70c1. The request story remains fully visible, with “How the last request was routed”, the visible stage caption and main's unchanged replaceKeeping / keepIcons line and provider-logo retention. The optional story toggle, open by default, is isolated in Nxir/magpie#3, based on the same upstream revision. GitHub rejected creation of its upstream PR with an account-permission error, so its reviewable diff is currently in the fork.

Closed context shows used/window tokens, fill, cache and the thin occupancy bar. Opening uses the same header and removes duplicate summary counts; closing releases the body. An absent magpie.routingContext setting reads the original magpie.ctxShut choice. Usage's Context link temporarily opens one request without replacing that preference. Live context nodes, cache states and the context text viewer are retained.

At 1100px card width, the stage and visible caption sit beside the request story. Context stays below both and splits overview/contents from 800px. Both pairs share the same split; content filters stay on one scrollable line, grid rows have a fixed height, and long content lists scroll inside the card. The page retains main's 1200px cap, so the upper split uses 1100px rather than the earlier unreachable 1280px threshold. Smaller cards retain the original narrow-stage layout. Disclosure clicks do not shrink the page heading or move the context header.

See GUI app shell and the GUI test README for the contract and tests.

Validation at 735c08e:

  • Native macOS, Linux nogui and Windows builds passed again after the final pending-prompt fix. Native/Linux/Windows vet and the sandboxed nogui Go suite passed on the unchanged main Go implementation. Bun-dependent tests were skipped in that generic local Go run because Bun was not on PATH. Upstream CI passed at the initial layout head d6d5738 using its configured Bun 1.4.2; CI on the final head is running. No Go files changed.
  • The whole GUI suite covered all 667 files in Chromium and WebKit, checkpointed as 127 + 279 + 261 files. The last batch reported 3,350 checks, 3,342 pass / 8 fail (one failure is the parent of two failed subtests). This is not reported as an all-green suite. The whole run preceded the final pending-prompt carry fix for Routing; every affected context path was rerun afterwards.
  • Affected layout fixtures were repaired in separate test commits: 8 control/animation, 10 five-language phone-row, 30 mobile/desktop-baseline and 37 cancellation/failure-colour cases pass after repair. These are passing affected-file reruns, not erased failures from the first full run.
  • Final context disclosure, old-choice migration, Usage-link, live patching, every-frame geometry and provider-logo tests passed all 134 checks across both engines and five languages. The new pending-prompt disclosure check fails before its fix because the carried context becomes invisible. At 735c08e, closing and reopening keep the card while the new live prompt is being read.
  • Both split PRs apply together without conflicts. Combined assets passed the original 90 context/story checks; after the final carry fix, all 10 affected combined-assets checks passed again.
  • With unmodified main e1b70c1 assets, the original lazy-header regression fails with closed context does not build the detail grid (actual 1, expected 0). Syntax and git diff --check pass. Fixtures use synthetic accounts/APIs; no live gateway or user configuration is touched. Native Windows/Linux GUI behavior was not manually exercised.

Unresolved whole-run failures are recorded rather than retried into a passing total:

  • Library switch click intercepted by its sticky header: #1609. An independent run with unchanged main assets reproduced the click failure.
  • Routing steady editor moved 1.6875px beyond the existing 1.5px tolerance: #1804. Unchanged main assets reproduced exactly that displacement; the tolerance is unchanged.
  • Usage route's Export POST was not observed: #1876. Its separate unchanged-main English WebKit run passed, which does not resolve the failed whole run.
  • Usage ledger's narrow split pill exceeded the view: #1948, related to the responsive-layout timing investigation in gui tests: 31 tests measure right after setViewportSize, which WebKit can still answer with the old width's layout #1671. Cause remains unresolved; the separate unchanged-main run passed.
  • Japanese Usage width overflow: #1864. Unchanged main assets reproduced Chromium overflow at 780px and 850px. The full run also failed WebKit at 740px; the isolated main WebKit run passed. Usage implementation/tests remain unchanged.

The automated preview below is maintained by CI and may describe the preceding revision until the latest run replaces it.


🎬 界面预览

CI 用这个 PR 的代码构建并真实运行 magpie(沙盒环境,配置了真实的 DeepSeek key),按改动自动操作、截图和录屏 · 735c08e · 运行记录

改动(按代码):路由页的上下文窗口改成一条可点击的标题行,放在舞台与请求故事的下方:收起时只显示已用/窗口 token、占比、缓存与占用条,点开才构建详情网格和内容列表,不再有第二个标题;卡片宽到 800px 及以上时详情内的概览与内容并排成两栏。

Note

沙盒里看不到:沙盒窗口是 1280×800,路由卡片宽度不足 1100px,看不到宽卡片断点下「舞台与请求故事并排、两处列分隔线对齐」的布局;旧的 magpie.ctxShut 折叠偏好迁移、以及从用量页「上下文」入口临时展开某个请求而不改动已保存偏好的行为,也因沙盒里没有相应状态/操作路径而不在本片里展示。

播放录屏

▶️ 点图打开录屏(可暂停、拖动)· 直接下载 mp4 · 红线是鼠标轨迹,红色圆环是点击

路由页的上下文窗口头

路由页打开时的样子

路由页打开时的样子

页面下方收起的上下文窗口头:用量、占比与占用条

页面下方收起的上下文窗口头:用量、占比与占用条

点击之后的上下文窗口

点击之后的上下文窗口

再次点击之后的上下文窗口

再次点击之后的上下文窗口

@Nxir
Nxir deployed to ui-preview October 8, 2026 17:39 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 8, 2026
@Nxir
Nxir force-pushed the codex/routing-details-layout branch from 1567381 to 1e32de9 Compare October 8, 2026 18:09
@Nxir
Nxir deployed to ui-preview October 8, 2026 18:09 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 8, 2026
@Nxir
Nxir force-pushed the codex/routing-details-layout branch from 1e32de9 to c212c56 Compare October 8, 2026 18:46
@Nxir
Nxir deployed to ui-preview October 8, 2026 18:46 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 8, 2026
@Nxir
Nxir marked this pull request as ready for review October 8, 2026 19:11
@Nxir
Nxir deployed to ui-preview October 10, 2026 03:39 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 10, 2026
@yetone

yetone commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Sorry this took so long to get a review. Thank you for the careful write-up and the before/after evidence.

Reviewed at head b60224b68416c6e843ad7b02be3f5e20053a7c52 against origin/main ab4a77895.

It no longer merges. Since your base 4a3d7c6f, 45 commits on main have touched routing.js, context.js or routing.css. git merge-tree reports conflicts in routing.js, i18n.js, docs/subsystems/gui-shell.md, internal/gui/tests/README.md and mobile-web.test.cjs. I didn't run the suite on a hand-resolved tree, because how you resolve routing.js decides what the tests would check.

The routing.js conflict needs care. Main's d13a4a1 (the owner's report that the provider logos in the request story kept blinking) changed renderSteps so that a line whose text, kind, model and logos haven't changed keeps its DOM node, and only changed lines are built again (replaceKeeping + keepIcons). Your side rebuilds every line with steps.replaceChildren(...). Taking it as is brings the blinking back, and routing-log-icons.test.cjs's live-request cases (the same li and logo nodes across three steps) would catch that. Please keep main's node-keeping and add your has-events / detailVisibility() calls around it.

The product call. The owner has delegated these decisions, so here it is:

  • Context header (yes). The one-line context header that builds the grid only when opened is welcome. Main already has a context fold (ctx-fold in context.js), so this replaces it. Keep reading magpie.ctxShut as you do now.

  • Request story (no to closed by default). The story shouldn't start closed or fade to a single line. Routing's purpose is to say why a request went where it did, and main keeps adding those reasons to the story:

    Not all of these are failures, so the has-events class wouldn't keep them visible. Leaving the story open, with the toggle there for anyone who wants it shorter, is fine.

  • Heading and stage caption. Please keep the heading "How the last request was routed" and keep the stage caption visible. With your change they become "Latest request" and a screen-reader-only caption.

The simplest way forward would be two PRs, each rebased on current main:

  1. the context header and the wide-card layout;
  2. the request-details toggle, open by default.

I'll review both with the Routing GUI tests in Chromium and WebKit, in every language, at narrow widths.

Rebuild the context and wide-layout change on main e1b70c1 following
the Oct 13 review. Keep the complete request story, original heading,
visible stage caption and main's unchanged line/logo retention.

Use one context header, construct its body only while open, migrate the
existing fold choice and retain live card updates and the text viewer.
Align the stage/story and overview/contents splits within the page's
existing width cap. Keep the narrow stage sizing and prevent flex shrink
from moving the header when context contents appear.

Three-platform vet and builds and the sandboxed nogui suite passed.
Base assets fail the new context test because a closed card constructs
the detail grid (1 instead of 0). Focused disclosure checks passed;
the complete GUI suite is still running and is tracked in the PR body.
@Nxir
Nxir force-pushed the codex/routing-details-layout branch from b60224b to d6d5738 Compare October 13, 2026 05:19
@Nxir
Nxir deployed to ui-preview October 13, 2026 05:19 — with GitHub Actions Active
@Nxir Nxir changed the title gui: make Routing request and context details compact and optional gui: make the Routing context lazy and align wide cards Oct 13, 2026
github-actions Bot added a commit that referenced this pull request Oct 13, 2026
Open the lazy context explicitly for its retained-animation check and wait for page entrance animations as well as cells. Reach the group Cancel button and history day with user wheel input rather than relying on forbidden click scrolling. Until the baseline contains the new Routing wrapper, keep its intentional desktop layout out of the unchanged-page pixel comparison; the focused layout matrix covers it and mobile fit still checks Routing.

Validation: group-fold and held-animations passed all 8 cases; phone-rows passed all 10 cases across five languages and both engines; mobile-web passed all 30 cases. git diff --check and JavaScript syntax passed. The complete GUI suite is still being recorded on unchanged d6d5738 assets. Library switch failures are independently reproduced on e1b70c1 assets and tracked by upstream yetone#1609; they are not claimed as passing.
@Nxir
Nxir deployed to ui-preview October 13, 2026 06:06 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 13, 2026
The visible full request story can leave a historical request below a narrow window. Reach the day and request row with wheel input before selecting them, while retaining the app scroll guard and all cancellation and failure-colour assertions.

Validation: all 37 checks in routing-agent-gone and routing-agent-hue-not-red pass across both engines, four/five languages and 420/1100px widths. The whole GUI run had exposed the two WebKit German 420px click-scroll failures. git diff --check and JavaScript syntax passed.
@Nxir
Nxir deployed to ui-preview October 13, 2026 06:27 — with GitHub Actions Active
github-actions Bot added a commit that referenced this pull request Oct 13, 2026
Keep the last available live prompt separately from the render key. Opening or closing the unified header can redraw that carried context while a new request has no prompt yet; clearing a render key for a disclosure no longer removes the entire card. Explicitly picked requests still start fresh, and unavailable or completed requests clear the carried data.

Validation: before the fix, the new pending-prompt disclosure regression fails because the carried context becomes invisible. After the fix, all 134 context disclosure, saved-choice, Usage-link, live patch, every-frame and provider-logo checks pass in Chromium and WebKit across five languages and desktop/phone widths. Native macOS, Linux nogui and Windows builds, syntax and git diff --check pass. The complete GUI run is recorded separately with unresolved existing failures linked in the PR description.
@Nxir
Nxir deployed to ui-preview October 13, 2026 06:41 — with GitHub Actions Active
@yetone

yetone commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Ran before merging, at head 735c08e merged onto main c8c3ce9:

Nits for a follow-up, not blocking:

  • #view-routing { overflow-y: scroll } always shows a scrollbar track on Windows, even when nothing scrolls. scrollbar-gutter: stable keeps the width steady without one.
  • A user who never toggled the context now gets it closed by default. That is intended, per the owner's review.

@yetone
yetone merged commit dae2618 into yetone:main Oct 14, 2026
6 of 8 checks passed
yetone added a commit that referenced this pull request Oct 14, 2026
v0.1.1233 shipped community PR #1354 (dae2618), which put "How the
last request was routed" in a right column beside the stage on wide
windows, split the context card into overview/contents columns, and
replaced the context card's own head with one lazily built disclosure
header. Two users on Discord asked for the old page back: wongxy
("这是哪个人才要改成这样的,丑死了", "UI方面的需求响应要克制一点", with a
screenshot of the new page) and molvqingtai ("v0.1.1231 没有这个问题").
The owner delegated the call: Routing goes back to v0.1.1231's look.

Only the lazy construction of the context body was a candidate to keep,
as it is invisible. It doesn't separate cleanly: it is built on the new
unified header (ctxSummary in the closed state, ctx-body/ctx-overview in
the open one), which is itself the visible change. So this reverts
dae2618 whole: assets, its doc section, its README entry, the new
routing-context-layout test, and the test edits that existed only for
the new layout (wheel-scrolling to rows the right column pushed down,
mobile-web's skip of Routing in the pixel comparison). No later commit
on main is a follow-up of it.

Later commits touching the same files are kept: 20350da's subagent
reason in routing.js and README entry, a7a3819/5fc2f87d1's gui-shell.md
lines, 00afcf9's README entry. routing.css and context.js are now
byte-identical to v0.1.1231; routing.js differs only by later features
(#1068 folders, subagent reasons).

Run (worktree on origin/main 3ec45e7 + this revert):
- Routing page screenshots against v0.1.1231's assets with one counted
  request (the .rt card): Chromium and WebKit, en/zh/zh-TW/ja/de, 1100
  and 420 wide, plus 1440/1800 in en/zh: 0 pixels differ in all 28.
  origin/main differs in all of them (the folded header, the columns).
- node --test routing-*, panel-routing*, group-fold, held-animations,
  phone-rows, context-*: 1025 of 1034 pass. The 9 reds are
  routing-keys-fold's "a request that comes flies to the fold" (WebKit,
  and Chromium de) and routing-model-rest's "Try now" reach. Both files
  run alone fail the same way on origin/main bda2719 (12 fails there,
  11 here, different cases of model-rest each run), at load average
  ~350 from other sessions; filed as #1612 and #2115.
- mobile-web (pixel baseline) with BASE_REF=dae2618ad^: every phone
  case and Routing's desktop compare pass; the 8 reds are all Settings,
  changed since by #2073's colorblind switch, not by this.
- gofmt -l, go vet (darwin, linux nogui, windows) and
  go test -tags nogui ./internal/gui pass.
Not tried: the native Wails window; the complete GUI suite.
@yetone

yetone commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Thank you for this PR, and for the careful work behind it: rebuilding it on main after review, the five-language and two-engine checks, and the detailed notes in each commit.

After it shipped in v0.1.1233, users on Discord asked for the previous Routing page back. They found the new wide layout (the routing story in a right column, the split context card, the folded context header) harder to read than before, and one noted that v0.1.1231 didn't look this way. We've decided to keep the page as it was, so bfef5d5 reverts this change and Routing is back to v0.1.1231's layout from the next release.

We looked at keeping just the lazy construction of the context body, since users can't see it, but it's built on the new unified header, so it couldn't be separated cleanly. The whole commit was reverted, along with the test changes that existed only for the new layout.

This is about how the page looks, not the quality of the code. Thanks again for contributing.

yetone added a commit that referenced this pull request Oct 14, 2026
…0.1.1244)

New lessons: an origin exemption judges every Origin a browser can send
(#2242, #2256; seen 2x with the 10-10 rebinding case); a file another
process rewrites may be half-written; a pinned hash or new download
source is checked against the vendor and trusted as far as who can write
it; a fixed date in a test is checked against every clock the code reads
(3c4b4dc -> 21aa402); a new field on a polled endpoint is costed at
the poll rate; a full run gives slow packages -timeout 45m; a community
layout PR is not merged on review alone (#1354).

Evidence added: five fixed-wait CI reds under the timing habit, unfiled
reds and a cancelled run that tested nothing, a second oversized squash
subject (seen 2x), "see the push" as a run record and plugins#56 under
the moved standards. ggbdpq's Watched row notes 94e3b3f and the
red-before/green-after fixes since.

Every cited sha was checked with git log; claims were checked against
their commit bodies. Ran: go test -tags nogui -count=1 -run
TestLoopGuardLeavesOrdinaryRepliesAlone ./internal/gateway (reads
LESSONS.md): ok. Docs only, no code.
yetone added a commit that referenced this pull request Oct 23, 2026
…at the page's foot into view (shihh on Discord)

The routing groups sit below the stage, the story and every request; with
many models (shihh on Discord) they are a long scroll down. The Routing
page's head now has Routing groups (#rtGoGroups) beside New group: a down
arrow, its name, and a tooltip saying where they are. Its click goes
through scrollOnPurpose, brings .rt-gsec to the top of the view and moves
the focus into it. The page's layout is unchanged (no #1354-style move):
the groups stay last in #rtMore. fitGo gives the button only the head's
spare room (the .grow spacer): named, its arrow alone (still named to a
screen reader), or left out, so nothing else in the head moves or wraps.
Strings in zh, zh-TW, ja and de. app.js untouched (plugin files only).

Test: routing-groups-jump.test.cjs, Chromium and WebKit x en/zh/zh-TW/ja/de
x 1000px web, 480px web, 640px window: 30/30. It is red on main's assets (no
button), red with the scrollOnPurpose check removed (the app's guard pulls
the view back), red without the focus move, and red with fitGo removed
(de at 480px web: Hide accounts moves).

Run at this change on 50f52b5 (de28176, rebased under it, touches only internal/gateway):
- go test -tags nogui -timeout 45m ./...: 69 packages ok, no FAIL
- gofmt -l: clean; go vet darwin, GOOS=linux -tags nogui, GOOS=windows: ok
- TestCoreScriptBudget and the other budget tests: ok
- GUI files the change can reach (routing*, group*, i18n-keys,
  click-scroll, title-bar-tools; 125 files, both engines): 1495/1495

Not run: the whole GUI suite. Another session's full GUI run held the
machine for 2h45m+, and this touches only the routing plugin's files.
Not changed: on a phone the web head already shrinks to its 40px
min-height on main, so wrapped buttons slide under the first card (Hide
accounts at 360px in German). Where the head has no spare room, the button
is left out rather than wrapped.

This branch was successfully deployed

1 active deployment
ui-preview — 735c08ef Deployed Oct 13, 2026 by Nxir via record #1174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants