Rewrite GitHub ingest from gh subprocess to octocrab #34
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-05-15T07:19:45Z - https://github.com/coilysiren/repo-recall/issues/173
Problem
The GitHub ingest layer shells out to
ghfor every API call, which makes error categorization (#164, #165), rate-limit backoff (#164), and cache-failure handling (#166) painful and stringly-typed. Stderr-parsing theghexit path also obscures HTTP status codes and rate-limit headers that octocrab exposes natively.While scoping this work I also found that
AGENTS.md's "nevergh {issue,pr,repo,search} list" rule (because they route through GraphQL under the hood) is being violated in three live sites - same class as the closed #124 and #129. Folding the cleanup into this rewrite since the call sites all move to octocrab anyway.Where
ghsubprocess sites that move to octocrab REST:/repos/X/issues?state=open/repos/X/pulls/repos/X/actions/runsci_status- currentlygh run list(GraphQL) →/repos/X/actions/runs?branch=Y&per_page=1fetch_deploy_health- currentlygh run list(GraphQL) →/repos/X/actions/workflows/W/runsfetch_pr_and_issue_counts- duplicates pulls.rs + issues.rs, collapses into themmy_gh_login-/userfetch_active_repos- currentlygh repo list(GraphQL) →/user/reposgh_health- replaced by startup auth probe (see below)ghsubprocess sites that move to octocrab GraphQL:octocrab.graphql(...), sanctioned perAGENTS.mdghsubprocess sites that stay (not API calls):gh repo cloneis git-over-HTTPS. Replacement is a separate decision.Auth
Read
gh auth tokenonce at startup, pass toOctocrab::builder().personal_token(...).build(). Empty token → build anonymous client + emit a startup warning + surface the newRemoteFetchState::Unconfiguredvariant on every remote column. Matches today's "best-effort, don't break the dashboard" stance.Closes
x-ratelimit-*headers, so a smallRateLimitGatekeyed on the shared client makes this trivial.RemoteFetchState::{Ok, Missing, Unauthorized, RateLimited, Error}enum at src/ingest/github/fetch_state.rs gets fed by typedoctocrab::Errorinstead of stderr-string-parsing. Adds the missing pill renderer in src/display/routes/templates.rs.Related
Plan
Six commits, one per discrete step, each closing its own follow-up issue under this umbrella:
octocrab+ sharedOctocrabclient inAppState(sourcesgh auth token, surfaces empty-token warning +Unconfiguredvariant).issues.rs, classifier upgrade closes #165.pulls.rs.ci_runs.rs.git/log.rsGitHub call sites (closes the AGENTS.md GraphQL-leak finding above; collapsesfetch_pr_and_issue_countsinto the dedicated modules).labeled.rstooctocrab.graphql()+ addRateLimitGate, closes #164.Test fixtures
Already collected. Live under
tests/fixtures/github/(rest captures, error synthetics, GraphQL synthetics) with re-runnablecapture.sh. Seetests/fixtures/README.md.