Skip to content

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

fix(subagent_sessions): scope listing to the port's own thread

Steven Enamakela590515774fd
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 cfe7b100be..c013b62d4e 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
@@ -127,7 +127,11 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
}) {
return Ok(Vec::new());
}
- super::list_for_parent(&self.store, parent_session, thread_id)
+ super::list_for_parent(
+ &self.store,
+ parent_session,
+ self.parent_thread_id.as_deref(),
+ )
.map_err(SubagentError::Persistence)?
.into_iter()
.filter(|row| self.is_owned(row))
@@ -156,7 +160,7 @@ impl TinySessionStore for OpenHumanTinySubagentSessionStore {
|| upsert.lifecycle_key.thread_id != self.parent_thread_id
|| upsert.lifecycle_key.task_id != upsert.task_id
{
- return Err(SubagentError::Session(
+ return Err(SubagentError::InvalidRequest(
"subagent session upsert is outside its authenticated owner scope".into(),
));
}
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
index 4c365f514f..1249fe52d5 100644
--- 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
@@ -63,7 +63,7 @@ async fn old_rows_without_checkpoint_identity_remain_readable_without_fabricated
async fn unthreaded_port_lists_only_unthreaded_rows() {
let workspace = tempfile::tempdir().unwrap();
let store = SubagentSessionStore::new(workspace.path().to_path_buf());
- let mut unthreaded: DurableSubagentSession = serde_json::from_value(serde_json::json!({
+ let unthreaded: DurableSubagentSession = serde_json::from_value(serde_json::json!({
"subagentSessionId": "unthreaded-session",
"parentSession": "owner",
"parentThreadId": null,
@@ -86,7 +86,6 @@ async fn unthreaded_port_lists_only_unthreaded_rows() {
}))
.unwrap();
let mut threaded = unthreaded.clone();
- unthreaded.subagent_session_id = "unthreaded-session".into();
threaded.subagent_session_id = "threaded-session".into();
threaded.parent_thread_id = Some("thread-a".into());
store.save(&[unthreaded, threaded]).unwrap();