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/cron/limits_tests.rs,crates/openhuman-core/src/cron/o

Steven Enamakelf1e4734520e9
diff --git a/crates/openhuman-core/src/cron/limits_tests.rs b/crates/openhuman-core/src/cron/limits_tests.rs
index 31176fd4ba..ee14e4113d 100644
--- a/crates/openhuman-core/src/cron/limits_tests.rs
+++ b/crates/openhuman-core/src/cron/limits_tests.rs
@@ -2,6 +2,7 @@
use super::*;
use crate::cron::job_builder::{create_agent_job, AgentJobInput};
+use crate::cron::limits;
use crate::cron::{add_job, add_shell_job, get_job, update_job, JobOrigin};
use tempfile::TempDir;
@@ -158,9 +159,16 @@ async fn run_now_refuses_a_stored_job_that_breaks_the_limits() {
let tmp = TempDir::new().unwrap();
let mut config = limited(&tmp);
config.cron.agent_jobs_only = false;
- let shell = add_shell_job(&config, None, Schedule::Every { every_ms: 600_000 }, "echo").unwrap();
+ 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(&config, &shell.id).await.is_err());
- assert!(crate::cron::ops::cron_run(&config, &shell.id).await.is_err());
- assert!(crate::cron::runs::list(&config, &shell.id).is_empty());
+ assert!(crate::cron::ops::run_job_now(&config, &shell.id)
+ .await
+ .is_err());
+ assert!(crate::cron::ops::cron_run(&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/ops.rs b/crates/openhuman-core/src/cron/ops.rs
index bfda80ccee..c2657ac718 100644
--- a/crates/openhuman-core/src/cron/ops.rs
+++ b/crates/openhuman-core/src/cron/ops.rs
@@ -228,8 +228,11 @@ pub async fn cron_run(config: &Config, job_id: &str) -> Result<Outcome<serde_jso
// Fail closed before queueing anything: an unreadable policy refuses the run.
cron::policy::get_policy(config, job_id).map_err(|e| e.to_string())?;
- cron::limits::check_run(config, &cron::get_job(config, job_id).map_err(|e| e.to_string())?)
- .map_err(|e| e.to_string())?;
+ cron::limits::check_run(
+ config,
+ &cron::get_job(config, job_id).map_err(|e| e.to_string())?,
+ )
+ .map_err(|e| e.to_string())?;
// Guard against duplicate concurrent executions for the same job.
{