Skip to content

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

feat(channels): add module provider startup wiring

Steven Enamakel0eb785d366ea
diff --git a/crates/openhuman-core/src/channels/routes.rs b/crates/openhuman-core/src/channels/routes.rs
index 122e8ae6d3..d7d51fda4b 100644
--- a/crates/openhuman-core/src/channels/routes.rs
+++ b/crates/openhuman-core/src/channels/routes.rs
@@ -88,12 +88,14 @@ impl RouteCallbacks {
context: ChannelRuntimeContext,
cancellation: tokio_util::sync::CancellationToken,
) -> Self {
+ let ctx = context.dispatch_ctx();
Self {
- context,
- core_context: crate::core::runtime::CoreContext::current(),
- tenant: crate::core::runtime::tenant::current_tenant_or_isolated(
+ core_context: ctx.resolved(),
+ tenant: crate::core::runtime::tenant::isolated_unless_tenant(
+ ctx.tenant(),
"channel_remote_control",
),
+ context,
cancellation,
}
}
diff --git a/crates/openhuman-core/src/channels/runtime/startup/callback.rs b/crates/openhuman-core/src/channels/runtime/startup/callback.rs
index 9848bb2238..2bfe27c65f 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/callback.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/callback.rs
@@ -29,14 +29,16 @@ pub(super) struct ChannelHostCallbacks {
impl ChannelHostCallbacks {
pub(super) fn new(
+ ctx: &crate::core::runtime::DispatchCtx,
config: Arc<Config>,
context: Arc<OnceLock<Weak<ChannelRuntimeContext>>>,
dispatch: mpsc::Sender<RuntimeChannelMessage>,
) -> Self {
Self {
config,
- core_context: crate::core::runtime::CoreContext::current(),
- tenant: crate::core::runtime::tenant::current_tenant_or_isolated(
+ core_context: ctx.resolved(),
+ tenant: crate::core::runtime::tenant::isolated_unless_tenant(
+ ctx.tenant(),
"channel_host_callback",
),
cancellation: crate::channels::runtime::session::channel_session(),
diff --git a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
index 9a0afbbd8f..fe40cddf9f 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/module_providers.rs
@@ -56,7 +56,7 @@ impl ModuleChannelRuntime {
tracing::warn!("[channels] legacy delivery import failed, will retry: {error:#}");
}
}
- let callback = ChannelHostCallbacks::new(Arc::clone(&config), context, dispatch);
+ let callback = ChannelHostCallbacks::new(dispatch_ctx, Arc::clone(&config), context, dispatch);
let lease = ChannelRuntimeLease::open(client.clone(), callback)
.await
.map_err(anyhow::Error::new)