Skip to content

fix(windows): avoid ENAMETOOLONG in Claude reviews#68

Open
rei-okawara-portx wants to merge 4 commits into
sendbird:mainfrom
portx-sora-step4:codex/windows-stdin-prompt
Open

fix(windows): avoid ENAMETOOLONG in Claude reviews#68
rei-okawara-portx wants to merge 4 commits into
sendbird:mainfrom
portx-sora-step4:codex/windows-stdin-prompt

Conversation

@rei-okawara-portx

@rei-okawara-portx rei-okawara-portx commented Jul 13, 2026

Copy link
Copy Markdown

Background

cc:review can inline up to 64 KiB of working-tree context. The Claude CLI wrapper previously placed that entire prompt in spawn() argv, which exceeds the Windows process command-line limit before Claude starts.

Problem

  • Large reviews fail with spawn ENAMETOOLONG on Windows.
  • Calling the npm claude shim directly is unreliable from Node on Windows because PATH normally resolves to a .cmd wrapper.
  • The previous native executable lookup assumed the default home-based npm prefix and missed relocated APPDATA, custom npm prefixes, and PATH-selected installations.

Solution

  • Keep CLI options in argv and send the prompt through Claude Code's documented non-interactive stdin input.
  • Record stdin pipe failures and fail the job closed instead of reporting a review without a delivered prompt.
  • Resolve the native Windows claude.exe in this order:
    1. CC_PLUGIN_CODEX_CLAUDE_BIN
    2. native claude.exe shims directly present in PATH
    3. npm prefixes present in PATH
    4. npm_config_prefix
    5. APPDATA\\npm
    6. the standard home npm prefix
    7. normal claude command lookup
  • Deduplicate Windows search roots case-insensitively.
  • Add unit, integration, and E2E coverage for stdin prompt delivery and binary discovery.

Verification

  • npm run test:cross-platform: 260 passed, 0 failed
  • node --test tests/claude-cli.test.mjs: 92 passed, 0 failed
  • npm run lint: passed
  • npm run typecheck: passed
  • npm run check:version-sync: passed
  • npm run check:changelog: passed
  • git diff --check: passed
  • Claude Code 2.1.170 completed a real 41,922-byte working-tree review with job status completed, phase done, and no job error.
  • A final installed-cache smoke task returned exactly OK with exit code 0.
  • Standard and adversarial Claude reviews were run. The adversarial review identified an unnecessary --input-format text compatibility risk; that flag was removed because text is already the documented default.

Scope / out of scope

  • No shell invocation was introduced.
  • No prompt temp files or environment-variable transport were introduced.
  • Review sandbox/tool policy and tracked-job behavior are unchanged.
  • Migrating the wrapper to the Agent SDK is intentionally out of scope; it would require redesigning auth, session, sandbox, and job control for no benefit to the one-shot prompt transport.

Remaining risks

  • The local full npm test command still includes existing platform-specific tests that assume POSIX bash, /proc, or executable test shims and is not green on native Windows. The repository's cross-platform suite is green.
  • Local Claude Code reported that srt-win.exe was unavailable and disabled its OS sandbox. Standard review still exposed no Bash, Write, or Edit tools; fixing the sandbox runtime distribution is a separate issue from prompt transport.

@rei-okawara-portx rei-okawara-portx marked this pull request as ready for review July 13, 2026 02:18
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