The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(agent): bind the parent before the triggered memory sub-agent spawns
M3gA-Mindd0488132a102
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rsindex 8c9ee79522..19ac3c5101 100644--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs@@ -720,12 +720,12 @@ impl OpenHumanTurnPrelude {.inject_agent_experience_context(original_user_message, enriched).await;- let parent = self.parent_context();+ let parent = run_context.attach_parent(self.parent_context());let (enriched_with_memory_agent, memory_agent_context_injected) = self.inject_triggered_memory_agent_context(original_user_message,enriched,- &parent,+ parent,overrides.suppress_memory_agent,).await;@@ -745,7 +745,6 @@ impl OpenHumanTurnPrelude {}self.apply_pending_announcements(&mut enriched);- run_context.attach_parent(parent);run_context.prepared_context_sources = Arc::new(prepared_sources);run_context.attachment_placeholders = Arc::new(crate::agent::multimodal::extract_image_placeholders_in_text(original_user_message),diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 5ced16e9f5..6985fbfb71 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -378,9 +378,17 @@ impl OpenHumanRunContext {/// reads "none running" while sub-agents are working. The run context's own/// sink is the live one (it is what `driver.rs` hands the turn graph), so/// prefer it and keep the snapshot as the fallback.- pub(crate) fn attach_parent(&mut self, mut parent: ParentExecutionContext) {+ ///+ /// Returns the installed parent so a caller that must launch a sub-agent+ /// *before* the rest of the turn is assembled — `inject_triggered_memory_agent_context`+ /// is the one such caller — hands it the bound context rather than the+ /// stale snapshot it started from.+ pub(crate) fn attach_parent(+ &mut self,+ mut parent: ParentExecutionContext,+ ) -> &ParentExecutionContext {parent.on_progress = self.progress.clone().or(parent.on_progress);- self.parent = Some(parent);+ self.parent.insert(parent)}/// Sets the same cancellation token on this context and its TinyAgents run.diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rsindex 9086a000c9..989e6dd78c 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context_tests.rs@@ -279,6 +279,32 @@ fn attach_parent_binds_the_runs_live_progress_sink_over_a_stale_snapshot() {);}+/// The returned reference is the bound context, not the caller's snapshot.+///+/// `enrich_request` launches the triggered memory sub-agent *before* the rest+/// of the turn is assembled, so it has to hand that spawn a parent context.+/// Taking it from this return value is what stops it passing the stale+/// snapshot it started from — the same `on_progress = None` that kept+/// `subagent_spawned` out of the Background tasks panel. If this method ever+/// stops returning the installed parent, that call site silently regresses.+#[test]+fn attach_parent_returns_the_bound_parent_not_the_caller_snapshot() {+ let (tx, _rx) = tokio::sync::mpsc::channel(4);+ let mut context = OpenHumanRunContext::new();+ context.progress = Some(tx);+ let snapshot = stale_parent_snapshot();+ assert!(snapshot.on_progress.is_none(), "snapshot starts stale");++ let bound = context.attach_parent(snapshot);++ assert!(+ bound.on_progress.is_some(),+ "the context returned by attach_parent must already carry the run's \+ live sink; a caller that spawns a sub-agent before the turn is \+ assembled uses this value, and a stale one drops SubagentSpawned"+ );+}+/// The bind must not blank a sink the snapshot did carry: a turn with no/// progress subscriber of its own (CLI, cron) leaves the snapshot intact.#[test]