Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8bee8b2
fix(webui): repair baseline gates and cross-platform runtime tests
Fectivnfy112357 Nov 9, 2026
fdb18fb
fix(webui): restore dialog dismissal and refresh reviewed browser bas…
Fectivnfy112357 Nov 9, 2026
01dbc45
fix(webui): prepare native macOS PTYs and retain independent CI diagn…
Fectivnfy112357 Nov 9, 2026
157f6b8
fix(webui): make Windows checks portable and stabilize browser measur…
Fectivnfy112357 Nov 9, 2026
de6b2f7
fix(webui): complete native browser baselines and deterministic lifec…
Fectivnfy112357 Nov 9, 2026
e25df38
fix(webui): isolate runtime fixtures and stabilize real interaction l…
Fectivnfy112357 Nov 9, 2026
5816142
test(webui): record reviewed motion contract and focus-aware trigger …
Fectivnfy112357 Nov 9, 2026
aeb83e3
fix(webui): preserve horizontal scrolling in contained diff files
Fectivnfy112357 Nov 9, 2026
f6ff399
fix(webui): coalesce live Markdown rendering at paint opportunities
Fectivnfy112357 Nov 9, 2026
ec9f842
test(webui): stabilize layout sampling and pin streaming compositor
Fectivnfy112357 Nov 9, 2026
a2a0f86
test(webui): restore normal browser frame scheduling
Fectivnfy112357 Nov 9, 2026
f4384b9
test(webui): use macOS windowed Chromium and settle layout observations
Fectivnfy112357 Nov 9, 2026
b367f2a
test(webui): reject empty browser frame geometry
Fectivnfy112357 Nov 9, 2026
293fa65
test(webui): distinguish turn requests from background titles
Fectivnfy112357 Nov 9, 2026
16fb1c4
test(webui): calibrate frame pacing against same-page idle samples
Fectivnfy112357 Nov 9, 2026
e0fd5bf
test(webui): isolate pointer performance from locator assertions
Fectivnfy112357 Nov 9, 2026
0a9d868
test(webui): wait for the embedded page before measuring its frame
Fectivnfy112357 Nov 9, 2026
c280802
test(webui): retain raw performance evidence for successful CI runs
Fectivnfy112357 Nov 9, 2026
2ccea71
fix(webui): keep drag width updates out of descendant styles
Fectivnfy112357 Nov 10, 2026
6f8834b
test(webui): compare frame overhead on a consistent clock
Fectivnfy112357 Nov 10, 2026
52c8a2e
test(webui): attribute application blocking separately from runner pa…
Fectivnfy112357 Nov 10, 2026
a2b2ed1
test(webui): gate frame CPU work and retain raw pacing diagnostics
Fectivnfy112357 Nov 10, 2026
1d1ace0
test(webui): attribute synchronous waits without charging scheduler p…
Fectivnfy112357 Nov 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/webui-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
run: |
echo "MCODE_WEBUI_VERIFY_DIR=$RUNNER_TEMP/webui-package-checks" >> "$GITHUB_ENV"
echo "WEBUI_BROWSER_OUTPUT_DIR=$RUNNER_TEMP/webui-browser-results" >> "$GITHUB_ENV"
if [ "$RUNNER_OS" = "macOS" ]; then
echo "WEBUI_BROWSER_HEADED=1" >> "$GITHUB_ENV"
fi
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
with:
version: 9.12.0
Expand All @@ -52,22 +55,26 @@ jobs:
- name: Check WebUI feedback
run: pnpm check:webui-feedback
- name: Build WebUI
id: build
run: pnpm build:webui
- name: Check WebUI build boundaries
run: pnpm check:webui-boundary
- name: Install Chromium
id: browsers
run: pnpm install:webui-browsers
- name: Install Chromium system dependencies
if: runner.os == 'Linux'
run: pnpm exec playwright install-deps chromium
- name: Test WebUI units and integrations
run: pnpm test:webui
- name: Test WebUI browser interactions
if: ${{ !cancelled() && steps.build.outcome == 'success' && steps.browsers.outcome == 'success' }}
run: pnpm test:webui-browser
- name: Verify WebUI package installation
if: ${{ !cancelled() && steps.build.outcome == 'success' }}
run: pnpm test:webui-package
- name: Upload WebUI browser diagnostics
if: ${{ failure() }}
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: webui-browser-${{ matrix.os }}-${{ github.run_attempt }}
Expand Down
36 changes: 31 additions & 5 deletions docs/webui-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,38 @@ repository-wide `pnpm verify` pipeline or publish packages.
| npm package build, installation and launcher verification | Yes | Yes | Yes |

