Skip to content

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

fix(agent): encapsulate direct runner parents

Steven Enamakel4bbdf0998394
diff --git a/crates/openhuman-core/src/agent/harness/session/turn/core/experience_context.rs b/crates/openhuman-core/src/agent/harness/session/turn/core/experience_context.rs
index aa1983ad03..ad43c83dad 100644
--- a/crates/openhuman-core/src/agent/harness/session/turn/core/experience_context.rs
+++ b/crates/openhuman-core/src/agent/harness/session/turn/core/experience_context.rs
@@ -127,10 +127,8 @@ impl Agent {
let options = harness::SubagentRunOptions {
task_id: Some(task_id.clone()),
model_override: Some(parent_context.model_name.clone()),
- run_context: crate::agent::tinyagents::host::OpenHumanRunContext {
- parent: Some(parent_context.clone()),
- ..Default::default()
- },
+ run_context: crate::agent::tinyagents::host::OpenHumanRunContext::new()
+ .with_parent(parent_context.clone()),
..Default::default()
};
diff --git a/crates/openhuman-core/src/agent/harness/session/turn/session_io/background_tasks.rs b/crates/openhuman-core/src/agent/harness/session/turn/session_io/background_tasks.rs
index 43baac06e0..7922cf2aa2 100644
--- a/crates/openhuman-core/src/agent/harness/session/turn/session_io/background_tasks.rs
+++ b/crates/openhuman-core/src/agent/harness/session/turn/session_io/background_tasks.rs
@@ -74,10 +74,8 @@ impl Agent {
tokio::spawn(async move {
let options = harness::SubagentRunOptions {
- run_context: crate::agent::tinyagents::host::OpenHumanRunContext {
- parent: Some(parent_ctx),
- ..Default::default()
- },
+ run_context: crate::agent::tinyagents::host::OpenHumanRunContext::new()
+ .with_parent(parent_ctx),
..Default::default()
};
let result = harness::run_subagent(&definition, &extraction_prompt, options).await;
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
index b24773195e..296312762b 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -247,6 +247,13 @@ impl OpenHumanRunContext {
self
}
+ /// Binds a direct runner to its explicit parent without exposing the
+ /// child-ledger link reserved for recursive [`Self::child`] calls.
+ pub(crate) fn with_parent(mut self, parent: ParentExecutionContext) -> Self {
+ self.parent = Some(parent);
+ self
+ }
+
/// Sets the same cancellation token on this context and its TinyAgents run.
pub fn with_cancellation(
mut self,
diff --git a/crates/openhuman-core/src/agent/triage/escalation.rs b/crates/openhuman-core/src/agent/triage/escalation.rs
index e615da7809..8eb32f020b 100644
--- a/crates/openhuman-core/src/agent/triage/escalation.rs
+++ b/crates/openhuman-core/src/agent/triage/escalation.rs
@@ -315,10 +315,8 @@ async fn dispatch_target_agent(agent_id: &str, prompt: &str) -> anyhow::Result<S
definition,
prompt,
SubagentRunOptions {
- run_context: crate::agent::tinyagents::host::OpenHumanRunContext {
- parent: Some(parent_ctx),
- ..Default::default()
- },
+ run_context: crate::agent::tinyagents::host::OpenHumanRunContext::new()
+ .with_parent(parent_ctx),
..Default::default()
},
)