Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.
routing: a key off screen is not laid out or painted, so hundreds of open keys keep WebKit's frames (#3164)
yetone9fc382e66d69
diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.jsindex 1ca0f115b..92c57b566 100644--- a/internal/gui/assets/plugins/routing/client.js+++ b/internal/gui/assets/plugins/routing/client.js@@ -1456,6 +1456,11 @@ function routingPage(part) {return v;};const h = b(hub), low = b(srcs).b;+ // a key off screen is not drawn, and its content is as tall as a drawn+ // key's (routing.css, #3164)+ let row = list.firstElementChild;+ while (row && (row.matches(".rt-fold, .rt-sub, .idle") || !row.firstElementChild?.checkVisibility?.({ contentVisibilityAuto: true }))) row = row.nextElementSibling;+ const pad = row && getComputedStyle(row), rowH = row && Math.round((b(row).b - b(row).t - parseFloat(pad.paddingTop) - parseFloat(pad.paddingBottom) - parseFloat(pad.borderTopWidth) - parseFloat(pad.borderBottomWidth)) * 100) / 100;for (const a of agents.values()) {const s = b(a.node), mx = (s.r + h.l) / 2;sets.push([a.wire, h.l > s.r ? curve(s.r, s.cy, mx, h.l, h.cy) : `M${s.cx} ${s.b} L${h.cx} ${h.t}`]);@@ -1491,6 +1496,9 @@ function routingPage(part) {const up = f?.open ? f : row.up && subs.get(row.up), a = b(row.li);sets.push([row.wire, up ? fromSub(up, a) : fromHub(a)]);}+ // set after this frame: the keys not drawn changing size resize the+ // stage, which in its own ResizeObserver WebKit reports as a loop+ if (rowH && list.style.getPropertyValue("--rt-row") !== rowH + "px") requestAnimationFrame(() => list.style.setProperty("--rt-row", rowH + "px"));wires.setAttribute("viewBox", `0 0 ${r.width} ${r.height}`);sky.setAttribute("viewBox", `0 0 ${r.width} ${r.height}`);for (const [p, d] of sets) {diff --git a/internal/gui/assets/plugins/routing/routing.css b/internal/gui/assets/plugins/routing/routing.cssindex ab35f4d77..4e7d5b430 100644--- a/internal/gui/assets/plugins/routing/routing.css+++ b/internal/gui/assets/plugins/routing/routing.css@@ -53,6 +53,12 @@.rt-accts { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; min-width: 0; }.rt-accts li { position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 6px; padding: 9px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; transition: opacity .3s, border-color .3s, transform .5s cubic-bezier(.2, .8, .2, 1); }.rt-accts li { margin-left: calc(var(--depth, 0) * 18px); }+/* a key off screen is not laid out or painted (#3164): with hundreds of+ keys open, WebKit painted every row again on each frame a magpie flew.+ One not drawn yet is as tall as a key drawn is (--rt-row, client.js's+ layout). A row a 429 hit keeps its tag up over its top edge, which this+ would cut, so it is drawn whole */+.rt-accts li:not(.hit) { content-visibility: auto; contain-intrinsic-size: auto var(--rt-row, 38px); }/* a group in the group: a heading its models hang from, set in under it */.rt-accts li.rt-sub { display: flex; align-items: center; gap: 7px; padding: 5px 10px; font-size: 12px; color: var(--muted); background: var(--card-2); border-style: dashed; }.rt-accts li.rt-sub.on { border-style: solid; border-color: var(--fg-2); color: var(--fg); }diff --git a/internal/gui/tests/routing-many-keys.test.cjs b/internal/gui/tests/routing-many-keys.test.cjsindex 557138ed9..d7bbfb5a1 100644--- a/internal/gui/tests/routing-many-keys.test.cjs+++ b/internal/gui/tests/routing-many-keys.test.cjs@@ -135,7 +135,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",}return { wire: Math.round(wire), cubic: Math.round(cubic) };});- t.diagnostic(`folded ${JSON.stringify(folded)}, open ${JSON.stringify(opened)}, wires ${JSON.stringify(tall)}`);+ // a key far below the fold of the window is not drawn, and is as tall+ // as the keys drawn: drawn, WebKit painted all 800 again on each frame+ // a magpie flew, ~40 frames a second+ const rows = await page.evaluate(() => new Promise((done) => requestAnimationFrame(() => requestAnimationFrame(() => {+ const keys = [...document.querySelectorAll("#view-routing .rt-accts > li:not(.rt-fold):not(.rt-sub):not(.idle):not(.hit)")];+ const drawn = (li) => li.firstElementChild.checkVisibility({ contentVisibilityAuto: true });+ const mid = (li) => { const r = li.getBoundingClientRect(); return Math.abs((r.top + r.bottom) / 2 - innerHeight / 2); };+ const seen = keys.reduce((a, li) => (mid(li) < mid(a) ? li : a));+ const h = (li) => Math.round(li.getBoundingClientRect().height);+ done({ shown: mid(seen) < innerHeight / 2 && drawn(seen), last: drawn(keys[keys.length - 1]), heights: [...new Set(keys.map(h))] });+ }))));+ t.diagnostic(`folded ${JSON.stringify(folded)}, open ${JSON.stringify(opened)}, wires ${JSON.stringify(tall)}, rows ${JSON.stringify(rows)}`);+ assert.equal(rows.shown, true, "a key in sight is drawn");+ assert.equal(rows.last, false, "the last of 800 keys, out of sight, is not drawn");+ assert.equal(rows.heights.length, 1, `keys drawn and not are one height: ${rows.heights}`);for (const [name, n] of [["folded", folded], ["open", opened]]) {// a key's place is looked up in an index of its provider's list:// before, a sort of 800 keys looked through the 500 for each of