Package verification uses an isolated installation and does not publish to npm.
Browser failure diagnostics are retained as Actions artifacts for seven days.
Only installation of Linux system dependencies is platform-gated. CI does not
skip the browser or package suites on macOS or Windows. This coverage declaration
Browser diagnostics and raw performance samples are retained as Actions artifacts
for seven days on successful and failed runs. Samples are written to the output
directory explicitly so the list reporter cannot discard in-memory attachments.
After a successful build and Chromium installation, browser checks still run if
unit tests fail. Package verification also runs after a successful build even if
an earlier test suite failed. Each failure still makes the job fail; this keeps
independent failures visible in one run instead of masking later suites.
Linux additionally installs Chromium system dependencies. Every platform runs
the browser and package suites. This coverage declaration
does not establish a passing run; platform and visual-baseline failures remain
visible and require diagnosis rather than relaxed assertions.

Hosted macOS sets `WEBUI_BROWSER_HEADED=1` for the browser suite and runs full
Chromium in a window. Native blank-page controls reproduced headless frame-source
stalls without the WebUI; windowed mode improves pacing but does not eliminate
hosted-runner pauses. Streaming frame p95 is compared diagnostically with the same
page's idle samples before and after streaming, recording whether it exceeds idle
p95 plus 50 ms. The frame gate requires main-thread CPU p95 between consecutive
animation callbacks to stay below 50 ms, capturing cumulative work across tasks.
Raw frame gaps, timers and tasks are retained for investigation.
Application execution retains the absolute 50 ms budget: lightweight Chromium tracing
measures main-thread task CPU time, adding browser-recorded Long Animation Frame
script pauses to their owning tasks to reject synchronous JavaScript waits as well.
Raw script and LongTask wall durations
remain diagnostic because they can include hosted-runner descheduling. Missing timing
capabilities or required task/frame CPU samples fail explicitly. Real idle, busy-script,
forced-layout and synchronous-wait controls verify attribution in the browser suite.
Other interaction budgets are unchanged.
Linux, Windows and local runs remain headless by default. To reproduce
the macOS CI browser mode locally, run `WEBUI_BROWSER_HEADED=1 pnpm test:webui-browser`
after building the client and installing Chromium.

## Active and archived workflows

Only `webui-ci.yml` remains in `.github/workflows/`. The following inherited
Expand All @@ -37,8 +63,8 @@ Restoring a legacy YAML file to `.github/workflows/` would restore its triggers;
the workflow-contract test rejects additional active YAML files.
Dependabot can still create dependency-update PRs; those PRs run WebUI CI.

The local `pnpm verify`, its profiles, all existing gate scripts and package
commands are unchanged. Run them locally when broader runtime, CLI, release or
The CI scope does not remove steps from local `pnpm verify` profiles or retire
local package commands. Run them locally when broader runtime, CLI, release or
security validation is needed. A green WebUI CI run does not establish those
broader checks. The previously reported repository-history scan findings are
outside this CI scope and have not been remediated by disabling Release audit.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@typescript-eslint/parser": "7.18.0",
"@typescript/native-preview": "7.0.0-dev.20260707.2",
"axe-core": "4.14.0",
"cross-spawn": "7.0.6",
"esbuild": "0.28.2",
"eslint": "8.57.1",
"eslint-config-airbnb-base": "15.0.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/browser-extension/scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ if (store) {
// store, so the two artifacts cannot be confused for one another.
const archive = join(packageRoot, `dist-${store}.zip`);
await rm(archive, { force: true });
await run("zip", ["-r", "-q", archive, "."], { cwd: outDir });
if (process.platform === "win32") {
if (!process.env.SystemRoot) throw new Error("Windows SystemRoot is required to locate the ZIP archive tool.");
await run(join(process.env.SystemRoot, "System32", "tar.exe"), ["-a", "-c", "-f", archive, "."], { cwd: outDir });
} else {
await run("zip", ["-r", "-q", archive, "."], { cwd: outDir });
}
process.stdout.write(`Packaged the ${store} build as ${archive}\n`);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createHash } from 'node:crypto';
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { lstat, mkdir, readFile, realpath, rm, writeFile } from 'node:fs/promises';
import net from 'node:net';
import path from 'node:path';

