Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): pass CUA_DRIVER_RS_ENABLE_WAYLAND through to embedded hosts (#4877)

Francesco Bonacci07cbc6cd45ab
diff --git a/libs/cua-driver/rust/THIRD_PARTY_NOTICES.md b/libs/cua-driver/rust/THIRD_PARTY_NOTICES.md
index 729023e17a..3037706305 100644
--- a/libs/cua-driver/rust/THIRD_PARTY_NOTICES.md
+++ b/libs/cua-driver/rust/THIRD_PARTY_NOTICES.md
@@ -18,6 +18,7 @@ the items listed.
| [yabai](https://github.com/koekeishiya/yabai) | Copyright (c) 2019 Åsmund Vikane | `crates/platform-macos/src/input/skylight.rs` (`activate_without_raise`) | The focus-without-raise SkyLight event-record sequence |
| [QuickJS-ng](https://github.com/quickjs-ng/quickjs) | Copyright (c) 2017-2026 Fabrice Bellard; (c) 2017-2024 Charlie Gordon; (c) 2023-2026 Ben Noordhuis; (c) 2023-2026 Saúl Ibarra Corretgé | `crates/cua-driver-core/src/script_tool/` (compiled in through rquickjs-sys) | The JavaScript engine behind the experimental `run_script` tool |
| [rquickjs](https://github.com/DelSkayn/rquickjs) | Copyright (c) 2020 Mees Delzenne; (c) 2025 Rquickjs Contributors | `crates/cua-driver-core/src/script_tool/` | Rust bindings to QuickJS-ng |
+| [T3 Code](https://github.com/pingdotgg/t3code) | Copyright (c) 2026 T3 Tools Inc. | `crates/cua-driver-sdk/src/embedded.rs` (`allowed_environment_name` and its test) | Linux fixes ported from T3 Code's patch to Cua Driver 0.34.0 ([pingdotgg/t3code#16975](https://github.com/pingdotgg/t3code/pull/16975), `patches/cua-driver-linux/0.34.0.patch`): the `CUA_DRIVER_RS_ENABLE_WAYLAND` embedded-host pass-through |
## MIT License
diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs
index 1883e39bc0..d5996109e2 100644
--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs
@@ -860,6 +860,7 @@ pub(crate) fn allowed_environment_name(name: &str) -> bool {
| "PROGRAMDATA"
| "DISPLAY"
| "WAYLAND_DISPLAY"
+ | "CUA_DRIVER_RS_ENABLE_WAYLAND"
| "XDG_RUNTIME_DIR"
| "XDG_SESSION_TYPE"
| "DBUS_SESSION_BUS_ADDRESS"
@@ -1306,6 +1307,41 @@ mod tests {
.any(|variable| variable.value == "forged-lock"));
}
+ #[test]
+ fn wayland_backend_opt_in_reaches_embedded_driver() {
+ let name = "CUA_DRIVER_RS_ENABLE_WAYLAND";
+ assert!(allowed_environment_name(name));
+ let inherited = [(name.to_owned(), "1".to_owned())];
+ let values = merge_safe_environment(inherited.clone(), &[]);
+ assert!(values
+ .iter()
+ .any(|variable| variable.name == name && variable.value == "1"));
+
+ // Hosts can opt in without changing their own process environment.
+ let enabled = EmbeddedEnvironmentVariable {
+ name: name.into(),
+ value: "1".into(),
+ };
+ let values = merge_safe_environment(std::iter::empty(), &[enabled]);
+ assert!(values
+ .iter()
+ .any(|variable| variable.name == name && variable.value == "1"));
+
+ // An explicit opt-out still wins over the inherited opt-in.
+ let disabled = EmbeddedEnvironmentVariable {
+ name: name.into(),
+ value: "0".into(),
+ };
+ let values = merge_safe_environment(inherited, &[disabled]);
+ assert!(values
+ .iter()
+ .any(|variable| variable.name == name && variable.value == "0"));
+ assert!(!allowed_environment_name("LD_PRELOAD"));
+ assert!(!allowed_environment_name(
+ "CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS"
+ ));
+ }
+
#[test]
fn interactive_linux_session_environment_is_inherited() {
let values = merge_safe_environment(