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 event bus subscription gracefully

Steven Enamakel7478f8db34fa
diff --git a/crates/openhuman-core/src/web_chat/event_bus.rs b/crates/openhuman-core/src/web_chat/event_bus.rs
index 050d05ba9d..7f598ecfd8 100644
--- a/crates/openhuman-core/src/web_chat/event_bus.rs
+++ b/crates/openhuman-core/src/web_chat/event_bus.rs
@@ -21,7 +21,14 @@ pub fn subscribe_web_channel_events() -> broadcast::Receiver<WebChannelEvent> {
EVENT_BUS.subscribe()
}
-pub fn publish_web_channel_event(event: WebChannelEvent) {
+/// Publish `event` to every subscribed socket bridge and the JSON-RPC
+/// `/events` stream, stamping `ts` (epoch ms) when the caller left it unset
+/// so every emitted event carries a wall-clock time the frontend can use for
+/// ordering/latency display without guessing at receive time.
+pub fn publish_web_channel_event(mut event: WebChannelEvent) {
+ if event.ts.is_none() {
+ event.ts = Some(crate::web_chat::progress_bridge::unix_epoch_ms());
+ }
let _ = EVENT_BUS.send(event);
}