diff --git a/codex-rs/core/src/agent/mod.rs b/codex-rs/core/src/agent/mod.rs index 03652e43e5..7f462a07c9 100644 --- a/codex-rs/core/src/agent/mod.rs +++ b/codex-rs/core/src/agent/mod.rs @@ -5,6 +5,7 @@ pub(crate) mod status; pub(crate) use codex_protocol::protocol::AgentStatus; pub(crate) use control::AgentControl; +#[cfg(test)] pub(crate) use guards::MAX_THREAD_SPAWN_DEPTH; pub(crate) use guards::exceeds_thread_spawn_depth_limit; pub(crate) use guards::next_thread_spawn_depth; diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index dc7d5902d6..0e3b495356 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -10,8 +10,8 @@ use crate::CodexAuth; use crate::SandboxState; use crate::agent::AgentControl; use crate::agent::AgentStatus; -use crate::agent::MAX_THREAD_SPAWN_DEPTH; use crate::agent::agent_status_from_event; +use crate::agent::exceeds_thread_spawn_depth_limit; use crate::analytics_client::AnalyticsEventsClient; use crate::analytics_client::build_track_events_context; use crate::compact; @@ -274,7 +274,7 @@ impl Codex { } if let SessionSource::SubAgent(SubAgentSource::ThreadSpawn { depth, .. }) = session_source - && depth >= MAX_THREAD_SPAWN_DEPTH + && exceeds_thread_spawn_depth_limit(depth) { config.features.disable(Feature::Collab); }