feat(source-control): detect outdated GitHub CLI instead of "Not authenticated"#3808
feat(source-control): detect outdated GitHub CLI instead of "Not authenticated"#3808Noisemaker111 wants to merge 3 commits into
Conversation
…enticated" When `gh` is installed but predates `gh auth status --json` (added in gh v2.81.0, cli/cli#11544), the server's auth probe can't be parsed, so the Source Control settings row shows a misleading "Not authenticated" — even though the user is signed in. Running `gh auth login` never clears it. Add an "outdated" source-control auth status: - contracts: new `outdated` literal on SourceControlProviderAuthStatus - server: thread the CLI `--version` output and host platform into parseAuth; the GitHub provider classifies the unknown-`--json`-flag / sub-2.81.0 case as outdated and puts an OS-appropriate upgrade command in `detail` - web: red version number + "Outdated CLI" badge + a copyable upgrade command Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ommand
- UpgradeCommandLine: `navigator.clipboard` is undefined in non-secure contexts
and some embedded webviews, so the copy handler threw. Guard it and fall back
to a hidden-textarea `execCommand("copy")`, only showing "Copied" on success.
- gitHubCliUpgradeCommand: return null for platforms without a known package
manager (freebsd, openbsd, sunos, aix) instead of an `apt` command that can't
run there; the row then shows the generic "update it" guidance with no
command line. Adds a regression test for the freebsd case.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| // A `gh` too old for `auth status --json` can't be parsed here, so the probe | ||
| // looks like a sign-out even when the user is authenticated. Surface it as an | ||
| // outdated CLI, with the platform-appropriate upgrade command in `detail`. | ||
| if (!authStatus.parsed && isOutdatedGitHubCli(input)) { |
There was a problem hiding this comment.
🟠 High sourceControl/GitHubSourceControlProvider.ts:105
parseGitHubAuth now returns status: "outdated" when the installed gh is too old, but the readiness checks in CommandPalette.tsx and GitActionsControl.tsx only gate on "unauthenticated" and treat every other status as ready. So a user with an outdated, signed-out gh sees GitHub marked usable, and pull-request actions are incorrectly enabled — they fail at runtime instead of being blocked up front. Either add "outdated" to the set of statuses that block readiness, or document why it should be treated as ready.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/sourceControl/GitHubSourceControlProvider.ts around line 105:
`parseGitHubAuth` now returns `status: "outdated"` when the installed `gh` is too old, but the readiness checks in `CommandPalette.tsx` and `GitActionsControl.tsx` only gate on `"unauthenticated"` and treat every other status as ready. So a user with an outdated, signed-out `gh` sees GitHub marked usable, and pull-request actions are incorrectly enabled — they fail at runtime instead of being blocked up front. Either add `"outdated"` to the set of statuses that block readiness, or document why it should be treated as ready.
…ated An `outdated` CLI can't confirm sign-in, but the readiness checks only gated on `unauthenticated`, so GitHub was marked usable and pull-request / publish / add-project actions were enabled and then failed at runtime. Treat `outdated` as not-ready (with an "update it" hint) in all three readiness paths: - CommandPalette add-project readiness - GitActionsControl publish readiness - client-runtime add-project remote readiness Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
feat(source-control): detect outdated GitHub CLI instead of "Not authenticated"
Problem
When the server's
ghpredatesgh auth status --json(gh v2.81.0, cli/cli#11544), the auth probe fails withunknown flag: --jsonand the Source Control row shows a misleading "Not authenticated" even though the user is signed in.gh auth loginnever clears it.What this does
Adds an
outdatedsource-control auth status and surfaces it clearly instead of faking a sign-out.Contracts —
packages/contracts/src/sourceControl.tsoutdatedliteral onSourceControlProviderAuthStatus.Server
SourceControlProviderDiscovery.ts: thread the CLI--versionoutput and hostplatform(via the existing ambientHostProcessPlatformreference) intoparseAuthas optional fields — no change toprobeSourceControlProvider's public signature, and existingparseAuthcallers/tests keep compiling.GitHubSourceControlProvider.ts: classify theunknown flag: --json/ sub-2.81.0case asoutdated, and put an OS-appropriate upgrade command inauth.detail(brew upgrade gh/winget upgrade --id GitHub.cli/sudo apt … gh). Version compare reuses@t3tools/shared/semver.Web —
apps/web/src/components/settings/SourceControlSettings.tsxauth.status === "outdated".Screenshot
Testing
GitHubSourceControlProvider.test.tsfor both detection paths: the--jsonflag rejection, and the version-gate fallback (with per-platform command assertions).pnpm typecheck+ tests. I followed existing patterns (ambientHostProcessPlatformusage, Effect.genin the probe pipe) but haven't compiled locally.Deliberately out of scope (separate follow-up PR, if you want it)
ScopedThreadRef/project-scoped, and the Settings page only has anenvironmentId, so wiring a run button there is a larger cross-cutting change.Note
Detect outdated GitHub CLI and surface platform-specific upgrade command in source control settings
'outdated'auth status to the source control contract, returned whenghis too old (below v2.81.0) or rejects the--jsonflag, instead of treating the state as unauthenticated.isOutdatedGitHubCli,parseGitHubCliVersion, andgitHubCliUpgradeCommandhelpers inGitHubSourceControlProvider.tsto detect the outdated condition and map the host platform to a specific upgrade command (brew,winget, orapt).SourceControlProviderDiscovery.tstoparseAuthso providers can produce the new status.SourceControlSettings.tsxwhen auth status is'outdated'.📊 Macroscope summarized c529532. 4 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.