Skip to content

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

test(session): assert load_skill is scoped rather than shared

Steven Enamakel6e85cd9f0b28
diff --git a/src/openhuman/agent/harness/session/builder/builder_tests_part_01_tests.rs b/src/openhuman/agent/harness/session/builder/builder_tests_part_01_tests.rs
index 5b2ba9c40e..6eabaa28c8 100644
--- a/src/openhuman/agent/harness/session/builder/builder_tests_part_01_tests.rs
+++ b/src/openhuman/agent/harness/session/builder/builder_tests_part_01_tests.rs
@@ -724,6 +724,8 @@ fn from_config_keeps_build_time_delegation_tools_out_of_the_durable_registry() {
/// `fleet` agent. Pointer identity is the property that keeps it at one copy,
/// so assert it directly rather than asserting equal contents (which the old
/// deep-cloning shape also satisfied).
+///
+/// One spec is exempt by design — see the `load_skill` branch below.
#[test]
fn the_three_spec_views_share_their_leaf_schemas() {
crate::openhuman::agent::harness::AgentDefinitionRegistry::init_global_builtins().unwrap();
@@ -759,16 +761,44 @@ fn the_three_spec_views_share_their_leaf_schemas() {
!visible.is_empty(),
"the orchestrator advertises tools, so the visible view is non-empty"
);
+ // `load_skill` is the one deliberate exception, and it is deliberate in the
+ // other direction: `visible_tool_specs_for_policy` rewrites its pack index
+ // and `skill` enum down to the packs THIS session can actually call, so the
+ // visible entry must NOT be the durable one — `durable_tool_specs` stays the
+ // unscoped truth, and sharing the leaf would scope it for every view that
+ // holds it. `use_skill` is filtered wholesale, never rewritten, so it shares
+ // like everything else.
+ //
+ // Asserted rather than merely excluded: a future change that made the
+ // rewrite mutate in place would silently scope the durable set, and a
+ // change that deep-copied everything again would still pass an
+ // exclusion-only test.
+ let load_skill = crate::openhuman::tools::toolpacks::LOAD_SKILL;
+ let mut saw_scoped_load_skill = false;
+
for spec in visible.iter() {
let shared = all
.iter()
.any(|candidate| std::sync::Arc::ptr_eq(candidate, spec));
+ if spec.name == load_skill {
+ assert!(
+ !shared,
+ "`{load_skill}` must be scoped into its own allocation — sharing the leaf would rewrite the durable set's copy too"
+ );
+ saw_scoped_load_skill = true;
+ continue;
+ }
assert!(
shared,
"visible spec `{}` must point at the full view's allocation, not a deep copy",
spec.name
);
}
+
+ assert!(
+ saw_scoped_load_skill,
+ "the orchestrator advertises `{load_skill}`, so the scoped-copy exception above must actually have been exercised rather than vacuously skipped"
+ );
}
/// Failure path: a duplicate name must not smuggle a *different* allocation