Skip to content

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

test(session_host): register a fake tool in legacy history tests

Steven Enamakelce3042430c2b
diff --git a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
index 2c508a44b2..8516858c4c 100644
--- a/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/imported_history_tests.rs
@@ -192,6 +192,12 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {
let root = tempfile::tempdir().expect("workspace");
let locator = crate::agent::session_store::splice_fixture::memory_locator();
+ let tool = || {
+ Box::new(tinyagents_harness::testkit::FakeTool::returning(
+ "legacy_history_probe",
+ "ok",
+ )) as Box<dyn tinytools::Tool>
+ };
let model = Arc::new(tinyagents_harness::testkit::ScriptedModel::replies(vec![
"reply after legacy adoption",
]));
@@ -199,6 +205,7 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {
let mut host = SessionHostBuilder::new()
.with_session_history_locator(Arc::clone(&locator))
.chat_model(chat_model)
+ .tools(vec![tool()])
.workspace_dir(root.path().join("workspace"))
.action_dir(root.path().to_path_buf())
.tool_dispatcher(Box::new(tinytools_agent::dialect::NativeDialect))
@@ -298,6 +305,7 @@ async fn legacy_history_is_loaded_only_for_an_unwritten_bound_session() {
let mut resumed = SessionHostBuilder::new()
.with_session_history_locator(locator.clone())
.chat_model(second_chat_model)
+ .tools(vec![tool()])
.workspace_dir(second_root.path().join("workspace"))
.action_dir(second_root.path().to_path_buf())
.tool_dispatcher(Box::new(tinytools_agent::dialect::NativeDialect))