Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Stabilize the interactive tmux startup safety test (#42755)

jif97e46694e145
diff --git a/codex-rs/cli/tests/doctor_path_safety.rs b/codex-rs/cli/tests/doctor_path_safety.rs
index cce1addf42..96530ca952 100644
--- a/codex-rs/cli/tests/doctor_path_safety.rs
+++ b/codex-rs/cli/tests/doctor_path_safety.rs
@@ -4,6 +4,8 @@ use std::ffi::OsString;
use std::path::PathBuf;
use std::time::Duration;
+#[cfg(unix)]
+use anyhow::Context;
use anyhow::Result;
use app_test_support::TestAppServer;
use codex_app_server_protocol::RequestId;
@@ -242,14 +244,34 @@ async fn interactive_tmux_startup_does_not_execute_workspace_helpers() -> Result
anyhow::bail!("TUI exited before trust prompt")
})
.await;
- session.terminate();
- let _ = timeout(Duration::from_secs(/*secs*/ 10), spawned.exit_rx).await?;
ready.map_err(|_| {
anyhow::anyhow!(
"trust prompt timed out: {}",
output.chars().take(/*n*/ 4000).collect::<String>()
)
})??;
+ // The trust screen discards pending input after its first draw. Retry the quit key
+ // until that drain has finished, and keep consuming output during normal shutdown.
+ let mut quit_retry = tokio::time::interval(Duration::from_millis(/*millis*/ 250));
+ let mut exit_rx = spawned.exit_rx;
+ timeout(Duration::from_secs(/*secs*/ 10), async {
+ loop {
+ tokio::select! {
+ result = &mut exit_rx => return result,
+ _ = quit_retry.tick() => {
+ let _ = writer.send(b"2".to_vec()).await;
+ }
+ Some(_) = output_rx.recv() => {}
+ }
+ }
+ })
+ .await
+ .with_context(|| {
+ format!(
+ "TUI did not exit after declining directory trust: {}",
+ output.chars().take(/*n*/ 4000).collect::<String>()
+ )
+ })??;
assert!(
output.contains("\x1b[>5u"),
"expected safe Ghostty/tmux keyboard flags: {output}"