Repository navigation
fix: report a missing gh or git binary as a clean error instead of a FileNotFoundError traceback - #155
Merged
2 commits merged intoSep 27, 2026
Merged
fix: report a missing gh or git binary as a clean error instead of a FileNotFoundError traceback#155 2 commits merged into
2 commits merged into
Conversation
…FileNotFoundError traceback
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fold the FileNotFoundError handling into main's locale-pinned git helpers; keep main's bytes-mode extract_diff/_get_base_file_content (CRLF-safe) and catch a missing git there directly instead of routing them through a text-mode run_git_raw. Run the tool pre-check before main's new git/gh calls (remote-branch adoption, commit_exists, base-merged lookup), and stub require_tools in conftest so tests do not depend on gh being installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rnEEjXWDBdePRhKMmZr1w
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
gh(orgit) is not on PATH,subprocess.runraisesFileNotFoundError, which no caller expected:check_gh_auth(typed-> bool) raised instead of returning False,get_pr_state(catching onlyGitOperationError/JSONDecodeError) killedmergemid-loop, andsplitshowed a raw traceback. Worse, once the wrappers convert that into aGitOperationError,cleanand the re-split prompt swallow it per-PR as a warning, report "Cleanup complete" and delete the plan file while every PR and branch is left in place.Now:
_run_ghand a shared_githelper (also used by a newrun_git_rawforextract_diff/_get_base_file_content, which had their ownsubprocess.run) raiseGitOperationError("'gh' is not installed or not on PATH")require_toolspre-checks run up front insplit(git, plusghunless--dry-run; the PR-number/user:branchpath always needsgh),execute,merge(which would otherwise skip every PR as a "fetch error" and exit 0), and — via a shared_require_cleanup_tools— before the confirm prompt in bothcleanand the re-split path, so a missing binary is reported instead of turning into a bogus "authentication failed" or a successful-looking cleanupstatusintentionally still degrades to the cached state (read-only).Test plan
TestMissingCliTools(wrappers),TestRequireTools,TestMissingCliToolsAreReportedFirst(split, dry-run of a local branch needs only git, dry-run of a PR number needs gh, execute, merge, clean keeps the plan, re-split cleanup in dry-run) — all fail on mainPATH=/nonexistentrepros (clean, split fix: clean deletes remote branches even when the local branch is gone and keeps the plan on failure #123 --dry-run, merge, split --dry-run re-split): clean error, exit 1, plan retained