[codex] fix(tui): tolerate unsupported bracketed paste#3548
Conversation
Legacy Windows console hosts can report bracketed paste as unsupported through crossterm, which made older Win10/LTSC shells a fragile startup and terminal-mode path. Disable bracketed paste automatically for unmarked legacy Windows console hosts, and make bracketed-paste enable/disable best-effort in terminal recovery, pause, cleanup, and emergency restore paths. Closes Hmbown#1102. Verification: - cargo fmt -- --check - cargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_rendering - cargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windows - cargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_paste - cargo test -p codewhale-tui --bin codewhale-tui --locked - cargo test --workspace --locked - cargo build --release -p codewhale-cli -p codewhale-tui --locked
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0a0bb1412
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review caught that mutating Settings::bracketed_paste inside apply_env_overrides could persist the legacy conhost fallback when unrelated settings are saved. Keep the stored setting unchanged, expose an effective_bracketed_paste runtime helper, and use that helper when building TuiOptions for startup. Verification: - cargo fmt -- --check - cargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_rendering - cargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windows - cargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_paste - cargo test -p codewhale-tui --bin codewhale-tui --locked
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Root cause
Win10/LTSC legacy console hosts can report crossterm bracketed paste as unsupported (
Bracketed paste not implemented in the legacy Windows API). CodeWhale already recovered some terminal modes best-effort, but bracketed paste still had strict paths and the legacy-host settings fallback did not disable it by default.Closes #1102.
Testing
cargo fmt -- --checkcargo test -p codewhale-tui --bin codewhale-tui --locked unmarked_windows_console_forces_calm_renderingcargo test -p codewhale-tui --bin codewhale-tui --locked recover_terminal_modes_runs_without_panic_on_windowscargo test -p codewhale-tui --bin codewhale-tui --locked paste_burst_detection_is_configurable_independent_of_bracketed_pastecargo test -p codewhale-tui --bin codewhale-tui --lockedcargo test --workspace --lockedcargo build --release -p codewhale-cli -p codewhale-tui --lockedAdditional local check:
cargo clippy --workspace --all-targets --locked -- -D warningscurrently fails on unrelated current-main warnings inclient/chat.rs,core/engine.rs,client.rs,tools/js_execution.rs,tools/pandoc.rs,tui/session_picker.rs, andtui/widgets/mod.rs; none are in this PR's changed files.