fix: consider 401 errors as trasient#4194
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
|
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
Updates GitHub packages worker enricher error classification so HTTP 401 Unauthorized responses are treated as transient (retryable) rather than auth/permanent, preventing repos from being permanently marked skip_enrichment due to temporary/token-related 401s.
Changes:
- Reclassify REST/GraphQL 401 in
fetchLightRepoasFetchError('TRANSIENT', ...)and add an explanatory comment. - Reclassify GraphQL 401 in
fetchActivitySnapshotasFetchError('TRANSIENT', ...).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| services/apps/packages_worker/src/enricher/fetchLightRepo.ts | Treats 401 as transient to enable retries (instead of permanently skipping repos), and documents rationale. |
| services/apps/packages_worker/src/enricher/fetchActivitySnapshot.ts | Aligns 401 handling with transient classification for snapshot GraphQL requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request updates the error handling logic for HTTP 401 Unauthorized responses in two files to better categorize these errors as transient rather than authentication-specific. This change improves the way the system handles authentication failures, particularly by treating them as temporary issues that may resolve without user intervention.
Error handling improvements:
graphqlRequestfunction infetchActivitySnapshot.tsto throw aFetchErrorwith type'TRANSIENT'instead of'AUTH'for 401 Unauthorized responses, aligning with the intended classification of these errors as potentially temporary.fetchLightRepofunction infetchLightRepo.tsto throw aFetchErrorwith type'TRANSIENT'for 401 Unauthorized responses and added a clarifying comment explaining that 401 errors are typically due to requester or platform issues, not repository-specific problems.Note
Medium Risk
Changes enrichment failure classification so 401s no longer permanently skip repos; behavior is limited to two fetch paths but affects queue/retry outcomes.
Overview
HTTP 401 from GitHub is now treated as transient in the packages worker enricher’s GraphQL helpers (
graphqlRequestinfetchActivitySnapshot.tsandfetchLightRepo), instead ofAUTH.That matters because
fetchWithRetriesmarksAUTHas permanent (skip_enrichment), whileTRANSIENTerrors are retried with backoff. A 401 (bad/expired token or GitHub-side auth glitch) should not permanently disqualify a repo.403 handling is unchanged: rate limits still map to
RATE_LIMIT, and other 403s remainAUTH.fetchLightRepoadds a short comment that 401 reflects requester/platform issues, not repository access.Reviewed by Cursor Bugbot for commit 7a25dd3. Bugbot is set up for automated code reviews on this repo. Configure here.