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
refactor(tinyagents): render policy denials via shared structured renderer
Steven Enamakel97581b0a391a
diff --git a/crates/openhuman-core/src/agent/tinyagents/policy_denial.rs b/crates/openhuman-core/src/agent/tinyagents/policy_denial.rsindex eb9d936d0c..edf999314e 100644--- a/crates/openhuman-core/src/agent/tinyagents/policy_denial.rs+++ b/crates/openhuman-core/src/agent/tinyagents/policy_denial.rs@@ -21,6 +21,9 @@use tinytools::status::POLICY_BLOCKED_MARKER;use tinytools::PermissionLevel;+use tinyagents_harness::middleware::library::{+ StructuredDenialParts, StructuredDenialRenderOptions,+};/// Generic workaround for a raw security-policy / autonomy block. These denials/// originate deep in the tools / `SecurityPolicy` layer (autonomy tier, command@@ -169,8 +172,11 @@ impl PolicyDenial<'_> {),};- format!(- "Blocked: {blocked}. Reason: {reason}. Workaround: {workaround} {RELAY_INSTRUCTION}"+ StructuredDenialParts::new(blocked, reason, workaround, RELAY_INSTRUCTION).render_with_options(+ &StructuredDenialRenderOptions {+ reason_label: "Reason",+ relay_separator: " ",+ },)}}diff --git a/crates/openhuman-core/src/agent/tinyagents/policy_denial_tests.rs b/crates/openhuman-core/src/agent/tinyagents/policy_denial_tests.rsindex 2a230935f0..a6c11a2d68 100644--- a/crates/openhuman-core/src/agent/tinyagents/policy_denial_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/policy_denial_tests.rs@@ -66,6 +66,21 @@ fn policy_denied_carries_reason_and_alternative() {assert!(msg.contains("Relay this to the user"));}+#[test]+fn host_denial_renderer_preserves_product_labels_and_punctuation() {+ let rendered = PolicyDenial::PolicyDenied {+ tool: "send_email",+ policy: "approval_gate",+ reason: "approval is required",+ }+ .render();++ assert_eq!(+ rendered,+ "Blocked: Tool 'send_email' was denied by policy 'approval_gate'. Reason: approval is required. Workaround: Address the reason above, or reach the goal with a permitted alternative tool / path. If this action is genuinely required, ask the user to adjust the policy. The tool did not run and produced no output — do NOT invent or report any result for it. Relay this to the user: explain what was blocked and why, then offer the workaround as the next step. Do not stop silently."+ );+}+#[test]fn security_policy_block_keeps_marker_and_adds_workaround_and_relay() {let raw = "[policy-blocked] Security policy: read-only mode — only read commands are allowed";