Skip to content

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

test(subagent_sessions): add parent_epoch field to session tests

Steven Enamakel1cc69e8906ea
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema_tests.rs
index 3ec92818da..552a0134ef 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/storage_schema_tests.rs
@@ -19,6 +19,7 @@ fn a_camel_case_session_becomes_a_snake_case_body_with_millisecond_times() {
"workerThreadId": null, "agentId": "researcher", "displayName": null,
"model": null, "sandboxMode": "workspace", "actionRoot": null,
"taskKey": "task", "taskTitle": "Task", "currentTaskId": null,
+ "parentEpoch": 7,
"status": "idle", "reusable": true, "latestHistory": [{"role": "user"}],
"latestError": null,
"createdAt": "1970-01-01T00:00:01Z", "created_at": "1970-01-01T00:00:01Z",
@@ -33,7 +34,8 @@ fn a_camel_case_session_becomes_a_snake_case_body_with_millisecond_times() {
json!({
"subagent_session_id": "s1", "parent_session": "p", "parent_thread_id": "t",
"agent_id": "researcher", "sandbox_mode": "workspace",
- "task_key": "task", "task_title": "Task", "status": "idle", "reusable": true,
+ "task_key": "task", "task_title": "Task", "parent_epoch": 7,
+ "status": "idle", "reusable": true,
"latest_history": [{"role": "user"}],
"created_ms": 1000, "updated_ms": 2000, "last_used_ms": 3000,
})
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
index c49ecd7499..d928003878 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/store_documents_tests.rs
@@ -54,6 +54,7 @@ fn save_upserts_sessions_and_keeps_the_others() {
assert_eq!(loaded[0].parent_session, "parent");
assert_eq!(loaded[0].current_task_id.as_deref(), Some("sub-legacy"));
assert_eq!(loaded[0].lifecycle_key, None);
+ assert_eq!(loaded[0].parent_epoch, None);
// A save from a stale snapshot never removes a session it does not know.
docs.save(&[session("c")]).unwrap();
let ids: Vec<_> = docs
@@ -222,7 +223,9 @@ fn a_durable_session_keeps_its_scoped_lifecycle_key_after_document_reopen() {
task_id: "task".into(),
};
saved.lifecycle_key = Some(key.clone());
+ saved.parent_epoch = Some(7);
docs_in(&storage, "local").save(&[saved]).unwrap();
let loaded = docs_in(&storage, "local").load().unwrap();
assert_eq!(loaded[0].lifecycle_key, Some(key));
+ assert_eq!(loaded[0].parent_epoch, Some(7));
}