fix(source-control): detect authenticated self-hosted gitlab remotes#2480
fix(source-control): detect authenticated self-hosted gitlab remotes#2480GuilhermeVieiraDev wants to merge 1 commit intopingdotgg:mainfrom
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)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 64c268f. Configure here.
ApprovabilityVerdict: Needs human review This PR introduces new capability to detect self-hosted GitLab remotes via authentication probing, changing the provider resolution flow. While well-tested, this is a meaningful feature addition that affects runtime behavior beyond a simple bug fix. You can customize Macroscope's approvability policy. Learn more. |
64c268f to
0a0d025
Compare
0a0d025 to
1200763
Compare
|
@GuilhermeVieiraDev is attempting to deploy a commit to the Ping Labs Team on Vercel. A member of the Team first needs to authorize it. |

What Changed
Fixed GitLab self-hosted detection for repos whose host does not include
gitlabin the remote URL.The provider registry now keeps the existing remote URL detection as the first path, but lets providers resolve an unknown remote when they have a stronger signal. GitLab uses
glab auth statusfrom the repo cwd and only claims the repo when the remote host exactly matches an authenticated GitLab host.Also updated GitLab auth discovery so
glab auth statuscan still report GitLab as authenticated when one configured host fails but another host is logged in.Why
Self-hosted GitLab instances can live on arbitrary domains, so checking whether the remote host contains
gitlabis not enough.This showed up when
glab auth statusreturned a mixed result: one GitLab host failed auth, while the repo's self-hosted instance was authenticated. The old discovery path treated the whole command as unauthenticated because the command exited non-zero, and the provider routing still saw the repo asunknownbecause the remote host did not look like GitLab.The fix keeps the heuristic behavior unchanged for normal GitHub, GitLab, Azure DevOps, and Bitbucket hosts, and only adds the extra provider-specific check for unknown remotes.
Checklist
Note
Medium Risk
Changes provider detection/routing to run additional CLI auth probes for unknown remotes and alters GitLab auth parsing, which could misclassify providers or add latency if parsing/execution differs from expectations.
Overview
Improves GitLab self-hosted detection by adding provider-specific refinement for unknown remotes: the registry now optionally reruns provider CLI auth checks and lets a provider claim the remote when its authenticated host matches the remote host (including non-standard ports).
Updates GitLab CLI auth parsing to treat
glab auth statusas authenticated when any listed host is logged in (even if another host fails and the command exits non-zero), backed by a newgitLabAuthStatusparser and expanded unit tests. Also preserves ports in remote URL detection by switching toURL.hostforbaseUrlwhile classifying providers using the portless hostname.Reviewed by Cursor Bugbot for commit 1200763. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix detection of authenticated self-hosted GitLab remotes from CLI auth status
parseGitLabAuthStatusHostsandfindAuthenticatedGitLabHostingitLabAuthStatus.tsto parseglab auth statusoutput into per-host auth records, supporting ports and non-standard hostnames.parseGitLabAuthto report authenticated status when any host in the CLI output is logged in, even if the command exits non-zero (common when gitlab.com is unauthenticated but a self-hosted instance is).refineUnknownRemoteProviderinSourceControlProviderDiscovery.tsand wires it intoSourceControlProviderRegistry.tsso thatunknownremotes are re-evaluated against CLI auth status and promoted to a concrete provider.detectSourceControlProviderFromRemoteUrlinsourceControl.tsto preserve ports inbaseUrlwhile still classifying provider kind by hostname alone.parseRemoteHostnow returns the host with port included for HTTPS URLs; callers that relied on hostname-only values may need review.Macroscope summarized 1200763.