Skip to content

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

fix(web_chat): handle missing turn in parallel turn processing

Steven Enamakel1f505508ac67
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 ba34fe52e9..1f9bdb0934 100644
--- a/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
+++ b/crates/openhuman-core/src/web_chat/ops/parallel_turn.rs
@@ -171,6 +171,18 @@ pub(crate) async fn spawn_parallel_turn(
thread_id_task,
request_id_task
);
+ // Cooperative cancel (deadline/cancel token) publishes no
+ // `chat_error` on this path today — leaving a client
+ // waiting on this request_id with no terminal event.
+ // `chat_cancelled` closes it out.
+ publish_web_channel_event(WebChannelEvent {
+ event: "chat_cancelled".to_string(),
+ client_id: client_id_task.clone(),
+ thread_id: thread_id_task.clone(),
+ request_id: request_id_task.clone(),
+ cancel_reason: Some("user_stop".to_string()),
+ ..Default::default()
+ });
}
}
diff --git a/crates/openhuman-core/src/web_chat/schemas.rs b/crates/openhuman-core/src/web_chat/schemas.rs
index e85f0a54c0..a51997fcfd 100644
--- a/crates/openhuman-core/src/web_chat/schemas.rs
+++ b/crates/openhuman-core/src/web_chat/schemas.rs
@@ -186,6 +186,13 @@ fn handle_queue_clear(params: Map<String, Value>) -> ControllerFuture {
})
}
+fn handle_queue_remove(params: Map<String, Value>) -> ControllerFuture {
+ Box::pin(async move {
+ let p = deserialize_params::<WebQueueRemoveParams>(params)?;
+ to_json(channel_web_queue_remove(&p.client_id, &p.thread_id, &p.item_id).await?)
+ })
+}
+
fn handle_cancel(params: Map<String, Value>) -> ControllerFuture {
Box::pin(async move {
let p = deserialize_params::<WebCancelParams>(params)?;