From e4c7800906b50b1ab6c2ad96ca3f1e2771f53982 Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Tue, 24 Nov 2026 03:51:33 -0500 Subject: [PATCH 1/2] Warm up Chrome before the timed server-visuals render test On a fresh hosted Linux runner the first Chrome launch reads the browser from a cold disk and took up to ~14 s to answer its first command, which the real-Chrome test timed against its 15 s render limit. Draw one untimed warm-up first so the limit times the drawing, not the cold start. --- .memory/inline-generative-ui.md | 1 + packages/cli/tests/server-visuals.test.mjs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.memory/inline-generative-ui.md b/.memory/inline-generative-ui.md index 512a67785..f59759f7a 100644 --- a/.memory/inline-generative-ui.md +++ b/.memory/inline-generative-ui.md @@ -112,6 +112,7 @@ Round 17 (2026-11-19): security (rev43) and correctness (rev44) reviews of 91ab5 ## Smarter artifacts Phase E2 (2026-11-19) - Item 32, visuals on `aiden serve` (b9cb9bec0, `packages/cli/src/server-visuals.ts`): `render_artifact` draws the visual once as a still PNG (2x, 720 or 1024 px wide) with an installed Chrome or Chromium found only at fixed paths (no `PATH` lookup, no override, no snap), headless, sandbox on, throwaway profile, offline with every request refused, bounded time and size; looked for only when a visual is drawn. The PNG goes out as the desktop's ordinary visual snapshot, so there is no Remote protocol change. `render_ui` sends its fallback text with each chart's data under its summary line (`compileAum(..., { fallback: { chartTables: true, plainTables: true } })` in `packages/cli/src/extensions/artifacts.ts`): since Phase E fix round 2, each table row is one plain line of labelled values (`Customer: Acme · Revenue: $1.2M`, cells clipped to 40 characters and stripped of control and bidi characters), not Markdown pipes or space-padded columns, because the phone's visual row shows the text as-is in a proportional font; sparklines list their values (all up to 32, else the first, `…`, the latest 30 and the count, so `…` always hides two or more; 2026-11-19), chart/sparkline/heatmap labels go through `cleanCell` (one line, max 120), plain rows are cut at 400 characters, heatmaps their cells as `row · column: value` lines, and scatter charts every numeric field when no `x` is named. Each tool result starts with what the person sees ("Shown as an image" / "Shown as text" / "Not shown" with the reason). Running as root or without a browser: not shown, said so. The server does not offer `chat-visual-viewer-v1`. A paired Mac never drew a server's native visual (Remote projects no markup); since Phase E fix round 2 `mapRemoteMessage` (`renderer/lib/hosts/remote-chat-mapper.ts`) turns each projected `ui` visual that has `fallbackText` and no `snapshotAttachmentId` into a text-only `ChatUiVisualV1` (`Visual` root, one `Text` per line, at most 400 lines, no data or state) placed by its `toolCallId`, so a paired Mac shows the same text as a phone; the tool result says "phones and Macs paired to this server show … as the text below". + - Test (2026-11-24): the real-Chrome test in `packages/cli/tests/server-visuals.test.mjs` draws one untimed warm-up first. A CI trace showed the first Chrome launch on a fresh hosted Linux runner takes 8-14 s to answer `Target.createTarget` (cold disk; nothing on stderr for ~7.5 s), against the 15 s render limit, while warm launches answer in ~170 ms and draw in ~1 s. Its D-Bus errors are noise: disabling D-Bus and running the file outside the parallel pool were both tried and changed nothing. This had been failing `renderer-other` on many branches (#906 runs 45337184177, 45352616175, 45356021801). - Idea 4, the visual's Actions menu: with extra actions, a visual caption's Copy (native) or Export (HTML) button becomes one `MoreHorizontal` "Actions for {title}" menu (`renderer/components/visual-actions-menu.tsx`, `VisualCaptionActions`) that lists the visual's own action first, so no new always-visible control. With no extras it is still the plain button. The expanded HTML view keeps a plain Export: a portalled Radix menu sits behind the top-layer popover and light-dismisses it. - Native visuals get **Keep in Artifacts** (settled messages only; `KeepVisualChatContext` from `chat-pane.tsx`, set only for a local non-Bot, non-routine chat in a non-Assistant workspace; the remote chat view never provides it). IPC `workspaces:artifacts:keepVisual(chatId, messageId, visualId)`; main re-checks every case and reads the visual from the stored chat, never from the renderer. - HTML visuals get **Send to canvas** only when `useDesignModeControls(chatId)` is non-null. IPC `designCanvas:placeArtifact(chatId, mediaId)` places it as an artifact frame (sized to the open canvas's viewSize) through the existing placement path (unsafe-HTML scan, size limits, frame cap); placed or already turns design mode on, an error result (`missing`, `unsafe`, `full`) toasts and leaves design mode alone. Messages live in `renderer/lib/visual-menu-actions.ts`. diff --git a/packages/cli/tests/server-visuals.test.mjs b/packages/cli/tests/server-visuals.test.mjs index e9c2a92fb..1ab9d5823 100644 --- a/packages/cli/tests/server-visuals.test.mjs +++ b/packages/cli/tests/server-visuals.test.mjs @@ -173,6 +173,10 @@ test("an installed browser draws a chart offline into a picture and leaves no pr const dir = mkdtempSync(join(tmpdir(), "aiden-server-visuals-")); t.after(() => rmSync(dir, { recursive: true, force: true })); const previous = process.env.AIDEN_CLI_ENTRY; process.env.AIDEN_CLI_ENTRY = join(pkg, "dist/app/cli.js"); t.after(() => { if (previous === undefined) delete process.env.AIDEN_CLI_ENTRY; else process.env.AIDEN_CLI_ENTRY = previous; }); + // The first launch of Chrome on a fresh CI machine reads the browser from a + // cold disk and has taken 8-14 s to answer; later launches answer in under + // 200 ms. Draw once without the limit, so the limit below times the drawing. + await api.renderServerVisualImage({ browserPath: browser.path, hostPage: api.serverVisualHostPage("

