Skip to content

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

feat(subagent-sessions): persist lifecycle key on durable sessions

Steven Enamakel421b76832da7
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
index d58c86ead6..31f644b4ce 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/ops.rs
@@ -120,6 +120,7 @@ pub fn upsert_running(
task_key: upsert.selector.task_key.clone(),
task_title: upsert.task_title.clone(),
current_task_id: None,
+ lifecycle_key: None,
status: DurableSubagentStatus::Running,
reusable: true,
latest_history: None,
@@ -135,6 +136,7 @@ pub fn upsert_running(
session.worker_thread_id = upsert.worker_thread_id.or(session.worker_thread_id);
session.display_name = upsert.display_name.or(session.display_name);
session.current_task_id = Some(upsert.task_id);
+ session.lifecycle_key = upsert.lifecycle_key.or(session.lifecycle_key);
session.status = DurableSubagentStatus::Running;
session.reusable = true;
session.latest_error = None;
diff --git a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/types.rs b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/types.rs
index 671c38c097..dd9ed64491 100644
--- a/crates/openhuman-core/src/agent/orchestration/subagent_sessions/types.rs
+++ b/crates/openhuman-core/src/agent/orchestration/subagent_sessions/types.rs
@@ -60,6 +60,11 @@ pub struct DurableSubagentSession {
pub task_key: String,
pub task_title: String,
pub current_task_id: Option<String>,
+ /// TinyAgents' full lifecycle identity for the current task. Older rows
+ /// do not contain this field; hosts recover those identities from the
+ /// validated checkpoint before resuming or controlling a live child.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub lifecycle_key: Option<tinyagents_orchestration::subagent::SubagentTaskKey>,
pub status: DurableSubagentStatus,
pub reusable: bool,
#[serde(default, with = "crate::agent::messages::history_wire::option")]
@@ -137,6 +142,10 @@ pub struct SubagentSessionUpsert {
pub task_title: String,
pub worker_thread_id: Option<String>,
pub task_id: String,
+ /// Full TinyAgents lifecycle identity when the caller owns one. `None` is
+ /// retained for legacy host paths and rows written before this field was
+ /// introduced.
+ pub lifecycle_key: Option<tinyagents_orchestration::subagent::SubagentTaskKey>,
}
#[derive(Debug, Clone)]