Skip to content

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

fix(agent): resolve delegate graph registry from the live parent context

Steven Enamakelef70b8f93d6a
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
index 3eb48fd125..46c45729e2 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/delegate_graph.rs
@@ -219,7 +219,17 @@ impl DelegateGraphTool {
.map(|n| (n as usize).min(MAX_MAX_REVISIONS))
.unwrap_or(DEFAULT_MAX_REVISIONS);
- let registry = match AgentDefinitionRegistry::current() {
+ // The live parent is the authority for this invocation. Looking only
+ // at `CoreContext::current()` can select another concurrent tenant's
+ // catalogue (or none at all) when callers execute the typed tool with
+ // an explicit parent carrier. Keep the process registry as the legacy
+ // fallback for contexts that do not carry an agent-local catalogue.
+ let registry = match run_context
+ .dispatch_ctx()
+ .into_core()
+ .and_then(|core| core.definitions())
+ .or_else(AgentDefinitionRegistry::global_arc)
+ {
Some(reg) => reg,
None => {
return Ok(ToolResult::error(
diff --git a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
index 34f3440388..0cf3b2f078 100644
--- a/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/tools/tools_e2e_tests.rs
@@ -21,7 +21,6 @@ const WORKER_THREAD_CANARY: &str = "tool-e2e-worker-thread-canary";
#[tokio::test]
async fn spawn_subagent_tool_runs_child_agent_e2e() {
- let _ = AgentDefinitionRegistry::init_global_builtins();
let workspace = tempfile::TempDir::new().expect("workspace");
let provider = Arc::new(ScriptedModel::new(vec![(
SPAWN_SUBAGENT_CANARY,