Skip to content

fix: surface GitHub auth failures and allow skipping repo creation#462

Open
shannah wants to merge 1 commit into
masterfrom
claude/sleepy-thompson-sl3q4
Open

fix: surface GitHub auth failures and allow skipping repo creation#462
shannah wants to merge 1 commit into
masterfrom
claude/sleepy-thompson-sl3q4

Conversation

@shannah

@shannah shannah commented May 31, 2026

Copy link
Copy Markdown
Owner

Summary

This is the CLI-side half of a two-PR fix for the GitHub "Bad credentials" (HTTP 401) problem reported in shannah/jdeploy-desktop-gui#80, where the desktop GUI fails to create a project with a 401 and never offers a way to fix the credentials. The companion GUI PR is shannah/jdeploy-desktop-gui (branch claude/sleepy-thompson-sl3q4).

These changes make the CLI's GitHub integration easier to recover from and less destructive on failure.

Changes

  1. Typed authentication failure — new GitHubAuthenticationException (a subclass of IOException, so existing catch (IOException) callers are unaffected). GitHubRepositoryInitializer.createGitHubRepository() and GitHubUsernameService.getGitHubUsername() now throw it on HTTP 401, so callers (e.g. the desktop GUI) can distinguish an invalid/expired token from other I/O errors and prompt the user to re-authenticate.

  2. Optional repository creation — added a createGitHubRepository flag to ProjectGeneratorRequest/ProjectGeneratorRequestBuilder (defaults to true, so existing behaviour is unchanged). When false, ProjectGenerator skips the POST /user/repos call and uses the repository purely as a push target. This lets a project target an already-existing repo without attempting to create it.

  3. Rollback on failureProjectGenerator.generate() now deletes the freshly-created project directory (and its -releases sibling) if generation fails after the directory was created. Previously a failed attempt (e.g. a 401 during repo creation) left the directory on disk, which then tripped the "Project directory already exists" check on the next attempt.

Testing

  • mvn -pl shared,cli -am install — builds cleanly.
  • mvn -pl cli test (integration tests skipped) — passes.

Existing behaviour is preserved: the new flag defaults to true and the new exception is an IOException subtype.

https://claude.ai/code/session_0156xouo4EmaKjSihdHSDXxF


Generated by Claude Code

- Throw GitHubAuthenticationException (an IOException subtype) on HTTP 401
  in GitHubRepositoryInitializer and GitHubUsernameService so callers can
  distinguish bad/expired credentials from other I/O errors.
- Add a createGitHubRepository flag to ProjectGeneratorRequest (default
  true) and honor it in ProjectGenerator so an existing repository can be
  used as a push target without attempting to create it.
- Roll back the freshly-created project directory (and its -releases
  sibling) when generation fails, so a failed attempt doesn't leave a
  directory behind that blocks retrying.

https://claude.ai/code/session_0156xouo4EmaKjSihdHSDXxF
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.

2 participants