Skip to content

Detect CLIs as shell type - #304528

Merged
Anthony Kim (anthonykim1) merged 11 commits into
mainfrom
anthonykim1/redoTerminalTitle
Apr 13, 2026
Merged

Anthony Kim (anthonykim1) merged 11 commits into
mainfrom
anthonykim1/redoTerminalTitle

Conversation

@anthonykim1

@anthonykim1 Anthony Kim (anthonykim1) commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Resolves: #290830

Claude Code, Copilot CLI, and Gemini CLI all send OSC titles, which we would use when setting is enabled.

  • Codex does not. Will file request to have them set osc titles as they are useful identifier when different clis are being used across.

  • Gemini CLI has inconsistency of what they set the terminal title to when comparing Windows vs. Mac.

MacOS:
macOSTab

Limitation for MacOS) We don't detect codex as shell type maybe in future once we have process tree walk through like windows.

Windows:
WindowsSequenceTitle

  • Note that the "PWD" title on codex on Windows is the same you will see on Ghostty on Mac and also Windows terminal

Copilot AI review requested due to automatic review settings March 24, 2026 17:27

Copilot AI 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.

Pull request overview

Adjusts terminal shell-type detection and tab-title computation to better support “agent CLI” terminals (eg Copilot/Claude/Codex/Gemini), so their own escape-sequence-provided title (${sequence}) can be used instead of long process-based titles.

Changes:

  • Add new GeneralShellType values for agent CLIs and map them from process titles.
  • Override terminal tab title template to ${sequence} for agent CLI shell types (unless shellLaunchConfig.titleTemplate is set).
  • Extend unit tests to cover the new title-template override behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts Adds tests for agent-CLI ${sequence} title override and precedence rules.
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Refreshes labels on shell-type change; adds agent-CLI shell-type override to ${sequence}.
src/vs/platform/terminal/node/windowsShellHelper.ts Adds agent CLI executables/scripts to the Windows process-tree “shell executable” list.
src/vs/platform/terminal/node/terminalProcess.ts Adds agent CLI shell-type mappings and normalizes shell-type lookup to lowercase; includes new debug logging.
src/vs/platform/terminal/common/terminal.ts Introduces new GeneralShellType enum members for agent CLIs.

@anthonykim1 Anthony Kim (anthonykim1) changed the title Anthonykim1/redo terminal title Detect CLIs as shell type Apr 6, 2026

Copilot AI 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.

Pull request overview

This PR extends terminal “shell type” detection to recognize agent CLIs (eg Copilot/Gemini) and uses their OSC title/sequence to improve terminal tab titles when the foreground process is otherwise indistinguishable (often just node).

Changes:

  • Add new GeneralShellType values for agent CLIs and map them from process titles.
  • Detect agent CLIs from OSC title sequences in TerminalInstance, suppressing misleading node/undefined shell type updates while the agent is running.
  • Override terminal tab title templating to prefer ${sequence} for agent CLIs (and for node when an OSC title is present), with new unit tests.
Show a summary per file
File Description
src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts Adds unit coverage for ${sequence} title overrides for agent CLIs and node+OSC-title.
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Implements OSC-title-based agent CLI detection and tab label template overrides.
src/vs/platform/terminal/node/windowsShellHelper.ts Adds agent CLI entries to Windows process-tree “shell executable” list.
src/vs/platform/terminal/node/terminalProcess.ts Adds agent CLI mappings to general shell type detection; normalizes case in one code path.
src/vs/platform/terminal/common/terminal.ts Introduces new GeneralShellType enum values for agent CLIs.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 4

@github-actions

This comment was marked as off-topic.

@alexr00 Alex Ross (alexr00) removed this from the 1.116.0 milestone Apr 13, 2026
@anthonykim1

Copy link
Copy Markdown
Contributor Author

/cc Megan Rogge (@meganrogge)

@anthonykim1
Anthony Kim (anthonykim1) marked this pull request as ready for review April 13, 2026 18:20
@anthonykim1
Anthony Kim (anthonykim1) merged commit b81fc85 into main Apr 13, 2026
26 checks passed
@anthonykim1
Anthony Kim (anthonykim1) deleted the anthonykim1/redoTerminalTitle branch April 13, 2026 18:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Assignees

Couldn't load assignees.