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): avoid accessibility advertise on Cinnamon (#2784)

injaneityb3ba12126188
diff --git a/docs/content/docs/reference/cua-driver/limits.mdx b/docs/content/docs/reference/cua-driver/limits.mdx
index 9ddde7bdf4..45d4d9bc28 100644
--- a/docs/content/docs/reference/cua-driver/limits.mdx
+++ b/docs/content/docs/reference/cua-driver/limits.mdx
@@ -273,6 +273,20 @@ place of `list_windows` there. Windows and Linux report `screenshot_width` and
---
+## Cinnamon disables accessibility advertisement
+
+On Cinnamon (`Cinnamon` or `X-Cinnamon`), Cua Driver leaves the session
+accessibility flags unchanged. Setting `ScreenReaderEnabled=true` launches
+Orca, while setting only `IsEnabled=true` can make the Cinnamon and GNOME
+settings schemas repeatedly overwrite each other.
+
+Applications that rely on Cua Driver to enable their accessibility bridge may
+therefore return a degraded or empty AT-SPI tree. Screenshots and available CDP
+browser routes continue to work. Do not set `CUA_DRIVER_RS_A11Y_ADVERTISE_MODE`
+to `all` or `is_enabled_only` in a normal Cinnamon session.
+
+---
+
## Permission boundaries
Cua Driver is constrained by the macOS permission model. Two relevant grants:
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs b/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
index 9ebcb7b9f4..fcdd28b575 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/a11y.rs
@@ -15,9 +15,12 @@
//! A real screen reader turns the Chromium signal on. Doing that ourselves is
//! unsafe on GNOME and COSMIC: their session services treat the signal as a user
//! request and launch Orca. Those desktops therefore get only the generic
-//! `IsEnabled` signal by default. Other desktops retain the Chromium signal for
-//! compatibility, and a caller can choose either policy explicitly with
-//! `CUA_DRIVER_RS_A11Y_ADVERTISE_MODE`.
+//! `IsEnabled` signal by default. Cinnamon cannot safely receive even that
+//! reduced signal: its settings daemon derives toolkit accessibility from the
+//! screen-reader setting and can enter a high-frequency settings write loop when
+//! they disagree. Cinnamon therefore receives no advertisement by default.
+//! Other desktops retain the Chromium signal for compatibility, and a caller
+//! can choose either policy explicitly with `CUA_DRIVER_RS_A11Y_ADVERTISE_MODE`.
//!
//! Everything here is best-effort. A session without an accessibility bus (some
//! headless or minimal setups) just yields an error we log and ignore; enabling
@@ -153,13 +156,22 @@ fn advertise_mode_from(
}
fn desktop_default_mode(desktop: Option<&str>) -> AdvertiseMode {
- let launches_screen_reader = desktop.is_some_and(|desktop| {
- desktop
- .split([':', ';'])
- .map(str::trim)
- .any(|part| part.eq_ignore_ascii_case("gnome") || part.eq_ignore_ascii_case("cosmic"))
- });
- if launches_screen_reader {
+ let has_desktop = |candidate: &str| {
+ desktop.is_some_and(|desktop| {
+ desktop
+ .split([':', ';'])
+ .map(str::trim)
+ .any(|part| part.eq_ignore_ascii_case(candidate))
+ })
+ };
+
+ // Cinnamon mirrors its GNOME and Cinnamon accessibility schemas and
+ // recomputes toolkit accessibility from the assistive-technology toggles.
+ // Advertising only IsEnabled can therefore livelock the settings daemons,
+ // while advertising ScreenReaderEnabled launches Orca. Fail closed.
+ if has_desktop("cinnamon") || has_desktop("x-cinnamon") {
+ AdvertiseMode::None
+ } else if has_desktop("gnome") || has_desktop("cosmic") {
AdvertiseMode::IsEnabledOnly
} else {
AdvertiseMode::All
@@ -196,6 +208,25 @@ mod tests {
);
}
+ #[test]
+ fn cinnamon_default_leaves_accessibility_status_untouched() {
+ for desktop in ["Cinnamon", "X-Cinnamon", "LinuxMint:X-Cinnamon"] {
+ assert_eq!(
+ advertise_mode_from(false, None, Some(desktop)),
+ AdvertiseMode::None,
+ "desktop={desktop}"
+ );
+ }
+ }
+
+ #[test]
+ fn cinnamon_safety_wins_in_composite_desktop_names() {
+ assert_eq!(
+ advertise_mode_from(false, None, Some("GNOME:X-Cinnamon")),
+ AdvertiseMode::None
+ );
+ }
+
#[test]
fn non_gnome_default_preserves_chromium_compatibility() {
assert_eq!(