Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): raise Windows ACP/stdio provider probe timeouts #5794

Closeddhiraj-ydv(GitHub profile, opens in a new tab)wants to merge 8 commits intomain fromrefs/pull/5794/headopened View on GitHub

Summary

On Windows, Codex / Cursor / Grok provider status checks were often marked Unavailable because cold CLI starts exceeded the old 8–15s budgets, probes used process.cwd() even when invalid, and non-interactive probes left stdin open (which can hang until timeout).

Claude and OpenCode were less affected because they do not use the same ACP/stdio cold-start path.

Changes

  • Add platform-aware providerProbeTimeouts helpers (Windows vs other)
  • Close stdin after spawn for CLI health probes
  • Use resolveProviderProbeCwd for Codex / Cursor / Grok status probes
  • Docs: docs/windows-provider-timeouts.md

Timeouts (Windows / non-Windows)

ProbeWindowsOther
Version (--version)15s4s
Codex app-server auth45s15s
Cursor agent about45s20s
Cursor ACP discovery45s20s
Grok ACP discovery45s20s

Optional probe cwd overrides: T3_PROVIDER_CWD / T3CODE_PROVIDER_CWD.

Test plan

  • providerProbeTimeouts unit tests pass
  • On Windows with Codex / Cursor / Grok installed: providers show Available after open folder
  • Non-Windows timeouts unchanged for fast paths
  • No regression for Claude / OpenCode provider status

Notes

Observed Cursor cold agent about times of ~7–12s on Windows, which already exceeded the previous 8s budget.


Note

Medium Risk Changes provider health-check timing and spawn behavior for multiple CLIs; non-Windows timeouts also increased slightly (e.g. Cursor about 8s→20s), which can delay “unavailable” reporting but should reduce false negatives on Windows.

Overview Fixes Codex, Cursor, and Grok often showing Unavailable on Windows when cold CLI/ACP probes exceeded short budgets, used a bad working directory, or hung with stdin left open.

Introduces providerProbeTimeouts with platform-aware limits via HostProcessPlatform (e.g. Codex auth 45s / 15s, Cursor agent about and ACP discovery 45s / 20s, version probes 15s / 4s). Claude and other providers wire version checks through the same helpers instead of scattered constants in providerSnapshot.

resolveProviderProbeCwd picks a validated directory (env overrides T3_PROVIDER_CWD / T3CODE_PROVIDER_CWD, host working directory, home, tmp) for Codex/Cursor/Grok spawns instead of process.cwd().

Closes stdin immediately after spawn in shared spawnAndCollect and Cursor runCursorCommand so non-interactive probes do not wait for EOF. Tests and docs/windows-provider-timeouts.md document the behavior.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 162cbd738b0ab4c811f303659a9ec0fa0276ccff. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Raise provider probe timeouts on Windows and fix stdin hangs in CLI probes

  • Introduces platform-aware timeout helpers in providerProbeTimeouts.ts that return longer durations on Windows (e.g. 45s vs 15s) for version, auth, Cursor, and Grok probes.
  • Replaces all hardcoded DEFAULT_TIMEOUT_MS / AUTH_PROBE_TIMEOUT_MS constants with these dynamic values across ClaudeProvider, CodexProvider, CursorProvider, and GrokProvider.
  • Fixes hangs on Windows by closing stdin after spawning child processes in spawnAndCollect and runCursorCommand.
  • Adds resolveProviderProbeCwd to select a usable working directory instead of process.cwd(), which can be inaccessible in some Windows environments.
  • Behavioral Change: probe timeouts are now significantly longer on Windows; test virtual-time advances were updated accordingly.
