mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-21 16:02:20 +00:00
tty7 injects shell integration into the shell it launches for a pane, and only that one. A shell the user starts by hand afterwards -- `zsh` typed at a bash prompt -- is a new process nobody injected into, so it emits no OSC 7 and no OSC 133, and the pane keeps showing whatever directory the outer shell reported last. On a local machine that is invisible, because oh-my-zsh reports OSC 7 itself from lib/termsupport.zsh. Over SSH it is not: that file returns early when SSH_CLIENT or SSH_TTY is set, which sshd always sets, so on a remote host neither oh-my-zsh nor tty7 reports the directory of a hand-started zsh. That combination is the whole of #698, and it is why the reporter sees it work over SSH under bash and stop under zsh. Documented in two places: a "Shells you start yourself" section in the shell integration reference, and a troubleshooting entry that names the symptom the way a user would ("the directory stopped following my shell"). Both give the two remedies -- `chsh -s /bin/zsh` on the remote host, which is what moves the integration into the shell tty7 bootstraps, and, when the login shell cannot be changed, a four-line precmd hook that reports OSC 7 by hand. The entry also says why a login script or `exec zsh` from .bashrc is not a fix: both run after (or instead of) the shell tty7 set up. The same pages now describe the process-inspection fallback honestly. It was one parenthetical -- "tty7 falls back to inspecting the process" -- which overpromises: it exists only where the daemon can see the pane's processes, so a local macOS/Linux pane or a remote-workspace pane gets it and an SSH pane or a Windows pane does not, and it is a poll driven by pane output at most twice a second, not a report, so it trails a `cd`. That poll is the mechanism behind the issue's second, unconfirmed half: with tty7-server on the remote host the daemon is on that host, so a nested zsh's cwd does get picked up out of /proc -- late, and only when the pane writes something. Deliberately no code. Propagating the integration into a shell the user starts by hand would mean exporting ZDOTDIR (or rewriting the user's startup files) from every pane, which leaks into every zsh in the session including scripts, and the remote bootstrap deletes its throwaway ZDOTDIR at the first prompt precisely because an SSH session has no reliable exit hook -- a directory that outlives its deletion is exactly what would break a nested shell rather than help it. Tightening the cwd poll for uninstrumented panes is a real possibility, but it is a Linux-only daemon path that cannot be exercised from here, for a symptom nobody has yet reproduced; the mechanism is written down instead. Claude-Session: https://claude.ai/code/session_01UUyWQXzcBAoBzaSX8pc7nU