Skip to content

[codex] Enrich source-control errors#3248

Open
juliusmarminge wants to merge 1 commit into
mainfrom
codex/enrich-source-control-errors
Open

[codex] Enrich source-control errors#3248
juliusmarminge wants to merge 1 commit into
mainfrom
codex/enrich-source-control-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • add structured source-control error context for cwd, provider, operation, command, repository, and reference
  • preserve original causes while keeping public error details transport-safe and independent of raw cause messages
  • replace valueless constructor wrappers with direct construction or meaningful static mappers, and use catchTags for tagged error unions
  • retain existing actionable CLI guidance for missing tools, authentication, and repository lookup failures

Validation

  • vp check
  • vp run typecheck
  • focused source-control and GitManager backend tests (117 tests)

Note

Medium Risk
Touches contract error shapes and all major source-control providers; behavior change for error messages surfaced to clients, though causes are preserved for debugging.

Overview
Source-control failures now carry structured, client-safe context: cwd, optional command, repository, and reference on SourceControlProviderError, with matching command/cwd on GitHub, GitLab, and Azure DevOps CLI errors.

Public detail and message no longer echo raw CLI stderr, schema decode text, or nested cause strings. CLI layers map VCS failures through fromVcsError (keeping friendly missing-tool/auth/not-found guidance) and attach the original error on cause. JSON decode failures use fixed detail strings instead of formatter output.

Providers build SourceControlProviderError inline (replacing thin providerError wrappers), sanitize references/repos via transportSafeSourceControlErrorValue (strip URL credentials/query/hash, normalize whitespace, cap length), and use generic provider-level details for Bitbucket API failures. Registry unsupported-provider and detectProvider paths populate the same fields while preserving detection causes.

Tests cover sanitization, cause retention, and updated fake GitHubCliError shapes.

Reviewed by Cursor Bugbot for commit 5d42a7a. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Enrich source-control errors with command, cwd, and sanitized context fields

  • Extends SourceControlProviderError, GitHubCliError, GitLabCliError, and AzureDevOpsCliError with command, cwd, reference, and repository fields so errors carry structured context for debugging.
  • Adds transportSafeSourceControlErrorValue in SourceControlProvider.ts to sanitize reference/repository values: strips URL credentials, query strings, and fragments, collapses whitespace, and bounds length to 256 characters.
  • Replaces generic providerError helpers in GitHub, GitLab, Bitbucket, and Azure DevOps providers with explicit error construction that propagates command and cwd from CLI errors and preserves the original cause.
  • Standardizes detail messages across all CLI error paths to avoid echoing raw upstream process output.
  • Behavioral Change: all structured source-control errors now require a cwd field; existing error construction sites must provide it.

Macroscope summarized 5d42a7a.

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: 694021bb-6f51-4c9e-b671-12fb970ae8c6

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-source-control-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:XXL 1,000+ changed lines (additions + deletions). labels Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Error-handling refactor that adds structured context (command, cwd, reference) to source-control errors and sanitizes sensitive data from error transport values. No runtime behavior changes outside error handling, comprehensive test coverage included.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ 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