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
fix: retire persisted TinyPlace autopilot jobs\n\n
Steven Enamakelcd9df9bfed01
diff --git a/src/core/runtime/services.rs b/src/core/runtime/services.rsindex af9d3789eb..6760afc45b 100644--- a/src/core/runtime/services.rs+++ b/src/core/runtime/services.rs@@ -384,6 +384,14 @@ pub async fn start_boot_once_jobs(services: ServiceSet, config: &Config) {}async fn run_legacy_migrations(config: &Config) {+ match crate::openhuman::cron::seed::prune_retired_jobs(config) {+ Ok(count) if count > 0 => {+ log::info!("[cron] removed {count} retired autopilot job(s)");+ }+ Ok(_) => {}+ Err(e) => log::warn!("[cron] failed to prune retired jobs: {e}"),+ }+// These used to run as detached tasks, allowing a user/API write to land// between a migration's `get(None)` check and its later `put`. Await each// copy in startup order so the crate stores are authoritative beforediff --git a/src/openhuman/cron/seed.rs b/src/openhuman/cron/seed.rsindex ee8ba5f795..aa5c16a7ad 100644--- a/src/openhuman/cron/seed.rs+++ b/src/openhuman/cron/seed.rs@@ -33,6 +33,11 @@ const MORNING_BRIEFING_JOB_NAME: &str = "morning_briefing";/// finds the migration path.const LEGACY_WELCOME_JOB_NAME: &str = "welcome";+/// Name used by the retired TinyPlace autopilot schedule. This migration+/// marker must remain until upgraded workspaces have had the persisted job+/// removed.+const RETIRED_TINYPLACE_AUTOPILOT_JOB_NAME: &str = "tinyplace_autopilot";+/// Delivery config for proactive agents. The channels module decides/// which channel(s) to deliver to based on the user's active channel/// preference — no channel is specified here.@@ -78,6 +83,25 @@ pub fn seed_proactive_agents(config: &Config) -> Result<()> {Ok(())}+/// Remove schedules whose implementation and management UI no longer exist.+///+/// Runs on every core boot (and is idempotent) so existing installations cannot+/// keep executing an enabled TinyPlace autopilot row after upgrading.+pub fn prune_retired_jobs(config: &Config) -> Result<usize> {+ let existing = list_jobs(config)?;+ let stale_ids: Vec<String> = existing+ .iter()+ .filter(|job| job.name.as_deref() == Some(RETIRED_TINYPLACE_AUTOPILOT_JOB_NAME))+ .map(|job| job.id.clone())+ .collect();++ for id in &stale_ids {+ remove_job(config, id)?;+ }++ Ok(stale_ids.len())+}+/// Remove any persisted cron job named `"welcome"` from a prior build.////// The one-shot welcome job `delete_after_run = true + Schedule::At`@@ -186,6 +210,7 @@ mod tests {assert!(!MORNING_BRIEFING_JOB_NAME.is_empty());assert!(!LEGACY_WELCOME_JOB_NAME.is_empty());assert_ne!(MORNING_BRIEFING_JOB_NAME, LEGACY_WELCOME_JOB_NAME);+ assert!(!RETIRED_TINYPLACE_AUTOPILOT_JOB_NAME.is_empty());}#[test]@@ -289,4 +314,33 @@ mod tests {"morning_briefing should have been seeded, got: {remaining:?}");}++ #[test]+ fn startup_prune_removes_retired_tinyplace_autopilot_jobs() {+ let tmp = TempDir::new().unwrap();+ let config = test_config(&tmp);++ add_agent_job_with_definition(+ &config,+ Some(RETIRED_TINYPLACE_AUTOPILOT_JOB_NAME.to_string()),+ Schedule::Cron {+ expr: "*/5 * * * *".to_string(),+ tz: None,+ active_hours: None,+ },+ "retired autopilot prompt",+ SessionTarget::Isolated,+ None,+ Some(proactive_delivery()),+ false,+ Some(RETIRED_TINYPLACE_AUTOPILOT_JOB_NAME.to_string()),+ true,+ None,+ )+ .expect("seed retired autopilot");++ assert_eq!(prune_retired_jobs(&config).unwrap(), 1);+ assert_eq!(prune_retired_jobs(&config).unwrap(), 0);+ assert!(list_jobs(&config).unwrap().is_empty());+ }}