The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/cron/bus_host_tests.rs,crates/openhuman-core/src/cron
Steven Enamakel84af1ce3ae5a
diff --git a/crates/openhuman-core/src/cron/bus_host_tests.rs b/crates/openhuman-core/src/cron/bus_host_tests.rsindex 91355d42a3..b89dfd5541 100644--- a/crates/openhuman-core/src/cron/bus_host_tests.rs+++ b/crates/openhuman-core/src/cron/bus_host_tests.rs@@ -3,13 +3,13 @@use super::*;use crate::cron::handlers::{- kind_handler, register_kind, JobKindHandler, JobOutcome, JobRunContext,+ JobKindHandler, JobOutcome, JobRunContext, kind_handler, register_kind,};use async_trait::async_trait;use std::sync::atomic::{AtomicUsize, Ordering};use tempfile::TempDir;use tinyflows_bus::schedule::types::Schedule;-use tinyflows_bus::schedule::{callbacks, CALLBACK_INTERFACE};+use tinyflows_bus::schedule::{CALLBACK_INTERFACE, callbacks};fn config(tmp: &TempDir) -> Config {let config = Config {diff --git a/crates/openhuman-core/src/cron/client.rs b/crates/openhuman-core/src/cron/client.rsindex 941ad5d7b4..54729b3739 100644--- a/crates/openhuman-core/src/cron/client.rs+++ b/crates/openhuman-core/src/cron/client.rs@@ -12,14 +12,14 @@//! Every call logs `[cron:bus]` with the member (never a payload) so a failing//! call is greppable.-use anyhow::{anyhow, Result};+use anyhow::{Result, anyhow};use chrono::{DateTime, Duration, Utc};-use serde::{de::DeserializeOwned, Serialize};+use serde::{Serialize, de::DeserializeOwned};use serde_json::Value;use tinyflows_bus::schedule::{- members, CheckOriginRequest, CheckPatchRequest, DeliveryConfig, JobOrigin, NextRunRequest,+ CheckOriginRequest, CheckPatchRequest, DeliveryConfig, JobOrigin, NextRunRequest,RunsCloserThanRequest, Schedule, SessionTarget, StoreBackend, StoreConfig, StoreOperation,- StoreRequest, TooFrequent, ValidateScheduleRequest,+ StoreRequest, TooFrequent, ValidateScheduleRequest, members,};use tinyflows_bus::schedule::{CronJob, CronJobPatch};diff --git a/crates/openhuman-core/src/cron/client_tests.rs b/crates/openhuman-core/src/cron/client_tests.rsindex bf06069b1d..9fbd63f7c2 100644--- a/crates/openhuman-core/src/cron/client_tests.rs+++ b/crates/openhuman-core/src/cron/client_tests.rs@@ -31,13 +31,17 @@ async fn schedules_are_validated_and_the_agent_floor_applies() {validate_schedule(&config, &every_minute, at(8), false).await.unwrap();- assert!(validate_schedule(&config, &every_minute, at(8), true)- .await- .is_err());+ assert!(+ validate_schedule(&config, &every_minute, at(8), true)+ .await+ .is_err()+ );let past = Schedule::At { at: at(1) };- assert!(validate_schedule(&config, &past, at(8), false)- .await- .is_err());+ assert!(+ validate_schedule(&config, &past, at(8), false)+ .await+ .is_err()+ );}#[tokio::test]@@ -47,10 +51,12 @@ async fn expressions_normalise_and_report_their_cron_form() {normalize_expression(&config, "0 9 * * 1-5").await.unwrap(),"0 0 9 * * 2-6");- assert!(schedule_cron_expression(&config, &cron("0 9 * * *"))- .await- .unwrap()- .is_some());+ assert!(+ schedule_cron_expression(&config, &cron("0 9 * * *"))+ .await+ .unwrap()+ .is_some()+ );assert!(schedule_cron_expression(&config, &Schedule::Every { every_ms: 1000 }).awaitdiff --git a/crates/openhuman-core/src/cron/cutover_tests.rs b/crates/openhuman-core/src/cron/cutover_tests.rsindex 65b5da3e06..08ad47ab76 100644--- a/crates/openhuman-core/src/cron/cutover_tests.rs+++ b/crates/openhuman-core/src/cron/cutover_tests.rs@@ -7,8 +7,8 @@ use super::*;use crate::config::Config;use crate::memory::lifecycle::jobs::BACKGROUND_JOB;use crate::security::SecurityPolicy;-use std::sync::atomic::{AtomicUsize, Ordering};use std::sync::Arc;+use std::sync::atomic::{AtomicUsize, Ordering};use tempfile::TempDir;fn config(tmp: &TempDir) -> Config {diff --git a/crates/openhuman-core/src/cron/documents_port.rs b/crates/openhuman-core/src/cron/documents_port.rsindex 4e9c801894..87b4c943e1 100644--- a/crates/openhuman-core/src/cron/documents_port.rs+++ b/crates/openhuman-core/src/cron/documents_port.rs@@ -24,7 +24,7 @@ use std::path::PathBuf;use std::sync::{Arc, LazyLock};use anyhow::{Context, Result};-use serde_json::{json, Value};+use serde_json::{Value, json};use tinybus::Result as BusResult;use tinyflows_bus::schedule::CallbackAddress;use tinystoragedrivers::{diff --git a/crates/openhuman-core/src/cron/job_builder.rs b/crates/openhuman-core/src/cron/job_builder.rsindex c198e83d14..e3efdcb594 100644--- a/crates/openhuman-core/src/cron/job_builder.rs+++ b/crates/openhuman-core/src/cron/job_builder.rs@@ -9,10 +9,10 @@use crate::config::Config;use {- crate::cron, tinyflows_bus::schedule::types::delivery_mode,- tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::DeliveryConfig,- tinyflows_bus::schedule::types::JobOrigin, tinyflows_bus::schedule::types::Schedule,- tinyflows_bus::schedule::types::SessionTarget, tinyflows_bus::schedule::AgentJobSpec,+ crate::cron, tinyflows_bus::schedule::AgentJobSpec, tinyflows_bus::schedule::types::CronJob,+ tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::JobOrigin,+ tinyflows_bus::schedule::types::Schedule, tinyflows_bus::schedule::types::SessionTarget,+ tinyflows_bus::schedule::types::delivery_mode,};/// What an agent job creation request carries; everything defaults.diff --git a/crates/openhuman-core/src/cron/job_builder_tests.rs b/crates/openhuman-core/src/cron/job_builder_tests.rsindex 4e460fe17f..ef6166edda 100644--- a/crates/openhuman-core/src/cron/job_builder_tests.rs+++ b/crates/openhuman-core/src/cron/job_builder_tests.rs@@ -95,14 +95,18 @@ fn origin_delivery_or_current_target_without_an_origin_is_an_error() {}).unwrap(),);- assert!(create_agent_job(&cfg, i, None)- .unwrap_err()- .contains("origin"));+ assert!(+ create_agent_job(&cfg, i, None)+ .unwrap_err()+ .contains("origin")+ );let mut i = input();i.session_target = Some(SessionTarget::Current);- assert!(create_agent_job(&cfg, i, None)- .unwrap_err()- .contains("current"));+ assert!(+ create_agent_job(&cfg, i, None)+ .unwrap_err()+ .contains("current")+ );}fn announce(channel_name: &str, to: &str) -> DeliveryConfig {diff --git a/crates/openhuman-core/src/cron/limits.rs b/crates/openhuman-core/src/cron/limits.rsindex fc60190284..846111673b 100644--- a/crates/openhuman-core/src/cron/limits.rs+++ b/crates/openhuman-core/src/cron/limits.rs@@ -9,12 +9,12 @@//! changed ([`super::store`]) and again where it runs, so a row written before//! the mode was switched on is refused too.-use anyhow::{bail, Result};+use anyhow::{Result, bail};use chrono::{Duration, Utc};use crate::config::Config;use crate::cron::{- delivery_mode, list_jobs, CronJob, CronJobPatch, DeliveryConfig, JobType, Schedule,+ CronJob, CronJobPatch, DeliveryConfig, JobType, Schedule, delivery_mode, list_jobs,};/// Whether `config` restricts cron to agent jobs.diff --git a/crates/openhuman-core/src/cron/limits_tests.rs b/crates/openhuman-core/src/cron/limits_tests.rsindex 472919bb73..2af9149b08 100644--- a/crates/openhuman-core/src/cron/limits_tests.rs+++ b/crates/openhuman-core/src/cron/limits_tests.rs@@ -1,9 +1,9 @@//! The agent-only limits: what is refused at add, update and run.use super::*;-use crate::cron::job_builder::{create_agent_job, AgentJobInput};+use crate::cron::job_builder::{AgentJobInput, create_agent_job};use crate::cron::limits;-use crate::cron::{add_job, add_shell_job, get_job, update_job, JobOrigin};+use crate::cron::{JobOrigin, add_job, add_shell_job, get_job, update_job};use tempfile::TempDir;fn limited(tmp: &TempDir) -> Config {@@ -54,14 +54,16 @@ fn shell_and_flow_jobs_are_refused() {assert!(add_shell_job(&config, None, every.clone(), "echo hi").is_err());assert!(add_job(&config, "*/10 * * * *", "echo hi").is_err());assert!(crate::cron::add_flow_schedule_job(&config, "flow", every).is_err());- assert!(limits::check_patch(- &config,- &CronJobPatch {- command: Some("echo hi".into()),- ..CronJobPatch::default()- }- )- .is_err());+ assert!(+ limits::check_patch(+ &config,+ &CronJobPatch {+ command: Some("echo hi".into()),+ ..CronJobPatch::default()+ }+ )+ .is_err()+ );}#[test]@@ -83,24 +85,28 @@ fn jobs_need_a_conversation_and_may_not_pick_a_destination() {}let job = create_agent_job(&config, input(600_000, None), origin()).unwrap();assert_eq!(job.delivery.mode, "origin");- assert!(update_job(- &config,- &job.id,- CronJobPatch {- delivery: Some(delivery("announce")),- ..CronJobPatch::default()- }- )- .is_err());- assert!(update_job(- &config,- &job.id,- CronJobPatch {- origin: Some(None),- ..CronJobPatch::default()- }- )- .is_err());+ assert!(+ update_job(+ &config,+ &job.id,+ CronJobPatch {+ delivery: Some(delivery("announce")),+ ..CronJobPatch::default()+ }+ )+ .is_err()+ );+ assert!(+ update_job(+ &config,+ &job.id,+ CronJobPatch {+ origin: Some(None),+ ..CronJobPatch::default()+ }+ )+ .is_err()+ );}#[test]@@ -163,21 +169,27 @@ async fn run_now_refuses_a_stored_job_that_breaks_the_limits() {let shell =add_shell_job(&config, None, Schedule::Every { every_ms: 600_000 }, "echo").unwrap();config.cron.agent_jobs_only = true;- assert!(crate::cron::ops::run_job_now(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &shell.id- )- .await- .is_err());- assert!(crate::cron::ops::cron_run(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &shell.id- )- .await- .is_err());- assert!(crate::cron::list_runs(&config, &shell.id, 10)- .unwrap()- .is_empty());+ assert!(+ crate::cron::ops::run_job_now(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &shell.id+ )+ .await+ .is_err()+ );+ assert!(+ crate::cron::ops::cron_run(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &shell.id+ )+ .await+ .is_err()+ );+ assert!(+ crate::cron::list_runs(&config, &shell.id, 10)+ .unwrap()+ .is_empty()+ );}diff --git a/crates/openhuman-core/src/cron/mod.rs b/crates/openhuman-core/src/cron/mod.rsindex ff65343000..4ae6508a09 100644--- a/crates/openhuman-core/src/cron/mod.rs+++ b/crates/openhuman-core/src/cron/mod.rs@@ -71,4 +71,4 @@ pub use tinyflows_bus::schedule::types::{ActiveHours, CronJob, CronJobPatch, CronRun, DeliveryConfig, DeliveryStatus, JobOrigin,JobType, Schedule, SessionTarget,};-pub use tinyflows_bus::schedule::{AgentJobSpec, JobPolicy, TooFrequent, MIN_AGENT_JOB_INTERVAL};+pub use tinyflows_bus::schedule::{AgentJobSpec, JobPolicy, MIN_AGENT_JOB_INTERVAL, TooFrequent};diff --git a/crates/openhuman-core/src/cron/ops_tests.rs b/crates/openhuman-core/src/cron/ops_tests.rsindex f25b49be45..cf6bffcd82 100644--- a/crates/openhuman-core/src/cron/ops_tests.rs+++ b/crates/openhuman-core/src/cron/ops_tests.rs@@ -178,9 +178,10 @@ fn update_fails_when_no_fields_provided() {let job = make_job(&config, "*/5 * * * *", None, "echo test");let err = run_update(&config, &job.id, None, None, None, None).unwrap_err();- assert!(err- .to_string()- .contains("At least one of --expression, --tz, --command, or --name"));+ assert!(+ err.to_string()+ .contains("At least one of --expression, --tz, --command, or --name")+ );}#[test]@@ -191,9 +192,10 @@ fn update_rejects_expression_for_non_cron_schedule() {let job = add_shell_job(&config, None, Schedule::At { at }, "echo test").unwrap();let err = run_update(&config, &job.id, Some("0 9 * * *"), None, None, None).unwrap_err();- assert!(err- .to_string()- .contains("Cannot update expression/tz on a non-cron schedule"));+ assert!(+ err.to_string()+ .contains("Cannot update expression/tz on a non-cron schedule")+ );}// ── add_once ────────────────────────────────────────────────────@@ -615,11 +617,13 @@ async fn run_job_now_refuses_a_job_that_is_already_running() {async fn run_job_now_reports_an_unknown_job() {let tmp = TempDir::new().unwrap();let config = test_config(&tmp);- assert!(run_job_now(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- "no-such-job"- )- .await- .is_err());+ assert!(+ run_job_now(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ "no-such-job"+ )+ .await+ .is_err()+ );}diff --git a/crates/openhuman-core/src/cron/origin.rs b/crates/openhuman-core/src/cron/origin.rsindex c0a4ccba34..1b80c6e00b 100644--- a/crates/openhuman-core/src/cron/origin.rs+++ b/crates/openhuman-core/src/cron/origin.rs@@ -10,8 +10,8 @@use crate::agent::turn_origin::{self, AgentTurnOrigin};use serde_json::Value;use {- tinyflows_bus::schedule::types::delivery_mode, tinyflows_bus::schedule::types::CronJob,- tinyflows_bus::schedule::types::JobOrigin,+ tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::JobOrigin,+ tinyflows_bus::schedule::types::delivery_mode,};/// Map a live turn origin onto the origin a job created in it records.diff --git a/crates/openhuman-core/src/cron/origin_tests.rs b/crates/openhuman-core/src/cron/origin_tests.rsindex 42dfe1da84..c7aebf58de 100644--- a/crates/openhuman-core/src/cron/origin_tests.rs+++ b/crates/openhuman-core/src/cron/origin_tests.rs@@ -1,5 +1,5 @@use super::*;-use crate::agent::turn_origin::{with_origin, TrustedAutomationSource};+use crate::agent::turn_origin::{TrustedAutomationSource, with_origin};use serde_json::json;use tinyflows_bus::schedule::types::{ChannelConversationIdentity, ChannelSessionIdentity, Schedule,diff --git a/crates/openhuman-core/src/cron/scheduler.rs b/crates/openhuman-core/src/cron/scheduler.rsindex d0e9df0605..ce6dfb29b3 100644--- a/crates/openhuman-core/src/cron/scheduler.rs+++ b/crates/openhuman-core/src/cron/scheduler.rs@@ -46,19 +46,19 @@ pub use delivery::deliver_job;use crate::config::Config;use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{self, Binding, HostRegistration, CLAIM_SCOPE};+use crate::cron::bus_host::{self, Binding, CLAIM_SCOPE, HostRegistration};use crate::cron::documents_port::DocScope;use crate::modules::tinyflows as module;use crate::security::SecurityPolicy;-use anyhow::{anyhow, Result};-use serde_json::{json, Value};+use anyhow::{Result, anyhow};+use serde_json::{Value, json};use std::collections::{HashMap, HashSet};use std::sync::atomic::{AtomicBool, Ordering};use std::sync::{Arc, LazyLock, Mutex};use tinyflows_bus::schedule::types::CronJob;use tinyflows_bus::schedule::{- members, Attempt, ManualDelivery, RunJobNow, RunJobReply, StartScheduler, StoreBackend,- StoreConfig,+ Attempt, ManualDelivery, RunJobNow, RunJobReply, StartScheduler, StoreBackend, StoreConfig,+ members,};use tokio::time::{self, Duration};diff --git a/crates/openhuman-core/src/cron/scheduler/delivery.rs b/crates/openhuman-core/src/cron/scheduler/delivery.rsindex 1a3bcb02ff..36549ff15a 100644--- a/crates/openhuman-core/src/cron/scheduler/delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/delivery.rs@@ -10,9 +10,9 @@ use crate::core::events::DomainEvent;use anyhow::Result;use chrono::Utc;use {- tinyflows_bus::schedule::types::delivery_mode, tinyflows_bus::schedule::types::CronJob,- tinyflows_bus::schedule::types::DeliveryConfig, tinyflows_bus::schedule::types::DeliveryStatus,- tinyflows_bus::schedule::types::JobType,+ tinyflows_bus::schedule::types::CronJob, tinyflows_bus::schedule::types::DeliveryConfig,+ tinyflows_bus::schedule::types::DeliveryStatus, tinyflows_bus::schedule::types::JobType,+ tinyflows_bus::schedule::types::delivery_mode,};pub(super) const MORNING_BRIEFING_AGENT_ID: &str = "morning_briefing";diff --git a/crates/openhuman-core/src/cron/scheduler/executor.rs b/crates/openhuman-core/src/cron/scheduler/executor.rsindex 7bbf7e5c04..21d5355372 100644--- a/crates/openhuman-core/src/cron/scheduler/executor.rs+++ b/crates/openhuman-core/src/cron/scheduler/executor.rs@@ -16,12 +16,12 @@ use super::failure_classification::{};use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{kind_refusal, Binding};-use crate::cron::handlers::{kind_handler, JobRunContext};+use crate::cron::bus_host::{Binding, kind_refusal};+use crate::cron::handlers::{JobRunContext, kind_handler};use std::collections::HashMap;use std::sync::Mutex;-use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};use tinyflows_bus::schedule::Attempt;+use tinyflows_bus::schedule::types::{CronJob, JobType, SessionTarget};/// Run states kept before the map is cleared outright (a run whose task was/// aborted never reaches `failed`).diff --git a/crates/openhuman-core/src/cron/scheduler/failure_classification.rs b/crates/openhuman-core/src/cron/scheduler/failure_classification.rsindex 99e9982875..97af0452b0 100644--- a/crates/openhuman-core/src/cron/scheduler/failure_classification.rs+++ b/crates/openhuman-core/src/cron/scheduler/failure_classification.rs@@ -11,10 +11,8 @@ pub(super) const AGENT_JOB_USER_FAILURE_MESSAGE: &str = "Something went wrong. P// whose job halts on a permanent config/billing state sees the exact next step// instead of "Something went wrong". Static `&'static str` only — they carry no// `err` fields, honouring the no-leak contract on `agent_error_to_user_message`.-pub(super) const CRON_HALT_API_KEY_UNSET_MESSAGE: &str =- "No API key is set for your AI provider. Add it in Connections \u{2192} API keys \u{2192} LLM, then re-run.";-pub(super) const CRON_HALT_INSUFFICIENT_CREDITS_MESSAGE: &str =- "Your AI provider is out of credits. Top it up or update its key in Connections \u{2192} API keys \u{2192} LLM.";+pub(super) const CRON_HALT_API_KEY_UNSET_MESSAGE: &str = "No API key is set for your AI provider. Add it in Connections \u{2192} API keys \u{2192} LLM, then re-run.";+pub(super) const CRON_HALT_INSUFFICIENT_CREDITS_MESSAGE: &str = "Your AI provider is out of credits. Top it up or update its key in Connections \u{2192} API keys \u{2192} LLM.";pub(super) const CRON_HALT_BUDGET_EXHAUSTED_MESSAGE: &str ="You've reached your managed AI budget. Raise it in Settings \u{2192} Billing.";@@ -34,10 +32,14 @@ pub(super) const CRON_HALT_BUDGET_EXHAUSTED_MESSAGE: &str =/// [`AGENT_JOB_USER_FAILURE_MESSAGE`], preserving today's behaviour.pub(super) fn agent_error_to_user_message(err: &AgentError) -> &'static str {match err {- AgentError::ProviderError { retryable: true, .. } => {+ AgentError::ProviderError {+ retryable: true, ..+ } => {"The model provider is temporarily unavailable. The next run will retry automatically."}- AgentError::ProviderError { retryable: false, .. } => {+ AgentError::ProviderError {+ retryable: false, ..+ } => {"The model provider rejected the request. Check provider credentials in Connections \u{2192} API keys \u{2192} LLM."}AgentError::ContextLimitExceeded { .. } => {diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rsindex bddad78041..02dfcdc6c9 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery.rs@@ -14,12 +14,12 @@use super::delivery::strip_openhuman_link_markup;use crate::config::Config;use crate::core::runtime::DispatchCtx;-use crate::web_chat::{publish_web_channel_event, WebChannelEvent};-use anyhow::{anyhow, Result};-use std::path::Path;-use tinyflows_bus::schedule::types::{CronJob, DeliveryStatus, JobOrigin};#[cfg(feature = "channels")]use crate::cron::channel_bridge;+use crate::web_chat::{WebChannelEvent, publish_web_channel_event};+use anyhow::{Result, anyhow};+use std::path::Path;+use tinyflows_bus::schedule::types::{CronJob, DeliveryStatus, JobOrigin};/// What a scheduled run replies when it has nothing worth sending.pub(crate) const NO_REPLY: &str = "NO_REPLY";@@ -71,8 +71,8 @@ pub(crate) async fn append_to_origin_transcript(append: &TranscriptAppend<'_>,) -> Result<(), String> {use tinyagents_session::transcript::{- append_background_message_in, BackgroundAppend, BackgroundAppendOutcome, SessionRef,- TranscriptMessage,+ BackgroundAppend, BackgroundAppendOutcome, SessionRef, TranscriptMessage,+ append_background_message_in,};let session = SessionRef::scoped(append.session_key.to_string(), append.agent_id.to_string());let options = BackgroundAppend::new(@@ -243,43 +243,45 @@ pub(crate) async fn deliver_to_origin(}#[cfg(feature = "channels")]{- let identity = channel_session- .as_deref()- .ok_or_else(|| anyhow!("channel origin has no durable session identity"))?;- let (session_key, agent_id, _tenant) =- super::origin_context::validated_channel_session(ctx, config, channel, identity)+ let identity = channel_session+ .as_deref()+ .ok_or_else(|| anyhow!("channel origin has no durable session identity"))?;+ let (session_key, agent_id, _tenant) =+ super::origin_context::validated_channel_session(+ ctx, config, channel, identity,+ ).map_err(|error| anyhow!("invalid channel origin: {error}"))?;- let text = strip_openhuman_link_markup(text);- channel_bridge::send_to_channel(- channel,- identity,- reply_target,- &text,- &origin_request_id(&job.id, run_id),- )- .await- .map_err(|e| anyhow!(e))?;- let transcripts = origin_channel_transcripts(ctx, config, identity, &agent_id)?;- append_to_origin_transcript(- transcripts.as_ref(),- &TranscriptAppend {- session_key: &session_key,- agent_id: &agent_id,- text: &text,- idempotency_key: &origin_request_id(&job.id, run_id),- job_id: &job.id,- run_id,- },- )- .await- .map_err(|error| anyhow!("could not persist channel origin reply: {error}"))?;- tracing::debug!(- job_id = %job.id,- run_id = %run_id,- channel = %channel,- "[cron] origin delivery sent to channel"- );- Ok(DeliveryStatus::Delivered)+ let text = strip_openhuman_link_markup(text);+ channel_bridge::send_to_channel(+ channel,+ identity,+ reply_target,+ &text,+ &origin_request_id(&job.id, run_id),+ )+ .await+ .map_err(|e| anyhow!(e))?;+ let transcripts = origin_channel_transcripts(ctx, config, identity, &agent_id)?;+ append_to_origin_transcript(+ transcripts.as_ref(),+ &TranscriptAppend {+ session_key: &session_key,+ agent_id: &agent_id,+ text: &text,+ idempotency_key: &origin_request_id(&job.id, run_id),+ job_id: &job.id,+ run_id,+ },+ )+ .await+ .map_err(|error| anyhow!("could not persist channel origin reply: {error}"))?;+ tracing::debug!(+ job_id = %job.id,+ run_id = %run_id,+ channel = %channel,+ "[cron] origin delivery sent to channel"+ );+ Ok(DeliveryStatus::Delivered)}}}diff --git a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rsindex d67b00b437..5e773bfb6e 100644--- a/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler/origin_delivery_tests.rs@@ -99,13 +99,15 @@ async fn no_reply_is_suppressed_without_writing_anything() {.await.unwrap();assert_eq!(status, DeliveryStatus::Suppressed);- assert!(conversations::get_messages(- &crate::core::runtime::DispatchCtx::ambient(),- cfg.workspace_dir.clone(),- "t-1"- )- .unwrap()- .is_empty());+ assert!(+ conversations::get_messages(+ &crate::core::runtime::DispatchCtx::ambient(),+ cfg.workspace_dir.clone(),+ "t-1"+ )+ .unwrap()+ .is_empty()+ );}#[tokio::test]@@ -182,15 +184,17 @@ async fn web_delivery_to_a_missing_thread_fails() {async fn origin_mode_without_an_origin_is_an_error() {let tmp = tempfile::TempDir::new().unwrap();let cfg = config(&tmp);- assert!(deliver_to_origin(- &crate::core::runtime::DispatchCtx::ambient(),- &cfg,- &job(None),- "run-1",- "hi"- )- .await- .is_err());+ assert!(+ deliver_to_origin(+ &crate::core::runtime::DispatchCtx::ambient(),+ &cfg,+ &job(None),+ "run-1",+ "hi"+ )+ .await+ .is_err()+ );}fn meta() -> TranscriptMeta {diff --git a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs b/crates/openhuman-core/src/cron/scheduler/run_delivery.rsindex 9d583b4e6a..015e733276 100644--- a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/run_delivery.rs@@ -11,8 +11,8 @@use super::delivery::deliver_run;use crate::core::bus::BUS;use crate::core::events::DomainEvent;-use crate::cron::bus_host::{kind_refusal, Binding};-use crate::cron::handlers::{kind_handler, JobRunContext};+use crate::cron::bus_host::{Binding, kind_refusal};+use crate::cron::handlers::{JobRunContext, kind_handler};use anyhow::Result;use chrono::Utc;use tinyflows_bus::schedule::types::{diff --git a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rsindex 714a36b771..052be539f7 100644--- a/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_classifier_and_delivery_tests.rs@@ -13,15 +13,17 @@ async fn deliver_if_configured_skips_empty_mode() {let config = test_config(&tmp).await;let mut job = test_job("echo ok");job.delivery.mode = "".into();- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "output",- true- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "output",+ true+ )+ .await+ .is_ok()+ );}#[tokio::test]@@ -79,15 +81,17 @@ async fn deliver_if_configured_proactive_mode_succeeds() {to: None,best_effort: true,};- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "hello",- true- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok()+ );}// ──────────────────────────────────────────────────────────────────────@@ -648,15 +652,17 @@ async fn deliver_if_configured_failure_skips_chat_but_alerts() {let config = test_config(&tmp).await;let job = proactive_job();// Failed run (non-empty canned error): no chat injection, but still alerts.- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "Something went wrong.",- false- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "Something went wrong.",+ false+ )+ .await+ .is_ok()+ );assert_eq!(cron_alerts(&config).await, 1);}@@ -666,15 +672,17 @@ async fn deliver_if_configured_empty_failure_alerts_with_fallback_body() {let config = test_config(&tmp).await;let job = proactive_job();// Empty failed run: still surfaces in /notifications with a fallback body.- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- false- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ false+ )+ .await+ .is_ok()+ );let items =crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();assert_eq!(items.len(), 1);diff --git a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rsindex 8d5be7cc55..91a38e8f26 100644--- a/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_dispatch_tests.rs@@ -3,12 +3,12 @@//! are honoured and a system job's handler result is what gets recorded.use super::*;-use crate::cron::system_job_handlers::{register, SystemJobContext};+use crate::cron::system_job_handlers::{SystemJobContext, register};use crate::cron::system_jobs::ensure_system_job;use std::sync::atomic::{AtomicUsize, Ordering};use tempfile::TempDir;-use tinyflows_bus::schedule::types::Schedule;use tinyflows_bus::schedule::JobPolicy;+use tinyflows_bus::schedule::types::Schedule;/// Stores `policy` on the job.fn set_policy(config: &Config, job_id: &str, policy: JobPolicy) -> anyhow::Result<()> {@@ -166,10 +166,12 @@ async fn a_system_job_handler_error_is_recorded_as_the_run_result() {dispatcher.drain().await;let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("error"));- assert!(stored- .last_output- .unwrap_or_default()- .contains("handler failed"));+ assert!(+ stored+ .last_output+ .unwrap_or_default()+ .contains("handler failed")+ );}#[tokio::test]@@ -284,10 +286,12 @@ async fn a_flow_schedule_job_fires_through_the_trigger_sink() {let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("ok"));- assert!(stored- .last_output- .unwrap_or_default()- .contains("flow schedule tick emitted for flow flow-missing-for-sink"));+ assert!(+ stored+ .last_output+ .unwrap_or_default()+ .contains("flow schedule tick emitted for flow flow-missing-for-sink")+ );assert!(stored.next_run > Utc::now(), "the recurrence moved on");}diff --git a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rsindex 4390b2fe1c..a78f9a998b 100644--- a/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_frequency_tests.rs@@ -1,24 +1,26 @@use super::*;+use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;+use tinyflows_bus::schedule::TooFrequent;use tinyflows_bus::schedule::types::JobType;use tinyflows_bus::schedule::types::Schedule;-use tinyflows_bus::schedule::TooFrequent;-use tinyflows_bus::schedule::MIN_AGENT_JOB_INTERVAL;#[tokio::test]async fn deliver_if_configured_empty_success_skips_chat_and_alert() {let tmp = TempDir::new().unwrap();let config = test_config(&tmp).await;let job = proactive_job();// Successful but empty: nothing delivered anywhere.- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "",- true- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "",+ true+ )+ .await+ .is_ok()+ );assert_eq!(cron_alerts(&config).await, 0);}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.rsindex b87778bc15..1cfc88d8c2 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@@ -253,8 +253,7 @@ fn is_local_provider_unreachable_failure_matches_raw_no_models_loaded_body() {#[test]fn is_local_provider_unreachable_failure_checks_output_when_raw_is_generic() {- let output =- "Your local inference server (e.g. LM Studio) is running but has no model loaded. \+ let output = "Your local inference server (e.g. LM Studio) is running but has no model loaded. \Load a model, then try again.";assert!(is_local_provider_unreachable_failure(@@ -440,11 +439,13 @@ async fn scheduler_flow_runs_active_hours_job_and_reschedules_inside_window() {let stored = cron::get_job(&config, &job.id).unwrap();assert_eq!(stored.last_status.as_deref(), Some("ok"));- assert!(stored- .last_output- .as_deref()- .unwrap_or_default()- .contains("active-hours-fired"));+ assert!(+ stored+ .last_output+ .as_deref()+ .unwrap_or_default()+ .contains("active-hours-fired")+ );assert_eq!(stored.schedule,Schedule::Cron {@@ -551,15 +552,17 @@ async fn deliver_if_configured_skips_non_announce_mode() {let job = test_job("echo ok");// Default delivery mode is not "announce", so nothing is published.- assert!(deliver_if_configured(- &crate::core::runtime::DispatchCtx::ambient(),- &config,- &job,- "x",- true- )- .await- .is_ok());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "x",+ true+ )+ .await+ .is_ok()+ );}#[tokio::test]@@ -616,15 +619,17 @@ async fn deliver_if_configured_publishes_event_for_announce_mode() {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());+ assert!(+ deliver_if_configured(+ &crate::core::runtime::DispatchCtx::ambient(),+ &config,+ &job,+ "hello",+ true+ )+ .await+ .is_ok()+ );}#[test]diff --git a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rsindex f043e64c3d..f332c3b1ba 100644--- a/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_host_agent_tests.rs@@ -109,11 +109,13 @@ fn a_cron_job_for_a_host_agent_builds_with_its_host_tools_and_context() {belt_builds.load(Ordering::SeqCst) > 0,"the host belt was built");- assert!(built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker"));+ assert!(+ built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker")+ );}#[test]@@ -134,9 +136,11 @@ fn an_id_the_host_does_not_know_falls_back_to_the_registries() {host_agents::clear_if(&installed);let built = built.expect("the orchestrator builds from the registries");assert!(built.context.is_none());- assert!(!built- .agent- .visible_tool_specs_arc()- .iter()- .any(|spec| spec.name == "cron_host_marker"));+ assert!(+ !built+ .agent+ .visible_tool_specs_arc()+ .iter()+ .any(|spec| spec.name == "cron_host_marker")+ );}diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rsindex d21da4a22d..15438c2c4e 100644--- a/crates/openhuman-core/src/cron/scheduler_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs@@ -1,4 +1,4 @@-use super::agent_run::{build_agent_for_cron_job, run_agent_job, EMPTY_AGENT_OUTPUT};+use super::agent_run::{EMPTY_AGENT_OUTPUT, build_agent_for_cron_job, run_agent_job};use super::*;use crate::config::Config;use crate::security::SecurityPolicy;diff --git a/crates/openhuman-core/src/cron/schemas.rs b/crates/openhuman-core/src/cron/schemas.rsindex 16908bc7a8..e168452cfa 100644--- a/crates/openhuman-core/src/cron/schemas.rs+++ b/crates/openhuman-core/src/cron/schemas.rs@@ -2,8 +2,8 @@ use crate::core::runtime::DispatchCtx;use serde::de::DeserializeOwned;use serde_json::{Map, Value};-use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::Outcome;+use crate::core::all::{ControllerFuture, RegisteredController};use crate::core::{ControllerSchema, FieldSchema, TypeSchema};use tinyflows_bus::schedule::types::{CronJobPatch, DeliveryConfig};diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rsindex d55c73d810..021e7aadb1 100644--- a/crates/openhuman-core/src/cron/store_tests.rs+++ b/crates/openhuman-core/src/cron/store_tests.rs@@ -147,9 +147,11 @@ fn a_legacy_jobs_db_is_imported_by_the_storage_importer_and_left_untouched() {let jobs = list_jobs(&config).unwrap();assert_eq!(jobs.len(), 3);assert!(jobs.iter().any(|job| job.name.as_deref() == Some("inbox")));- assert!(find_flow_schedule_job(&config, "flow-beta")- .unwrap()- .is_some());+ assert!(+ find_flow_schedule_job(&config, "flow-beta")+ .unwrap()+ .is_some()+ );assert_eq!(std::fs::read(&legacy).unwrap(),before,diff --git a/crates/openhuman-core/src/cron/tools.rs b/crates/openhuman-core/src/cron/tools.rsindex 16b3ca473c..4de3e16a36 100644--- a/crates/openhuman-core/src/cron/tools.rs+++ b/crates/openhuman-core/src/cron/tools.rs@@ -13,7 +13,7 @@ mod runs;mod update;pub use add::CronAddTool;-pub use collapsed::{CronTool, CRON_TOOL_NAME};+pub use collapsed::{CRON_TOOL_NAME, CronTool};pub use list::CronListTool;pub use remove::CronRemoveTool;pub use run::CronRunTool;diff --git a/crates/openhuman-core/src/cron/tools/add.rs b/crates/openhuman-core/src/cron/tools/add.rsindex 29d16ae965..d10bae7c27 100644--- a/crates/openhuman-core/src/cron/tools/add.rs+++ b/crates/openhuman-core/src/cron/tools/add.rs@@ -1,5 +1,5 @@use crate::config::Config;-use crate::cron::job_builder::{create_agent_job, AgentJobInput};+use crate::cron::job_builder::{AgentJobInput, create_agent_job};use crate::cron::origin::{current_job_origin, current_turn_may_skip_approval};use crate::security::SecurityPolicy;use crate::tools::schema_cache::static_schema;diff --git a/crates/openhuman-core/src/cron/tools/collapsed.rs b/crates/openhuman-core/src/cron/tools/collapsed.rsindex b690235484..bb7752a45b 100644--- a/crates/openhuman-core/src/cron/tools/collapsed.rs+++ b/crates/openhuman-core/src/cron/tools/collapsed.rs@@ -36,8 +36,8 @@ use super::{use crate::config::Config;use crate::security::policy::SecurityPolicy;use tinytools::collapse::{- any_external_effect, args_without_action, merge_action_schemas, resolve, strictest_permission,- unknown_action_message, CollapsedAction,+ CollapsedAction, any_external_effect, args_without_action, merge_action_schemas, resolve,+ strictest_permission, unknown_action_message,};use tinytools::{PermissionLevel, Tool, ToolCallOptions, ToolResult};