Skip to content

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

docs(relay): document profile stamping on outbound events

Steven Enamakel0916de479461
diff --git a/crates/openhuman-core/src/channels/providers/relay/channel.rs b/crates/openhuman-core/src/channels/providers/relay/channel.rs
index 531dbf2255..d68e94dd44 100644
--- a/crates/openhuman-core/src/channels/providers/relay/channel.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/channel.rs
@@ -55,9 +55,10 @@ impl RelayChannel {
self.sent.lock().unwrap_or_else(|e| e.into_inner()).clone()
}
- /// The event that carries `message` to the gateway. The routing stamp
- /// (`agent`) is left for `publish_web_channel_event`, which takes it from
- /// the publishing context.
+ /// The event that carries `message` to the gateway. The routing stamps
+ /// (`agent`, `profile`) are left for `publish_web_channel_event`, which
+ /// takes them from the publishing context's tenant, so `/events` hands the
+ /// reply only to the caller's own stream.
pub fn outbound_event(&self, message: &SendMessage) -> WebChannelEvent {
WebChannelEvent {
event: CHANNEL_OUTBOUND_EVENT.to_string(),
diff --git a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs
index 511549c10a..cc372029d9 100644
--- a/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs
+++ b/crates/openhuman-core/src/channels/providers/relay/channel_tests.rs
@@ -25,6 +25,7 @@ fn the_outbound_event_names_the_chat_and_carries_the_text() {
assert_eq!(structured["chat_id"], "-100");
assert_eq!(structured["reply_to_message_id"], "m-1");
assert!(event.agent.is_none(), "stamped at publish, not here");
+ assert!(event.profile.is_none(), "stamped at publish, not here");
let wire = serde_json::to_value(sink().outbound_event(&SendMessage::new("x", "-100")))
.expect("serialize");
@@ -45,7 +46,8 @@ async fn send_publishes_under_the_callers_stamp_and_records_the_text() {
crate::core::runtime::DomainSet::full(),
Default::default(),
)
- .session_agent("u-relay-test"),
+ .session_agent("u-relay-test")
+ .profile("p-relay-test"),
);
let channel = Arc::new(RelayChannel::new(
"telegram",
@@ -73,6 +75,9 @@ async fn send_publishes_under_the_callers_stamp_and_records_the_text() {
assert_eq!(event.agent.as_deref(), Some("u-relay-test"));
assert!(event.belongs_to("u-relay-test"));
assert!(!event.belongs_to("u-someone-else"));
+ assert_eq!(event.profile.as_deref(), Some("p-relay-test"));
+ assert!(event.belongs_to_profile("p-relay-test"));
+ assert!(!event.belongs_to_profile("p-someone-else"));
assert_eq!(channel.sent(), vec!["reply one".to_string()]);
}
diff --git a/crates/openhuman-core/src/user_agents/surface.rs b/crates/openhuman-core/src/user_agents/surface.rs
index 15dec09ef9..4a24c02818 100644
--- a/crates/openhuman-core/src/user_agents/surface.rs
+++ b/crates/openhuman-core/src/user_agents/surface.rs
@@ -18,9 +18,11 @@ use crate::core::runtime::is_saas;
/// shared between users.
///
/// `threads_delete` and `threads_purge` delete only the caller's own threads
-/// (their store is the caller's workspace). Their cleanup of detached
-/// sub-agent work is safe across users once background completions and
-/// running sub-agents are keyed per tenant.
+/// (their store is the caller's workspace). Their cleanup of detached work is
+/// confined to the caller too: running sub-agents are cancelled only in the
+/// caller's workspace (`running_subagents::caller_workspace`), background
+/// completions are keyed per profile (`tenant::profile_key`) and web-channel
+/// sessions per tenant.
pub const USER_METHODS: &[&str] = &[
// Conversation threads: all state lives under the agent's workspace.
"openhuman.threads_list",