Skip to content

Claude Code launches on macOS without kqueue stdin errors - #176

Closed
webdevcody wants to merge 2 commits into
mainfrom
cursor/fix-claude-kqueue-0dc6
Closed

webdevcody wants to merge 2 commits into
mainfrom
cursor/fix-claude-kqueue-0dc6

Conversation

@webdevcody

@webdevcody webdevcody commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This fixes the Claude Code launch regression on macOS by reopening the agent's concrete PTY device instead of the /dev/tty alias after the login-shell rc-file shim runs.

Contents: Bug fix · Proof · Risk · Technical overview

Bug fix

  • Claude gets a watchable stdin - the launch shim now records the pane's concrete tty path before giving the login shell /dev/null, then the launch prelude reopens that saved device for the agent CLI.
  • Iris-style autostarts still stay quiet - rc files continue to run with non-TTY stdin, preserving the Keep rc autostart hooks from swallowing agent launches #130 behavior.
  • No screenshot - this is a PTY/fd launch-path fix with no TUI surface change.
sequenceDiagram
    participant Shim as /bin/sh shim
    participant Shell as login shell rc files
    participant Agent as Claude Code
    Shim->>Shim: NEBULA_PANE_TTY=$(tty)
    Shim->>Shell: exec </dev/null; exec shell -l -i -c ...
    Shell->>Shell: rc files see non-TTY stdin
    Shell->>Agent: exec <"$NEBULA_PANE_TTY"; unset NEBULA_PANE_TTY; claude ...
Loading

Proof

  • Build - cargo build passed.
  • Tests - cargo test passed.
  • Lint - cargo clippy -- -D warnings passed.
  • Regression coverage - the existing Iris autostart e2e test now records the fake Claude stdin device and fails if it is /dev/tty.

Risk

🟢 Low.

Area Rating Why
🔒 Security / production merge Low The temporary env var is internal to the launch wrapper and is unset before the agent command runs.
⚡ Performance Low Adds one tty call during PTY launch only.
🧩 Pattern fit Low Keeps the existing login-shell shim and pane env-restatement pattern.

Rollback: reverting this commit restores the previous /dev/tty reopen behavior and would bring back the macOS Claude/Bun kqueue failure.

Technical overview

  • nebula_core::env now names NEBULA_PANE_TTY beside the other environment constants.
  • crates/nebula-daemon/src/registry.rs captures the PTY path before redirecting stdin to /dev/null, reopens ${NEBULA_PANE_TTY:-/dev/tty} in the launch prelude, and unsets it with the pane color overrides.
  • crates/nebula/tests/e2e_pty.rs extends the existing rc-autostart regression test to assert the CLI sees a TTY whose stdin device is not /dev/tty.

Fixes #166.

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 19, 2026 17:50
Co-authored-by: Web Dev Cody <webdevcody@gmail.com>
Co-authored-by: Web Dev Cody <webdevcody@gmail.com>

Copy link
Copy Markdown
Contributor Author

Closing as superseded by two merged PRs:

This branch now conflicts with main in registry.rs and e2e_pty.rs.


Generated by Claude Code

@webdevcody webdevcody closed this Oct 21, 2026
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