Skip to content

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

refactor(subagent): simplify pause lookup and drop redundant borrow

Steven Enamakel4adddfe08b8a
diff --git a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
index 6de8bbb3ae..76385403d9 100644
--- a/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
+++ b/crates/openhuman-core/src/agent/subagent_host/lifecycle/driver_result.rs
@@ -57,22 +57,22 @@ pub(crate) async fn resolve_inline_driver_outcome(
host.persistence_disposition
}),
))
- } else if let Some(outcome) = bundle
+ } else {
+ bundle
.persistence
.load_pause(task_key)
.await
.map_err(map_lifecycle_error)?
- {
- Some((
- outcome,
- cached
- .as_ref()
- .map_or(SubagentPersistenceDisposition::PauseExisting, |host| {
- host.persistence_disposition
- }),
- ))
- } else {
- None
+ .map(|outcome| {
+ (
+ outcome,
+ cached
+ .as_ref()
+ .map_or(SubagentPersistenceDisposition::PauseExisting, |host| {
+ host.persistence_disposition
+ }),
+ )
+ })
};
if let Some((outcome, disposition)) = persisted {
diff --git a/crates/openhuman-core/src/agent_runs/subagent_control.rs b/crates/openhuman-core/src/agent_runs/subagent_control.rs
index 311144f780..37236545e1 100644
--- a/crates/openhuman-core/src/agent_runs/subagent_control.rs
+++ b/crates/openhuman-core/src/agent_runs/subagent_control.rs
@@ -189,7 +189,7 @@ fn handle_subagent_cancel(ctx: DispatchCtx, params: Map<String, Value>) -> Contr
subagent_sessions::SubagentSessionStore::new(meta.workspace_dir);
if let Err(err) = subagent_sessions::mark_failed(
&store,
- &subagent_session_id,
+ subagent_session_id,
&task_id,
"cancelled by user".to_string(),
) {