Skip to content

fix(gitlab): recognize SSH-over-443 remotes - #30998

Merged
nwparker merged 6 commits into
stablyai:mainfrom
lorenzozanee:fix/gitlab-altssh-443
Oct 24, 2026
Merged

nwparker merged 6 commits into
stablyai:mainfrom
lorenzozanee:fix/gitlab-altssh-443

Conversation

@lorenzozanee

@lorenzozanee lorenzozanee commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem and user-facing result

GitLab.com repositories using ssh://[email protected]:443/team/project.git could miss GitLab recognition and fail to produce file or commit links. Manual merge-request links could use the SSH-only hostname. These remotes now resolve to the same GitLab.com project, and file, commit, and new merge-request links use https://gitlab.com. CLI worktree commands also accept GitLab.com issue and merge-request URLs matching the stored SSH-over-443 remote.

Provider inference can now select the existing GitLab “Create MR” wording instead of the GitHub “Create PR” fallback while eligibility loads. This is an intended correction to provider recognition; no new control or notice is added. Git retains the configured transport remote.

What changed and plan

The three existing parsers reuse the existing exact-host GitLab alias normalizer for derived project identity and web URLs. Tests cover the parser boundaries, final link destinations, CLI project matching, and the provider-hook-to-header-action flow. Self-hosted service ports, foreign-project rejection, lookalike host rejection, and other providers keep their existing behavior. There is no new stored state, protocol, credential handling, or process operation.

Light review classification

  • Small: three production files, 19 added and 10 removed lines; test changes are excluded from the production limit.
  • Outside risky areas: only derived host, provider, path, and URL values change; no persistence, lifecycle, ordering, process, credential, or cross-version contract change.
  • Not a repeat: git log origin/main --since=2026-09-23 on the three production files contains no commits, including no same-symptom fix or revert in the last 30 days.
  • Local effect: pure parsing and URL construction with existing return types; unchanged consumers receive corrected identity and link values.

Linked Issue

Tracked in #30876

Validation

The current review loop passed 52 tests in the three existing parser/manual-link suites on c50edba4c7bfbf06671b0fcf58eea1818ba4b933. The test-only coverage follow-up 1b4e7afe90c passed 17 tests in index-worktree-gitlab-links.test.ts and use-hosted-review-state.test.tsx, using Node with ORCA_BACKGROUND_LAUNCH=1 and the machine-wide test queue. The latter drives the real provider hook through the existing header action and asserts disabled “Create MR” copy while eligibility loads. Existing CLI foreign-project/host/port rejection tests remain in the executed suite; the parser suites retain exact-alias lookalike rejection.

Validation follows the current review QA table: pure parser and URL flows use regression tests, the CLI uses an integration test running its real command entry point, and provider wording uses a renderer/state/action test plus one branch-only app screenshot. No lifecycle, process, or login flow changed. A live SSH/WSL transport test, agent reply matrix, or hosted MR creation is outside this validation scope; no such pass is claimed.

Main was integrated at 5eb61acd64a45f49b375ec8935708244114f3748, where the branch-only M4Air screenshot shows the real enabled “Create MR” action for the alias remote. The app was stopped gracefully and all ten real-config hashes were unchanged. Missing glab prevented hosted review lookup on that machine; this screenshot does not claim lookup, authentication, transport or MR creation coverage.

The initial integrated-head CI failure came from main's unrelated JiraUser import. A subsequent additive main merge 097b162cdc64488a5233e263433c91907aa6e5d0 includes the landed #32964 repair; narrow inspection confirms the reviewed PR additions and removals are preserved. The screenshot carries across that main merge. Final current-head PR Checks passed, including static/type checks, all five test shards, Git compatibility and Linux/Windows packaging; headless persistence and native smoke also passed.

source-control-gitlab-alias-branch.png

The normal follow-up commit hook and the prescribed main-merge staged checks passed. Earlier historical validation is not counted as current-head app evidence.

Attribution and AI disclosure

Original implementation by @lorenzozanee; exact original commit 7f5b284890934024ff3b95cec31cdadcab9af547 and its author are preserved in the branch history. The contributor’s three production changes are preserved; additive follow-up commits strengthen tests and integrate main without rewriting history.

The original contributor disclosed OpenCode (gpt-6-luna) assistance. Native OpenAI Codex workers assisted with reproduction, regression coverage, validation, and independent review.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer material is copied.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

GitLab remote parsing now recognizes altssh.gitlab.com as GitLab and uses the canonical gitlab.com host for project references and source-control web links. Tests cover supported SSH forms, hostname casing, and rejection of lookalike hosts. Additional tests cover merge-request action state while hosted-review eligibility is loading and CLI worktree arguments containing GitLab issue and merge-request links. The original remote remains the SSH transport address.

Priority: Normal

Merge Risk: Low · up to 097b1

Restrict the alias to SSH-over-443 remotes so nonstandard HTTP(S) endpoints do not generate links to the wrong GitLab host.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description explains the problem, user-facing result, implementation, linked issue number, validation, visual proof, AI disclosure, and upstream boundary. However, it does not follow the required … Update the description to use the required template sections. Add an actual link to issue #30876, complete the ELI5 and Why sections, include the Testing checkboxes and platform details, add Review and Notes sections, and complete the Check…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: recognizing GitLab SSH-over-443 remotes.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, user-facing result, implementation, linked issue number, validation, visual proof, AI disclosure, and upstream boundary. However, it does not follow the required template headings and omits the required issue link, Testing checklist, Review, Notes, and Checklist sections. The explanation of alternatives is also incomplete.

