Skip to content

fix(github): auto-refreshing installation token + mention resolution backoff - #143

Closed
xiaoland wants to merge 1 commit into
mainfrom
fix/github-token-refresh
Closed

xiaoland wants to merge 1 commit into
mainfrom
fix/github-token-refresh

Conversation

@xiaoland

Copy link
Copy Markdown
Owner

Found by live acceptance on v0.3.0: after the installation token expired (1h), all GitHub API calls failed 401 permanently (401 → outbox 'rejected', mentions never resolved) until restart, plus a ~4rps hot retry loop. Fix: build the installation client via app.installation(id) (octocrab CachedToken auto-refresh) and add exponential backoff to mention-authority resolution. Verified: fmt/check/clippy/test green.

…backoff

Found by live acceptance: one hour after serve start, every GitHub API call
began failing 401 'Bad credentials' — the installation client was built once
with a fixed personal_token (installation tokens expire after 1h) and never
refreshed, silently wedging mention resolution, reactions, and the write
outbox. The client now uses octocrab's installation auth state, which caches
and refreshes tokens with an expiry buffer.

Also: mention-authority resolution retried every 250ms tick on persistent
failure (~4 rps against a dead credential); it now backs off exponentially
(2s doubling to a 60s cap) and stops iterating the batch on first error.
@xiaoland

Copy link
Copy Markdown
Owner Author

Superseded: commit cherry-picked into #142 (single acceptance-fix PR).

@xiaoland xiaoland closed this Aug 31, 2026
@xiaoland
xiaoland deleted the fix/github-token-refresh branch August 31, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant