Stale/duplicate session titles + no wrong-session safeguard → silent data loss in Bypass-permissions mode
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code session titles are auto-generated from the first message and never update as the work pivots, so long-lived sessions become misnamed. When several sessions on one project start with similar first messages, they are near-indistinguishable in the mobile session list and on desktop. This makes it easy to send an instruction to the WRONG session.
If that target session is in Bypass-permissions mode, the misrouted command executes with NO confirmation prompt — silent commits/deletes/overwrites in the wrong repo or branch, with no undo. The typo isn't the real hazard; wrong-session + bypass-permissions is.
Real example (today): three concurrently-live sessions — "Build 3D combo lab with animation", "3D Combo Lab authoring surface", and "Encode Combo Lab 3D decisions" — where the one titled "Build 3D combo lab with animation" had actually become the MCP/infra session. The title no longer matched its contents at all, and a sibling session was running in Bypass-permissions mode.
Surfaces involved: desktop app + mobile app with Remote Control.
What Should Happen?
Session titles should track what a session is actually about — auto-retitle (or prompt to retitle) when the topic drifts from the first message, with an easy manual rename on BOTH desktop and mobile.
Near-identical titles should be disambiguated in the list (append branch / cwd / a short session id).
There should be a strong, persistent indicator of which session is currently focused, plus a confirm-on-target when switching sessions via Remote Control.
Safety backstop: the FIRST mutating command after a Remote-Control session switch should require explicit confirmation even in Bypass-permissions mode, so a misrouted instruction can't silently modify the wrong repo/branch.
Error Messages/Logs
Steps to Reproduce
- Start several Claude Code sessions on the same project, each with a similar opening message (e.g. multiple "3D combo lab" chats).
- Let their actual work diverge over time — one becomes infra/MCP setup, another stays the original task.
- Open the session list on mobile AND on desktop: titles are still frozen at each session's first message, and several read almost identically.
- Switch between sessions via Remote Control. There is no strong, persistent indicator of which session is currently focused, and the near-identical titles don't disambiguate.
- Type an instruction intended for one session — it is easy to send it to the wrong one. If the target session is in Bypass-permissions mode, it executes immediately with no confirmation.
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
N/A — used via the Claude Code desktop app + mobile app with Remote Control; no standalone CLI is installed on this machine, so claude --version is unavailable. Auto-update channel: latest.
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
4 Comments
You've framed the real hazard correctly — "wrong-session + bypass-permissions," not the typo. One non-obvious thing worth knowing, because it lets you rebuild a safety net today without waiting on the retitle feature:
**Bypass-permissions disables the confirmation prompt, but it does not disable
PreToolUsehooks.** Hooks fire independently of the permission mode. So the misrouted-destructive-command path that currently executes silently can still be intercepted deterministically by a hook — the one layer bypass mode doesn't skip.Two concrete pieces:
SessionStarthook records the intended repo root + branch (e.g. into a per-session file keyed by the session id). APreToolUsehook onBashthen, for destructive verbs (git commit,git push,git reset --hard,rm -rf,git checkout/branch switches), compares the currentcwdrepo/branch against what was pinned — and refuses (exit non-zero) on a mismatch. That converts "a misrouted command silently committed to the wrong repo" into a hard stop, even under bypass-permissions. Reads and matching-context commands pass, so it's low-friction.SessionStarthook that injects/echoescwd + git branch + a short taggives each session a stable, content-true marker in its own transcript, so you can tell "which session is this" from the session itself rather than from a title that froze on the first message. (A statusline showing repo/branch does the same on desktop.) This addresses the disambiguation half without needing the auto-retitle to ship.The feature request (auto-retitle on topic drift + disambiguate near-identical titles + easy rename on mobile/desktop) is the right product fix — especially the mobile rename, since Remote Control is where misrouting is easiest. But the irreversible-write part of this is the more urgent half, and it's defensible at the hook layer right now: the title fix prevents misidentification, while a context-pinning
PreToolUseguard prevents the destructive execution that misidentification leads to. Worth doing both — they cover different stages of the same failure.(Reasoning from your description; you'd scope the refused-verb list and the "what counts as the right context" check to your own workflow — the point is just that the hook layer survives bypass mode, which is exactly the gap you hit.)
The framing is exactly right — the typo isn't the hazard, wrong-session + bypass-permissions is. A few user-side mitigations that contain the blast radius today, before any title/safeguard fix lands:
1. Isolate concurrent sessions by working directory, not just by title. Run each parallel session in its own git worktree (or clone):
Now a misrouted command operates on that worktree's checkout — it can't overwrite files or commit on the sibling session's branch, because each session's
cwdis a different tree. It turns "silent damage in the wrong repo" into "a no-op or obvious error in the right-but-wrong-task tree."2. Treat
--dangerously-skip-permissionsas a per-task, single-session tool, not a default for long-lived or concurrent sessions. The flag's whole purpose is removing the confirmation that would otherwise catch a misroute; the more sessions you have live, the more that one prompt is worth. The infra/MCP session that had pivoted would, in normal permission mode, have surfaced the wrong-session command as a prompt instead of running it silently.3. Keep a hook-level safety net that survives bypass mode. PreToolUse hooks run independently of the permission prompts, so they still fire under
--dangerously-skip-permissions(this is exactly why hook-based guards are used in autonomous setups). A small PreToolUse hook that blocks (exit 2) destructive operations when the session isn't in its expected repo/branch — e.g. refusegit push/git reset --hard/rm -rfwhengit rev-parse --show-toplevelisn't the path this session is supposed to own — gives you a wrong-session guard that doesn't depend on the UI ever fixing titles. Encode the "expected repo" via an env var set when you launch each session.None of these fix the underlying UX gap (stale titles + no wrong-session confirmation), but together they make a misroute recoverable instead of silent-and-irreversible.
Session identity belongs in the authorization context, not only in the UI label. A mutation decision should be bound to at least the canonical repo root, worktree, branch, session id, and the moment the operator last selected that session.
The proposed first-mutation-after-switching gate is especially useful because it creates an explicit handoff boundary. I would also show a stable short session id and cwd in every remote-control composer, then invalidate any cached mutation approval when either changes. Hooks can veto a dangerous command, but they cannot infer which similarly named session the human intended to address; that must be enforced above the tool layer.
Thanks — the wrong-session + bypass-permissions hazard is a fair point. Part of this is covered today: you can rename any session with
/renamein the CLI, and renames made from the desktop app or claude.ai now sync to the CLI session name as well. Docs: https://code.claude.com/docs/en/commandsAutomatically re-titling when the topic drifts, disambiguating near-identical titles, and a stronger mode indicator on mobile are still open, so leaving this open for those.
🤖 Generated with Claude Code