Lightweight coding agent that runs in your terminal
Rust
chore: hide nickname for debug flag (#17007)
jif-oai99f167e6bfa1
diff --git a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rsindex e30b9b5806..0d460b1a04 100644--- a/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs+++ b/codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs@@ -5,6 +5,7 @@ use crate::agent::control::render_input_preview;use crate::agent::next_thread_spawn_depth;use crate::agent::role::DEFAULT_ROLE_NAME;use crate::agent::role::apply_role_to_config;+use codex_features::Feature;use codex_protocol::AgentPath;use codex_protocol::models::DeveloperInstructions;use codex_protocol::protocol::InterAgentCommunication;@@ -208,10 +209,18 @@ impl ToolHandler for Handler {)})?;- Ok(SpawnAgentResult {- task_name,- nickname,- })+ let hide_agent_metadata = turn+ .config+ .features+ .enabled(Feature::DebugHideSpawnAgentMetadata);+ if hide_agent_metadata {+ Ok(SpawnAgentResult::HiddenMetadata { task_name })+ } else {+ Ok(SpawnAgentResult::WithNickname {+ task_name,+ nickname,+ })+ }}}@@ -267,9 +276,15 @@ impl SpawnAgentArgs {}#[derive(Debug, Serialize)]-pub(crate) struct SpawnAgentResult {- task_name: String,- nickname: Option<String>,+#[serde(untagged)]+pub(crate) enum SpawnAgentResult {+ WithNickname {+ task_name: String,+ nickname: Option<String>,+ },+ HiddenMetadata {+ task_name: String,+ },}impl ToolOutput for SpawnAgentResult {diff --git a/codex-rs/tools/src/agent_tool.rs b/codex-rs/tools/src/agent_tool.rsindex 4a767dbc07..1a1eeb19dc 100644--- a/codex-rs/tools/src/agent_tool.rs+++ b/codex-rs/tools/src/agent_tool.rs@@ -50,7 +50,11 @@ pub fn create_spawn_agent_tool_v1(options: SpawnAgentToolOptions<'_>) -> ToolSpepub fn create_spawn_agent_tool_v2(options: SpawnAgentToolOptions<'_>) -> ToolSpec {let available_models_description = (!options.hide_agent_type_model_reasoning).then(|| spawn_agent_models_description(options.available_models));- let return_value_description = "Returns the canonical task name for the spawned agent, plus the user-facing nickname when available.";+ let return_value_description = if options.hide_agent_type_model_reasoning {+ "Returns the canonical task name for the spawned agent."+ } else {+ "Returns the canonical task name for the spawned agent, plus the user-facing nickname when available."+ };let mut properties = spawn_agent_common_properties_v2(&options.agent_type_description);if options.hide_agent_type_model_reasoning {hide_spawn_agent_metadata_options(&mut properties);@@ -78,7 +82,9 @@ pub fn create_spawn_agent_tool_v2(options: SpawnAgentToolOptions<'_>) -> ToolSperequired: Some(vec!["task_name".to_string(), "message".to_string()]),additional_properties: Some(false.into()),},- output_schema: Some(spawn_agent_output_schema_v2()),+ output_schema: Some(spawn_agent_output_schema_v2(+ options.hide_agent_type_model_reasoning,+ )),})}@@ -371,7 +377,21 @@ fn spawn_agent_output_schema_v1() -> Value {})}-fn spawn_agent_output_schema_v2() -> Value {+fn spawn_agent_output_schema_v2(hide_agent_metadata: bool) -> Value {+ if hide_agent_metadata {+ return json!({+ "type": "object",+ "properties": {+ "task_name": {+ "type": "string",+ "description": "Canonical task name for the spawned agent."+ }+ },+ "required": ["task_name"],+ "additionalProperties": false+ });+ }+json!({"type": "object","properties": {