Skip to content

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

test(session): wrap tool specs in Arc in builder tests\n\nThe builder tests now build their spec vectors from Arc-wrapped ToolSpec\nvalues, matching the shared ownership the three spec views use. The\nassertions are unchanged; only the carrier type differs.\n\nAuto-committed-on: macbook\n

Steven Enamakelb74681c5453c
diff --git a/src/openhuman/agent/harness/session/builder/builder_tests.rs b/src/openhuman/agent/harness/session/builder/builder_tests.rs
index c9004fd23a..008b72567e 100644
--- a/src/openhuman/agent/harness/session/builder/builder_tests.rs
+++ b/src/openhuman/agent/harness/session/builder/builder_tests.rs
@@ -126,9 +126,11 @@ fn load_skill_spec_from_registry() -> ToolSpec {
/// nobody calls advertises every pack exactly as before.
#[test]
fn visible_specs_scope_load_skills_index_to_the_session() {
- let specs = vec![
- load_skill_spec_from_registry(),
- spec(crate::openhuman::tools::toolpacks::USE_SKILL),
+ // `Arc` leaves, because the three spec views share them — the assertions
+ // below are unchanged, only the carrier is.
+ let specs: Vec<std::sync::Arc<ToolSpec>> = vec![
+ std::sync::Arc::new(load_skill_spec_from_registry()),
+ std::sync::Arc::new(spec(crate::openhuman::tools::toolpacks::USE_SKILL)),
];
let visible: std::collections::HashSet<String> = specs.iter().map(|s| s.name.clone()).collect();
// Reachable: one workflows tool. Everything else in every other pack is
@@ -169,9 +171,11 @@ fn visible_specs_scope_load_skills_index_to_the_session() {
/// A session that can reach no pack at all should not carry the pack tools.
#[test]
fn visible_specs_drop_the_pack_tools_when_no_pack_is_reachable() {
- let specs = vec![
- load_skill_spec_from_registry(),
- spec(crate::openhuman::tools::toolpacks::USE_SKILL),
+ // `Arc` leaves, because the three spec views share them — the assertions
+ // below are unchanged, only the carrier is.
+ let specs: Vec<std::sync::Arc<ToolSpec>> = vec![
+ std::sync::Arc::new(load_skill_spec_from_registry()),
+ std::sync::Arc::new(spec(crate::openhuman::tools::toolpacks::USE_SKILL)),
];
let visible: std::collections::HashSet<String> = specs.iter().map(|s| s.name.clone()).collect();
let session = session_allowing(&[
@@ -242,12 +246,14 @@ fn a_realistic_withheld_session_keeps_its_packs_advertised() {
&visible,
);
- let specs: Vec<ToolSpec> = tools
+ let specs: Vec<std::sync::Arc<ToolSpec>> = tools
.iter()
- .map(|t| ToolSpec {
- name: t.name().to_string(),
- description: t.description().to_string(),
- parameters: t.parameters_schema(),
+ .map(|t| {
+ std::sync::Arc::new(ToolSpec {
+ name: t.name().to_string(),
+ description: t.description().to_string(),
+ parameters: t.parameters_schema(),
+ })
})
.collect();