Skip to content

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

chore: files changed crates/openhuman-core/src/core/runtime/agent_scope_tests.rs,crates/openhuman-co

Steven Enamakel6bbc07250245
diff --git a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs
index a170e8b0f5..6ab6a04835 100644
--- a/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs
+++ b/crates/openhuman-core/src/core/runtime/agent_scope_tests.rs
@@ -40,6 +40,40 @@ fn every_agent_context_owns_its_slots() {
assert_eq!(alpha.agent_state().len(), 1);
}
+#[test]
+fn autonomy_tier_source_and_ceiling_survive_derived_contexts() {
+ let parent = root("/tmp/autonomy-source-parent");
+ let fixed = parent.derive_with(
+ overlay("/tmp/autonomy-source-fixed")
+ .captured_autonomy_tier()
+ .read_only_autonomy_ceiling(),
+ );
+
+ let child = fixed.derive_with(overlay("/tmp/autonomy-source-child"));
+ assert_eq!(
+ child.autonomy_tier_source(),
+ crate::core::runtime::AutonomyTierSource::Captured
+ );
+ assert_eq!(
+ child.autonomy_tier_ceiling(),
+ Some(AutonomyLevel::ReadOnly)
+ );
+
+ let mut source_override = overlay("/tmp/autonomy-source-override");
+ source_override.autonomy_tier_source =
+ Some(crate::core::runtime::AutonomyTierSource::LiveConfig);
+ let overridden = fixed.derive_with(source_override);
+ assert_eq!(
+ overridden.autonomy_tier_source(),
+ crate::core::runtime::AutonomyTierSource::LiveConfig
+ );
+ assert_eq!(
+ overridden.autonomy_tier_ceiling(),
+ Some(AutonomyLevel::ReadOnly),
+ "changing the tier source cannot clear a fixed host ceiling"
+ );
+}
+
#[test]
fn contexts_derived_without_an_agent_share_the_parent_slots() {
let parent = root("/tmp/agent-scope-shared");
diff --git a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
index cac3b618b0..1a8fa45c14 100644
--- a/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
+++ b/crates/openhuman-core/src/core/runtime/dispatch_ctx.rs
@@ -163,7 +163,7 @@ impl DispatchCtx {
/// Source binding for live autonomy-tier decisions under this dispatch.
pub fn autonomy_tier_source(&self) -> super::AutonomyTierSource {
self.resolved()
- .map_or(super::AutonomyTierSource::LiveConfig, |core| {
+ .map_or(super::AutonomyTierSource::Captured, |core| {
core.autonomy_tier_source()
})
}
diff --git a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
index 8b0b10cd4f..dee8b999ef 100644
--- a/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
+++ b/crates/openhuman-core/src/flows/tinyflows/caps/ops_tier_gate_and_timeouts_tests.rs
@@ -84,9 +84,18 @@ async fn code_adapter_observes_file_backed_tier_changes_between_calls() {
..AutonomyConfig::default()
};
config.save().await.unwrap();
+ let context = crate::core::runtime::CoreContext::for_test(
+ crate::core::runtime::DomainSet::full(),
+ Some(config.workspace_dir.clone()),
+ )
+ .derive_with(crate::core::runtime::ContextOverlay::new(
+ config.clone(),
+ crate::core::runtime::DomainSet::full(),
+ crate::tools::toolpacks::ToolGroups::default(),
+ ));
let code = OpenHumanCode {
- ctx: crate::core::runtime::DispatchCtx::ambient(),
+ ctx: crate::core::runtime::DispatchCtx::new(context),
security: Arc::new(SecurityPolicy::from_config(
&config.autonomy,
&config.workspace_dir,