Skip to content

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

test(flows): isolate the builder-chat e2e and run it in the JSON-RPC suites

M3gA-Mind5ff74f36069d
diff --git a/scripts/__tests__/rust-product-enumeration.test.mjs b/scripts/__tests__/rust-product-enumeration.test.mjs
index 3edf56d4dc..e90e5bbc59 100644
--- a/scripts/__tests__/rust-product-enumeration.test.mjs
+++ b/scripts/__tests__/rust-product-enumeration.test.mjs
@@ -36,6 +36,7 @@ const JSON_RPC_TARGETS = [
"json_rpc_threads_e2e",
"json_rpc_wallet_e2e",
"json_rpc_flows_e2e",
+ "json_rpc_flows_builder_chat_e2e",
"json_rpc_mcp_e2e",
"json_rpc_inference_e2e",
"json_rpc_auth_security_e2e",
diff --git a/scripts/test-rust-e2e.sh b/scripts/test-rust-e2e.sh
index 508ce63795..7392a90d58 100755
--- a/scripts/test-rust-e2e.sh
+++ b/scripts/test-rust-e2e.sh
@@ -276,6 +276,7 @@ run_json_rpc_e2e_suite() {
# partial list is never run as though it were complete.
local target listing test_names test_name
local -a targets=(json_rpc_threads_e2e json_rpc_wallet_e2e json_rpc_flows_e2e
+ json_rpc_flows_builder_chat_e2e
json_rpc_mcp_e2e json_rpc_inference_e2e json_rpc_auth_security_e2e
json_rpc_config_e2e json_rpc_agent_team_e2e json_rpc_web_chat_e2e
json_rpc_misc_e2e)
diff --git a/scripts/test-rust-with-mock.sh b/scripts/test-rust-with-mock.sh
index c66a6af9f1..15bf95ab6e 100755
--- a/scripts/test-rust-with-mock.sh
+++ b/scripts/test-rust-with-mock.sh
@@ -305,6 +305,7 @@ run_json_rpc_e2e() {
# provider route persisted by one scenario cannot affect another one.
local target listing test_names test_name matched_count=0
local -a targets=(json_rpc_threads_e2e json_rpc_wallet_e2e json_rpc_flows_e2e
+ json_rpc_flows_builder_chat_e2e
json_rpc_mcp_e2e json_rpc_inference_e2e json_rpc_auth_security_e2e
json_rpc_config_e2e json_rpc_agent_team_e2e json_rpc_web_chat_e2e
json_rpc_misc_e2e)
diff --git a/tests/json_rpc_flows_builder_chat_e2e.rs b/tests/json_rpc_flows_builder_chat_e2e.rs
index ba0bf4b831..cc1a926946 100644
--- a/tests/json_rpc_flows_builder_chat_e2e.rs
+++ b/tests/json_rpc_flows_builder_chat_e2e.rs
@@ -370,12 +370,18 @@ async fn chat_spawns_workflow_builder_and_saves_its_proposal() {
.with_writer(std::io::stderr)
.try_init();
let _env_lock = json_rpc_e2e_env_lock_async().await;
+ // Managed inference (routed to the mock below) is registered by the
+ // TinyHumans layer, not built into the core.
+ tinyhumans_boot::boot();
let _fifo_guard = ScriptedFifoGuard;
let tmp = tempdir().expect("tempdir");
let home = tmp.path();
let openhuman_home = home.join(".openhuman");
let _home_guard = EnvVarGuard::set_to_path("HOME", home);
let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");
+ let _storage_url_guard = EnvVarGuard::unset("OPENHUMAN_STORAGE_URL");
+ // Step 4 answers the create_workflow approval: the gate must be on.
+ let _approval_gate_guard = EnvVarGuard::unset("OPENHUMAN_APPROVAL_GATE");
let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");
let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");
let _api_url_guard = EnvVarGuard::unset("OPENHUMAN_API_URL");
@@ -669,6 +675,26 @@ async fn chat_spawns_workflow_builder_and_saves_its_proposal() {
.as_str()
.expect("agent flow id")
.to_string();
+ // The save turn ends on its own reply. Turn 1 ended clean, so any
+ // chat_error is this turn's.
+ let turn2_end = wait_for("the save turn's terminal event", || {
+ let events = Arc::clone(&events);
+ async move {
+ let mut terminal = events_named(&events, "chat_error");
+ terminal.extend(
+ events_named(&events, "chat_done")
+ .into_iter()
+ .filter(|e| e.to_string().contains("TURN2-END")),
+ );
+ terminal.into_iter().next()
+ }
+ })
+ .await;
+ assert_eq!(
+ turn2_end.get("event").and_then(Value::as_str),
+ Some("chat_done"),
+ "the save turn must finish cleanly: {turn2_end}"
+ );
// The save task's own completion: whatever it records on the proposal is
// recorded by then.
wait_for("SubagentCompleted for the save task", || {