Skip to content

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

fix(config): preserve context overlay base after save

Steven Enamakel12ef9fca6a6c
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 c28c7b21ce..70e3c51876 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -441,6 +441,12 @@ 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) => {
@@ -458,7 +464,14 @@ impl Config {
version,
anchor: Some(source_anchor.clone()),
};
- *self.context_overlay.lock().unwrap() = None;
+ if let Some(base) = overlay_base_after_save {
+ let existing_overlay = { self.context_overlay.lock().unwrap().clone() };
+ if let Some(overlay) = existing_overlay {
+ let mut advanced = (*overlay).clone();
+ advanced.base = base;
+ *self.context_overlay.lock().unwrap() = Some(std::sync::Arc::new(advanced));
+ }
+ }
if let Some(snapshot) = self
.context_snapshot