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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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 runtime behavior by adding a GitLab remote detection mechanism that executes CLI commands ( You can customize Macroscope's approvability policy. Learn more. |
64c268f to
0a0d025
Compare

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 logic by adding provider-specific remote resolution (via
glab auth status) and tweaking host parsing to include ports, which could misclassify remotes if parsing is wrong. Impact is limited to source-control provider selection and auth discovery.Overview
Fixes routing for self-hosted GitLab remotes whose domain doesn’t contain
gitlabby adding a provider-specific unknown-remote detection hook: the registry now allows providers to resolveunknownremotes, and GitLab claims a remote only when its host exactly matches an authenticated host reported byglab auth status.Improves GitLab auth discovery to treat
glab auth statusas authenticated even when the command exits non-zero, by parsing per-host sections, and updates shared remote URL parsing to preserve ports while classifying providers by hostname. Adds focused tests covering mixed-auth outputs and non-standard port remotes.Reviewed by Cursor Bugbot for commit 0a0d025. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix detection of authenticated self-hosted GitLab remotes
makeRemoteDetectortoGitLabSourceControlProviderthat runsglab auth statusto identify authenticated self-hosted GitLab hosts when provider context is unknown.SourceControlProviderRegistrywith aresolveUnknownProviderContextstep that invokes provider-supplied remote detectors to refine unknown contexts at runtime.parseGitLabAuthStatusHoststo parse multi-hostglab auth statusoutput and identify which host has an authenticated account.parseRemoteHostto useURL.hostinstead ofhostnameso ports are preserved inbaseUrl, with provider classification using the portless hostname.parseGitLabAuthnow returns authenticated status when any host is authenticated in the CLI output, even if the CLI exits non-zero.Macroscope summarized 0a0d025.