Skip to content

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

fix(web_chat): use task context when accessing in-flight state

Steven Enamakel734bb5bcefaa
diff --git a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
index 620921cabd..e6a17ea869 100644
--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
@@ -213,7 +213,7 @@ pub(crate) async fn spawn_parallel_turn(
}
}
- parallel_in_flight(ctx)
+ parallel_in_flight(&ctx_task)
.lock_owned()
.await
.remove(&map_key_task);
diff --git a/crates/openhuman-core/src/web_chat/ops/start_chat.rs b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
index 7a0af548e4..836800f269 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -555,7 +555,7 @@ async fn start_chat_inner(
// Release any in-flight slot we still own and stop. The
// `request_id` guard below prevents clobbering a newer turn that
// replaced us on the interrupt path.
- let mut in_flight = in_flight(ctx).lock_owned().await;
+ let mut in_flight = in_flight(&ctx_task).lock_owned().await;
if let Some(current) = in_flight.get(&map_key_task) {
if current.request_id == request_id_task {
in_flight.remove(&map_key_task);
@@ -652,7 +652,7 @@ async fn start_chat_inner(
// Drain followup messages queued during this turn.
let followups = {
- let mut in_flight = in_flight(ctx).lock_owned().await;
+ let mut in_flight = in_flight(&ctx_task).lock_owned().await;
let followups = if let Some(current) = in_flight.get(&map_key_task) {
if current.request_id == request_id_task {
let fups = current.run_queue.drain(QueueLane::Followup).await;