fix(github): classify access, network and server failures; cancel a listing promptly #154

Merged
james.maes merged 2 commits from fix/153-failure-classification into main 2026-11-10 21:39:19 +00:00
2 Commits
Author SHA1 Message Date
james.maesandClaude Fable 5.2 d6750699b6 fix(github): address the independent review of the failure mapping
The caller's cancellation is decided once; 429 is a rate limit and a
proxy's 407 is unavailable; messages take GitHub's reason only from a JSON
answer and describe a network failure by its kind, never by the platform's
text; an abandoned request's late failure is observed; a final state counts
only once the caller's progress took it; help texts and docs match.

Refs #153

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
2026-11-10 15:38:52 -06:00
james.maesandClaude Fable 5.2 a19f741afc fix(github): classify access, network and server failures; cancel a listing promptly
The listers translated a rejected token, rate limits and "not found".
Everything else escaped as a raw exception: a refusal of access (403, an
organization that enforces SAML single sign-on, for example), an error on
GitHub's side (5xx), a network failure, and a request that timed out. The
CLI reported those as exit code 70, a bug in gclo, and the desktop app
took a timed-out organization lookup for a superseded one and showed
nothing.

- GitHubFailures is the one mapping both listers use. 403 (and 451) is
  Forbidden, with GitHub's own reason in the message; 5xx, a network
  failure and a timeout are the new GitHubAccessKind.Unavailable. A
  failure it does not know stays what it is.
- The CLI maps Unavailable to exit code 4 (retry later). For these cases
  the exit code changes from 70 to 3 or 4.
- Each gateway request is awaited with the caller's token, so Ctrl+C
  during a request that hangs no longer waits for the HTTP timeout. A
  cancellation the caller did not ask for is a timeout.
- OrgSyncEngine reports through RunProgress, which drops whatever arrives
  for a repository after its final state in the run. A git operation
  abandoned on cancel keeps reporting transfer progress; a row that said
  Canceled could go back to "Cloning 40%", and the CLI could print a
  progress line after the summary.

README.md listed a rejected token under exit code 2; its table now has
3, 4 and 70 as docs/CLI.md does.

Closes #153

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
2026-11-10 15:33:26 -06:00