VS Code: auto-title overwrites manually renamed sessions repeatedly

Resolved 💬 6 comments Opened Mar 30, 2026 by tarcisiopad Closed Jun 4, 2026

Bug description

When renaming a session in the Claude Code VS Code extension, the title reverts to the previous name — not just once, but repeatedly throughout the conversation. Each manual rename triggers what appears to be a race condition where the webview sends back a stale cached title milliseconds after the user's rename.

Evidence

A single session JSONL file contained 78 custom-title entries — the user kept renaming to "GoAds" and the UI kept reverting to the previous title ("Vendas"). The pattern clearly shows alternating entries:

{"type":"custom-title","sessionId":"...","customTitle":"GoAds"}    // user sets
{"type":"custom-title","customTitle":"Vendas","sessionId":"..."}   // UI reverts
{"type":"custom-title","sessionId":"...","customTitle":"GoAds"}    // user sets again
{"type":"custom-title","customTitle":"Vendas","sessionId":"..."}   // UI reverts again
// ...repeated 78 times

Note the different JSON field ordering — sessionId first when user-initiated vs customTitle first when reverted — suggesting two different code paths are generating these entries.

Root cause analysis

The renameSession method in extension.js (line 202) correctly protects against ai-title overwriting customTitle, but has no protection against stale custom-title writes. The webview appears to sync its state and send back the old cached title as a new custom-title write, which overwrites the user's rename.

Suggested fix

Add a debounce/lock mechanism to renameSession: after a manual rename, ignore any subsequent rename with a different title within a short window (e.g., 3 seconds). This blocks the stale UI revert while still allowing the user to rename again after the window.

Alternatively, track a userRenamed flag that permanently disables auto-titling for that session, and add deduplication to prevent writing the same title twice.

Steps to reproduce

  1. Open Claude Code in VS Code
  2. Start a conversation and send a message
  3. Rename the session to a custom name (e.g., "MyProject")
  4. Continue conversing
  5. Observe: the session name reverts to the auto-generated or previous title
  6. Rename again — it reverts again

Environment

  • OS: Windows 11
  • IDE: VS Code
  • Extension version: 2.1.87

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