Skip to content

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

chore: I don't see an actual diff in your message — the "Diff:" section is empty, and the stat is

Steven Enamakel1985a6cf1acb
diff --git a/crates/openhuman-rpc/src/server/http/events.rs b/crates/openhuman-rpc/src/server/http/events.rs
index 191837ad45..f705350c46 100644
--- a/crates/openhuman-rpc/src/server/http/events.rs
+++ b/crates/openhuman-rpc/src/server/http/events.rs
@@ -54,11 +54,13 @@ pub(super) async fn events_handler(
// SaaS: the stream belongs to the user the gateway scoped this request to,
// and carries only that user's events. No user scope, or a browser bind
// token instead of the gateway's bearer, is refused outright.
- let saas_agent = if crate::core_host::core::runtime::is_saas() {
- let agent = crate::core_host::core::runtime::CoreContext::current()
- .and_then(|ctx| ctx.session_agent().map(str::to_owned));
- match agent {
- Some(agent) if bearer_ok => Some(agent),
+ // The stream keys on the tenant (profile), read from the task's own scope.
+ let saas_profile = if crate::core_host::core::runtime::is_saas() {
+ let profile = crate::core_host::core::runtime::current_tenant()
+ .ok()
+ .and_then(|tenant| tenant.profile);
+ match profile {
+ Some(profile) if bearer_ok => Some(profile),
_ => {
log::warn!("[events] reject subscribe: SaaS streams need a gateway user scope");
return (StatusCode::NOT_FOUND, Json(json!({ "error": "not found" })))
@@ -117,8 +119,8 @@ pub(super) async fn events_handler(
if event.client_id != client_id {
return None;
}
- if let Some(agent) = saas_agent.as_deref() {
- if !event.belongs_to(agent) {
+ if let Some(profile) = saas_profile.as_deref() {
+ if !event.belongs_to_profile(profile) {
return None;
}
}