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-spaces): the relay-turned-off mesh test no longer waits out the reconnect spread, and CI runs cua-spaces unit tests (#6795)

cua-agents[bot]6c52391390d7
diff --git a/.github/workflows/ci-cua-sdk.yml b/.github/workflows/ci-cua-sdk.yml
index f47ff07ce6..0b2682fc77 100644
--- a/.github/workflows/ci-cua-sdk.yml
+++ b/.github/workflows/ci-cua-sdk.yml
@@ -314,6 +314,7 @@ jobs:
# asserts wall-clock budgets.
run: |
cargo test --locked -p cua-mesh --lib --test mesh -- --test-threads=4
+ cargo test --locked -p cua-spaces --lib -- --test-threads=4
cargo test --locked -p cua-mesh --test scale -- --test-threads=1 --nocapture
- name: Test the Space list at scale and under chaos (budgets)
if: matrix.shard == 1
@@ -464,6 +465,7 @@ jobs:
# asserts wall-clock budgets.
run: |
cargo test --locked -p cua-mesh --lib --test mesh -- --test-threads=4
+ cargo test --locked -p cua-spaces --lib -- --test-threads=4
cargo test --locked -p cua-mesh --test scale -- --test-threads=1 --nocapture
- name: Test the Space list at scale and under chaos (budgets)
# 20 computers x 10 Spaces with computers off, slow, lossy, hung or
diff --git a/libs/cua/crates/cua-mesh/src/dialer.rs b/libs/cua/crates/cua-mesh/src/dialer.rs
index 649cde3f72..ce427c5716 100644
--- a/libs/cua/crates/cua-mesh/src/dialer.rs
+++ b/libs/cua/crates/cua-mesh/src/dialer.rs
@@ -85,6 +85,13 @@ impl Dialer {
) -> Result<Self> {
let mut cfg = MeshConfig::new(relay.to_owned(), NodeKind::Client, identity, auth);
cfg.media_udp_port = media_udp_port;
+ Self::start_with_config(cfg, timeout).await
+ }
+
+ /// [`Dialer::start`] with a prepared node config (tests only, to
+ /// speed up reconnects).
+ #[doc(hidden)]
+ pub async fn start_with_config(cfg: MeshConfig, timeout: Duration) -> Result<Self> {
let mesh = Mesh::start(cfg).await?;
if let Err(e) = mesh.wait_ready(timeout).await {
mesh.shutdown();
diff --git a/libs/cua/crates/cua-spaces/src/mesh.rs b/libs/cua/crates/cua-spaces/src/mesh.rs
index 364fe669f0..ef4b0032c1 100644
--- a/libs/cua/crates/cua-spaces/src/mesh.rs
+++ b/libs/cua/crates/cua-spaces/src/mesh.rs
@@ -836,14 +836,19 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn a_space_on_a_mesh_the_relay_turned_off_reconnects() {
let coord = cua_mesh::testing::FakeCoordinator::start(cua_mesh::Mode::Account).await;
- let dialer = Dialer::start(
- &coord.url,
- cua_mesh::static_auth(Vec::new()),
+ // After the relay closes the session the node waits a random
+ // backoff plus up to 10 s of spread before it asks again; the
+ // test only cares what the node learns then, not how long it waits.
+ let mut cfg = cua_mesh::MeshConfig::new(
+ coord.url.clone(),
+ cua_mesh::NodeKind::Client,
None,
- Duration::from_secs(10),
- )
- .await
- .unwrap();
+ cua_mesh::static_auth(Vec::new()),
+ );
+ cfg.reconnect_speedup = 1000;
+ let dialer = Dialer::start_with_config(cfg, Duration::from_secs(10))
+ .await
+ .unwrap();
let clients = MeshClients::default();
let key = Key::Account(coord.url.clone());
clients.nodes.lock().await.insert(