Skip to content

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

refactor(config): reuse context overlay when refreshing config

Steven Enamakel78fed6659ad4
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 254d0e7748..c1606c9c98 100644
--- a/crates/openhuman-core/src/config/schema/load/context_overlay.rs
+++ b/crates/openhuman-core/src/config/schema/load/context_overlay.rs
@@ -119,7 +119,7 @@ fn apply_change(current: &mut Value, path: &[String], value: Option<Value>) {
apply_change(child, rest, value);
}
-fn copy_runtime_bindings(source: &Config, target: &mut Config) {
+pub(crate) fn copy_runtime_bindings(source: &Config, target: &mut Config) {
target.profile_providers = source.profile_providers.clone();
target.workspace_dir = source.workspace_dir.clone();
target.action_dir = source.action_dir.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 c40991bc87..999cceab1a 100644
--- a/crates/openhuman-core/src/config/schema/load/impl_load.rs
+++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs
@@ -503,14 +503,15 @@ impl Config {
if refreshed.document_snapshot.lock().unwrap().anchor != expected.anchor {
return;
}
- refreshed.profile_providers = runtime.profile_providers.clone();
- refreshed.workspace_dir = runtime.workspace_dir;
- refreshed.action_dir = runtime.action_dir;
- refreshed.config_path = runtime.config_path;
- refreshed.cli_inference_snapshot = runtime.cli_inference_snapshot;
- refreshed.recovered_from_corruption = runtime.recovered_from_corruption;
- refreshed.ephemeral_route = runtime.ephemeral_route;
- refreshed.resolved_endpoints = runtime.resolved_endpoints;
+ let overlay = runtime.context_overlay.lock().unwrap().clone();
+ if let Some(overlay) = overlay {
+ let Ok(merged) = overlay.reapply(&refreshed) else {
+ return;
+ };
+ refreshed = merged;
+ } else {
+ super::context_overlay::copy_runtime_bindings(&runtime, &mut refreshed);
+ }
refreshed.context_snapshot = Some(std::sync::Arc::downgrade(&snapshot));
let mut current = snapshot.lock().unwrap();