ovis icon indicating copy to clipboard operation
ovis copied to clipboard

PR view says gh is "not signed in" for Gitea remotes; add Gitea support

Open pnexus-wikii opened this issue 2 weeks ago • 0 comments

Summary

Two things, one bug and one feature request:

  1. Bug: on a repo whose remote is a self-hosted Gitea instance, the PR view claims "GitHub CLI (gh) on this PC is not signed in" even though gh is signed in. The message sends the user to gh auth login, which changes nothing.
  2. Feature request: support Gitea (and similar self-hosted forges) for the pull-request view, so the PR panel is not GitHub-only.

Environment

  • Ovis 0.5.4 (herdr plugin install, ~/.config/ovis/updates/.../release-eUlhw5)
  • gh 2.70.0, signed in to github.com (verified: gh auth status exits 0 inside the Ovis server process environment)
  • tea 0.15.1, signed in to the same self-hosted Gitea instance
  • Repo origin: https://git.example.com/org/repo.git (Gitea, HTTPS)

Reproduction

Open the PR view for a repo whose only remote is the Gitea host.

What Ovis runs and what gh answers (same env as the Ovis server: HOME, PATH, GH_TOKEN inherited, plus GH_PROMPT_DISABLED=1, GH_NO_UPDATE_NOTIFIER=1, GH_PAGER=cat, NO_COLOR=1, CLICOLOR=0, GIT_TERMINAL_PROMPT=0):

$ gh pr view --json number,title
none of the git remotes configured for this repository point to a known GitHub host.
To tell gh about a new GitHub host, please use `gh auth login`
$ echo $?
1

Ovis then shows:

GitHub CLI (gh) on this PC is not signed in. Run gh auth login there to see pull requests here.

Cause

server/pull-request.ts (runGh):

// gh exits 4 when it needs a sign-in; older releases only say so
if (code === 4 || /gh auth login/.test(err.text)) throw new PullRequestError("gh_signed_out", …);

gh's "not a known GitHub host" advice contains the literal string gh auth login, so the regex matches and the error is misclassified as gh_signed_out. The correct branch already exists in failure() (/none of the git remotes|no git remotes/i → no_github_remote), but runGh throws first, so it is unreachable for this case.

Suggested bug fix

  • In runGh, classify "none of the git remotes … known GitHub host" as no_github_remote before the signed-out check, e.g. exclude that stderr text from the /gh auth login/ heuristic, or only treat it as signed out on exit code 4 (and on the classic "To get started with GitHub CLI, please run: gh auth login" text).
  • Optionally pre-check git remote -v for a github.com host and return no_github_remote directly, so the panel can say "this repo is not on GitHub" instead of invoking gh at all.

That alone would make the existing message honest. The feature request below is the more useful outcome.

Feature request: Gitea PR support

Please make the PR panel forge-aware instead of GitHub-only:

  • Detect the remote host from git remote -v (or the existing repo metadata) and pick a backend:
    • github.com → current gh path (unchanged).
    • A configured Gitea host → use the Gitea REST API (/api/v1/repos/{owner}/{repo}/pulls/...) or the tea CLI when present, reusing the token from tea's config (tea login list) or a dedicated Ovis setting.
  • Same panel shape: PR title/state/checks/review status, open in browser, and merge if feasible.
  • When no backend is configured for the host, show "No PR provider configured for " rather than a gh sign-in hint.

tea already handles auth and API for Gitea, so a first iteration could shell out to it (mirroring the existing gh subprocess pattern and its timeouts/caps) before adding native API calls. Per-host configuration matters here: users often work across github.com and one or more self-hosted Gitea instances in the same session.

Happy to test a build against a live Gitea 1.2x instance.

pnexus-wikii avatar Nov 17 '26 09:11 pnexus-wikii