Treat non-interactive dumb terminals as warnings in codex doctor (#44615)

## Why

`TERM=dumb` should not fail the terminal check when neither stdin nor stdout is a terminal. Terminal warnings should also not obscure more severe issues such as unreadable terminfo.

## What changed

- Report `TERM=dumb` as a warning in non-interactive runs, without suggesting a replacement `TERM` value. Keep it a failure when stdin or stdout is a terminal.
- Sort terminal issues by descending severity so failures appear first.

## Testing

Add coverage for terminal stream combinations, human output snapshots, and a non-interactive JSON report that retains an overall failure and exit code `1` when another check fails.

GitOrigin-RevId: 9af5483e371b4b06eb50e8fcdf15704f0bbc33f1
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-10 18:40:07 +00:00
1 parent 3715bf4100
commit 3422443ec4
4 files changed
+141 -21

No files matched your search

+19
View File
@@ -178,6 +178,25 @@ fn startup_and_doctor_do_not_execute_path_helpers() -> Result<()> {
Ok(())
}
#[test]
fn non_interactive_dumb_terminal_preserves_other_doctor_failures() -> Result<()> {
let fixture = Fixture::new()?;
let output = fixture
.command()?
.args(["doctor", "--json"])
// Explicit identity takes precedence over inherited terminal-specific variables.
.env("TERM_PROGRAM", "dumb")
.env_remove("TERMINFO")
.env_remove("TERMINFO_DIRS")
.output()?;
// The fixture's provider is unreachable, regardless of terminal capabilities.
assert_eq!(output.status.code(), Some(1));
let report: Value = serde_json::from_slice(&output.stdout)?;
assert_eq!(report["checks"]["terminal.env"]["status"], "warning");
assert_eq!(report["overallStatus"], "fail");
Ok(())
}
#[cfg(unix)]
#[tokio::test]
async fn interactive_tmux_startup_does_not_execute_workspace_helpers() -> Result<()> {