Skip to content

GitLab forge support for PRs, CI badges, planboard and issue ingestion (#193) - #1571

Merged
currentbits merged 2 commits into
mainfrom
coder/gitlab-forge-support-for-prs-ci-badges-p-50fdfa
Oct 10, 2026
Merged

currentbits merged 2 commits into
mainfrom
coder/gitlab-forge-support-for-prs-ci-badges-p-50fdfa

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Closes #193.

GitLab projects now get merge requests (status, create, squash merge, background refresh), CI badges, the planboard and issue ingestion, through a new glab api backend with the same contract as the gh paths.

What changed

  • electron/gitlab.js (new): detects a GitLab origin (gitlab.com, or any host whose name contains "gitlab", including subgroups and ssh ports). All calls go through glab api --hostname <host>, so self-hosted instances work.
    • Merge requests are mapped to PrInfo; when a branch has several, the open one wins.
    • CI checks are the jobs of the head pipeline. An allow_failure job that fails counts as skipping, not red.
    • Every issues.js entry point has a GitLab version: fetch, list, plan:* labels, comment, close, reopen and create.
  • electron/worktrees-pr.js: viewBranchPr is the shared branch-to-PR lookup for prStatus and mergePr. prChecks, refreshPrStates and createPr dispatch to GitLab before the GitHub guard. ghTryAsync takes opts.bin, so glab gets the same async/timeout/kill handling.
  • electron/issues.js: routes to GitLab when origin is GitLab, and accepts GitLab /-/issues/N URLs.
  • Planboard note and crew "open PR" step: both use the new isForgeRemote, so they now apply to GitLab projects.

Tests

  • New electron/test/gitlab.test.js uses a fake glab (CODER_GLAB_BIN) to cover MR lookup, CI jobs and every issues.js entry point.
  • Several existing tests used gitlab.com as their example of an unsupported remote. They now use bitbucket.org, so they still test the same thing.
  • Locally, 398/398 pass across the PR, issue, planboard and crew suites.

Known limits

  • I haven't tested this against a live GitLab (glab isn't installed on the dev machine). The request and response shapes follow the GitLab REST docs.
  • A self-hosted GitLab on a host without "gitlab" in its name isn't detected.
  • GitLab merges always squash; the merge method and --auto options only apply to gh.
  • The PR workspace (listPrs/checkoutPr) and mergeOptions still only work with GitHub.

🤖 Generated with Claude Code

#193)

Adds electron/gitlab.js, a glab api backend with the same contract as the
gh paths: merge requests (status, create, squash merge, background
refresh), head-pipeline jobs as CI checks, and issue fetch/list/plan
labels/comment/close/reopen/create. GitLab origins (gitlab.com or a host
containing "gitlab", including subgroups) route there before the GitHub
guard. Planboard note and crew PR step now apply to GitLab too.

Closes #193

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T07:57:15.483767Z d801119 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@currentbits
currentbits merged commit f75efd3 into main Oct 10, 2026
5 of 6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8011192f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread electron/worktrees-pr.js
Comment on lines +1283 to +1286
const gl = gitlabOrigin(originUrl);
if (gl) {
// ponytail: GitLab always squash-merges now; method/auto are gh-only.
await require("./gitlab.js").mergeMr(cwd, gl, info.number);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not turn GitLab auto-merge into an immediate merge

When GitLab checks are pending, NextGitActionButton.tsx still exposes “Auto-merge” and calls onPrMerge({ auto: true }), but this branch ignores opts.auto and immediately invokes the merge API. On projects that do not enforce successful pipelines server-side, clicking Auto-merge can therefore merge before the running checks finish; use GitLab's merge-when-pipeline-succeeds option or reject/hide auto-merge for GitLab.

Useful? React with 👍 / 👎.

Comment thread electron/issues.js
Comment on lines +87 to +88
const gitlabUrl = gitlab.parseGitlabIssueUrl(s);
if (gitlabUrl) return gitlabUrl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the forge from pasted issue URLs

A GitLab URL is reduced to only {number, owner, repo}, so fetchIssue later chooses the backend solely from the current project's origin. Pasting a GitLab issue URL while working in a GitHub checkout consequently runs gh issue view -R owner/repo and can import an unrelated GitHub issue with the same coordinates; the inverse mismatch queries GitLab for a pasted GitHub URL. Preserve the URL's forge/host and route accordingly, or reject cross-forge references.

Useful? React with 👍 / 👎.

Comment thread electron/gitlab.js
Comment on lines +179 to +180
const bucket =
j.allow_failure && j.status === "failed" ? "skipping" : normalizeCheckBucket(j.status);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat optional manual jobs as skipped

For an optional GitLab manual job, the Jobs API reports status: "manual" with allow_failure: true; this condition only special-cases failed jobs, and normalizeCheckBucket("manual") falls through to pending. Such pipelines therefore remain displayed as “checks still running” indefinitely even though GitLab considers the manual job non-blocking and the MR is ready to merge. Map optional manual jobs to the skipping bucket as well.

Useful? React with 👍 / 👎.

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.

GitLab forge support for PRs, CI badges, planboard and issue ingestion

1 participant