Skip to content

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

test(subagent-sessions): cover stale and post-close failure rejection

Steven Enamakel95fb4acecf59
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
index 4edad2638c..c9b18de594 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops_tests.rs
@@ -118,6 +118,14 @@ fn stale_completion_cannot_overwrite_reused_or_closed_session() {
assert_eq!(current.current_task_id.as_deref(), Some("second-task"));
assert_eq!(current.status, DurableSubagentStatus::Running);
assert!(current.latest_history.is_none());
+ assert!(mark_failed(
+ &store,
+ &second.subagent_session_id,
+ "first-task",
+ "stale failure".into(),
+ )
+ .is_err());
+ assert!(store.load().unwrap()[0].latest_error.is_none());
close(&store, &second.subagent_session_id).unwrap();
assert!(mark_finished(
@@ -128,6 +136,13 @@ fn stale_completion_cannot_overwrite_reused_or_closed_session() {
vec![TranscriptMessage::user("late after close")],
)
.is_err());
+ assert!(mark_failed(
+ &store,
+ &second.subagent_session_id,
+ "second-task",
+ "late failure".into(),
+ )
+ .is_err());
let closed = store.load().unwrap().remove(0);
assert_eq!(closed.status, DurableSubagentStatus::Closed);
assert!(closed.latest_history.is_none());