Skip to content

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

feat(config): add provider config normalization during migration

Steven Enamakel0a5527a3a587
diff --git a/crates/openhuman-core/src/config/migrations/mod.rs b/crates/openhuman-core/src/config/migrations/mod.rs
index b30b5c7f74..21980c39e1 100644
--- a/crates/openhuman-core/src/config/migrations/mod.rs
+++ b/crates/openhuman-core/src/config/migrations/mod.rs
@@ -80,6 +80,23 @@ pub(crate) fn seed_new_workspace(config: &mut Config) {
/// so a partial run leaves the gate unchanged and the next launch
/// retries from the same starting version.
pub async fn run_pending(config: &mut Config) {
+ // Provider-owned normalization is independent of the schema version. It
+ // must still run when an unhosted core already advanced the generic schema,
+ // so a later hosted boot can repair provider-specific legacy values.
+ if !config.recovered_from_corruption {
+ let before_normalization = config.clone();
+ if crate::inference::registry::normalize_config(config) {
+ if let Err(err) = config.save().await {
+ *config = before_normalization;
+ log::warn!(
+ "[migrations] provider config normalization ran but config.save failed: \
+ {err:#} — restored the in-memory config; it will retry on next launch"
+ );
+ return;
+ }
+ }
+ }
+
if config.schema_version >= CURRENT_SCHEMA_VERSION {
log::debug!(
"[migrations] schema_version={} already at current={} — nothing to do",