Resolution

Update the description to use the required template sections. Add an actual link to issue #30876, complete the ELI5 and Why sections, include the Testing checkboxes and platform details, add Review and Notes sections, and complete the Checklist. Keep the existing validation details and screenshot.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

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

nwparker and others added 2 commits October 23, 2026 05:07
Reuse the existing GitLab transport-host normalizer in project identity,
hosted links, and manual merge-request links. Cover alias variants,
lookalikes, nested groups, and canonical encoded links.

Fixes stablyai#30876

Co-authored-by: lorenzozanee <[email protected]>

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Gate GitLab alias folding by SSH-over-443 transport. · git-remote-host-alias.ts:4-27

src/shared/git-remote-host-alias.ts:4-27
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Gate GitLab alias folding by SSH-over-443 transport.

normalizeGitLabRemoteHost is host-only, but the hosted-remote and source-control URL parsers apply it to url.hostname without checking the protocol or port. Therefore, https://altssh.gitlab.com:8443/team/project.git can produce public GitLab links and GitLab provider identity, even though altssh.gitlab.com is documented only as an SSH-over-443 alias. Keep the shared helper host-only and gate alias folding in the protocol-aware callers.

Suggested fix
diff --git a/src/main/git/hosted-remote-url.ts b/src/main/git/hosted-remote-url.ts
@@
-function providerForHost(host: string): HostedRemoteHost | null {
-  const normalized = normalizeGitLabRemoteHost(host)
+function providerForHost(
+  host: string,
+  allowGitLabAlias = true
+): HostedRemoteHost | null {
+  const normalized = allowGitLabAlias
+    ? normalizeGitLabRemoteHost(host)
+    : host.trim().toLowerCase()
@@
-    const hosted = providerForHost(url.hostname)
+    const hosted = providerForHost(
+      url.hostname,
+      url.protocol.toLowerCase() === 'ssh:' && url.port === '443'
+    )
diff --git a/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts b/src/renderer/src/components/right-sidebar/source-control/review/remote-repo.ts
@@
-function providerForHost(host: string): ManualReviewProvider | null {
-  const normalized = normalizeGitLabRemoteHost(host)
+function providerForHost(
+  host: string,
+  allowGitLabAlias = true
+): ManualReviewProvider | null {
+  const normalized = allowGitLabAlias
+    ? normalizeGitLabRemoteHost(host)
+    : host.trim().toLowerCase()
@@
     const remoteHost = url.hostname.toLowerCase()
-    const host = normalizeGitLabRemoteHost(remoteHost)
+    const allowGitLabAlias = protocol === 'ssh:' && url.port === '443'
+    const host = allowGitLabAlias ? normalizeGitLabRemoteHost(remoteHost) : remoteHost
     const hintedProvider = normalizeProvider(providerHint)
-    const inferredProvider = providerForHost(host)
+    const inferredProvider = providerForHost(remoteHost, allowGitLabAlias)
@@
-    } else if (remoteHost === 'altssh.gitlab.com') {
+    } else if (allowGitLabAlias && remoteHost === 'altssh.gitlab.com') {

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b5c6fc35-0873-4a24-ad0b-772f2a939057
Commits

Reviewing files that changed from the base of the PR and between 5eb61ac and 097b162.

Files selected for processing: 3
  • src/main/git/hosted-remote-url.ts
  • src/main/gitlab/project-ref-parser.test.ts
  • src/main/gitlab/project-ref-parser.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

@brennanb2025

Copy link
Copy Markdown
Contributor

GitLab.com remotes using ssh://[email protected]:443/... could lose provider recognition or produce web links with the SSH-only host. This change reuses the existing exact-host alias normalizer so project identity, file links, commit links and manual MR links resolve to gitlab.com, while Git keeps its configured transport.

The light review found no production blocker. One additive test-only fixer round covered the actual CLI command and provider-hook-to-header-action consumers; the same reviewer accepted the follow-up. All 69 named regression tests passed. Main was integrated at 5eb61acd, then the branch received additive merge 097b162c containing main’s #32964 CI repair. Narrow inspection verified that the reviewed additions/removals and contributor history are preserved. The screenshot from 5eb61acd carries across this main merge. Final current-head CI passed, including static/type checks, all five test shards, Git compatibility, and Linux/Windows packaging. Headless persistence and native smoke checks also passed.

The existing Source Control action now infers GitLab's “Create MR” wording for this alias. The branch-only M4Air run shows the real enabled action. The owned app stopped gracefully and all ten real-config hashes were unchanged. Hosted review lookup was unavailable because glab was absent; that lookup is outside this screenshot requirement. Tests cover final file/commit/manual-MR destinations, lookalikes, self-hosted ports, foreign-project rejection, and CLI issue/MR matching. No live SSH/WSL authentication, agent reply, or hosted MR creation pass is claimed; these flows did not change. The common pattern separates Git transport from web/API identity; Orca's existing exact alias mapping is an intended difference because the generic reference parser lacks it. No in-scope fixes remain; no new controls were added.

Original implementation and preserved commit history are credited to @lorenzozanee.

For Brennan's review

source-control-gitlab-alias-branch.png

@nwparker
nwparker merged commit df97aa3 into stablyai:main Oct 24, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants