Skip to content

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

fix(web_chat): reject turns when the profile is no longer hosted

Steven Enamakelcc2100496195
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 56c3f2ac3d..763c4e929e 100644
--- a/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
+++ b/crates/openhuman-core/src/web_chat/ops/channel_ops.rs
@@ -232,6 +232,9 @@ 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