Skip to content

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

fix(agent): correct tool registration to use harness assembly

Steven Enamakel0b738c6de72c
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
index 9434ec42b3..aeb496e02c 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
@@ -151,6 +151,11 @@ pub(super) fn assemble_turn_harness(
// The turn's reasoning choice (`reasoning::turn_reasoning_for`), attached
// to every model request this harness builds.
reasoning: Option<tinyinference_llm::model::ReasoningConfig>,
+ // Whether this turn runs on a chat thread (`OpenHumanRunContext::thread_id`
+ // is `Some`). The per-thread `goal_*` tools resolve their target from the
+ // run's thread, so a thread-less turn (a headless `inference_agent_chat`
+ // without a `thread_id`) is not offered them at all (issue #6956).
+ has_thread: bool,
) -> AssembledTurnHarness {
let mut harness: AgentHarness<(), OpenHumanRunContext> = AgentHarness::new();
// Cross-route fallback ownership (issue #4249, Workstream 02.2): populate the
@@ -415,6 +420,7 @@ pub(super) fn assemble_turn_harness(
&early_exit_set,
early_exit_hook.as_ref(),
is_subagent_run,
+ has_thread,
&session_deferred,
);
@@ -728,3 +734,7 @@ pub(super) fn assemble_turn_harness(
prompt_cache_guard,
}
}
+
+#[cfg(test)]
+#[path = "harness_assembly_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
index cadb311565..3d64087c80 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs
@@ -88,6 +88,7 @@ pub(super) fn register_turn_tools_and_agents(
early_exit_set: &HashSet<&str>,
early_exit_hook: Option<&EarlyExitHook>,
is_subagent_run: bool,
+ has_thread: bool,
session_deferred: &HashSet<String>,
) -> (
usize,
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index 635cc67627..2fbca0d62d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -288,6 +288,7 @@ async fn run_turn_via_tinyagents_inner(
&run_context,
hosted_root.as_ref().map(|(base, _)| base.config.as_ref()),
),
+ run_context.thread_id.is_some(),
);
// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).