Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
ci(cua-driver): add lightweight desktop readiness checks
Francesco Bonacci17c5444375ca
diff --git a/.github/workflows/ci-cua-driver-preflight.yml b/.github/workflows/ci-cua-driver-preflight.ymlnew file mode 100644index 0000000000..c3e3ce158f--- /dev/null+++ b/.github/workflows/ci-cua-driver-preflight.yml@@ -0,0 +1,50 @@+name: "CI: Cua Driver desktop readiness (non-certifying)"++on:+ pull_request:+ paths:+ - "scripts/ci/linux/preflight-rust-e2e.sh"+ - "scripts/ci/windows/preflight-rust-e2e.ps1"+ - "scripts/ci/windows/verify-user-session.ps1"+ - ".github/workflows/ci-cua-driver-preflight.yml"+ workflow_dispatch:++permissions:+ contents: read++jobs:+ linux:+ name: "Linux / lightweight desktop readiness"+ runs-on: ubuntu-latest+ timeout-minutes: 10+ env:+ CUA_E2E_SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}+ steps:+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ ref: ${{ env.CUA_E2E_SOURCE_SHA }}+ - name: Prepare a disposable X11 session+ run: |+ sudo apt-get update+ sudo apt-get install -y --no-install-recommends xvfb xauth x11-utils dbus-x11 libglib2.0-bin ffmpeg jq+ - name: Check syntax and host readiness+ run: |+ bash -n scripts/ci/linux/preflight-rust-e2e.sh+ xvfb-run -a dbus-run-session -- scripts/ci/linux/preflight-rust-e2e.sh++ windows:+ name: "Windows / lightweight desktop readiness"+ runs-on: windows-latest+ timeout-minutes: 15+ env:+ CUA_E2E_SOURCE_SHA: ${{ github.event.pull_request.head.sha || github.sha }}+ steps:+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ with:+ ref: ${{ env.CUA_E2E_SOURCE_SHA }}+ - name: Ensure recording tools are available+ shell: pwsh+ run: .\scripts\ci\windows\setup-ffmpeg.ps1+ - name: Check host readiness+ shell: pwsh+ run: .\scripts\ci\windows\preflight-rust-e2e.ps1diff --git a/scripts/ci/README.md b/scripts/ci/README.mdindex 991b0479ec..4dd916c048 100644--- a/scripts/ci/README.md+++ b/scripts/ci/README.md@@ -118,6 +118,10 @@ a certification artifact. Its goal is a warm-cache run under 10 minutes;check the workflow's measured duration rather than treating the timeout as aperformance guarantee.+`CI: Cua Driver desktop readiness (non-certifying)` runs the lightweight+Linux and Windows checks in temporary GUI sessions when the preflight scripts+change. It does not invoke the strict preflight or any behavior matrix.+For a local focused iteration, run the matching commands from the repositoryroot (a first compilation may be much slower than a warm run):@@ -130,6 +134,31 @@ cargo test --locked -p cua-perception --test protocolcargo test --locked -p cua-driver-core --lib```+Before spending time on a desktop matrix, run the lightweight host readiness+check in the same logged-in desktop session that will run the test:++```bash+# Linux, from the repository root+scripts/ci/linux/preflight-rust-e2e.sh+```++```powershell+# Windows, from the repository root+.\scripts\ci\windows\preflight-rust-e2e.ps1+```++These commands report the architecture, display or input desktop, session bus+where applicable, recording tools, checkout SHA, and an already-built driver+version (not its source identity). They do not build fixtures, request+permissions, start the Driver, or write or clear E2E artifacts. A missing+binary or optional browser does not fail the lightweight check. The commands+cannot establish AX/UIA, capture, permission, video, fixture, or browser behavior.+The canonical runner's strict environment preflight still proves those before+any behavioral rows.+If `CUA_E2E_SOURCE_SHA` is set, the lightweight check fails when it differs+from the checked-out SHA. For a hosted Linux X11 lane, enter its `xvfb-run` and+`dbus-run-session` environment before running this check.+For desktop behavior, use a diagnostic lane only to narrow a failure. Thecomplete Linux, Windows, and macOS runs at the stable exact candidate SHAremain the certification gate described below and in the test harnesses guide.diff --git a/scripts/ci/linux/preflight-rust-e2e.sh b/scripts/ci/linux/preflight-rust-e2e.shnew file mode 100755index 0000000000..3321548ef4--- /dev/null+++ b/scripts/ci/linux/preflight-rust-e2e.sh@@ -0,0 +1,99 @@+#!/usr/bin/env bash+# Read-only readiness checks before starting the Linux desktop matrix.+set -euo pipefail++SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+REPO_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"+DRIVER_BIN="${CUA_TEST_DRIVER_BIN:-${REPO_ROOT}/libs/cua-driver/rust/target/release/cua-driver}"+FAILURES=0++pass() { printf '[ready] %s\n' "$1"; }+warn() { printf '[optional] %s\n' "$1"; }+fail() { printf '[missing] %s\n' "$1" >&2; FAILURES=$((FAILURES + 1)); }++if [[ "$(uname -s)" != Linux ]]; then+ fail 'Linux host required'+else+ pass "Linux architecture: $(uname -m)"+fi++if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then+ display_socket="${WAYLAND_DISPLAY}"+ if [[ "${display_socket}" != /* ]]; then+ display_socket="${XDG_RUNTIME_DIR:-/nonexistent}/${display_socket}"+ fi+ if [[ -S "${display_socket}" ]]; then+ pass "Wayland display socket: ${display_socket}"+ else+ fail "Wayland display socket unavailable: ${display_socket}"+ fi+ pass "Session/compositor: ${XDG_SESSION_TYPE:-unknown}/${XDG_CURRENT_DESKTOP:-unknown}; verify compositor-specific identity in the strict matrix preflight"+ if [[ -z "${DISPLAY:-}" ]]; then+ for tool in wf-recorder grim wtype; do+ if command -v "${tool}" >/dev/null 2>&1; then pass "${tool} available"; else fail "${tool} required for native Wayland"; fi+ done+ fi+fi++if [[ -n "${DISPLAY:-}" ]]; then+ if command -v xdpyinfo >/dev/null 2>&1; then+ if xdpyinfo -display "${DISPLAY}" >/dev/null 2>&1; then+ pass "X11 display reachable: ${DISPLAY}"+ else+ fail "X11 display not reachable: ${DISPLAY} (check Xauthority and session)"+ fi+ else+ warn 'xdpyinfo unavailable; X11 reachability is unverified until the strict matrix preflight'+ fi+ if command -v ffmpeg >/dev/null 2>&1; then pass 'ffmpeg available'; else fail 'ffmpeg required for X11 recording'; fi+fi++if [[ -z "${DISPLAY:-}" && -z "${WAYLAND_DISPLAY:-}" ]]; then+ fail 'no DISPLAY or WAYLAND_DISPLAY; enter the desktop session or use xvfb-run with dbus-run-session'+fi++for tool in ffprobe jq; do+ if command -v "${tool}" >/dev/null 2>&1; then pass "${tool} available"; else fail "${tool} required for E2E"; fi+done+if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]]; then+ fail 'no session D-Bus address; enter the desktop user session or use dbus-run-session'+elif command -v gdbus >/dev/null 2>&1; then+ if gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus \+ --method org.freedesktop.DBus.ListNames >/dev/null 2>&1; then+ pass 'session D-Bus reachable'+ else+ fail 'session D-Bus unreachable; enter the desktop user session or use dbus-run-session'+ fi+else+ warn 'gdbus unavailable; session D-Bus address exists but reachability is unverified'+fi++source_sha="$(git -C "${REPO_ROOT}" rev-parse HEAD 2>/dev/null || true)"+if [[ "${source_sha}" =~ ^[0-9a-f]{40}$ ]]; then+ pass "checked-out source SHA: ${source_sha}"+else+ fail 'checked-out source SHA unavailable'+fi+if [[ -n "${CUA_E2E_SOURCE_SHA:-}" && "${CUA_E2E_SOURCE_SHA,,}" != "${source_sha}" ]]; then+ fail 'CUA_E2E_SOURCE_SHA differs from the checkout; sync exact source before testing'+fi+if [[ -x "${DRIVER_BIN}" ]]; then+ if version="$("${DRIVER_BIN}" --version 2>&1)"; then+ pass "driver version: ${version} (${DRIVER_BIN}); source identity not yet verified"+ else+ fail "source driver cannot run --version: ${DRIVER_BIN}"+ fi+else+ warn "source driver not built: ${DRIVER_BIN}"+fi++for browser in google-chrome chromium microsoft-edge; do+ if command -v "${browser}" >/dev/null 2>&1; then warn "browser available: ${browser}"; fi+done+warn 'fixture, AX, capture, permission, and recording checks require the strict matrix preflight'++if ((FAILURES)); then+ printf '%s required preflight check(s) failed\n' "${FAILURES}" >&2+ exit 1+fi+pass 'lightweight environment checks complete (not desktop certification)'diff --git a/scripts/ci/windows/preflight-rust-e2e.ps1 b/scripts/ci/windows/preflight-rust-e2e.ps1new file mode 100644index 0000000000..f93387fc24--- /dev/null+++ b/scripts/ci/windows/preflight-rust-e2e.ps1@@ -0,0 +1,76 @@+# Read-only readiness checks before starting the Windows desktop matrix.+Set-StrictMode -Version Latest+$ErrorActionPreference = "Stop"++$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition+$repoRoot = (Resolve-Path (Join-Path $scriptDir "..\..\..")).Path+$rustRoot = Join-Path $repoRoot "libs\cua-driver\rust"+$driverBin = if ($env:CUA_TEST_DRIVER_BIN) { $env:CUA_TEST_DRIVER_BIN } else {+ Join-Path $rustRoot "target\release\cua-driver.exe"+}+$failures = 0++function Ready([string]$message) { Write-Host "[ready] $message" }+function Optional([string]$message) { Write-Host "[optional] $message" }+function Missing([string]$message) {+ Write-Host "[missing] $message" -ForegroundColor Red+ $script:failures+++}++if (-not [Environment]::Is64BitOperatingSystem) {+ Missing "64-bit Windows host required"+} else {+ Ready "64-bit Windows; process architecture $([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)"+}++try {+ & (Join-Path $scriptDir "verify-user-session.ps1")+ Ready "interactive input desktop"+} catch {+ Missing "interactive input desktop unavailable: $($_.Exception.Message)"+}++foreach ($tool in @("ffmpeg.exe", "ffprobe.exe")) {+ if (Get-Command $tool -ErrorAction SilentlyContinue) {+ Ready "$tool available"+ } else {+ Missing "$tool required for E2E recording"+ }+}++$sourceSha = $null+if (Get-Command git -ErrorAction SilentlyContinue) {+ $sourceSha = (& git -C $repoRoot rev-parse HEAD 2>$null)+}+if ($sourceSha -match '^[0-9a-fA-F]{40}$') {+ Ready "checked-out source SHA: $sourceSha"+} else {+ Missing "checked-out source SHA unavailable"+}+if ($env:CUA_E2E_SOURCE_SHA -and $sourceSha -ine $env:CUA_E2E_SOURCE_SHA) {+ Missing "CUA_E2E_SOURCE_SHA differs from the checkout; sync exact source before testing"+}++if (Test-Path -LiteralPath $driverBin -PathType Leaf) {+ try {+ $version = & $driverBin --version 2>&1+ if ($LASTEXITCODE -eq 0) { Ready "driver version: $version ($driverBin); source identity not yet verified" }+ else { Missing "source driver cannot run --version: $driverBin" }+ } catch {+ Missing "source driver cannot run --version: $driverBin ($($_.Exception.Message))"+ }+} else {+ Optional "source driver not built: $driverBin"+}++foreach ($browser in @("chrome.exe", "msedge.exe")) {+ if (Get-Command $browser -ErrorAction SilentlyContinue) {+ Optional "browser available on PATH: $browser"+ }+}+Optional "fixture, UIA, capture, permission, and recording checks require the strict matrix preflight"++if ($failures -gt 0) {+ throw "$failures required preflight check(s) failed"+}+Ready "lightweight environment checks complete (not desktop certification)"