From d09877157d41ff527d563ccb64d53849846c6f75 Mon Sep 17 00:00:00 2001 From: Jiaxiaoyuan Date: Fri, 20 Nov 2026 22:04:33 +0800 Subject: [PATCH 1/5] Use a pinned portable FFmpeg on Linux WebUI CI --- .aoci/baseline.json | 20 ++++++++++---------- .github/workflows/webui-ci.yml | 17 ++++++++++++----- aoci.code.txt | 4 ++-- test/source-sync.test.mjs | 9 +++++---- 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/.aoci/baseline.json b/.aoci/baseline.json index 942c403e..b1bdb3d7 100644 --- a/.aoci/baseline.json +++ b/.aoci/baseline.json @@ -1,7 +1,7 @@ { "version": 1, "created_at": "2026-11-19T05:53:26Z", - "updated_at": "2026-11-20T10:44:13Z", + "updated_at": "2026-11-20T14:03:07Z", "files": { ".agents/skills/changelog-card-publish/SKILL.md": { "role": "index", @@ -317,9 +317,9 @@ }, ".github/workflows/webui-ci.yml": { "role": "index", - "sha256": "d145b227385b4c57b26af11ffc25cc5736fa83adf6cc7975a5ee98d78a5ae298", - "size": 6267, - "normalized_sha256": "d145b227385b4c57b26af11ffc25cc5736fa83adf6cc7975a5ee98d78a5ae298" + "sha256": "b32adc09ecba0f196bd1bf7592d3ea456d9a9902eb184a0ea65d89faa900272c", + "size": 6817, + "normalized_sha256": "b32adc09ecba0f196bd1bf7592d3ea456d9a9902eb184a0ea65d89faa900272c" }, ".gitignore": { "role": "index", @@ -773,9 +773,9 @@ }, "aoci.code.txt": { "role": "index", - "sha256": "a8c909897c9fd56baac348d81d13888fe6a67cface1601909d50041cacd43ff7", - "size": 638265, - "normalized_sha256": "a8c909897c9fd56baac348d81d13888fe6a67cface1601909d50041cacd43ff7" + "sha256": "7f0291a5f14f01ed545cfc721fb59720d2d676327a0563f73b00fdb194b8f170", + "size": 638248, + "normalized_sha256": "7f0291a5f14f01ed545cfc721fb59720d2d676327a0563f73b00fdb194b8f170" }, "aoci.meta.txt": { "role": "index", @@ -31820,9 +31820,9 @@ }, "test/source-sync.test.mjs": { "role": "index", - "sha256": "571fadf30890f870b4d50292dd435a4666f2ac92973dd51c43e9146fcfd6532a", - "size": 97175, - "normalized_sha256": "571fadf30890f870b4d50292dd435a4666f2ac92973dd51c43e9146fcfd6532a" + "sha256": "afee05bfb8ffc23b2fe2e6d67c77bf437e3486597efe2e0fa5da9f775a2552b9", + "size": 97325, + "normalized_sha256": "afee05bfb8ffc23b2fe2e6d67c77bf437e3486597efe2e0fa5da9f775a2552b9" }, "test/sqlite-message-contention.test.ts": { "role": "observe", diff --git a/.github/workflows/webui-ci.yml b/.github/workflows/webui-ci.yml index 1a9c2495..551d7621 100644 --- a/.github/workflows/webui-ci.yml +++ b/.github/workflows/webui-ci.yml @@ -83,22 +83,29 @@ jobs: run: pnpm install:webui-browsers - name: Install FFmpeg if: matrix.lane.name == 'units' || matrix.lane.shard - timeout-minutes: ${{ runner.os == 'Linux' && 15 || 8 }} + timeout-minutes: 8 shell: bash run: | # The native Design media paths run FFmpeg for real: the tests cut a # real clip, draw a real waveform and persist a real poster. Without # the binary on PATH they fail on `spawnSync ffmpeg ENOENT` rather - # than on anything about the code under test. The Linux image ships - # one already; the macOS and Windows images do not. + # than on anything about the code under test. verify_ffmpeg() { node -e 'require("node:child_process").execFileSync("ffmpeg", ["-version"], { stdio: "inherit" })' } if verify_ffmpeg; then exit 0 elif [ "$RUNNER_OS" = "Linux" ]; then - sudo apt-get update - sudo apt-get install -y --no-install-recommends ffmpeg + # Avoid the Ubuntu mirror and its large graph of FFmpeg packages. + ffmpeg_dir="$(mktemp -d "$RUNNER_TEMP/webui-ffmpeg.XXXXXX")" + archive="$ffmpeg_dir/ffmpeg.tar.xz" + curl --fail --location --retry 3 --retry-max-time 240 --connect-timeout 15 --max-time 120 \ + --output "$archive" \ + "https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v8.1.3-2/jellyfin-ffmpeg_8.1.3-2_portable_linux64-gpl.tar.xz" + printf '%s %s\n' 1df84d04c4322902dba81c290508cdf3d89524d210b9fe03154bea6c4e3bfbb6 "$archive" | sha256sum --check + tar -xJf "$archive" -C "$ffmpeg_dir" ffmpeg ffprobe + export PATH="$ffmpeg_dir:$PATH" + printf '%s\n' "$ffmpeg_dir" >> "$GITHUB_PATH" elif [ "$RUNNER_OS" = "macOS" ]; then brew install ffmpeg else diff --git a/aoci.code.txt b/aoci.code.txt index bd7ab875..cf6891f6 100644 --- a/aoci.code.txt +++ b/aoci.code.txt @@ -109,7 +109,7 @@ sync-issue-to-feishu.yml[FV4M]: F:Defines legacy Feishu notification for eligibl webui-npm-preview.yml[FV4S]: F:Defines legacy npm preview package verification for the WebUI branch. | R:- | A:- | S:- ===//.github/workflows/=== -webui-ci.yml[FV4S]: F:Runs independent WebUI checks, unit and integration tests, browser shards, and package jobs on three operating systems. | R:code:package.json,code:playwright.config.mjs,code:.github/workflows/update-visual-baselines.yml | A:- | S:macOS uses windowed Chromium. Linux skips recommended FFmpeg packages and allows a longer install for slow mirrors. Diagnostics isolate platform, lane and attempt. +webui-ci.yml[FV4S]: F:Runs independent WebUI checks, unit and integration tests, browser shards, and package jobs on three operating systems. | R:code:package.json,code:playwright.config.mjs,code:.github/workflows/update-visual-baselines.yml | A:- | S:macOS uses windowed Chromium. Linux provisions a checksum-pinned portable FFmpeg when absent to avoid APT mirrors. Diagnostics isolate platform, lane and attempt. update-visual-baselines.yml[FV4S]: F:Re-records the per-platform Playwright visual baselines of the named WebUI browser specs on the three CI runners and commits each runner's own pixels. | R:code:.github/workflows/webui-ci.yml | A:- | S:The refresh selects the browser mode the CI compares with — windowed Chromium on macOS — in a step of its own, because a step cannot read back the environment file it writes. ===//.plan/browser-use/board/=== @@ -5860,7 +5860,7 @@ network-deny.mjs[SE4T]: F:Provides test helpers that deny network access. | R:- offline-environment.mjs[SE4T]: F:Prepares an offline environment for verification. | R:- | A:- | S:- public-artifact.test.mjs[SE4T]: F:Checks the contents and contracts of public artifacts. | R:- | A:- | S:- smoke.test.mjs[SE4M]: F:Runs smoke checks for the public distribution. | R:- | A:- | S:- -source-sync.test.mjs[TV6L]: F:Tests source synchronization, WebUI workflow contracts, and release tooling. | R:code:scripts/lib/acceptance-records.mjs,code:.github/workflows/webui-ci.yml | A:- | S:Requires three browser shards per OS, native provisioning before suites, a Linux-only FFmpeg timeout increase, independent lane failures, unique diagnostics, and read-only workflow permissions. +source-sync.test.mjs[TV6L]: F:Tests source synchronization, WebUI workflow contracts, and release tooling. | R:code:scripts/lib/acceptance-records.mjs,code:.github/workflows/webui-ci.yml | A:- | S:Requires three browser shards per OS, checksum-verified Linux and Windows FFmpeg provisioning, independent lane failures, unique diagnostics, and read-only workflow permissions. vitest-suites.json[FQ6L]: F:Declares the Vitest files every verification suite runs, per group. | R:- | A:- | S:A new Vitest file is registered in its group here; the Vitest config and the package scripts read this file instead of naming files themselves. windows-contract.test.mjs[SE4S]: F:Tests Windows-specific distribution and runtime contracts. | R:- | A:- | S:- diff --git a/test/source-sync.test.mjs b/test/source-sync.test.mjs index df355e55..244ccde2 100644 --- a/test/source-sync.test.mjs +++ b/test/source-sync.test.mjs @@ -85,10 +85,11 @@ test('public WebUI CI runs only WebUI checks and cannot publish packages', () => const ffmpeg = job.steps.find(step => step.name === 'Install FFmpeg'); assert.ok(ffmpeg, 'the native Design media paths run FFmpeg for real'); assert.match(ffmpeg.run, /ffmpeg/); - assert.equal(ffmpeg['timeout-minutes'], "${{ runner.os == 'Linux' && 15 || 8 }}"); - assert.match(ffmpeg.run, /sudo apt-get install -y --no-install-recommends ffmpeg/); - assert.doesNotMatch(ffmpeg.run, /npm publish|wget /); - assert.equal((ffmpeg.run.match(/\bcurl /g) ?? []).length, 1); + assert.equal(ffmpeg['timeout-minutes'], 8); + assert.doesNotMatch(ffmpeg.run, /apt-get|npm publish|wget /); + assert.equal((ffmpeg.run.match(/\bcurl /g) ?? []).length, 2); + assert.match(ffmpeg.run, /https:\/\/github\.com\/jellyfin\/jellyfin-ffmpeg\/releases\/download\/v\d+\.\d+\.\d+-\d+\/jellyfin-ffmpeg_[\d.-]+_portable_linux64-gpl\.tar\.xz/); + assert.match(ffmpeg.run, /[a-f0-9]{64}.*sha256sum --check\s+tar -xJf .* ffmpeg ffprobe/); assert.match(ffmpeg.run, /https:\/\/github\.com\/GyanD\/codexffmpeg\/releases\/download\/\d+\.\d+\.\d+\//); assert.match(ffmpeg.run, /[a-f0-9]{64}.*sha256sum --check\s+unzip /); const commands = job.steps.filter(step => step.run && step !== directories).map(step => step.run); From dfa836b16cc80f2db73ddfbaa95a27e632156ff0 Mon Sep 17 00:00:00 2001 From: Jiaxiaoyuan Date: Fri, 20 Nov 2026 22:23:38 +0800 Subject: [PATCH 2/5] Stabilize native browser checks and stream measurements --- .aoci/baseline.json | 32 +++++++++---------- aoci.code.txt | 4 +-- .../browser/architecture-acceptance.spec.mjs | 1 + .../browser/streaming-performance.spec.mjs | 4 +++ .../test/integration/agent-transcript.test.ts | 6 +++- .../isolated-chromium-two-pages.test.ts | 8 ++++- 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.aoci/baseline.json b/.aoci/baseline.json index b1bdb3d7..22208261 100644 --- a/.aoci/baseline.json +++ b/.aoci/baseline.json @@ -1,7 +1,7 @@ { "version": 1, "created_at": "2026-11-19T05:53:26Z", - "updated_at": "2026-11-20T14:03:07Z", + "updated_at": "2026-11-20T14:21:45Z", "files": { ".agents/skills/changelog-card-publish/SKILL.md": { "role": "index", @@ -773,9 +773,9 @@ }, "aoci.code.txt": { "role": "index", - "sha256": "7f0291a5f14f01ed545cfc721fb59720d2d676327a0563f73b00fdb194b8f170", - "size": 638248, - "normalized_sha256": "7f0291a5f14f01ed545cfc721fb59720d2d676327a0563f73b00fdb194b8f170" + "sha256": "67aaa267074c3730abb480eb0926ce871af6cde9890b256509c19129562a1c63", + "size": 638560, + "normalized_sha256": "67aaa267074c3730abb480eb0926ce871af6cde9890b256509c19129562a1c63" }, "aoci.meta.txt": { "role": "index", @@ -28430,9 +28430,9 @@ }, "packages/webui/test/browser/architecture-acceptance.spec.mjs": { "role": "index", - "sha256": "5defe9c4769f44b9ade7ed5d817bb6bab382869ad7e6bc9e91faf497a6c21fe6", - "size": 24635, - "normalized_sha256": "5defe9c4769f44b9ade7ed5d817bb6bab382869ad7e6bc9e91faf497a6c21fe6" + "sha256": "a9b579432f17f59ef8f57591fa6064f5176781ed8b0f0d107073884088be4802", + "size": 24705, + "normalized_sha256": "a9b579432f17f59ef8f57591fa6064f5176781ed8b0f0d107073884088be4802" }, "packages/webui/test/browser/browser-bridge-real-browser.spec.ts": { "role": "observe", @@ -28995,9 +28995,9 @@ }, "packages/webui/test/browser/streaming-performance.spec.mjs": { "role": "index", - "sha256": "d2f06b3c590a7b1c06f56f3a8f480a3968d537ba5f080c853149022f80733fe7", - "size": 25429, - "normalized_sha256": "d2f06b3c590a7b1c06f56f3a8f480a3968d537ba5f080c853149022f80733fe7" + "sha256": "8b40ee27fab86c7ece5058526c25648047cec0be6db205b17b1a5d7fe22e4c7a", + "size": 25721, + "normalized_sha256": "8b40ee27fab86c7ece5058526c25648047cec0be6db205b17b1a5d7fe22e4c7a" }, "packages/webui/test/browser/support/accessibility-baseline.json": { "role": "index", @@ -29360,9 +29360,9 @@ }, "packages/webui/test/integration/agent-transcript.test.ts": { "role": "observe", - "sha256": "a02713d0ab3616147836f3efcb5e6b442079160da3f96b38ec6f3f447a33d745", - "size": 125244, - "normalized_sha256": "a02713d0ab3616147836f3efcb5e6b442079160da3f96b38ec6f3f447a33d745" + "sha256": "611c867c9c3e11c27c949837977388557019e910ab4c71677510af1a93b5a35e", + "size": 125497, + "normalized_sha256": "611c867c9c3e11c27c949837977388557019e910ab4c71677510af1a93b5a35e" }, "packages/webui/test/integration/browser-core-agent-actions.test.ts": { "role": "observe", @@ -29426,9 +29426,9 @@ }, "packages/webui/test/integration/isolated-chromium-two-pages.test.ts": { "role": "observe", - "sha256": "eaeaff358619a8992546c87f75a6a4475b669fd30def2f42b7632d29f0077f7d", - "size": 51206, - "normalized_sha256": "eaeaff358619a8992546c87f75a6a4475b669fd30def2f42b7632d29f0077f7d" + "sha256": "78df3a7bc3662c9deb3ec7ef2ee7de92e632e056f71d63b123fa0df681d3b02d", + "size": 51526, + "normalized_sha256": "78df3a7bc3662c9deb3ec7ef2ee7de92e632e056f71d63b123fa0df681d3b02d" }, "packages/webui/test/integration/loopback-harness-path.test.ts": { "role": "observe", diff --git a/aoci.code.txt b/aoci.code.txt index cf6891f6..2d3925fb 100644 --- a/aoci.code.txt +++ b/aoci.code.txt @@ -5669,7 +5669,7 @@ account-login.spec.mjs[TU4M]: F:Tests account login and subscription quota rende api-key-feedback.spec.mjs[SE4M]: F:Tests presentation of API key connection feedback. | R:- | A:- | S:- application-observation.spec.mjs[SE4T]: F:Tests application observation and stale presenter results. | R:- | A:- | S:- application-performance.mjs[SE4S]: F:Defines application performance measurement thresholds and helpers. | R:- | A:- | S:- -architecture-acceptance.spec.mjs[SE4M]: F:Tests the WebUI architecture contracts (terminal readiness, roster permissions, probe economy, transfer retention) as browser workflows. | R:code:packages/webui/test/browser/harness.mjs,code:packages/webui/docs/verification/browser-suite.md | A:- | S:Case names carry roadmap requirement IDs (V13-V36, C11); this repository defines none of them. +architecture-acceptance.spec.mjs[TE4M]: F:Tests terminal readiness, roster permissions, probe economy and transfer retention as browser workflows. | R:code:packages/webui/test/browser/harness.mjs,code:packages/webui/docs/verification/browser-suite.md | A:- | S:Wait for panel exit to unmount before reopening after a terminal reconnect. Case IDs refer to roadmap requirements. browser-notice-layer.spec.mjs[SE4T]: F:Tests Browser Use notice layering over page content. | R:- | A:- | S:- browser-workspace.spec.mjs[SE4L]: F:Tests opening and operating Browser Use in the workspace panel. | R:- | A:- | S:- composer-goal-mode.spec.mjs[SE4S]: F:Tests entering goal mode from the WebUI composer. | R:- | A:- | S:- @@ -5715,7 +5715,7 @@ settings-account-tab.spec.mjs[SE4L]: F:Tests account settings navigation. | R:- settings-shortcuts.spec.mjs[SE4M]: F:Tests keyboard shortcut settings and bindings. | R:- | A:- | S:- settings-theme.spec.mjs[SE4S]: F:Tests theme settings and selected navigation styling. | R:- | A:- | S:- ssh-terminal.spec.mjs[SE4M]: F:Tests SSH terminal presentation and connection status. | R:- | A:- | S:- -streaming-performance.spec.mjs[SE4L]: F:Measures responsiveness during streamed replies. | R:- | A:- | S:- +streaming-performance.spec.mjs[TE4L]: F:Measures streaming responsiveness in the built browser client and validates blocking attribution with positive and negative controls. | R:code:packages/webui/test/browser/application-performance.mjs,code:packages/webui/test/browser/harness.mjs | A:- | S:Start the first stream chunk in a timer task so the measured window excludes the DevTools task that injects and configures the fixture. surface-appearance.spec.mjs[SE4S]: F:Tests appearance contracts for shared WebUI surfaces. | R:- | A:- | S:- terminal-cross-page.spec.mjs[SE4S]: F:Tests that PTY sessions can be observed across pages. | R:- | A:- | S:- toast.spec.mjs[SE4T]: F:Tests toast placement and failed-read feedback. | R:- | A:- | S:- diff --git a/packages/webui/test/browser/architecture-acceptance.spec.mjs b/packages/webui/test/browser/architecture-acceptance.spec.mjs index 2d172be3..b69ad4fe 100644 --- a/packages/webui/test/browser/architecture-acceptance.spec.mjs +++ b/packages/webui/test/browser/architecture-acceptance.spec.mjs @@ -42,6 +42,7 @@ for (const state of ["absent", "not-ready"]) { // And the action works again: the terminal opens for the tab that asked // for it, and the panel watches it. await page.getByRole("button", { name: "关闭面板" }).click(); + await expect(page.getByTestId("workspace-panel")).toHaveCount(0); await page.getByTestId("workspace-panel-controls").getByRole("button", { name: "浏览器" }).click(); await expect.poll(() => page.evaluate(() => window.__fixture.terminals().length)).toBe(1); await expect.poll(() => page.evaluate(() => window.__fixture.watchedTerminalIds().length)).toBe(1); diff --git a/packages/webui/test/browser/streaming-performance.spec.mjs b/packages/webui/test/browser/streaming-performance.spec.mjs index 842ca5af..c6f3ba63 100644 --- a/packages/webui/test/browser/streaming-performance.spec.mjs +++ b/packages/webui/test/browser/streaming-performance.spec.mjs @@ -202,6 +202,10 @@ async function measureStreamedReply(page, options) { }; probe(); + // Start the first chunk in its own browser task, like subsequent + // chunks. The DevTools task that injects this fixture can otherwise + // overlap the marker and charge its setup time to application work. + await new Promise((resolve) => setTimeout(resolve, 0)); performance.mark(measureStart); const started = performance.now(); for (let index = 0; index < count; index += 1) { diff --git a/packages/webui/test/integration/agent-transcript.test.ts b/packages/webui/test/integration/agent-transcript.test.ts index 446aae04..f102bd56 100644 --- a/packages/webui/test/integration/agent-transcript.test.ts +++ b/packages/webui/test/integration/agent-transcript.test.ts @@ -162,6 +162,7 @@ afterAll(() => { * or at this deadline -- never later. */ const BROWSER_FRAME_TIMEOUT_MS = 60_000; +const BROWSER_INPUT_TIMEOUT_MS = 10_000; /** * One of the browser panel's own states, read from the page. @@ -1273,7 +1274,10 @@ it.each(["transcript", "cross-client", "external-active-mutation", "external-act pageBox.y + pageBox.height * 88 / imageDimensions.height, ); await page.keyboard.type("browser-while-todo-active"); - await expect.poll(() => browserReportedValues).toContain("browser-while-todo-active"); + // The browser panel serializes keystrokes through the runtime. Playwright + // has finished dispatching keys before the isolated page finishes receiving them. + await expect.poll(() => browserReportedValues, { timeout: BROWSER_INPUT_TIMEOUT_MS }) + .toContain("browser-while-todo-active"); // The two right-side panels share one surface, and the browser panel // holds it now — so the progress card is not on the screen. The todo // itself is still reported: the runtime still carries it, and the diff --git a/packages/webui/test/integration/isolated-chromium-two-pages.test.ts b/packages/webui/test/integration/isolated-chromium-two-pages.test.ts index ad61db83..2376fe79 100644 --- a/packages/webui/test/integration/isolated-chromium-two-pages.test.ts +++ b/packages/webui/test/integration/isolated-chromium-two-pages.test.ts @@ -551,9 +551,15 @@ describe.skipIf(!available)("the browser service, streaming two pages of one Chr ); if (!current) return false; await service.selectTarget(current.id, "run-1"); + // Discovery and selection can succeed while the new tab is still + // loading. A repaint of the initial document is lost on navigation. + const ready = await readSelection( + 'document.title === "second page" && document.readyState === "complete"', + ); + if (ready !== true) return false; second = current.id; return true; - }, "the second page to become the run's selection"); + }, "the second page to load in the run's selection"); const secondStream = (async () => { for await (const frame of service.watchFrames( From fadacd8a72ddcff42914844a4cd39a634e5074b5 Mon Sep 17 00:00:00 2001 From: Jiaxiaoyuan Date: Sat, 21 Nov 2026 00:36:57 +0800 Subject: [PATCH 3/5] Assert Composer submenu exit from its animation event --- .aoci/baseline.json | 14 ++++----- aoci.code.txt | 2 +- packages/webui/test/browser/composer.spec.mjs | 30 ++++++++++++++++--- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/.aoci/baseline.json b/.aoci/baseline.json index 22208261..e519156e 100644 --- a/.aoci/baseline.json +++ b/.aoci/baseline.json @@ -1,7 +1,7 @@ { "version": 1, "created_at": "2026-11-19T05:53:26Z", - "updated_at": "2026-11-20T14:21:45Z", + "updated_at": "2026-11-20T16:36:34Z", "files": { ".agents/skills/changelog-card-publish/SKILL.md": { "role": "index", @@ -773,9 +773,9 @@ }, "aoci.code.txt": { "role": "index", - "sha256": "67aaa267074c3730abb480eb0926ce871af6cde9890b256509c19129562a1c63", - "size": 638560, - "normalized_sha256": "67aaa267074c3730abb480eb0926ce871af6cde9890b256509c19129562a1c63" + "sha256": "ab067c58dac202f2337272200395e89f569334f378206604a0bbb9e5406c4b81", + "size": 638707, + "normalized_sha256": "ab067c58dac202f2337272200395e89f569334f378206604a0bbb9e5406c4b81" }, "aoci.meta.txt": { "role": "index", @@ -28472,9 +28472,9 @@ }, "packages/webui/test/browser/composer.spec.mjs": { "role": "index", - "sha256": "324c7cbb54f83a561d699b26ce9e1986bdff135baf9402f796cf7e405af34706", - "size": 33683, - "normalized_sha256": "324c7cbb54f83a561d699b26ce9e1986bdff135baf9402f796cf7e405af34706" + "sha256": "df360c312136d05c97a261bf3d5d02385799b08b890501025713042495573d59", + "size": 34289, + "normalized_sha256": "df360c312136d05c97a261bf3d5d02385799b08b890501025713042495573d59" }, "packages/webui/test/browser/connection-status.spec.mjs": { "role": "index", diff --git a/aoci.code.txt b/aoci.code.txt index 2d3925fb..525b25f4 100644 --- a/aoci.code.txt +++ b/aoci.code.txt @@ -5673,7 +5673,7 @@ architecture-acceptance.spec.mjs[TE4M]: F:Tests terminal readiness, roster permi browser-notice-layer.spec.mjs[SE4T]: F:Tests Browser Use notice layering over page content. | R:- | A:- | S:- browser-workspace.spec.mjs[SE4L]: F:Tests opening and operating Browser Use in the workspace panel. | R:- | A:- | S:- composer-goal-mode.spec.mjs[SE4S]: F:Tests entering goal mode from the WebUI composer. | R:- | A:- | S:- -composer.spec.mjs[SE4L]: F:Tests the composer's slash palette, history and drafts, attachments, @ mentions, shared field feedback and submit gate as browser workflows. | R:code:packages/webui/docs/client/composer.md,code:packages/webui/test/browser/harness.mjs,code:packages/webui/docs/verification/browser-suite.md | A:- | S:- +composer.spec.mjs[TU4L]: F:Exercises composer menus, slash palette, drafts, attachments, mentions, and submit gating in the built browser client. | R:code:packages/webui/docs/client/composer.md,code:packages/webui/test/browser/harness.mjs,code:packages/webui/docs/verification/browser-suite.md | A:- | S:Arms a listener on the current submenu before hover, then verifies its named exit event and DOM removal separately so a late style sample cannot erase animation evidence. connection-status.spec.mjs[SE4S]: F:Tests connection status and recovery after an interrupted stream. | R:- | A:- | S:- content-page.spec.mjs[SE4S]: F:Tests the shared content page in the browser. | R:- | A:- | S:- context-usage-ring.spec.mjs[SE4M]: F:Tests context usage ring rendering from runtime data. | R:- | A:- | S:- diff --git a/packages/webui/test/browser/composer.spec.mjs b/packages/webui/test/browser/composer.spec.mjs index ba39864a..2c576a90 100644 --- a/packages/webui/test/browser/composer.spec.mjs +++ b/packages/webui/test/browser/composer.spec.mjs @@ -489,10 +489,32 @@ test("the composer's second-level menu has an opaque shared surface", async ({ p expect(submenuBackground, `${name} submenu has an opaque surface`).not.toBe("rgba(0, 0, 0, 0)"); expect(submenuBackground, `${name} submenu matches the root menu surface`).toBe(rootBackground); - await root.getByRole("menuitem", { name: "添加文件或图片" }).hover(); - await expect(submenu).toHaveAttribute("data-webui-motion-state", "exit"); - expect(await submenu.evaluate((node) => getComputedStyle(node).animationName)).toBe("webui-motion-surface-exit"); - await expect(submenu).toHaveCount(0, { timeout: 500 }); + // Capture the short exit on this instance before hovering away. Reading + // style or state after the hover can miss it on a busy runner. + const exit = await submenu.evaluateHandle((node) => { + const observed = { name: "", state: "" }; + node.addEventListener("animationstart", (event) => { + if ( + event.target === node && + !event.pseudoElement && + event.animationName === "webui-motion-surface-exit" + ) { + observed.name = event.animationName; + observed.state = node.dataset.webuiMotionState; + } + }); + return observed; + }); + try { + await root.getByRole("menuitem", { name: "添加文件或图片" }).hover(); + await expect.poll(() => exit.jsonValue()).toEqual({ + name: "webui-motion-surface-exit", + state: "exit", + }); + await expect(submenu).toHaveCount(0); + } finally { + await exit.dispose(); + } } }); From ddfeb4de3f9d0dcaaf8d39b3a066641211343a86 Mon Sep 17 00:00:00 2001 From: Jiaxiaoyuan Date: Sat, 21 Nov 2026 01:04:30 +0800 Subject: [PATCH 4/5] Distinguish native runtime shutdown stalls before acknowledgement --- .aoci/baseline.json | 32 +++++++++---------- aoci.code.txt | 8 ++--- .../src/infra/shutdown-diagnostics.ts | 10 +++++- packages/local-runtime-v2/src/runtime.ts | 2 ++ .../test/browser/native-runtime.spec.mjs | 9 ++++-- .../browser/support/native-browser-host.ts | 16 +++++++--- 6 files changed, 49 insertions(+), 28 deletions(-) diff --git a/.aoci/baseline.json b/.aoci/baseline.json index e519156e..96f6ef5d 100644 --- a/.aoci/baseline.json +++ b/.aoci/baseline.json @@ -1,7 +1,7 @@ { "version": 1, "created_at": "2026-11-19T05:53:26Z", - "updated_at": "2026-11-20T16:36:34Z", + "updated_at": "2026-11-20T17:04:18Z", "files": { ".agents/skills/changelog-card-publish/SKILL.md": { "role": "index", @@ -773,9 +773,9 @@ }, "aoci.code.txt": { "role": "index", - "sha256": "ab067c58dac202f2337272200395e89f569334f378206604a0bbb9e5406c4b81", - "size": 638707, - "normalized_sha256": "ab067c58dac202f2337272200395e89f569334f378206604a0bbb9e5406c4b81" + "sha256": "70dea33809344412e2289c0848c49ccf40956f36982100918468657e74e432bb", + "size": 639385, + "normalized_sha256": "70dea33809344412e2289c0848c49ccf40956f36982100918468657e74e432bb" }, "aoci.meta.txt": { "role": "index", @@ -5649,9 +5649,9 @@ }, "packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts": { "role": "index", - "sha256": "e1b5da492e3ac36fcc418436da15957af153f8795fbf0be8661fc6d875f39c84", - "size": 277, - "normalized_sha256": "e1b5da492e3ac36fcc418436da15957af153f8795fbf0be8661fc6d875f39c84" + "sha256": "bf4ec3b5cfaa2954868576c1e1c034defda3bb49aa3d1e0852dc392f356bd11d", + "size": 594, + "normalized_sha256": "bf4ec3b5cfaa2954868576c1e1c034defda3bb49aa3d1e0852dc392f356bd11d" }, "packages/local-runtime-v2/src/infra/sse/bounded-ring.ts": { "role": "index", @@ -5721,9 +5721,9 @@ }, "packages/local-runtime-v2/src/runtime.ts": { "role": "index", - "sha256": "b802e88e552dd869780546d60803e5a268f8c87a73fbf91437cf78bb00ae6bf1", - "size": 35740, - "normalized_sha256": "b802e88e552dd869780546d60803e5a268f8c87a73fbf91437cf78bb00ae6bf1" + "sha256": "d2da6a7c4ad34faae5824567e74459e1437f49e91cbb6a071d65b9b6fc31d5a3", + "size": 35853, + "normalized_sha256": "d2da6a7c4ad34faae5824567e74459e1437f49e91cbb6a071d65b9b6fc31d5a3" }, "packages/local-runtime-v2/src/service/agent-turn/contracts.ts": { "role": "index", @@ -28584,9 +28584,9 @@ }, "packages/webui/test/browser/native-runtime.spec.mjs": { "role": "index", - "sha256": "42e93ba4c5dc0d0923b58ad61bf57499b3b50f5431fe5c67715a18d00ea0aa05", - "size": 14379, - "normalized_sha256": "42e93ba4c5dc0d0923b58ad61bf57499b3b50f5431fe5c67715a18d00ea0aa05" + "sha256": "751f0c3e43d2eaf4d56e01306102d41d2e75538fb8eb7f3daead9a2cd980b536", + "size": 14681, + "normalized_sha256": "751f0c3e43d2eaf4d56e01306102d41d2e75538fb8eb7f3daead9a2cd980b536" }, "packages/webui/test/browser/overlay-coordination.spec.mjs": { "role": "index", @@ -29042,9 +29042,9 @@ }, "packages/webui/test/browser/support/native-browser-host.ts": { "role": "index", - "sha256": "0bdfaa062b39de9e45eabad4fce1a9795c65ed5f921de27fd377a549e1feb7df", - "size": 7937, - "normalized_sha256": "0bdfaa062b39de9e45eabad4fce1a9795c65ed5f921de27fd377a549e1feb7df" + "sha256": "d017e3fa3a4b6020d5e17df31bb68cc3682b24525e3135ff8424a664468852b4", + "size": 8122, + "normalized_sha256": "d017e3fa3a4b6020d5e17df31bb68cc3682b24525e3135ff8424a664468852b4" }, "packages/webui/test/browser/support/native-design-browser-host.ts": { "role": "index", diff --git a/aoci.code.txt b/aoci.code.txt index 525b25f4..18371009 100644 --- a/aoci.code.txt +++ b/aoci.code.txt @@ -1039,7 +1039,7 @@ wire.ts[MD4M]: F:Projects session and project records into their public view and ===//packages/local-runtime-v2/src/=== background-runtime.ts[ER4M]: F:Creates and owns background runtime infrastructure. | R:- | A:createBackgroundRuntime,CreateBackgroundRuntimeOptions,BackgroundRuntime | S:Shutdown drains deferred maintenance before releasing the runtime owner lease and can report both phases. index.ts[LG4T]: F:Exports local runtime host creation and rootless runtime generation switching. | R:- | A:createLocalRuntimeHost,createLocalRuntimeHostV2,switchRootlessV2Generation | S:- -runtime.ts[AG4L]: F:Constructs and closes the V2 local runtime host and provides a factory with test overrides. | R:code:packages/local-runtime-v2/src/background-runtime.ts | A:createLocalRuntimeHostV2,createLocalRuntimeHostV2ForTest,LocalRuntimeV2TestOverrides | S:Opt-in shutdown phase markers precede owner, legacy host and database teardown. +runtime.ts[AG4L]: F:Constructs and closes the V2 local runtime host and provides a factory with test overrides. | R:code:packages/local-runtime-v2/src/background-runtime.ts,code:packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts | A:createLocalRuntimeHostV2,createLocalRuntimeHostV2ForTest,LocalRuntimeV2TestOverrides | S:Opt-in shutdown tracing marks entry, return and throw around synchronous database close without changing cleanup order or the first-error outcome. services.ts[AG4L]: F:Defines the local runtime service assembly, creation options, and test overrides. | R:- | A:RuntimeServices,RuntimeServicesTestOverrides,CreateRuntimeServicesOptions | S:- ===//packages/local-runtime-v2/src/compat/v1/=== @@ -5689,7 +5689,7 @@ model-picker-interactions.spec.mjs[SE4M]: F:Tests model picker interactions and motion.spec.mjs[SE4S]: F:Tests shared WebUI motion contracts. | R:- | A:- | S:- native-design-tasks.spec.mjs[TB6L]: F:Exercises native Design node runs, reference understanding, authenticated media and cancellation through the browser. | R:code:packages/webui/test/browser/support/native-design-browser-host.ts | A:- | S:Wait for the connected image reference to render after an out-of-band setup write before triggering the slow understanding run. Preserve provider and host evidence for uncompleted runs. native-design.spec.mjs[SE4L]: F:Exercises native Design menus, graph gestures, real tool presentation, media operations and library controls. | R:code:packages/webui/test/browser/support/native-design-browser-host.ts | A:- | S:FFmpeg must be on PATH. Focus the conversation before the production tool turn so headed Chromium does not defer the panel in a background tab. Clipboard assertions normalize CRLF. -native-runtime.spec.mjs[SE4M]: F:Tests the native runtime path and persistence of terminal sessions. | R:- | A:- | S:- +native-runtime.spec.mjs[TH4M]: F:Exercises terminal lifecycle and persistence against the actual WebUI host and native PTYs. | R:code:packages/webui/test/browser/support/native-browser-host.ts | A:- | S:The parent requires the close receipt and process exit separately, and preserves captured shutdown logs in the Playwright trace if the receipt is missing. overlay-coordination.spec.mjs[SE4M]: F:Tests Escape dismissal order for stacked overlays. | R:- | A:- | S:- plugin-catalogue-layout.spec.mjs[SE4L]: F:Tests category layout in plugin marketplace and management views. | R:- | A:- | S:- plugin-mcp-status.spec.mjs[SE4M]: F:Tests failed MCP connection status and its displayed reason. | R:- | A:- | S:- @@ -5738,7 +5738,7 @@ accessibility-review.json[SE4T]: F:Records browser accessibility review evidence accessibility.d.mts[SE4T]: F:Declares types for browser accessibility test helpers. | R:- | A:- | S:- accessibility.mjs[SE4M]: F:Implements browser accessibility checks and loads their exceptions. | R:- | A:- | S:- composer-mascot-opaque.webm.asset.json[SE4T]: F:Describes the opaque composer mascot video test asset. | R:- | A:- | S:- -native-browser-host.ts[SE4S]: F:Runs the real WebUI service and native PTYs for browser acceptance. | R:- | A:- | S:Enables runtime shutdown phase markers and reports the current service owner if teardown times out. +native-browser-host.ts[XQ4S]: F:Runs the actual loopback WebUI service and native PTYs for browser acceptance. | R:code:packages/webui/src/server/service.ts,code:packages/webui/src/runtime/terminal.ts | A:- | S:Close tracing distinguishes waiting on a service owner from waiting for real PTY exit events, which must be observed before acknowledging successful teardown. native-design-browser-host.ts[SE4M]: F:Provides a native WebUI host for testing Design, including the synthetic provider that receives the media upload. | R:- | A:- | S:The synthetic provider reads the multipart upload body itself: the platform multipart parser differs across platforms and leaves the provider waiting. rendering-integrity.json[SE4L]: F:Stores the recorded browser rendering integrity expectations for each surface, state and theme. | R:- | A:- | S:It is re-recorded with RECORD_RENDERING_INTEGRITY=1 when the surfaces move, and every value is compared against what the run measures. rendering-integrity.mjs[SE4M]: F:Loads and checks browser rendering integrity requirements. | R:- | A:- | S:- @@ -5868,4 +5868,4 @@ windows-contract.test.mjs[SE4S]: F:Tests Windows-specific distribution and runti validate-plugin.mjs[SE4L]: F:Validates plugin packages against their manifest and schema contracts. | R:- | A:- | S:- ===//packages/local-runtime-v2/src/infra/=== -shutdown-diagnostics.ts[SE4T]: F:Writes opt-in runtime shutdown phase markers to stderr. | R:- | A:traceRuntimeShutdownPhase | S:Enabled only by MCODE_RUNTIME_SHUTDOWN_DIAGNOSTICS=1. Callers supply static phase names. +shutdown-diagnostics.ts[RO4T]: F:Writes opt-in shutdown phase markers with process uptime to the parent stderr stream. | R:code:packages/local-runtime-v2/src/runtime.ts | A:traceRuntimeShutdownPhase | S:Enabled only by MCODE_RUNTIME_SHUTDOWN_DIAGNOSTICS=1. Synchronous writes make markers observable before native blocking; broken diagnostic pipes cannot alter shutdown. diff --git a/packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts b/packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts index 2ddad4cf..117a0c00 100644 --- a/packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts +++ b/packages/local-runtime-v2/src/infra/shutdown-diagnostics.ts @@ -1,5 +1,13 @@ +import { writeSync } from "node:fs"; + /** Phase markers for a host whose shutdown deadline expires before it returns. */ export function traceRuntimeShutdownPhase(phase: string): void { if (process.env.MCODE_RUNTIME_SHUTDOWN_DIAGNOSTICS !== "1") return; - process.stderr.write(`[runtime-shutdown] ${phase}\n`); + // The next native call may block this process before an asynchronous write + // flushes to the parent. Diagnostics must not change the shutdown outcome. + try { + writeSync(2, `[runtime-shutdown] ${phase} (uptime ${process.uptime().toFixed(3)}s)\n`); + } catch { + // The parent may already have closed the diagnostics pipe. + } } diff --git a/packages/local-runtime-v2/src/runtime.ts b/packages/local-runtime-v2/src/runtime.ts index e1d99160..b3951e60 100644 --- a/packages/local-runtime-v2/src/runtime.ts +++ b/packages/local-runtime-v2/src/runtime.ts @@ -990,7 +990,9 @@ async function closeRuntime({ try { traceRuntimeShutdownPhase("close_database"); database?.close(); + traceRuntimeShutdownPhase("close_database_returned"); } catch (error) { + traceRuntimeShutdownPhase("close_database_threw"); firstError ??= error; } if (firstError !== undefined) throw firstError; diff --git a/packages/webui/test/browser/native-runtime.spec.mjs b/packages/webui/test/browser/native-runtime.spec.mjs index fe703600..640654f8 100644 --- a/packages/webui/test/browser/native-runtime.spec.mjs +++ b/packages/webui/test/browser/native-runtime.spec.mjs @@ -61,7 +61,7 @@ async function within(promise, ms, makeError) { } } -test.afterAll(async () => { +test.afterAll(async ({}, testInfo) => { if (!child || child.exitCode !== null || !child.connected) return; const stopped = once(child, "message"); child.send("close"); @@ -75,7 +75,12 @@ test.afterAll(async () => { stopped, 25_000, () => new Error(`the native host did not finish closing\n${logs}`), - ); + ).catch(async (error) => { + // The child may be blocked in a native call and unable to send its + // receipt. Preserve the received trace in the parent before rethrowing. + await testInfo.attach("native-host-shutdown", { body: logs, contentType: "text/plain" }); + throw error; + }); // The host reports the step it stopped at when its own shutdown does not // finish, so a stall says which step it was instead of leaving the hook // with a bare timeout and no way to tell what is stuck. diff --git a/packages/webui/test/browser/support/native-browser-host.ts b/packages/webui/test/browser/support/native-browser-host.ts index 5d8624fb..96463080 100644 --- a/packages/webui/test/browser/support/native-browser-host.ts +++ b/packages/webui/test/browser/support/native-browser-host.ts @@ -44,9 +44,12 @@ if (!sessionId) throw new Error("Native acceptance session was not created"); type NativePtyModule = ReturnType[0]>>; const native: NativePtyModule = loadWebuiPty(); const exits: Promise[] = []; +let exited = 0; const terminal = new WebuiTerminalManager(() => ({ spawn: (shell, args, options) => { const pty = native.spawn(shell, args, options); - exits.push(new Promise((resolve) => { pty.onExit(resolve); })); + exits.push(new Promise((resolve) => { + pty.onExit(() => { exited++; resolve(); }); + })); return pty; } })); const operations = new Map(createOperationRegistry(port, terminal)); @@ -80,7 +83,9 @@ async function close() { // Each step says where it is before it runs: a shutdown that does not // finish is otherwise a silence, and the suite cannot tell which step // stopped answering. - const step = (name: string) => { process.stderr.write(`[native-host] ${name}\n`); }; + const step = (name: string) => { + process.stderr.write(`[native-host] ${name} (uptime ${process.uptime().toFixed(3)}s)\n`); + }; // The report leaves with the process, so the exit is taken in the send // callback: the message has to be flushed first. const report = (message: Record) => { @@ -110,12 +115,13 @@ async function close() { // that is the first thing the close does — so the host reports where it // stopped and goes, instead of leaving the suite to time out blind. step(`service.close did not finish (at ${owner})`); - report({ closed: false, terminals: 0, exited: exits.length, stalledAt: owner }); + report({ closed: false, terminals: 0, exited, stalledAt: owner }); return; } if (outcome !== "closed") throw outcome; - step("terminals exited"); + step(`wait terminal exit events (${exited}/${exits.length} observed)`); await Promise.all(exits); + step(`terminal exit events received (${exited}/${exits.length})`); step("apiHost.close"); await assembled.host.apiHost.close(); step("terminals checked"); @@ -132,7 +138,7 @@ async function close() { // under load that was enough for the suite's shutdown hook to miss its // deadline. The callback runs once the message has been flushed, so the // report is not lost by exiting here. - report({ closed: true, terminals: 0, exited: exits.length }); + report({ closed: true, terminals: 0, exited }); })(); return closing; } From daa7fb875f4dd218807671f48fd8532188628103 Mon Sep 17 00:00:00 2001 From: Jiaxiaoyuan Date: Sat, 21 Nov 2026 02:57:48 +0800 Subject: [PATCH 5/5] Retain sanitized native shutdown evidence on Windows CI --- .github/workflows/webui-ci.yml | 1 + .../test/browser/native-runtime.spec.mjs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/webui-ci.yml b/.github/workflows/webui-ci.yml index 551d7621..0d0d026b 100644 --- a/.github/workflows/webui-ci.yml +++ b/.github/workflows/webui-ci.yml @@ -141,6 +141,7 @@ jobs: env: WEBUI_BROWSER_OUTPUT_DIR: ${{ runner.temp }}/webui-browser-diagnostics/browser WEBUI_BROWSER_SHARD: ${{ matrix.lane.shard }} + WEBUI_NATIVE_SHUTDOWN_EVIDENCE: ${{ runner.os == 'Windows' && '1' || '0' }} run: pnpm test:webui-browser --shard="$WEBUI_BROWSER_SHARD" - name: Verify WebUI package installation if: matrix.lane.name == 'package' diff --git a/packages/webui/test/browser/native-runtime.spec.mjs b/packages/webui/test/browser/native-runtime.spec.mjs index 640654f8..a4199147 100644 --- a/packages/webui/test/browser/native-runtime.spec.mjs +++ b/packages/webui/test/browser/native-runtime.spec.mjs @@ -106,6 +106,26 @@ test.afterAll(async ({}, testInfo) => { 2_000, () => new Error(`the native host did not exit\n${logs}`), ); + if (process.env.WEBUI_NATIVE_SHUTDOWN_EVIDENCE === "1") { + // Passing tests do not retain Playwright traces. Print only the bounded + // phase timeline, never the full runtime output, to the CI log. + const phase = /^(\[runtime-shutdown\]|\[native-host\]) (.{1,80}) \(uptime \d{1,7}\.\d{3}s\)$/; + const runtime = /^(?:stop_v1_producers|stop_background|close_services|close_sandbox|close_background|await_background_maintenance|release_runtime_owner|close_v1_host|close_database(?:_returned|_threw)?|closed)$/; + const host = /^(?:service\.close|apiHost\.close|terminals checked|data dir removed|reported)$/; + const owner = /^owner (?:terminal|websocket-connections|websocket|browser-bridge|miniapp-proxies|http-listener|harness)$/; + const exits = /^(?:wait terminal exit events \(\d{1,3}\/\d{1,3} observed\)|terminal exit events received \(\d{1,3}\/\d{1,3}\))$/; + const timeline = logs.split(/\r?\n/).filter((line) => { + const match = phase.exec(line); + if (!match) return false; + return match[1] === "[runtime-shutdown]" + ? runtime.test(match[2]) + : host.test(match[2]) || owner.test(match[2]) || exits.test(match[2]); + }).slice(-64); + console.log(`[native-host-success] ${JSON.stringify({ + receipt: { closed: true, terminals: 0, exited: message.exited }, + timeline, + })}`); + } }); async function rpc(page, operation, body = operation === "listTerminals" ? {} : undefined) {