Skip to content

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

fix(agent): remove unused reasoning module and related imports

Steven Enamakelf495167bd44e
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session.rs b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
index a90d31d25c..4ffc7ee11d 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -744,20 +744,6 @@ impl OpenHumanTurnPrelude {
self.tool_dispatcher.tool_call_format(),
)
.harness_dispatcher();
- // The thread's reasoning choice is read per turn, so changing it keeps
- // this warm session; the effective config supplies the default.
- run_context.reasoning = crate::agent::tinyagents::turn_reasoning(
- self.thread_id.as_deref(),
- self.runtime_config.as_deref(),
- );
- if let Some(reasoning) = run_context.reasoning.as_ref() {
- log::debug!(
- "[agent][reasoning] turn reasoning effort={:?} budget_tokens={:?} agent={}",
- reasoning.effort,
- reasoning.budget_tokens,
- self.agent_definition_id
- );
- }
self.context
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner)
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
index e4e6edf06f..9434ec42b3 100644
--- a/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs
@@ -148,7 +148,7 @@ pub(super) fn assemble_turn_harness(
// `None` for a caller with no thread identity (a sub-agent child, most
// notably), which never runs in plan mode.
run_mode: Option<RunModeHandle>,
- // The turn's reasoning choice (`OpenHumanRunContext::reasoning`), attached
+ // The turn's reasoning choice (`reasoning::turn_reasoning_for`), attached
// to every model request this harness builds.
reasoning: Option<tinyinference_llm::model::ReasoningConfig>,
) -> AssembledTurnHarness {
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 555e9b6e89..aab9227362 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -307,12 +307,6 @@ pub struct OpenHumanRunContext {
/// the registry that recovers positional / code-style calls; `Auto`
/// (the default) leaves the harness to choose from the model profile.
pub(crate) tool_dialect: tinyagents_harness::config::ToolDispatcher,
- /// The reasoning ("thinking") config this turn asks every model call for,
- /// resolved from the session's effective config
- /// (`agent::tinyagents::reasoning_for_config`). Turn assembly installs it
- /// as the harness `RunPolicy::default_reasoning`; `None` leaves the
- /// provider default.
- pub(crate) reasoning: Option<tinyinference_llm::model::ReasoningConfig>,
}
impl Default for OpenHumanRunContext {
@@ -354,7 +348,6 @@ impl OpenHumanRunContext {
session_sidecar: Arc::new(Mutex::new(SessionTurnSidecar::default())),
required_output: None,
tool_dialect: tinyagents_harness::config::ToolDispatcher::Auto,
- reasoning: None,
}
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/mod.rs b/crates/openhuman-core/src/agent/tinyagents/mod.rs
index 8bd194df5e..1ef1108b4d 100644
--- a/crates/openhuman-core/src/agent/tinyagents/mod.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/mod.rs
@@ -46,7 +46,7 @@ pub mod run_mode;
pub mod payload_summarizer;
mod policy_denial;
pub(crate) mod reaper;
-mod reasoning;
+pub(crate) mod reasoning;
pub(crate) mod replay;
pub(crate) mod retriever;
mod routes;
diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
index 0eef11fd66..c0cb20cc4e 100644
--- a/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning.rs
@@ -70,6 +70,35 @@ pub(crate) fn apply_requested_effort(thread_id: &str, raw: Option<&str>) -> Resu
Ok(())
}
+/// The reasoning config for the turn `ctx` is about to run, or `None` for the
+/// provider default.
+///
+/// Only a root turn (spawn depth 0) follows the user's thinking level; a
+/// sub-agent runs at its provider default, since the user picked a level for
+/// the conversation, not for every delegated helper. The config comes from
+/// the session snapshot the root turn carries (`ParentExecutionContext`).
+pub(crate) fn turn_reasoning_for(
+ ctx: &crate::agent::tinyagents::host::OpenHumanRunContext,
+) -> Option<ReasoningConfig> {
+ if ctx.spawn_depth > 0 {
+ return None;
+ }
+ let config = ctx
+ .parent
+ .as_ref()
+ .and_then(|parent| parent.runtime_config.as_deref());
+ let reasoning = turn_reasoning(ctx.thread_id.as_deref(), config);
+ if let Some(reasoning) = reasoning.as_ref() {
+ log::debug!(
+ "[agent][reasoning] turn reasoning effort={:?} budget_tokens={:?} thread_id={:?}",
+ reasoning.effort,
+ reasoning.budget_tokens,
+ ctx.thread_id
+ );
+ }
+ reasoning
+}
+
/// The reasoning config one agent turn should request: the thread's own
/// choice, else [`reasoning_for_config`].
pub(crate) fn turn_reasoning(
diff --git a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
index c6581521ef..00d041946a 100644
--- a/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/reasoning_tests.rs
@@ -93,3 +93,27 @@ fn unknown_requested_effort_is_rejected_and_keeps_the_prior_choice() {
fn turn_without_thread_or_config_has_no_reasoning() {
assert_eq!(turn_reasoning(None, None), None);
}
+
+#[test]
+fn root_turn_follows_the_thread_choice() {
+ let thread = "reasoning-test-thread-root";
+ set_thread_effort(thread, Some(ReasoningEffort::High));
+ let mut ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();
+ ctx.thread_id = Some(thread.to_string());
+ assert_eq!(
+ turn_reasoning_for(&ctx),
+ Some(ReasoningConfig::effort(ReasoningEffort::High))
+ );
+ set_thread_effort(thread, None);
+}
+
+#[test]
+fn subagent_turn_keeps_the_provider_default() {
+ let thread = "reasoning-test-thread-subagent";
+ set_thread_effort(thread, Some(ReasoningEffort::High));
+ let mut ctx = crate::agent::tinyagents::host::OpenHumanRunContext::new();
+ ctx.thread_id = Some(thread.to_string());
+ ctx.spawn_depth = 1;
+ assert_eq!(turn_reasoning_for(&ctx), None);
+ set_thread_effort(thread, None);
+}
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
index 05fad760e2..5a188879e1 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_runner.rs
@@ -280,7 +280,7 @@ async fn run_turn_via_tinyagents_inner(
.thread_id
.as_deref()
.map(crate::agent::tinyagents::run_mode::handle_for_thread),
- run_context.reasoning.clone(),
+ crate::agent::tinyagents::reasoning::turn_reasoning_for(&run_context),
);
// Fail-closed registry validation gate (issue #4249, Workstream 10 — registry).