Macroscope summarized 162cbd7.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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 Plus

      Run ID: bb9422ea-b5ba-4b8d-b6d4-784e48cb3dce

      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

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      This PR fixes Windows provider timeout issues by raising probe timeouts and fixing stdin handling. While the fix is well-scoped to provider probing, the changes affect multiple provider files and core spawn behavior, and the author is new to these files. Human review is recommended to verify the platform-specific behavior changes.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Reviewed against the Effect service conventions. The new probe-timeout module reads platform/env/cwd/fs through process globals instead of the Effect environment the repo already models (HostProcessPlatform, HostProcessEnvironment, HostProcessWorkingDirectory, FileSystem.FileSystem), and a couple of compatibility aliases were introduced instead of updating consumers. Details inline.

      Posted via Macroscope — Effect Service Conventions
      @@ -76,3 +82,6 @@
      7682 Effect.gen(function* () {
      7783 const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
      7884 const child = yield* spawner.spawn(command);
      85+ // Close stdin immediately. Non-interactive probes (`agent about`, `grok --version`,
      86+ // etc.) can hang on Windows if stdin stays open waiting for EOF.
      87+ yield* Stream.run(Stream.empty, child.stdin).pipe(Effect.ignore);
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      This changes backend behavior for every provider probe (stdin is now closed right after spawn, and probes now spawn with a resolved cwd), but the added tests only assert the pure constants and the cwd helper. Consider extending the existing mock-spawner probe tests (e.g. Layers/CursorProvider.test.ts, Layers/GrokAdapter.test.ts) to assert the spawned command's cwd and that stdin is closed, so the fix is covered by a focused test.

      Posted via Macroscope — Effect Service Conventions
      @@ -0,0 +25,21 @@
      25+
      26+/** Cursor `agent about` (version + auth). Measured ~8–12s cold on Windows. */
      27+export const CURSOR_ABOUT_TIMEOUT_MS = isWindows ? 45_000 : 20_000;
      28+
      29+/** Cursor ACP model discovery after about succeeds. */
      30+export const CURSOR_ACP_MODEL_DISCOVERY_TIMEOUT_MS = isWindows ? 45_000 : 20_000;
      31+
      32+/** Grok `agent stdio` ACP initialize for model discovery. */
      33+export const GROK_ACP_MODEL_DISCOVERY_TIMEOUT_MS = isWindows ? 45_000 : 20_000;
      34+
      35+/**
      36+ * Resolve a usable working directory for provider status probes.
      37+ *
      38+ * Electron/desktop backends can end up with a non-directory or inaccessible
      39+ * `process.cwd()` (empty welcome state). Spawning with an invalid cwd on
      40+ * Windows can hang instead of failing cleanly.
      41+ */
      42+export function resolveProviderProbeCwd(
      43+ preferred?: string | null,
      44+ environment: NodeJS.ProcessEnv = process.env,
      45+): string {
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      This helper defaults to process.env, falls back to process.cwd(), and probes directories with blocking NodeFs.statSync, even though the callers already run in an environment that carries FileSystem.FileSystem / Path.Path (see checkCursorProviderStatus's declared requirements) plus HostProcessEnvironment / HostProcessWorkingDirectory. Consider making it an Effect.fn that acquires those from the environment and uses FileSystem.stat, so cwd resolution is testable through the Effect environment rather than process globals and sync fs.

      Posted via Macroscope — Effect Service Conventions
    5. One remaining convention issue in apps/server/src/provider/providerProbeTimeouts.ts: the timeout values now follow HostProcessPlatform (good), but the probe-cwd resolver still reads the working directory straight from process.cwd() instead of the HostProcessWorkingDirectory reference the repo already models. Details inline.

      Posted via Macroscope — Effect Service Conventions
    6. One new item on the Effect-form cwd resolver; the earlier findings about resolveProviderProbeCwdSync doing blocking node:fs I/O and defaulting to process.env inside Effect call sites (which already carry FileSystem.FileSystem / HostProcessEnvironment) are still open — see previously posted comments rather than a repeat here.

      Posted via Macroscope — Effect Service Conventions
    7. Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 39a698deef57fb45bd93be7ad84cc0f9af79e057. Configure [here](https://www.cursor.com/dashboard/bugbot).
    8. One finding: providerProbeTimeouts.ts references Exit without importing it.

      Posted via Macroscope — Effect Service Conventions
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      provider/providerProbeTimeouts.ts

      Exit is used here but never imported in this module (only NodeFs, NodeOs, Effect and the hostProcess members are imported), so this file will not compile. Since the intent is only to tolerate a process.cwd() defect from the reference's defaultValue, Effect.catchDefect expresses that directly without an extra namespace import (and without also absorbing interrupts, which Effect.exit does).

        const workingDirectory = yield* Effect.map(HostProcessWorkingDirectory, (cwd) =>
          cwd.trim().length > 0 ? cwd : undefined,
        ).pipe(Effect.catchDefect(() => Effect.succeed(undefined)));

      No longer relevant as of 8c5f68ebbcc0d98b3eb11719ad07107f78c312f1

    9. Reviewed the new providerProbeTimeouts module and its call sites against the repo's Effect conventions. Two issues in the changed test files: a direct process.platform read and manual Effect.runPromise runners, both of which the repo models through the Effect environment (HostProcessPlatform) and it.effect respectively (and both are enforced by t3code/no-global-process-runtime / t3code/no-manual-effect-runtime-in-tests).

      Posted via Macroscope — Effect Service Conventions
    10. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      We are keeping the provider timeout fix in the open #7232, which prevents a slow probe from marking an installed provider as broken. The measured Windows timing cases from this PR remain useful input for that review.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.