Skip to content

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

refactor(session_host): update context passing in session finalization

Steven Enamakeld3aee3fcf1f9
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 257236bc33..38d7aa3873 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session.rs
@@ -27,12 +27,12 @@ type ActiveTerminalSidecar = std::sync::Arc<
use std::sync::Arc;
use anyhow::Result;
-use tinyagents_graph::goals::ThreadGoalStatus;
use tinyagents_harness::multimodal::markers::extract_image_placeholders_in_text;
use tinyagents_runtime::{
- CommitReceipt, ResumePreparation, SessionBuilder, SessionTerminal, ToolSnapshot,
+ CommitReceipt, ResumePreparation, SessionBuilder, SessionTerminal,
TranscriptTarget, TurnPreparation,
};
+use tinyagents_harness::tool::ToolSnapshot;
use tinyinference_llm::message::Message;
use super::types::OpenHumanSessionHost;
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
index fbc0cfb090..7d3c7659a1 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session/post_commit.rs
@@ -236,6 +236,7 @@ pub(super) async fn finalize_committed_turn(
let started = std::time::Instant::now();
super::account_committed_turn_against_goal(
&prelude.workspace_dir,
+ &receipt.options.context.dispatch_ctx(),
thread_id.as_deref(),
&sidecar,
)
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_usage.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_usage.rs
index a97f98f5f3..7067d6bf73 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_usage.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_usage.rs
@@ -34,13 +34,14 @@ fn rollup_usage(
/// child total the codec attached to the atomic transcript append.
pub(in crate::agent::session_host) async fn account_committed_turn_against_goal(
workspace_dir: &std::path::Path,
+ context: &crate::core::runtime::DispatchCtx,
thread_id: Option<&str>,
sidecar: &crate::agent::tinyagents::host::run_context::SessionTurnSidecar,
) {
let usage = rollup_usage(sidecar);
crate::agent::goals::account_turn(
workspace_dir,
- &crate::core::runtime::DispatchCtx::ambient(),
+ context,
thread_id,
usage.input_tokens,
usage.output_tokens,