Skip to content

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

refactor(agent): remove parent_epoch from registry

Steven Enamakel4782cc38ed2b
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs
index df0935a26b..e6e111e23f 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs
@@ -184,7 +184,6 @@ pub(crate) fn register(
subagent_session_id: Option<String>,
workspace_dir: PathBuf,
parent_thread_id: Option<String>,
- parent_epoch: Option<u64>,
run_queue: Arc<RunQueue<crate::agent::queued_turn::QueuedTurn>>,
abort: AbortHandle,
status: watch::Receiver<DetachedSubagentStatus>,
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 ff2cbe4ee6..8d7ba147c7 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
@@ -232,6 +232,85 @@ fn reused_session_replaces_parent_epoch_for_each_current_task() {
assert_eq!(reopened.parent_epoch, None);
}
+#[test]
+fn reused_session_replaces_parent_epoch_for_each_current_task() {
+ let dir = tempfile::tempdir().unwrap();
+ let store = SubagentSessionStore::new(dir.path().to_path_buf());
+ let first = upsert_running(
+ &store,
+ SubagentSessionUpsert {
+ selector: selector("epoch-reuse"),
+ display_name: None,
+ task_title: "First run".into(),
+ worker_thread_id: None,
+ task_id: "epoch-task-1".into(),
+ lifecycle_key: None,
+ parent_epoch: Some(7),
+ },
+ None,
+ )
+ .unwrap();
+ assert_eq!(first.parent_epoch, Some(7));
+ mark_finished(
+ &store,
+ &first.subagent_session_id,
+ "epoch-task-1",
+ &SubagentRunStatus::Completed,
+ Vec::new(),
+ )
+ .unwrap();
+
+ let second = upsert_running(
+ &store,
+ SubagentSessionUpsert {
+ selector: selector("epoch-reuse"),
+ display_name: None,
+ task_title: "Second run".into(),
+ worker_thread_id: None,
+ task_id: "epoch-task-2".into(),
+ lifecycle_key: None,
+ parent_epoch: Some(8),
+ },
+ Some(&first),
+ )
+ .unwrap();
+ assert_eq!(second.subagent_session_id, first.subagent_session_id);
+ assert_eq!(second.parent_epoch, Some(8));
+ mark_finished(
+ &store,
+ &second.subagent_session_id,
+ "epoch-task-2",
+ &SubagentRunStatus::Completed,
+ Vec::new(),
+ )
+ .unwrap();
+
+ let legacy = upsert_running(
+ &store,
+ SubagentSessionUpsert {
+ selector: selector("epoch-reuse"),
+ display_name: None,
+ task_title: "Legacy run".into(),
+ worker_thread_id: None,
+ task_id: "epoch-task-3".into(),
+ lifecycle_key: None,
+ parent_epoch: None,
+ },
+ Some(&second),
+ )
+ .unwrap();
+ assert_eq!(legacy.subagent_session_id, first.subagent_session_id);
+ assert_eq!(legacy.parent_epoch, None);
+ let reopened = store
+ .load()
+ .unwrap()
+ .into_iter()
+ .find(|session| session.subagent_session_id == first.subagent_session_id)
+ .unwrap();
+ assert_eq!(reopened.current_task_id.as_deref(), Some("epoch-task-3"));
+ assert_eq!(reopened.parent_epoch, None);
+}
+
#[test]
fn driver_task_cancel_reports_legacy_failure_and_refuses_ambiguous_ids() {
let dir = tempfile::tempdir().unwrap();