Skip to content

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

refactor(config): drop unused base field from context overlay

Steven Enamakel56c56b6a3cde
diff --git a/crates/openhuman-core/src/config/schema/load/context_overlay.rs b/crates/openhuman-core/src/config/schema/load/context_overlay.rs
index 11804edc4a..d105d03230 100644
--- a/crates/openhuman-core/src/config/schema/load/context_overlay.rs
+++ b/crates/openhuman-core/src/config/schema/load/context_overlay.rs
@@ -13,7 +13,6 @@ use std::sync::Arc;
#[derive(Clone)]
pub(crate) struct ConfigContextOverlay {
- base: Value,
changes: Vec<Change>,
runtime: RuntimeBindings,
}
@@ -53,33 +52,22 @@ impl std::fmt::Debug for ConfigContextOverlay {
}
impl ConfigContextOverlay {
- pub(crate) fn with_base(&self, base: Value) -> Self {
- let mut advanced = self.clone();
- advanced.base = base;
- advanced
- }
-
pub(crate) fn derive(parent: &Config, child: &Config) -> anyhow::Result<Arc<Self>> {
let inherited = parent.context_overlay.lock().unwrap().clone();
- let (base, mut changes) = match inherited.as_ref() {
- Some(overlay) => (overlay.base.clone(), overlay.changes.clone()),
- None => (serde_json::to_value(parent)?, Vec::new()),
- };
+ let mut changes = inherited
+ .as_ref()
+ .map(|overlay| overlay.changes.clone())
+ .unwrap_or_default();
let parent_value = serde_json::to_value(parent)?;
let target = serde_json::to_value(child)?;
diff_values(&parent_value, &target, &mut Vec::new(), &mut changes);
let runtime = RuntimeBindings::capture(child);
- Ok(Arc::new(Self {
- base,
- changes,
- runtime,
- }))
+ Ok(Arc::new(Self { changes, runtime }))
}
pub(crate) fn reapply(&self, fresh: &Config) -> anyhow::Result<Config> {
- let fresh_persisted = serde_json::to_value(fresh)?;
- let mut value = fresh_persisted.clone();
+ let mut value = serde_json::to_value(fresh)?;
for change in &self.changes {
apply_change(&mut value, &change.path, change.value.clone());
}
@@ -90,7 +78,6 @@ impl ConfigContextOverlay {
std::sync::Mutex::new(fresh.document_snapshot.lock().unwrap().clone());
result.context_snapshot = fresh.context_snapshot.clone();
result.context_overlay = std::sync::Mutex::new(Some(Arc::new(Self {
- base: fresh_persisted,
changes: self.changes.clone(),
runtime: self.runtime.clone(),
})));
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 fbc3f7222f..755bb683a5 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -416,15 +416,6 @@ 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
@@ -468,13 +459,6 @@ impl Config {
version,
anchor: Some(source_anchor.clone()),
};
- if let Some(base) = overlay_base_after_save {
- let existing_overlay = { self.context_overlay.lock().unwrap().clone() };
- if let Some(overlay) = existing_overlay {
- let advanced = overlay.with_base(base);
- *self.context_overlay.lock().unwrap() = Some(std::sync::Arc::new(advanced));
- }
- }
if let Some(snapshot) = self
.context_snapshot