Skip to content

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

refactor(orchestration): improve parent epoch extraction logic

Steven Enamakelb5dcfe10bd8e
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
index df66722729..5a8cd0c708 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/cancel.rs
@@ -122,9 +122,10 @@ pub(crate) fn cancel_by_task_with_workspace_reason(
reason,
)?;
let parent_epoch = match selected.as_ref().and_then(|selected| {
- selected
- .was_paused
- .then_some((selected.parent_thread_id.as_deref(), selected.task_id.as_str()))
+ selected.was_paused.then_some((
+ selected.parent_thread_id.as_deref(),
+ selected.task_id.as_str(),
+ ))
}) {
Some((Some(thread_id), selected_task_id)) => {
match crate::agent::orchestration::background_completions::paused_task_parent_epoch(
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 e37d705ee2..ece645cb93 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/registry.rs
@@ -233,18 +233,20 @@ pub(crate) fn register(
}
let parent_epoch = match parent_thread_id.as_deref() {
- Some(thread_id) => match crate::agent::orchestration::background_completions::CompletionTarget::new(
- ctx.clone(),
- workspace_dir.clone(),
- parent_session.clone(),
- Some(thread_id.to_owned()),
- ) {
- Ok(target) => target.parent_epoch(),
- Err(error) => {
- abort.abort();
- return Err(RegistrationError::ParentLifecycle(error));
+ Some(thread_id) => {
+ match crate::agent::orchestration::background_completions::CompletionTarget::new(
+ ctx.clone(),
+ workspace_dir.clone(),
+ parent_session.clone(),
+ Some(thread_id.to_owned()),
+ ) {
+ Ok(target) => target.parent_epoch(),
+ Err(error) => {
+ abort.abort();
+ return Err(RegistrationError::ParentLifecycle(error));
+ }
}
- },
+ }
None => None,
};