Skip to content

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

fix(web_chat): enforce hosted profile check in start_chat

Steven Enamakelf8740ef66df8
diff --git a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
index 763c4e929e..56c3f2ac3d 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -232,9 +232,6 @@ pub async fn channel_web_chat(
// A SaaS user chooses the thread id; the same rules as `threads_upsert`
// apply (no reserved prefixes, no path-like ids). No-op outside SaaS.
crate::profiles::surface::check_thread_id(thread_id.trim())?;
- // A profile this node no longer hosts (its lease was lost or released)
- // starts no new turn here. No-op outside SaaS.
- crate::profiles::host::ensure_hosted()?;
// Mirrors the socket `chat:start` payload's `run_mode` handling
// (`openhuman_rpc::server::socketio`): apply it before starting the turn so
// `plan_mode_middleware` sees the requested mode from the first tool
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 bf221dd111..a59bde4cca 100644
--- a/crates/openhuman-core/src/web_chat/ops/start_chat.rs
+++ b/crates/openhuman-core/src/web_chat/ops/start_chat.rs
@@ -183,6 +183,9 @@ async fn start_chat_inner(
if message.is_empty() {
return Err(StartChatError::Other("message is required".to_string()));
}
+ // A profile this node no longer hosts (its lease was lost or released)
+ // starts no new turn here. No-op outside SaaS.
+ crate::profiles::host::ensure_hosted().map_err(StartChatError::Other)?;
// Save originals before scanning, history, memory, or queue persistence.
// A missing config/root cannot safely accept an upload.