Skip to content

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

docs(web_chat): update module docs for queue mode and parallel turn support

Steven Enamakel9593f8d6d58a
diff --git a/crates/openhuman-core/src/web_chat/mod.rs b/crates/openhuman-core/src/web_chat/mod.rs
index 3e53f7e838..4767343222 100644
--- a/crates/openhuman-core/src/web_chat/mod.rs
+++ b/crates/openhuman-core/src/web_chat/mod.rs
@@ -1,21 +1,27 @@
//! Web/desktop channel turn runner.
//!
-//! Drives a chat turn from a Socket.IO `chat` event through the agent
-//! harness to a delivered, durably-persisted reply: `start_chat`
-//! (`ops_part_02.rs`) validates and preprocesses the message, resolves or
-//! builds the session `Agent` (`session.rs`), and hands off to
-//! `run_task::run_chat_task`, which spawns `spawn_progress_bridge` alongside
-//! the run and lets `presentation.rs` persist the reply
-//! (`reply_persistence.rs`) before announcing it. Exposes the `channel.web_*`
-//! RPC namespace (`schemas.rs`) and the `WebChannelEvent` broadcast bus
-//! (`event_bus.rs`) that both Socket.IO and the JSON-RPC `/events` SSE stream
-//! consume. See `README.md` for the full lifecycle and wiring.
+//! Drives a chat turn from a Socket.IO `chat:start` event (or an inbound
+//! `channels/` provider message) through the agent harness to a delivered,
+//! durably-persisted reply: `start_chat` (`ops_part_02.rs`) validates and
+//! preprocesses the message, applies the queue mode against the thread's
+//! in-flight state, and spawns `run_task::run_chat_task` under the cancel
+//! token / wall-clock backstop / `APPROVAL_CHAT_CONTEXT` scope
+//! (`run_turn_under_cancel_and_deadline`, `ops_part_01.rs`). `run_chat_task`
+//! resolves or builds the cached session `Agent` (`session.rs`), spawns
+//! `spawn_progress_bridge` alongside the run, and returns the result; the
+//! spawning task then hands an `Ok` to `presentation::deliver_response`,
+//! which persists the reply (`reply_persistence.rs`) before announcing it,
+//! and an `Err` to `web_errors::classify_inference_error`. Exposes the
+//! `channel.web_*` RPC namespace (`schemas.rs`) and the `WebChannelEvent`
+//! broadcast bus (`event_bus.rs`) that both Socket.IO and the JSON-RPC
+//! `/events` SSE stream consume. See `README.md` for the full lifecycle and
+//! wiring.
//!
//! Submodules: `ops*.rs` (request surface, session/in-flight state),
//! `run_task.rs` (turn execution), `session.rs` (agent build/fingerprint),
//! `progress_bridge.rs` (progress → socket event bridge), `presentation.rs`
-//! (reply segmentation/delivery), `reply_persistence.rs` (durable reply
-//! write), `event_bus.rs` (broadcast + `DomainEvent` surface subscribers),
+//! (reply delivery), `reply_persistence.rs` (durable reply write),
+//! `event_bus.rs` (broadcast + `DomainEvent` surface subscribers),
//! `web_errors*.rs` (provider error classification), `schemas.rs` (RPC
//! contract), `types.rs` (shared param/state types).
diff --git a/crates/openhuman-core/src/web_chat/run_task.rs b/crates/openhuman-core/src/web_chat/run_task.rs
index 663f66e802..eb17b8dd7a 100644
--- a/crates/openhuman-core/src/web_chat/run_task.rs
+++ b/crates/openhuman-core/src/web_chat/run_task.rs
@@ -1,6 +1,8 @@
-//! `run_chat_task` — builds the session agent, runs a turn through the agent
-//! harness, and spawns the progress bridge alongside it. Called from
-//! `ops::start_chat` once validation and cache-lookup are done.
+//! `run_chat_task` — resolves or builds the cached session agent
+//! (`session.rs`), spawns the progress bridge alongside the turn, runs it
+//! through the agent harness, and applies the per-thread budget correlation
+//! to a failed turn. Called from `start_chat` and `spawn_parallel_turn`
+//! (`ops_part_02.rs`/`ops_part_03.rs`) once the message has been validated.
use std::sync::Arc;