# Check stdin rather than stdout for interactive terminals (GitLab MR #3383) ## Metadata | Field | Value | |---|---| | Institute | Molodetz Institute — Research & Retrieval Division | | Subject | shell-multiplexer-auto-attach | | Document type | Source Dossier | | Tier | 1 | | Source title | Check stdin rather than stdout for interactive terminals | | Source URL | https://gitlab.com/gitlab-org/gitlab-development-kit/-/merge_requests/3383/pipelines | | Source publisher / author | GitLab (gitlab-development-kit project) | | Source type | repository | | Source date (published) | Unknown — not stated | | Date researched | 2026-10-09 | | Researched by | tai (agent), model: Claude Sonnet 5, on behalf of retoor | | Research method | web search synthesis | | Confidence | Medium | | Status | Active | ## Summary A real-world merge request fixing an interactivity check that tested `stdout.isatty()` when it should have tested `stdin.isatty()` — the two can legitimately disagree (e.g. output piped to a pager while input stays a real terminal, or vice versa). ## Key findings - `stdin.isatty()` and `stdout.isatty()` are independent facts and can differ in either direction in real, common shell usage (piping, redirection). - Which one is the "right" one to check depends on what the check is actually trying to answer (can I read user input? vs. can I write formatted/colored output?) — conflating them is a real, shipped bug class. ## Pros / strengths - A fixed, real production bug (not a hypothetical) — concrete evidence this mismatch actually bites people, not just a theoretical edge case. ## Cons / limitations / caveats - Specific to one project's bug fix; doesn't generalize a universal rule beyond "check the stream that matches what you actually need, and don't assume stdin/stdout agree." ## Relevance to tai A direct implementation warning for the proposal's `.bashrc` detection logic: if it ever needs to distinguish "can prompt a human" from "output looks like a terminal," check `stdin` specifically (`[ -t 0 ]`), not `stdout`, and never assume the two will match. ## Changelog | Date | Change | |---|---| | 2026-10-09 | Initial dossier created. |