Skip to content

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

test(orchestration): add subagent control tests

Steven Enamakelb9b112d806f2
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
index 62d0d075ae..2d9708d43c 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_control_tests.rs
@@ -63,11 +63,33 @@ async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {
let _lock = crate::config::TEST_ENV_LOCK.lock().await;
let workspace = tempfile::tempdir().expect("tempdir");
// Snapshot the durable session store before and after: a real cancel
- // would `mark_failed` the session and rewrite this file.
+ // would `mark_failed` the session and rewrite it.
let store = SubagentSessionStore::new(workspace.path().to_path_buf());
- std::fs::create_dir_all(store.path().parent().expect("store has a parent")).expect("mkdir");
- let before = "[]";
- std::fs::write(store.path(), before).expect("seed store");
+ let seeded: Vec<crate::agent::orchestration::subagent_sessions::DurableSubagentSession> =
+ serde_json::from_value(json!([{
+ "subagentSessionId": "subsess-sub-rpc-done",
+ "parentSession": "session-rpc",
+ "parentThreadId": "thread-rpc",
+ "workerThreadId": null,
+ "agentId": "agent_memory",
+ "displayName": null,
+ "model": null,
+ "sandboxMode": "workspace",
+ "actionRoot": null,
+ "taskKey": "task",
+ "taskTitle": "Task",
+ "currentTaskId": "sub-rpc-done",
+ "status": "running",
+ "reusable": true,
+ "latestHistory": null,
+ "latestError": null,
+ "createdAt": "2026-01-01T00:00:00Z",
+ "updatedAt": "2026-01-01T00:00:00Z",
+ "lastUsedAt": "2026-01-01T00:00:00Z"
+ }]))
+ .expect("session fixture");
+ store.save(&seeded).expect("seed store");
+ let before = serde_json::to_string(&store.load().expect("load seeded")).expect("encode");
for (task_id, status, outcome) in [
(
"sub-rpc-done",
@@ -108,7 +130,7 @@ async fn cancel_of_a_finished_run_reports_its_outcome_and_rewrites_nothing() {
assert_eq!(field(&out, "outcome"), Some(json!(outcome)), "{task_id}");
}
assert_eq!(
- std::fs::read_to_string(store.path()).expect("store still readable"),
+ serde_json::to_string(&store.load().expect("store still readable")).expect("encode"),
before,
"a finished run's session must not be rewritten as cancelled"
);