claude-code - 💡(How to fix) Fix Session name auto-rename overwrites user-set names — endless rename loop [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49710Fetched 2026-04-17 08:33:35
View on GitHub
Comments
1
Participants
1
Timeline
7
Reactions
0
Author
Participants
Timeline (top)
mentioned ×3subscribed ×2closed ×1commented ×1
RAW_BUFFERClick to expand / collapse

Type: bug / UX regression

Problem

In Claude Code desktop, session names are being auto-overwritten with random snippets from conversation dialog. I rename a session to something meaningful, continue working, and Claude Code silently overwrites my name with arbitrary dialog text. Rename → get overwritten → rename again → get overwritten. Endless loop.

What I want instead

For agent-driven workflows, session names should be the agent name or workstream identifier — things like:

  • captain
  • designex
  • devex
  • of-mobile
  • iscp
  • mdpal-cli

Short, stable, meaningful labels that tell me which agent this session is running. Random dialog snippets like "I'll start by reading the file" tell me nothing — they describe what just happened, not what this session IS.

Impact

  • User-set names get overwritten
  • For multi-agent workflows (captain + N worktree agents in parallel tabs), I need stable short names to distinguish them
  • Can't reliably find a session by name — they change without my action
  • Forces repeated manual intervention just to keep the name I set
  • Undermines the whole point of naming a session (organization, recall, tab differentiation)

Expected behavior

Once a user explicitly sets a session name, Claude Code should never auto-rename it. Even better: let the agent set the session name programmatically at startup (e.g., from $AGENTNAME env var) so it's automatic but deterministic and meaningful.

Suggested fix

  1. Track name source: user | auto | agent
  2. Auto-rename only when source is auto
  3. First user rename flips source to user and stops further auto-rename forever
  4. Expose a way for agents to self-name at startup (e.g., CLAUDE_SESSION_NAME env var or a hook)

Reproduction

  1. Start a Claude Code desktop session
  2. Rename to something specific (captain, designex, etc.)
  3. Continue the conversation
  4. Watch the name get overwritten with a random dialog fragment within a few turns

Happens reliably, multiple times per session.

Reporter

Jordan Dea-Mattson Head of Product and Technology, OrdinaryFolk (soon CPTO)

Hits this constantly running multi-agent workflows (captain + N worktree agents in parallel tabs). Building TheAgency — an open-source AI Augmented Development framework — where multi-session tab differentiation is central to the workflow.

extent analysis

TL;DR

The issue can be resolved by implementing a mechanism to track the source of the session name and only allowing auto-rename when the source is auto, while also providing a way for agents to set the session name programmatically.

Guidance

  • Implement a name_source tracker with values user, auto, or agent to determine when to allow auto-rename.
  • When a user explicitly sets a session name, flip the name_source to user and prevent further auto-rename.
  • Introduce an environment variable (e.g., CLAUDE_SESSION_NAME) or a hook for agents to set the session name at startup.
  • Verify the fix by testing the session name persistence after user rename and agent startup.

Example

# Pseudocode example of name_source tracker
class Session:
    def __init__(self):
        self.name_source = 'auto'

    def set_name(self, name):
        self.name = name
        self.name_source = 'user'

    def auto_rename(self, new_name):
        if self.name_source == 'auto':
            self.name = new_name

Notes

The provided pseudocode example is a simplified illustration and may require adaptation to the actual implementation.

Recommendation

Apply the suggested fix by implementing the name_source tracker and providing a way for agents to set the session name programmatically, as this approach addresses the root cause of the issue and aligns with the expected behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Once a user explicitly sets a session name, Claude Code should never auto-rename it. Even better: let the agent set the session name programmatically at startup (e.g., from $AGENTNAME env var) so it's automatic but deterministic and meaningful.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Session name auto-rename overwrites user-set names — endless rename loop [1 comments, 1 participants]