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(images): claim the features cua-spacesd 0.8.0 reports on every image (#5823)

ddupont9fd979a24a6e
diff --git a/libs/cua-spacesd/crates/cua-spacesd-server/tests/image_claims.rs b/libs/cua-spacesd/crates/cua-spacesd-server/tests/image_claims.rs
new file mode 100644
index 0000000000..54869d173a
--- /dev/null
+++ b/libs/cua-spacesd/crates/cua-spacesd-server/tests/image_claims.rs
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: FSL-1.1-MIT
+// Copyright (c) 2026 Cua AI, Inc.
+
+//! Every Space image lists each feature this server reports on its OS.
+//!
+//! `cua-spacesd doctor --strict` turns a supported feature that the image's
+//! claims leave out (`capabilities.unclaimed`) into a failed release gate.
+//! A new feature therefore has to be claimed (required, optional or not
+//! applicable) by every image at once, not only by the Linux one.
+
+use std::path::{Path, PathBuf};
+
+use cua_spacesd_client::manifest::Manifest;
+use cua_spacesd_server::{filesystem::runas, privilege, process, server, services};
+
+fn repo_root() -> PathBuf {
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../..")
+}
+
+fn strings(v: &serde_json::Value, key: &str) -> Vec<String> {
+ v.get(key)
+ .and_then(|l| l.as_array())
+ .map(|l| {
+ l.iter()
+ .filter_map(|s| s.as_str().map(str::to_owned))
+ .collect()
+ })
+ .unwrap_or_default()
+}
+
+/// The feature claims of an image definition: `claims` in `image.json`,
+/// the top level in the hand-written VM manifests.
+fn claims(rel: &str) -> Manifest {
+ let path = repo_root().join(rel);
+ let text =
+ std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("read {}: {e}", path.display()));
+ let doc: serde_json::Value =
+ serde_json::from_str(&text).unwrap_or_else(|e| panic!("parse {rel}: {e}"));
+ let claims = doc.get("claims").unwrap_or(&doc);
+ Manifest {
+ features_required: strings(claims, "features_required"),
+ features_optional: strings(claims, "features_optional"),
+ features_not_applicable: strings(claims, "features_not_applicable"),
+ ..Manifest::default()
+ }
+}
+
+/// Reported (supported) on every OS, whatever the guest has installed.
+fn everywhere() -> Vec<&'static str> {
+ vec![
+ "fs_watch",
+ "tunnel.forward",
+ "hotspot",
+ runas::MULTIPART_FEATURE,
+ process::EXEC_LEDGER_FEATURE,
+ server::RELAY_ATTACH_FEATURE,
+ services::teleport::WIPE_FEATURE,
+ ]
+}
+
+/// Also reported on Linux and macOS guests.
+fn unix() -> Vec<&'static str> {
+ let mut v = everywhere();
+ v.extend([
+ runas::RUN_AS_FEATURE,
+ runas::XATTR_FEATURE,
+ privilege::PROCESS_RUN_AS_FEATURE,
+ services::volume::FEATURE,
+ services::volume::BINDS_FEATURE,
+ ]);
+ v
+}
+
+#[test]
+fn every_image_claims_the_features_spacesd_reports() {
+ let images = [
+ ("libs/images/linux/image.json", unix()),
+ ("libs/images/omarchy/image.json", unix()),
+ ("libs/images/bench/osworld/image.json", unix()),
+ ("libs/images/bench/web/image.json", unix()),
+ ("libs/images/macos/image.json", unix()),
+ ("scripts/images/manifests/windows-2022.json", everywhere()),
+ ];
+ let mut missing = Vec::new();
+ for (rel, features) in images {
+ let m = claims(rel);
+ for f in features {
+ if !m.lists(f) {
+ missing.push(format!("{rel}: {f}"));
+ }
+ }
+ }
+ assert!(
+ missing.is_empty(),
+ "unclaimed features fail `doctor --strict` (capabilities.unclaimed); \
+ add them to features_required, features_optional or \
+ features_not_applicable:\n {}",
+ missing.join("\n ")
+ );
+}
diff --git a/libs/images/bench/osworld/image.json b/libs/images/bench/osworld/image.json
index 1f0ebbbda3..9e22fd54bf 100644
--- a/libs/images/bench/osworld/image.json
+++ b/libs/images/bench/osworld/image.json
@@ -94,10 +94,16 @@
"audio.uplink",
"audio.opus",
"audio.per_app",
- "teleport.*"
+ "teleport.*",
+ "files.multipart",
+ "fs.run_as",
+ "fs.xattr",
+ "process.exec_ledger",
+ "process.run_as"
],
"features_not_applicable": [
- "volume.mount"
+ "volume.mount",
+ "volume.binds"
],
"codecs_required": [],
"auth_modes": [
diff --git a/libs/images/bench/web/image.json b/libs/images/bench/web/image.json
index 5b25ba86c3..04b2360e20 100644
--- a/libs/images/bench/web/image.json
+++ b/libs/images/bench/web/image.json
@@ -201,10 +201,16 @@
"audio.per_app",
"clipboard.files",
"clipboard.image",
- "teleport.*"
+ "teleport.*",
+ "files.multipart",
+ "fs.run_as",
+ "fs.xattr",
+ "process.exec_ledger",
+ "process.run_as"
],
"features_not_applicable": [
- "volume.mount"
+ "volume.mount",
+ "volume.binds"
],
"feature_attributes": {
"presence.cursor_shape": {
diff --git a/libs/images/macos/image.json b/libs/images/macos/image.json
index 08761339cf..f2699fd14d 100644
--- a/libs/images/macos/image.json
+++ b/libs/images/macos/image.json
@@ -68,7 +68,13 @@
"h264_hw",
"audio.desktop",
"audio.opus",
- "teleport.*"
+ "teleport.*",
+ "files.multipart",
+ "fs.run_as",
+ "fs.xattr",
+ "process.exec_ledger",
+ "process.run_as",
+ "volume.binds"
],
"feature_attributes": {
"volume.mount": {
diff --git a/scripts/images/manifests/windows-2022.json b/scripts/images/manifests/windows-2022.json
index d649ce7dc6..acc7ac72ee 100644
--- a/scripts/images/manifests/windows-2022.json
+++ b/scripts/images/manifests/windows-2022.json
@@ -39,7 +39,9 @@
"teleport.*",
"audio.desktop",
"audio.opus",
- "volume.mount"
+ "volume.mount",
+ "files.multipart",
+ "process.exec_ledger"
],
"feature_attributes": {
"presence.cursor_shape": {