Expand Down Expand Up @@ -33,7 +33,7 @@ const SOCKET_FILE = 'owner.sock';
const RECORD_FILE = 'owner.json';
const WINDOWS_PIPE_PREFIX = '\\\\.\\pipe\\mcode-miniapp-owner-';

/** A socket file on POSIX, a named pipe on Windows — named from the plugin id, never from the directory. */
/** A directory-scoped socket on POSIX, a plugin-scoped named pipe on Windows. */
export function resolveMiniAppOwnerEndpoint(
pluginDataDir: string,
pluginId: string,
Expand All @@ -43,7 +43,11 @@ export function resolveMiniAppOwnerEndpoint(
const digest = createHash('sha256').update(pluginId).digest('hex').slice(0, 16);
return `${WINDOWS_PIPE_PREFIX}${digest}`;
}
return path.join(pluginDataDir, SOCKET_FILE);
const endpoint = path.join(pluginDataDir, SOCKET_FILE);
// macOS limits sockaddr_un.sun_path to 104 bytes, including its terminator.
if (Buffer.byteLength(endpoint) < 104) return endpoint;
const digest = createHash('sha256').update(path.resolve(pluginDataDir)).digest('hex').slice(0, 32);
return path.join('/tmp', `mcode-miniapp-owner-${process.getuid!()}`, `${digest}.sock`);
}

