Skip to content

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

test(agent): update tool visibility assertions to use tool specs

Steven Enamakeldbac7b902889
diff --git a/crates/openhuman-core/src/agent/agent_turn_loop_packed_tool_tests.rs b/crates/openhuman-core/src/agent/agent_turn_loop_packed_tool_tests.rs
index 2e7e909aff..3874c4d366 100644
--- a/crates/openhuman-core/src/agent/agent_turn_loop_packed_tool_tests.rs
+++ b/crates/openhuman-core/src/agent/agent_turn_loop_packed_tool_tests.rs
@@ -50,7 +50,10 @@ async fn turn_routes_a_bare_packed_tool_call_through_use_skill() {
let (mut agent, _tmp) = build_agent_with(provider, tools, Box::new(NativeDialect));
assert!(
- !agent.visible_tool_names.contains("skill_registry_search"),
+ !agent
+ .visible_tool_specs_arc()
+ .iter()
+ .any(|spec| spec.name == "skill_registry_search"),
"precondition: the tool is withheld behind its pack"
);
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index 634bacc3b1..0a4757128f 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -342,7 +342,7 @@ async fn an_empty_named_scope_advertises_no_tools_at_all() {
)
.expect("summarizer is a shipped agent definition");
- let visible = agent.visible_tool_names;
+ let visible = &agent.visible_tool_names;
let real: Vec<&String> = visible
.iter()
.filter(|n| n.as_str() != crate::agent::harness::host_definition::NO_TOOLS_SENTINEL)
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
index d08478e02f..7b56dd060a 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests_tool_exposure_tests.rs
@@ -147,7 +147,7 @@ fn wildcard_belt_defers_but_keeps_reachable() {
assert_eq!(
agent.deferred_tool_names,
- &std::collections::HashSet::from(["rare".to_string()])
+ std::collections::HashSet::from(["rare".to_string()])
);
assert!(agent.visible_tool_names.contains("plain"));
assert!(!agent.visible_tool_names.contains("rare"));
@@ -178,11 +178,11 @@ fn named_belt_opts_into_discovery_by_naming_tool_search() {
assert_eq!(
agent.visible_tool_names,
- &std::collections::HashSet::from(["plain".to_string()])
+ std::collections::HashSet::from(["plain".to_string()])
);
assert_eq!(
agent.deferred_tool_names,
- &std::collections::HashSet::from(["rare".to_string()])
+ std::collections::HashSet::from(["rare".to_string()])
);
assert!(agent.tool_policy_session.is_allowed("rare"));
}
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
index 261256b898..b7a2f46e23 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
@@ -5,7 +5,7 @@ use std::sync::Arc;
use tinyagents_runtime::ToolSnapshot;
use tinytools::ToolSpec;
-fn synthesized_tool_names(prelude: &super::SessionPrelude) -> std::collections::HashSet<String> {
+fn synthesized_tool_names(prelude: &super::OpenHumanTurnPrelude) -> std::collections::HashSet<String> {
prelude
.tool_surface
.lock()
diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
index 1e50025499..249148d8de 100644
--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
@@ -344,7 +344,7 @@ async fn cron_agent_job_uses_agent_definition_tool_scope() {
let built =
build_agent_for_cron_job(&crate::core::runtime::DispatchCtx::ambient(), &config, &job)
.expect("build cron agent");
- let visible = built.agent.visible_tool_names_for_test();
+ let visible = built.agent.visible_tool_specs_arc();
assert!(
!visible.is_empty(),
diff --git a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
index 9e99213316..d96b076445 100644
--- a/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_run_status_and_prompt_binding_tests.rs
@@ -160,10 +160,10 @@ async fn flows_build_hides_the_live_run_tool_from_the_builder_belt() {
// Precondition: the builder advertises all four run-advancing tools on its
// belt before restriction — the exact set #4593/#4881 are about.
- let visible_before = agent.visible_tool_names_for_test();
+ let visible_before = agent.visible_tool_specs_arc();
for present in ["run_flow", "resume_flow_run", "cancel_flow_run"] {
assert!(
- visible_before.contains(present),
+ visible_before.iter().any(|spec| spec.name == present),
"precondition: workflow_builder belt should advertise `{present}`; visible = \
{visible_before:?}"
);
@@ -173,7 +173,7 @@ async fn flows_build_hides_the_live_run_tool_from_the_builder_belt() {
// After restriction none of the run-advancing tools are callable on the
// flows_build path — the hide-list covers all of them (#4593 + #4881).
- let visible = agent.visible_tool_names_for_test();
+ let visible = agent.visible_tool_specs_arc();
for hidden in [
"run_workflow",
"run_flow",
@@ -181,7 +181,7 @@ async fn flows_build_hides_the_live_run_tool_from_the_builder_belt() {
"cancel_flow_run",
] {
assert!(
- !visible.contains(hidden),
+ !visible.iter().any(|spec| spec.name == hidden),
"run-advancing tool `{hidden}` must be hidden on the flows_build path; visible = \
{visible:?}"
);
@@ -263,17 +263,17 @@ async fn flows_build_copilot_toolset_unhides_the_live_run_tools() {
restrict_builder_toolset_for_copilot(&mut agent);
- let visible = agent.visible_tool_names_for_test();
+ let visible = agent.visible_tool_specs_arc();
for still_reachable in ["run_flow", "resume_flow_run"] {
assert!(
- visible.contains(still_reachable),
+ visible.iter().any(|spec| spec.name == still_reachable),
"`{still_reachable}` must stay reachable on the streaming copilot path — it \
is gated behind the WebChat approval surface, not hidden; visible = {visible:?}"
);
}
for hidden in ["run_workflow", "cancel_flow_run"] {
assert!(
- !visible.contains(hidden),
+ !visible.iter().any(|spec| spec.name == hidden),
"`{hidden}` must stay hidden on the copilot path (unrelated legacy runner / \
a cancel that is now safe to unhide but deliberately still gated behind a \
product decision); visible = {visible:?}"
diff --git a/crates/openhuman-core/src/threads/transcript_host_tests.rs b/crates/openhuman-core/src/threads/transcript_host_tests.rs
index 3eb4bcbedf..5d21488060 100644
--- a/crates/openhuman-core/src/threads/transcript_host_tests.rs
+++ b/crates/openhuman-core/src/threads/transcript_host_tests.rs
@@ -8,7 +8,7 @@
use std::sync::Arc;
-use crate::agent::session_store::splice_fixture::memory_locator;
+use crate::agent::session_store::splice_fixture_tests::memory_locator;
use tempfile::TempDir;
use tinyagents_session::transcript::view::{
project_records, project_thread_in, DisplayItem, ToolCallStatus,