Skip to content

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

test(agent-harness): narrow unknown-tool assertion to a single tool name

Steven Enamakel3dd165238d7f
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index cdf70ce4bb..c3af0a8f2d 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -176,6 +176,16 @@ fn captured_requests_mention_unknown_tool(requests: &[Value]) -> bool {
.contains("unknown tool")
}
+/// Same check, narrowed to one tool name — for tests whose script *relies* on
+/// some other call being rejected (e.g. a child calling a tool outside its
+/// named list) and only need to prove that a specific delegate resolved.
+fn captured_requests_reject_tool_as_unknown(requests: &[Value], tool: &str) -> bool {
+ serde_json::to_string(requests)
+ .unwrap_or_default()
+ .to_ascii_lowercase()
+ .contains(&format!("unknown tool `{tool}`"))
+}
+
// ─── Fan-out overlap barrier ────────────────────────────────────────────────
//
// Only `parallel_subagent_fanout` arms this; every other test leaves it empty
@@ -2293,8 +2303,11 @@ async fn multi_hop_delegation_chain_inner() {
);
// No unknown-tool result for `research` — delegation was synthesised correctly.
+ // Scoped to `research`: the researcher's `ask_user_clarification` call IS
+ // rejected as unknown by design (see the ordering note above), so a blanket
+ // check would fail on the very mechanic this test exercises.
assert!(
- !captured_requests_mention_unknown_tool(&requests),
+ !captured_requests_reject_tool_as_unknown(&requests, "research"),
"found an unknown-tool result — `research` delegation was not synthesised; requests: {}",
serde_json::to_string_pretty(&requests).unwrap_or_default()
);