Skip to content

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

fix(session_host): instrument concurrent turn futures with diagnostics

Steven Enamakel24da7381d905
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index fbf906a01d..5cd7bc7579 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -427,20 +427,32 @@ impl OpenHumanSessionHost {
.take_turn_inputs();
let origin = options.run_context.data.origin.clone();
let (enriched, memory_turn) = futures::join!(
- prelude.enrich_request(
- &original_user_message,
- &turn,
- &mut options.run_context.data,
- ),
+ async {
+ let value = prelude
+ .enrich_request(
+ &original_user_message,
+ &turn,
+ &mut options.run_context.data,
+ )
+ .await;
+ concurrent_turn_diagnostic(9);
+ value
+ },
// Boxed: the hook's future (config load, engine
// calls) would otherwise be inlined into this
// already-large hook future.
- Box::pin(prelude.memory_pre_turn(
- view.history,
- view.committed_turns,
- view.history.last().filter(|last| **last == request.input),
- origin,
- )),
+ Box::pin(async {
+ let value = prelude
+ .memory_pre_turn(
+ view.history,
+ view.committed_turns,
+ view.history.last().filter(|last| **last == request.input),
+ origin,
+ )
+ .await;
+ concurrent_turn_diagnostic(10);
+ value
+ }),
);
concurrent_turn_diagnostic(6);
options.run_context.data.memory_turn = memory_turn;