Skip to content

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

fix(config): preserve unknown fields when loading config

Steven Enamakel2d0d2f6ea0b5
diff --git a/crates/openhuman-core/src/config/schema/load/branches.rs b/crates/openhuman-core/src/config/schema/load/branches.rs
index e7ab542304..8ebae60106 100644
--- a/crates/openhuman-core/src/config/schema/load/branches.rs
+++ b/crates/openhuman-core/src/config/schema/load/branches.rs
@@ -9,7 +9,8 @@ use super::dirs::{default_action_dir, resolve_action_dir, ConfigResolutionSource
use super::env::EnvLookup;
use super::impl_load::migration_source;
use super::migrate::{
- migrate_cloud_provider_slugs, migrate_legacy_inference_url, migrate_legacy_memory_backend,
+ migrate_cloud_provider_slugs, migrate_components, migrate_legacy_inference_url,
+ migrate_legacy_memory_backend,
migrate_legacy_memory_sources, migrate_search_settings,
};
use super::secrets::decrypt_config_secrets;
@@ -174,6 +175,7 @@ impl Config {
migrate_legacy_inference_url(&mut config);
let migration_raw = migration_source(&config_path, &contents).await;
migrate_legacy_memory_backend(&mut config, &migration_raw);
+ migrate_components(&mut config, &migration_raw);
migrate_cloud_provider_slugs(&mut config);
migrate_search_settings(&mut config);
migrate_legacy_memory_sources(&mut config);
diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rs
index 01202f0b3a..e3800ecf13 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -6,7 +6,8 @@ use super::dirs::{
};
use super::env::{EnvLookup, ProcessEnv, ProcessEnvWithoutWorkspace};
use super::migrate::{
- migrate_cloud_provider_slugs, migrate_legacy_inference_url, migrate_legacy_memory_backend,
+ migrate_cloud_provider_slugs, migrate_components, migrate_legacy_inference_url,
+ migrate_legacy_memory_backend,
migrate_search_settings,
};
use super::secrets::{
@@ -437,6 +438,7 @@ impl Config {
config.action_dir = resolve_action_dir(&config.action_dir_override);
let migration_raw = migration_source(&config_path, &raw).await;
migrate_legacy_memory_backend(&mut config, &migration_raw);
+ migrate_components(&mut config, &migration_raw);
config.apply_env_overrides();
// Debug-dump path is read-only; ignore the migration signal (the
// authoritative `load_or_init` path persists upgraded secrets).
@@ -499,6 +501,7 @@ impl Config {
migrate_legacy_inference_url(&mut config);
let migration_raw = migration_source(&config_path, &raw).await;
migrate_legacy_memory_backend(&mut config, &migration_raw);
+ migrate_components(&mut config, &migration_raw);
migrate_cloud_provider_slugs(&mut config);
migrate_search_settings(&mut config);
config.apply_env_overrides_from(&ProcessEnvWithoutWorkspace);
diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs
index b04de4251d..f265714ff1 100644
--- a/crates/openhuman-core/src/config/schema/load/migrate.rs
+++ b/crates/openhuman-core/src/config/schema/load/migrate.rs
@@ -323,10 +323,10 @@ pub(crate) fn migrate_components_with(config: &mut Config, raw: &str, tinymemes:
.and_then(toml::Value::as_str)
.is_some_and(|e| e.trim().eq_ignore_ascii_case("none"));
disable(config, "memory", engine_none.then_some(false));
- let memes_off = tinymemes
+ let memes_on = tinymemes
.filter(|v| !v.trim().is_empty())
- .map(|v| !matches!(crate::tinymemes::mode_from_flag(Some(v)), true));
- disable(config, "memes", memes_off.map(|off| !off));
+ .map(crate::tinymemes::flag_enabled);
+ disable(config, "memes", memes_on);
if !moved.is_empty() {
tracing::info!(
"[config][migrate] legacy switches moved to [components]: {}",
diff --git a/crates/openhuman-core/src/tinymemes/mod.rs b/crates/openhuman-core/src/tinymemes/mod.rs
index b3757905b3..22d459d0f2 100644
--- a/crates/openhuman-core/src/tinymemes/mod.rs
+++ b/crates/openhuman-core/src/tinymemes/mod.rs
@@ -27,6 +27,12 @@ use crate::config::Config;
use std::time::{Duration, Instant};
pub(crate) use arm::Arm;
+pub(crate) use arm::FLAG_ENV;
+
+/// Whether an `OPENHUMAN_TINYMEMES` value turns remixing on in any form.
+pub(crate) fn flag_enabled(value: &str) -> bool {
+ arm::mode_from(Some(value)) != arm::Mode::Off
+}
const TIMEOUT_ENV: &str = "OPENHUMAN_TINYMEMES_TIMEOUT_MS";
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(20);