Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(server): outdated gh no longer reads as "not authenticated" (#7588)

Theo Browne51341f2ac1e2
diff --git a/apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts b/apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts
index 9e8a68295..1381271e6 100644
--- a/apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts
+++ b/apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts
@@ -381,3 +381,18 @@ it("reports unauthenticated when GitHub JSON has accounts but none are valid", (
},
);
});
+
+it("reports an update hint instead of unauthenticated when gh predates --json", () => {
+ const auth = GitHubSourceControlProvider.discovery.parseAuth(
+ processResult("", {
+ stderr: "unknown flag: --json\n\nUsage: gh auth status [flags]\n",
+ exitCode: ChildProcessSpawner.ExitCode(1),
+ }),
+ );
+
+ assert.strictEqual(auth.status, "unknown");
+ assert.match(
+ Option.getOrElse(auth.detail, () => ""),
+ /2\.81\.0/,
+ );
+});
diff --git a/apps/server/src/sourceControl/GitHubSourceControlProvider.ts b/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
index b5d5d3a55..3dcc8ab82 100644
--- a/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
+++ b/apps/server/src/sourceControl/GitHubSourceControlProvider.ts
@@ -67,6 +67,16 @@ function parseGitHubAuth(input: SourceControlAuthProbeInput) {
});
}
+ // gh gained `auth status --json` in 2.81.0. Older versions reject the flag and exit
+ // non-zero, which reads exactly like a signed-out CLI. Name the real problem instead.
+ if (input.exitCode !== 0 && output.includes("unknown flag: --json")) {
+ return providerAuth({
+ status: "unknown",
+ detail:
+ "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.",
+ });
+ }
+
if (input.exitCode !== 0) {
return providerAuth({
status: "unauthenticated",
diff --git a/apps/web/src/components/settings/SourceControlSettings.tsx b/apps/web/src/components/settings/SourceControlSettings.tsx
index 55da45247..a43c11646 100644
--- a/apps/web/src/components/settings/SourceControlSettings.tsx
+++ b/apps/web/src/components/settings/SourceControlSettings.tsx
@@ -240,9 +240,10 @@ function itemSummary({
</span>
);
}
+ const authDetail = optionLabel(auth.detail);
return (
<span>
- Could not verify {item.label}. {item.installHint}
+ Could not verify {item.label}. {authDetail ?? item.installHint}
</span>
);
}
diff --git a/docs/user/source-control.md b/docs/user/source-control.md
index c64a63f7b..916536bbe 100644
--- a/docs/user/source-control.md
+++ b/docs/user/source-control.md
@@ -67,7 +67,7 @@ Run a quick **Rescan** after setting up a new machine or changing credentials.
### For GitHub (Recommended for most users)
-1. Install the GitHub CLI on the machine running T3 Code:
+1. Install the GitHub CLI (version 2.81.0 or newer) on the machine running T3 Code:
```bash
brew install gh
```
@@ -140,6 +140,7 @@ Control settings**.
**Common issues:**
- **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
+- **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
- **Bitbucket not connecting** – Double-check your environment variables are set in the correct shell profile and the server was restarted
- **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)