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
test(cua-driver): require a modern Tk in the Lume seed (#4604)
Francesco Bonaccic7e684b414f3
diff --git a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py b/libs/cua-driver/scripts/tests/test_macos_lume_runner.pyindex e2b6f88c31..dcc65b962a 100644--- a/libs/cua-driver/scripts/tests/test_macos_lume_runner.py+++ b/libs/cua-driver/scripts/tests/test_macos_lume_runner.py@@ -266,6 +266,49 @@ def test_seed_guide_keeps_the_login_keychain_searchable() -> None:assert '"$HOME/Library/Keychains/login.keychain-db"' in text+def _fake_python_with_tk(tmp_path: Path, patchlevel: str | None) -> Path:+ fake_bin = tmp_path / "bin"+ real = shutil.which("python3")+ if patchlevel is None:+ body = 'case "$*" in *tkinter*) exit 1 ;; esac\nexec "$TEST_REAL_PYTHON" "$@"\n'+ else:+ body = (+ f'case "$*" in *tkinter*) echo {patchlevel}; exit 0 ;; esac\n'+ 'exec "$TEST_REAL_PYTHON" "$@"\n'+ )+ _write_executable(fake_bin / "python3", body)+ assert real is not None+ return fake_bin+++ ("patchlevel", "message"),+ [(None, "no usable tkinter"), ("8.5.9", "uses Tk 8.5.9")],+)+def test_lume_runner_refuses_missing_or_legacy_tk(+ tmp_path: Path, patchlevel: str | None, message: str+) -> None:+ fake_bin = _fake_python_with_tk(tmp_path, patchlevel)+ completed = _run(+ RUN_ALL,+ 'PATH="$TEST_FAKE_BIN:$PATH"\nrequire_modern_tk\n',+ env={"TEST_FAKE_BIN": str(fake_bin), "TEST_REAL_PYTHON": shutil.which("python3") or ""},+ )+ assert completed.returncode == 2+ assert message in completed.stderr++[email protected]("patchlevel", ["8.6.16", "9.1.0"])+def test_lume_runner_accepts_modern_tk(tmp_path: Path, patchlevel: str) -> None:+ fake_bin = _fake_python_with_tk(tmp_path, patchlevel)+ completed = _run(+ RUN_ALL,+ 'PATH="$TEST_FAKE_BIN:$PATH"\nrequire_modern_tk\n',+ env={"TEST_FAKE_BIN": str(fake_bin), "TEST_REAL_PYTHON": shutil.which("python3") or ""},+ )+ assert completed.returncode == 0, completed.stderr++@pytest.mark.parametrize("script", [RUN_ALL, RUN_RUST_E2E], ids=lambda path: path.name)def test_no_permission_mode_check_pipes_into_grep(script: Path) -> None:text = script.read_text(encoding="utf-8")diff --git a/libs/cua-driver/tests/runners/macos-lume/README.md b/libs/cua-driver/tests/runners/macos-lume/README.mdindex 5c47c17ca9..a3c8608fb9 100644--- a/libs/cua-driver/tests/runners/macos-lume/README.md+++ b/libs/cua-driver/tests/runners/macos-lume/README.md@@ -113,7 +113,7 @@ printf '%s %s\n' "$HOMEBREW_INSTALL_SHA256" "$HOMEBREW_INSTALLER" \/bin/bash "$HOMEBREW_INSTALLER"eval "$(/opt/homebrew/bin/brew shellenv)"-brew install node ffmpeg jq rust+brew install node ffmpeg jq rust python-tkprintf '\n%s\n' 'eval "$(/opt/homebrew/bin/brew shellenv)"' \>> "$HOME/.zprofile"@@ -133,8 +133,14 @@ npm --versionffmpeg -version | head -1ffprobe -version | head -1jq --version+python3 -c 'import tkinter; print(tkinter.Tcl().eval("info patchlevel"))'```+`python3` must resolve to Homebrew's Python with Tk 8.6 or later. Apple's+Command Line Tools Python ships Tk 8.5.9, which renders the Tk canvas fixture+too poorly for its OCR row to read the labels. The runner refuses an older or+missing Tk instead of skipping the Tk rows.+Keep autologin, sleep prevention, and screen-lock prevention enabled. Add onlythe maintainer host's public SSH key to `~/.ssh/authorized_keys`; never copy aprivate key or registry credential into the guest.diff --git a/libs/cua-driver/tests/runners/macos-lume/run-all.sh b/libs/cua-driver/tests/runners/macos-lume/run-all.shindex a8b7645f09..293c90fa08 100755--- a/libs/cua-driver/tests/runners/macos-lume/run-all.sh+++ b/libs/cua-driver/tests/runners/macos-lume/run-all.sh@@ -197,6 +197,26 @@ require_golden_image_dependencies() {done}+# The Tk pointer and perception rows skip when python3 has no tkinter, and+# Apple's Tk 8.5.9 renders the canvas fixture too poorly for OCR. The canonical+# lane must run them, so require a modern Tk instead of a shrunken matrix.+require_modern_tk() {+ local version+ if ! version="$(python3 -c 'import tkinter; print(tkinter.Tcl().eval("info patchlevel"))' 2>/dev/null)"; then+ echo "python3 has no usable tkinter; install Homebrew python-tk so the Tk rows run" >&2+ return 2+ fi+ if ! python3 - "${version}" <<'PY'+import sys+major, minor = (int(part) for part in sys.argv[1].split(".")[:2])+raise SystemExit(0 if (major, minor) >= (8, 6) else 1)+PY+ then+ echo "python3 uses Tk ${version}; install Homebrew python-tk (Tk 8.6 or later) and put it first on PATH" >&2+ return 2+ fi+}+run_bounded_command() {command -v python3 >/dev/null 2>&1 || {echo "Missing golden-image dependency: python3" >&2@@ -947,6 +967,7 @@ if [[ "${SIP_STATUS}" != *"System Integrity Protection status: disabled."* ]]; tfirequire_golden_image_dependencies || exit $?+require_modern_tk || exit $?if [[ ! -f "${SIGNING_KEYCHAIN}" ]]; thenecho "Missing golden-image signing keychain: ${SIGNING_KEYCHAIN}" >&2