Add trusted cmux-tui startup benchmarks

Closed
LA
3mo ago
+23678-7

Adds the event-driven cmux-tui startup benchmark harness and hosted macOS, Linux, and Windows workflow.

Trust boundary:

  • automatic runs use base-owned pull_request_target and reject fork heads
  • manual runs require the current default-branch SHA as the baseline
  • the base owns toolchain parsing, harness tests, measurement, profiles, and evidence verification
  • the candidate supplies only declared build inputs and the measured product binary

Coverage includes cold first render, warm attach, headless readiness, restored state, and incompatible state. Each scenario uses 10 warmup pairs and 50 measured pairs with exact identities, lifecycle evidence, raw distributions, and native profile attempts.

Static checks: actionlint, Rust 1.95 rustfmt, verifier AST parse, and git diff --check. No local compile was run.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


[!NOTE]
High Risk
Large CI surface area with sudo/containment accounts, untrusted candidate binary import, and native Windows bootstrap on the launch path—failures or bypasses could affect runner hygiene or measurement integrity, though scope is benchmark/CI-only.

Overview
Introduces a manual, cross-platform startup benchmark that compares exact baseline and candidate commits on macOS, Linux, and Windows, with a split trust model: the candidate is built in an isolated job and imported via a signed manifest, while the trusted workflow SHA owns harness builds, measurement, verification, and evidence hashing.

CI and tooling: Adds cmux-tui-startup-benchmark.yml (workflow_dispatch with SHA validation, Zig/Rust per checkout, sandbox preflight, paired runs, optional native profiles, integrity before/after records, artifact upload). Extends setup-cmux-tui-rust with optional toolchain-file and python-command. cmux-tui.yml now installs bubblewrap on Linux, runs startup supervisor/preflight containment on macOS/Linux, adds a Windows-gnu containment job (MSVC bootstrap + restricted-token preflight + harness tests), and gates hosted verification on Windows containment success.

Product support: New cmux-startup-bootstrap crate and a large native Windows bootstrap (windows_bootstrap.c) for validated config consumption, job containment, timing page mapping, and staged control-channel events. Workspace adds memmap2 to cmux-tui and documents startup performance in the README.

Reviewed by Cursor Bugbot for commit c91d53ade086b22b5d701a44bad8ff99789d7a8f. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Adds a trusted, event-driven startup benchmark for cmux-tui on macOS, Linux, and Windows with a native Windows bootstrap, precise timing, and reliable hang capture. Adds a Windows AppContainer feasibility gate and hardens containment by setting staged probe ACLs at creation.

  • New Features

    • Added startup_benchmark example that emits paired stats, lifecycle evidence, and optional native profiles.
    • Introduced a manual cross-OS workflow: isolated candidate build → signed import → trusted harness run → cmux-tui/scripts/verify-startup-benchmark.py → artifact upload; Windows containment uses portable zig; setup-cmux-tui-rust now supports toolchain-file and python-command.
    • Added cmux-startup-bootstrap with a native Windows bootstrap to validate inputs, enforce restricted job/token, isolate on a private desktop, map a timing page with SHA256 checks, and record bootstrap evidence.
  • Bug Fixes

    • Stabilized CI containment: installed bubblewrap, aligned preflight/supervisor handshakes, and boxed warm server state.
    • Windows: separated security startup deadline from bootstrap and improved deadline evidence; accepted API-set imports; fixed supervisor socket teardown and platform checks; ensured restricted-token hangs produce diagnostics.
    • AppContainer gate: fixed compilation and handle/token proof ownership, switched to a supported launch path, preserved early broker failures, relayed broker failures to verification, switched the broker protocol to pipes, identified target hash failures, and enabled broker traversal before config validation.
    • Hardened probe permissions: set staged probe ACL at creation for correct ownership and race-free access.

Summary by CodeRabbit

  • New Features

    • Added cross-platform startup benchmarking for macOS, Linux, and Windows.
    • Added cold, warm, headless, restored, and incompatible startup scenarios.
    • Added paired baseline and candidate comparisons with statistical summaries.
    • Added JSON, Markdown, lifecycle, metadata, and profiling artifacts.
    • Added evidence validation and reliability safeguards.
    • Added configurable Python commands and toolchain files for benchmark automation.
  • Documentation

    • Added a startup performance guide covering methodology, artifacts, and profiling.