Skip to content

Detect Bun-bundled claude.exe (claude-code v2.x)#4

Open
changsu-jin wants to merge 1 commit intodevmegablaster:mainfrom
changsu-jin:fix/claude-exe-detection
Open

Detect Bun-bundled claude.exe (claude-code v2.x)#4
changsu-jin wants to merge 1 commit intodevmegablaster:mainfrom
changsu-jin:fix/claude-exe-detection

Conversation

@changsu-jin
Copy link
Copy Markdown

Problem

The Sessions panel shows "No active Claude sessions" even when multiple
claude processes are running and writing to JSONL transcripts.

Root cause

claude-code v2.x ships a Bun-bundled native macOS binary named
claude.exe (installed at
<node_modules>/@anthropic-ai/claude-code/bin/claude.exe). The current
process matcher in liveClaudeCwdCounts() checks for
name == "claude" and exePath.hasSuffix("/claude") /
"/bin/claude", none of which match claude.exe. Result:
liveCwdCounts is always empty, the per-cwd capacity gate in
loadSessions rejects every candidate, and the SESSIONS panel stays
empty.

You can reproduce by checking:

  • proc_name(pid) returns claude.exe for v2.x processes
  • proc_pidpath(pid) resolves through the Node shim symlink to
    /.../@anthropic-ai/claude-code/bin/claude.exe
  • lsof -p <pid> shows the binary as claude.ex (truncated 9-char
    COMMAND) and txt mapped to claude.exe

Fix

Extend the matcher in Sources/NotchPilot/ClaudeMonitor.swift to
recognize:

  • name == "claude.exe" (proc_name returns claude.exe for the Bun
    binary)
  • exePath containing /@anthropic-ai/claude-code/ (most robust —
    package path)
  • exePath ending in /claude.exe or /bin/claude.exe

Existing string-based matches are retained for backward compatibility
with older Node-shim installs.

Verification

  • macOS 26.4.1 / M5 Pro / claude-code 2.1.128
  • Before: SESSIONS panel "No active Claude sessions" with >10 live
    claude PIDs across multiple cwds.
  • After local build (./scripts/build.sh): live sessions appear
    correctly in the panel; liveCwdCounts populates with the right
    cwd → PID mappings (verified by cross-checking lsof -p <pid> cwd
    output against the panel).

claude-code v2.x ships a Bun-bundled native macOS binary named
`claude.exe` under `<node_modules>/@anthropic-ai/claude-code/bin/`.
The matcher in `liveClaudeCwdCounts()` only recognized `claude` /
`/bin/claude`, so on machines using v2.x `liveCwdCounts` was always
empty, the per-cwd capacity gate in `loadSessions` rejected every
candidate, and the SESSIONS panel stayed empty even with multiple
live `claude` processes writing to JSONL transcripts.

Extend the matcher to also accept `claude.exe` proc names, the
`/@anthropic-ai/claude-code/` package path, and `*/claude.exe` /
`*/bin/claude.exe` exec paths. Existing matches are kept so older
Node-shim installs still work.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant