Skip to content

Fix clearing custom terminal titles - #336599

Merged
Megan Rogge (meganrogge) merged 1 commit into
microsoft:mainfrom
Chirag-Bhardwaj:fix/terminal-clear-custom-title
Sep 17, 2026
Merged

Megan Rogge (meganrogge) merged 1 commit into
microsoft:mainfrom
Chirag-Bhardwaj:fix/terminal-clear-custom-title

Conversation

@Chirag-Bhardwaj

Copy link
Copy Markdown
Contributor

Fixes #333933.

Clearing a custom terminal name leaves _staticTitle and the API title source intact, so subsequent label refreshes can restore the old name and process title updates remain blocked. It also leaves the shell title listener disconnected. Reset those fields and restore the listener when an API rename clears the title.

Adds regression coverage for empty-string and undefined renames followed by a process title update, and for an OSC title sequence after clearing the name. All three cases fail before the fix and pass afterward.

Validation:

  • npm run test-browser-no-install -- --browser chromium --run src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts — 114 passing.
  • Targeted ESLint for both changed files and git diff --check pass.

To verify manually: rename a terminal to a custom name, rename it to an empty name, then run printf '\033]0;updated-title\007' with terminal.integrated.tabs.title set to ${sequence}. The title should follow subsequent shell updates instead of retaining the custom name.

AI assistance: implemented and tested with OpenAI Codex.

Copilot AI balanced review requested due to automatic review settings September 17, 2026 18:17
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
  • src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts

@Chirag-Bhardwaj

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

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.

🟢 Approval recommended

The focused fix correctly restores title behavior and includes regression coverage for all described cases.

Pull request overview

Fixes terminal title clearing so dynamic process and shell-sequence titles resume correctly.

Changes:

  • Clears stale API title state and restores the shell title listener.
  • Adds regression tests for empty and undefined title resets.
File summaries
File Description
terminalInstance.ts Resets static title state and restores dynamic title updates.
terminalInstance.test.ts Tests process and OSC title updates after clearing.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@meganrogge Megan Rogge (meganrogge) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@meganrogge
Megan Rogge (meganrogge) merged commit 5ddf120 into microsoft:main Sep 17, 2026
33 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.139.0 milestone Sep 17, 2026
Abdon Morales (abdonmorales) pushed a commit to abdonmorales/vscode-utcs that referenced this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal: empty rename does not restore dynamic tab title — stale staticTitle is never cleared

5 participants