Skip to content

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

test(in_process): update goal loading and clearing in e2e tests

Steven Enamakelfb451a9f9db5
diff --git a/tests/in_process/agent_turn_overrides_e2e.rs b/tests/in_process/agent_turn_overrides_e2e.rs
index 5383d53ac2..11db80d1a0 100644
--- a/tests/in_process/agent_turn_overrides_e2e.rs
+++ b/tests/in_process/agent_turn_overrides_e2e.rs
@@ -33,7 +33,6 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use tempfile::TempDir;
-use openhuman_core::agent::goals::runtime as goal_runtime;
use openhuman_core::agent::session_host::TurnOverrides;
use openhuman_core::agent::OpenHumanSessionHost;
use openhuman_core::agent_registry::host_definition::{AgentDefinition, AgentDefinitionRegistry};
@@ -621,15 +620,21 @@ async fn thread_goal_complete_and_clear_stop_the_goal_reaching_later_turns_inner
seed_goal(&workspace_path, THREAD, OBJECTIVE)
.await
.expect("seed an active thread goal for the measured agent");
- let seeded = goal_runtime::load_for_thread(&workspace_path, Some(THREAD))
+ let goal_store = tinyagents_harness_tools::goals::GoalStore::new(
+ openhuman_core::storage::sessions::stores_or_ephemeral(&workspace_path).kv,
+ );
+ let seeded = goal_store
+ .get(THREAD)
.await
+ .ok()
+ .flatten()
.expect("the seeded goal must load before completion");
assert_eq!(
seeded.objective, OBJECTIVE,
"control: the goal must be loadable before completing it"
);
- goal_runtime::complete_for_thread(&workspace_path, Some(THREAD)).await;
+ goal_store.complete(THREAD).await.expect("complete goal");
// A completed goal renders no context block, so a later turn is clean
// with no per-turn override set at all.
@@ -652,11 +657,9 @@ async fn thread_goal_complete_and_clear_stop_the_goal_reaching_later_turns_inner
later turns; found it in: {prompt}"
);
- goal_runtime::clear_for_thread(&workspace_path, Some(THREAD)).await;
+ goal_store.clear(THREAD).await.expect("clear goal");
assert!(
- goal_runtime::load_for_thread(&workspace_path, Some(THREAD))
- .await
- .is_none(),
+ goal_store.get(THREAD).await.unwrap().is_none(),
"clear_for_current_thread must remove the goal row outright"
);
@@ -669,8 +672,11 @@ async fn thread_goal_complete_and_clear_stop_the_goal_reaching_later_turns_inner
seed_goal(&workspace_path, THREAD, ACTIVE_OBJECTIVE)
.await
.expect("seed a second, still-active thread goal");
- let active = goal_runtime::load_for_thread(&workspace_path, Some(THREAD))
+ let active = goal_store
+ .get(THREAD)
.await
+ .ok()
+ .flatten()
.expect("the second goal must load while it is still active");
assert_eq!(
active.objective, ACTIVE_OBJECTIVE,
@@ -678,11 +684,9 @@ async fn thread_goal_complete_and_clear_stop_the_goal_reaching_later_turns_inner
proves nothing"
);
- goal_runtime::clear_for_thread(&workspace_path, Some(THREAD)).await;
+ goal_store.clear(THREAD).await.expect("clear active goal");
assert!(
- goal_runtime::load_for_thread(&workspace_path, Some(THREAD))
- .await
- .is_none(),
+ goal_store.get(THREAD).await.unwrap().is_none(),
"clear_for_current_thread must remove an ACTIVE goal, not only a completed one"
);