Skip to content

Source Control settings: probe forge readiness up front, not from stderr after a failure #608

Closed

Description

@currentbits

What T3 does

T3 discovers every forge provider up front and reports readiness as data, not as a surprise at the moment you click something. SourceControlDiscovery returns a sourceControlProviders[] with {kind, label, status, installHint, auth: {status, detail}}; Settings -> Source Control renders it as a list of "authenticated and ready / what is missing and how to fix it / which account is signed in", plus a Rescan button (docs/user/source-control.md).

That data then gates the UI. buildAddProjectRemoteSourceReadiness (packages/client-runtime/src/operations/projects.ts:127) turns discovery into Record<source, {ready, hint}>: a provider that is missing renders with its install hint, an unauthenticated one renders with the login hint, and sortAddProjectProviderSources floats the ready ones to the top of the Add Project source list. GitHub carries a real version gate too — status checks need gh >= 2.81.0, and the failure message says so instead of saying "auth failed".

Solenta today

There is no forge probe. The only thing resembling one is a regex over command output after a failure (electron/worktrees.js:1781):

/gh auth login|GH_TOKEN|not logged into|authentication required|HTTP 401|Bad credentials/i

So we learn gh is missing or logged out only after a push, a PR create, or a planboard sync has already failed, and the user has to interpret raw stderr. There is no place in the app that answers "is my GitHub set up, and as whom".

Why it matters

Every forge feature we have or plan (#459 clone/publish, #456 Bitbucket + Azure DevOps, #193 GitLab, #363 commit-push-PR chain, #427 outage resilience, planboard sync) needs the same answer: is this provider installed, new enough, authenticated, and as which account. Without it each feature grows its own ad-hoc failure text. It is also the honest fix for first-run: #356 preflights the agent CLIs but nothing preflights gh.

This is the forge-side twin of #319 (provider auth detection against reality, not config presence) — same principle, different binary.

Scope suggestion

  • One sourceControl:discover IPC that probes each configured forge CLI: present? version? gh auth status / glab auth status / az account show? which login? Cache with an explicit Rescan.
  • Settings pane listing providers with status, account, and a copy-pasteable fix command.
  • Feed the result into the add-project source list (Clone from URL and publish a local repo in add-project #459) and disable/annotate forge actions instead of failing at click time.
  • Keep the existing stderr regex as a fallback for auth that expires mid-session, and invalidate the cache when it fires.

Activity

  1. added
    enhancement
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 20, 2026
  2. currentbits commented on Aug 20, 2026

    @currentbits
    OwnerAuthor

    Implemented in this worktree (coder/fork-source-control-settings-probe-forge-bc94fa):

    • sourceControl:discover IPC probes GitHub (gh), GitLab (glab), Azure DevOps (az + azure-devops extension), and Bitbucket env tokens. Cached until Rescan or a mid-session isGhAuthFailure hit.
    • Settings → Source Control: status, signed-in-as, copy-pasteable fix command, Rescan.
    • Create PR / checks / merge disable with the hint when GitHub is missing or signed out. Push and Commit stay on git.
    • src/sourceControl.ts exports buildAddProjectRemoteSourceReadiness / sortAddProjectProviderSources for Clone from URL and publish a local repo in add-project #459. Add Project itself is unchanged (clone source list is still that issue).
    • Existing gh stderr regex stays as the fallback and now busts the probe cache.

    GitHub 2.81.0 is the JSON gh auth status gate only. An older gh that still prints Logged in to … account NAME stays available so we do not lie about Create PR.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 20, 2026
  4. currentbits commented on Aug 20, 2026

    @currentbits
    OwnerAuthor

    Landed on main (d5fd524 + c933916).

    • electron/sourceControl.js: probes gh / glab / az up front (gh auth status --json hosts on 2.81+, text parse below that, "outdated" only when a sub-2.81 gh can't report sign-in), Bitbucket via SOLENTA_BITBUCKET_* env tokens. Cached until Rescan or an isGhAuthFailure hit busts it.
    • sourceControl:discover IPC → Settings → Source Control section (status dot, version, signed-in-as, copy-pasteable hint, Rescan).
    • Header next-git button disables Create PR / checks / merge with the hint as title when GitHub isn't set up; unknown (timed-out or unparseable) auth deliberately does NOT block — see c933916.

    Tests: electron/test/source-control.test.js (7) + test/sourceControl.test.ts, test/sourceControlSettings.test.tsx, next-git additions. Full renderer suite green (1333).

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

    enhancementplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions