fix(github): self-heal a stale cached installation token on read-path GitHub calls - #8995
Conversation
… GitHub calls fetchPullRequestFreshness minted an installation token and fed the (possibly-stale, shared-cache) token straight into fetchLivePullRequestResult with no retry, so a single 401 was classified status: "stale", reason: "unavailable" -- failing the reopen-guard/gate-override re-check closed for what every write helper transparently retries via withInstallationTokenRetry (JSONbored#6191). Route the shared backfill.ts read helpers (fetchLivePullRequestResult, fetchLiveIssueState, fetchLivePullRequestHeadSha) through withInstallationTokenRetry when given an installationId: a 401 then evicts the stale token, re-mints once, and succeeds. Public-token / no-installation reads omit the id and fetch with the passed token exactly as before. fetchPullRequestFreshness passes the id only when it actually holds an installation token. Closes JSONbored#8892
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8995 +/- ##
==========================================
+ Coverage 90.56% 90.88% +0.32%
==========================================
Files 96 98 +2
Lines 22490 23912 +1422
Branches 3884 4442 +558
==========================================
+ Hits 20367 21732 +1365
- Misses 1945 1952 +7
- Partials 178 228 +50
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-26 15:47:25 UTC
Review summary Nits — 4 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
fix(github): self-heal a stale cached installation token on read-path GitHub calls
fetchPullRequestFreshness minted an installation token and fed the
(possibly-stale, shared-cache) token straight into fetchLivePullRequestResult
with no retry, so a single 401 was classified status: "stale", reason:
"unavailable" -- failing the reopen-guard/gate-override re-check closed for
what every write helper transparently retries via withInstallationTokenRetry
(#6191).
Route the shared backfill.ts read helpers (fetchLivePullRequestResult,
fetchLiveIssueState, fetchLivePullRequestHeadSha) through
withInstallationTokenRetry when given an installationId: a 401 then evicts the
stale token, re-mints once, and succeeds. Public-token / no-installation reads
omit the id and fetch with the passed token exactly as before.
fetchPullRequestFreshness passes the id only when it actually holds an
installation token.
Closes #8892
Validation
Verified locally on this branch before opening:
npm run typechecknpx turbo run build:tsc build:verifynpm run test:coverage— patch coverage 100.0% of changed lines