Skip to content

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

chore: files changed crates/openhuman-core/src/channels/runtime/startup/start_channels.rs,crates/ope

Steven Enamakel32ed661c3962
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 180573e918..5756c00d85 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -218,11 +218,6 @@ async fn start_channels_inner(mut config: Config, session: CancellationToken) ->
component: "channels".into(),
});
- // Register the cron delivery subscriber so cron jobs can deliver output
- // to channels via events instead of directly constructing channel instances.
- let _cron_delivery_handle = bus.subscribe(Arc::new(
- crate::cron::bus::CronDeliverySubscriber::new(Arc::clone(&channels_by_name)),
- ));
// NOTE: the flows `FlowTriggerSubscriber` is registered in
// `runtime/subscribers.rs::register_domain_subscribers` (unconditional core boot), NOT
// here — `start_channels` is skipped when no channel is configured or
diff --git a/crates/openhuman-core/src/core/README.md b/crates/openhuman-core/src/core/README.md
index 99e0fb4057..83b2eeb21b 100644
--- a/crates/openhuman-core/src/core/README.md
+++ b/crates/openhuman-core/src/core/README.md
@@ -155,7 +155,7 @@ and the host is the one that knows `E`. [`events.rs`](./events.rs) is the event
`DomainEvent`, a `#[non_exhaustive]` enum whose `domain()` value is appended
to `EVENTS_ROOT` (`/ai/tinyhumans/openhuman/events`) as the routing key.
The catalog is published under `EVENTS_INTERFACE`
-(`ai.tinyhumans.openhuman.Events`) at `EVENTS_VERSION`, currently `1.10.0`.
+(`ai.tinyhumans.openhuman.Events2`) at `EVENTS_VERSION`, currently `2.0.0`.
`bus::init()` starts the in-process broker and announces a peer manifest
(advisory; failure only logs). Every accessor is safe before `init`:
diff --git a/crates/openhuman-core/src/core/bus.rs b/crates/openhuman-core/src/core/bus.rs
index 6a4172417c..2596c4c2e7 100644
--- a/crates/openhuman-core/src/core/bus.rs
+++ b/crates/openhuman-core/src/core/bus.rs
@@ -48,15 +48,14 @@ pub const EVENTS_ROOT: &str = "/ai/tinyhumans/openhuman/events";
/// The interface the event catalog is published under.
///
-/// A breaking change to the catalog ships as a **new interface name**
-/// (`Events2`), never as a redefinition — see `tinybus`'s protocol rules.
-pub const EVENTS_INTERFACE: &str = "ai.tinyhumans.openhuman.Events";
+/// Removing a variant breaks compatibility with peers that may still publish
+/// it, so a breaking catalog change ships under a new interface name.
+pub const EVENTS_INTERFACE: &str = "ai.tinyhumans.openhuman.Events2";
/// The version of the event catalog this build speaks.
///
-/// Bump the minor for an added variant or field; bump the major only for a
-/// change that an older subscriber cannot parse, and rename the interface when
-/// you do. Peers exchange this through [`manifest`], so a version skew between
+/// Bump the minor for an added variant or field; bump the major for a breaking
+/// change and publish it under a new interface name. Peers exchange this through [`manifest`], so a version skew between
/// the kernel and an out-of-process integration is reported at startup with
/// both numbers rather than as a decode failure later.
///
@@ -95,7 +94,9 @@ pub const EVENTS_INTERFACE: &str = "ai.tinyhumans.openhuman.Events";
/// `ComposioConnectionCreated` and `ComposioConfigChanged` (additive): a
/// subscriber rebuilds its dispatch context from it instead of reading an
/// ambient one.
-pub const EVENTS_VERSION: Version = Version::new(1, 13, 0);
+/// `2.0.0` removes `CronDeliveryRequested`; announce delivery now sends
+/// synchronously through the cron channel bridge.
+pub const EVENTS_VERSION: Version = Version::new(2, 0, 0);
/// The bus. Initialised once by [`init`]; safe to touch before that.
pub static BUS: OnceBus<DomainEvent> = OnceBus::new();
diff --git a/crates/openhuman-core/src/core/events.rs b/crates/openhuman-core/src/core/events.rs
index 38f968d1b6..749bfa3a2c 100644
--- a/crates/openhuman-core/src/core/events.rs
+++ b/crates/openhuman-core/src/core/events.rs
@@ -385,14 +385,6 @@ pub enum DomainEvent {
success: bool,
output: String,
},
- /// A cron job requests delivery of its output to a channel.
- CronDeliveryRequested {
- job_id: String,
- channel: String,
- target: String,
- output: String,
- },
-
/// A proactive message (morning briefing, welcome, cron output, etc.)
/// needs to be delivered to the user. The channels module routes it to
/// the user's active channel.
@@ -1386,7 +1378,6 @@ impl DomainEvent {
Self::CronJobTriggered { .. }
| Self::CronJobCompleted { .. }
- | Self::CronDeliveryRequested { .. }
| Self::ProactiveMessageRequested { .. }
| Self::CronSystemJobDue { .. }
| Self::FlowRunProgress { .. }
@@ -1518,7 +1509,6 @@ impl DomainEvent {
Self::ChannelDisconnected { .. } => "ChannelDisconnected",
Self::CronJobTriggered { .. } => "CronJobTriggered",
Self::CronJobCompleted { .. } => "CronJobCompleted",
- Self::CronDeliveryRequested { .. } => "CronDeliveryRequested",
Self::ProactiveMessageRequested { .. } => "ProactiveMessageRequested",
Self::CronSystemJobDue { .. } => "CronSystemJobDue",
Self::FlowRunProgress { .. } => "FlowRunProgress",
diff --git a/crates/openhuman-core/src/core/events_tests.rs b/crates/openhuman-core/src/core/events_tests.rs
index a9de36216e..2a53165a2d 100644
--- a/crates/openhuman-core/src/core/events_tests.rs
+++ b/crates/openhuman-core/src/core/events_tests.rs
@@ -205,15 +205,6 @@ fn all_variants_have_correct_domain() {
},
"cron",
),
- (
- DomainEvent::CronDeliveryRequested {
- job_id: "j".into(),
- channel: "c".into(),
- target: "t".into(),
- output: "o".into(),
- },
- "cron",
- ),
(
DomainEvent::ProactiveMessageRequested {
source: "cron:morning_briefing".into(),
diff --git a/crates/openhuman-core/src/cron/README.md b/crates/openhuman-core/src/cron/README.md
index cd6750519d..e08b6c0e6c 100644
--- a/crates/openhuman-core/src/cron/README.md
+++ b/crates/openhuman-core/src/cron/README.md
@@ -170,7 +170,7 @@ alerts tab and run history.
| --- | --- |
| `none` | Silent. Output lives in the job's `last_output` only. This is `DeliveryConfig::default()`. |
| `proactive` | Publishes `ProactiveMessageRequested`. `channels::proactive::ProactiveMessageSubscriber` pushes to the in-app web stream and mirrors to `channels_config.active_channel` when set. Used for briefings and other desktop-first output. |
-| `announce` | Requires `channel` and `to`. Publishes `CronDeliveryRequested`; `cron::bus::CronDeliverySubscriber` (`cron::delivery`) sends it through the named `tinychannels_bus::Channel`. The `cron_add` tool checks `to` against the channel's `allowed_users`. |
+| `announce` | Requires `channel` and `to`. Sends synchronously through `cron::channel_bridge::send_to_channel`; the run records `Delivered` only after the channel accepts the message, otherwise `Failed`. The `cron_add` tool checks `to` against the channel's `allowed_users`. |
| `origin` | Sends the reply back into the conversation that created the job ([`scheduler/origin_delivery.rs`](./scheduler/origin_delivery.rs)). Requires `CronJob.origin`. |
Origin delivery treats blank output or exactly `NO_REPLY` as `Suppressed`:
@@ -318,7 +318,6 @@ feature) nothing loads and every cron call answers `COMPONENT_DISABLED:tinyflows
| [`origin.rs`](./origin.rs) | `JobOrigin` capture from the live turn, the approval-gate exemption, and the turn origin a run executes under. |
| [`job_builder.rs`](./job_builder.rs) | `create_agent_job`: origin-aware defaults and delivery validation shared by the `cron` and `schedule` tools. |
| [`channel_bridge.rs`](./channel_bridge.rs) | Cron's handle on the channel runtime: per-chat history and live channels, registered by `start_channels`. |
-| [`bus.rs`](./bus.rs) | `CronDeliverySubscriber`, which sends `announce` output to a channel. |
| [`seed.rs`](./seed.rs) | Built-in proactive jobs and pruning of retired rows. |
| `system_jobs.rs` | `system:<name>` flow rows owned by other domains. |
| [`tools.rs`](./tools.rs), `tools/` | Agent tools. See [tools/README.md](tools/README.md). |
@@ -377,8 +376,6 @@ Cron publishes, through [`core/bus.rs`](../core/bus.rs), these `DomainEvent` var
(output truncated to 512 characters).
- `ProactiveMessageRequested` (`proactive` delivery), consumed by
`channels::proactive`.
-- `CronDeliveryRequested` (`announce` delivery), consumed by
- `cron::bus::CronDeliverySubscriber`.
- `CronSystemJobDue`, consumed by `memory::bus`.
## Who calls in
@@ -390,7 +387,7 @@ Cron publishes, through [`core/bus.rs`](../core/bus.rs), these `DomainEvent` var
- [`tools/impl/system/schedule.rs`](../tools/impl/system/schedule.rs) is the `schedule` tool, built on the same
store functions and `create_agent_job`.
- [`channels/runtime/startup/start_channels.rs`](../channels/runtime/startup/start_channels.rs) registers
- `CronDeliverySubscriber` and the channel bridge.
+ the channel bridge used by `announce` and origin delivery.
- [`flows/ops/triggers.rs`](../flows/ops/triggers.rs) creates and removes flow schedule rows
(`bind_schedule_trigger` / `unbind_schedule_trigger`), idempotent through
`find_flow_schedule_job`. These rows are never created by the `cron_add`
diff --git a/crates/openhuman-core/src/cron/bus.rs b/crates/openhuman-core/src/cron/bus.rs
deleted file mode 100644
index fe1a72afd7..0000000000
--- a/crates/openhuman-core/src/cron/bus.rs
+++ /dev/null
@@ -1,101 +0,0 @@
-//! Event bus handlers for the cron domain.
-//!
-//! When the cron scheduler needs to deliver job output to a channel (Telegram,
-//! Discord, Slack, etc.), it publishes a `CronDeliveryRequested` event instead
-//! of directly constructing channel instances. The [`CronDeliverySubscriber`]
-//! picks up those events and dispatches to the appropriate channel, keeping
-//! channel construction out of the scheduler.
-
-use crate::core::events::DomainEvent;
-use async_trait::async_trait;
-use std::collections::HashMap;
-use std::sync::Arc;
-use tinybus::EventHandler;
-use tinychannels_bus::{Channel, SendMessage};
-
-/// Subscribes to `CronDeliveryRequested` events and dispatches
-/// the output to the named channel.
-pub struct CronDeliverySubscriber {
- channels_by_name: Arc<HashMap<String, Arc<dyn Channel>>>,
-}
-
-impl CronDeliverySubscriber {
- pub fn new(channels_by_name: Arc<HashMap<String, Arc<dyn Channel>>>) -> Self {
- Self { channels_by_name }
- }
-}
-
-#[async_trait]
-impl EventHandler<DomainEvent> for CronDeliverySubscriber {
- fn name(&self) -> &str {
- "cron::delivery"
- }
-
- fn domains(&self) -> Option<&[&str]> {
- Some(&["cron"])
- }
-
- async fn handle(&self, event: &DomainEvent) {
- let DomainEvent::CronDeliveryRequested {
- job_id,
- channel,
- target,
- output,
- } = event
- else {
- return;
- };
-
- tracing::debug!(
- job_id = %job_id,
- channel = %channel,
- target = %target,
- output_len = output.len(),
- "[cron] handling delivery request"
- );
-
- let channel_lower = channel.to_ascii_lowercase();
- if let Some(ch) = self.channels_by_name.get(&channel_lower) {
- match ch.send(&SendMessage::new(output, target)).await {
- Ok(()) => {
- tracing::debug!(
- job_id = %job_id,
- channel = %channel_lower,
- "[cron] delivery succeeded"
- );
- }
- Err(e) => {
- crate::core::observability::report_error(
- &e,
- "cron",
- "delivery",
- &[
- ("job_id", job_id.as_str()),
- ("channel", channel_lower.as_str()),
- ("failure", "channel_send"),
- ],
- );
- }
- }
- } else {
- let msg = format!(
- "no matching channel '{}' found for cron delivery (job {})",
- channel_lower, job_id
- );
- crate::core::observability::report_error(
- msg.as_str(),
- "cron",
- "delivery",
- &[
- ("job_id", job_id.as_str()),
- ("channel", channel_lower.as_str()),
- ("failure", "channel_missing"),
- ],
- );
- }
- }
-}
-
-#[cfg(test)]
-#[path = "bus_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/cron/bus_tests.rs b/crates/openhuman-core/src/cron/bus_tests.rs
deleted file mode 100644
index 643cda71d1..0000000000
--- a/crates/openhuman-core/src/cron/bus_tests.rs
+++ /dev/null
@@ -1,102 +0,0 @@
-use super::*;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use tinychannels_bus::ChannelMessage;
-use tokio::sync::mpsc;
-
-/// Minimal mock channel that tracks send() calls.
-struct MockChannel {
- name: String,
- send_count: Arc<AtomicUsize>,
- fail: bool,
-}
-
-#[async_trait]
-impl Channel for MockChannel {
- fn name(&self) -> &str {
- &self.name
- }
- async fn send(&self, _message: &SendMessage) -> anyhow::Result<()> {
- self.send_count.fetch_add(1, Ordering::SeqCst);
- if self.fail {
- anyhow::bail!("mock send failure");
- }
- Ok(())
- }
- async fn listen(&self, _tx: mpsc::Sender<ChannelMessage>) -> anyhow::Result<()> {
- Ok(())
- }
-}
-
-fn delivery_event(channel: &str) -> DomainEvent {
- DomainEvent::CronDeliveryRequested {
- job_id: "test-job".into(),
- channel: channel.into(),
- target: "chat-123".into(),
- output: "hello".into(),
- }
-}
-
-fn make_subscriber(channels: Vec<Arc<dyn Channel>>) -> CronDeliverySubscriber {
- let map: HashMap<String, Arc<dyn Channel>> = channels
- .into_iter()
- .map(|c| (c.name().to_string(), c))
- .collect();
- CronDeliverySubscriber::new(Arc::new(map))
-}
-
-#[tokio::test]
-async fn ignores_non_delivery_events() {
- let send_count = Arc::new(AtomicUsize::new(0));
- let ch: Arc<dyn Channel> = Arc::new(MockChannel {
- name: "telegram".into(),
- send_count: Arc::clone(&send_count),
- fail: false,
- });
- let sub = make_subscriber(vec![ch]);
-
- sub.handle(&DomainEvent::CronJobTriggered {
- job_id: "j1".into(),
- job_name: "test-job".into(),
- job_type: "shell".into(),
- })
- .await;
-
- assert_eq!(send_count.load(Ordering::SeqCst), 0);
-}
-
-#[tokio::test]
-async fn dispatches_to_matching_channel() {
- let send_count = Arc::new(AtomicUsize::new(0));
- let ch: Arc<dyn Channel> = Arc::new(MockChannel {
- name: "telegram".into(),
- send_count: Arc::clone(&send_count),
- fail: false,
- });
- let sub = make_subscriber(vec![ch]);
-
- sub.handle(&delivery_event("Telegram")).await;
-
- assert_eq!(send_count.load(Ordering::SeqCst), 1);
-}
-
-#[tokio::test]
-async fn missing_channel_does_not_panic() {
- let sub = make_subscriber(vec![]);
- // Should log a warning but not panic.
- sub.handle(&delivery_event("nonexistent")).await;
-}
-
-#[tokio::test]
-async fn send_failure_does_not_panic() {
- let send_count = Arc::new(AtomicUsize::new(0));
- let ch: Arc<dyn Channel> = Arc::new(MockChannel {
- name: "slack".into(),
- send_count: Arc::clone(&send_count),
- fail: true,
- });
- let sub = make_subscriber(vec![ch]);
-
- // Should log a warning but not panic.
- sub.handle(&delivery_event("slack")).await;
- assert_eq!(send_count.load(Ordering::SeqCst), 1);
-}
diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rs
index aa6656ca6e..7e984ceed7 100644
--- a/crates/openhuman-core/src/cron/mod.rs
+++ b/crates/openhuman-core/src/cron/mod.rs
@@ -12,7 +12,6 @@
// Host-condition policy (battery / AC / CPU) that throttles background LLM
// work such as memory digests. The cron poll loop itself does not consult it.
-pub mod bus;
pub(crate) mod bus_host;
pub mod channel_bridge;
pub(crate) mod client;
diff --git a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
index b87778bc15..0306180363 100644
--- a/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
+++ b/crates/openhuman-core/src/cron/scheduler_halt_and_persist_tests.rs
@@ -562,71 +562,6 @@ async fn deliver_if_configured_skips_non_announce_mode() {
.is_ok());
}
-#[tokio::test]
-async fn deliver_if_configured_publishes_event_for_announce_mode() {
- use crate::core::events::DomainEvent;
- use std::sync::atomic::{AtomicUsize, Ordering};
- use tinybus::EventHandler;
-
- // Create an isolated bus for this test.
- let bus = crate::core::bus_testing::isolated_bus().await;
-
- let received = Arc::new(AtomicUsize::new(0));
- let received_clone = Arc::clone(&received);
-
- struct Counter(Arc<AtomicUsize>);
-
- #[async_trait::async_trait]
- impl EventHandler<DomainEvent> for Counter {
- fn name(&self) -> &str {
- "test::counter"
- }
- fn domains(&self) -> Option<&[&str]> {
- Some(&["cron"])
- }
- async fn handle(&self, event: &DomainEvent) {
- if matches!(event, DomainEvent::CronDeliveryRequested { .. }) {
- self.0.fetch_add(1, Ordering::SeqCst);
- }
- }
- }
-
- let _handle = bus.subscribe(Arc::new(Counter(received_clone)));
-
- // Publish directly on the test bus (bypasses the global singleton).
- let tmp = TempDir::new().unwrap();
- let config = test_config(&tmp).await;
- let mut job = test_job("echo ok");
- job.delivery = DeliveryConfig {
- mode: "announce".into(),
- channel: Some("telegram".into()),
- to: Some("chat-123".into()),
- best_effort: true,
- };
-
- // Manually publish the same event deliver_if_configured would produce.
- bus.publish(DomainEvent::CronDeliveryRequested {
- job_id: job.id.clone(),
- channel: "telegram".into(),
- target: "chat-123".into(),
- output: "hello".into(),
- });
-
- tokio::time::sleep(std::time::Duration::from_millis(50)).await;
- assert_eq!(received.load(Ordering::SeqCst), 1);
-
- // Also verify the function itself succeeds.
- assert!(deliver_if_configured(
- &crate::core::runtime::DispatchCtx::ambient(),
- &config,
- &job,
- "hello",
- true
- )
- .await
- .is_ok());
-}
-
#[test]
fn is_env_assignment_true() {
assert!(is_env_assignment("FOO=bar"));
diff --git a/crates/openhuman-core/src/mcp/registry/bus.rs b/crates/openhuman-core/src/mcp/registry/bus.rs
index 7004d746ed..3d59cd9e0a 100644
--- a/crates/openhuman-core/src/mcp/registry/bus.rs
+++ b/crates/openhuman-core/src/mcp/registry/bus.rs
@@ -76,8 +76,7 @@ impl EventHandler<DomainEvent> for McpClientEventSubscriber {
/// Register the MCP client event subscriber at startup.
///
-/// Call this from wherever other domain subscribers are registered
-/// (e.g. alongside `CronDeliverySubscriber::new(...)` in core startup).
+/// Call this from wherever other domain subscribers are registered.
pub fn init() {
use crate::core::bus::BUS;
use std::sync::Arc;