Skip to content

fix(tnotify): write to client TTY and survive PTY destruction - #8

Merged
inkatze merged 2 commits into
mainfrom
fix/tnotify-reliability
Apr 10, 2026
Merged

fix(tnotify): write to client TTY and survive PTY destruction#8
inkatze merged 2 commits into
mainfrom
fix/tnotify-reliability

Conversation

@inkatze

@inkatze inkatze commented Apr 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • tnotify: Write raw OSC 99 directly to the tmux client TTY (#{client_tty}) instead of DCS passthrough to /dev/tty, so notification delivery isn't tied to the pane that spawned the watcher
  • tnotify-watch: Add HUP to the signal cleanup handler so the PID file is removed if the watcher receives SIGHUP
  • config.fish: Start the watcher with nohup to survive PTY destruction

Context

Notifications would stop delivering over SSH and then burst all at once when opening a new tmux pane. Root cause: the watcher process died from SIGHUP (when its originating pane's PTY was destroyed), left a stale PID file, and notifications queued up until a new pane triggered a watcher restart.

Test plan

  • Run Ansible to propagate fish config to remote machine
  • Kill existing tnotify-watch process and remove ~/.cache/tnotify.pid
  • Open a new tmux pane to start the updated watcher
  • Verify Claude Code notifications arrive promptly over SSH
  • Close the originating pane and confirm notifications continue working from other panes

The tnotify watcher would silently die (SIGHUP on PTY destruction) and
leave a stale PID file, causing notifications to queue up until a new
pane was opened. Three changes:

- tnotify: write raw OSC 99 to the tmux client TTY instead of DCS
  passthrough to /dev/tty, decoupling delivery from the originating pane
- tnotify-watch: add HUP to the signal cleanup handler
- config.fish: start the watcher with nohup to survive PTY destruction

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Improves reliability of tnotify/tnotify-watch notifications in tmux-over-SSH by decoupling notification delivery from the originating pane鈥檚 PTY and tightening watcher lifecycle handling.

Changes:

  • Update tnotify to write the raw OSC 99 escape sequence directly to a tmux client TTY (#{client_tty}) instead of using tmux DCS passthrough to /dev/tty.
  • Add SIGHUP handling to the tnotify-watch cleanup handler so stale PID files get removed on HUP-driven exits.
  • Start the watcher via nohup from config.fish so it survives PTY destruction.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
roles/fish/files/fish/functions/tnotify.fish Redirect notification escape output to a tmux client TTY instead of pane /dev/tty passthrough.
roles/fish/files/fish/functions/tnotify-watch.fish Ensure PID cleanup runs on SIGHUP in addition to INT/TERM/process-exit.
roles/fish/files/fish/config.fish Launch watcher under nohup to avoid SIGHUP termination when the spawning PTY disappears.

馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread roles/fish/files/fish/functions/tnotify.fish
Comment thread roles/fish/files/fish/functions/tnotify.fish

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread roles/fish/files/fish/functions/tnotify-watch.fish Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@inkatze
inkatze marked this pull request as ready for review April 10, 2026 21:18
@inkatze
inkatze merged commit 15843c0 into main Apr 10, 2026
12 of 14 checks passed
@inkatze
inkatze deleted the fix/tnotify-reliability branch April 10, 2026 21:18
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.

2 participants