Skip to content

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

test(cron): assert built-in jobs count against the active-job cap

Steven Enamakel50129b0d193e
diff --git a/crates/openhuman-core/src/cron/schemas_tests.rs b/crates/openhuman-core/src/cron/schemas_tests.rs
index 8a22ec2eda..8f57768956 100644
--- a/crates/openhuman-core/src/cron/schemas_tests.rs
+++ b/crates/openhuman-core/src/cron/schemas_tests.rs
@@ -245,7 +245,7 @@ async fn rpc_add_cannot_create_a_memory_system_flow_from_parameters() {
.await
.unwrap_err();
- assert!(result.to_ascii_lowercase().contains("flow"), "{result}");
+ assert!(result.contains("allowed enum variants"), "{result}");
assert!(crate::cron::list_jobs(&config).unwrap().is_empty());
}
diff --git a/crates/openhuman-core/src/cron/system_jobs_tests.rs b/crates/openhuman-core/src/cron/system_jobs_tests.rs
index 73c5b4e74d..dd09447c80 100644
--- a/crates/openhuman-core/src/cron/system_jobs_tests.rs
+++ b/crates/openhuman-core/src/cron/system_jobs_tests.rs
@@ -134,6 +134,7 @@ fn memory_jobs_seed_under_agent_only_without_authorizing_generic_flows() {
let tmp = TempDir::new().unwrap();
let mut config = test_config(&tmp);
config.cron.agent_jobs_only = true;
+ config.cron.max_active_jobs = 2;
ensure_memory_jobs(&config).expect("trusted memory jobs should seed in an enforced scope");
let background = system_rows(&config, BACKGROUND_JOB);
@@ -143,6 +144,21 @@ fn memory_jobs_seed_under_agent_only_without_authorizing_generic_flows() {
for job in background.iter().chain(sync.iter()) {
crate::cron::limits::check_run(&config, job).unwrap();
}
+ assert_eq!(crate::cron::list_jobs(&config).unwrap().len(), 2);
+
+ let extra_agent = crate::cron::client::store_blocking::<crate::cron::CronJob>(
+ &config,
+ tinyflows_bus::schedule::StoreOperation::AddAgent {
+ spec: tinyflows_bus::schedule::AgentJobSpec::new(
+ every(30),
+ "must not exceed the active-job cap",
+ ),
+ },
+ );
+ assert!(
+ extra_agent.is_err(),
+ "built-in jobs consume the configured capacity"
+ );
assert!(add_flow_schedule_job(&config, "system:memory_background", every(30)).is_err());
assert!(ensure_system_job(&config, "untrusted_flow", every(30)).is_err());