Warm-up

", "Warm-up", 720, () => ""), width: 720, timeoutMs: 120_000 }); const profiles = () => readdirSync(tmpdir()).filter((name) => name.startsWith("aiden-visual-")).length; const before = profiles(); const visuals = api.createServerVisualCollector(); From f4a401c9445e9a7c186baa2b8d852b399497c3ae Mon Sep 17 00:00:00 2001 From: Sambit Biswas Date: Tue, 24 Nov 2026 03:58:21 -0500 Subject: [PATCH 2/2] Count leftover browser profiles from before the warm-up render --- packages/cli/tests/server-visuals.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/tests/server-visuals.test.mjs b/packages/cli/tests/server-visuals.test.mjs index 1ab9d5823..0849668aa 100644 --- a/packages/cli/tests/server-visuals.test.mjs +++ b/packages/cli/tests/server-visuals.test.mjs @@ -173,12 +173,12 @@ test("an installed browser draws a chart offline into a picture and leaves no pr const dir = mkdtempSync(join(tmpdir(), "aiden-server-visuals-")); t.after(() => rmSync(dir, { recursive: true, force: true })); const previous = process.env.AIDEN_CLI_ENTRY; process.env.AIDEN_CLI_ENTRY = join(pkg, "dist/app/cli.js"); t.after(() => { if (previous === undefined) delete process.env.AIDEN_CLI_ENTRY; else process.env.AIDEN_CLI_ENTRY = previous; }); + const profiles = () => readdirSync(tmpdir()).filter((name) => name.startsWith("aiden-visual-")).length; + const before = profiles(); // The first launch of Chrome on a fresh CI machine reads the browser from a // cold disk and has taken 8-14 s to answer; later launches answer in under // 200 ms. Draw once without the limit, so the limit below times the drawing. await api.renderServerVisualImage({ browserPath: browser.path, hostPage: api.serverVisualHostPage("

Warm-up

", "Warm-up", 720, () => ""), width: 720, timeoutMs: 120_000 }); - const profiles = () => readdirSync(tmpdir()).filter((name) => name.startsWith("aiden-visual-")).length; - const before = profiles(); const visuals = api.createServerVisualCollector(); const html = `
`; const started = Date.now();