Skip to content

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

refactor(session_host): simplify sidecar type and trim redundant docs

Steven Enamakele6d597383c2f
diff --git a/crates/openhuman-core/src/agent/session_host/driver.rs b/crates/openhuman-core/src/agent/session_host/driver.rs
index 23fd089420..d84124a587 100644
--- a/crates/openhuman-core/src/agent/session_host/driver.rs
+++ b/crates/openhuman-core/src/agent/session_host/driver.rs
@@ -5,6 +5,7 @@
//! complete immutable model history and tool declaration snapshot per call.
mod grounded_close;
+use grounded_close::SupplementalTrace;
use std::{collections::HashSet, sync::Arc, time::Instant};
@@ -233,8 +234,7 @@ impl SessionDriver<OpenHumanRunContext> for OpenHumanSessionDriver {
));
}
};
- let supplemental_trace =
- grounded_close::SupplementalTrace::install_for_turn(&sidecar, &mut outcome);
+ let supplemental_trace = SupplementalTrace::install_for_turn(&sidecar, &mut outcome);
if outcome.text.trim().is_empty() && outcome.tool_outcomes.is_empty() {
return Err(driver_error(
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 ff7c0ca0cb..9aadc63b0f 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -15,6 +15,10 @@ mod transcript;
mod turn;
pub(super) use turn::begin_turn_resume;
+type ActiveTerminalSidecar = std::sync::Arc<
+ std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,
+>;
+
use std::sync::Arc;
use anyhow::Result;
@@ -59,14 +63,8 @@ pub(super) struct OpenHumanSessionState {
pub(super) reply_language_directive: Option<String>,
pub(super) time_zone: Option<String>,
prelude: Option<OpenHumanTurnPrelude>,
- /// Deferred native terminal belonging to the turn currently owned by the
- /// runtime. The session's terminal callback drains it after partial
- /// transcript persistence on cancellation or failure.
- active_terminal_sidecar: Option<
- std::sync::Arc<
- std::sync::Mutex<crate::agent::tinyagents::host::run_context::SessionTurnSidecar>,
- >,
- >,
+ /// Deferred native terminal, finalized after transcript durability.
+ active_terminal_sidecar: Option<ActiveTerminalSidecar>,
/// The previous turn's deferred post-commit work (thread-goal
/// accounting). The next turn awaits it before loading the goal
/// (`post_commit::await_pending`).
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 fad0280344..7eac1033f9 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs
@@ -41,12 +41,7 @@ pub(crate) fn fresh_root_run_config(kind: &str) -> tinyagents_harness::context::
/// Builds an owned direct child for the neutral subagent lifecycle.
///
-/// The durable key is derived from `parent` *before* a child exists, preserving
-/// the parent's root id, immediate run id, and thread. `child_config.run_id`
-/// must be a durable-unique child execution id; this helper cannot prove global
-/// uniqueness for a caller-supplied value. The resulting TinyAgents and
-/// OpenHuman cancellation carriers are the same shared token, so either the
-/// lifecycle executor or host child observes cancellation across the tree.
+/// Derives lineage before creation and shares cancellation across the tree.
pub(crate) fn direct_subagent_child(
parent: &tinyagents_harness::context::RunContext<OpenHumanRunContext>,
task_id: impl Into<String>,