Skip to content

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

fix(security_gate): stop blocking tool calls on benign stop summaries

Steven Enamakelf4b87fbc7af4
diff --git a/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs b/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs
index c9ee9c7ffc..f30fb6cebd 100644
--- a/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/stop_summary_tests.rs
@@ -103,7 +103,10 @@ fn a_secret_in_an_error_line_is_not_repeated() {
`http_request` on `http_request`. Resolve this blocker before retrying.",
),
);
- assert!(!out.contains("sk-live-abcdefghijklmnopqrstuvwxyz0123456789"), "{out}");
+ assert!(
+ !out.contains("sk-live-abcdefghijklmnopqrstuvwxyz0123456789"),
+ "{out}"
+ );
assert!(out.contains("credentials"), "{out}");
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
index 80a31d9988..29596112ba 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
@@ -389,9 +389,37 @@ impl OpenHumanSecurityGate {
/// (`middleware::repeated_failure`), which pauses the turn before the model can
/// answer. The model must get this turn to tell the user the action was not
/// done, as it did with the harness's unmarked fallback text.
+/// What the model is told when the approval prompt for `tool_name` expired
+/// unanswered. Like the refusal text it carries no `[policy-denied]` marker
+/// (see [`decision_for_outcome`]), so the model keeps the turn to tell the
+/// user.
+pub(crate) fn unanswered_approval_text(tool_name: &str) -> String {
+ format!(
+ "The approval request for '{tool_name}' was not answered in time, so it was not run. \
+ Tell the user it is waiting on their approval and that they can ask again to retry. \
+ Do not retry this call yourself this turn and do not achieve the same result another \
+ way (shell, CLI, another tool)."
+ )
+}
+
fn decision_for_outcome(tool_name: &str, outcome: GateOutcome) -> GateDecision {
match outcome {
GateOutcome::Allow => GateDecision::Prompted { approved: true },
+ // An expired prompt is not a refusal: nobody answered. Saying so lets
+ // the agent (and, for a sub-agent, its parent) tell the user the action
+ // is waiting on their approval rather than that it was declined — the
+ // generic text below left a 600s `media_generate_image` expiry reported
+ // as nothing at all.
+ GateOutcome::Deny { reason }
+ if crate::security::approval::is_unanswered_approval_reason(&reason) =>
+ {
+ tracing::warn!(
+ target: "tinyagents",
+ tool = %tool_name,
+ "[tinyagents::host::security] approval prompt expired unanswered"
+ );
+ GateDecision::deny(unanswered_approval_text(tool_name))
+ }
GateOutcome::Deny { reason } => {
tracing::warn!(
target: "tinyagents",