Skip to content

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

feat(runtime): derive profile-aware config overlays in core context

Steven Enamakelfa94b119348f
diff --git a/crates/openhuman-core/src/core/runtime/context.rs b/crates/openhuman-core/src/core/runtime/context.rs
index 0c9627e33e..044533170b 100644
--- a/crates/openhuman-core/src/core/runtime/context.rs
+++ b/crates/openhuman-core/src/core/runtime/context.rs
@@ -424,11 +424,26 @@ impl CoreContext {
}
};
let agent = self.agent.derive(&mut overlay);
- if let Some(parent_config) = parent_config {
- match crate::config::schema::load::context_overlay::ConfigContextOverlay::derive(
- parent_config,
- &overlay.config,
- ) {
+ let config_overlay = if let Some(profile_id) = overlay.profile.as_deref() {
+ let parent_profile_config = (self.profile() == Some(profile_id))
+ .then_some(parent_config)
+ .flatten();
+ Some(
+ crate::config::schema::load::context_overlay::ConfigContextOverlay::derive_profile(
+ parent_profile_config,
+ &overlay.config,
+ ),
+ )
+ } else {
+ parent_config.map(|parent_config| {
+ crate::config::schema::load::context_overlay::ConfigContextOverlay::derive(
+ parent_config,
+ &overlay.config,
+ )
+ })
+ };
+ if let Some(config_overlay) = config_overlay {
+ match config_overlay {
Ok(config_overlay) => {
overlay.config.context_overlay = std::sync::Mutex::new(Some(config_overlay));
}