/**
Expand All @@ -59,8 +63,17 @@ export async function acquireMiniAppOwner(
): Promise<MiniAppOwnerAcquisition> {
const nowMs = input.nowMs ?? Date.now;
const platform = input.platform ?? process.platform;
const endpoint = resolveMiniAppOwnerEndpoint(input.pluginDataDir, input.pluginId, platform);
if (platform !== 'win32') await mkdir(input.pluginDataDir, { recursive: true });
const dataDir = platform === 'win32' ? input.pluginDataDir : await realpath(input.pluginDataDir);
const endpoint = resolveMiniAppOwnerEndpoint(dataDir, input.pluginId, platform);
if (platform !== 'win32' && path.dirname(endpoint) !== dataDir) {
const socketDirectory = path.dirname(endpoint);
await mkdir(socketDirectory, { recursive: true, mode: 0o700 });
const metadata = await lstat(socketDirectory);
if (!metadata.isDirectory() || metadata.uid !== process.getuid!() || (metadata.mode & 0o077) !== 0) {
throw new Error(`Mini App owner socket directory is not private: ${socketDirectory}`);
}
}

for (let attempt = 0; attempt < 2; attempt += 1) {
const server = net.createServer((socket) => socket.destroy());
Expand Down
15 changes: 14 additions & 1 deletion packages/local-runtime-v2/test/unit/miniapp/owner-lease.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mkdtemp, rm } from 'node:fs/promises';
import { mkdtemp, rm, symlink } from 'node:fs/promises';
import net from 'node:net';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
Expand Down Expand Up @@ -39,6 +39,19 @@ async function acquire(dir: string, client = 'webui'): Promise<MiniAppOwnerAcqui
}

describe('Mini App ownership', () => {
it.skipIf(process.platform === 'win32')('holds long data paths without truncating or sharing their sockets', async () => {
const root = await pluginDataDir();
const first = join(root, 'a'.repeat(120));
const second = join(root, 'b'.repeat(120));
expect(Buffer.byteLength(resolveMiniAppOwnerEndpoint(first, 'fixture.miniapp'))).toBeLessThan(104);
expect((await acquire(first, 'desktop')).kind).toBe('acquired');
expect(await acquire(first)).toMatchObject({ kind: 'held', owner: { client: 'desktop' } });
const alias = join(root, 'alias');
await symlink(first, alias);
expect(await acquire(alias)).toMatchObject({ kind: 'held', owner: { client: 'desktop' } });
expect((await acquire(second)).kind).toBe('acquired');
});

it('acquires an unowned Mini App and can take it again after releasing', async () => {
const dir = await pluginDataDir();

Expand Down
1 change: 1 addition & 0 deletions packages/webui/docs/architecture/module-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ host management, the projects rooted on a host and the remote terminal.
| `runtime/auth-session.ts`, `runtime/auth-context.ts` | The one OAuth core with its lease and refresh timer, and the per-request auth context. |
| `runtime/account-login.ts`, `runtime/check-in.ts`, `runtime/usage-quota.ts`, `runtime/usage-quota-projection.ts`, `runtime/reset-card-projection.ts`, `runtime/signing.ts` | Account login, daily check-in, the account-billing client (the quota, the credit fallback and the reset cards) and its two pure projections, request signing. |
| `runtime/terminal.ts` | The terminal process manager. One per WebUI service, not a host-wide singleton. |
| `runtime/native-pty.ts` | Shared native PTY loading for local and SSH terminals. Restores the macOS spawn-helper execute bits missing from node-pty 1.1.0 prebuilds; a missing helper or failed permission change remains an explicit error. |
| `runtime/remote-control/` | The phone pairing link: the vendored bridge, the pairing client and its credential source, the owner, the command router and the global-event source. See [`runtime/remote-control.md`](../runtime/remote-control.md). |
| `runtime/mcode-tools.ts`, `runtime/mcode-tools-environment.ts`, `runtime/mcode-tools-entry.ts` | The mcode-tools broker, the child-process environment projection and the embedded entry loader. |
| `runtime/workspace-archive.ts` + `runtime/workspace-archive/` | Archive listing and extraction: `zip-adapter.ts` and `tar-adapter.ts` over `archive-policy.ts`, `archive-listing.ts`, `archive-filesystem.ts`, `archive-types.ts`. |
Expand Down
83 changes: 73 additions & 10 deletions packages/webui/docs/verification/browser-suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ and runs in the browser gate, after the client build and Chromium installation.
Live and completed turn visibility is asserted from controlled stream frames while the indicator
remains unmodified.

Live assistant Markdown coalesces arriving chunks at the next animation frame, retaining the latest
complete source without restarting a pending frame. Static content, replacements and completion
render immediately. The streaming responsiveness cases keep the existing 50 ms jank and long-task
budgets; a separate continuous-stream case verifies visible progress before completion and retains
the final chunk when `[DONE]` arrives in the same task. These are built-client fixture checks, not
measurements of a live model provider.

The composer spec selects `/compact` from the slash palette, adds an instruction, and asserts the
`runCommand` request body at the fixture transport. This checks built-client behavior only; a
production command-runner journey is not currently covered by `agent-transcript.test.ts` or another
Expand Down Expand Up @@ -136,7 +143,7 @@ The shell case asserts that built
image assets finish loading successfully. The tests also assert relevant DOM state and viewport
geometry; screenshots are not the sole oracle. These are deterministic fixture renders with
synthetic session content, not user workspace or account data. Review image diffs on the pinned
Linux Chromium revision before accepting baseline changes.
Chromium revision on the recorded platform before accepting baseline changes.

`pnpm test:webui-browser` uses the already installed Playwright Chromium directly. It does not
download a browser or install system packages. On a new machine, run `pnpm install:webui-browsers`
Expand All @@ -154,15 +161,71 @@ pnpm build:webui
pnpm test:webui-browser
```

The screenshots are comparable across machines, because the gate does not read the host's fonts.
The font files under `packages/webui/test/browser/fonts/` are committed to this repository, and
`scripts/lib/webui-font-environment.mjs` writes a fontconfig that exposes only those files. The
browser is launched with `FONTCONFIG_FILE` pointing at it, so every name in the client's font
stack resolves to a committed face. The fontconfig also selects grayscale antialiasing, because
LCD subpixel rendering colours the glyph edges and that fringe depends on the display's subpixel
layout and on the host's fontconfig version. A machine with no CJK font installed and a machine
with a full set of them therefore render the same bytes: the recorded baseline is a property of
this repository, not of the runner.
The font files under `packages/webui/test/browser/fonts/` are committed to this repository.
The fixture server exposes those files as web fonts under the client's first sans and monospace
family names, and `openApp` waits for both faces and the initial layout observation before a test
measures geometry. This also pins macOS and Windows, whose font engines do not use fontconfig.
On Linux, `scripts/lib/webui-font-environment.mjs` additionally sets `FONTCONFIG_FILE` to expose
only the committed files and selects grayscale antialiasing. Native rasterization can still differ,
so screenshot baselines are platform-specific; review actual native captures before adding them.

Chromium uses its normal frame scheduling and graphics path. Live Markdown coalescing
is measured at the browser's paint opportunities rather than an artificially unbounded frame rate.
Application work retains an absolute 50 ms budget. Frame pacing diagnostics compare active
p95 with the larger same-page idle p95 before/after streaming plus 50 ms. The comparison and
whether it exceeds that budget are saved in `frame-budget-comparison.json`; raw wall-clock
frame intervals do not decide application acceptance. The frame gate uses CPU timestamps on
consecutive animation-callback trace markers: main-thread CPU p95 per frame must stay below
50 ms. This includes cumulative work across small tasks without charging the application for
time descheduled by the runner. Raw maximum gaps, 50/100 ms outlier counts,
timer delays and every frame/long-task sample remain recorded in `stream-performance-raw.json`.
Raw task wall durations remain diagnostic. Lightweight CDP tracing (`toplevel,blink.user_timing`)
records root tasks intersecting measurement markers on the page's main thread; any task with
at least 50 ms of thread CPU time fails. Long Animation Frame `pauseDuration` is mapped
to the owning root task by the measurement marker's page/trace clock offset. Task CPU plus
its recorded synchronous pauses also fails at 50 ms, retaining coverage of JavaScript
blocking that uses little CPU. Script wall duration remains diagnostic because it also
includes time descheduled by the runner. Missing pause attribution or clock mapping fails.
This distinguishes actual execution from time descheduled by the runner without exempting
expensive layout or painting. Missing markers, CPU timings or observer support fail explicitly.
Tasks shorter than 50 ms without a CPU field use their wall duration as a conservative upper
bound; at least one real CPU sample is required, and an over-budget wall task with missing CPU
timing fails. The JSON evidence retains both task wall/CPU timings and script attribution.
Real browser controls require an idle page to pass, 80 ms busy-script/forced-layout work to fail,
and a synchronous request delayed by 120 ms to fail even when it uses little CPU.
An empty sample set fails. Both conversation sizes and rendered-content assertions remain intact.
Idle and active loops sample callback arrival with the same `performance.now()` clock. The active
window includes two paint opportunities after the final text reaches the DOM.
The plugin scroll case waits for populated rows and the hover action's layout stability before
recording its pre-wheel pinned geometry.

Hosted macOS CI sets `WEBUI_BROWSER_HEADED=1` and selects full Chromium in a window;
Linux, Windows and local runs stay headless by default. Blank-page controls on native macOS
reproduced long headless frame intervals without any client work. On the same image and browser
build, windowed mode improved frame pacing, but repeated runs still exposed isolated scheduler
pauses. Windowed mode therefore complements the idle calibration rather than proving stability
on its own. Use the same environment flag locally to reproduce
the macOS CI mode; no frame-rate override or software-compositing override is used.

Related launcher boxes are read in one DOM snapshot, and hover-dependent styles are polled for
their exact final values. The long-line diff case scrolls the contained viewport into view and
waits for real overflow before checking actual horizontal scrolling; DOM text alone is insufficient.

Performance cases disable tracing during measurement and capture screenshots only on failure:
Chromium CPU profiles showed Playwright's injected snapshot walker inside the drag measurement,
and trace screenshots also occupy the renderer/compositor. The drag still runs through real pointer
input, waits two frames after pointer release, and retains the 50 ms long-task budget. Locator-based
geometry assertions run after the observer stops, so their injected queries are not charged to the
application. Raw task durations are attached as `workspace-drag-long-tasks.json`.
The review must paint its initial layout before the toolbar measurement begins. The panel's
`--webui-workspace-width` is a non-inherited registered property: it controls the panel's own
overlap margin, and inheriting each pointer sample into thousands of diff descendants caused
unnecessary style recalculation. The browser regression checks both actual panel resizing and
the child's independent default value.
Disclosure cases capture all coupled CSS transitions,
inspect their interpolated midpoint and
finish it before checking the final geometry, instead of racing a fixed delay against driver latency.
Tests that deliberately freeze the browser clock advance it explicitly for the initial layout frames.

That also removes the trap the previous arrangement carried. The gate used to depend on the CJK
fonts that `playwright install --with-deps chromium` pulled in, so the installed set changed with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function PluginItemDialog({
: "配置 MiniMax Code 如何连接到该项"}
onClose={onClose}
dismissOnEscape
dismissOnBackdrop
width="standard"
portalTarget={portalTarget}
>
Expand Down
Loading
Loading