Skip to content

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

fix(relay): scope relayed inbound messages to the current tenant

Steven Enamakel6bda9f3eb842
diff --git a/crates/openhuman-core/src/channels/providers/relay/ops.rs b/crates/openhuman-core/src/channels/providers/relay/ops.rs
index 1d6e72ec62..3771c1918b 100644
--- a/crates/openhuman-core/src/channels/providers/relay/ops.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/ops.rs
@@ -24,6 +24,9 @@ use crate::security::SecurityPolicy;
/// a duplicate and runs no turn, so a gateway can retry a delivery.
pub async fn channel_relay_inbound(params: RelayInboundParams) -> Result<Outcome<Value>, String> {
params.validate()?;
+ // In SaaS a relayed message must run as its user: with no tenant scope
+ // there is no workspace, stream or config it may touch.
+ let tenant = crate::core::runtime::current_tenant().map_err(|error| error.to_string())?;
let thread_id = params.thread_id();
let config = crate::config::rpc::load_config_with_timeout().await?;
let workspace_dir = config.workspace_dir.clone();
@@ -54,6 +57,7 @@ pub async fn channel_relay_inbound(params: RelayInboundParams) -> Result<Outcome
channel = %params.channel,
thread_id = %thread_id,
request_id = %request_id,
+ profile = ?tenant.profile,
chars = params.text.chars().count(),
"[channels::relay] relayed message accepted"
);