[BUG] VS Code: ListAgents name reverts to an auto-generated name after resuming a renamed session

Status Open
Reported on v2.1.287
Maintainer reply None cached
Activity 1 comment · opened Oct 2, 2026

Bug

In the VS Code extension, after VS Code is restarted and a renamed conversation is resumed, the running session's own name (the first line of ListAgents: "This session is <name>") is an auto-generated name (e.g. demo-project-4c), while the conversation title set by /rename is restored correctly.

Running /rename <same name> again restores the name reported by ListAgents. Returning the same title from a SessionStart hook via hookSpecificOutput.sessionTitle does not.

Environment

  • Claude Code 2.1.287 (VS Code extension anthropic.claude-code, entrypoint: claude-vscode)
  • VS Code 1.140.0
  • Windows 11

Steps to reproduce

  1. Start a new conversation in the Claude Code VS Code extension and run /rename my-session.
  2. Quit VS Code and start it again. The extension restores the conversation tab automatically.
  3. In the restored conversation, ask Claude to call ListAgents.
  4. Observe that the first line reports an auto-generated name (This session is <folder>-<xx>), while the conversation tab still shows my-session.
  5. Run /rename my-session again, then call ListAgents. The reported name is now my-session.

Expected

After step 3, the first line says This session is my-session.

Observations

  • The transcript (<session-id>.jsonl) contains {"type":"custom-title","customTitle":"my-session"} and {"type":"agent-name","agentName":"my-session"} records, with new ones appended repeatedly during the conversation, including after resume. So the name is persisted, but after resume ListAgents reports an auto-generated name instead.
  • A SessionStart hook (matcher startup|resume|clear|compact) receives "session_title": "my-session" on stdin for source resume, so the title is known at that point.
  • When that hook returns {"hookSpecificOutput": {"hookEventName": "SessionStart", "sessionTitle": "my-session"}}, the run is recorded as hook_success and its captured stdout contains that JSON. However, ListAgents still reports the auto-generated name.
  • In my tests, other sessions reported the custom name when ~/.claude/sessions/<PID>.json contained "name": "my-session" and "nameSource": "user". After restart, the new <PID>.json contained an auto-generated name instead.

Impact

After restarting VS Code, I have to run /rename again in each affected session to restore the name used for cross-session messaging (ListAgents / SendMessage).

Related

  • #80711: SessionStart hook sessionTitle is persisted but not shown in the TUI session-name badge. A similar persistence/display mismatch; it is unclear whether the cause is shared.
  • #88992: renaming via the VS Code sidebar doesn't update the ListAgents / SendMessage name. Different trigger (sidebar rename, not resume after /rename).
  • #87114: reports missing sessions in ListAgents and names that differ from those shown in the session overview.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