The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(agent_harness_e2e): assert the model is told a refused call's reason
M3gA-Mind4689841a15bf
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rsindex 88973318da..e8295b8ef9 100644--- a/tests/agent_harness_e2e.rs+++ b/tests/agent_harness_e2e.rs@@ -176,6 +176,21 @@ fn captured_requests_mention_unknown_tool(requests: &[Value]) -> bool {.contains("unknown tool")}+/// Asserts the model's follow-up request carries the refusal the security+/// gate renders for a refused approval (`decision_for_outcome`), not the+/// harness's bare "tool call was not approved" fallback.+fn assert_model_saw_the_refusal(requests: &[Value]) {+ let body = serde_json::to_string(requests).unwrap_or_default();+ assert!(+ body.contains("must not be performed") && body.contains("another way"),+ "the model must be told the refused call may not be done another way; captured: {body}"+ );+ assert!(+ !body.contains("tool call was not approved"),+ "the model got the reason-less fallback; captured: {body}"+ );+}+/// 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.@@ -1649,6 +1664,7 @@ async fn approval_gate_deny_flow_inner() {full_response.contains("DENIAL_ACK_CANARY"),"full_response must contain DENIAL_ACK_CANARY; got: {full_response}");+ assert_model_saw_the_refusal(&with_captured(|c| c.clone()));// The denied file_write must not have overwritten the placeholder.// The pre-created file must still contain exactly the original placeholder string.@@ -1729,6 +1745,7 @@ async fn approval_gate_timeout_inner() {full_response.contains("TIMEOUT_ACK_CANARY"),"full_response must contain TIMEOUT_ACK_CANARY after TTL auto-deny; got: {full_response}");+ assert_model_saw_the_refusal(&with_captured(|c| c.clone()));// The file's content must remain the placeholder (not the canary).// Use .expect() so a missing file fails loudly rather than vacuously passing.