feat: enhance subagent context with abort flag and implement tool call timeout
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//! including the default read-only tool set for reviewer agents.
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::{Arc, Mutex, atomic::{AtomicBool, Ordering}};
|
||||
use super::spawn::AgentDefinition;
|
||||
|
||||
/// Default read-only tool names granted to `role == "reviewer"` agents.
|
||||
@@ -21,6 +21,11 @@ pub struct SubagentContext {
|
||||
/// workflow run. Set by the workflow engine; `note_finding` writes
|
||||
/// into this from tool code via `ToolCtx.workflow_findings`.
|
||||
pub workflow_findings: Option<Arc<Mutex<Vec<String>>>>,
|
||||
/// Atomic abort flag: when set to `true`, the subagent loop will exit
|
||||
/// at the earliest opportunity (before the next LLM call). Mirrors the
|
||||
/// main agent's `abort_flag` mechanism so that long-running or stuck
|
||||
/// subagents can be cancelled from the parent.
|
||||
pub abort_flag: Option<Arc<AtomicBool>>,
|
||||
}
|
||||
|
||||
/// Build a `SubagentContext` from an `AgentDefinition`.
|
||||
@@ -48,5 +53,6 @@ pub fn build_subagent_context(def: AgentDefinition) -> SubagentContext {
|
||||
session_dir: PathBuf::new(),
|
||||
workspaces: Vec::new(),
|
||||
workflow_findings: None,
|
||||
abort_flag: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user