Skip to content

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

test(openhuman-embed): assert scoped hooks inside the scheduled scope

Steven Enamakel490733d6dd75
diff --git a/crates/openhuman-embed/tests/scoped_hooks.rs b/crates/openhuman-embed/tests/scoped_hooks.rs
index 33aaf7143c..1d0455f42b 100644
--- a/crates/openhuman-embed/tests/scoped_hooks.rs
+++ b/crates/openhuman-embed/tests/scoped_hooks.rs
@@ -158,18 +158,20 @@ async fn scenario() {
.unwrap();
let turn_hook = Observer::new("turn-a", &events, None);
let scheduled = openhuman_core::agent::host_agents::resolve("worker-a").unwrap();
- // The agent's callbacks are plain data on the scheduled agent; the session
- // built from it carries them explicitly (asserted by the counts below).
- assert_eq!(
- scheduled.hooks.tool_hooks().len(),
- 1,
- "scheduled turns lost the agent's tool hooks"
- );
- assert_eq!(
- scheduled.hooks.post_turn_hooks().len(),
- 1,
- "scheduled turns lost the agent's post-turn hooks"
- );
+ scheduled
+ .scope(async {
+ assert_eq!(
+ openhuman_core::agent::hooks::embedder_tool_hooks().len(),
+ 2,
+ "scheduled turns lost the agent's tool hooks"
+ );
+ assert_eq!(
+ openhuman_core::agent::hooks::embedder_post_turn_hooks().len(),
+ 2,
+ "scheduled turns lost the agent's post-turn hooks"
+ );
+ })
+ .await;
let (first, second) = tokio::join!(
a.turn("a-first")
.tool_hook(turn_hook.clone())