Skip to content

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

test(flows): cover sandbox dry-run in the builder arc

Steven Enamakelf21558d15e60
diff --git a/crates/openhuman-core/src/flows/copilot_bus.rs b/crates/openhuman-core/src/flows/copilot_bus.rs
index 57243f0eed..4b3c9c119e 100644
--- a/crates/openhuman-core/src/flows/copilot_bus.rs
+++ b/crates/openhuman-core/src/flows/copilot_bus.rs
@@ -32,6 +32,10 @@ pub(crate) struct CopilotToolCatalog {
impl CopilotToolCatalog {
/// Load the tools the compiled module serves for this host configuration.
pub(crate) fn load(config: Arc<Config>) -> Result<Self, String> {
+ // Tool registration is synchronous, so this metadata-only call uses
+ // the storage blocking bridge. It carries the supplied Config
+ // explicitly and does not make a host callback or resolve tenant data;
+ // actual tool calls below take their authority from ToolRunContext.
let node_kinds = serde_json::to_value(crate::flows::all_node_kind_contracts())
.map_err(|error| format!("could not encode workflow node contracts: {error}"))?
.as_array()
diff --git a/crates/openhuman-core/src/modules/tinyflows.rs b/crates/openhuman-core/src/modules/tinyflows.rs
index ce91b598aa..7c29b508ab 100644
--- a/crates/openhuman-core/src/modules/tinyflows.rs
+++ b/crates/openhuman-core/src/modules/tinyflows.rs
@@ -42,7 +42,9 @@ pub(crate) fn disabled_message() -> String {
#[cfg(feature = "modules")]
mod imp {
- use super::{HOST_BUS_NAME, MODULE_ID, disabled_message};
+ use super::{HOST_BUS_NAME, disabled_message};
+ #[cfg(not(test))]
+ use super::MODULE_ID;
use crate::config::Config;
#[cfg(not(test))]
use crate::modules::ops;
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 4e759cdf46..e3f8807196 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -11545,9 +11545,16 @@ async fn json_rpc_flows_full_arc_discover_build_create_run_inner() {
clear_forced_chat_completions();
with_chat_completion_requests(|requests| requests.clear());
let demo_graph = opus_sonnet_demo_graph();
- // Turn 1: propose the demo graph. Turn 2: a plain reply ends the builder's
- // loop. Both gate on "propose_workflow" (in the builder's tool schema every
- // turn, absent from the scout / plain agent nodes).
+ // Turn 1: dry-run the graph through TinyFlows' sandbox bus path. Turn 2:
+ // propose it after reading the sandbox result. Turn 3: a plain reply ends
+ // the builder loop.
+ push_forced_chat_completion_when(
+ "dry_run_workflow",
+ forced_tool_call_completion(
+ "dry_run_workflow",
+ json!({ "graph": demo_graph.clone() }),
+ ),
+ );
push_forced_chat_completion_when(
"propose_workflow",
forced_tool_call_completion(
@@ -11593,6 +11600,16 @@ async fn json_rpc_flows_full_arc_discover_build_create_run_inner() {
proposed_ids.contains(&"planner") && proposed_ids.contains(&"drafter"),
"proposal graph must carry the agent nodes: {proposed_ids:?}"
);
+ let builder_requests = with_chat_completion_requests(|requests| requests.clone());
+ assert!(
+ builder_requests.iter().any(|request| {
+ request
+ .get("body")
+ .map(Value::to_string)
+ .is_some_and(|body| body.contains("\\\"sandbox\\\": true"))
+ }),
+ "the second builder call must receive the released module's sandbox report: {builder_requests:?}"
+ );
// ── 3. flows_create + flows_run: the saved graph runs its agent nodes ──
clear_forced_chat_completions();