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/scheduler/run_delivery.rs,crates/openhuman-core/
Steven Enamakel87880238ade0
diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs b/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rsnew file mode 100644index 0000000000..e58ba0c90b--- /dev/null+++ b/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs@@ -0,0 +1,16 @@+use super::*;++/// Run an agent job under a fresh run id for focused scheduler tests.+pub(super) async fn run_agent_job(+ config: &Config,+ job: &CronJob,+) -> (bool, String, Option<String>) {+ let run_id = uuid::Uuid::new_v4().to_string();+ run_agent_job_for_run(+ &crate::core::runtime::DispatchCtx::host_default(),+ config,+ job,+ &run_id,+ )+ .await+}diff --git a/crates/openhuman-core/src/cron/scheduler/delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler/delivery_tests.rsnew file mode 100644index 0000000000..a955faf4e4--- /dev/null+++ b/crates/openhuman-core/src/cron/scheduler/delivery_tests.rs@@ -0,0 +1,15 @@+use super::*;++/// Deliver under a fresh run id and discard the delivery status.+pub(super) async fn deliver_if_configured(+ ctx: &crate::core::runtime::DispatchCtx,+ config: &Config,+ job: &CronJob,+ output: &str,+ success: bool,+) -> Result<()> {+ let run_id = uuid::Uuid::new_v4().to_string();+ deliver_run(ctx, config, job, &run_id, output, success)+ .await+ .map(|_| ())+}diff --git a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs b/crates/openhuman-core/src/cron/scheduler/run_delivery.rsindex be1a21e99e..57e2526e8a 100644--- a/crates/openhuman-core/src/cron/scheduler/run_delivery.rs+++ b/crates/openhuman-core/src/cron/scheduler/run_delivery.rs@@ -108,6 +108,13 @@ fn stand_in(flow_id: &str) -> CronJob {}}+#[cfg(test)]+#[path = "run_delivery_tests.rs"]+pub(crate) mod tests;++#[cfg(test)]+pub(crate) use tests::stand_in_for_test;+/// Fire the `flow` row bound to `flow_id` through the registered `flow`/// handler.pub(crate) async fn trigger(binding: &Binding, flow_id: &str, run_id: &str) -> Attempt {diff --git a/crates/openhuman-core/src/cron/scheduler/run_delivery_tests.rs b/crates/openhuman-core/src/cron/scheduler/run_delivery_tests.rsnew file mode 100644index 0000000000..346b81b7f9--- /dev/null+++ b/crates/openhuman-core/src/cron/scheduler/run_delivery_tests.rs@@ -0,0 +1,6 @@+use super::*;++/// A stand-in flow row for handler tests.+pub(crate) fn stand_in_for_test(command: &str) -> CronJob {+ stand_in(command)+}diff --git a/crates/openhuman-core/src/cron/scheduler/shell_job.rs b/crates/openhuman-core/src/cron/scheduler/shell_job.rsindex 0b79049075..d3ad2b408b 100644--- a/crates/openhuman-core/src/cron/scheduler/shell_job.rs+++ b/crates/openhuman-core/src/cron/scheduler/shell_job.rs@@ -1,5 +1,5 @@-//! Execution of `JobType::Shell` jobs under the security policy, with a-//! forbidden-path argument scan and a hard timeout.+//! Execution of `JobType::Shell` jobs under the security policy and a hard+//! timeout.use crate::config::Config;use crate::security::SecurityPolicy;@@ -22,26 +22,7 @@ pub(crate) async fn authorize_shell_command(.await{Ok(analysis) => analysis,- Err(_) => {- #[cfg(test)]- {- if !config.modules.enabled {- return Err("Command analysis is unavailable.".to_owned());- }- // Scheduler unit tests exercise process and retry behavior- // without loading a native artifact. Production has no- // parser fallback and fails closed below.- security- .check_gated_command(command)- .map_err(|_| "blocked by security policy: command rejected".to_owned())?;- if !security.is_command_allowed(command) {- return Err("blocked by security policy: command not allowed".to_owned());- }- return Ok(());- }- #[cfg(not(test))]- return Err("Command analysis is unavailable.".to_owned());- }+ Err(_) => return Err("Command analysis is unavailable.".to_owned()),};security.check_gated_command_analysis(&analysis)@@ -58,67 +39,6 @@ pub(crate) async fn authorize_shell_command(}}-#[cfg(test)]-pub(super) fn is_env_assignment(word: &str) -> bool {- word.contains('=')- && word- .chars()- .next()- .is_some_and(|c| c.is_ascii_alphabetic() || c == '_')-}--#[cfg(test)]-pub(super) fn strip_wrapping_quotes(token: &str) -> &str {- token.trim_matches(|c| c == '"' || c == '\'')-}--#[cfg(test)]-pub(super) fn forbidden_path_argument(security: &SecurityPolicy, command: &str) -> Option<String> {- let mut normalized = command.to_string();- for sep in ["&&", "||"] {- normalized = normalized.replace(sep, "\x00");- }- for sep in ['\n', ';', '|'] {- normalized = normalized.replace(sep, "\x00");- }-- for segment in normalized.split('\x00') {- let tokens: Vec<&str> = segment.split_whitespace().collect();- if tokens.is_empty() {- continue;- }-- // Skip leading env assignments and executable token.- let mut idx = 0;- while idx < tokens.len() && is_env_assignment(tokens[idx]) {- idx += 1;- }- if idx >= tokens.len() {- continue;- }- idx += 1;-- for token in &tokens[idx..] {- let candidate = strip_wrapping_quotes(token);- if candidate.is_empty() || candidate.starts_with('-') || candidate.contains("://") {- continue;- }-- let looks_like_path = candidate.starts_with('/')- || candidate.starts_with("./")- || candidate.starts_with("../")- || candidate.starts_with("~/")- || candidate.contains('/');-- if looks_like_path && !security.is_path_string_allowed(candidate) {- return Some(candidate.to_string());- }- }- }-- None-}-pub(super) async fn run_job_command(ctx: &crate::core::runtime::DispatchCtx,config: &Config,