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 test module for tiny session store

Steven Enamakel05421e0cfc4c
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
index dbf624a5e4..0c2217197b 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port.rs
@@ -202,3 +202,7 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
Ok(true)
}
}
+
+#[cfg(test)]
+#[path = "tiny_port_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs
new file mode 100644
index 0000000000..a39c903e39
--- /dev/null
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/tiny_port_tests.rs
@@ -0,0 +1,43 @@
+use super::*;
+
+#[tokio::test]
+async fn old_rows_without_checkpoint_identity_remain_readable_without_fabricated_keys() {
+ let workspace = tempfile::tempdir().unwrap();
+ let store = SubagentSessionStore::new(workspace.path().to_path_buf());
+ let row: DurableSubagentSession = serde_json::from_value(serde_json::json!({
+ "subagentSessionId": "legacy-session",
+ "parentSession": "owner",
+ "parentThreadId": "thread",
+ "workerThreadId": null,
+ "agentId": "researcher",
+ "displayName": null,
+ "model": null,
+ "sandboxMode": "workspace",
+ "actionRoot": null,
+ "taskKey": "analysis",
+ "taskTitle": "Analyze",
+ "currentTaskId": "legacy-task",
+ "status": "idle",
+ "reusable": true,
+ "latestHistory": null,
+ "latestError": null,
+ "createdAt": "2026-01-01T00:00:00Z",
+ "updatedAt": "2026-01-01T00:00:00Z",
+ "lastUsedAt": "2026-01-01T00:00:00Z"
+ }))
+ .unwrap();
+ assert!(row.lifecycle_key.is_none());
+ store.save(&[row]).unwrap();
+
+ let port = OpenHumanTinySubagentSessionStore::new(workspace.path().to_path_buf());
+ let sessions = port.list_for_parent("owner", Some("thread")).await.unwrap();
+ assert_eq!(sessions.len(), 1);
+ assert_eq!(sessions[0].subagent_session_id, "legacy-session");
+ assert_eq!(sessions[0].current_task_id.as_deref(), Some("legacy-task"));
+ assert!(sessions[0].lifecycle_key.is_none());
+ assert!(port
+ .list_for_parent("foreign-owner", Some("thread"))
+ .await
+ .unwrap()
+ .is_empty());
+}