Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(work-panel): clarify overflowing tool launcher navigation

vastsa58572bad676e
diff --git a/apps/desktop/src/styles/work-panel.css b/apps/desktop/src/styles/work-panel.css
index 47ba453e6..18ed31980 100644
--- a/apps/desktop/src/styles/work-panel.css
+++ b/apps/desktop/src/styles/work-panel.css
@@ -505,12 +505,15 @@
display: flex;
width: 100%;
min-height: 0;
+ flex: 1;
flex-direction: column;
gap: 8px;
padding: 14px 10px;
+ overflow: hidden;
}
.work-panel-launcher-title {
+ flex: 0 0 auto;
padding: 0 8px 4px;
color: var(--ds-text-muted);
font-size: var(--text-sm);
@@ -520,9 +523,24 @@
.work-panel-launcher-list {
display: flex;
min-height: 0;
+ flex: 1;
flex-direction: column;
gap: 2px;
+ overflow-x: hidden;
overflow-y: auto;
+ overscroll-behavior-y: contain;
+ scrollbar-gutter: stable;
+}
+
+/* A quiet, persistent thumb makes an overflowing tool list discoverable even
+ before hover. The shared scrollbar still renders only when needed. */
+.work-panel-launcher-list::-webkit-scrollbar-thumb {
+ background: color-mix(in oklab, var(--ds-text-primary) 16%, transparent);
+}
+
+.work-panel-launcher-list::-webkit-scrollbar-thumb:hover,
+.work-panel-launcher-list::-webkit-scrollbar-thumb:active {
+ background: color-mix(in oklab, var(--ds-text-primary) 28%, transparent);
}
.work-panel-launcher-row {
diff --git a/apps/desktop/test/work-panel.test.mjs b/apps/desktop/test/work-panel.test.mjs
index 5a1cd03ca..2edf9f6b7 100644
--- a/apps/desktop/test/work-panel.test.mjs
+++ b/apps/desktop/test/work-panel.test.mjs
@@ -639,16 +639,26 @@ test("the launcher tool list scrolls when it outgrows the panel body", () => {
// the pane and the rows below the fold become unreachable (issue #2026).
const launcher = globalStyles.match(/\.work-panel-launcher \{[^}]*\}/)?.[0] ?? "";
assert.match(launcher, /min-height: 0/);
+ assert.match(launcher, /flex: 1/);
+ assert.match(launcher, /overflow: hidden/);
const list = globalStyles.match(/\.work-panel-launcher-list \{[^}]*\}/)?.[0] ?? "";
assert.match(list, /min-height: 0/);
assert.match(list, /overflow-y: auto/);
+ assert.match(list, /flex: 1/);
+ assert.match(list, /overflow-x: hidden/);
+ assert.match(list, /overscroll-behavior-y: contain/);
+ assert.match(list, /scrollbar-gutter: stable/);
// Rows are flex items of that list: without flex-shrink: 0 a constrained
// list first compresses them below their 40px height instead of scrolling.
const row = globalStyles.match(/\.work-panel-launcher-row \{[^}]*\}/)?.[0] ?? "";
assert.match(row, /flex-shrink: 0/);
// The title stays pinned; only the rows scroll.
const title = globalStyles.match(/\.work-panel-launcher-title \{[^}]*\}/)?.[0] ?? "";
+ assert.match(title, /flex: 0 0 auto/);
assert.doesNotMatch(title, /overflow-y/);
+ // Overflow remains discoverable without hover; use the shared theme ink.
+ const thumb = globalStyles.match(/\.work-panel-launcher-list::-webkit-scrollbar-thumb \{[^}]*\}/)?.[0] ?? "";
+ assert.match(thumb, /var\(--ds-text-primary\) 16%, transparent/);
});
test("work panel empty states match the app's other empty-state proportions", () => {
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index e7b1c909b..7bd075c8c 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1111,9 +1111,14 @@ singleton without duplicating it:
+---------------------------------------+
```
-The launcher is bounded by the panel body: the title stays pinned while the
-tool rows scroll inside the list when the data-driven set outgrows the
-available height, so every row remains reachable (#2026).
+The launcher fills and is bounded by the panel body: the title does not shrink
+or scroll, while the tool list uses the remaining height. Rows retain their
+40px hit targets and scroll independently when the data-driven set outgrows
+the available height, so every row remains reachable (#2026). The list reserves
+a stable scrollbar gutter and shows a quiet, theme-aware thumb whenever it
+overflows, even before hover; short lists have no scrollbar. Long labels stay
+ellipsized without horizontal scrolling, and wheel input at either end does
+not chain into the surrounding shell.
### 5.2.1 Light-theme surface
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 247fbb134..f401a2968 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -4995,10 +4995,15 @@ window; opening a normal panel afterward must still work.
still work without moving it.
4) Click `+` twice and verify each creates and activates a separate New
launcher tab. Confirm its body lists Review and each in-scope plugin view
- exactly once. Shrink the window (or install enough plugins) so the launcher
- rows exceed the panel height: the New title stays pinned, the row list
- scrolls, the bottom rows stay reachable by wheel, scrollbar, and Tab focus
- (#2026). Open Browser and confirm its native surface opens at unchanged
+ exactly once. With 40 plugin views and long localized names, shrink the
+ window and narrow the panel: the New title stays pinned, the row list alone
+ scrolls, and 40px rows stay reachable by wheel, scrollbar, and Tab focus
+ (#2026). A quiet scrollbar thumb is visible before hover, its reserved
+ gutter prevents label shifts, and there is no horizontal overflow or scroll
+ chaining into the shell. Repeat with no explicit tab, a `+`-created New tab,
+ few/no plugins, and light/dark themes in English and Chinese. Activate the
+ last tool, close its view, and confirm the complete launcher returns.
+ Open Browser and confirm its native surface opens at unchanged
bounds. Open its context menu and verify the native popup appears above Browser
chrome while the page remains visible. With Browser active, right-click another
tab and confirm it still uses the native menu. Repeat at 50% and 150% app zoom;
@@ -5099,9 +5104,10 @@ window; opening a normal panel afterward must still work.
`work-panel-tabs.test.mjs`, `browser-tab-restore.test.mjs`,
`work-panel.test.mjs`, `plugin-work-panel-views.test.mjs`,
`plugin-view-navigation.test.mjs`, `work-panel-tab-menu.test.mjs`);
- isolated Electron
- tab-menu, Browser native-menu page visibility, and close geometry in
- `scripts/e2e-work-panel-tab-close.mjs`; full UI scenario Draft
+ isolated Electron tab-menu, Browser native-menu page visibility, and close
+ geometry in `scripts/e2e-work-panel-tab-close.mjs`; launcher overflow,
+ native focus reveal, hit targets, and open/close user paths in
+ `node scripts/e2e-work-panel-launcher-overflow.mjs`; full UI scenario Draft
#### E2E-057: Message-owned review history survives commits and rolls back safely
diff --git a/scripts/e2e-work-panel-launcher-overflow.mjs b/scripts/e2e-work-panel-launcher-overflow.mjs
new file mode 100644
index 000000000..a4a7487a1
--- /dev/null
+++ b/scripts/e2e-work-panel-launcher-overflow.mjs
@@ -0,0 +1,100 @@
+import assert from "node:assert/strict";
+import { spawn } from "node:child_process";
+import { createRequire } from "node:module";
+import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { resolveElectronBinary } from "./e2e/boot.mjs";
+
+const root = join(dirname(fileURLToPath(import.meta.url)), "..");
+const require = createRequire(join(root, "packages/agent-runtime/package.json"));
+const { build } = require("esbuild");
+const { electronBinary } = resolveElectronBinary(root);
+const temp = await mkdtemp(join(process.env.PI_SCRATCH_DIR || tmpdir(), "pi-launcher-overflow-"));
+const scenarios = [
+ { count: 40, width: 244, height: 260, explicitTab: false, theme: "light", language: "en" },
+ { count: 40, width: 360, height: 320, explicitTab: true, theme: "dark", language: "zh-CN" },
+ { count: 40, width: 720, height: 600, explicitTab: true, theme: "light", language: "en" },
+ { count: 3, width: 244, height: 520, explicitTab: false, theme: "dark", language: "zh-CN" },
+ { count: 0, width: 360, height: 260, explicitTab: true, theme: "light", language: "en" },
+];
+try {
+ const styles = await Promise.all(
+ ["tokens", "base", "chat-shell", "ui-kit", "work-panel"].map((name) =>
+ readFile(join(root, `apps/desktop/src/styles/${name}.css`), "utf8"),
+ ),
+ );
+ await writeFile(join(temp, "style.css"), styles.join("\n"));
+ await build({
+ entryPoints: [join(root, "scripts/e2e/work-panel-launcher-overflow.tsx")],
+ outfile: join(temp, "renderer.js"),
+ bundle: true,
+ platform: "browser",
+ format: "iife",
+ jsx: "automatic",
+ define: {
+ "process.env.NODE_ENV": '"production"',
+ "import.meta.env": '{"DEV":false,"MODE":"production"}',
+ },
+ loader: { ".css": "empty" },
+ alias: {
+ "@pi-desktop/shared": join(root, "packages/shared/src/index.ts"),
+ "@pi-desktop/i18n": join(root, "packages/i18n/src/index.ts"),
+ react: join(root, "apps/desktop/node_modules/react"),
+ "react-dom": join(root, "apps/desktop/node_modules/react-dom"),
+ i18next: join(root, "apps/desktop/node_modules/i18next"),
+ "react-i18next": join(root, "apps/desktop/node_modules/react-i18next"),
+ },
+ nodePaths: [join(root, "apps/desktop/node_modules")],
+ });
+ await writeFile(join(temp, "index.html"),
+ '<!doctype html><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src \'self\'; style-src \'self\' \'unsafe-inline\'"><title>Work panel launcher overflow regression</title><link rel="stylesheet" href="style.css"><body><script src="renderer.js"></script>');
+ await writeFile(join(temp, "main.cjs"), `
+const { app, BrowserWindow } = require("electron");
+const path = require("node:path");
+app.setPath("userData", path.join(__dirname, "profile"));
+app.whenReady().then(async () => {
+ const window = new BrowserWindow({ show: false, width: 1000, height: 800,
+ webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false, backgroundThrottling: false } });
+ window.webContents.on("console-message", (event) => console.error(event.message));
+ try {
+ await window.loadFile(path.join(__dirname, "index.html"));
+ for (const scenario of ${JSON.stringify(scenarios)}) {
+ const result = await window.webContents.executeJavaScript(
+ "globalThis.launcherOverflowProbe(" + JSON.stringify(scenario) + ")");
+ console.log("LAUNCHER_OVERFLOW " + JSON.stringify({ ...scenario, ...result }));
+ }
+ app.exit(0);
+ } catch (error) { console.error(error); app.exit(1); }
+});
+`);
+ const env = { ...process.env };
+ delete env.ELECTRON_RUN_AS_NODE;
+ const child = spawn(electronBinary, [join(temp, "main.cjs")], {
+ env, stdio: ["ignore", "pipe", "pipe"],
+ });
+ let output = "";
+ for (const stream of [child.stdout, child.stderr]) {
+ stream.on("data", (data) => { output += data; });
+ }
+ const timeout = setTimeout(() => child.kill("SIGKILL"), 45_000);
+ let code;
+ try {
+ code = await new Promise((resolve, reject) => {
+ child.once("error", reject);
+ child.once("close", resolve);
+ });
+ } finally {
+ clearTimeout(timeout);
+ }
+ const results = output.split(/\r?\n/).filter((line) => line.startsWith("LAUNCHER_OVERFLOW "));
+ assert.equal(code, 0, output.slice(-6000));
+ assert.equal(results.length, scenarios.length, "Not all launcher scenarios ran");
+ for (const line of results) {
+ assert.equal(JSON.parse(line.slice("LAUNCHER_OVERFLOW ".length)).ok, true);
+ console.log(line);
+ }
+} finally {
+ await rm(temp, { recursive: true, force: true });
+}
diff --git a/scripts/e2e/work-panel-launcher-overflow.tsx b/scripts/e2e/work-panel-launcher-overflow.tsx
new file mode 100644
index 000000000..eecaa8e7f
--- /dev/null
+++ b/scripts/e2e/work-panel-launcher-overflow.tsx
@@ -0,0 +1,165 @@
+import { createRoot } from "react-dom/client";
+import { flushSync } from "react-dom";
+import { createInstance } from "i18next";
+import { I18nextProvider } from "react-i18next";
+import { catalogs } from "@pi-desktop/i18n";
+import { IPC } from "@pi-desktop/shared";
+import { WorkPanel } from "../../apps/desktop/src/components/workpanel/WorkPanel";
+import { useAppStore } from "../../apps/desktop/src/stores/app-store";
+
+type Scenario = {
+ count: number;
+ width: number;
+ height: number;
+ explicitTab: boolean;
+ theme: "light" | "dark";
+ language: "en" | "zh-CN";
+};
+
+declare global {
+ var launcherOverflowProbe: (scenario: Scenario) => Promise<{
+ ok: true;
+ rows: number;
+ scrollHeight: number;
+ clientHeight: number;
+ }>;
+}
+
+function check(condition: unknown, message: string): asserts condition {
+ if (!condition) throw new Error(message);
+}
+
+// Mock only the native bridge; the real component, store actions, and CSS run.
+window.piDesktop = {
+ channels: IPC,
+ platform: "darwin",
+ invoke: async () => ({ ok: true, data: undefined }),
+ on: () => () => undefined,
+};
+const host = document.createElement("div");
+host.style.cssText = "position:absolute;inset:0 auto auto 0;display:flex";
+document.body.append(host);
+const root = createRoot(host);
+const i18n = createInstance();
+const ready = i18n.init({
+ lng: "en",
+ resources: {
+ en: { translation: catalogs.en },
+ "zh-CN": { translation: catalogs["zh-CN"] },
+ },
+ interpolation: { escapeValue: false },
+});
+
+function element(selector: string): HTMLElement {
+ const node = host.querySelector<HTMLElement>(selector);
+ check(node, `Missing ${selector}`);
+ return node;
+}
+
+async function rendered() {
+ await Promise.all(document.getAnimations().map((animation) => animation.finished));
+ await new Promise<void>((resolve) =>
+ requestAnimationFrame(() => requestAnimationFrame(() => resolve())),
+ );
+}
+
+function visibleRow(row: HTMLElement, list: HTMLElement) {
+ const box = row.getBoundingClientRect();
+ const viewport = list.getBoundingClientRect();
+ check(box.top >= viewport.top - 1 && box.bottom <= viewport.bottom + 1,
+ "Tool row is not fully visible inside its scroll viewport");
+ const hit = document.elementFromPoint(box.left + box.width / 2, box.top + box.height / 2);
+ check(hit && row.contains(hit), "Visible tool does not receive pointer hits");
+}
+
+globalThis.launcherOverflowProbe = async (scenario) => {
+ await ready;
+ await i18n.changeLanguage(scenario.language);
+ document.documentElement.dataset.theme = scenario.theme;
+ host.style.width = `${scenario.width}px`;
+ host.style.height = `${scenario.height}px`;
+ flushSync(() => {
+ useAppStore.setState({
+ activeSessionId: "launcher-overflow",
+ workPanelWidth: scenario.width,
+ workPanelOpen: true,
+ workPanelTabs: [],
+ activeWorkPanelTabId: null,
+ workPanelContexts: {},
+ pluginViews: Array.from({ length: scenario.count }, (_, order) => ({
+ pluginId: `fixture.tool-${order}`,
+ viewId: "main",
+ ref: `fixture.tool-${order}/main`,
+ title: `${scenario.language === "en" ? "Tool" : "工具"} ${order} ${"Long localized tool name ".repeat(8)}`,
+ pluginName: `Fixture ${order}`,
+ order,
+ })),
+ });
+ root.render(
+ <I18nextProvider i18n={i18n}>
+ <WorkPanel containerWidth={scenario.width + 450} sidebarCollapsed />
+ </I18nextProvider>,
+ );
+ });
+ if (scenario.explicitTab) {
+ flushSync(() => element(".work-panel-new-tab").click());
+ }
+ await rendered();
+
+ const list = element(".work-panel-launcher-list");
+ const title = element(".work-panel-launcher-title");
+ const rows = [...host.querySelectorAll<HTMLElement>(".work-panel-launcher-row")];
+ const first = rows[0];
+ const last = rows.at(-1);
+ check(first && last, "Review row is missing");
+ check(rows.length === scenario.count + 1, "Launcher lost or duplicated a tool");
+ const body = element(".work-panel-body").getBoundingClientRect();
+ const launcher = element(".work-panel-launcher").getBoundingClientRect();
+ check(launcher.top >= body.top - 1 && launcher.bottom <= body.bottom + 1,
+ "Launcher grows outside the panel body");
+ check(list.scrollWidth === list.clientWidth, "Long labels create horizontal scrolling");
+ for (const row of rows) {
+ check(row.getBoundingClientRect().height === 40, "Tool hit targets were compressed");
+ }
+ const overflows = rows.length * 40 + (rows.length - 1) * 2 > list.clientHeight;
+ check((list.scrollHeight > list.clientHeight) === overflows,
+ "The tool list does not own vertical overflow");
+ const thumb = getComputedStyle(list, "::-webkit-scrollbar-thumb").backgroundColor;
+ check(!["rgba(0, 0, 0, 0)", "transparent"].includes(thumb) && !/\s0\)$/.test(thumb),
+ "The tool list hides its scroll affordance at rest");
+ const titleTop = title.getBoundingClientRect().top;
+ list.scrollTop = list.scrollHeight;
+ await rendered();
+ visibleRow(last, list);
+ check(title.getBoundingClientRect().top === titleTop, "Scrolling moves the launcher title");
+
+ // Browser focus must reveal off-screen rows without moving the panel shell.
+ first.focus();
+ await rendered();
+ visibleRow(first, list);
+ last.focus();
+ await rendered();
+ visibleRow(last, list);
+ check(title.getBoundingClientRect().top === titleTop, "Keyboard focus moves the launcher title");
+ check(host.scrollHeight <= host.clientHeight, "Tool navigation scrolls the outer shell");
+
+ const result = { ok: true as const, rows: rows.length,
+ scrollHeight: list.scrollHeight, clientHeight: list.clientHeight };
+ if (scenario.count > 0) {
+ const sourceTabId = useAppStore.getState().activeWorkPanelTabId;
+ flushSync(() => last.click());
+ await rendered();
+ const state = useAppStore.getState();
+ const destination = state.workPanelTabs.find((tab) => tab.id === state.activeWorkPanelTabId);
+ check(destination?.resource === `fixture.tool-${scenario.count - 1}/main`,
+ "The last tool does not open its own view");
+ check(state.workPanelTabs.length === 1 && destination.id !== sourceTabId,
+ "Opening a tool failed to replace the New launcher");
+ flushSync(() => element(".work-panel-tab-close").click());
+ await rendered();
+ check(host.querySelectorAll(".work-panel-launcher-row").length === rows.length,
+ "Closing the view did not restore all tools");
+ check(useAppStore.getState().workPanelOpen, "Closing the final view collapsed the panel");
+ }
+ return result;
+};