feat: implement abort mechanism for workflows and subagents

This commit is contained in:
asepharyana
2026-07-13 09:09:23 +07:00
parent 65647ce517
commit 104b0daf4c
5 changed files with 104 additions and 32 deletions
+4
View File
@@ -106,11 +106,13 @@ impl Tool for SpawnAgents {
// by this tool call are isolated from any other concurrent
// spawn_agents or workflow_run invocations.
let findings: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(Vec::new()));
let no_abort: Option<std::sync::Arc<std::sync::atomic::AtomicBool>> = None;
let results = crate::app::workflow::engine::execute_primitive(
&wf.script,
&HashMap::new(),
max_concurrency,
true,
&no_abort,
live.as_ref(),
&ctx.session_dir,
&ctx.workspaces,
@@ -195,11 +197,13 @@ impl Tool for SpawnPipeline {
// Per-invocation findings scope isolates this pipeline from any
// other concurrent spawn_agents / spawn_pipeline / workflow_run.
let findings: Arc<Mutex<Vec<String>>> = Arc::new(Mutex::new(Vec::new()));
let no_abort: Option<std::sync::Arc<std::sync::atomic::AtomicBool>> = None;
let results = crate::app::workflow::engine::execute_primitive(
&wf.script,
&HashMap::new(),
1,
false,
&no_abort,
live.as_ref(),
&ctx.session_dir,
&ctx.workspaces,
+3
View File
@@ -186,6 +186,7 @@ impl Tool for CompanyPipeline {
.and_then(|v| v.as_str())
.unwrap_or("full");
let no_abort: Option<std::sync::Arc<std::sync::atomic::AtomicBool>> = None;
match mode {
"quick" => {
crate::app::workflow::company::run_company_pipeline_quick(
@@ -193,6 +194,7 @@ impl Tool for CompanyPipeline {
&ctx.session_dir,
&ctx.workspaces,
ctx.turn_events.as_ref(),
&no_abort,
)
}
_ => {
@@ -201,6 +203,7 @@ impl Tool for CompanyPipeline {
&ctx.session_dir,
&ctx.workspaces,
ctx.turn_events.as_ref(),
&no_abort,
)
}
}