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-sdk): a skill installed another way no longer leaves an agent "not set up" (#6282)

ddupont9cad89e24d4f
diff --git a/libs/cua/crates/cua-agent-setup/src/lib.rs b/libs/cua/crates/cua-agent-setup/src/lib.rs
index 9d6739250d..ea0d7f1d4a 100644
--- a/libs/cua/crates/cua-agent-setup/src/lib.rs
+++ b/libs/cua/crates/cua-agent-setup/src/lib.rs
@@ -764,9 +764,21 @@ impl AgentSetup {
.chain(a.also_reads.iter().map(|l| l.resolve(&self.env)))
.collect();
for s in bundled {
- if let Some(h) = dirs.iter().find_map(|d| fsutil::hash_dir(&d.join(&s.name))) {
+ let found = dirs.iter().find_map(|d| {
+ let p = d.join(&s.name);
+ fsutil::hash_dir(&p).map(|h| (p, h))
+ });
+ if let Some((p, h)) = found {
skills_installed.push(s.name.clone());
- if h != s.hash {
+ // Outdated only when cua wrote this copy and nobody has
+ // touched it since: that is the copy `update` refreshes.
+ // A copy the user installed another way (a newer
+ // cua-driver skill from its own installer) or edited is
+ // theirs, and setup skips it without `--force`, so it
+ // can never become current and must not hold the agent
+ // in "not set up".
+ let owned = state.skills.get(&p).is_some_and(|r| r.hash == h);
+ if h != s.hash && owned {
skills_outdated.push(s.name.clone());
}
}
diff --git a/libs/cua/crates/cua-agent-setup/tests/agents.rs b/libs/cua/crates/cua-agent-setup/tests/agents.rs
index 4f7e5cdf65..de1979761b 100644
--- a/libs/cua/crates/cua-agent-setup/tests/agents.rs
+++ b/libs/cua/crates/cua-agent-setup/tests/agents.rs
@@ -790,6 +790,26 @@ fn update_refreshes_outdated_copies_cua_wrote() {
);
}
+#[test]
+fn a_skill_the_user_installed_another_way_is_not_outdated() {
+ let t = T::new();
+ let s = t.setup();
+ s.install_skills(&ids(&["cline"]), &ids(&["cua-sandboxes"]), false)
+ .unwrap();
+ let dest = t.home.join(".cline/skills/cua-sandboxes");
+ // Another installer replaced it with different content that cua never
+ // wrote: setup skips it without --force, so it can never match the
+ // bundled copy and must not keep the agent in "not set up".
+ std::fs::write(
+ dest.join("SKILL.md"),
+ "---\nname: cua-sandboxes\ndescription: newer from its own installer\n---\n",
+ )
+ .unwrap();
+ let st = s.detect().into_iter().find(|a| a.id == "cline").unwrap();
+ assert_eq!(st.skills_installed, ["cua-sandboxes"]);
+ assert!(st.skills_outdated.is_empty(), "{st:?}");
+}
+
#[cfg(unix)]
#[test]
fn claude_code_is_configured_through_its_own_cli_when_present() {