feat(tui): clarify Windows auto mode requirements (#5568)
## Summary - Coerce Windows `workspace-write` configs back to read-only, surface the forced downgrade in the approvals popup, and funnel users toward WSL or Full Access. - Add WSL installation instructions to the Auto preset on Windows while keeping the preset available for other platforms. - Skip the trust-on-first-run prompt on native Windows so new folders remain read-only without additional confirmation. - Expose a structured sandbox policy resolution from config to flag Windows downgrades and adjust tests (core, exec, TUI) to reflect the new behavior; provide a Windows-only approvals snapshot. ## Testing - cargo fmt - cargo test -p codex-core config::tests::add_dir_override_extends_workspace_writable_roots - cargo test -p codex-exec suite::resume::exec_resume_preserves_cli_configuration_overrides - cargo test -p codex-tui chatwidget::tests::approvals_selection_popup_snapshot - cargo test -p codex-tui approvals_popup_includes_wsl_note_for_auto_mode - cargo test -p codex-tui windows_skips_trust_prompt - just fix -p codex-core - just fix -p codex-tui
This commit is contained in:
@@ -1276,9 +1276,36 @@ fn approvals_selection_popup_snapshot() {
|
||||
chat.open_approvals_popup();
|
||||
|
||||
let popup = render_bottom_popup(&chat, 80);
|
||||
#[cfg(target_os = "windows")]
|
||||
insta::with_settings!({ snapshot_suffix => "windows" }, {
|
||||
assert_snapshot!("approvals_selection_popup", popup);
|
||||
});
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
assert_snapshot!("approvals_selection_popup", popup);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn approvals_popup_includes_wsl_note_for_auto_mode() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
if cfg!(target_os = "windows") {
|
||||
chat.config.forced_auto_mode_downgraded_on_windows = true;
|
||||
}
|
||||
chat.open_approvals_popup();
|
||||
|
||||
let popup = render_bottom_popup(&chat, 80);
|
||||
assert_eq!(
|
||||
popup.contains("Requires Windows Subsystem for Linux (WSL)"),
|
||||
cfg!(target_os = "windows"),
|
||||
"expected auto preset description to mention WSL requirement only on Windows, popup: {popup}"
|
||||
);
|
||||
assert_eq!(
|
||||
popup.contains("Codex forced your settings back to Read Only on this Windows machine."),
|
||||
cfg!(target_os = "windows") && chat.config.forced_auto_mode_downgraded_on_windows,
|
||||
"expected downgrade notice only when auto mode is forced off on Windows, popup: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn full_access_confirmation_popup_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
@@ -1293,6 +1320,20 @@ fn full_access_confirmation_popup_snapshot() {
|
||||
assert_snapshot!("full_access_confirmation_popup", popup);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
#[test]
|
||||
fn windows_auto_mode_instructions_popup_lists_install_steps() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
chat.open_windows_auto_mode_instructions();
|
||||
|
||||
let popup = render_bottom_popup(&chat, 120);
|
||||
assert!(
|
||||
popup.contains("wsl --install"),
|
||||
"expected WSL instructions popup to include install command, popup: {popup}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_reasoning_selection_popup_snapshot() {
|
||||
let (mut chat, _rx, _op_rx) = make_chatwidget_manual();
|
||||
|
||||
Reference in New Issue
Block a user