From cc98dfd5274300e4334ea7b943f2212a84944e44 Mon Sep 17 00:00:00 2001 From: dhruvgupta-oai Date: Mon, 23 Mar 2026 19:13:58 -0400 Subject: [PATCH] Wait for apply_patch tool completion in snapshot test --- codex-rs/core/tests/suite/shell_snapshot.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/codex-rs/core/tests/suite/shell_snapshot.rs b/codex-rs/core/tests/suite/shell_snapshot.rs index 68228a412e..0c78da5f3b 100644 --- a/codex-rs/core/tests/suite/shell_snapshot.rs +++ b/codex-rs/core/tests/suite/shell_snapshot.rs @@ -565,10 +565,22 @@ async fn shell_command_snapshot_still_intercepts_apply_patch() -> Result<()> { }) .await?; + wait_for_event_match(&codex, |ev| match ev { + EventMsg::ExecCommandBegin(ev) if ev.call_id == call_id => Some(ev.clone()), + _ => None, + }) + .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); + wait_for_event_match(&codex, |ev| match ev { + EventMsg::ExecCommandEnd(ev) if ev.call_id == call_id => Some(ev.clone()), + _ => None, + }) + .await; + wait_for_event(&codex, |ev| matches!(ev, EventMsg::TurnComplete(_))).await; assert_eq!(