Skip to content

Commit 0d62163

Browse files
t3dotggclaude
andcommitted
fix(server): old gh versions no longer report as signed out
gh added `auth status --json` in 2.81.0. Older versions reject the flag, and the probe read that as "not authenticated". Now they get a clear "update gh" hint instead, shown in Settings -> Source Control. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent 3c06655 commit 0d62163

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

‎apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,3 +381,18 @@ it("reports unauthenticated when GitHub JSON has accounts but none are valid", (
381381
},
382382
);
383383
});
384+
385+
it("reports an update hint instead of unauthenticated when gh predates --json", () => {
386+
const auth = GitHubSourceControlProvider.discovery.parseAuth(
387+
processResult("", {
388+
stderr: "unknown flag: --json\n\nUsage: gh auth status [flags]\n",
389+
exitCode: ChildProcessSpawner.ExitCode(1),
390+
}),
391+
);
392+
393+
assert.strictEqual(auth.status, "unknown");
394+
assert.match(
395+
Option.getOrElse(auth.detail, () => ""),
396+
/2\.81\.0/,
397+
);
398+
});

‎apps/server/src/sourceControl/GitHubSourceControlProvider.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ function parseGitHubAuth(input: SourceControlAuthProbeInput) {
6767
});
6868
}
6969

70+
// gh gained `auth status --json` in 2.81.0. Older versions reject the flag and exit
71+
// non-zero, which reads exactly like a signed-out CLI. Name the real problem instead.
72+
if (input.exitCode !== 0 && output.includes("unknown flag: --json")) {
73+
return providerAuth({
74+
status: "unknown",
75+
detail:
76+
"GitHub CLI is too old to report sign-in status. Update `gh` to 2.81.0 or newer (for example `brew upgrade gh`) and rescan.",
77+
});
78+
}
79+
7080
if (input.exitCode !== 0) {
7181
return providerAuth({
7282
status: "unauthenticated",

‎apps/web/src/components/settings/SourceControlSettings.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,10 @@ function itemSummary({
240240
</span>
241241
);
242242
}
243+
const authDetail = optionLabel(auth.detail);
243244
return (
244245
<span>
245-
Could not verify {item.label}. {item.installHint}
246+
Could not verify {item.label}. {authDetail ?? item.installHint}
246247
</span>
247248
);
248249
}

‎docs/user/source-control.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials.
6767

6868
### For GitHub (Recommended for most users)
6969

70-
1. Install the GitHub CLI on the machine running T3 Code:
70+
1. Install the GitHub CLI (version 2.81.0 or newer) on the machine running T3 Code:
7171
```bash
7272
brew install gh
7373
```
@@ -140,6 +140,7 @@ Control settings**.
140140
**Common issues:**
141141

142142
- **Provider shows "Not authenticated"** – Run the login command for that provider (e.g., `gh auth login`) in a terminal on the server, then rescan in Settings
143+
- **GitHub says it could not verify sign-in status** – T3 Code needs GitHub CLI 2.81.0 or newer to check sign-in status. Update `gh` (e.g., `brew upgrade gh`), then rescan
143144
- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted
144145
- **Can't push to a remote** – Verify your Git remote URL matches the provider you've authenticated with (SSH vs HTTPS remotes may need different credentials)
145146

0 commit comments

Comments
 (0)