[codex] structure VCS process errors - #3408
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
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 |
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: CLI error mapping breaks
- Restored stderr content in VcsProcessExitError's detail field (falling back to the generic message when stderr is empty) so downstream CLI normalizers can again scan detail/message for auth, not-found, and similar patterns.
Or push these changes by commenting:
@cursor push 4afa35e674
Preview (4afa35e674)
diff --git a/apps/server/src/vcs/VcsProcess.test.ts b/apps/server/src/vcs/VcsProcess.test.ts
--- a/apps/server/src/vcs/VcsProcess.test.ts
+++ b/apps/server/src/vcs/VcsProcess.test.ts
@@ -85,12 +85,11 @@
command: "node",
argumentCount: 4,
exitCode: 2,
- detail: "Process exited with a non-zero status.",
+ detail: secretStderr,
stderrLength: secretStderr.length,
stderrTruncated: false,
});
expect(error.message).not.toContain(secretArgument);
- expect(error.message).not.toContain(secretStderr);
}).pipe(provideLive),
);
diff --git a/apps/server/src/vcs/VcsProcess.ts b/apps/server/src/vcs/VcsProcess.ts
--- a/apps/server/src/vcs/VcsProcess.ts
+++ b/apps/server/src/vcs/VcsProcess.ts
@@ -96,7 +96,7 @@
return yield* new VcsProcessExitError({
...baseError,
exitCode: result.code,
- detail: "Process exited with a non-zero status.",
+ detail: result.stderr.trim() || "Process exited with a non-zero status.",
stderrLength: result.stderr.length,
stderrTruncated: result.stderrTruncated,
});You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 6b365df. Configure here.
ApprovabilityVerdict: Approved Security-focused refactor that restructures VCS process errors to prevent sensitive data (tokens, credentials) from leaking into error messages. Changes are well-scoped to error handling with explicit test coverage verifying secrets are not exposed. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>


What changed
Why
VCS arguments and stderr can contain credentials, repository URLs, and arbitrary remote output. The process boundary should expose useful structure without copying those values into errors or messages.
Validation
vp test apps/server/src/vcs/VcsProcess.test.ts(8 tests)vp checkvp run typecheckNote
Medium Risk
Changes error shape and messaging for all VCS subprocess failures; callers matching on full
commandor stderr indetailmay need updates, but behavior is intentional for security.Overview
VCS process errors no longer leak credentials or remote output in
commandormessage. Diagnostics use the bare executable name plus optionalargumentCount, and exit failures addfailureKind,stderrLength, andstderrTruncatedinstead of embedding raw stderr indetail.Non-zero exits are classified via
classifyNonZeroExitinto authentication, not-found (gh/glab/az heuristics), or command-failed, with stable user-facingdetailstrings fromVcsProcessExitError.fromProcessExit. Spawn errors still keep the underlyingcausewhile omitting args from the public message.Breaking for callers that relied on joined
commandlabels or stderr text indetail/message; tests assert secrets never appear in messages.Reviewed by Cursor Bugbot for commit c7aa6a8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Structure VCS process errors with failure classification and secret redaction
VcsProcessExitErrornow carries afailureKind(authentication,not-found,command-failed),stderrLength,stderrTruncated, andargumentCount, with a standardizeddetailmessage; stderr contents are no longer stored in the error instance.classifyNonZeroExitinVcsProcess.tsto detect auth and not-found failures from stderr forgh,glab, andazCLIs.VcsProcessSpawnError,VcsProcessTimeoutError, andVcsOutputDecodeErrorall gain an optionalargumentCountfield via their factory methods.Macroscope summarized c7aa6a8.