Skip to content

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

test(fleet-prompt): pin the Deferred rows to a deferred tool and its tool_search route

M3gA-Mind20503182a8d1
diff --git a/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
index db9e997adc..c8fbcc4606 100644
--- a/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
+++ b/crates/openhuman-core/src/agent/registry/agents/fleet_prompt_tests.rs
@@ -88,6 +88,19 @@ fn render(def: &AgentDefinition, definitions: &[AgentDefinition]) -> String {
/// register (a disabled browser, say) therefore go unexamined — the invariant
/// can miss, but it cannot misfire.
fn tool_universe() -> BTreeSet<String> {
+ registered_tools()
+ .iter()
+ .map(|t| t.name().to_string())
+ .chain(
+ crate::tools::toolpacks::all_packed_tool_names()
+ .into_iter()
+ .map(str::to_string),
+ )
+ .collect()
+}
+
+/// Every tool this build registers, in a throwaway workspace.
+fn registered_tools() -> Vec<Box<dyn tinytools::Tool>> {
let tmp = tempfile::TempDir::new().expect("temp dir");
let config = crate::config::Config {
workspace_dir: tmp.path().join("workspace"),
@@ -106,14 +119,6 @@ fn tool_universe() -> BTreeSet<String> {
&config,
);
tools
- .iter()
- .map(|t| t.name().to_string())
- .chain(
- crate::tools::toolpacks::all_packed_tool_names()
- .into_iter()
- .map(str::to_string),
- )
- .collect()
}
/// Is `tool` on `def`'s belt at all (every tool, for a wildcard)?
@@ -203,6 +208,39 @@ pub(super) fn names_presented_as_callable<'a>(
.collect()
}
+/// A **Deferred** row is only honest while its tool really is deferred and the
+/// prompt really gives the route. Pin both, so a tool promoted onto the belt,
+/// or a prompt that drops the `tool_search` hint, fails here instead of
+/// leaving a stale excuse in [`KNOWN_UNCALLABLE`].
+#[test]
+fn deferred_rows_name_deferred_tools_the_prompt_routes_through_tool_search() {
+ let tools = registered_tools();
+ let defs = load_builtins().expect("built-ins load");
+ let deferred = KNOWN_UNCALLABLE
+ .iter()
+ .filter(|(_, _, why)| why.starts_with("`ToolExposure::Deferred`"));
+ for (agent, tool, _) in deferred {
+ // Feature-gated out of this build: the row cannot fire either.
+ let Some(registered) = tools.iter().find(|t| t.name() == *tool) else {
+ continue;
+ };
+ assert_eq!(
+ registered.exposure(),
+ tinytools::ToolExposure::Deferred,
+ "`{tool}` is listed as Deferred for `{agent}` but is not deferred"
+ );
+ let def = defs
+ .iter()
+ .find(|d| d.id == *agent)
+ .unwrap_or_else(|| panic!("Deferred row names unknown agent `{agent}`"));
+ let prompt = render(def, &defs);
+ assert!(
+ prompt.contains("`tool_search`") && prompt.contains(&format!("`{tool}`")),
+ "`{agent}`'s prompt must name `{tool}` with its route, `tool_search`"
+ );
+ }
+}
+
/// Hits [`every_prompt_names_only_tools_its_agent_can_call`] tolerates, as
/// `(agent, tool, why)`; agent `*` matches any agent.
///