[VSCode] Renaming session via sidebar pencil icon doesn't sync terminal tab title — next message overwrites the custom name

Status Open
Reported on v2.1.81
Maintainer reply None cached
Activity 11 comments · opened Mar 23, 2026

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

  1. Open a Claude Code session in VS Code
  2. Send a message (e.g., about updating a library) — the terminal tab gets auto-titled (e.g., "Update BMAD library")
  3. In the left sidebar (session list), click the pencil/edit icon next to the session
  4. Rename it to something else (e.g., "teste rename")
  5. The sidebar shows the new name, but the terminal tab still shows the old auto-generated title
  6. Send any new message or wait for Claude's response
  7. 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 /rename command 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 — /rename now updates terminal tab title (fixed, but only for /rename command)
  • #23610 — Custom session titles lost after resuming
  • #26121 — Session name lost after context compaction
  • #36077 — /resume does not display custom session names

Suggested Fix

When the user renames a session via the sidebar UI (pencil icon), the extension should:

  1. Update the session metadata (as it currently does)
  2. Also send a terminal title update (ESC ]0; sequence or VS Code API terminal.name)
  3. 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.

View original on GitHub ↗

11 Comments

OQAY · 6 months ago

Additional Finding: /rename command not available in VS Code extension

The /rename slash command (which correctly syncs both sidebar and terminal tab) is not available in the VS Code extension. Typing /rename "name" returns:

Unknown skill: rename — no matching commands

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

  • CLI users: Have /rename as a workaround — works correctly
  • VS Code extension users: No working rename mechanism at all — the only option (sidebar pencil icon) is broken

Suggestion

Either:

  1. Fix the sidebar pencil icon rename to sync with terminal tab title and prevent auto-generated titles from overwriting it (same as the original suggestion)
  2. Or expose the /rename slash command in the VS Code extension, so users have at least one working rename path

Ideally both should work.

OQAY · 6 months ago

Root Cause Analysis (from reading the bundled extension code)

I reverse-engineered the minified extension code at ~/.vscode/extensions/anthropic.claude-code-*/extension.js and webview/index.js and found the exact root cause.

The Bug: Reactive watcher in webview ignores customTitle

In webview/index.js, there's a reactive watcher that runs whenever the active session's state changes:

// Reactive watcher (runs on every session state change):
let Q = session?.summary.value;  // Always reads AI-generated summary
let q = (Q && Q.length > 25 ? Q.substring(0, 24) + "…" : Q) || "Claude Code";
connection.renameTab(q, hasPendingPermissions, hasUnseenCompletion);

This watcher always uses summary.value (the AI-auto-generated title) to call renameTab(). It never checks if the user has set a customTitle via the sidebar pencil icon.

The Disconnect

When the user renames via the sidebar pencil icon:

  1. renameSession(sessionId, title, false) is called → writes {"type":"custom-title", "customTitle": "..."} to the .jsonl file ✅
  2. The session's customTitles map is updated ✅
  3. But summary.value on the active session object is NOT updated ❌
  4. On the next reactive trigger (new message, state change), the watcher reads the old summary.value and calls renameTab() with the AI-generated title, overwriting the tab title ❌

The Backend is Already Correct

The backend renameSession() method in extension.js already has the right priority logic:

// When AI tries to set title (j=true):
if (customTitle exists in .jsonl) return true;  // Skip — user already renamed

// When user sets title (j=false):
write {"type": "custom-title", ...} to .jsonl

And when loading sessions from disk:

if (type === "custom-title") { title = customTitle; isCustom = true; }
if (type === "ai-title" && !isCustom) { title = aiTitle; }  // Respects custom

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 for customTitle:

// BEFORE (current):
let Q = session?.summary.value;
let q = (Q && Q.length > 25 ? Q.substring(0, 24) + "…" : Q) || "Claude Code";
connection.renameTab(q, ...);

// AFTER (fix):
let customTitle = session?.customTitle?.value;  // Check user-defined title first
let Q = customTitle || session?.summary.value;
let q = (Q && Q.length > 25 ? Q.substring(0, 24) + "…" : Q) || "Claude Code";
connection.renameTab(q, ...);

Additionally, the sidebar pencil rename handler should update summary.value (or a new customTitle reactive signal) on the active session object so the watcher picks it up immediately.

Environment

  • Extension version: 2.1.81 (win32-x64)
  • File analyzed: extension.js (362KB) and webview/index.js (462KB)
techflowil · 6 months ago

So even when you rename from the sidebar it gets overwritten? That's rough. No way to keep track of sessions at all.

becerratops · 6 months ago

+1, reproducing this on Linux with the VS Code extension.

Environment:

  • OS: Linux (Ubuntu 24.04)
  • Editor: VS Code with Claude Code extension
  • Claude Code version: 2.1.96

Repro:

  1. Open an existing session in the sidebar
  2. Hover the entry, click the pencil icon, rename to a custom title (e.g. "Jake's chat")
  3. Rename appears to succeed in the sidebar UI
  4. Send another message in the session, or reload the VS Code window
  5. Sidebar entry reverts to a snippet of the first user message in the session, not the custom name

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.

Logvin · 6 months ago

+1, reproducing this on macOS. The issue is currently labeled platform:windows but it's clearly cross-platform at this point (Windows, Linux, and now macOS all confirmed).

Environment:

  • OS: macOS 15.3 (Darwin 25.3.0, Apple Silicon)
  • Editor: VS Code 1.115.0
  • Extension: anthropic.claude-code 2.1.111

Repro:

  1. Open an existing session from the sidebar
  2. Hover the entry, click the pencil icon, rename to something like "Sexy Feet Pics Project"
  3. Sidebar updates... looks fine
  4. Send one more message
  5. Sidebar reverts to the auto-generated title on the next render

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... /rename isn't exposed here, and the pencil icon doesn't stick.

Would love to see either:

  1. The one-line fix OQAY proposed (check \customTitle\ in the reactive watcher)
  2. \/rename\ exposed in the extension environment as a fallback
  3. A \claude.code.disableAutoRename\ setting for people who just want to manage titles themselves

Happy to test a fix on macOS if someone picks this up.

joelveloso · 6 months ago

+1, still reproducing on macOS with Claude Code 2.1.92.

Environment:

  • OS: macOS 26.4.1 (Darwin 25.4.0, Apple Silicon)
  • Extension: Claude Code 2.1.92
  • Editor: VS Code (native extension)

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.js reads summary.value and ignores customTitle).

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.

economistkr73-prog · 4 months ago

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.

joelveloso · 3 months ago

Confirmed above workaround works.

ahmedsalhin · 3 months ago

+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.

wshallwshall · 3 months ago

+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 CODE sidebar 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 customTitle check @OQAY proposed is still the durable fix for the auto-title overwrite — these are complementary.)

Two asks:

  1. Make the sidebar rename update the tab title (route it through the working path, and/or apply the customTitle check in the watcher).
  2. Make the header history icon consistently available, so the working rename path isn't conditional on how the session happened to be created.

Environment

  • OS: Windows 11 Home (10.0.26200)
  • VS Code: 1.128.1
  • Extension: anthropic.claude-code 2.1.209 (win32-x64)
  • Claude Code: 2.1.207

Worth flagging that this is still present at 2.1.209 — ~130 releases after the original report at 2.1.81.

AdrianJohnsonUK18 · 2 months ago

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 /rename returning "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.)