mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: disallow runaway subagent chains (#5659)
This commit is contained in:
@@ -412,6 +412,20 @@ impl Agent {
|
||||
cancellation_token: Option<CancellationToken>,
|
||||
session: &Session,
|
||||
) -> (String, Result<ToolCallResult, ErrorData>) {
|
||||
if session.session_type == crate::session::SessionType::SubAgent
|
||||
&& (tool_call.name == DYNAMIC_TASK_TOOL_NAME_PREFIX
|
||||
|| tool_call.name == SUBAGENT_EXECUTE_TASK_TOOL_NAME)
|
||||
{
|
||||
return (
|
||||
request_id,
|
||||
Err(ErrorData::new(
|
||||
ErrorCode::INVALID_REQUEST,
|
||||
"Subagents cannot create other subagents".to_string(),
|
||||
None,
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
if tool_call.name == PLATFORM_MANAGE_SCHEDULE_TOOL_NAME {
|
||||
let arguments = tool_call
|
||||
.arguments
|
||||
|
||||
Reference in New Issue
Block a user