fix: Clean up orphaned sub-agents when the parent agent
This commit is contained in:
+5
-1
@@ -1,10 +1,10 @@
|
|||||||
mod agent;
|
mod agent;
|
||||||
mod input;
|
mod input;
|
||||||
mod macros;
|
mod macros;
|
||||||
|
mod prompts;
|
||||||
mod role;
|
mod role;
|
||||||
mod session;
|
mod session;
|
||||||
pub(crate) mod todo;
|
pub(crate) mod todo;
|
||||||
mod prompts;
|
|
||||||
|
|
||||||
pub use self::agent::{Agent, AgentVariables, complete_agent_variables, list_agents};
|
pub use self::agent::{Agent, AgentVariables, complete_agent_variables, list_agents};
|
||||||
pub use self::input::Input;
|
pub use self::input::Input;
|
||||||
@@ -1898,6 +1898,10 @@ impl Config {
|
|||||||
self.exit_session()?;
|
self.exit_session()?;
|
||||||
self.load_functions()?;
|
self.load_functions()?;
|
||||||
if self.agent.take().is_some() {
|
if self.agent.take().is_some() {
|
||||||
|
if let Some(ref supervisor) = self.supervisor {
|
||||||
|
supervisor.read().cancel_all();
|
||||||
|
}
|
||||||
|
self.supervisor.take();
|
||||||
self.rag.take();
|
self.rag.take();
|
||||||
self.discontinuous_last_message();
|
self.discontinuous_last_message();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,6 +305,10 @@ fn run_child_agent(
|
|||||||
input = input.merge_tool_results(output, tool_results);
|
input = input.merge_tool_results(output, tool_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(ref supervisor) = child_config.read().supervisor {
|
||||||
|
supervisor.read().cancel_all();
|
||||||
|
}
|
||||||
|
|
||||||
Ok(accumulated_output)
|
Ok(accumulated_output)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user