Skip to content

fix(tui): suppress verbose CLI logging on Windows alt-screen to prevent TUI leak#1910

Open
aboimpinto wants to merge 1 commit into
Hmbown:mainfrom
aboimpinto:fix/1776-part2-verbose-leak
Open

fix(tui): suppress verbose CLI logging on Windows alt-screen to prevent TUI leak#1910
aboimpinto wants to merge 1 commit into
Hmbown:mainfrom
aboimpinto:fix/1776-part2-verbose-leak

Conversation

@aboimpinto
Copy link
Copy Markdown
Contributor

@aboimpinto aboimpinto commented May 21, 2026

Summary

This is the missing second commit from PR #1776. The maintainer merged the first commit (stop RUST_LOG from leaking tracing messages) but closed PR #1776 without merging this follow-up fix.

Problem

On Windows, stderr cannot be redirected to the log file (no dup2). When --verbose or DEEPSEEK_LOG_LEVEL=debug is set, eprintln! calls from crate::logging still leak into the TUI alt-screen buffer, corrupting the display � even after the RUST_LOG fix was merged.

Fix

Call crate::logging::set_verbose(false) at two points:

  1. run_tui() � right after EnterAlternateScreen, so verbose logging is suppressed for the entire TUI session on Windows.
  2. resume_terminal() � right after re-entering alt-screen during terminal recovery, so the suppression holds across suspend/resume cycles.

Changes

  • crates/tui/src/tui/ui.rs: +9 lines � set_verbose(false) calls in run_tui and resume_terminal, gated by #[cfg(windows)].

Related

Urgent: this is a regression on Windows for users who run with verbose/debug logging.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Windows-specific logic to suppress verbose logging when entering or resuming the TUI's alternate screen, aiming to prevent log output from corrupting the interface. Feedback indicates that this approach is currently permanent on Windows, unlike the scoped redirection used on Unix, and suggests restoring the verbosity state during cleanup. Additionally, the reviewer noted that this fix only addresses internal logging and recommended exploring WinAPI-based stderr redirection to handle third-party output and panics more effectively.

Comment thread crates/tui/src/tui/ui.rs Outdated
@aboimpinto
Copy link
Copy Markdown
Contributor Author

Addressed the code review feedback:

@aboimpinto
Copy link
Copy Markdown
Contributor Author

Rebased onto current main (v0.8.44). Only 1 commit needed — the test commit was already upstream.

@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 24, 2026

Stewardship note: #1909 is now the canonical tracking issue for this Windows verbose-log leak, and the thinner duplicate #1904 was closed in favor of it. Keeping the issue open while this PR has a Windows failure; the next useful step is to inspect that failing check before deciding whether to merge, harvest, or revise.

@aboimpinto
Copy link
Copy Markdown
Contributor Author

Fixed the composer_history flaky test (timeout 5s → 30s). The memory_guidance_matches_constitutional_tier_order failure is pre-existing on main (prompts.rs is unchanged by this PR).

@aboimpinto aboimpinto force-pushed the fix/1776-part2-verbose-leak branch from ce14c79 to 90eecae Compare May 24, 2026 22:12
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented May 25, 2026

Thanks @aboimpinto. I checked this while triaging v0.8.45 PRs. The current PR diff only contains Cargo.toml/Cargo.lock version/dependency churn and does not include the described alt-screen verbose logging change, so I’m not merging it as-is. I’m keeping #1909 open because the underlying Windows logging issue still needs an actual code fix or a restored patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[URGENT] Windows: CLI verbose logging still leaks into TUI alt-screen after PR #1776 (second commit was not merged)

2 participants