Skip to content

fix: stop RUST_LOG from leaking tracing messages into TUI alt-screen on Windows#1776

Closed
aboimpinto wants to merge 6 commits into
Hmbown:mainfrom
aboimpinto:fix/rust-log-tui-corruption
Closed

fix: stop RUST_LOG from leaking tracing messages into TUI alt-screen on Windows#1776
aboimpinto wants to merge 6 commits into
Hmbown:mainfrom
aboimpinto:fix/rust-log-tui-corruption

Conversation

@aboimpinto

@aboimpinto aboimpinto commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix a Windows-specific bug where RUST_LOG environment variable (commonly set for tracing) causes tracing log messages to leak into the DeepSeek-TUI alt-screen, corrupting the terminal display.

Problem

When running DeepSeek-TUI with verbose logging enabled (DEEPSEEK_LOG_LEVEL=debug or --verbose), the env_requests_verbose_logging() function in crates/tui/src/logging.rs was checking both DEEPSEEK_LOG_LEVEL and RUST_LOG:

pub fn env_requests_verbose_logging() -> bool {
    std::env::var("DEEPSEEK_LOG_LEVEL")
        .ok()
        .is_some_and(|value| log_value_enables_verbose(&value))
        || std::env::var("RUST_LOG")  // ← causes issue on Windows
            .ok()
            .is_some_and(|value| log_value_enables_verbose(&value))
}

RUST_LOG controls the tracing subscriber filter in runtime_log.rs (file logging). On Windows, stderr is not redirected to the log file. When RUST_LOG is set to trace/debug/info, it incorrectly activates verbose CLI output, causing tracing messages to spill onto the TUI alt-screen display.

Fix

Remove RUST_LOG from env_requests_verbose_logging(). Only DEEPSEEK_LOG_LEVEL should gate CLI verbose output:

/// Note: RUST_LOG is intentionally NOT checked here — it controls the
/// tracing subscriber filter in runtime_log.rs (file logging) and
/// should not gate CLI verbose output. On Windows, where stderr is not
/// redirected to the log file, coupling the two causes tracing log
/// messages to leak into the TUI alt-screen.
pub fn env_requests_verbose_logging() -> bool {
    std::env::var("DEEPSEEK_LOG_LEVEL")
        .ok()
        .is_some_and(|value| log_value_enables_verbose(&value))
}

Steps to Reproduce

  1. On Windows, set RUST_LOG=trace
  2. Launch deepseek-tui --verbose
  3. Observe tracing log lines from stderr overwriting the alt-screen buffer

Changes

  • crates/tui/src/logging.rs: Remove RUST_LOG check from verbose output gate
  • Add documentation comment explaining why RUST_LOG is intentionally excluded

Closes #1774

…on Windows

Only DEEPSEEK_LOG_LEVEL should gate verbose CLI output. RUST_LOG controls
the tracing subscriber independently (file logging). On Windows stderr is
not redirected to the log file, so coupling the two causes tracing log
messages to leak into the TUI alt-screen, corrupting the display.

Closes Hmbown#1774

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

Copy link
Copy Markdown
Contributor

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 decouples the RUST_LOG environment variable from the CLI's verbose logging logic in crates/tui/src/logging.rs to prevent log leakage into the TUI, particularly on Windows. Feedback suggests refining the documentation to more accurately distinguish between tracing crate messages and internal CLI verbose messages emitted via eprintln!.

Comment thread crates/tui/src/logging.rs Outdated
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
aboimpinto added a commit to aboimpinto/CodeWhale that referenced this pull request May 18, 2026
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
aboimpinto added a commit to aboimpinto/CodeWhale that referenced this pull request May 18, 2026
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
aboimpinto added a commit to aboimpinto/CodeWhale that referenced this pull request May 19, 2026
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
aboimpinto added a commit to aboimpinto/CodeWhale that referenced this pull request May 19, 2026
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
aboimpinto added a commit to aboimpinto/CodeWhale that referenced this pull request May 19, 2026
…criber in logging.rs

Addresses gemini-code-assist review feedback on PR Hmbown#1776.
@Hmbown Hmbown mentioned this pull request May 20, 2026
11 tasks
@Hmbown

Hmbown commented May 21, 2026

Copy link
Copy Markdown
Owner

Thanks for the Windows RUST_LOG leakage fix. This was harvested into v0.8.40 release PR #1823 as commit 1874359, and #1823 is now CI-green. Closing as superseded by the release branch; thank you for the Windows reliability work.

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.

Windows: RUST_LOG leaks tracing into TUI alt-screen

2 participants