fix(server): handle localized Windows provider probe output#1895
fix(server): handle localized Windows provider probe output#1895raulpesilva wants to merge 8 commits intopingdotgg:mainfrom
Conversation
Decode Windows provider probe output correctly and recognize localized command-not-found errors so Codex and Claude status checks stop surfacing garbled messages in settings.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Extract the unresolved registry read helper in the catalog test so the linter no longer flags the fallback function as unnecessarily re-created inside the test case.
Accumulate provider probe output before decoding so Windows UTF-16LE streams stay intact even when chunk boundaries split code units across odd-sized buffers.
Only apply trailing backslash escaping when a provider command argument actually needs quoting so plain Windows paths keep their original value.
ApprovabilityVerdict: Needs human review This PR changes runtime behavior on Windows by modifying how provider commands are spawned (new shell quoting approach) and how process output is decoded (UTF-16LE heuristic detection). While the fix for localized error messages is well-tested and scoped, the changes to command execution and output decoding patterns affect core provider functionality and warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Require an even-length buffer and at least one matching zero byte before decoding Windows provider output as UTF-16LE so short UTF-8 responses remain intact.
|
Maybe this PR ended up a bit larger than ideal, but I think the changes are still clear and easy to follow. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 19a503a. Configure here.
Use the existing case-insensitive Windows command-not-found regexes directly instead of lowercasing output first.
Run Windows provider probes through a shell command string so custom binary paths containing spaces are quoted the way cmd.exe expects.

What Changed
codexandclaudeso localized shell output is decoded correctly instead of showing garbled accented characters in Settings.cmd.exeoutput consistently.Why
The Settings screen was rendering broken accented characters on Windows because localized
cmd.exeoutput was being decoded incorrectly by the server before it reached the UI.This also caused a second issue: when
codexorclaudewere missing fromPATH, the server could misclassify them as installed but failing to run because the "command not found" check only matched English output. Fixing this at the subprocess boundary keeps the UI simple, makes provider checks more reliable, and ensures the correct status/message is shown across localized Windows environments.UI Changes
before:


after:
Checklist
Note
Medium Risk
Changes how provider CLI probes are spawned/quoted on Windows and how their stdout/stderr is decoded, which can affect provider availability/status detection across platforms. Risk is mitigated by added unit/integration coverage for Windows-specific behaviors and localized error messages.
Overview
Fixes Windows provider health checks to correctly handle localized
cmd.exeoutput and missing-CLI detection.On Windows, provider probes now build commands via
makeProviderCommand(shell + robust argument quoting for paths with spaces) andcollectStreamAsStringnow buffers raw bytes and decodes as UTF-16LE when appropriate, preventing garbled Unicode output.isWindowsCommandNotFoundis expanded to match multiple localized "command not found" patterns so missingcodex/claudeare reported as not installed instead of installed but failed.Adds regression tests for UTF-16LE chunk-boundary decoding, Windows shell quoting, localized missing-command stderr handling in provider status checks, and a small test helper cleanup in the web environment catalog tests.
Reviewed by Cursor Bugbot for commit 1e1a9e7. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix Windows provider probe to detect localized 'command not found' stderr output
isWindowsCommandNotFoundin processRunner.ts to match localized error messages (e.g. Portuguese) using a set of regex patterns instead of a single English string.collectStreamAsStringin providerSnapshot.ts to accumulate rawUint8Arraychunks before decoding, enabling correct UTF-16LE decoding of Windows process output across arbitrary chunk boundaries.quoteWindowsShellArgumentand updatesmakeProviderCommandto wrap paths with spaces in quotes and setshell: trueon Windows, replacing directChildProcess.makecalls inClaudeProviderandCodexProvider.Macroscope summarized 1e1a9e7.