Files
codex/codex-rs/tui/tests/suite/tui_mode_picker_tests.rs
T
Eric Traut 65c83ea5a2 Restore the daemon auto-start feature flag (#59447)
## What changed

Honor `features.daemon_auto_start` as a stable, default-enabled setting instead of ignoring it with a deprecation warning. Apply it to interactive daemon auto-start and remote-control daemon eligibility, and accept it in managed feature requirements.

Preserve explicit `false` values when saving the setting, even when the server reports a disabled default. Record the setting and disabled auto-start outcomes in launch telemetry.

## Testing

Update coverage for restarting a discovered daemon with auto-start disabled and for persisting an explicit opt-out when the server default is disabled. Adjust embedded-backend tests to disable auto-start through configuration.

GitOrigin-RevId: cbf079e3e27b4a7e6e802bf8f19dae653dd7472c
2026-11-04 16:46:21 +00:00

67 lines
2.5 KiB
Rust

//! The picker persists a preference, but only a new process adopts the renderer.
use super::*;
use pretty_assertions::assert_eq;
#[test]
fn tui_mode_picker_applies_only_after_restart() -> Result<()> {
let root = codex_utils_cargo_bin::repo_root()?;
let mut home = tempfile::tempdir()?;
write_test_config(home.path(), &root)?;
let path = home.path().join("config.toml");
let config = std::fs::read_to_string(&path)?;
std::fs::write(
&path,
format!(
"tui.fullscreen_transcript = false\ntui.alternate_screen = \"always\"\ntui.disable_paste_burst = true\ntui.status_line = [\"thread-id\"]\n{config}"
),
)?;
for (launch, current) in [false, true, false].into_iter().enumerate() {
let mut terminal = PtyCodex::start(&root, home, &[])?;
terminal.wait_for_startup()?;
// The header precedes session setup; wait for the thread ID before sending commands.
let deadline = Instant::now() + STARTUP_TIMEOUT;
loop {
terminal.read_output(Duration::from_millis(/*millis*/ 50))?;
terminal.answer_startup_queries()?;
if terminal
.screen_contents()
.split_whitespace()
.any(|word| uuid::Uuid::parse_str(word).is_ok())
{
break;
}
ensure!(
Instant::now() < deadline,
"thread did not become ready: {}",
terminal.screen_contents()
);
terminal.ensure_running()?;
}
assert_eq!(terminal.parser.screen().alternate_screen(), current);
if launch == 2 {
break;
}
terminal.write_input(b"/tui")?;
terminal.wait_for_screen("/tui")?;
terminal.write_input(b"\r")?;
terminal.wait_for_screen("TUI mode for next launch")?;
terminal.write_input(if current { b"\x1b[A" } else { b"\x1b[B" })?;
terminal.write_input(b"\r")?;
terminal.wait_for_screen(if current {
"Saved TUI mode: Scrollback"
} else {
"Saved TUI mode: Fullscreen"
})?;
assert_eq!(terminal.parser.screen().alternate_screen(), current);
let saved: toml::Value = toml::from_str(&std::fs::read_to_string(&path)?)?;
assert_eq!(
saved["tui"]["fullscreen_transcript"].as_bool(),
Some(!current)
);
home = std::mem::replace(&mut terminal._codex_home, tempfile::tempdir()?);
drop(terminal);
}
Ok(())
}