diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs index d46ec5996..b2bbae4a7 100644 --- a/codex-rs/core/src/codex.rs +++ b/codex-rs/core/src/codex.rs @@ -1933,21 +1933,9 @@ impl Session { }; match conversation_history { InitialHistory::New => { - // Build and record initial items (user instructions + environment context) - // TODO(ccunningham): Defer initial context insertion until the first real turn - // starts so it reflects the actual first-turn settings (permissions, etc.) and - // we do not emit model-visible "diff" updates before the first user message. - let items = self.build_initial_context(&turn_context).await; - self.record_conversation_items(&turn_context, &items).await; - { - let mut state = self.state.lock().await; - state.set_reference_context_item(Some(turn_context.to_turn_context_item())); - } + // Defer initial context insertion until the first real turn starts so + // turn/start overrides can be merged before we write model-visible context. self.set_previous_turn_settings(None).await; - // Ensure initial items are visible to immediate readers (e.g., tests, forks). - if !is_subagent { - self.flush_rollout().await; - } } InitialHistory::Resumed(resumed_history) => { let rollout_items = resumed_history.history; diff --git a/codex-rs/core/src/codex_tests.rs b/codex-rs/core/src/codex_tests.rs index 6d3270dcd..69ce86b61 100644 --- a/codex-rs/core/src/codex_tests.rs +++ b/codex-rs/core/src/codex_tests.rs @@ -808,6 +808,18 @@ async fn record_initial_history_reconstructs_resumed_transcript() { assert_eq!(expected, history.raw_items()); } +#[tokio::test] +async fn record_initial_history_new_defers_initial_context_until_first_turn() { + let (session, _turn_context) = make_session_and_context().await; + + session.record_initial_history(InitialHistory::New).await; + + let history = session.clone_history().await; + assert_eq!(history.raw_items().to_vec(), Vec::::new()); + assert!(session.reference_context_item().await.is_none()); + assert_eq!(session.previous_turn_settings().await, None); +} + #[tokio::test] async fn resumed_history_injects_initial_context_on_first_context_update_only() { let (session, turn_context) = make_session_and_context().await; diff --git a/codex-rs/core/tests/suite/collaboration_instructions.rs b/codex-rs/core/tests/suite/collaboration_instructions.rs index 781f226cb..7eec64b72 100644 --- a/codex-rs/core/tests/suite/collaboration_instructions.rs +++ b/codex-rs/core/tests/suite/collaboration_instructions.rs @@ -39,17 +39,11 @@ fn collab_mode_with_instructions(instructions: Option<&str>) -> CollaborationMod fn developer_texts(input: &[Value]) -> Vec { input .iter() - .filter_map(|item| { - let role = item.get("role")?.as_str()?; - if role != "developer" { - return None; - } - let text = item - .get("content")? - .as_array()? - .first()? - .get("text")? - .as_str()?; + .filter(|item| item.get("role").and_then(Value::as_str) == Some("developer")) + .filter_map(|item| item.get("content")?.as_array().cloned()) + .flatten() + .filter_map(|content| { + let text = content.get("text")?.as_str()?; Some(text.to_string()) }) .collect() @@ -59,8 +53,8 @@ fn collab_xml(text: &str) -> String { format!("{COLLABORATION_MODE_OPEN_TAG}{text}{COLLABORATION_MODE_CLOSE_TAG}") } -fn count_exact(texts: &[String], target: &str) -> usize { - texts.iter().filter(|text| text.as_str() == target).count() +fn count_messages_containing(texts: &[String], target: &str) -> usize { + texts.iter().filter(|text| text.contains(target)).count() } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] @@ -139,7 +133,7 @@ async fn user_input_includes_collaboration_instructions_after_override() -> Resu let input = req.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -186,7 +180,7 @@ async fn collaboration_instructions_added_on_user_turn() -> Result<()> { let input = req.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -235,7 +229,7 @@ async fn override_then_next_turn_uses_updated_collaboration_instructions() -> Re let input = req.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -300,8 +294,8 @@ async fn user_turn_overrides_collaboration_instructions_after_override() -> Resu let dev_texts = developer_texts(&input); let base_text = collab_xml(base_text); let turn_text = collab_xml(turn_text); - assert_eq!(count_exact(&dev_texts, &base_text), 0); - assert_eq!(count_exact(&dev_texts, &turn_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &base_text), 0); + assert_eq!(count_messages_containing(&dev_texts, &turn_text), 1); Ok(()) } @@ -382,8 +376,8 @@ async fn collaboration_mode_update_emits_new_instruction_message() -> Result<()> let dev_texts = developer_texts(&input); let first_text = collab_xml(first_text); let second_text = collab_xml(second_text); - assert_eq!(count_exact(&dev_texts, &first_text), 1); - assert_eq!(count_exact(&dev_texts, &second_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &first_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &second_text), 1); Ok(()) } @@ -462,7 +456,7 @@ async fn collaboration_mode_update_noop_does_not_append() -> Result<()> { let input = req2.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -549,8 +543,8 @@ async fn collaboration_mode_update_emits_new_instruction_message_when_mode_chang let dev_texts = developer_texts(&input); let default_text = collab_xml(default_text); let plan_text = collab_xml(plan_text); - assert_eq!(count_exact(&dev_texts, &default_text), 1); - assert_eq!(count_exact(&dev_texts, &plan_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &default_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &plan_text), 1); Ok(()) } @@ -635,7 +629,7 @@ async fn collaboration_mode_update_noop_does_not_append_when_mode_is_unchanged() let input = req2.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -710,7 +704,7 @@ async fn resume_replays_collaboration_instructions() -> Result<()> { let input = req2.single_request().input(); let dev_texts = developer_texts(&input); let collab_text = collab_xml(collab_text); - assert_eq!(count_exact(&dev_texts, &collab_text), 1); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 1); Ok(()) } @@ -766,7 +760,7 @@ async fn empty_collaboration_instructions_are_ignored() -> Result<()> { let dev_texts = developer_texts(&input); assert_eq!(dev_texts.len(), 1); let collab_text = collab_xml(""); - assert_eq!(count_exact(&dev_texts, &collab_text), 0); + assert_eq!(count_messages_containing(&dev_texts, &collab_text), 0); Ok(()) } diff --git a/codex-rs/core/tests/suite/compact_remote.rs b/codex-rs/core/tests/suite/compact_remote.rs index 5f26d1ea1..683f8b945 100644 --- a/codex-rs/core/tests/suite/compact_remote.rs +++ b/codex-rs/core/tests/suite/compact_remote.rs @@ -2541,7 +2541,6 @@ async fn snapshot_request_shape_remote_mid_turn_compaction_multi_summary_reinjec } #[tokio::test(flavor = "multi_thread", worker_threads = 2)] -// TODO(ccunningham): Update once manual remote /compact with no prior user turn becomes a no-op. async fn snapshot_request_shape_remote_manual_compact_without_previous_user_messages() -> Result<()> { skip_if_no_network!(Ok(())); @@ -2581,19 +2580,15 @@ async fn snapshot_request_shape_remote_manual_compact_without_previous_user_mess assert_eq!( compact_mock.requests().len(), - 1, - "current behavior still issues remote compaction for manual /compact without prior user" + 0, + "manual /compact without prior user should not issue a remote compaction request" ); - let compact_request = compact_mock.single_request(); let follow_up_request = responses_mock.single_request(); insta::assert_snapshot!( "remote_manual_compact_without_prev_user_shapes", format_labeled_requests_snapshot( - "Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message.", - &[ - ("Remote Compaction Request", &compact_request), - ("Remote Post-Compaction History Layout", &follow_up_request), - ] + "Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message.", + &[("Remote Post-Compaction History Layout", &follow_up_request)] ) ); diff --git a/codex-rs/core/tests/suite/personality.rs b/codex-rs/core/tests/suite/personality.rs index 754c46ebf..329db44f3 100644 --- a/codex-rs/core/tests/suite/personality.rs +++ b/codex-rs/core/tests/suite/personality.rs @@ -867,7 +867,7 @@ async fn user_turn_personality_remote_model_template_includes_update_message() - let developer_texts = request.message_input_texts("developer"); let personality_text = developer_texts .iter() - .find(|text| text.contains("")) + .find(|text| text.contains(remote_friendly_message)) .expect("expected personality update message in developer input"); assert!( 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 ca07006ea..fba041128 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,15 +1,12 @@ --- source: core/tests/suite/compact.rs +assertion_line: 3343 expression: "format_labeled_requests_snapshot(\"Manual /compact with no prior user turn currently still issues a compaction request; follow-up turn carries canonical context and the new user message.\",\n&[(\"Local Compaction Request\", &requests[0]),\n(\"Local Post-Compaction History Layout\", &requests[1]),])" --- Scenario: Manual /compact with no prior user turn currently still issues a compaction request; follow-up turn carries canonical context and the new user message. ## Local Compaction Request -00:message/developer: -01:message/user[2]: - [01] - [02] > -02:message/user: +00:message/user: ## Local Post-Compaction History Layout 00:message/user:\nMANUAL_EMPTY_SUMMARY diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_sampling_model_switch_compaction_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_sampling_model_switch_compaction_shapes.snap index 7f61d7ed5..6163a5c80 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_sampling_model_switch_compaction_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_sampling_model_switch_compaction_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact.rs -assertion_line: 1791 +assertion_line: 1799 expression: "format_labeled_requests_snapshot(\"Pre-sampling compaction on model switch to a smaller context window: current behavior compacts using prior-turn history only (incoming user message excluded), and the follow-up request carries compacted history plus the new user message.\",\n&[(\"Initial Request (Previous Model)\", &requests[0]),\n(\"Pre-sampling Compaction Request\", &requests[1]),\n(\"Post-Compaction Follow-up Request (Next Model)\", &requests[2]),])" --- Scenario: Pre-sampling compaction on model switch to a smaller context window: current behavior compacts using prior-turn history only (incoming user message excluded), and the follow-up request carries compacted history plus the new user message. @@ -10,18 +10,16 @@ Scenario: Pre-sampling compaction on model switch to a smaller context window: c 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:before switch +02:message/user:before switch ## Pre-sampling Compaction Request 00:message/developer: 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:before switch -04:message/assistant:before switch -05:message/user: +02:message/user:before switch +03:message/assistant:before switch +04:message/user: ## Post-Compaction Follow-up Request (Next Model) 00:message/user:before switch diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_strips_incoming_model_switch_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_strips_incoming_model_switch_shapes.snap index 46d76bb10..681aae6a4 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_strips_incoming_model_switch_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact__pre_turn_compaction_strips_incoming_model_switch_shapes.snap @@ -1,6 +1,6 @@ --- source: core/tests/suite/compact.rs -assertion_line: 3188 +assertion_line: 3195 expression: "format_labeled_requests_snapshot(\"Pre-turn compaction during model switch (without pre-sampling model-switch compaction): current behavior strips incoming from the compact request and restores it in the post-compaction follow-up request.\",\n&[(\"Initial Request (Previous Model)\", &requests[0]),\n(\"Local Compaction Request\", &requests[1]),\n(\"Local Post-Compaction History Layout\", &requests[2]),])" --- Scenario: Pre-turn compaction during model switch (without pre-sampling model-switch compaction): current behavior strips incoming from the compact request and restores it in the post-compaction follow-up request. @@ -10,18 +10,16 @@ Scenario: Pre-turn compaction during model switch (without pre-sampling model-sw 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:BEFORE_SWITCH_USER +02:message/user:BEFORE_SWITCH_USER ## Local Compaction Request 00:message/developer: 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:BEFORE_SWITCH_USER -04:message/assistant:BEFORE_SWITCH_REPLY -05:message/user: +02:message/user:BEFORE_SWITCH_USER +03:message/assistant:BEFORE_SWITCH_REPLY +04:message/user: ## Local Post-Compaction History Layout 00:message/user:BEFORE_SWITCH_USER diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_compact_resume_restates_realtime_end_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_compact_resume_restates_realtime_end_shapes.snap index fc12d431e..b09f509b3 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_compact_resume_restates_realtime_end_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_compact_resume_restates_realtime_end_shapes.snap @@ -1,17 +1,19 @@ --- source: core/tests/suite/compact_remote.rs +assertion_line: 1950 expression: "format_labeled_requests_snapshot(\"After remote manual /compact and resume, the first resumed turn rebuilds history from the compaction item and restates realtime-end instructions from reconstructed previous-turn settings.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Resume History Layout\", after_resume_request),])" --- Scenario: After remote manual /compact and resume, the first resumed turn rebuilds history from the compaction item and restates realtime-end instructions from reconstructed previous-turn settings. ## Remote Compaction Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:USER_ONE -04:message/assistant:REMOTE_FIRST_REPLY +02:message/user:USER_ONE +03:message/assistant:REMOTE_FIRST_REPLY ## Remote Post-Resume History Layout 00:compaction:encrypted=true diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_restates_realtime_start_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_restates_realtime_start_shapes.snap index cb0463089..c3a832dae 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_restates_realtime_start_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_manual_compact_restates_realtime_start_shapes.snap @@ -1,17 +1,19 @@ --- source: core/tests/suite/compact_remote.rs +assertion_line: 1742 expression: "format_labeled_requests_snapshot(\"Remote manual /compact while realtime remains active: the next regular turn restates realtime-start instructions after compaction clears the baseline.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])" --- Scenario: Remote manual /compact while realtime remains active: the next regular turn restates realtime-start instructions after compaction clears the baseline. ## Remote Compaction Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:USER_ONE -04:message/assistant:REMOTE_FIRST_REPLY +02:message/user:USER_ONE +03:message/assistant:REMOTE_FIRST_REPLY ## Remote Post-Compaction History Layout 00:compaction:encrypted=true 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 6ec8149c0..7f08586bb 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,14 +1,8 @@ --- source: core/tests/suite/compact_remote.rs -expression: "format_labeled_requests_snapshot(\"Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", &follow_up_request),])" +expression: "format_labeled_requests_snapshot(\"Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message.\",\n&[(\"Remote Post-Compaction History Layout\", &follow_up_request),])" --- -Scenario: Remote manual /compact with no prior user turn still issues a compact request; follow-up turn carries canonical context and new user message. - -## Remote Compaction Request -00:message/developer: -01:message/user[2]: - [01] - [02] > +Scenario: Remote manual /compact with no prior user turn skips the remote compact request; the follow-up turn carries canonical context and new user message. ## Remote Post-Compaction History Layout 00:message/developer: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_does_not_restate_realtime_end_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_does_not_restate_realtime_end_shapes.snap index b1f83ce4d..ce2107f5f 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_does_not_restate_realtime_end_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_mid_turn_compaction_does_not_restate_realtime_end_shapes.snap @@ -1,32 +1,35 @@ --- source: core/tests/suite/compact_remote.rs +assertion_line: 1843 expression: "format_labeled_requests_snapshot(\"Remote mid-turn continuation compaction after realtime was closed before the turn: the initial second-turn request emits realtime-end instructions, but the continuation request does not restate them after compaction because the current turn already established the inactive baseline.\",\n&[(\"Second Turn Initial Request\", second_turn_request),\n(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])" --- Scenario: Remote mid-turn continuation compaction after realtime was closed before the turn: the initial second-turn request emits realtime-end instructions, but the continuation request does not restate them after compaction because the current turn already established the inactive baseline. ## Second Turn Initial Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:SETUP_USER -04:message/assistant:REMOTE_SETUP_REPLY -05:message/developer:\nRealtime conversation ended.\n\nSubsequ... -06:message/user:USER_TWO +02:message/user:SETUP_USER +03:message/assistant:REMOTE_SETUP_REPLY +04:message/developer:\nRealtime conversation ended.\n\nSubsequ... +05:message/user:USER_TWO ## Remote Compaction Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:SETUP_USER -04:message/assistant:REMOTE_SETUP_REPLY -05:message/developer:\nRealtime conversation ended.\n\nSubsequ... -06:message/user:USER_TWO -07:function_call/test_tool -08:function_call_output:unsupported call: test_tool +02:message/user:SETUP_USER +03:message/assistant:REMOTE_SETUP_REPLY +04:message/developer:\nRealtime conversation ended.\n\nSubsequ... +05:message/user:USER_TWO +06:function_call/test_tool +07:function_call_output:unsupported call: test_tool ## Remote Post-Compaction History Layout 00:message/developer: diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_end_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_end_shapes.snap index 57af327d1..ab570b6ab 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_end_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_end_shapes.snap @@ -1,17 +1,19 @@ --- source: core/tests/suite/compact_remote.rs +assertion_line: 1656 expression: "format_labeled_requests_snapshot(\"Remote pre-turn auto-compaction after realtime was closed between turns: the follow-up request emits realtime-end instructions from previous-turn settings even though compaction cleared the reference baseline.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])" --- Scenario: Remote pre-turn auto-compaction after realtime was closed between turns: the follow-up request emits realtime-end instructions from previous-turn settings even though compaction cleared the reference baseline. ## Remote Compaction Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:USER_ONE -04:message/assistant:REMOTE_FIRST_REPLY +02:message/user:USER_ONE +03:message/assistant:REMOTE_FIRST_REPLY ## Remote Post-Compaction History Layout 00:compaction:encrypted=true diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_start_shapes.snap b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_start_shapes.snap index a72f581bb..698faea27 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_start_shapes.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__compact_remote__remote_pre_turn_compaction_restates_realtime_start_shapes.snap @@ -1,17 +1,19 @@ --- source: core/tests/suite/compact_remote.rs +assertion_line: 1521 expression: "format_labeled_requests_snapshot(\"Remote pre-turn auto-compaction while realtime remains active: compaction clears the reference baseline, so the follow-up request restates realtime-start instructions.\",\n&[(\"Remote Compaction Request\", &compact_request),\n(\"Remote Post-Compaction History Layout\", post_compact_request),])" --- Scenario: Remote pre-turn auto-compaction while realtime remains active: compaction clears the reference baseline, so the follow-up request restates realtime-start instructions. ## Remote Compaction Request -00:message/developer: +00:message/developer[2]: + [01] + [02] \nRealtime conversation started.\n\nYou a... 01:message/user[2]: [01] [02] > -02:message/developer:\nRealtime conversation started.\n\nYou a... -03:message/user:USER_ONE -04:message/assistant:REMOTE_FIRST_REPLY +02:message/user:USER_ONE +03:message/assistant:REMOTE_FIRST_REPLY ## Remote Post-Compaction History Layout 00:compaction:encrypted=true diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_cwd_change_does_not_refresh_agents.snap b/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_cwd_change_does_not_refresh_agents.snap index 65dffc556..42d92a720 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_cwd_change_does_not_refresh_agents.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_cwd_change_does_not_refresh_agents.snap @@ -1,5 +1,6 @@ --- source: core/tests/suite/model_visible_layout.rs +assertion_line: 288 expression: "format_labeled_requests_snapshot(\"Second turn changes cwd to a directory with different AGENTS.md; current behavior does not emit refreshed AGENTS instructions.\",\n&[(\"First Request (agents_one)\", &requests[0]),\n(\"Second Request (agents_two cwd)\", &requests[1]),])" --- Scenario: Second turn changes cwd to a directory with different AGENTS.md; current behavior does not emit refreshed AGENTS instructions. @@ -9,18 +10,14 @@ Scenario: Second turn changes cwd to a directory with different AGENTS.md; curre 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:> -04:message/user:first turn in agents_one +02:message/user:first turn in agents_one ## Second Request (agents_two cwd) 00:message/developer: 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:> -04:message/user:first turn in agents_one -05:message/assistant:turn one complete -06:message/user:> -07:message/user:second turn in agents_two +02:message/user:first turn in agents_one +03:message/assistant:turn one complete +04:message/user:> +05:message/user:second turn in agents_two diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_turn_overrides.snap b/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_turn_overrides.snap index 2172d7399..da0ecf3a8 100644 --- a/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_turn_overrides.snap +++ b/codex-rs/core/tests/suite/snapshots/all__suite__model_visible_layout__model_visible_layout_turn_overrides.snap @@ -1,5 +1,6 @@ --- source: core/tests/suite/model_visible_layout.rs +assertion_line: 177 expression: "format_labeled_requests_snapshot(\"Second turn changes cwd, approval policy, and personality while keeping model constant.\",\n&[(\"First Request (Baseline)\", &requests[0]),\n(\"Second Request (Turn Overrides)\", &requests[1]),])" --- Scenario: Second turn changes cwd, approval policy, and personality while keeping model constant. @@ -9,19 +10,17 @@ Scenario: Second turn changes cwd, approval policy, and personality while keepin 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:first turn +02:message/user:first turn ## Second Request (Turn Overrides) 00:message/developer: 01:message/user[2]: [01] [02] > -02:message/developer: -03:message/user:first turn -04:message/assistant:turn one complete -05:message/developer[2]: +02:message/user:first turn +03:message/assistant:turn one complete +04:message/developer[2]: [01] [02] The user has requested a new communication style. Future messages should adhe... -06:message/user: -07:message/user:second turn with context updates +05:message/user: +06:message/user:second turn with context updates