Skip to content

fix(server): handle localized Windows provider probe output#1895

Open
raulpesilva wants to merge 8 commits intopingdotgg:mainfrom
raulpesilva:feat/localized-windows-output
Open

fix(server): handle localized Windows provider probe output#1895
raulpesilva wants to merge 8 commits intopingdotgg:mainfrom
raulpesilva:feat/localized-windows-output

Conversation

@raulpesilva
Copy link
Copy Markdown

@raulpesilva raulpesilva commented Apr 10, 2026

What Changed

  • Fixed Windows provider health checks for codex and claude so localized shell output is decoded correctly instead of showing garbled accented characters in Settings.
  • Added a shared server-side path for Windows provider probes that handles Unicode cmd.exe output consistently.
  • Expanded Windows "command not found" detection to recognize localized messages, so missing CLIs are reported as unavailable instead of "installed but failed to run."
  • Added regression coverage for localized Windows output and provider status handling.

Why

The Settings screen was rendering broken accented characters on Windows because localized cmd.exe output was being decoded incorrectly by the server before it reached the UI.
This also caused a second issue: when codex or claude were missing from PATH, 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:
image
after:
image

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes

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.exe output and missing-CLI detection.

On Windows, provider probes now build commands via makeProviderCommand (shell + robust argument quoting for paths with spaces) and collectStreamAsString now buffers raw bytes and decodes as UTF-16LE when appropriate, preventing garbled Unicode output. isWindowsCommandNotFound is expanded to match multiple localized "command not found" patterns so missing codex/claude are 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

  • Extends isWindowsCommandNotFound in processRunner.ts to match localized error messages (e.g. Portuguese) using a set of regex patterns instead of a single English string.
  • Rewrites collectStreamAsString in providerSnapshot.ts to accumulate raw Uint8Array chunks before decoding, enabling correct UTF-16LE decoding of Windows process output across arbitrary chunk boundaries.
  • Adds quoteWindowsShellArgument and updates makeProviderCommand to wrap paths with spaces in quotes and set shell: true on Windows, replacing direct ChildProcess.make calls in ClaudeProvider and CodexProvider.
  • Behavioral Change: on Windows, provider probe commands now run via the shell with quoted arguments rather than direct process invocation.

Macroscope summarized 1e1a9e7.

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 10, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1c85b2c2-9302-44f5-8f9f-6a0f01cff13e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 10, 2026
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.
@github-actions github-actions bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 10, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 10, 2026

Approvability

Verdict: 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.
@raulpesilva
Copy link
Copy Markdown
Author

Maybe this PR ended up a bit larger than ideal, but I think the changes are still clear and easy to follow.
Please feel free to close this PR if you'd prefer a smaller split-up version.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

raulpesilva and others added 3 commits April 10, 2026 17:52
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant