Skip to content

fix(server): treat slow az --version as present, not missing (#4) - #10

Merged
radroid merged 2 commits into
mainfrom
t3x/fix-azure-devops-probe-timeout
Jul 25, 2026
Merged

fix(server): treat slow az --version as present, not missing (#4)#10
radroid merged 2 commits into
mainfrom
t3x/fix-azure-devops-probe-timeout

Conversation

@radroid

@radroid radroid commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #4. On Windows the Azure DevOps connector reported "not available" with the install az hint even when the Azure CLI was installed, on PATH, and authenticated.

Root cause: the source-control discovery probe hard-coded a 5s timeout on az --version and its catch-all mapped every failure — including a VcsProcessTimeoutError — to status: "missing", which rendered the install hint and short-circuited the fast (~1s) az account show auth check. az --version on Windows routinely takes 6–8s (Python startup + the Azure CLI "updates available" check), so a present-but-slow CLI was misclassified as missing.

Changes (apps/server/src/sourceControl/SourceControlProviderDiscovery.ts)

  1. Raise the probe budget: replace the three hard-coded timeoutMs: 5_000 values with a named CLI_PROBE_TIMEOUT_MS = 15_000 (well above the observed 6–8s tail; still below the module's 30s default).
  2. Distinguish timeout from missing: probeCli's error handler now branches on the cause tag — only VcsProcessSpawnError (ENOENT / genuine spawn failure) → status: "missing" + install hint. A timeout (or any other runtime failure) → status: "available", so probeSourceControlProvider still runs the fast az account show auth probe instead of short-circuiting.

No contract change — SourceControlDiscoveryStatus stays "available" | "missing"; a slow-but-present CLI resolves through the existing "available" + auth path, which the desktop Settings UI already renders as "Authenticated as …".

Tests (new SourceControlProviderDiscovery.test.ts)

TDD — written to fail first, then made green. Drives the exported probeSourceControlProvider with a capturing mock VcsProcess:

  • --version times out + auth succeeds → available + authenticated, and the az account show probe actually runs. (red before fix)
  • --version spawn error (ENOENT) → missing + unknown, auth probe not attempted. (regression guard)
  • Happy path → --version probe timeoutMs >= 15000, version parsed, available + authenticated. (red before fix)
  • --version times out + account show exits non-zero → available + unauthenticated.

Verification

  • vp test run src/sourceControl/13 files / 94 tests pass
  • tsgo --noEmit → clean (exit 0)
  • vp fmt --check + lint on changed files → clean

🤖 Generated with Claude Code

The source-control discovery probe hard-capped the CLI version probe at
5s and mapped every failure — including a timeout — to `status: "missing"`,
which rendered the "install az" hint and skipped the fast auth check. On
Windows `az --version` routinely takes 6-8s (Python startup + the Azure CLI
"updates available" check), so an installed, authenticated Azure CLI was
reported "not available".

- Raise the discovery CLI probe timeout from 5s to 15s (CLI_PROBE_TIMEOUT_MS).
- Branch probeCli's error handler on the cause tag: only VcsProcessSpawnError
  (ENOENT) => "missing" + install hint. A timeout (or other runtime failure)
  => "available", so probeSourceControlProvider still runs the fast
  `az account show` auth probe instead of short-circuiting.

Adds SourceControlProviderDiscovery.test.ts covering: timeout => available +
auth runs, spawn error => missing + auth skipped, the raised timeout, and
timeout + unauthenticated.

Fixes #4

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 25, 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e42ab158-a25d-42df-a571-d49fc8ed4983

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
  • Commit unit tests in branch t3x/fix-azure-devops-probe-timeout

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.

Address review nit: the "all non-spawn errors => available" branch was
only exercised via VcsProcessTimeoutError. Add a case where `--version`
fails with a non-zero exit (VcsProcessExitError) and assert the provider
stays available and the auth probe still runs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@radroid
radroid merged commit 7333fdf into main Jul 25, 2026
1 check passed
@radroid
radroid deleted the t3x/fix-azure-devops-probe-timeout branch July 30, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Azure DevOps source control shows "not available" on Windows because the 5s CLI probe times out on slow az --version (misclassified as missing)

1 participant