Wait for an attached thread in TUI job-control tests (#65012)

## 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
This commit is contained in:
Dylan Hurd
2026-12-01 15:28:04 +00:00
committed by copyberry
parent aadf113445
commit 55c37f6b80
@@ -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();