Remote Claude Code session (desktop app): GitHubPrManager spawns local `gh` with remote cwd → misleading ENOENT
Summary
When working in a remote Claude Code session in the Claude desktop app (the session's working directory lives on a remote host, reached over SSH), the PR/CI panel reports "CI checks unavailable" for every PR. ~/Library/Logs/Claude/main.log shows:
[GitHubPrManager] Failed to get PR state for branch:
Failed to spawn /opt/homebrew/bin/gh: spawn /opt/homebrew/bin/gh ENOENT
The error message blames the binary path, but /opt/homebrew/bin/gh exists, is executable, and is authenticated. The real failure is the cwd option being passed to child_process.spawn.
Root cause
The remote session's working directory is a remote Linux path, e.g.
Working directory: /home/eo/src/airshelf/.claude/worktrees/charming-wing-4298ff
(visible in ~/Library/Logs/Claude/ssh.log for every RemoteProcess spawn).
The desktop-side GitHubPrManager then tries to populate the PR/CI panel by calling child_process.spawn('/opt/homebrew/bin/gh', [...], { cwd: <that remote path>, env, timeout }) — but on the local macOS host. The remote Linux path doesn't exist on the Mac, posix_spawn fails to chdir into it, and Node surfaces the failure as ENOENT on the binary path, which is misleading enough that users (and the bot in #57859) chase the wrong fix (PATH, LSEnvironment, gh auth, code-signing).
Reproducer (no Claude needed)
node -e 'require("child_process").spawn("/opt/homebrew/bin/gh", ["--version"], {cwd: "/path/that/does/not/exist/locally"}).on("error", e => console.log(e.message, e.code))'
# → spawn /opt/homebrew/bin/gh ENOENT ENOENT
Identical error format to the one in main.log.
Suggested fix
Pick one:
- (a) Preferred: for remote sessions, run
ghover SSH against the remote cwd. The remote already has the repo, the branch, and (in this user's case) an authenticatedgh. PR state is naturally repo-local; round-tripping to the local host adds nothing. - (b) Resolve the session cwd to a host-local equivalent before the local spawn — but this only works if the user happens to have the same repo cloned locally at a matching path. Brittle.
- (c) At minimum, detect a non-existent cwd before spawning and surface a clear panel message ("CI checks not available in remote sessions" or "Working directory not found on host") instead of letting the
ENOENTbubble up. This would have saved hours of mis-diagnosis.
Versions
- Claude.app: 1.8089.1
- macOS: 26.x (Apple Silicon)
- Remote host: Linux (Ubuntu), reached via SSH
- gh: 2.92.0 (Homebrew,
/opt/homebrew/bin/gh), keyring-authed
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