Skip to content

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

fix(tinyagents): validate and trim steer_subagent message argument

Steven Enamakel7036ab78bbce
diff --git a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
index 85b813fba6..56cfe0b3c2 100644
--- a/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/ops_tests_model_resolution_tests.rs
@@ -27,7 +27,7 @@ impl tinytools::Tool for BlockingSubagentCloseTool {
async fn execute(&self, _args: serde_json::Value) -> anyhow::Result<tinytools::ToolResult> {
let _ = self.started.send(()).await;
let _ = self.release.await;
- Ok(tinytools::ToolResult::text("tool released after close"))
+ Ok(tinytools::ToolResult::success("tool released after close"))
}
}
@@ -259,7 +259,7 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {
.expect("TaskFirst host adapter resolves raw task ID via the owned session port");
let steered_payload: serde_json::Value =
serde_json::from_str(&steered.output()).expect("message dispatch returns JSON");
- assert_eq!(steered_payload["job_id"], job_id);
+ assert_eq!(steered_payload["job_id"].as_str(), Some(job_id.as_str()));
assert_eq!(steered_payload["status"], "message_queued");
assert!(port
@@ -287,7 +287,7 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {
.await
.expect("Tiny await observes close cancellation");
assert!(
- !wait_result.is_error(),
+ !wait_result.is_error,
"raw product task ID resolves through the authenticated session port: {}",
wait_result.output()
);
@@ -305,7 +305,7 @@ async fn closing_a_durable_driver_session_cancels_only_its_registered_child() {
.await
.expect("Tiny await observes settled cancellation");
assert!(
- !wait_result.is_error(),
+ !wait_result.is_error,
"shared Jobs await returns the settled cancellation: {}",
wait_result.output()
);
diff --git a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
index 7fd2c825f8..e90215e095 100644
--- a/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/tool_registration.rs
@@ -177,6 +177,18 @@ impl ToolDispatch<(), OpenHumanRunContext> for TaskFirstSessionMessageDispatch {
parent: &tinyagents_harness::context::RunContext<OpenHumanRunContext>,
) -> anyhow::Result<ToolResult> {
if let Some(object) = arguments.as_object_mut() {
+ let Some(message) = object
+ .get("message")
+ .and_then(serde_json::Value::as_str)
+ .map(str::trim)
+ .filter(|message| !message.is_empty())
+ else {
+ return Ok(ToolResult::error("steer_subagent: `message` is required"));
+ };
+ object.insert(
+ "message".into(),
+ serde_json::Value::String(message.to_owned()),
+ );
let selected = object
.get("task_id")
.and_then(serde_json::Value::as_str)