[Bug]: GitLab MR links include the installation subfolder in the API project path, breaking reads and monitoring #20226
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server; packages/contracts or packages/shared
Steps to reproduce#
- Use a self-managed GitLab installation served at a URL prefix, such as
https://code.example.com/gitlab. - Authenticate glab and configure its documented per-host installation prefix:
glab config set subfolder gitlab --host code.example.com - Use a repository whose API path is
team/subgroup/project, with an SSH remote such asgit@code.example.com:team/subgroup/project.git. - Link its MR in T3 using the full browser URL:
https://code.example.com/gitlab/team/subgroup/project/-/merge_requests/9. - Start watching the MR.
Expected behavior#
T3 preserves the browser URL, resolves the API project identity to team/subgroup/project, and successfully reads and monitors the MR.
Actual behavior#
T3 stores gitlab/team/subgroup/project as the repository and calls the API with that value as the project path. GitLab returns 404. The outer T3 error is GitLab CLI command failed.
The watcher retries every two minutes and stops after eight read failures. Restarting it repeats the failure. Successful watch registration does not establish that T3 can read the MR.
Impact#
Major degradation or frequent failure
Version or commit#
Release v0.1.0 and check main@e3b35d1b2440b104f0bc2e357377c348121234dd
Environment#
T3 server 0.1.0, Linux, glab 1.118.0, self-managed GitLab under a URL prefix.
Logs or stack traces#
The following uses placeholder host/project names corresponding to the reproduced installation. With its existing configuration and credentials:
glab config get subfolder --host code.example.com
# gitlab
glab api --hostname code.example.com 'projects/gitlab%2Fteam%2Fsubgroup%2Fproject/merge_requests/9'
# 404 Project Not Found
glab api --hostname code.example.com 'projects/team%2Fsubgroup%2Fproject/merge_requests/9'
# succeeds
glab repo view 'https://code.example.com/gitlab/team/subgroup/project' --output json
# succeeds; path_with_namespace is team/subgroup/project,
# web_url retains /gitlab/team/subgroup/project
The final command was tested successfully against the affected installation with glab 1.118.0. It returned the numeric project ID, correct `path_with_namespace`, and original `web_url`.
Screenshots, recordings, or supporting files#
No response
Workaround#
Not possible
AxxiD(GitHub profile, opens in a new tab) added labelsbug
AxxiD(GitHub profile, opens in a new tab) added labelsneeds-triage
juliusmarminge added labelsvia-triage
juliusmarminge removed labelsneeds-triage
Thanks for confirming. I tested
glab repo view <project-web-url> --output jsonon the affected installation with glab 1.118.0. It returned the correctpath_with_namespaceand preserved the installation prefix inweb_url. That validates the CLI lookup only; I haven’t tested a T3 implementation end to end.Two cases worth covering:
- Existing linked MRs already contain the incorrect repository identity, so correcting only newly created links would leave those broken.
- The installation prefix and a legitimate group can both be named
gitlab, so normalization must avoid stripping twice.
Also hit on macOS (arm64), desktop app nightly
0.1.1-nightly.20261020.3386, glab 1.123.0. Here the/gitlabprefix is configured throughapi_host: code.example.com/gitlabrather thansubfolder.It fails the same way:
projects/gitlab%2Fgroup%2Fproject/...returns 404, andprojects/group%2Fproject/...succeeds. The lookup that #21576 relies on also works with this setup:glab repo view https://code.example.com/gitlab/group/project --output jsonreturnspath_with_namespace = group/project.Triage by Claude Opus 5.5 (Claude Code) via
t3 triage.juliusmarminge added labelsneeds more info
juliusmarminge removed labelsneeds more info
This fully breaks the auto-settle and watching for all Merge Requests in that Gitlab instance because it cannot get the MR state. It would be nice to have the fix merged soon
juliusmarminge linked this to #21576
Sign in to join this conversation.
Note
Grok responding on behalf of Julius.
Confirmed on main: T3 takes everything before
/-/merge_requests/<n>as the project path.parseChangeRequestUrlinpackages/shared/src/changeRequestUrl.tsmatches^/(.+)/-/merge_requests/(\d+), so a GitLab installed under a prefix like/gitlabends up withgitlab/team/subgroup/projectas the repository. Nothing in the GitLab provider reads glab'ssubfoldersetting.changeRequestUrlForalso rebuilds MR URLs ashttps://<host>/<repository>/-/merge_requests/<n>, so it has no place for a prefix either.Accepting this as a bug in self-managed GitLab support. Related but separate: #7849 (full URL sent as the project path on new-project lookup) and #16463 (split SSH/API hostnames).
Possible direction: once a URL has been parsed, resolve the API project identity through glab (for example
path_with_namespacefromglab repo view <url> --output json, as you suggested), and keep the browser URL for links. We haven't tested this yet.