Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore: files changed src/openhuman/skills/ops_create.rs,src/openhuman/skills/ops_discover.rs

Steven Enamakel30296eb4658c
diff --git a/src/openhuman/skills/ops_create.rs b/src/openhuman/skills/ops_create.rs
index 05ab5bc52b..f720903230 100644
--- a/src/openhuman/skills/ops_create.rs
+++ b/src/openhuman/skills/ops_create.rs
@@ -152,7 +152,10 @@ fn legacy_workflow_dir(
// Profile-local skills are placed by hand under
// `<workspace>/personalities/<id>/skills/`, never scaffolded through
// the create path; treat them like Legacy here (no create target).
- WorkflowScope::Legacy | WorkflowScope::Profile => return None,
+ // Builtin bundles come from a `const` table compiled into the
+ // binary; a create RPC that could write one would make that table
+ // remotely extensible, which is the whole thing it exists to prevent.
+ WorkflowScope::Builtin | WorkflowScope::Legacy | WorkflowScope::Profile => return None,
};
for root in roots {
let canonical_root = match std::fs::canonicalize(&root) {
@@ -217,7 +220,7 @@ pub(crate) fn create_workflow_inner(
}
workspace_dir.join(".openhuman").join("workflows")
}
- WorkflowScope::Legacy | WorkflowScope::Profile => {
+ WorkflowScope::Builtin | WorkflowScope::Legacy | WorkflowScope::Profile => {
return Err(
"cannot create skill in legacy or profile scope; choose 'user' or 'project'"
.to_string(),
diff --git a/src/openhuman/skills/ops_discover.rs b/src/openhuman/skills/ops_discover.rs
index 8bc4b6940b..2a17723dfa 100644
--- a/src/openhuman/skills/ops_discover.rs
+++ b/src/openhuman/skills/ops_discover.rs
@@ -218,6 +218,24 @@ fn discover_filtered(
// a name wins, so we scan user first, then project, then legacy.
let mut by_name: HashMap<String, Workflow> = HashMap::new();
+ // Builtin skills (`<workspace>/.openhuman/builtin-skills/`) are a skill
+ // root scanned FIRST and at the lowest precedence, so every other scope
+ // shadows them on a name collision. No trust marker is consulted: the
+ // directory is core-managed and its contents were written from constants
+ // compiled into this binary, which is a stronger provenance claim than the
+ // marker makes about a project directory. See `skills::bundled`.
+ if let Some(ws) = workspace_dir {
+ if kinds.contains(&RootKind::Skill) {
+ let root = crate::openhuman::skills::bundled::builtin_root(ws);
+ tracing::trace!(
+ root = %root.display(),
+ scope = ?WorkflowScope::Builtin,
+ "[workflows] discover:branch:builtin"
+ );
+ absorb(&mut by_name, scan_root(&root, WorkflowScope::Builtin));
+ }
+ }
+
if let Some(home) = home_dir {
for (root, kind) in user_roots(home) {
if kinds.contains(&kind) {
@@ -387,11 +405,16 @@ fn absorb(by_name: &mut HashMap<String, Workflow>, incoming: Vec<Workflow>) {
fn precedence(scope: WorkflowScope) -> u8 {
match scope {
- WorkflowScope::Legacy => 0,
- WorkflowScope::User => 1,
- WorkflowScope::Project => 2,
+ // Builtin sits below everything, including Legacy: a bundle that ships
+ // with the binary must never shadow something the user installed or
+ // wrote. Adding a builtin skill is then a change that cannot take a
+ // name away from an existing workspace.
+ WorkflowScope::Builtin => 0,
+ WorkflowScope::Legacy => 1,
+ WorkflowScope::User => 2,
+ WorkflowScope::Project => 3,
// Profile-local skills win against every global scope for their owner.
- WorkflowScope::Profile => 3,
+ WorkflowScope::Profile => 4,
}
}