Skip to content

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

test(embed): add flow approval integration tests

Steven Enamakele392b614f4c8
diff --git a/crates/openhuman-embed/tests/flow_approvals.rs b/crates/openhuman-embed/tests/flow_approvals.rs
index 325ec197a6..9828498bcf 100644
--- a/crates/openhuman-embed/tests/flow_approvals.rs
+++ b/crates/openhuman-embed/tests/flow_approvals.rs
@@ -7,8 +7,8 @@ use std::time::Duration;
use openhuman_core::agent::turn_origin::{self, TrustedAutomationSource};
use openhuman_core::core::events::DomainEvent;
use openhuman_core::core::runtime::{AgentContextRegistry, CoreContext};
-use openhuman_core::security::approval::{ApprovalTurnContext, FlowRunContext};
use openhuman_core::security::approval::{ApprovalGate, ApprovalSourceContext, GateOutcome};
+use openhuman_core::security::approval::{ApprovalTurnContext, FlowRunContext};
use openhuman_embed::{
Access, AgentDefinitionSpec, AgentSpec, AgentTurnOrigin, ApprovalDecision, Runtime,
ToolScopeSpec, TrustedAccess, Workspace,
@@ -93,17 +93,19 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
context,
turn_origin::with_origin(origin("flow-live"), async move {
async move {
- let turn = ApprovalTurnContext::default().with_flow_run(run_context("flow-live", "run-direct"));
- parking_gate
- .intercept_audited_for_call(&turn,
- "shell",
- "flow action",
- serde_json::json!({"command": "redacted"}),
- Some("flow-call"),
- )
- .await
- }
- .await
+ let turn = ApprovalTurnContext::default()
+ .with_flow_run(run_context("flow-live", "run-direct"));
+ parking_gate
+ .intercept_audited_for_call(
+ &turn,
+ "shell",
+ "flow action",
+ serde_json::json!({"command": "redacted"}),
+ Some("flow-call"),
+ )
+ .await
+ }
+ .await
}),
));
let request_id = tokio::time::timeout(Duration::from_secs(5), async {
@@ -229,7 +231,10 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
// must produce a denied tool result and never create the marker.
let turn_agent = agent.clone();
let turn = tokio::spawn(async move {
- turn_agent.turn("write the marker").send()
+ turn_agent
+ .turn("write the marker")
+ .flow_run("flow-live", "run-tool")
+ .send()
.await
});
let request = common::eventually("flow tool to park", || {
@@ -269,11 +274,13 @@ fn flow_surfaces_correlate_decisions_and_closed_instances_never_publish() {
old_context,
turn_origin::with_origin(
origin("flow-closed"),
- gate.intercept_audited(&ApprovalTurnContext::default().with_flow_run(run_context("flow-closed", "run-closed")),
- "shell",
- "late flow action",
- serde_json::json!({}),
- ),
+ gate.intercept_audited(
+ &ApprovalTurnContext::default()
+ .with_flow_run(run_context("flow-closed", "run-closed")),
+ "shell",
+ "late flow action",
+ serde_json::json!({}),
+ ),
),
),
)