| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Classify GitHub API failures (rate limit, auth, abuse detection) as blocking and short-circuit the repo scan loop and manifest download instead of swallowing them into an ok:true scan of a partial manifest set. Surface an error when every attempted repo fails so scripts do not infer success from ok:true with zero scans created.
| Back | FazBrowse Home | New Git URL |
When your GitHub token is rate-limited, socket scan github currently tells you it succeeded. It exits 0 and prints:
Nothing was uploaded. Every repo failed, and the run reported green. On a laptop that is confusing; in CI it is worse, because a pipeline step that exits 0 is a pipeline step nobody looks at. Teams can go a long time believing their repos are being scanned when no scan has happened at all.
After this change, a rate-limited, unauthorized, or abuse-throttled run stops at the first blocking error, prints what hit and — when GitHub tells us — when it resets, and exits non-zero. Genuinely empty repos with no manifests still succeed, exactly as before.
Refs ASK-167.
Why it looked like success — the status code was never readThe GitHub-API scanning path read every GitHub REST response body and JSON-parsed it without ever checking the HTTP status. When a token is rate-limited, GitHub answers with one of three shapes:
None of those parse into the JSON the code expected, so the old code read them as "repo has no default branch / no manifests". The per-repo error was then swallowed by the scan loop, and the run finished with the success lines above.
The change — classify the response, retry only what is worth retrying, stop the loop on a blocking errorNew utils/github-errors.mts holds two pieces:
Wired in at the call sites:
The success line now reads N GitHub repos processed rather than N GitHub repos detected, since "detected" was part of what made the old output read as a completed scan.
src/utils/github-errors.test.mts and src/commands/scan/create-scan-from-github.test.mts. Fake fetch and scanRepoFn are injected as plain functions rather than mocked at the module level, so the tests exercise the real decision logic.
They cover detection of 403 + remaining: 0, 429, secondary-limit and 401; Retry-After and reset parsing; the cheap-retry-then-succeed path; 5xx backoff; the loop stopping on a blocking error and returning a non-zero exit; and an empty repo still succeeding.
Ran:
Test Files 2 passed (2) Tests 25 passed (25)tsgo, eslint, and biome are clean on the changed files.
Branch scope — this is the v1.x port; main already has the equivalent fixmain already carries an equivalent Octokit-based fix, so no companion PR is needed there.
This ports the same behavior to the shipping v1.x line, adapted to its raw-apiFetch architecture.
Note
Medium Risk
Changes CLI exit semantics and GitHub request handling for a CI-facing scan path; behavior is well covered by 25 unit tests with injected fakes.
Overview
Fixes ASK-167: socket scan github no longer exits successfully when GitHub rate limits, auth failures, or abuse detection block the run.
Adds utils/github-errors.mts with classifyGitHubResponse (rate limit / auth / abuse), githubApiRequest (bounded retries for short reset windows, 5xx, and network errors), and canonical blocking error messages. Repo details, tree, commit, and contents calls use githubApiRequest; manifest download responses also run through classifyGitHubResponse.
Extracts runGithubScanLoop so multi-repo scans stop early on blocking GitHub errors, return ok: false (non-zero exit), and fail when every repo errors for non-blocking reasons instead of reporting "N repos / 0 manifests" as success. Empty repos and partial success behavior are unchanged.
Reviewed by Cursor Bugbot for commit 30806f1. Configure here.