Skip to content

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

chore(security): remove unused bus modules

Steven Enamakela4f67e72cf86
diff --git a/crates/openhuman-core/src/security/credentials/bus.rs b/crates/openhuman-core/src/security/credentials/bus.rs
index e2f16cfd20..8f4a5eb8e4 100644
--- a/crates/openhuman-core/src/security/credentials/bus.rs
+++ b/crates/openhuman-core/src/security/credentials/bus.rs
@@ -56,8 +56,10 @@ impl EventHandler<DomainEvent> for SessionExpiredSubscriber {
}
async fn handle(&self, event: &DomainEvent) {
+ // A session expiry belongs to the host's own sign-in: outside SaaS the
+ // process default, and in SaaS (which leaves it to the gateway) none.
self.handle_with(
- &DispatchCtx::ambient(),
+ &DispatchCtx::host_default(),
crate::core::runtime::is_saas(),
event,
)
diff --git a/crates/openhuman-core/src/security/devices/bus.rs b/crates/openhuman-core/src/security/devices/bus.rs
index 68e8cbf515..3d3807e075 100644
--- a/crates/openhuman-core/src/security/devices/bus.rs
+++ b/crates/openhuman-core/src/security/devices/bus.rs
@@ -95,7 +95,9 @@ impl EventHandler<DomainEvent> for DeviceTunnelSubscriber {
.unwrap_or_else(std::sync::PoisonError::into_inner)
.get(channel_id.as_str())
.cloned();
- let ctx = DispatchCtx::ambient();
+ // Tunnel frames arrive over the host's socket: its own tenant,
+ // and in SaaS none (the frame is then dropped below).
+ let ctx = DispatchCtx::host_default();
match super::owner::owner_of(&ctx, channel_id, pending.as_ref()).await {
Ok(owner) => {
let handled = crate::storage::agents::within_agent(
diff --git a/crates/openhuman-core/src/skills/webhooks/bus.rs b/crates/openhuman-core/src/skills/webhooks/bus.rs
index 6a034449e7..6f22c21d52 100644
--- a/crates/openhuman-core/src/skills/webhooks/bus.rs
+++ b/crates/openhuman-core/src/skills/webhooks/bus.rs
@@ -62,6 +62,9 @@ impl EventHandler<DomainEvent> for WebhookRequestSubscriber {
return;
};
+ // An inbound webhook arrives over the host's socket: its own tenant,
+ // and in SaaS none (the request is then not handled).
+ let ctx = crate::core::runtime::DispatchCtx::host_default();
let started_at = Instant::now();
let correlation_id = request.correlation_id.clone();
@@ -130,7 +133,7 @@ impl EventHandler<DomainEvent> for WebhookRequestSubscriber {
tokio::spawn(async move {
let result =
tokio::time::timeout(std::time::Duration::from_secs(60), async {
- run_agent_trigger(&envelope).await
+ run_agent_trigger(&ctx, &envelope).await
})
.await;
let (resp, err) = match result {
@@ -302,12 +305,12 @@ fn decode_webhook_body(base64_body: &str) -> Result<serde_json::Value, String> {
/// Run the triage pipeline for a trigger envelope and return the
/// human-readable decision summary on success.
async fn run_agent_trigger(
+ ctx: &crate::core::runtime::DispatchCtx,
envelope: &crate::agent::triage::TriggerEnvelope,
) -> Result<String, String> {
- let outcome =
- crate::agent::triage::run_triage(&crate::core::runtime::DispatchCtx::ambient(), envelope)
- .await
- .map_err(|e| format!("triage evaluation failed: {e}"))?;
+ let outcome = crate::agent::triage::run_triage(ctx, envelope)
+ .await
+ .map_err(|e| format!("triage evaluation failed: {e}"))?;
match outcome {
crate::agent::triage::TriageOutcome::Decision(run) => {
@@ -318,7 +321,7 @@ async fn run_agent_trigger(
crate::agent::turn_origin::with_origin(
origin,
crate::agent::triage::apply_decision(
- &crate::core::runtime::DispatchCtx::ambient(),
+ ctx,
run.clone(),
envelope,
),