Skip to content

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

test(session_host): add coverage for orphaned head resume and transcript compat

Steven Enamakel327cb3849fed
diff --git a/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs b/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
index 89a7d12293..5dce223143 100644
--- a/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/orphaned_head_resume_tests.rs
@@ -46,6 +46,12 @@ async fn resumed_orphaned_tool_head_is_repaired_before_the_request() {
let chat_model: Arc<dyn tinyinference_llm::model::ChatModel<()>> = model.clone();
let new_host = || {
crate::agent::SessionHostBuilder::new()
+ // Splices raw JSONL rows: the host writes through the file locator.
+ .with_session_history_locator(Arc::new(
+ tinyagents_session::transcript::FileTranscriptLocator::new(
+ root.path().join("workspace"),
+ ),
+ ))
.chat_model(chat_model.clone())
.tools(Vec::new())
.workspace_dir(root.path().join("workspace"))
diff --git a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs
index 4c4c7edc03..30e2ee128e 100644
--- a/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/transcript_compat_tests.rs
@@ -171,6 +171,17 @@ pub(super) fn model(responses: Vec<ModelResponse>, native: bool) -> Arc<Scripted
}))
}
+/// These suites pin the classic JSONL transcript format and its resume
+/// behaviour, so their hosts write through the file locator explicitly (the
+/// default for a host with no session store is the workspace's driver store).
+pub(super) fn file_locator(
+ root: &Path,
+) -> Arc<dyn tinyagents_session::transcript::TranscriptLocator> {
+ Arc::new(tinyagents_session::transcript::FileTranscriptLocator::new(
+ root.join("workspace"),
+ ))
+}
+
pub(super) fn build_host(
root: &Path,
model: Arc<ScriptedModel>,
@@ -179,6 +190,7 @@ pub(super) fn build_host(
) -> crate::agent::OpenHumanSessionHost {
let chat_model: Arc<dyn ChatModel<()>> = model;
let builder = crate::agent::SessionHostBuilder::new()
+ .with_session_history_locator(file_locator(root))
.chat_model(chat_model)
.tools(tools())
.workspace_dir(root.join("workspace"))
@@ -623,6 +635,7 @@ fn assert_retired_tool_replay(identity_bound: bool) {
);
let chat_model: Arc<dyn ChatModel<()>> = first_model;
let mut first = crate::agent::SessionHostBuilder::new()
+ .with_session_history_locator(file_locator(root.path()))
.chat_model(chat_model)
.tools(vec![Box::new(ArchivedAudioTool)])
.permanent_tool_names(std::collections::HashSet::from([RETIRED.to_string()]))
@@ -661,6 +674,7 @@ fn assert_retired_tool_replay(identity_bound: bool) {
} else {
let chat_model: Arc<dyn ChatModel<()>> = next.clone();
crate::agent::SessionHostBuilder::new()
+ .with_session_history_locator(file_locator(root.path()))
.chat_model(chat_model)
.tools(tools())
.workspace_dir(workspace.clone())
diff --git a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
index cc7839c40b..5b4f96eae0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/turn_exec_tests.rs
@@ -573,6 +573,12 @@ async fn session_screens_the_new_input_but_not_a_replayed_tool_results_row() {
let chat_model: Arc<dyn tinyinference_llm::model::ChatModel<()>> = model.clone();
let new_host = || {
crate::agent::SessionHostBuilder::new()
+ // Splices raw JSONL rows: the host writes through the file locator.
+ .with_session_history_locator(Arc::new(
+ tinyagents_session::transcript::FileTranscriptLocator::new(
+ root.path().join("workspace"),
+ ),
+ ))
.chat_model(chat_model.clone())
.tools(Vec::new())
.workspace_dir(root.path().join("workspace"))