[Bug]: Integrated terminal does not set TERM_PROGRAM, breaking shell prompt and terminal detection#8450

openedAug 27, 2026byNNoahbanderson

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. Open the integrated terminal in T3 Code on macOS.
  2. Run: echo "[$TERM_PROGRAM] [$TERM_PROGRAM_VERSION] [$COLORTERM]"
  3. Observe all three are empty.

For a practical repro, use any shell config that selects a prompt by terminal. Minimal case:

1case "$TERM_PROGRAM" in
2 "vscode") echo "vscode config" ;;
3 "ghostty") echo "ghostty config" ;;
4 *) echo "fallback config" ;;
5esac

In every other terminal emulator this selects the correct branch. In T3 Code it always hits the fallback, because there is nothing to match on.

Expected behavior

The integrated terminal exports TERM_PROGRAM (and ideally TERM_PROGRAM_VERSION) into the pty environment, the way every other terminal emulator does:

EmulatorTERM_PROGRAM
VS Codevscode
Apple TerminalApple_Terminal
iTerm2iTerm.app
Ghosttyghostty
WezTermWezTerm
HyperHyper
T3 Code(unset)

Something like TERM_PROGRAM=t3code plus TERM_PROGRAM_VERSION=0.0.35.

Actual behavior

TERM_PROGRAM is never set, so the shell cannot tell it is running inside T3 Code.

Impact

Minor bug or occasional failure

Version or commit

main

Environment

15.7.4

Logs or stack traces

shell
1

Screenshots, recordings, or supporting files

No response

Workaround

No response

Synced from GitHub

I reproduced this on macOS and have a small fix ready for TERM_PROGRAM and TERM_PROGRAM_VERSION.

The patch sets them to t3code and the server package version when T3 Code creates the terminal environment. It overrides inherited values such as Apple_Terminal, while explicit per-terminal runtime overrides still take precedence.

I tested:

  • Both variables missing from the parent environment
  • Inherited Apple_Terminal and version 2.14
  • Explicit runtime overrides
  • The complete terminal manager test file, with all 56 tests passing

I am leaving COLORTERM out because #7680 already covers it. I will open a focused PR for the first two variables and link it here.

Reproduced on current main: the integrated terminal's shell started without TERM_PROGRAM (COLORTERM was already set). #22827 sets TERM_PROGRAM and TERM_PROGRAM_VERSION at spawn without changing which user environment variables pass through. Both reviewers approved and the proof audit passed; Windows ConPTY and desktop remain unverified.