Skip to content

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

feat(config): add migration for retiring configured agents

Steven Enamakelff5e413d41fb
diff --git a/crates/openhuman-core/src/config/migrations/mod.rs b/crates/openhuman-core/src/config/migrations/mod.rs
index d9cdda640f..6e86ad4f8c 100644
--- a/crates/openhuman-core/src/config/migrations/mod.rs
+++ b/crates/openhuman-core/src/config/migrations/mod.rs
@@ -33,6 +33,7 @@ mod remove_write_auto_approve;
mod repair_http_request_limits;
mod retire_chat_v1_model;
pub(crate) mod retire_cloud_provider_type;
+pub(crate) mod retire_configured_agents;
mod retire_local_whisper_stt;
mod retire_managed_tier_slugs;
mod unify_ai_provider_settings;
diff --git a/crates/openhuman-core/src/config/migrations/retire_configured_agents.rs b/crates/openhuman-core/src/config/migrations/retire_configured_agents.rs
new file mode 100644
index 0000000000..b2268c9239
--- /dev/null
+++ b/crates/openhuman-core/src/config/migrations/retire_configured_agents.rs
@@ -0,0 +1,16 @@
+//! Drop the retired top-level `[agents]` configuration before typed decoding.
+//!
+//! Older versions used this table to configure synchronous provider-backed
+//! delegate tools. The host no longer supports that surface, so preserve all
+//! other configuration while ignoring this stale table on load.
+
+/// Remove the legacy configured-agent table from a parsed TOML document.
+pub(crate) fn rewrite_document(document: &mut toml::Value) {
+ if let Some(table) = document.as_table_mut() {
+ table.remove("agents");
+ }
+}
+
+#[cfg(test)]
+#[path = "retire_configured_agents_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs b/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs
new file mode 100644
index 0000000000..cae4fa6fae
--- /dev/null
+++ b/crates/openhuman-core/src/config/migrations/retire_configured_agents_tests.rs
@@ -0,0 +1,18 @@
+use super::*;
+
+#[test]
+fn removes_only_the_top_level_agents_table_idempotently() {
+ let mut document: toml::Value = toml::from_str(
+ "default_model = 'kept'\n[agents.worker]\nmodel = 'retired'\n[memory.agents.local]\nrecall = true",
+ )
+ .unwrap();
+
+ rewrite_document(&mut document);
+ let first = document.clone();
+ rewrite_document(&mut document);
+
+ assert_eq!(document, first);
+ assert_eq!(document["default_model"].as_str(), Some("kept"));
+ assert!(document.get("agents").is_none());
+ assert!(document["memory"]["agents"]["local"]["recall"].as_bool().unwrap());
+}
diff --git a/crates/openhuman-core/src/config/schema/load/parse.rs b/crates/openhuman-core/src/config/schema/load/parse.rs
index 9f1693d41c..72d8c4d182 100644
--- a/crates/openhuman-core/src/config/schema/load/parse.rs
+++ b/crates/openhuman-core/src/config/schema/load/parse.rs
@@ -15,6 +15,7 @@ use crate::config::Config;
pub(crate) fn config_from_toml_str(contents: &str) -> anyhow::Result<Config> {
let mut document: toml::Value = toml::from_str(contents)?;
crate::config::migrations::retire_cloud_provider_type::rewrite_document(&mut document)?;
+ crate::config::migrations::retire_configured_agents::rewrite_document(&mut document);
reject_non_finite_floats(&document, &mut String::new())?;
let json = serde_json::to_value(document)?;
serde_path_to_error::deserialize(json).map_err(|err| {