anthropics / anthropics/claude-code
[FEATURE] Remote Control: same-name re-registration should supersede the old session entry (disconnected duplicates accumulate indefinitely)
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
## Summary
When a `claude --remote-control ` process is stopped and a new one is started with the **same display name**, the app (claude.ai / desktop / mobile, Code tab) creates a **new** entry in the Recents list instead of superseding the old one. The old disconnected entry stays forever — there is no delete affordance in the UI and no CLI command to deregister it (archiving only hides it).
## Environment
- Claude Code 2.1.219
- macOS (launchd keepalive) and Synology DSM (tmux + supervisor), all on a claude.ai Max subscription
## Reproduction
1. Run `claude --remote-control myhost-remote` on a machine; entry appears in the app.
2. Kill the process; start it again with the exact same name.
3. The app now shows **two** `myhost-remote` entries — one live, one permanently dead.
## Why this hurts in practice
I run a small fleet (4 machines) of 24/7 remote-control daemons. Because server-side registrations can **silently die** (process healthy, connections ESTABLISHED, but the host disappears from the app — client-side undetectable), each machine performs a **daily forced re-registration** as a mitigation. That works, but the side effect is **+4 dead duplicate entries every day**, and the Recents list becomes mostly graveyard. Users have to guess which same-named entry is the live one.
Note the irony: the accumulation is caused by the workaround for another RC reliability gap (silent registration loss). Fixing either side would help.
## Prior art
- #40812 — ghost sessions persist after restart (closed: not planned)
- #50496 — allow deleting old RC sessions (closed: not planned)
- #50884 — remove stale/dead RC environments (closed)
- #61525 — no way to delete or reconnect disconnected sessions (closed as **completed** on 2026-05-24, but the accumulation behavior above still reproduces on 2.1.219 as of 2026-07-26)
## Suggested fixes (any one of these would resolve it)
1. **Supersede by name**: a new registration with the same `--remote-control ` replaces the previous entry for that name (opt-in flag would be fine, e.g. `--remote-control-replace`).
2. **TTL / auto-expiry** for disconnected RC sessions (e.g. hide after N days offline).
3. **Delete affordance**: context-menu delete in the app and/or a CLI `claude remote-control deregister `.
Option 1 fits the daemon use case best: for a keepalive-managed host, the display name *is* the stable identity; the per-session entries behind it are an implementation detail.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the `claude --remote-control ` registration flow and how disconnected entries appear in the Code tab Recents list; the issue names no repository files or tests. Clarify which proposed behavior is intended, then add coverage showing that repeated registration with the same display name does not leave a permanent duplicate.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100