Skip to content
Source
Sign inSign up
pingdotgg/t3code

GitHub source control shows "Not authenticated" when `gh` is outdated (missing `auth status --json`) #3806

ClosedNoisemaker111(GitHub profile, opens in a new tab) opened this issue 2 comments

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

Steps to reproduce

  1. Install gh older than 2.81.0 (e.g. 2.74.2) on the machine running T3 Code.
  2. Run gh auth login, and confirm gh auth status shows you logged in.
  3. Open Settings → Source Control, then click Rescan.

Expected behavior

GitHub is reported as authenticated, since gh auth status confirms the user is signed in.

Actual behavior

GitHub shows "Not authenticated" and Rescan never clears it, even though the user is fully signed in. Because the message tells you to sign in, users run gh auth login over and over — which never helps, since the real problem is the CLI version, not the login.

Root cause: the server detects auth by running gh auth status --json hosts and parsing the JSON:

  • apps/server/src/sourceControl/GitHubSourceControlProvider.ts:91 — authArgs: ["auth", "status", "--json", "hosts"]
  • The --json flag was only added to gh auth status in gh v2.81.0 (cli/cli#11544, merged 2025-09-25).

On older gh, the command fails with unknown flag: --json (exit 1), so parseGitHubAuthStatus returns { parsed: false }, and parseGitHubAuth falls into the exitCode !== 0 branch (GitHubSourceControlProvider.ts:70) → "unauthenticated". gh --version is never consulted, and the raw error is hidden behind a generic badge — so the UI conflates "your CLI is too old" with "you're logged out," which have opposite fixes.

Impact

Major degradation or frequent failure

Version or commit

Environment

gh 2.74.2 (reproduces on any gh < 2.81.0).

Logs or stack traces

$ gh auth status --json hosts
unknown flag: --json

Screenshots, recordings, or supporting files

Before / after:

Image

Workaround

Upgrade gh to v2.81.0 or newer.


Proposed fix (implemented in a draft PR): distinguish an outdated source-control auth status from unauthenticated — when gh rejects --json (or the parsed gh --version is < 2.81.0), report outdated with an "Outdated CLI" badge instead of "Not authenticated".

  1. Independently reproduced on Linux with gh 2.45.0 (Ubuntu package), fully logged in — T3 reported auth: { status: "unauthenticated", detail: "unknown flag: --json" } while gh auth status showed the account signed in.

    Opened #3943 with a fix: an opt-in authFallbackArgs on the CLI discovery spec, retried only when the primary probe exits non-zero without resolving an account, plus a text parser for gh auth status output (handles both the current account <login> and older as <login> phrasings). Verified end-to-end against a CLI that rejects --json: status flips from unauthenticated to authenticated.

  2. the flag is almost a year old soon so i think it's fair to require users keeping their deps somewhat up to date

  3. juliusmarminge closed this

Sign in to join this conversation.