* fix(gh_client): fail fast on 401/403 auth errors instead of retrying forever (#5325) Fixes #5325. The Studio data-recipe GitHub Crawler swallows 401 Unauthorized (and 403 Forbidden without rate-limit headers) into the generic "network error" retry path, so a job with a stale or wrong-scoped GitHub token spins indefinitely emitting "Retry." lines until the user cancels. Changes: - Add GitHubAuthError. Raised on 401, and on 403 unless the response carries a clear rate-limit signal (Retry-After header for secondary limits, or X-RateLimit-Remaining: 0 for primary limits). - Track which token source resolved at construction time: explicit argument (recipe-level field), GH_TOKEN, or GITHUB_TOKEN. Surfaced in the error message so the user knows which credential to rotate. - Insert the auth-failure check before the existing 403/429 rate-limit branch in both .graphql() and .rest() so auth failures bypass the sleep-and-retry loop and abort the recipe immediately. Genuine rate limiting still retries via the existing path. requests.RequestException handling is unchanged because GitHubAuthError does not inherit from it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * style: apply black formatting per pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix GitHub auth failure handling Preserve GitHub token source through the repo seed scraper and fail fast on non-rate-limit auth errors while keeping genuine rate-limit retries. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Wasim Yousef Said <wasimysdev@gmail.com> |
||
|---|---|---|
| .. | ||
| src/data_designer_github_repo_seed | ||
| pyproject.toml | ||
| README.md | ||
data-designer-github-repo-seed
A Data Designer seed-reader plugin for Unsloth Studio that scrapes real GitHub data (issues, pull requests, commits) from one or more repositories and hands it to the recipe pipeline as a seed dataset.
Designed to ship with Studio as a default seed source so any user with a GitHub token can build training datasets straight from live repos.
What it does
Given a list of owner/name repos, a GitHub token, and a per-resource
limit, the plugin uses GitHub's GraphQL API to fetch issues, pull
requests, and/or commits, with labels, state, authors, and the first N
comments of each item, and materialises a single JSONL with uniform
columns so the rest of the recipe (LLM text / LLM structured / processors)
can treat it like any other seed table.
| Column | Description |
|---|---|
item_type |
issue / pull / commit |
repo |
owner/name |
number |
Issue/PR number, or commit SHA |
title |
Title (or commit message headline) |
body |
Issue/PR body (or full commit message) |
state |
OPEN / CLOSED / MERGED (empty for commit) |
author |
GitHub login of the author |
created_at |
ISO8601 |
closed_at |
ISO8601 (empty for commits) |
url |
Permalink |
labels |
List of label names |
comments |
First N comments concatenated |
Usage in a recipe
{
"seed_config": {
"source": {
"seed_type": "github_repo",
"repos": ["unslothai/unsloth", "unslothai/unsloth-zoo"],
"token": "",
"item_types": ["issues", "pulls"],
"limit": 100,
"include_comments": true,
"max_comments_per_item": 30
},
"sampling_strategy": "shuffle",
"selection_strategy": null
}
}
Leave token empty to fall back to the server's GH_TOKEN / GITHUB_TOKEN
environment variable, useful when the recipe is published and shouldn't
carry a secret.
Auth
A GitHub personal access token with public_repo scope is enough for public
repositories; repo scope is required for private ones. GraphQL requests
are rate-limit aware: the client inspects x-ratelimit-* headers and
sleeps until reset when the budget drops below a safety threshold.
Install
Shipped as a default Studio plugin. For development:
pip install -e .
Registered automatically via the data_designer.plugins entry point.