Skip to content

[Bug]: GitLab unknown-remote probe needs the network: glab auth status hangs when a configured host is offline (VPN), stalling vcs.refreshStatus for 65s #17209

Description

@L-X-T

Note

Fable (an AI agent in T3 Code) writing on behalf of Alexander Thalhammer (@L-X-T). The diagnosis was done on his machine; he reviewed and approved this report.

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Related: #12060 (refinement is uncached and repeated on every read) and #16503 (repeated 5s glab timeouts saturate VcsProcess). This report is a different trigger with a different fix. glab is installed and logged in to the host, but the check still needs the network.

Area

apps/server

Steps to reproduce

  1. Use a self-hosted GitLab whose host name has no gitlab DNS label (here git.example.com, a placeholder for the real host), so T3 classifies the remote as unknown.
  2. Log glab in to that host (glab auth login --hostname git.example.com). In my setup gitlab.com is configured too.
  3. Make the host unreachable while DNS still resolves. Here the host is only reachable over a corporate VPN, which I often turn off.
  4. Open a project with that remote in T3 Code and use the app normally.

Expected behavior

Recognizing the remote as GitLab shouldn't need the network. While the host is offline, T3 should still return git status quickly. At most, PR info should be missing.

Actual behavior

A "Some requests are slow" toast keeps coming back with vcs.refreshStatus entries, and git status stays stale for over a minute.

  • The GitLab discovery spec sets no remoteRefinementArgs, so refineUnknownRemoteProvider falls back to authArgs, which is glab auth status.
  • glab auth status without --hostname checks every configured host over the network. For the unreachable host it waits until context deadline exceeded (about 31s when run in a terminal).
  • T3 kills it after the 5s DEFAULT_PROBE_TIMEOUT_MS. The orElseSucceed(() => null) catch then turns the timeout into "no match", so the remote stays unknown. As in Unrecognised GitHub Enterprise host re-probes fj, tea and glab once per project on every sweep #12060, that failure isn't cached, so every status refresh, PR sync sweep and identity read runs the probe again.
  • With the host reachable, the same glab auth status finishes in about 0.8s and the remote is correctly refined to GitLab Self-Hosted. The probe only fails because it needs the network.

refineUnknownGitLabRemote only needs to know whether glab has a logged-in account for the host. It doesn't need a live check. glab can answer that offline from its config:

$ time glab config get api_host --host git.example.com   # VPN off, works the same
git.example.com
0.48s total
$ glab config get api_host --host unknown.example.com
                                                       # empty output, exit 0

The Forgejo spec already does this: it sets remoteRefinementArgs: ["login", "list", ...], a local read, separate from its network auth check.

Suggested fix

  1. Give the GitLab discovery spec an offline remoteRefinementArgs, for example glab config get user --host <host> or glab config get api_host --host <host>. Refine to GitLab when the output isn't empty. This needs the probe args to accept the remote's host. Alternatively, read glab's config.yml hosts: keys directly.
  2. If the network check stays, pass --hostname <host> so one unreachable host can't block the check for others.
  3. Cache negative or timed-out refinements for a while (see Unrecognised GitHub Enterprise host re-probes fj, tea and glab once per project on every sweep #12060).

Impact

Major degradation or frequent failure. Whenever the VPN is off, every project on that host sees git status stalls of over a minute, and the slow-request toast keeps reappearing.

Version or commit

0.0.46-nightly.20261005.2689 (desktop, bundled local server)

Environment

macOS 15.8.1, Apple Silicon. glab 1.121.0 with hosts gitlab.com and git.example.com (token in keyring). 9 projects with remotes on https://git.example.com/....

Logs or stack traces

# server.trace.ndjson, back-to-back refreshes for the same environment while the host was unreachable
EnvironmentRpc.request rpc.method=vcs.refreshStatus  13:54:26.917 → 13:55:31.929  65011.7 ms
EnvironmentRpc.request rpc.method=vcs.refreshStatus  13:55:31.931 → 13:56:37.266  65335.1 ms

# same window, other remote-status consumers stalled the same way
PullRequestSyncReactor.sweep            63495 ms
ws.rpc.pullRequests.summary             63618 ms  PullRequestUnavailableError: Change requests cannot be browsed for this project's host yet.

# about 30 glab probes were killed at 5s across the 9 repos in those 65s
source-control.discovery.refine-unknown-remote: glab auth status  (timeoutMs 5000)

# glab auth status run in a terminal while the host is unreachable:
# git.example.com fails with "context deadline exceeded" after ~31s

Workaround (until this is fixed): a glab wrapper earlier on PATH turns a plain glab auth status into glab auth status --hostname gitlab.com when nc -z -G 1 git.example.com 443 fails. This makes the probe return in about 1s.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions