Skip to content

fix(server): bound editor discovery and optimize Windows diagnostics#3874

Open
SivanTechDev wants to merge 2 commits into
pingdotgg:mainfrom
SivanTechDev:fix/windows-process-diagnostics
Open

fix(server): bound editor discovery and optimize Windows diagnostics#3874
SivanTechDev wants to merge 2 commits into
pingdotgg:mainfrom
SivanTechDev:fix/windows-process-diagnostics

Conversation

@SivanTechDev

@SivanTechDev SivanTechDev commented Jul 10, 2026

Copy link
Copy Markdown

What Changed

  • Bound optional editor discovery during server.getConfig to 500 ms.
  • Return no advertised editors when editor discovery exceeds that limit, allowing the rest of config loading to complete safely.
  • Replace the Windows N+1 CIM diagnostics query with two bulk queries joined by process ID.
  • Increase the Windows diagnostics timeout from 1 second to 5 seconds while retaining the 1-second POSIX timeout.
  • Add focused regression tests for bounded config loading and the Windows bulk-query command shape.

Why

Fixes #3610.

On the affected Windows machine, server.getConfig could remain blocked while resolving optional external editors. When the request was interrupted, the client treated the local environment as disconnected, so project history and provider configuration did not load.

Editor discovery is optional and should not block the rest of the server configuration. The 500 ms limit preserves detected editor results when discovery completes promptly. If discovery times out, the server returns an empty editor list rather than advertising an unverified launcher, while allowing the rest of the configuration to load.

Windows process diagnostics also queried Win32_PerfFormattedData_PerfProc_Process once for every process. On the affected machine, that N+1 query shape exceeded the existing timeout. Loading both CIM classes once and joining them by process ID completed in about 866 ms.

The Windows timeout is increased to 5 seconds to leave reasonable headroom for slower hosts. The existing 1-second timeout remains unchanged for POSIX diagnostics.

Validation

  • Typecheck passed.
  • Formatting passed.
  • Focused server.getConfig timeout regression test passed.
  • Focused Windows CIM query regression test passed.
  • Manually verified the empty timeout fallback with the web client on the affected Windows 11 machine.
  • Confirmed that config loading completes and the local environment connects.
  • Electron was not manually tested.

Checklist

  • This PR is small and focused.
  • I explained what changed and why.
  • No UI changes; screenshots are not applicable.
  • No animation or interaction changes; video is not applicable.

Note

Medium Risk
Touches hot paths (server.getConfig and Windows diagnostics) that affect connection UX and process listing; behavior changes are bounded by timeouts and fallbacks rather than altering auth or data persistence.

Overview
Fixes local environments appearing disconnected when optional work blocked server.getConfig on slow Windows hosts.

server.getConfig now caps editor discovery at 500 ms and returns an empty availableEditors list on timeout so the rest of config (environment, auth, providers, etc.) can finish without waiting on resolveAvailableEditors.

Windows process diagnostics no longer run N+1 Get-CimInstance perf queries per process. The PowerShell script loads Win32_PerfFormattedData_PerfProc_Process once into a hashtable, loads Win32_Process once, and joins by process ID. Process query timeouts are per-platform: POSIX stays at 1 s, Windows rises to 5 s via a timeoutMillis parameter on runProcess.

Regression tests cover the Windows bulk CIM script shape and that server.getConfig completes when editor discovery never resolves.

Reviewed by Cursor Bugbot for commit fb9096e. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Bound editor discovery to 500ms timeout and optimize Windows process diagnostics

  • serverGetConfig in ws.ts now times out editor discovery after 500ms and returns an empty availableEditors array instead of blocking indefinitely.
  • Windows process diagnostics in ProcessDiagnostics.ts now fetch Win32_PerfFormattedData_PerfProc_Process once and correlate results in memory via a $perfById hashtable, replacing per-process CIM queries.
  • Platform-specific timeouts are introduced: POSIX process queries use 1s and Windows queries use 5s.
  • Behavioral Change: serverGetConfig callers will now receive availableEditors: [] if discovery does not complete within 500ms.

Macroscope summarized fb9096e.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

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: b513a0f5-87ec-4ef7-a6a8-9e95d8a885bb

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 10, 2026
@macroscopeapp

macroscopeapp Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Performance and robustness improvements with defensive patterns: adds timeouts with safe fallbacks to editor discovery (prevents blocking) and optimizes Windows diagnostics queries. Changes are well-tested and limited in scope.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:S 10-29 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.

[Bug]: Windows 0.0.28/nightly local backend appears disconnected; server.getConfig interrupted, 0.0.27 works

1 participant