From 8d210e5cd28d8047bac7de14c29c39c10040bcf5 Mon Sep 17 00:00:00 2001 From: Michel Liao Date: Wed, 25 Nov 2026 14:07:03 -0500 Subject: [PATCH] fix(gitlab): group work item links, such as epics, are no longer read as issues GitLab.com serves epics at `/groups//-/work_items/`, and redirects the older `/-/epics/` address there. The issue route read that as issue `` in a project named `groups/`, so with any GitLab project open the link opened the issue panel, which asked GitLab for `projects/groups%2F/issues` and could not load anything. `groups` is a name GitLab reserves at the top level, so no project lives below it. The issue route now leaves those URLs alone and they open as ordinary links. A subgroup named `groups` is still read as before. Claude Fable 5.2 in Claude Code, running in T3 Code. Co-Authored-By: Claude Fable 5.2 --- .../src/sourceControl/sourceControlDefinitions.test.ts | 1 + packages/source-control-gitlab/src/shared/definition.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/server/src/sourceControl/sourceControlDefinitions.test.ts b/apps/server/src/sourceControl/sourceControlDefinitions.test.ts index 3684eb4c9dcaf..0e317f36de9c1 100644 --- a/apps/server/src/sourceControl/sourceControlDefinitions.test.ts +++ b/apps/server/src/sourceControl/sourceControlDefinitions.test.ts @@ -52,6 +52,7 @@ it.each([ "https://github.com/acme/web/pull/42", "https://example.test/acme/web/issues/42", "https://github.com/acme/web/issues/0", + "https://gitlab.com/groups/acme/-/work_items/12", ])("does not read %s as an issue", (url) => { expect(sourceControlDefinitions.parseIssueUrl(url)).toBeNull(); }); diff --git a/packages/source-control-gitlab/src/shared/definition.ts b/packages/source-control-gitlab/src/shared/definition.ts index 31fea2dc296fb..42645a4dad302 100644 --- a/packages/source-control-gitlab/src/shared/definition.ts +++ b/packages/source-control-gitlab/src/shared/definition.ts @@ -22,9 +22,10 @@ const CHANGE_REQUEST_REFERENCE = // Self-managed GitLab runs on any hostname and nests projects in groups. const CHANGE_REQUEST_PATH = /^\/([^/]+(?:\/[^/]+)+)\/-\/merge_requests\/(\d+)(?:\/|$)/u; const COMMIT_PATH = /^\/([^/]+(?:\/[^/]+)+)\/-\/commit\/([0-9a-f]+)\/?$/iu; -// An incident is an issue that GitLab also serves at `/-/issues/incident/`. +// An incident is an issue that GitLab also serves at `/-/issues/incident/`. No project is +// below `/groups/`: a work item there is the group's own, such as an epic. const ISSUE_PATH = - /^\/([^/]+(?:\/[^/]+)+)\/-\/(?:issues(?:\/incident)?|work_items)\/(\d+)(?:\/|$)/u; + /^\/(?!groups\/)([^/]+(?:\/[^/]+)+)\/-\/(?:issues(?:\/incident)?|work_items)\/(\d+)(?:\/|$)/u; // Every GitLab page inside a project sits below its first `/-/`. const REPOSITORY_PAGE_PATH = /^\/([^/]+(?:\/[^/]+)+?)\/-\//u;