Skip to content

[codex] Enrich Git VCS driver errors#3253

Merged
juliusmarminge merged 5 commits into
mainfrom
codex/enrich-git-vcs-driver-errors
Jun 20, 2026
Merged

[codex] Enrich Git VCS driver errors#3253
juliusmarminge merged 5 commits into
mainfrom
codex/enrich-git-vcs-driver-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • give Git command failures structured operation, cwd, fixed executable, argument-count, exit-code, and output-length context
  • keep raw argv, stdout, and stderr out of direct error fields and messages while preserving exact platform and crypto causes
  • detect missing working directories structurally and classify non-repository results before constructing sanitized errors
  • remove the synthetic remove-worktree wrapper so callers retain the original Git failure

Validation

  • vp test apps/server/src/vcs/GitVcsDriverCore.test.ts apps/server/src/git/GitManager.test.ts (82 tests)
  • vp check
  • vp run typecheck

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 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: 7b76cd94-b657-4ab8-959b-ee9bd3929a4c

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 codex/enrich-git-vcs-driver-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR refactors Git VCS driver error handling to provide more structured error metadata while removing raw command arguments and stderr from error messages (a security improvement). The changes don't affect git operation logic, only error reporting, and include comprehensive test updates.

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

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 13:35

Dismissing prior approval to re-evaluate bb03e7a

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 15:58

Dismissing prior approval to re-evaluate f9485b2

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 16:24

Dismissing prior approval to re-evaluate c4d0cd4

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Non-git cwd status regression
    • Added stderr substring checks for 'not a git repository' in both readStatusDetailsLocal and readStatusDetailsRemote before the generic GitCommandError throw, returning the non-repository sentinel values so GitManager correctly identifies non-git directories.

Create PR

Or push these changes by commenting:

@cursor push 51cf41d948
Preview (51cf41d948)
diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts
--- a/apps/server/src/vcs/GitVcsDriverCore.ts
+++ b/apps/server/src/vcs/GitVcsDriverCore.ts
@@ -1196,6 +1196,9 @@
       return NON_REPOSITORY_REMOTE_STATUS_DETAILS;
     }
     if (branchResult.exitCode !== 0) {
+      if (branchResult.stderr.toLowerCase().includes("not a git repository")) {
+        return NON_REPOSITORY_REMOTE_STATUS_DETAILS;
+      }
       return yield* new GitCommandError({
         ...gitCommandContext({
           operation: "GitVcsDriver.statusDetailsRemote.branch",
@@ -1316,6 +1319,9 @@
     }
 
     if (statusResult.exitCode !== 0) {
+      if (statusResult.stderr.toLowerCase().includes("not a git repository")) {
+        return NON_REPOSITORY_STATUS_DETAILS;
+      }
       return yield* new GitCommandError({
         ...gitCommandContext({
           operation: "GitVcsDriver.statusDetails.status",

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit c4d0cd4. Configure here.

Comment thread apps/server/src/vcs/GitVcsDriverCore.ts
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge
juliusmarminge merged commit 4238a0e into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/enrich-git-vcs-driver-errors branch June 20, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant