[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.
11 Comments
Additional Finding:
/renamecommand not available in VS Code extensionThe
/renameslash command (which correctly syncs both sidebar and terminal tab) is not available in the VS Code extension. Typing/rename "name"returns:This means the only way to rename a session in the VS Code extension is through the sidebar pencil icon, which has the bug described above (name gets overwritten by auto-generated terminal title on next message).
Impact
/renameas a workaround — works correctlySuggestion
Either:
/renameslash command in the VS Code extension, so users have at least one working rename pathIdeally both should work.
Root Cause Analysis (from reading the bundled extension code)
I reverse-engineered the minified extension code at
~/.vscode/extensions/anthropic.claude-code-*/extension.jsandwebview/index.jsand found the exact root cause.The Bug: Reactive watcher in webview ignores
customTitleIn
webview/index.js, there's a reactive watcher that runs whenever the active session's state changes:This watcher always uses
summary.value(the AI-auto-generated title) to callrenameTab(). It never checks if the user has set acustomTitlevia the sidebar pencil icon.The Disconnect
When the user renames via the sidebar pencil icon:
renameSession(sessionId, title, false)is called → writes{"type":"custom-title", "customTitle": "..."}to the.jsonlfile ✅customTitlesmap is updated ✅summary.valueon the active session object is NOT updated ❌summary.valueand callsrenameTab()with the AI-generated title, overwriting the tab title ❌The Backend is Already Correct
The backend
renameSession()method inextension.jsalready has the right priority logic:And when loading sessions from disk:
So the file-level persistence is correct — custom titles survive restarts. The bug is purely in the live reactive watcher that controls the tab title during an active session.
Suggested Fix
In the reactive watcher that calls
renameTab(), add a check forcustomTitle:Additionally, the sidebar pencil rename handler should update
summary.value(or a newcustomTitlereactive signal) on the active session object so the watcher picks it up immediately.Environment
extension.js(362KB) andwebview/index.js(462KB)So even when you rename from the sidebar it gets overwritten? That's rough. No way to keep track of sessions at all.
+1, reproducing this on Linux with the VS Code extension.
Environment:
Repro:
Expected: Custom rename persists across messages and reloads until I rename it again.
Actual: Custom rename is cosmetic only. The first-message snippet is restored on the next render.
Impact: This makes the sidebar effectively unusable for organizing more than a handful of sessions. When the first message of a session is something generic like "ok" or "yes please" (which happens often when continuing prior context), there is no way to identify the session at a glance, and no way to label it manually. Combined with #35578 (auto-rename on restart) and #29194 (CLI /rename not syncing to the sidebar), there is currently no working path to give a session a stable human-readable name in the VS Code extension.
A claude.code.disableAutoRename setting plus persistence of pencil-icon renames would fully resolve this for me.
+1, reproducing this on macOS. The issue is currently labeled
platform:windowsbut it's clearly cross-platform at this point (Windows, Linux, and now macOS all confirmed).Environment:
anthropic.claude-code2.1.111Repro:
The rename is cosmetic. It never hits the live reactive watcher, so the AI title wins on the next state change. OQAY's root-cause analysis above nails it.
Impact: The sidebar is basically unusable for organizing more than a handful of sessions. I run 10+ sessions across a few projects and the auto-titles are near-useless when the first message is something generic like "keep going" or "let's work on X." There's currently no working path in the VS Code extension to give a session a stable name...
/renameisn't exposed here, and the pencil icon doesn't stick.Would love to see either:
customTitle\in the reactive watcher)/rename\exposed in the extension environment as a fallbackclaude.code.disableAutoRename\setting for people who just want to manage titles themselvesHappy to test a fix on macOS if someone picks this up.
+1, still reproducing on macOS with Claude Code 2.1.92.
Environment:
Sidebar pencil-icon rename reverts to the auto-generated title on the next message, matching @OQAY's root-cause analysis above (reactive watcher in
webview/index.jsreadssummary.valueand ignorescustomTitle).Also worth noting for anyone hitting this: the sidebar delete button is also a no-op in this version — filed separately as #49824. Between the two, there is currently no working way to manage sessions from the VS Code extension UI.
I found a workaround for this.
The terminal tab name takes priority over the sidebar label. As long as
the terminal tab is still open, clicking another session causes the
terminal tab's auto-generated name to overwrite the sidebar label I just
edited.
The fix: after renaming the session in the sidebar, close the terminal tab.
With the terminal tab gone, there's nothing left to overwrite the custom
name, so the edited label persists.
Confirmed above workaround works.
+1, reproducing this on macOS as well.
Environment:
OS: macOS (Darwin 25.5.0)
Editor: VS Code, Claude Code native extension
Repro: Renamed a session via the Session History panel (hover → Rename) to a custom name. The Session History list showed the new name, but the tab title kept the auto-generated title from the first message and never updated to match. No setting under claude-code.* controls this, and there's no documented way to force the tab to pick up the renamed value.
+1, still reproducing on Windows 11 — and I think I have a new data point that narrows the fix: there are two rename entry points in the VS Code extension, they behave differently, and the one that works is only available on some sessions.
Two rename paths, divergent behavior
Path A — panel header → history (clock) icon → session dropdown. This one works.
When the Claude Code panel header shows the clock/history icon, clicking it opens the session dropdown (Local / Web tabs + search + session list). Renaming a session from that dropdown does update the editor tab title at the top. Correct, expected behavior.
Path B — the
CLAUDE CODEsidebar session list. This one is broken.Renaming inline in the sidebar list updates the sidebar label only. The tab title never changes — exactly the bug described in this issue and root-caused by @OQAY above.
The kicker: Path A isn't always available. The clock/history icon only appears on some sessions — it seems to depend on how the session was created (I haven't pinned down the trigger; new sessions sometimes get it and sometimes don't). When it's absent, the sidebar list (Path B) is my only rename option, and that's the broken one. So whether I can successfully rename a session is effectively luck of the draw.
Why this matters for the fix
This corroborates @OQAY's analysis from the other direction: a code path that correctly pushes a user-set title into
renameTab()already exists and already ships — it's reachable from the header dropdown. The sidebar rename simply doesn't go through it.That suggests the fix may be smaller than "patch the reactive watcher and hope": route the sidebar rename handler through the same path the header-dropdown rename already uses. (The watcher
customTitlecheck @OQAY proposed is still the durable fix for the auto-title overwrite — these are complementary.)Two asks:
customTitlecheck in the watcher).Environment
anthropic.claude-code2.1.209 (win32-x64)Worth flagging that this is still present at 2.1.209 — ~130 releases after the original report at 2.1.81.
Confirming this bug is still present and adding a data point: running
/rename "some name"from within the VS Code extension's chat panel (not the CLI) printed a local success message —Session renamed to: <name>— with no error. However, neither the sidebar session label nor the terminal/tab title actually changed afterward.This differs slightly from @OQAY's original report above of
/renamereturning "Unknown skill: rename" — today, the command appeared to succeed but silently had no effect on either surface; the rename was persisted but I needed to close and reopen the session for the renamed value to appear (in both places) as per @wshallwshall 's comment.(Environment: Claude Code VS Code extension, Windows 11.)