Skip to content

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

test(agent_harness_e2e): dedupe approval decisions by request id

Steven Enamakel3093ad5d0ebd
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index 2567a5dcbc..1930e3e273 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -4487,6 +4487,9 @@ async fn orchestrator_calls_an_operator_trusted_mcp_tool_directly_inner() {
.await;
let deadline = tokio::time::Instant::now() + Duration::from_secs(120);
+ // The same approval can reach this subscription more than once (a replay on
+ // the stream); decide each request id a single time.
+ let mut decided = std::collections::HashSet::new();
let done = loop {
let remaining = deadline.saturating_duration_since(tokio::time::Instant::now());
let event = tokio::time::timeout(remaining, events.recv())
@@ -4500,6 +4503,9 @@ async fn orchestrator_calls_an_operator_trusted_mcp_tool_directly_inner() {
.or_else(|| event.get("request_id"))
.and_then(Value::as_str)
.expect("MCP approval request id");
+ if !decided.insert(request_id.to_string()) {
+ continue;
+ }
let decision = post_json_rpc(
&stack.rpc_base,
944,