Skip to content

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

fix(config): snapshot persisted config instead of live config

Steven Enamakelfa071784f31d
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 e842949af8..fbc3f7222f 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -416,6 +416,15 @@ impl Config {
}
let mut config_to_save = self.clone();
super::super::cli_overrides::restore_persisted_inference_fields(&mut config_to_save);
+ let overlay_base_after_save =
+ if update_snapshot && self.context_overlay.lock().unwrap().is_some() {
+ Some(
+ serde_json::to_value(&config_to_save)
+ .context("Failed to snapshot persisted config")?,
+ )
+ } else {
+ None
+ };
// A document source seals the whole body under the scope's data key;
// the process-local field key would make it unreadable on another node.
// A config seeded from the local file (or saved by a migration before
@@ -442,12 +451,6 @@ impl Config {
} else {
None
};
- let overlay_base_after_save =
- if update_snapshot && self.context_overlay.lock().unwrap().is_some() {
- Some(serde_json::to_value(self).context("Failed to snapshot config context")?)
- } else {
- None
- };
let version = match source.write_versioned(&toml_str, expected).await {
Ok(version) => version,
Err(error) => {