(Filing here as moshi-hooks is archived and homebrew-moshi has issues disabled — happy to move this wherever you prefer.)
Environment: moshi-hook 0.2.63 (brew), macOS 15 (arm64), iOS app with Pro, mosh + SSH sessions.
Summary
Remote tmux session detection (moshi-hook context --ssh-connection/--mosh-port) only detects tmux when the server runs on the literal default socket /tmp/tmux-<uid>/default. Two common setups break it:
- Custom socket (
tmux -L name or tmux -S /path/sock)
TMUX_TMPDIR relocation (still default-socket semantics, different directory — a common macOS setup because /private/tmp gets periodically cleaned)
In both cases context falls back to the login shell:
$ moshi-hook context --mosh-port 60001 # session IS attached to tmux (custom socket)
{
"kind": "shell",
"cwd": "/Users/sean"
}
Consequence: the diff viewer button stays greyed out for any tmux user with a non-stock socket (cwd resolves to the login shell's ~, which isn't a git repo), while plain no-tmux shells work fine. Everything else (pairing, tmux picker, gateway) works with custom sockets, so the greyed diff button looks like a client bug rather than a socket-path issue — took a while to pin down.
Migrating our servers to the true default socket fixed detection completely, confirming by elimination.
Suggested fixes (any one would do)
- Resolve the socket from the attached tmux client process argv (
-S/-L are visible under the session's process tree), or from $TMUX of any pane process
- Honor
TMUX_TMPDIR when probing the default socket
- Or an env override on the daemon, e.g.
MOSHI_TMUX_SOCKET, analogous to the existing MOSHI_HERDR_PATH
Related packaging note
The brew service plist ships no PATH in EnvironmentVariables, so the daemon runs with the bare system PATH — on a stock homebrew-tmux Mac the daemon itself can't find tmux for its gateway/capture spawns until the user hand-patches the plist (which brew services restart reverts). Consider baking a sane PATH into the formula's service block.
Happy to test builds — the app is excellent, this was the one rough edge.
(Filing here as moshi-hooks is archived and homebrew-moshi has issues disabled — happy to move this wherever you prefer.)
Environment: moshi-hook 0.2.63 (brew), macOS 15 (arm64), iOS app with Pro, mosh + SSH sessions.
Summary
Remote tmux session detection (
moshi-hook context --ssh-connection/--mosh-port) only detects tmux when the server runs on the literal default socket/tmp/tmux-<uid>/default. Two common setups break it:tmux -L nameortmux -S /path/sock)TMUX_TMPDIRrelocation (still default-socket semantics, different directory — a common macOS setup because/private/tmpgets periodically cleaned)In both cases
contextfalls back to the login shell:Consequence: the diff viewer button stays greyed out for any tmux user with a non-stock socket (cwd resolves to the login shell's
~, which isn't a git repo), while plain no-tmux shells work fine. Everything else (pairing, tmux picker, gateway) works with custom sockets, so the greyed diff button looks like a client bug rather than a socket-path issue — took a while to pin down.Migrating our servers to the true default socket fixed detection completely, confirming by elimination.
Suggested fixes (any one would do)
-S/-Lare visible under the session's process tree), or from$TMUXof any pane processTMUX_TMPDIRwhen probing the default socketMOSHI_TMUX_SOCKET, analogous to the existingMOSHI_HERDR_PATHRelated packaging note
The brew service plist ships no
PATHinEnvironmentVariables, so the daemon runs with the bare system PATH — on a stock homebrew-tmux Mac the daemon itself can't findtmuxfor its gateway/capture spawns until the user hand-patches the plist (whichbrew services restartreverts). Consider baking a sane PATH into the formula's service block.Happy to test builds — the app is excellent, this was the one rough edge.