Skip to content

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

fix(cron): preserve agent definition on patches that omit it

Steven Enamakel2b1c7818edf3
diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rs
index 3aa6390a43..2df08d4211 100644
--- a/crates/openhuman-core/src/cron/store_tests.rs
+++ b/crates/openhuman-core/src/cron/store_tests.rs
@@ -169,7 +169,7 @@ fn a_legacy_jobs_db_is_imported_by_the_storage_importer_and_left_untouched() {
}
#[test]
-fn successive_patches_each_land_on_the_stored_job() {
+fn a_patch_over_the_bus_keeps_the_agent_definition_it_does_not_mention() {
use tinyflows_bus::schedule::types::{CronJobPatch, SessionTarget};
let tmp = TempDir::new().unwrap();
let config = test_config(&tmp);
@@ -219,4 +219,17 @@ fn successive_patches_each_land_on_the_stored_job() {
get_job(&config, &job.id).unwrap().prompt.as_deref(),
Some("check in")
);
+ // Regression: `CronJobPatch.agent_id` is `Option<Option<_>>` and a present
+ // `null` means "clear it". A patch that never mentioned the agent used to
+ // serialize `agent_id: null` across the bus, so every update (pausing a
+ // job, a policy change) silently dropped the job's agent definition.
+ assert_eq!(
+ policy.agent_id.as_deref(),
+ Some("teeny"),
+ "an unrelated patch cleared the agent definition"
+ );
+ assert_eq!(
+ get_job(&config, &job.id).unwrap().agent_id.as_deref(),
+ Some("teeny")
+ );
}
diff --git a/vendor/tinyflows b/vendor/tinyflows
index 62c3e78c32..c3c1df3b0b 160000
--- a/vendor/tinyflows
+++ b/vendor/tinyflows
@@ -1 +1 @@
-Subproject commit 62c3e78c3223f6cf814efafc9df674e6e4c10bb5
+Subproject commit c3c1df3b0b39319c01125f47d21de5810a626e6e