Skip to content

Fix hook writing wrong session prefix under grouped tmux sessions#82

Open
mikasam1 wants to merge 1 commit into
six-ddc:mainfrom
mikasam1:fix/grouped-session-hook-prefix
Open

Fix hook writing wrong session prefix under grouped tmux sessions#82
mikasam1 wants to merge 1 commit into
six-ddc:mainfrom
mikasam1:fix/grouped-session-hook-prefix

Conversation

@mikasam1
Copy link
Copy Markdown

When a user attaches to the ccbot tmux session via a grouped session (e.g. tmux new -t ccbot -s view-A for independent client focus) and then starts claude inside a window, the SessionStart hook captures the grouped session name ("view-A") from tmux display-message instead of the canonical name from config ("ccbot").

The resulting session_map key looks like view-A:@3 instead of ccbot:@3. Session_monitor's _load_current_session_map filters keys with startswith("ccbot:") and silently drops all view-prefixed entries. Result: recv-direction forwarding (JSONL -> Telegram) never works for any session started this way, while send-direction (tmux send-keys) still works — which is especially confusing to debug.

Since grouped sessions share the same window set in tmux, window_id is unambiguous across all views. Always writing the canonical prefix (from TMUX_SESSION_NAME env / config.tmux_session_name) correctly identifies the window regardless of which view triggered the hook.

When a user attaches to the ccbot tmux session via a grouped session
(e.g. `tmux new -t ccbot -s view-A` for independent client focus) and
then starts claude inside a window, the SessionStart hook captures the
grouped session name ("view-A") from `tmux display-message` instead of
the canonical name from config ("ccbot").

The resulting session_map key looks like `view-A:@3` instead of
`ccbot:@3`. Session_monitor's `_load_current_session_map` filters keys
with `startswith("ccbot:")` and silently drops all view-prefixed
entries. Result: recv-direction forwarding (JSONL -> Telegram) never
works for any session started this way, while send-direction (tmux
send-keys) still works — which is especially confusing to debug.

Since grouped sessions share the same window set in tmux, window_id is
unambiguous across all views. Always writing the canonical prefix
(from TMUX_SESSION_NAME env / config.tmux_session_name) correctly
identifies the window regardless of which view triggered the hook.
Copy link
Copy Markdown
Author

@mikasam1 mikasam1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant