mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
feat: cap number of agents (#9855)
Adding more guards to agent: * Max depth or 1 (i.e. a sub-agent can't spawn another one) * Max 12 sub-agents in total
This commit is contained in:
@@ -1518,7 +1518,10 @@ pub enum SessionSource {
|
||||
pub enum SubAgentSource {
|
||||
Review,
|
||||
Compact,
|
||||
ThreadSpawn { parent_thread_id: ThreadId },
|
||||
ThreadSpawn {
|
||||
parent_thread_id: ThreadId,
|
||||
depth: i32,
|
||||
},
|
||||
Other(String),
|
||||
}
|
||||
|
||||
@@ -1540,8 +1543,11 @@ impl fmt::Display for SubAgentSource {
|
||||
match self {
|
||||
SubAgentSource::Review => f.write_str("review"),
|
||||
SubAgentSource::Compact => f.write_str("compact"),
|
||||
SubAgentSource::ThreadSpawn { parent_thread_id } => {
|
||||
write!(f, "thread_spawn_{parent_thread_id}")
|
||||
SubAgentSource::ThreadSpawn {
|
||||
parent_thread_id,
|
||||
depth,
|
||||
} => {
|
||||
write!(f, "thread_spawn_{parent_thread_id}_d{depth}")
|
||||
}
|
||||
SubAgentSource::Other(other) => f.write_str(other),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user