From c39d3e99d5ddb4bdc04f7803a3723cc97cfdbe0e Mon Sep 17 00:00:00 2001 From: jif Date: Mon, 3 Aug 2026 14:06:38 +0000 Subject: [PATCH] Wait for patch events before reading shell snapshots (#36757) ## What changed Move shell snapshot validation in the intercepted `apply_patch` test until after the turn completes and its patch lifecycle events have been collected. GitOrigin-RevId: 1c16bcfcc97f09165c4a2eb2d15f4059a14b2a99 --- codex-rs/core/tests/suite/shell_snapshot.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/tests/suite/shell_snapshot.rs b/codex-rs/core/tests/suite/shell_snapshot.rs index f2f4859940..bd8f86261b 100644 --- a/codex-rs/core/tests/suite/shell_snapshot.rs +++ b/codex-rs/core/tests/suite/shell_snapshot.rs @@ -608,10 +608,6 @@ async fn shell_command_snapshot_still_intercepts_apply_patch() -> Result<()> { }) .await?; - let snapshot_path = wait_for_snapshot(&codex_home).await?; - let snapshot_content = fs::read_to_string(&snapshot_path).await?; - assert_posix_snapshot_sections(&snapshot_content); - let mut saw_patch_begin = false; let mut patch_end = None; wait_for_event(&codex, |ev| match ev { @@ -628,6 +624,10 @@ async fn shell_command_snapshot_still_intercepts_apply_patch() -> Result<()> { }) .await; + let snapshot_path = wait_for_snapshot(&codex_home).await?; + let snapshot_content = fs::read_to_string(&snapshot_path).await?; + assert_posix_snapshot_sections(&snapshot_content); + assert!( saw_patch_begin, "expected apply_patch to emit PatchApplyBegin"