Skip to content

Conversation

@gunpal5
Copy link

@gunpal5 gunpal5 commented Jun 23, 2025

fix: Claude Code provider for windows system. some of the changes might also be useful for non-windows systems as well.
closes: #5042


Important

Adds Windows support for Claude Code using WSL with platform-specific handling and tests.

  • Behavior:
    • Adds platform-specific handling in run.ts to support Windows using WSL.
    • Validates systemPrompt and messages in runClaudeCode().
    • Converts Windows paths to WSL paths in runClaudeCodeOnWindows().
    • Handles process errors and cleanup in runClaudeCodeOnWindows() and runClaudeCodeOnNonWindows().
  • Tests:
    • Adds windows-integration.spec.ts to test Windows-specific behavior using WSL.
    • Mocks dependencies like fs, path, os, execa, and readline in tests.
    • Tests error handling and path conversion in Windows environment.
  • Misc:
    • Refactors runProcess() to dispatch to platform-specific functions.
    • Adds cleanup logic for temporary files and processes in run.ts.

This description was created by Ellipsis for 30bf7a9. You can customize this summary. It will automatically update as commits are pushed.

@gunpal5 gunpal5 requested review from cte, jr and mrubens as code owners June 23, 2025 23:14
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jun 23, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 23, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 23, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 23, 2025
@daniel-lxs daniel-lxs force-pushed the claude-code-windows-support branch from 1e982cd to 40ad899 Compare June 24, 2025 16:11
@gunpal5
Copy link
Author

gunpal5 commented Jun 24, 2025

@daniel-lxs Please remember on windows you can only pass 8kb worth of data in command line on windows system.

--disallowedTools takes tool names space separated

https://github.com/RooCodeInc/Roo-Code/blob/40ad8990737f90e1263c21bbbb70077385560641/src/integrations/claude-code/run.ts#L190

@gunpal5
Copy link
Author

gunpal5 commented Jun 25, 2025

@daniel-lxs Let me know if I can help with something here.

@daniel-lxs
Copy link
Member

Thank you @gunpal5 We are testing this PR to make sure it works.

@gunpal5
Copy link
Author

gunpal5 commented Jun 25, 2025

@daniel-lxs Thanks, Please take your time and let me know if any changes required here.

Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

I took a look at the changes and I think they could work, however I am a bit concerned about isolation of the windows-specific workaround since the integration is working quite well on other OSes.

I left a couple of suggestions on how to achieve this, let me know what you think!

Copy link
Member

Choose a reason for hiding this comment

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

The cleanup happens in the finally callback, but if the Node.js process is killed unexpectedly (SIGKILL), this cleanup might not run. Have you considered adding a process exit handler or documenting that users might need to manually clean up the .claude-code-temp directory in such cases?

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 28, 2025
@gunpal5 gunpal5 closed this Jun 29, 2025
@gunpal5 gunpal5 force-pushed the claude-code-windows-support branch from 671f5d8 to b45252d Compare June 29, 2025 18:15
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 29, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Jun 29, 2025
@delve-auditor
Copy link

delve-auditor bot commented Jun 29, 2025

No security or compliance issues detected. Reviewed everything up to 24eb6e4.

Security Overview
  • 🔎 Scanned files: 0 changed file(s)
Detected Code Changes

No code changes detected in this PR.

Reply to this PR with @delve-auditor followed by a description of what change you want and we'll auto-submit a change to this PR to implement it.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 29, 2025
@gunpal5
Copy link
Author

gunpal5 commented Jun 29, 2025

@daniel-lxs I am trying to fix the claude code. claude code is calling weird tools like <claude_read_file> etc.

'I\'ll help you add a new property "Description" to the Source.cs file. Let me first examine the current Source.cs file to understand its structure.\n\n<read>\n<path>NewsAPI/Models/Source.cs</path>\n</read>\n\nNow let me also check the NewsAPI.Net version to ensure consistency:\n\n<read>\n<path>NewsAPI.Net/Models/Source.cs</path>\n</read>\n\nI can see that both Source.cs files have the same structure with Id, Name, and Url properties. I\'ll add the Description property to both files to maintain consistency ac…ription" property to both Source.cs files in the NewsAPI and NewsAPI.Net projects. The new property:\n\n- Is decorated with `[JsonProperty("description")]` to match the JSON naming convention\n- Is of type `string` to store description text\n- Has both getter and setter for full property functionality\n- Maintains consistency with the existing property structure\n\nThe Description property will now be available for use when working with Source objects in both projects.\n</result>\n</attempt_completion>'

@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 30, 2025
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jun 30, 2025
@gunpal5
Copy link
Author

gunpal5 commented Jun 30, 2025

New Modifications, removed the Readme changes

@gunpal5 gunpal5 reopened this Jun 30, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Jun 30, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Jun 30, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jun 30, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 30, 2025
@hannesrudolph hannesrudolph added Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. PR - Needs Preliminary Review and removed PR - Changes Requested Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 30, 2025
@daniel-lxs
Copy link
Member

Looking at this PR, I'm wondering if the temporary file approach is necessary for Windows. Since PR #5186 already handles stdin piping for messages on non-Windows platforms, couldn't we use the same approach through WSL?

The Windows-specific code could potentially be simplified to just prepend 'wsl' to the command while keeping the stdin piping logic. This would eliminate the need for temporary file creation, cleanup handlers, and path conversions.

Also noticed the tool separator was changed from comma to space on line 117 - this affects all platforms, not just Windows. Was this change intentional?

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 30, 2025
@gunpal5
Copy link
Author

gunpal5 commented Jul 1, 2025

I'm wondering if the temporary file approach is necessary for Windows.

I could only find this solution just to match with the older implementation. I was avoiding the drastic changes. We can use stdin instead of temporary files. but still claude code tool calling will be an issue. Claude is not respecting the system prompt. I am not sure why.

Also noticed the tool separator was changed from comma to space on line 117 - this affects all platforms, not just Windows. Was this change intentional?

Official documentation clearly mentions names of Tools should be space separated not comma separated.

https://docs.anthropic.com/en/docs/claude-code/sdk#available-cli-options

@daniel-lxs
Copy link
Member

Thanks for the clarification. Yeah, I think it makes sense to revert the temporary file changes and keep the stdin approach. The tool separator fix looks good.

Let's go with the simpler implementation - just prepending 'wsl' should be sufficient for Windows support.

@gunpal5
Copy link
Author

gunpal5 commented Jul 3, 2025

stdin only support actual input messages, system prompt has to be configured with command line only. Temporary file solution would be still needed for system prompt.

@daniel-lxs
Copy link
Member

The system prompt is set in the command itself, do you mean we need to export the system prompt to a file?

@andrew01234567890
Copy link

Do we have to proxy commands over WSL?

I tested this today and Roo works with claude code over WSL if you use the vscode WSL extension. Install Roo on the WSL side and run your commands, it will work (with some caveats, you need to code . from wsl or the environment is not configured correctly and you'll get an ENOENT error back that claude doesn't exist).

@gunpal5
Copy link
Author

gunpal5 commented Jul 12, 2025

Anthropic has just released native windows support. so I think this fix is not needed anymore.

@gunpal5 gunpal5 closed this Jul 12, 2025
@github-project-automation github-project-automation bot moved this from PR [Changes Requested] to Done in Roo Code Roadmap Jul 12, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 12, 2025
@hannesrudolph
Copy link
Collaborator

Where announcement?

@gunpal5
Copy link
Author

gunpal5 commented Jul 12, 2025

@hannesrudolph they released it silently. I've been using it for like 2 hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Changes Requested size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Claude Code not working on Windows OS ?

4 participants