Skip to content

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

fix(plan_review): correct test assertion for gate evaluation

Steven Enamakel9c707a146cd3
diff --git a/crates/openhuman-core/src/agent/plan_review/gate_tests.rs b/crates/openhuman-core/src/agent/plan_review/gate_tests.rs
index 204cda0d06..f9acc6aecb 100644
--- a/crates/openhuman-core/src/agent/plan_review/gate_tests.rs
+++ b/crates/openhuman-core/src/agent/plan_review/gate_tests.rs
@@ -77,3 +77,41 @@ async fn cancelled_park_cleans_up_waiter() {
// The drop guard removed the entry, so there is nothing left to decide.
assert!(!gate.decide_by_thread("t-drop", PlanReviewResolution::Approve));
}
+
+#[tokio::test]
+async fn parked_review_for_thread_carries_tool_call_id_and_expiry() {
+ let gate = std::sync::Arc::new(PlanReviewGate::new(Duration::from_secs(5)));
+ let g2 = gate.clone();
+ let parked = tokio::spawn(async move {
+ g2.request_review(
+ Some("t-replay".into()),
+ Some("c-replay".into()),
+ "Ship it".into(),
+ vec!["step one".into()],
+ Some("call-replay".into()),
+ )
+ .await
+ });
+ tokio::time::sleep(Duration::from_millis(20)).await;
+
+ let row = gate
+ .parked_review_for_thread("t-replay")
+ .expect("review should be parked");
+ assert_eq!(row.thread_id, Some("t-replay".to_string()));
+ assert_eq!(row.client_id, Some("c-replay".to_string()));
+ assert_eq!(row.tool_call_id, Some("call-replay".to_string()));
+ assert!(row.expires_at.is_some());
+ assert_eq!(row.steps, vec!["step one".to_string()]);
+
+ assert!(gate.decide_by_thread("t-replay", PlanReviewResolution::Approve));
+ parked.await.unwrap();
+
+ // Decided reviews are no longer parked.
+ assert!(gate.parked_review_for_thread("t-replay").is_none());
+}
+
+#[tokio::test]
+async fn parked_review_for_thread_is_none_when_nothing_is_parked() {
+ let gate = PlanReviewGate::new(Duration::from_secs(5));
+ assert!(gate.parked_review_for_thread("no-such-thread").is_none());
+}