Skip to content

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

chore: files changed crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs

Steven Enamakelfe7851e34ac7
diff --git a/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs b/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs
index 8653f59c95..b12a74e588 100644
--- a/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs
+++ b/crates/openhuman-core/src/flows/ops_run_finalizer_tests.rs
@@ -1,4 +1,6 @@
use super::*;
+use tinyagents_session::port::TurnStates;
+use tinyagents_session::turn_state::types::{TurnLifecycle, TurnState};
#[tokio::test]
async fn dropping_finalizer_for_terminal_run_does_not_rewrite_flow_summary() {
@@ -27,3 +29,66 @@ async fn dropping_finalizer_for_terminal_run_does_not_rewrite_flow_summary() {
let flow = store::get_flow(&config, &flow.id).unwrap().unwrap();
assert!(flow.last_status.is_none());
}
+
+#[tokio::test]
+async fn streamed_flow_finalizer_settles_the_bridge_workspace_turn_state() {
+ let tmp_a = TempDir::new().unwrap();
+ let tmp_b = TempDir::new().unwrap();
+ let config_a = test_config(&tmp_a);
+ let config_b = test_config(&tmp_b);
+ let ctx = crate::core::runtime::DispatchCtx::new(
+ crate::core::runtime::CoreContext::for_test_with_config(
+ crate::core::runtime::DomainSet::full(),
+ config_a.clone(),
+ ),
+ );
+
+ crate::agent::harness::host_definition::AgentDefinitionRegistry::init_global(
+ &config_b.workspace_dir,
+ )
+ .expect("agent registry init");
+ let mut agent = crate::agent::OpenHumanSessionHost::from_config_for_agent(
+ &ctx,
+ &config_b,
+ "workflow_builder",
+ )
+ .expect("build workflow_builder agent");
+ let target = FlowStreamTarget {
+ thread_id: "flow-stream-workspace-binding".to_string(),
+ request_id: "flow-stream-request-binding".to_string(),
+ };
+ for config in [&config_a, &config_b] {
+ crate::agent::session_store::turn_states_for(&config.workspace_dir)
+ .put(&TurnState::started(
+ target.thread_id.clone(),
+ target.request_id.clone(),
+ 25,
+ "2026-10-16T00:00:00Z",
+ ))
+ .expect("seed turn state");
+ }
+
+ attach_flow_progress_bridge(&ctx, &mut agent, &target, "flows_build", &config_b);
+ finalize_flow_stream(
+ &ctx,
+ &target,
+ &Err("fixture agent failure".to_string()),
+ "fixture prompt",
+ )
+ .await;
+
+ let state_a = crate::agent::session_store::turn_states_for(&config_a.workspace_dir)
+ .get_turn(&target.thread_id, &target.request_id)
+ .unwrap()
+ .unwrap();
+ let state_b = crate::agent::session_store::turn_states_for(&config_b.workspace_dir)
+ .get_turn(&target.thread_id, &target.request_id)
+ .unwrap()
+ .unwrap();
+ assert_eq!(state_a.lifecycle, TurnLifecycle::Started);
+ assert_eq!(
+ state_b.lifecycle,
+ TurnLifecycle::Interrupted,
+ "the finalizer must settle the exact store installed by the progress bridge"
+ );
+}