The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(ops_install): handle missing skill directory during uninstall
Steven Enamakel4b41aa62dd73
diff --git a/crates/openhuman-core/src/skills/ops_install/uninstall.rs b/crates/openhuman-core/src/skills/ops_install/uninstall.rsindex 80f7c59fc4..d4239a9b4f 100644--- a/crates/openhuman-core/src/skills/ops_install/uninstall.rs+++ b/crates/openhuman-core/src/skills/ops_install/uninstall.rs@@ -4,7 +4,7 @@ use std::path::Path;use serde::{Deserialize, Serialize};-use super::super::ops_types::{WorkflowScope, MAX_NAME_LEN, SKILL_MD, WORKFLOW_MD};+use super::super::ops_types::WorkflowScope;/// Input for [`uninstall_workflow`]. Mirrors the `skills.uninstall` JSON-RPC payload.#[derive(Debug, Clone, Deserialize)]@@ -28,8 +28,9 @@ pub struct UninstallWorkflowOutcome {/// Remove an installed user-scope SKILL.md skill from `~/.openhuman/skills/`.///-/// Only user-scope uninstalls are supported. Resolution is defensive:-/// canonicalises paths, refuses symlinks, requires SKILL.md to be present.+/// Only user-scope uninstalls are supported. Resolution is defensive+/// (`tinyskills::remove_bundle`): canonicalises paths, refuses symlinks,+/// requires a workflow document to be present.////// `home_dir_override` is for tests; production callers pass `None`.pub fn uninstall_workflow(@@ -37,24 +38,6 @@ pub fn uninstall_workflow(home_dir_override: Option<&Path>,) -> Result<UninstallWorkflowOutcome, String> {let trimmed = params.name.trim().to_string();- if trimmed.is_empty() {- return Err("skill name is required".to_string());- }- if trimmed.contains('/') || trimmed.contains('\\') || trimmed.contains("..") {- log::warn!(- "[skills] uninstall_workflow: rejected name with path separators name={:?}",- trimmed- );- return Err(format!(- "skill name '{trimmed}' must not contain path separators"- ));- }- if trimmed.len() > MAX_NAME_LEN {- return Err(format!(- "skill name is {} chars (max {MAX_NAME_LEN})",- trimmed.len()- ));- }let home = match home_dir_override.map(|p| p.to_path_buf())@@ -66,103 +49,30 @@ pub fn uninstall_workflow(// Workflows created post-rename live under `~/.openhuman/workflows/`; older// ones under `~/.openhuman/skills/` or the legacy `~/.agents/skills/` root.- // Resolve whichever root actually holds this id so delete works regardless- // of when/where it was authored — and matches every user root+ // The first root holding this id wins, matching every user root// discover_workflows_inner surfaces (else a listed workflow can't be- // uninstalled).+ // uninstalled). Slug validation and the symlink/containment/bundle checks+ // are owned by `tinyskills::remove_bundle`.let openhuman_dir = home.join(".openhuman");- let root = [+ let roots = [openhuman_dir.join("workflows"),openhuman_dir.join("skills"),home.join(".agents").join("skills"),- ]- .into_iter()- .find(|r| r.join(&trimmed).exists());- let root = match root {- Some(r) => r,- None => return Err(format!("workflow '{trimmed}' is not installed")),- };-- let root_meta = std::fs::symlink_metadata(&root)- .map_err(|e| format!("stat {} failed: {e}", root.display()))?;- if root_meta.file_type().is_symlink() {- log::warn!(- "[workflows] uninstall_workflow: refused symlinked root path={}",- root.display()- );- return Err(format!(- "workflows root {} is a symlink — refusing to resolve",- root.display()- ));- }-- let canonical_root = std::fs::canonicalize(&root)- .map_err(|e| format!("canonicalize {} failed: {e}", root.display()))?;-- let candidate = root.join(&trimmed);- match std::fs::symlink_metadata(&candidate) {- Ok(m) if m.file_type().is_symlink() => {- log::warn!(- "[skills] uninstall_workflow: refused symlinked alias name={trimmed} path={}",- candidate.display()- );- return Err(format!(- "skill '{trimmed}' is a symlinked alias — refusing to resolve"- ));- }- Ok(_) => {}- Err(e) if e.kind() == std::io::ErrorKind::NotFound => {- return Err(format!("skill '{trimmed}' is not installed"));- }- Err(e) => {- return Err(format!("stat {} failed: {e}", candidate.display()));- }- }-- let canonical_candidate = std::fs::canonicalize(&candidate).map_err(|e| {- if e.kind() == std::io::ErrorKind::NotFound {- format!("skill '{trimmed}' is not installed")- } else {- format!("canonicalize {} failed: {e}", candidate.display())+ ];++ let removed = tinyskills::remove_bundle(&roots, &trimmed).map_err(|e| {+ log::warn!("[skills] uninstall_workflow: refused name={trimmed:?} error={e}");+ match e {+ tinyskills::RemoveError::NotInstalled(slug) => {+ format!("workflow '{slug}' is not installed")+ }+ other => other.to_string(),}})?;-- if !canonical_candidate.starts_with(&canonical_root) {- log::warn!(- "[skills] uninstall_workflow: path escape rejected candidate={} root={}",- canonical_candidate.display(),- canonical_root.display()- );- return Err(format!(- "refused to remove {} — path escapes skills root",- canonical_candidate.display()- ));- }-- let meta = std::fs::symlink_metadata(&canonical_candidate)- .map_err(|e| format!("stat {} failed: {e}", canonical_candidate.display()))?;- if meta.file_type().is_symlink() || !meta.is_dir() {- return Err(format!(- "{} is not a directory — refusing to remove",- canonical_candidate.display()- ));- }-- if !canonical_candidate.join(WORKFLOW_MD).exists()- && !canonical_candidate.join(SKILL_MD).exists()- {- return Err(format!(- "{} does not look like a workflow (missing {WORKFLOW_MD})",- canonical_candidate.display()- ));- }-log::info!(- "[skills] uninstall_workflow: removing name={trimmed} path={}",- canonical_candidate.display()+ "[skills] uninstall_workflow: removed name={trimmed} path={}",+ removed.display());- std::fs::remove_dir_all(&canonical_candidate)- .map_err(|e| format!("remove {} failed: {e}", canonical_candidate.display()))?;// Notify live agent sessions to drop the removed skill from their// `## Installed Skills` catalogue (see `OpenHumanSessionHost::refresh_workflows`).@@ -173,7 +83,7 @@ pub fn uninstall_workflow(Ok(UninstallWorkflowOutcome {name: trimmed,- removed_path: canonical_candidate.display().to_string(),+ removed_path: removed.display().to_string(),scope: WorkflowScope::User,})}diff --git a/vendor/tinyskills b/vendor/tinyskillsindex bdfa5c067b..5e3903b943 160000--- a/vendor/tinyskills+++ b/vendor/tinyskills@@ -1 +1 @@-Subproject commit bdfa5c067b12f84c24d9338983082ff0a21c87ab+Subproject commit 5e3903b9435090cc0367b83c89c3283b32e203f9