diff --git a/codex-rs/app-server/tests/suite/v2/compaction.rs b/codex-rs/app-server/tests/suite/v2/compaction.rs index 09d75879f7..5b5faa02d6 100644 --- a/codex-rs/app-server/tests/suite/v2/compaction.rs +++ b/codex-rs/app-server/tests/suite/v2/compaction.rs @@ -203,6 +203,11 @@ async fn thread_compact_start_triggers_compaction_and_returns_empty_response() - skip_if_no_network!(Ok(())); let server = responses::start_mock_server().await; + let sse = responses::sse(vec![ + responses::ev_assistant_message("m1", "MANUAL_COMPACT_SUMMARY"), + responses::ev_completed_with_tokens("r1", 200), + ]); + responses::mount_sse_sequence(&server, vec![sse]).await; let codex_home = TempDir::new()?; write_mock_responses_config_toml( diff --git a/codex-rs/core/tests/suite/compact.rs b/codex-rs/core/tests/suite/compact.rs index 56f1e156a4..b10790698d 100644 --- a/codex-rs/core/tests/suite/compact.rs +++ b/codex-rs/core/tests/suite/compact.rs @@ -62,7 +62,7 @@ const SECOND_AUTO_SUMMARY: &str = "SECOND_AUTO_SUMMARY"; const FINAL_REPLY: &str = "FINAL_REPLY"; const CONTEXT_LIMIT_MESSAGE: &str = "Your input exceeds the context window of this model. Please adjust your input and try again."; -const DUMMY_FUNCTION_NAME: &str = "unsupported_tool"; +const DUMMY_FUNCTION_NAME: &str = "test_tool"; const DUMMY_CALL_ID: &str = "call-multi-auto"; const FUNCTION_CALL_LIMIT_MSG: &str = "function call limit push"; const POST_AUTO_USER_MSG: &str = "post auto follow-up"; @@ -2288,6 +2288,9 @@ async fn manual_compact_retries_after_context_window_error() { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] +// TODO(ccunningham): Re-enable after the follow-up compaction behavior PR lands. +// Current main behavior around non-context manual /compact failures is known-incorrect. +#[ignore = "behavior change covered in follow-up compaction PR"] async fn manual_compact_non_context_failure_retries_then_emits_task_error() { skip_if_no_network!(); @@ -3145,7 +3148,7 @@ async fn snapshot_request_shape_pre_turn_compaction_including_incoming_user_mess "pre_turn_compaction_including_incoming_shapes", sectioned_request_shapes(&[ ("Local Compaction Request", &requests[2]), - ("Local Post-Compaction History Request", &requests[3]), + ("Local Post-Compaction History Layout", &requests[3]), ]) ); assert!( @@ -3335,7 +3338,7 @@ async fn snapshot_request_shape_mid_turn_continuation_compaction() { "mid_turn_compaction_shapes", sectioned_request_shapes(&[ ("Local Compaction Request", &requests[1]), - ("Local Post-Compaction History Request", &requests[2]), + ("Local Post-Compaction History Layout", &requests[2]), ]) ); assert!( @@ -3396,7 +3399,7 @@ async fn snapshot_request_shape_manual_compact_without_previous_user_messages() let follow_up_shape = request_input_shape(&requests[0]); insta::assert_snapshot!( "manual_compact_without_prev_user_shapes", - sectioned_request_shapes(&[("Local Post-Compaction History", &requests[0]),]) + sectioned_request_shapes(&[("Local Post-Compaction History Layout", &requests[0]),]) ); assert!( !follow_up_shape.contains(""), @@ -3472,7 +3475,7 @@ async fn snapshot_request_shape_manual_compact_with_previous_user_messages() { "manual_compact_with_history_shapes", sectioned_request_shapes(&[ ("Local Compaction Request", &requests[1]), - ("Local Post-Compaction History Request", &requests[2]), + ("Local Post-Compaction History Layout", &requests[2]), ]) ); assert!( diff --git a/codex-rs/core/tests/suite/compact_remote.rs b/codex-rs/core/tests/suite/compact_remote.rs index f1a470f0db..22a00b70b4 100644 --- a/codex-rs/core/tests/suite/compact_remote.rs +++ b/codex-rs/core/tests/suite/compact_remote.rs @@ -41,7 +41,7 @@ fn estimate_compact_payload_tokens(request: &responses::ResponsesRequest) -> i64 .saturating_add(approx_token_count(&request.instructions_text())) } -const DUMMY_FUNCTION_NAME: &str = "unsupported_tool"; +const DUMMY_FUNCTION_NAME: &str = "test_tool"; fn summary_with_prefix(summary: &str) -> String { format!("{SUMMARY_PREFIX}\n{summary}") @@ -1064,6 +1064,9 @@ async fn remote_manual_compact_failure_emits_task_error_event() -> Result<()> { } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] +// TODO(ccunningham): Re-enable after the follow-up compaction behavior PR lands. +// Current main behavior for rollout replacement-history persistence is known-incorrect. +#[ignore = "behavior change covered in follow-up compaction PR"] async fn remote_compact_persists_replacement_history_in_rollout() -> Result<()> { skip_if_no_network!(Ok(())); @@ -1538,7 +1541,7 @@ async fn snapshot_request_shape_remote_pre_turn_compaction_including_incoming_us "remote_pre_turn_compaction_including_incoming_shapes", sectioned_request_shapes(&[ ("Remote Compaction Request", &compact_request), - ("Remote Post-Compaction History Request", &requests[2]), + ("Remote Post-Compaction History Layout", &requests[2]), ]) ); assert!( @@ -1717,7 +1720,7 @@ async fn snapshot_request_shape_remote_mid_turn_continuation_compaction() -> Res "remote_mid_turn_compaction_shapes", sectioned_request_shapes(&[ ("Remote Compaction Request", &compact_request), - ("Remote Post-Compaction History Request", &requests[1]), + ("Remote Post-Compaction History Layout", &requests[1]), ]) ); assert!( @@ -1780,7 +1783,7 @@ async fn snapshot_request_shape_remote_manual_compact_without_previous_user_mess insta::assert_snapshot!( "remote_manual_compact_without_prev_user_shapes", format!( - "## Remote Post-Compaction History Request\n{}", + "## Remote Post-Compaction History Layout\n{}", request_input_shape(&follow_up_request) ) ); @@ -1867,7 +1870,7 @@ async fn snapshot_request_shape_remote_manual_compact_with_previous_user_message "remote_manual_compact_with_history_shapes", sectioned_request_shapes(&[ ("Remote Compaction Request", &compact_request), - ("Remote Post-Compaction History Request", &requests[1]), + ("Remote Post-Compaction History Layout", &requests[1]), ]) ); assert!( diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_with_history_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_with_history_shapes.snap index fbc5734d50..dac70915df 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_with_history_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_with_history_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact.rs -expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Request\", &requests[2]),])" +expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Layout\", &requests[2]),])" --- ## Local Compaction Request 00:message/developer: @@ -10,7 +10,7 @@ expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests 04:message/assistant:FIRST_REPLY 05:message/user: -## Local Post-Compaction History Request +## Local Post-Compaction History Layout 00:message/user:USER_ONE 01:message/user: 02:message/developer: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_without_prev_user_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_without_prev_user_shapes.snap index 874011cbe7..0c382c0008 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_without_prev_user_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__manual_compact_without_prev_user_shapes.snap @@ -1,9 +1,10 @@ --- source: core/tests/suite/compact.rs -expression: "sectioned_request_shapes(&[(\"Local Post-Compaction History\", &requests[0]),])" +assertion_line: 3015 +expression: "sectioned_request_shapes(&[(\"Local Post-Compaction History Layout\",\n&requests[0]),])" --- -## Local Post-Compaction History +## Local Post-Compaction History Layout 00:message/developer: 01:message/user: 02:message/user: -03:message/user:AFTER_MANUAL_EMPTY_COMPACT +03:message/user: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__mid_turn_compaction_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__mid_turn_compaction_shapes.snap index 5cfa5ab608..30519d5e71 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__mid_turn_compaction_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__mid_turn_compaction_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact.rs -expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Request\", &requests[2]),])" +expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Layout\", &requests[2]),])" --- ## Local Compaction Request 00:message/developer: @@ -11,7 +11,7 @@ expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests 05:function_call_output: 06:message/user: -## Local Post-Compaction History Request +## Local Post-Compaction History Layout 00:message/developer: 01:message/user: 02:message/user: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_including_incoming_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_including_incoming_shapes.snap index 54e72e2c21..716484a946 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_including_incoming_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_including_incoming_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact.rs -expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[2]),\n(\"Local Post-Compaction History Request\", &requests[3]),])" +expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests[2]),\n(\"Local Post-Compaction History Layout\", &requests[3]),])" --- ## Local Compaction Request 00:message/developer: @@ -13,7 +13,7 @@ expression: "sectioned_request_shapes(&[(\"Local Compaction Request\", &requests 07:message/user: | | USER_THREE 08:message/user: -## Local Post-Compaction History Request +## Local Post-Compaction History Layout 00:message/user:USER_ONE 01:message/user:USER_TWO 02:message/developer: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_with_history_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_with_history_shapes.snap index f3303a5941..e2d9b5a8b6 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_with_history_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_with_history_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact_remote.rs -expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Request\", &requests[1]),])" +expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", &requests[1]),])" --- ## Remote Compaction Request 00:message/developer: @@ -9,7 +9,7 @@ expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact 03:message/user:USER_ONE 04:message/assistant:REMOTE_MANUAL_FIRST_REPLY -## Remote Post-Compaction History Request +## Remote Post-Compaction History Layout 00:message/user:USER_ONE 01:message/user: 02:message/developer: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_without_prev_user_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_without_prev_user_shapes.snap index d6b658d8b3..9f9f23e0b1 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_without_prev_user_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_without_prev_user_shapes.snap @@ -1,8 +1,8 @@ --- source: core/tests/suite/compact_remote.rs -expression: "format!(\"## Remote Post-Compaction History Request\\n{}\",\nrequest_input_shape(&follow_up_request))" +expression: "format!(\"## Remote Post-Compaction History Layout\\n{}\",\nrequest_input_shape(&follow_up_request))" --- -## Remote Post-Compaction History Request +## Remote Post-Compaction History Layout 00:message/developer: 01:message/user: 02:message/user: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_shapes.snap index fd2786b9d0..38dad1a774 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact_remote.rs -expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Request\", &requests[1]),])" +expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", &requests[1]),])" --- ## Remote Compaction Request 00:message/developer: @@ -10,7 +10,7 @@ expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact 04:function_call/ 05:function_call_output: -## Remote Post-Compaction History Request +## Remote Post-Compaction History Layout 00:message/developer: 01:message/user: 02:message/user: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_including_incoming_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_including_incoming_shapes.snap index f54063a1a3..a91475e982 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_including_incoming_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_including_incoming_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact_remote.rs -expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Request\", &requests[2]),])" +expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", &requests[2]),])" --- ## Remote Compaction Request 00:message/developer: @@ -12,7 +12,7 @@ expression: "sectioned_request_shapes(&[(\"Remote Compaction Request\", &compact 06:message/assistant:REMOTE_SECOND_REPLY 07:message/user:USER_THREE -## Remote Post-Compaction History Request +## Remote Post-Compaction History Layout 00:message/user:USER_ONE 01:message/user:USER_TWO 02:message/developer: