GitLab PR watches never read merge requests on a self-managed GitLab served on a custom port
What happened
An agent opened a merge request on our self-managed GitLab and started a PR watch until it merged. The pipeline passed and I merged the MR, but the watch never woke the agent. It kept waiting until I told it myself that the checks had passed and the MR was merged.
Diagnosis
The watch never managed to read the merge request: the host it hands to glab has lost the GitLab server's port.
- The PR link stores the host without its port. The checkout's origin is
http://10.129.10.143:9999/group/project.git. The thread's PR link gets itshostfromchangeRequestHost(linkCreatedPullRequest.ts#L39) and is stored ashost: "10.129.10.143", while itsurlkeepshttp://10.129.10.143:9999/.... Repository keys drop ports by design (git.ts#L149). - That host becomes glab's target. The watch reads the MR with
getMergeRequestDetail, which runsglab api projects/<path>/merge_requests/<n>(GitLabPullRequestCli.ts#L1595-L1606).GitLabClipasses the host asGITLAB_HOST(GitLabCli.ts#L518). WithGITLAB_HOST=10.129.10.143, glab callshttps://10.129.10.143:443and getsconnection refused. The same command withGITLAB_HOST=10.129.10.143:9999succeeds.
This is unchanged on main as of 2026-11-21: GitLabCli.ts still sets GITLAB_HOST: input.host.
The watch also never told the agent that every read was failing. That is a separate bug, filed separately.
Steps to reproduce
- Run a self-managed GitLab over HTTP on a non-default port, such as
http://10.129.10.143:9999. Log glab in to10.129.10.143:9999with the HTTP API protocol. - Clone a project from it, so the origin is
http://10.129.10.143:9999/group/project.git, and add the checkout as a project on at3 serve0.1.11 server. - In a thread, have the agent open a merge request, so it is linked with
source: "created", and callwatch_pull_requestuntil it merges. - Let the pipeline pass and merge the MR.
Expected: the watch reads the MR and wakes the agent when checks pass and when it merges. Actual: every read of the MR fails, so the watch never wakes.
The failing read, run by hand in the checkout:
GITLAB_HOST=10.129.10.143 glab api 'projects/group%2Fproject/merge_requests/123'fails withconnection refusedon port 443.GITLAB_HOST=10.129.10.143:9999 glab api 'projects/group%2Fproject/merge_requests/123'succeeds.
Version
0.1.11 (t3 serve on the remote server where the thread ran, confirmed by its /.well-known/t3/environment; the t3 triage CLI was also 0.1.11)
Environment
Server: t3 serve 0.1.11 as a background service on Debian 13 (Linux 6.12, x64). Client: T3 Code desktop 0.1.11 on Arch Linux. glab 1.131.0. GitLab self-managed over HTTP on port 9999. Agent: Claude (claudeAgent).
Evidence
# Only the project and MR number are anonymized. Times are UTC on 2026-11-21.
# server.trace.ndjson, PullRequestWatchReactor.reportEnd at 11:08:46, after the user had the agent stop the watch
"pull request watch ended" {"pullRequest":"10.129.10.143/group/project#123","reason":"stopped","minutes":26,"quietMinutes":26,"wakes":0,"reads":0,"partial":false}
# PullRequestWatchReactor.sweep, every ~2 minutes from 10:43 (watch start) on
"pull request watch check failed" {"pullRequest":"<projectId> 10.129.10.143/group/project#123"}
PullRequestOperationError (operation: detail)
> PullRequestProviderError (provider: gitlab, operation: getChangeRequest, reason: failed)
> GitLabCliCommandError (operation: execute, command: glab)
> VcsProcessExitError (argumentCount: 2, exitCode: 1, stderrLength: 272, failureKind: command-failed)
# The thread's PR link in statev2.sqlite: the host has no port, the url does
{"host":"10.129.10.143","repository":"group/project","number":123,"url":"http://10.129.10.143:9999/group/project/-/merge_requests/123","source":"created"}
# The same glab read, rerun by hand in the checkout
$ GITLAB_HOST=10.129.10.143 glab api 'projects/group%2Fproject/merge_requests/123'
ERROR Get "https://10.129.10.143/api/v4/projects/group%2Fproject/merge_requests/123": dial tcp 10.129.10.143:443: connect: connection refused.
$ GITLAB_HOST=10.129.10.143:9999 glab api 'projects/group%2Fproject/merge_requests/123'
# exit 0: state=merged, merged_at=2026-11-21T11:06:12Z, head_pipeline.status=success
# An earlier watch on another MR in the same project ended the same way: 8 minutes, wakes 0, reads 0.
Related issues
#16463 (self-hosted GitLab MR links fail when SSH and API hostnames differ; that one is a different hostname, this one is a dropped port) and #39655 (Add to another machine drops the port for the same kind of GitLab, in a different code path) are close but not duplicates. #22342 is why glab's error never reached the trace.
Fix applied or workaround
Nothing was changed on the machine during triage. The reporter now tells their agents to wait on merge requests with their own mr-wait script, which calls glab directly, instead of T3 Code's built-in watch_pull_request.
Filed by
Claude Code (Claude Opus 5.5, claude-opus-5-5) via t3 triage
[!NOTE] 🤖 Claude Opus 5.5 responding on behalf of ahmedisam99
The same dropped port also stops "Auto-settle merged threads" for these threads: the server never records that the MR merged.
PullRequestSyncReactor keeps each linked PR's snapshot current through getChangeRequestSummary. On GitLab that calls the same getMergeRequestDetail with the port-less host (GitLabPullRequestProvider.ts#L335-L344). Every sync failed, so the link's snapshot stayed null. resolveAutoSettlementAt returns early whenever a link has no snapshot (ThreadSettlementService.ts#L224). Auto-settle on merge is on (the default, not overridden in the server's settings.json), yet the thread stayed active after the MR merged at 11:06:12.
# server.trace.ndjson, PullRequestSyncReactor.sweep "pull request sync skipped", per MR (UTC, 2026-11-21)
11x 10.129.10.143/group/project#123 | Pull request operation summary failed: GitLab CLI command failed. | 10:42:54 -> 11:52:37
10x 10.129.10.143/group/project#122 | Pull request operation summary failed: GitLab CLI command failed. | 10:40:49 -> 12:02:37
# statev2.sqlite: every PR link on this host (3) has snapshot: null
#39282 (closed) had the same symptom, GitLab MRs that never sync so auto-settle never fires, but from a different cause: a host with no T3 project.