fix(gitlab): name the cause of a failed glab command #22509
main fromrefs/pull/22509/head·opened View on GitHubProblem#
When glab fails, GitLabCliCommandError.detail is the same fixed string for every failure class, so a user behind a broken proxy (or any non-auth, non-rate-limit failure) sees an identical message thousands of times and can't tell T3, glab, or the GitLab server apart. The process boundary already classifies each failure (failureKind, timeout, output limits) — the classification was being discarded. Fixes #22342.
Change#
GitLabCliCommandError gains an optional reason field — a bounded set of failure-class tags (not-found, timed-out, output-limit-exceeded, ...) populated in fromVcsError — appended to detail, the string SourceControlProviderError surfaces. The issue suggested putting glab's stderr in the message; this deliberately doesn't, matching the convention from #5620/#8645 — stderr is classified then discarded at the process boundary and never reaches the error. Unclassified exits stay generic rather than claiming a cause. Modeled on #8645's GitCommandError.reason (ForwardCompatibleOptional, tag in parens), adjusted to put the tag in detail since that is what wrappers copy here.
Scope and approval#
Fixes #22342 (untriaged, claiming the small-fix exception): one error class in packages/source-control-gitlab, one problem — the discarded classification. Follow-ups intentionally left out: mr view's MR-not-found message can't distinguish a project-level 404 (needs subcommand-aware classification), and PullRequestProviderError.reason could map the new tag.
Verification#
New tests in GitLabCli.test.ts; before the fix the not-found assertion fails on the old fixed string. After: vp test run src/server/GitLabCli.test.ts 11/11, vp test run 174/174 package, vp lint/vp fmt --check clean, package typecheck clean on macOS arm64. Not exercised: a real GitLab server or packaged app — covered at the service boundary with the same VcsProcessExitError shapes VcsProcess produces.
SWE-2 Max, Devin CLI
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
Approvability#
Verdict: Approved at
f98d0d4Macroscope's review found this PR approvable — This is a focused GitLab CLI error-reporting fix that preserves existing command behavior while adding bounded failure-reason tags to diagnostics. The production scope is isolated to one error class, with targeted tests and no configuration, deployment, security, billing, or schema-breaking impact.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 8e1bb03
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
79f8652e-146f-42bd-b721-abd77aafb2c8
Commits-
Reviewing files that changed from the base of the PR and between fdd200ab4100de0dcc2491e852bc34157b75d8b3 and 53bd547e6b443f46ad36006163c40c17a4831200.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 6a3a460
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
957bc5e7-9d05-4cdc-8ae7-1d8f3c96cfd2
Commits-
Reviewing files that changed from the base of the PR and between f98d0d43879d91f4749151010d7ef777c13055a3 and eadbaf7bfd72160d826083c1bbb2a866b22c288e.
Files selected for processing: 2-
packages/source-control-gitlab/src/server/GitLabCli.test.tspackages/source-control-gitlab/src/server/GitLabCli.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
Walkthrough
-
GitLab CLI command errors now support optional failure reasons. VCS failure kinds map to specific reasons, and tests verify classified and unclassified errors.
Changes: GitLab CLI error classification
Priority:Layer / File(s) Summary Classify GitLab CLI failures
packages/source-control-gitlab/src/server/GitLabCli.ts,packages/source-control-gitlab/src/server/GitLabCli.test.tsGitLabCliCommandErroraccepts an optional failure reason and includes it in the detail when present. VCS failures map to specific reasons. Tests cover not-found and timeout classifications, generic command failures, and unclassified exits. NormalEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
- pingdotgg/t3code#22342 — Adds bounded failure reasons to GitLab CLI error details, but does not expose raw stderr.
- pingdotgg/t3code#12300 — Changes the generic error surface for classified failures, while unclassified exits can remain generic.
- pingdotgg/t3code#20226 — Adds a
not-foundreason to the GitLab 404 error path. - pingdotgg/t3code#24201 — Adds an
output-limit-exceededreason for the GitLab CLI output-limit failure.
Possibly related PRs
- pingdotgg/t3code#23995 — Adds process failure-classification hooks and shared VCS error shapes used by this GitLab CLI mapping.
- pingdotgg/t3code#24464 — Raises the GitLab merge-request list output limit for the failure classified here as
output-limit-exceeded. - pingdotgg/t3code#24215 — Raises the merge-request list output limit for long descriptions; this PR classifies output-limit failures.
Suggested reviewers:
juliusmarminge
Merge Risk:
Minimal · up toeadba-
Classified GitLab CLI failures reach the provider error message. No actionable merge risk remains beyond normal checks.
Security architecture risk:
Minimal · up tof98d0-
The change exposes only predefined failure categories through an existing error path. It preserves authentication and rate-limit handling and does not add command-execution authority or raw process output to error messages. No material security risk was identified in the changed behavior.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The effective exposure change is limited to diagnostic categories reaching consumers of existing GitLab provider errors. The comparison does not introduce a new execution entrypoint, credential capability, or persistent-state transition.
Trust Boundaries and Controls
- observed — Process failures cross the existing provider boundary through fixed error classes and bounded diagnostic tags. Authentication and rate-limit classifications remain distinct, and unsupported reason values decode as absent rather than becoming arbitrary display text.
-
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: adding failure-cause information to failed GitLab CLI commands. Description check The description includes all required sections. It explains the problem, the implementation, the scope exception, the verification results, and the checks that were not run. It also identifies the age… Linked Issues check Issue #22342requires GitLab CLI failures to expose the failure cause instead of one fixed detail.GitLabCliCommandErrornow maps recognizedVcsErrorclasses to boundedreasontags and includes …Out of Scope Changes check The whole-PR diff changes GitLabCliCommandErrorreason mapping and focusedGitLabClitests. The bounded tags, error formatting, and tests directly support issue#22342. No unrelated product behavi…Full details: Description check
-
Explanation
The description includes all required sections. It explains the problem, the implementation, the scope exception, the verification results, and the checks that were not run. It also identifies the agent and harness used.
Full details: Linked Issues check
-
Explanation
Issue
#22342requires GitLab CLI failures to expose the failure cause instead of one fixed detail.GitLabCliCommandErrornow maps recognizedVcsErrorclasses to boundedreasontags and includes each tag indetailandmessage.GitLabCli.test.tsverifiesnot-found,timed-out, and generic unclassified exits. The issue presents stderr as a suggestion, not a required coding condition. The tests also preserve the separate merge-request not-found behavior.
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff changes
GitLabCliCommandErrorreason mapping and focusedGitLabClitests. The bounded tags, error formatting, and tests directly support issue#22342. No unrelated product behavior or follow-up scope appears in the reviewed changes.
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
tanstack-source added labelsbug
Sinan53x(GitHub profile, opens in a new tab) linked this to fix #22342
Note
🤖 Claude Opus 5.5 responding on behalf of Theo
Closing. This PR has been open for more than 3 weeks, and
mainhas moved a long way since then. If the change still matters, open a fresh PR from currentmain.t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes