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 chat ID in start chat response

Steven Enamakel0c3890f0be23
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 b3b298e203..ef79ec4d52 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -518,12 +518,17 @@ pub async fn start_chat(
followups.len(),
thread_id_task
);
+ // `followups` can carry more than one drained item; the event's
+ // `item_id`/`text_preview` describe the first one so the UI has
+ // something concrete to show even when several dispatch at once.
+ let first_followup = followups.first();
crate::core::bus::BUS.publish(
crate::core::events::DomainEvent::RunQueueFollowupDispatched {
thread_id: thread_id_task.clone(),
followup_count: followups.len(),
- item_id: None,
- text_preview: None,
+ item_id: first_followup.map(|f| f.id.clone()),
+ text_preview: first_followup
+ .map(|f| crate::agent::queued_turn::text_preview(&f.text)),
},
);
dispatch_followups(followups);