[codex] Structure Azure DevOps CLI failures#3460
Conversation
|
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)
Comment |
f0d056b to
67eff03
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Spawn NotFound mislabels missing cwd
- Added two narrowing conditions (pathOrDescriptor !== context.cwd and syscall !== "chdir") to distinguish a missing az executable from a non-existent working directory, mirroring the pattern used in GitVcsDriverCore.
Or push these changes by commenting:
@cursor push 54a8bbd299
Preview (54a8bbd299)
diff --git a/apps/server/src/sourceControl/AzureDevOpsCli.ts b/apps/server/src/sourceControl/AzureDevOpsCli.ts
--- a/apps/server/src/sourceControl/AzureDevOpsCli.ts
+++ b/apps/server/src/sourceControl/AzureDevOpsCli.ts
@@ -94,7 +94,9 @@
if (
cause._tag === "VcsProcessSpawnError" &&
cause.cause instanceof PlatformError.PlatformError &&
- cause.cause.reason._tag === "NotFound"
+ cause.cause.reason._tag === "NotFound" &&
+ cause.cause.reason.pathOrDescriptor !== context.cwd &&
+ cause.cause.reason.syscall !== "chdir"
) {
return new AzureDevOpsCliUnavailableError(fields);
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 67eff03. Configure here.
ApprovabilityVerdict: Approved This PR refactors Azure DevOps CLI error handling by splitting a generic error class into multiple typed error classes and replacing string-based error detection with structured field checks. The changes are internal to error handling with comprehensive test coverage. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
c883233 to
710f7c4
Compare
710f7c4 to
1aa6361
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
1aa6361 to
5252104
Compare


Summary
AzureDevOpsCliErrordetail field with distinct schema-tagged command and decode failuresValidation
vp test apps/server/src/sourceControl/AzureDevOpsCli.test.ts apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.test.tsvp checkvp run typecheckNote
Medium Risk
Callers that matched on the old single error class must handle the new union tags; classification behavior changes slightly (e.g. chdir NotFound vs missing az).
Overview
Replaces the single
AzureDevOpsCliErrorwith a union of schema-tagged classes (unavailable CLI, authentication, PR not found, generic command failure, and separate decode errors for PR list, PR view, and repository JSON).fromVcsErrornow mapsVcsErrorby structured fields (failureKind, spawnNotFoundwithchdirvs missingaz) instead of parsing error strings. User-facingdetail/messagestay fixed per type; upstream text stays oncause. Command failures gainargumentCount; decode failures gainoutputLength.isAzureDevOpsCliErroris added for the union.Tests assert the new types (including that a missing cwd is not misclassified as missing Azure CLI).
Reviewed by Cursor Bugbot for commit 5252104. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Replace generic Azure DevOps CLI errors with structured typed error classes
AzureDevOpsCliUnavailableError,AzureDevOpsCliAuthenticationError,AzureDevOpsPullRequestNotFoundError,AzureDevOpsCommandFailedError, and decode errors for PRs and repositories) in AzureDevOpsCli.ts, replacing the previous single generic error type.AzureDevOpsCommandFailedError.fromVcsErrorto classify failures by structured fields (e.g.failureKind, spawnNotFoundwith/withoutchdirsyscall) instead of string matching.outputLengthandargumentCountto decode and command failure errors for richer diagnostics.AzureDevOpsCliErrorunion.Macroscope summarized 5252104.