diff --git a/codex-rs/app-server/tests/suite/v2/thread_fork.rs b/codex-rs/app-server/tests/suite/v2/thread_fork.rs index f623738742..6023a3ef2e 100644 --- a/codex-rs/app-server/tests/suite/v2/thread_fork.rs +++ b/codex-rs/app-server/tests/suite/v2/thread_fork.rs @@ -338,17 +338,22 @@ async fn thread_fork_honors_explicit_null_thread_instructions() -> Result<()> { expect_instructions, "unexpected instructions field in payload: {payload:?}" ); + let developer_texts = request.message_input_texts("developer"); if index == 2 { assert_eq!( payload.get("instructions"), Some(&Value::String(String::new())) ); + assert!( + developer_texts.iter().any(|text| text.is_empty()), + "expected explicit empty developerInstructions to produce an empty developer instruction message: {developer_texts:?}" + ); + } else { + assert!( + developer_texts.iter().all(|text| !text.is_empty()), + "did not expect empty developer instruction messages: {developer_texts:?}" + ); } - let developer_texts = request.message_input_texts("developer"); - assert!( - developer_texts.iter().all(|text| !text.is_empty()), - "did not expect empty developer instruction messages: {developer_texts:?}" - ); } Ok(()) diff --git a/codex-rs/app-server/tests/suite/v2/turn_start.rs b/codex-rs/app-server/tests/suite/v2/turn_start.rs index 193a76ccf3..b09b78d3bc 100644 --- a/codex-rs/app-server/tests/suite/v2/turn_start.rs +++ b/codex-rs/app-server/tests/suite/v2/turn_start.rs @@ -252,17 +252,22 @@ async fn turn_start_honors_explicit_null_thread_instructions() -> Result<()> { expect_instructions, "unexpected instructions field in payload: {payload:?}" ); + let developer_texts = request.message_input_texts("developer"); if index == 2 { assert_eq!( payload.get("instructions"), Some(&Value::String(String::new())) ); + assert!( + developer_texts.iter().any(|text| text.is_empty()), + "expected explicit empty developerInstructions to produce an empty developer instruction message: {developer_texts:?}" + ); + } else { + assert!( + developer_texts.iter().all(|text| !text.is_empty()), + "did not expect empty developer instruction messages: {developer_texts:?}" + ); } - let developer_texts = request.message_input_texts("developer"); - assert!( - developer_texts.iter().all(|text| !text.is_empty()), - "did not expect empty developer instruction messages: {developer_texts:?}" - ); } Ok(()) diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index 11bfade15c..f7484ba677 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -3664,7 +3664,6 @@ impl Session { // stays isolated as its own top-level developer message for guardian subagents. if !separate_guardian_developer_message && let Some(developer_instructions) = turn_context.developer_instructions.as_deref() - && !developer_instructions.is_empty() { developer_sections.push(developer_instructions.to_string()); } @@ -3779,7 +3778,6 @@ impl Session { // subagent sees a distinct, easy-to-audit instruction block. if separate_guardian_developer_message && let Some(developer_instructions) = turn_context.developer_instructions.as_deref() - && !developer_instructions.is_empty() && let Some(guardian_developer_message) = crate::context_manager::updates::build_developer_update_item(vec![ developer_instructions.to_string(),