Keep max-depth collab tool schemas stable

This commit is contained in:
Friel
2026-04-04 01:12:31 +00:00
parent 9d48bd4dc3
commit 679de088a3
4 changed files with 12 additions and 21 deletions

View File

@@ -419,16 +419,10 @@ impl AgentControl {
async fn resume_single_agent_from_rollout(
&self,
mut config: crate::config::Config,
config: crate::config::Config,
thread_id: ThreadId,
session_source: SessionSource,
) -> CodexResult<ThreadId> {
if let SessionSource::SubAgent(SubAgentSource::ThreadSpawn { depth, .. }) = &session_source
&& *depth >= config.agent_max_depth
{
let _ = config.features.disable(Feature::SpawnCsv);
let _ = config.features.disable(Feature::Collab);
}
let state = self.upgrade()?;
let mut reservation = self.state.reserve_spawn_slot(config.agent_max_threads)?;
let (session_source, agent_metadata) = match session_source {

View File

@@ -496,13 +496,6 @@ impl Codex {
);
}
if let SessionSource::SubAgent(SubAgentSource::ThreadSpawn { depth, .. }) = session_source
&& depth >= config.agent_max_depth
{
let _ = config.features.disable(Feature::SpawnCsv);
let _ = config.features.disable(Feature::Collab);
}
if config.features.enabled(Feature::JsRepl)
&& let Err(err) = resolve_compatible_node(config.js_repl_node_path.as_deref()).await
{

View File

@@ -8,7 +8,6 @@ use crate::models_manager::manager::RefreshStrategy;
use crate::tools::context::FunctionToolOutput;
use crate::tools::context::ToolOutput;
use crate::tools::context::ToolPayload;
use codex_features::Feature;
use codex_protocol::AgentPath;
use codex_protocol::ThreadId;
use codex_protocol::models::BaseInstructions;
@@ -264,12 +263,7 @@ pub(crate) fn apply_spawn_agent_runtime_overrides(
Ok(())
}
pub(crate) fn apply_spawn_agent_overrides(config: &mut Config, child_depth: i32) {
if child_depth >= config.agent_max_depth && !config.features.enabled(Feature::MultiAgentV2) {
let _ = config.features.disable(Feature::SpawnCsv);
let _ = config.features.disable(Feature::Collab);
}
}
pub(crate) fn apply_spawn_agent_overrides(_config: &mut Config, _child_depth: i32) {}
pub(crate) async fn apply_requested_spawn_agent_model_overrides(
session: &Session,

View File

@@ -1762,6 +1762,10 @@ async fn spawn_agent_allows_depth_up_to_configured_max_depth() {
let mut config = (*turn.config).clone();
config.agent_max_depth = DEFAULT_AGENT_MAX_DEPTH + 1;
config
.features
.enable(Feature::SpawnCsv)
.expect("test config should allow spawn_csv");
turn.config = Arc::new(config);
turn.session_source = SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
parent_thread_id: session.conversation_id,
@@ -1785,6 +1789,12 @@ async fn spawn_agent_allows_depth_up_to_configured_max_depth() {
let result: SpawnAgentResult =
serde_json::from_str(&content).expect("spawn_agent result should be json");
assert!(!result.agent_id.is_empty());
let child_thread = manager
.get_thread(parse_agent_id(&result.agent_id))
.await
.expect("spawned max-depth child thread should exist");
assert!(child_thread.enabled(Feature::Collab));
assert!(child_thread.enabled(Feature::SpawnCsv));
assert!(
result
.nickname