Skip to content

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

fix(recorded_tools): handle empty tool call arguments

Steven Enamakel59dc5f0e958a
diff --git a/crates/openhuman-core/src/agent/session_host/recorded_tools.rs b/crates/openhuman-core/src/agent/session_host/recorded_tools.rs
index 78667de874..c00e38b823 100644
--- a/crates/openhuman-core/src/agent/session_host/recorded_tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/recorded_tools.rs
@@ -112,13 +112,7 @@ pub(super) fn recorded_search_tools(recorded: &[ToolSpec]) -> Vec<ToolSpec> {
}
fn is_search_role_tool(name: &str) -> bool {
- [
- tinysearch_bus::Role::Search,
- tinysearch_bus::Role::Answer,
- tinysearch_bus::Role::Contents,
- ]
- .into_iter()
- .any(|role| tinysearch_bus::role_tool_name(role) == name)
+ tinysearch_bus::role_for_tool(name).is_some()
}
/// Executors for recorded search role tools the live surface no longer
diff --git a/crates/openhuman-core/src/agent/session_host/recorded_tools_tests.rs b/crates/openhuman-core/src/agent/session_host/recorded_tools_tests.rs
index ae37759e20..a4ad9e4305 100644
--- a/crates/openhuman-core/src/agent/session_host/recorded_tools_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/recorded_tools_tests.rs
@@ -126,3 +126,40 @@ fn authoritative_integrations_do_not_restore_revoked_or_gated_actions() {
let rebuilt = rehydrate_integration_actions(&recorded, &[], &integrations, true);
assert!(rebuilt.is_empty());
}
+
+#[test]
+fn recorded_search_tools_keep_only_role_tools() {
+ let recorded = vec![
+ spec("web_search_tool"),
+ spec("GMAIL_SEND_EMAIL"),
+ spec("web_answer_tool"),
+ spec("parallel_search"),
+ spec("web_fetch"),
+ ];
+ let names: Vec<String> = recorded_search_tools(&recorded)
+ .into_iter()
+ .map(|spec| spec.name)
+ .collect();
+ assert_eq!(names, vec!["web_search_tool", "web_answer_tool"]);
+}
+
+#[cfg(feature = "modules")]
+#[test]
+fn missing_search_tools_are_rebuilt_once_with_their_recorded_declaration() {
+ let recorded = vec![
+ spec("web_answer_tool"),
+ spec("web_answer_tool"),
+ spec("web_search_tool"),
+ ];
+ let live: Vec<Box<dyn Tool>> = vec![Box::new(crate::search::TinySearchTool::recorded(
+ tinysearch_bus::ToolSpec {
+ name: "web_search_tool".into(),
+ description: "live".into(),
+ parameters: serde_json::json!({"type": "object"}),
+ },
+ ))];
+ let rebuilt = rehydrate_search_tools(&recorded, &live);
+ assert_eq!(rebuilt.len(), 1);
+ assert_eq!(rebuilt[0].name(), "web_answer_tool");
+ assert_eq!(rebuilt[0].description(), "web_answer_tool description");
+}
diff --git a/vendor/tinysearch b/vendor/tinysearch
index 2789d39e9b..52b56487b1 160000
--- a/vendor/tinysearch
+++ b/vendor/tinysearch
@@ -1 +1 @@
-Subproject commit 2789d39e9bd9360fdedfb838b0dd17d288eed75a
+Subproject commit 52b56487b1b664b8b8f7d75c026b887d30f0066f