Skip to content

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

test(agent): assert model sees expired approval text

Steven Enamakelbb49fa78de7b
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
index 6f56addf96..578d8d1e84 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_failure_effect_tests.rs
@@ -345,6 +345,7 @@ async fn failures_of_different_use_skill_tools_do_not_share_a_budget() {
// tools declared no policy and `web_answer_tool` carries no reading verb, the
// timeout read as a possible side effect with zero retries.
+#[cfg(feature = "modules")]
fn search_spec(name: &str) -> tinysearch_bus::ToolSpec {
tinysearch_bus::ToolSpec {
name: name.to_string(),
@@ -353,6 +354,7 @@ fn search_spec(name: &str) -> tinysearch_bus::ToolSpec {
}
}
+#[cfg(feature = "modules")]
#[test]
fn a_web_search_tool_timeout_is_transient_not_an_uncertain_action() {
let tools: Vec<Box<dyn tinytools::Tool>> =
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index d770a7b3dd..cf9d2cf185 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -131,6 +131,19 @@ fn captured_requests_mention_unknown_tool(requests: &[Value]) -> bool {
.contains("unknown tool")
}
+/// Asserts the model's follow-up request carries the expired-approval text
+/// (`unanswered_approval_text`): an unanswered prompt is not a refusal, but the
+/// model is still told not to achieve the same result another way.
+fn assert_model_saw_the_expiry(requests: &[Value]) {
+ let body = serde_json::to_string(requests).unwrap_or_default();
+ assert!(
+ body.contains("not answered in time")
+ && body.contains("approval window expired")
+ && body.contains("another way"),
+ "the model must be told the approval expired and not to work around it; captured: {body}"
+ );
+}
+
/// 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.
@@ -1626,7 +1639,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()));
+ assert_model_saw_the_expiry(&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.