From 55c37f6b8034b27e48bf689a38292b80aa504e5c Mon Sep 17 00:00:00 2001 From: Dylan Hurd Date: Tue, 1 Dec 2026 15:09:07 +0000 Subject: [PATCH] Wait for an attached thread in TUI job-control tests (#65012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why The `/status` palette can appear during startup, before the TUI attaches to a thread. Waiting for the palette alone can let the test suspend the TUI too early. ## What changed Use the bundled model catalog to avoid model fetch delays during test startup. Configure the status line to show `thread-id` and `run-state`, then wait for ` · Ready` before opening the `/status` palette and suspending the TUI. GitOrigin-RevId: adfe1163082dca64c76791f38cee29791ea774b5 --- codex-rs/tui/tests/suite/job_control_tests.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/codex-rs/tui/tests/suite/job_control_tests.rs b/codex-rs/tui/tests/suite/job_control_tests.rs index c35e12a362..fae0b1ba24 100644 --- a/codex-rs/tui/tests/suite/job_control_tests.rs +++ b/codex-rs/tui/tests/suite/job_control_tests.rs @@ -3,7 +3,7 @@ use super::PtyCodex; use super::STARTUP_TIMEOUT; use super::contains_bytes; -use super::write_test_config; +use super::write_test_config_with_bundled_models; use anyhow::Context; use anyhow::Result; use anyhow::ensure; @@ -78,7 +78,7 @@ finally: "#; let repo_root = codex_utils_cargo_bin::repo_root()?; let home = tempfile::tempdir()?; - write_test_config(home.path(), &repo_root)?; + write_test_config_with_bundled_models(home.path(), &repo_root)?; let codex = codex_utils_cargo_bin::cargo_bin("codex-tui") .or_else(|_| codex_utils_cargo_bin::cargo_bin("codex"))?; let mut terminal = PtyCodex::start_binary( @@ -92,10 +92,15 @@ finally: handoff, codex.to_str().context("TUI path")?, "--no-alt-screen", + "-c", + r#"tui.status_line=["thread-id","run-state"]"#, ], /*editor*/ None, )?; terminal.wait_for_startup()?; + // The /status palette can appear during startup. The separator only appears + // once an attached thread has an ID alongside its run state. + terminal.wait_for_screen(" · Ready")?; terminal.write_input(b"/status")?; terminal.wait_for_screen("show current session configuration")?; let before_suspend = terminal.output.len();