Skip to content

fix: refresh GitLab OAuth2 token on 401 during long runs - #10

Merged
fabio-DigitalScience merged 1 commit into
mainfrom
fix/gitlab-token-refresh
Mar 3, 2026
Merged

fabio-DigitalScience merged 1 commit into
mainfrom
fix/gitlab-token-refresh

Conversation

@fabio-DigitalScience

Copy link
Copy Markdown
Collaborator

Summary

  • Long-running analyses on large GitLab groups (e.g. 638 repos) fail mid-run because the glab CLI OAuth2 token expires (~2h)
  • Adds a tokenRefresh callback to the GitLab provider that re-invokes glab auth status -t on 401 responses, retrying the request once with the fresh token
  • Only activated when the token was originally sourced from glab CLI (not for PATs or env var tokens)

Test plan

  • go test ./internal/provider/... — 3 new tests for token refresh (success, no callback, refresh failure)
  • go test ./... — all 17 packages pass
  • go vet ./... — clean
  • Full run on digital-science group (638 repos) completed with zero 401 errors

🤖 Generated with Claude Code

Long-running analyses on large GitLab groups fail mid-run because the
glab CLI OAuth2 token expires (~2h). Add a token refresh callback to
the GitLab provider that re-invokes glab CLI on 401 responses, retrying
the request once with the fresh token.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fabio-DigitalScience
fabio-DigitalScience merged commit d6522f0 into main Mar 3, 2026
1 check passed
@fabio-DigitalScience
fabio-DigitalScience deleted the fix/gitlab-token-refresh branch March 3, 2026 21:31
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