Skip to content

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

@brentestewart

Description

@brentestewart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions