[VSCode] Renaming session via sidebar pencil icon doesn't sync terminal tab title — next message overwrites the custom name
Bug Description
When renaming a session using the pencil icon in the sidebar session list (VS Code extension UI), the rename only applies to the sidebar label. The terminal tab title remains unchanged with the old auto-generated name.
On the next Claude response or user message, the auto-generated terminal tab title overwrites the custom name back in the sidebar — effectively losing the rename.
Steps to Reproduce
- Open a Claude Code session in VS Code
- Send a message (e.g., about updating a library) — the terminal tab gets auto-titled (e.g., "Update BMAD library")
- In the left sidebar (session list), click the pencil/edit icon next to the session
- Rename it to something else (e.g., "teste rename")
- The sidebar shows the new name, but the terminal tab still shows the old auto-generated title
- Send any new message or wait for Claude's response
- Bug: The sidebar name reverts back to the auto-generated terminal title (e.g., "Update BMAD library"), losing the custom name
Expected Behavior
- Renaming via the sidebar pencil icon should also update the terminal tab title
- The custom name should persist and not be overwritten by auto-generated titles
- Behavior should match
/renamecommand which correctly syncs both sidebar and terminal tab
Actual Behavior
- Sidebar rename and terminal tab title are out of sync
- The terminal tab title takes priority and overwrites the sidebar custom name on the next message cycle
- The rename is effectively lost
Screenshot
The sidebar shows "teste rename" (custom name), but the terminal tab still shows "Update BMAD library" (auto-generated). After the next message, "teste rename" gets overwritten back to "Update BMAD library".
Environment
- Claude Code version: 2.1.81
- VS Code: Windows 11 Pro
- Extension: Claude Code (native VS Code extension)
Workaround
Using /rename "name" command inside the session works correctly — it syncs both the sidebar and the terminal tab title. The bug is specific to the sidebar pencil icon rename UI.
Related Issues
- #25789 —
/renamenow updates terminal tab title (fixed, but only for/renamecommand) - #23610 — Custom session titles lost after resuming
- #26121 — Session name lost after context compaction
- #36077 —
/resumedoes not display custom session names
Suggested Fix
When the user renames a session via the sidebar UI (pencil icon), the extension should:
- Update the session metadata (as it currently does)
- Also send a terminal title update (ESC ]0; sequence or VS Code API
terminal.name) - Set a flag marking this as a user-defined name, preventing auto-generated titles from overwriting it (same logic already used by
/rename)
Essentially, the sidebar rename should internally trigger the same code path as /rename.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