tmux auto-start menu hung on mosh #123

Closed
opened 2026-04-23 17:45:35 +00:00 by omarz · 2 comments
Member

After a fresh hero_skills install, the tmux auto-start menu hung on mosh (output rendered but keystrokes and Ctrl+C didn't reach the shell), and SSH skipped the menu entirely and dropped into plain bash.

Root cause

  • Mosh hang: the menu ran inline while .bashrc was being sourced, before bash had claimed the controlling TTY. Under mosh's startup timing, read blocked on a TTY the shell didn't yet own, so neither input nor SIGINT could be delivered.
  • SSH skip: SSH login shells read ~/.profile, not ~/.bashrc. The multi_user_add-generated ~/.profile exported env vars but never bridged to .bashrc, so ~/hero/cfg/init.sh (and its tmux block) never loaded on SSH login.

Fix

  • Tmux block (generate_init_sh heredoc): install the menu as a _hero_tmux_menu function registered via PROMPT_COMMAND. Bash fires it once, right before the first prompt, after TTY ownership is complete — so read and signals work under both ssh and mosh. Function
    detaches itself from PROMPT_COMMAND on entry so Ctrl+C falls back to a normal bash prompt instead of re-firing.
  • patch_shell_rc_files: on Linux, append a $BASH_VERSION-guarded . ~/.bashrc to ~/.profile (idempotent — skipped if already bridged). SSH login shells now pick up init.sh the same way mosh does.
After a fresh hero_skills install, the tmux auto-start menu hung on mosh (output rendered but keystrokes and Ctrl+C didn't reach the shell), and SSH skipped the menu entirely and dropped into plain bash. ### Root cause - Mosh hang: the menu ran inline while .bashrc was being sourced, before bash had claimed the controlling TTY. Under mosh's startup timing, read blocked on a TTY the shell didn't yet own, so neither input nor SIGINT could be delivered. - SSH skip: SSH login shells read ~/.profile, not ~/.bashrc. The multi_user_add-generated ~/.profile exported env vars but never bridged to .bashrc, so ~/hero/cfg/init.sh (and its tmux block) never loaded on SSH login. ### Fix - Tmux block (generate_init_sh heredoc): install the menu as a _hero_tmux_menu function registered via PROMPT_COMMAND. Bash fires it once, right before the first prompt, after TTY ownership is complete — so read and signals work under both ssh and mosh. Function detaches itself from PROMPT_COMMAND on entry so Ctrl+C falls back to a normal bash prompt instead of re-firing. - patch_shell_rc_files: on Linux, append a $BASH_VERSION-guarded . ~/.bashrc to ~/.profile (idempotent — skipped if already bridged). SSH login shells now pick up init.sh the same way mosh does.
Author
Member

fix is ready in the pr, but it looks it happens on linux device only. needs to verify first

fix is ready in the pr, but it looks it happens on linux device only. needs to verify first
Author
Member

verified it on another linux machine and the fix worked

verified it on another linux machine and the fix worked
omarz closed this issue 2026-04-26 11:23:01 +00:00
omarz self-assigned this 2026-04-26 11:23:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_skills#123
No description provided.