Skip to content

[Bug] [Studio] GitHub Crawler retries indefinitely on 401 Unauthorized #5325

Closed

Description

@SgtPooki

Description

The GitHub Crawler step in Studio's data-recipe runner treats 401 Unauthorized from the GitHub GraphQL API as a transient network error and keeps retrying. The token is invalid, so every retry returns 401. The job stays alive doing this until the user notices and cancels it manually.

Sample log from a stuck run:

[8:10:23 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.
[8:10:31 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.
[8:10:47 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.
[8:11:19 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.
[8:12:19 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.
[8:13:19 AM] [WARNING] GraphQL network error: 401 Client Error: Unauthorized for url: https://api.github.com/graphql. Retry.

Impact

Recipes silently burn time + GitHub API budget after a token rotation, expiry, or scope mismatch. The user sees [WARNING] lines instead of a clear failure, then has to dig through logs to realize the token is bad.

Expected Behavior

401 Unauthorized (and 403 Forbidden from the GraphQL endpoint that does not include X-RateLimit-Remaining: 0) should fail the job immediately with a message that names the failing token source: recipe-level field, GH_TOKEN, or GITHUB_TOKEN.

Actual Behavior

Both 401 and 403-non-rate-limit are caught by the same Retry. path used for genuinely transient network errors, with no upper bound visible to the user.

Environment

  • Image: unsloth/unsloth:latest (digest sha256:d0a8d4fe2145…6c5ea0, pulled 2026-05-06)
  • Studio data-recipe runner using data-designer-github-repo-seed plugin
  • GraphQL client: python-graphql-client / requests, going through https://api.github.com/graphql

Additional Context

The trigger in our case was a recipe that had its seed_config.source.token field populated with a token that was later revoked. The pod's GH_TOKEN env var was valid, but the recipe-level token took precedence and was the one returning 401. Behavior would be the same on any expired or scope-stripped token.

Suggested fix locations: data_designer_github_repo_seed/scraper_impl/gh_client.py retry decorator, plus whatever wrapper calls requests.post(.../graphql). Stopping on response.status_code == 401 and surfacing response.headers.get("X-GitHub-Request-Id") would be enough.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions