Skip to content

fix: consider 401 errors as trasient#4194

Merged
mbani01 merged 1 commit into
mainfrom
fix/enricher_error_categorization
Jun 10, 2026
Merged

fix: consider 401 errors as trasient#4194
mbani01 merged 1 commit into
mainfrom
fix/enricher_error_categorization

Conversation

@mbani01

@mbani01 mbani01 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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:

  • Updated the graphqlRequest function in fetchActivitySnapshot.ts to throw a FetchError with type 'TRANSIENT' instead of 'AUTH' for 401 Unauthorized responses, aligning with the intended classification of these errors as potentially temporary.
  • Updated the fetchLightRepo function in fetchLightRepo.ts to throw a FetchError with 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 (graphqlRequest in fetchActivitySnapshot.ts and fetchLightRepo), instead of AUTH.

That matters because fetchWithRetries marks AUTH as permanent (skip_enrichment), while TRANSIENT errors 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 remain AUTH. fetchLightRepo adds 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.

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 self-assigned this Jun 10, 2026
Copilot AI review requested due to automatic review settings June 10, 2026 17:03
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fetchLightRepo as FetchError('TRANSIENT', ...) and add an explanatory comment.
  • Reclassify GraphQL 401 in fetchActivitySnapshot as FetchError('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.

@mbani01 mbani01 merged commit ac895e0 into main Jun 10, 2026
19 checks passed
@mbani01 mbani01 deleted the fix/enricher_error_categorization branch June 10, 2026 17:19
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.

3 participants