Skip to content

Conversation

@youngmrz
Copy link
Contributor

Summary

  • Fix for Windows paths with spaces in Claude CLI scanner
  • Fix test: prevent infinite timer loop in requestAnimationFrame mock

Supersedes #1156 (which had CI issues)

Test plan

  • CI tests pass on all platforms

🤖 Generated with Claude Code

youngmrz and others added 5 commits January 17, 2026 17:32
Two fixes for issue AndyMik90#1050:

1. Skip extensionless paths from `where claude` results on Windows.
   These stubs are not directly executable and cause ENOENT errors.
   Only validate .cmd, .exe, and .bat files.

2. Use `chcp 65001` to set UTF-8 code page before running cmd.exe.
   This prevents garbled error messages when validating CLI paths
   that contain spaces or special characters.

Fixes AndyMik90#1050

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…here

Apply the same fix to windows-paths.ts utility functions:
- findWindowsExecutableViaWhere (sync)
- findWindowsExecutableViaWhereAsync (async)

Previously these functions would fall back to extensionless paths
(e.g., `paths[0]`) if no .cmd/.exe/.bat was found first. Now they
strictly filter to only return valid Windows executable extensions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Apply the same chcp 65001 fix from claude-code-handlers.ts to both
validateClaude and validateClaudeAsync in cli-tool-manager.ts.

This ensures error messages are correctly encoded in UTF-8 on Windows
when validating CLI paths through any code path (initial setup,
settings panel, sidebar click).

Addresses Sentry feedback about inconsistent UTF-8 handling.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The /s flag only strips outer quotes when the command starts with a
quote character. Since we prepend 'chcp 65001 >nul && ', the command
no longer starts with a quote, so the ""path"" pattern would result
in unbalanced quotes.

Use simple double-quote wrapping ("path") which works correctly
when the command doesn't rely on /s quote stripping.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: youngmrz <[email protected]>
Changes:
- Use proper quoting for paths in shell-escape utility functions
- Fix test: prevent infinite timer loop in requestAnimationFrame mock

The requestAnimationFrame mock was using setTimeout(callback, 0) which
caused vi.runAllTimersAsync() to enter an infinite loop. Changed to
return a unique ID without scheduling timers.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: youngmrz <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Warning

Rate limit exceeded

@youngmrz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 51 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7cb9e0a and f55902d.

📒 Files selected for processing (4)
  • apps/frontend/src/__tests__/integration/terminal-copy-paste.test.ts
  • apps/frontend/src/main/cli-tool-manager.ts
  • apps/frontend/src/main/ipc-handlers/claude-code-handlers.ts
  • apps/frontend/src/main/utils/windows-paths.ts

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @youngmrz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the Claude CLI integration on Windows by addressing issues related to path handling and command execution encoding. Additionally, it resolves a critical testing problem by refining timer mocks in frontend integration tests, ensuring stable and reliable test execution.

Highlights

  • Improved Windows CLI Path Handling: The Claude CLI scanner on Windows now correctly handles paths containing spaces and ensures proper UTF-8 encoding for command execution, preventing garbled error messages. This is achieved by prepending chcp 65001 to commands executed via cmd.exe.
  • Refined Executable Detection on Windows: The where command results on Windows are now filtered to specifically identify and use only executable files (ending in .cmd, .exe, or .bat), avoiding issues with non-executable paths that could cause ENOENT errors.
  • Fixed Test Timer Loop: An integration test for terminal copy/paste was updated to prevent an infinite timer loop by correctly mocking requestAnimationFrame using vi.useFakeTimers() and a custom mock that returns an ID without scheduling real timers. Asynchronous operations now use vi.runAllTimersAsync() for controlled timer advancement.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two important fixes. First, it correctly handles Windows paths with spaces when scanning for and executing the Claude CLI. This is achieved by adjusting the command line for cmd.exe and making the path discovery logic more robust by filtering for executable file extensions. Second, it resolves an infinite loop in the terminal copy/paste integration tests by properly mocking requestAnimationFrame and using vitest's fake timers. The changes are well-implemented and improve both the application's stability on Windows and the reliability of the test suite. I have one minor suggestion to improve the robustness of parsing command output on Windows.

try {
if (isWindows) {
const result = await execFileAsync('where', ['claude'], { timeout: 5000 });
const paths = result.stdout.trim().split('\n').filter(p => p.trim());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better robustness, it's recommended to split the output of the where command using a regular expression that handles both Windows (\r\n) and Unix-style (\n) line endings. While the current implementation with split('\n') and trim() in the loop might work in most cases, using split(/\r?\n/) is safer and more explicit. This also makes the code consistent with how where output is parsed in apps/frontend/src/main/utils/windows-paths.ts.

Suggested change
const paths = result.stdout.trim().split('\n').filter(p => p.trim());
const paths = result.stdout.trim().split(/\r?\n/).filter(p => p.trim());

@youngmrz
Copy link
Contributor Author

Reinstating original PR #1156

@youngmrz youngmrz closed this Jan 18, 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.

1 participant