-
Notifications
You must be signed in to change notification settings - Fork 0
Detection layer: purple dot mapped to wrong session for same-cwd sessions #60
Copy link
Copy link
Closed
Description
Problem
When multiple Claude Code sessions share the same project directory, the purple active dot (detection layer) may be placed on the wrong session item, and switch may jump to the wrong tab.
How to reproduce
- Have two sessions with the same project path (e.g. both in
~/git/codex-ff) - Resume one session using
claude -r(interactive picker) orclaude -r <uuid> - Open CodeV Quick Switcher → Sessions tab
- The purple dot appears on the most recently modified same-path session, not necessarily the one actually running
Tested with both iTerm2 and Ghostty — same behavior.
Root cause
detectActiveSessions() maps PIDs to session IDs using two passes:
- First pass: match
--resume <uuid>or-r <uuid>in process args via regex → correct mapping - Second pass: for processes without UUID in args, use
lsofto find cwd → match to the first unclaimed session with that cwd
The second pass fails for same-cwd sessions because it picks whichever session comes first in the list.
Three bugs found:
- Regex only matched
--resume, not-r:claude -r <uuid>shows-rin process args, so the UUID was missed entirely. - No title-based disambiguation:
claude -n "name",claude --resume "title"have no UUID — only a title. Without matching against custom titles, detection falls back to cwd matching. claude -r(interactive picker) does NOT update process args: previously assumed args would update to--resume <uuid>after picker selection. Testing confirmed args remainclaude -rwith no UUID or title. This makesclaude -r(picker) equivalent to bareclaudefor detection purposes.
Full same-cwd matrix
Detection layer (purple dot)
| Launch command | Detection method | Needs terminal API? | Terminals |
|---|---|---|---|
claude --resume <uuid> |
UUID from process args | No | All |
claude -r <uuid> |
UUID from process args (-r regex fix) |
No | All |
claude -n "name" |
Match name against session custom titles | No | All |
claude --resume "title" / -r "title" |
Match title against session custom titles | No | All |
claude -r (interactive picker) |
Same as bare claude — args stay claude -r, no UUID |
See below | — |
claude or claude -r (picker), later /rename'd |
Cross-reference (not yet implemented) | Yes (per-tab TTY) | iTerm2 only |
claude or claude -r (picker), never /rename'd |
Unsolvable | — | None |
Switch layer (click → jump to correct tab)
| Launch command | Has custom title? | iTerm2 | Ghostty / cmux |
|---|---|---|---|
Any with /rename |
Yes | Title match ✓ | Title match ✓ |
claude -n "name" |
Yes | Title match ✓ | Title match ✓ |
claude -r "title" |
Yes | Title match ✓ | Title match ✓ |
-r <uuid> without /rename |
No | TTY match ✓ | cwd fallback ✗ |
claude / claude -r (picker), /rename'd + exited + resumed |
Yes | Title match ✓ | Title match ✓ |
claude / claude -r (picker), /rename'd but not exited |
Yes (but detection wrong) | Wrong item clicked | Wrong item clicked |
claude / claude -r (picker), never /rename'd |
No | Unsolvable | ✗ |
Fix (PR #61)
- Regex fix:
/--resume\s+/→/(?:--resume|-r)\s+/ - Title disambiguation:
-n/--name/--resume "title"matched against custom titles - Docs: corrected
claude -rpicker behavior (args do NOT update), full matrix
Remaining unresolved
claude -r(interactive picker) = same as bareclaudefor detectionclaudeorclaude -r+/rename'd but not exited → needs cross-reference (iTerm2 only)claudeorclaude -r+ never/rename'd → unsolvable on all terminals
🤖 On behalf of @grimmerk — generated with Claude Code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels