Bug Description
When running multiple CCB instances simultaneously (e.g. in separate git worktrees), ask codex silently sends messages to the wrong Codex pane. The command appears to succeed but Codex shows no activity, and the task hangs indefinitely.
Root Cause
All CCB instances use the same hardcoded pane_title_marker: "CCB-Codex" (line 2113, 2399 in ccb). When multiple Codex panes exist, find_pane_by_title_marker() in terminal.py (line 584) returns the first pane whose title starts with the marker -- which may belong to a different CCB instance.
Additionally, stale panes from previous sessions that retain the "CCB-Codex" title can also cause false matches, even in single-instance scenarios.
Steps to Reproduce
- Start CCB in directory A:
cd /path/to/project-a && ccb codex claude
- Start CCB in directory B (e.g. a worktree):
cd /path/to/project-b && ccb codex claude
- In directory B's Claude session, run
/ask codex "create hello.py"
- Expected: Codex in directory B receives the task
- Actual: Message is sent to directory A's Codex pane (or a stale pane), directory B's Codex shows no activity, task hangs
Suggested Fix
Make pane_title_marker unique per project by including the project hash (already computed in __init__):
# Before (ccb line 2113, 2399):
pane_title_marker = "CCB-Codex"
# After:
pane_title_marker = f"CCB-Codex-{self.project_id[:8]}"
This also applies to WezTerm path (line 1256):
# Before:
pane_title_marker = f"CCB-{provider.capitalize()}"
# After:
pane_title_marker = f"CCB-{provider.capitalize()}-{self.project_id[:8]}"
Using project_id[:8] (a hash) is more robust than Path.cwd().name because:
- Git worktrees with the same parent project name would still get unique markers
- Special characters in directory names are avoided
Environment
- CCB version: v5.2.6
- Terminal: tmux
- OS: macOS (Darwin 25.3.0)
Bug Description
When running multiple CCB instances simultaneously (e.g. in separate git worktrees),
ask codexsilently sends messages to the wrong Codex pane. The command appears to succeed but Codex shows no activity, and the task hangs indefinitely.Root Cause
All CCB instances use the same hardcoded
pane_title_marker: "CCB-Codex"(line 2113, 2399 inccb). When multiple Codex panes exist,find_pane_by_title_marker()interminal.py(line 584) returns the first pane whose title starts with the marker -- which may belong to a different CCB instance.Additionally, stale panes from previous sessions that retain the "CCB-Codex" title can also cause false matches, even in single-instance scenarios.
Steps to Reproduce
cd /path/to/project-a && ccb codex claudecd /path/to/project-b && ccb codex claude/ask codex "create hello.py"Suggested Fix
Make
pane_title_markerunique per project by including the project hash (already computed in__init__):This also applies to WezTerm path (line 1256):
Using
project_id[:8](a hash) is more robust thanPath.cwd().namebecause:Environment