Skip to content

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

feat(channels): start channel runtime from subscriber registry

Steven Enamakelb89a6835374d
diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
index abb142bb52..5e7cb324fe 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -33,41 +33,10 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
// Initialize the global event bus singleton and register the tracing
// subscriber for debug logging of all domain events.
crate::core::bus::init().await.expect("bus init");
- let bus = crate::core::bus::BUS.get().expect("bus initialised");
- let _tracing_handle = bus.subscribe(Arc::new(crate::core::bus::TracingSubscriber));
- crate::platform::health::bus::register_health_subscriber();
- crate::threads::store::register_conversation_persistence_subscriber(
- config.workspace_dir.clone(),
- );
- crate::integrations::composio::register_composio_trigger_subscriber();
- // Surface parked ApprovalGate requests as chat messages so the user can
- // answer yes/no in the thread (chat-native approval, issue #1339).
- crate::web_chat::register_approval_surface_subscriber();
- // Surface generated-artifact lifecycle events (ArtifactReady /
- // ArtifactFailed) as `artifact_ready` / `artifact_failed` web-channel
- // events so the frontend ArtifactCard can render in chat (#2779).
- crate::web_chat::register_artifact_surface_subscriber();
- crate::threads::artifact_rows::register_artifact_row_subscriber();
- // Surface external-egress disclosure events (ExternalTransferPending) as
- // `external_transfer_pending` web-channel events so the frontend can show a
- // per-action "what leaves, to where, why" card (privacy epic S2, #4436).
- crate::web_chat::register_egress_surface_subscriber();
- // Surface thread-goal / thread-todo / run-queue lifecycle events
- // (ThreadGoalUpdated/Cleared, ThreadTodosChanged, RunQueue*) as
- // `thread_goal_updated`/`thread_goal_cleared`/`thread_todos_changed`/
- // `queue_item_queued`/`queue_item_delivered` web-channel events so the
- // desktop goal chip, todo drawer, and message-queue UI stay live (C3).
- crate::web_chat::register_agent_surface_subscriber();
- // Surface memory store/recall activity (MemoryStored/MemoryRecalled) as
- // `memory_activity` web-channel events, routed to the turn's own
- // thread/client only (C5) — never carries memory content or the raw
- // recall query, only a short clipped preview.
- crate::web_chat::register_memory_activity_surface_subscriber();
- // Task-sources: subscribe to Composio connection-created events for
- // one-shot fetches, and spawn the periodic poll that pulls work from
- // configured external sources onto the agent's todo board.
- crate::integrations::task_sources::bus::register_task_sources_subscriber();
- crate::integrations::task_sources::start_periodic_poll();
+ // Domain subscribers (tracing, health, persistence, web surfaces, composio,
+ // task sources) are registered by `core::runtime::subscribers`
+ // on every core boot, not here: this entry point is skipped when no
+ // channel is configured.
// Native request handlers. Re-registering is safe (latest wins) so
// this is idempotent even if `bootstrap_core_runtime` also runs.
// Must happen before `run_message_dispatch_loop` begins, because
diff --git a/crates/openhuman-core/src/core/runtime/subscribers.rs b/crates/openhuman-core/src/core/runtime/subscribers.rs
index 7b7fb1f524..0460574b19 100644
--- a/crates/openhuman-core/src/core/runtime/subscribers.rs
+++ b/crates/openhuman-core/src/core/runtime/subscribers.rs
@@ -163,6 +163,12 @@ pub(super) fn register_domain_subscribers(
// (`SubscriptionHandle::drop` aborts the task).
static INFRA: Once = Once::new();
INFRA.call_once(|| {
+ // Debug-log every domain event; the handle lives for the process.
+ if let Some(handle) =
+ crate::core::bus::BUS.subscribe(Arc::new(crate::core::bus::TracingSubscriber))
+ {
+ std::mem::forget(handle);
+ }
crate::platform::health::bus::register_health_subscriber();
// Initialise the scheduler gate before any background AI workers start