warp-notify.sh fails silently: /dev/tty not accessible from Claude Code hook subprocesses

Open Beginner friendly
#43 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
macos, shell
Domain
cli

Research direction

Inspect warp-notify.sh, focusing on the existing printf to /dev/tty used by the hook notifications. Reproduce a PermissionRequest or Stop event on macOS, then verify that the process-tree TTY lookup delivers the OSC 777 notification while retaining the fallback when no writable TTY is found.

Written by the indexing model from the issue text.

Description

Summary

The warp-notify.sh script writes OSC 777 escape sequences to /dev/tty, but Claude Code runs hook scripts in subprocesses that are detached from the controlling terminal. This causes a silent failure (/dev/tty: Device not configured), meaning no notifications are ever delivered despite the plugin being correctly installed and enabled.

Steps to Reproduce

  1. Install the plugin: /plugin install warp@claude-code-warp
  2. Trigger a PermissionRequest or Stop hook event in Claude Code
  3. No Warp notification appears

Root Cause

Claude Code spawns hook scripts in a subprocess context where /dev/tty is not accessible (ENXIO — device not configured). The script's fallback || true suppresses the error, so nothing is logged and the notification silently fails.

The hooks are invoked correctly — verified by adding temporary file logging. The failure is specifically in the printf ... > /dev/tty call inside warp-notify.sh.

Fix

Walk up the process tree from the hook script to find the first ancestor that has a writable TTY, then write the OSC sequence directly to that TTY device (e.g. /dev/ttys006):

FOUND_TTY=""
CHECK_PID=$$
for _ in 1 2 3 4 5; do
    CHECK_PID=$(ps -o ppid= -p "$CHECK_PID" 2>/dev/null | tr -d ' ')
    [ -z "$CHECK_PID" ] && break
    CANDIDATE=$(ps -o tty= -p "$CHECK_PID" 2>/dev/null | tr -d ' ')
    if [ -n "$CANDIDATE" ] && [ "$CANDIDATE" != "??" ] && [ -w "/dev/$CANDIDATE" ]; then
        FOUND_TTY="/dev/$CANDIDATE"
        break
    fi
done

if [ -n "$FOUND_TTY" ]; then
    printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY" > "$FOUND_TTY"
else
    printf '\033]777;notify;%s;%s\007' "$TITLE" "$BODY" > /dev/tty 2>/dev/null || true
fi

This replacement for the existing printf ... > /dev/tty line in warp-notify.sh fixes all hook notification types on macOS. The original /dev/tty fallback is retained for cases where the process tree walk doesn't find a TTY.

Environment

  • macOS 15.4 (Darwin 25.4.0)
  • Warp v0.2026.05.06.15.42.stable_04
  • Claude Code with plugin warp@claude-code-warp v2.0.0
Dominant language
Shell
Stars
231
Forks
56
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from warpdotdev/claude-code-warp

All issues in warpdotdev/claude-code-warp

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.