Skip to content

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

fix(ws_loop): handle connection close during handshake

Steven Enamakel719e055390c0
diff --git a/crates/openhuman-core/src/platform/socket/ws_loop.rs b/crates/openhuman-core/src/platform/socket/ws_loop.rs
index f5a1dc963c..7269b378f1 100644
--- a/crates/openhuman-core/src/platform/socket/ws_loop.rs
+++ b/crates/openhuman-core/src/platform/socket/ws_loop.rs
@@ -1,7 +1,24 @@
//! WebSocket Engine.IO / Socket.IO connection loop with automatic reconnection.
+//!
+//! Split by responsibility rather than by line count:
+//! - [`dispatch`] parses incoming Engine.IO/Socket.IO frames.
+//! - [`connect`] runs the redirect-following connect and one connection's
+//! handshake and event loop.
+//! - [`reconnect`] is the outer [`ws_loop`] retry/backoff loop that drives
+//! [`connect::run_connection`] and decides how to react to failures.
#[cfg(test)]
#[path = "ws_loop_tests.rs"]
mod tests;
-include!("ws_loop_part_01.rs");
-include!("ws_loop_part_02.rs");
+
+mod connect;
+mod dispatch;
+mod reconnect;
+
+pub(super) use reconnect::ws_loop;
+
+#[cfg(test)]
+use manager::AckRegistry;
+
+#[cfg(test)]
+use super::manager;