Skip to content

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

test(cron): cover clearing the store cap when agent-only limits are disabled

Steven Enamakelccb5846b9733
diff --git a/crates/openhuman-core/src/cron/limits_tests.rs b/crates/openhuman-core/src/cron/limits_tests.rs
index 0199da3105..2f5cb0b031 100644
--- a/crates/openhuman-core/src/cron/limits_tests.rs
+++ b/crates/openhuman-core/src/cron/limits_tests.rs
@@ -132,6 +132,19 @@ fn active_jobs_are_capped_by_the_store_count() {
assert!(get_job(&config, &third.id).unwrap().enabled);
}
+#[test]
+fn disabling_agent_only_limits_clears_the_store_cap() {
+ let tmp = TempDir::new().unwrap();
+ let mut config = limited(&tmp);
+ config.cron.max_active_jobs = 1;
+ create_agent_job(&config, input(600_000, None), origin()).unwrap();
+
+ config.cron.agent_jobs_only = false;
+ create_agent_job(&config, input(600_000, None), None)
+ .expect("disabling agent-only mode should clear the persisted cap");
+ assert_eq!(crate::cron::list_jobs(&config).unwrap().len(), 2);
+}
+
#[test]
fn concurrent_preflight_admissions_cannot_oversubscribe_the_store_cap() {
use std::sync::{Arc, Barrier};
diff --git a/crates/openhuman-core/src/profiles/host.rs b/crates/openhuman-core/src/profiles/host.rs
index e24f80b1bb..a01a9d2adc 100644
--- a/crates/openhuman-core/src/profiles/host.rs
+++ b/crates/openhuman-core/src/profiles/host.rs
@@ -224,7 +224,7 @@ impl ProfileHost {
/// [`layout::profile_config`] plus the operator's cron limits, which no
/// profile config can loosen.
- fn forced_config(&self, layout: &ProfileLayout, id: &ProfileId) -> Config {
+ pub(super) fn forced_config(&self, layout: &ProfileLayout, id: &ProfileId) -> Config {
let mut config = layout::profile_config(layout, id);
let cron = &self.saas.cron;
config.cron.agent_jobs_only = cron.agent_jobs_only;