Skip to content

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

test(isolation): simplify host-only helper test assertions

Steven Enamakelda1a86e63c01
diff --git a/crates/openhuman-embed/tests/isolation_subagents.rs b/crates/openhuman-embed/tests/isolation_subagents.rs
index 405e8bee2f..03fdfc42b6 100644
--- a/crates/openhuman-embed/tests/isolation_subagents.rs
+++ b/crates/openhuman-embed/tests/isolation_subagents.rs
@@ -232,34 +232,11 @@ fn host_only_and_disallowed_scopes_do_not_opt_into_declared_helpers() {
)]),
)
.expect("host-only agent with declared helper builds");
- let host_outcome = host_only
+ host_only
.run("try the helper")
.await
.expect("host-only turn returns");
let host_requests = chat_requests(&host_only_provider).await;
- let host_tool_results = host_requests
- .iter()
- .map(common::tool_results)
- .collect::<Vec<_>>()
- .join("\n");
- eprintln!(
- "host-only fixture outcome reply={:?} request_count={} request_shapes={:?} tool_results={:?}",
- host_outcome.reply,
- host_requests.len(),
- host_requests.iter().map(|request| {
- let body: serde_json::Value = serde_json::from_slice(&request.body).unwrap_or_default();
- body.get("messages")
- .and_then(|messages| messages.as_array())
- .map(|messages| messages.iter().map(|message| (
- message.get("role")
- .and_then(serde_json::Value::as_str)
- .map(str::to_owned),
- message.get("content").map_or(0, |content| content.to_string().len()),
- )).collect::<Vec<_>>())
- .unwrap_or_default()
- }).collect::<Vec<_>>(),
- host_tool_results,
- );
assert!(!host_requests.is_empty());
assert!(!tool_names(&host_requests[0])
.iter()
@@ -268,6 +245,11 @@ fn host_only_and_disallowed_scopes_do_not_opt_into_declared_helpers() {
.iter()
.all(|request| !String::from_utf8_lossy(&request.body)
.contains("HOST-ONLY-HELPER-MARK")));
+ let host_tool_results = host_requests
+ .iter()
+ .map(common::tool_results)
+ .collect::<Vec<_>>()
+ .join("\n");
assert_refused_without_async_reference(&host_tool_results);
let denied_provider = scripted_provider(
@@ -340,7 +322,9 @@ fn assert_refused_without_async_reference(result: &str) {
lowercase.contains("not available")
|| lowercase.contains("not allowed")
|| lowercase.contains("not in the current session")
- || lowercase.starts_with("unknown tool `spawn_subagent`"),
+ || lowercase
+ .trim_start()
+ .starts_with("unknown tool `spawn_subagent`"),
"the attempted spawn must return an explicit refusal: {result}"
);
for reference_field in ["task_id", "subagent_session_id", "status"] {