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/job_builder.rs,crates/openhuman-core/src/cron/sc
Steven Enamakelb806eec2672e
diff --git a/crates/openhuman-core/src/cron/job_builder.rs b/crates/openhuman-core/src/cron/job_builder.rsindex bedad1f338..c97fb69ac7 100644--- a/crates/openhuman-core/src/cron/job_builder.rs+++ b/crates/openhuman-core/src/cron/job_builder.rs@@ -66,6 +66,60 @@ pub(crate) fn validate_delivery_for_config(.map_err(|e| e.to_string())}+/// Validate the module's delivery shape against the origin the job will+/// actually store, then authorize any channel destination using only a+/// verified current turn. A persisted or request-supplied channel origin may+/// describe routing, but it cannot prove that the caller is allowed to route+/// there.+pub(crate) fn validate_delivery_for_config_with_trusted_origin(+ config: &Config,+ delivery: &DeliveryConfig,+ effective_origin: Option<&JobOrigin>,+ trusted_origin: Option<&JobOrigin>,+) -> Result<(), String> {+ let mode = delivery.mode.trim();+ if mode.eq_ignore_ascii_case(delivery_mode::ANNOUNCE) {+ // Announce has an explicit destination. Let the validator's exemption+ // see only the verified turn, never the job's mutable origin field.+ return validate_delivery_for_config(config, delivery, trusted_origin);+ }++ validate_delivery_for_config(config, delivery, effective_origin)?;++ if mode.eq_ignore_ascii_case(delivery_mode::ORIGIN) {+ if let Some(JobOrigin::Channel {+ channel,+ reply_target,+ ..+ }) = effective_origin+ {+ if channel_target_matches(trusted_origin, channel, reply_target) {+ return Ok(());+ }+ // Origin delivery has no explicit `channel`/`to` fields, so+ // project its effective destination through the same module+ // validation and host allowlist used by announce delivery.+ let projected = DeliveryConfig {+ mode: delivery_mode::ANNOUNCE.to_string(),+ channel: Some(channel.clone()),+ to: Some(reply_target.clone()),+ best_effort: delivery.best_effort,+ };+ validate_delivery_for_config(config, &projected, None)?;+ }+ }++ Ok(())+}++fn channel_target_matches(origin: Option<&JobOrigin>, channel: &str, target: &str) -> bool {+ matches!(origin,+ Some(JobOrigin::Channel { channel: trusted_channel, reply_target, .. })+ if trusted_channel.trim().eq_ignore_ascii_case(channel.trim())+ && reply_target == target+ )+}+/// Create an agent job from the current turn.////// `origin` is the conversation to bind the job to (seediff --git a/crates/openhuman-core/src/cron/schemas.rs b/crates/openhuman-core/src/cron/schemas.rsindex 07d49cabe0..65da65939a 100644--- a/crates/openhuman-core/src/cron/schemas.rs+++ b/crates/openhuman-core/src/cron/schemas.rs@@ -385,9 +385,10 @@ fn handle_add(ctx: DispatchCtx, params: Map<String, Value>) -> ControllerFuturelet delivery_cfg = delivery.clone().unwrap_or_default();// RPC `origin` is request data, not a verified turn context;// it cannot exempt a target from the configured allowlist.- crate::cron::job_builder::validate_delivery_for_config(+ crate::cron::job_builder::validate_delivery_for_config_with_trusted_origin(&config,&delivery_cfg,+ origin.as_ref(),None,)?;crate::cron::client::check_origin_requirements(diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rsindex 4bd154850b..34d59331b1 100644--- a/crates/openhuman-core/src/cron/store.rs+++ b/crates/openhuman-core/src/cron/store.rs@@ -212,11 +212,14 @@ pub(crate) fn update_job_with_origin(.delivery.clone().unwrap_or_else(|| existing.delivery.clone());- // Validation only needs a verified current-turn origin. A persisted- // or request-provided origin may have come from an untrusted RPC.- crate::cron::job_builder::validate_delivery_for_config(+ let effective_origin = patch+ .origin+ .clone()+ .unwrap_or_else(|| existing.origin.clone());+ crate::cron::job_builder::validate_delivery_for_config_with_trusted_origin(config,&delivery,+ effective_origin.as_ref(),trusted_origin.as_ref(),).map_err(anyhow::Error::msg)?;