Skip to content

Honor TERM=dumb and CI env in interactive console detection #1833

Description

@Widthdom

Summary

ConsoleUi.ShouldUseInteractiveConsole (ConsoleUi.cs:64-68) determines whether to render a spinner / progress bar based on Console.IsOutputRedirected alone. This misses several common cases: TERM=dumb (legitimately a TTY but supports no escape sequences), TERM unset (some embedded shells), running under tmux/screen with TERM=screen (escape behavior differs), and CI environments that allocate a TTY but pipe stdout through a logging shim. The result: spinner artifacts littering CI logs, broken in dumb-terminal environments, no graceful degradation.

Where

  • src/CodeIndex/Cli/ConsoleUi.cs:64-68 (interactive-console detection)
  • src/CodeIndex/Cli/ConsoleUi.cs:191-222 (spinner render)

Suggested approach

(1) Extend ShouldUseInteractiveConsole to also return false when TERM=dumb, TERM is empty/null on Unix, or CI=true env var is set (common convention adopted by GitHub Actions, GitLab, CircleCI). (2) Allow an explicit --progress=auto|always|never override (and CDIDX_PROGRESS=... env var). (3) Document the heuristic under "TTY detection" in the README. (4) Add unit tests that drive ShouldUseInteractiveConsole with various env permutations. (5) Cross-link with #1523 (NO_COLOR honor — same family of TTY-aware behavior) and the just-filed #1805 (--quiet) — they should compose: --quiet implies no spinner regardless of TTY.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions