-
Couldn't load subscription status.
- Fork 1.6k
Retry Commits Generating request on invalid hunks #4430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+326
−40
Conversation
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
1 task
826cb3e to
e9ee84c
Compare
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
e9ee84c to
473a77d
Compare
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
473a77d to
e9ee3fc
Compare
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
sergeibbb
added a commit
that referenced
this pull request
Jun 26, 2025
713d1b4 to
161a5be
Compare
d13
approved these changes
Jul 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, branch just needs updating
161a5be to
0aeac8d
Compare
sergeibbb
added a commit
that referenced
this pull request
Jul 7, 2025
sergeibbb
added a commit
that referenced
this pull request
Jul 7, 2025
sergeibbb
added a commit
that referenced
this pull request
Jul 7, 2025
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.
Implement robust AI-assisted rebase generation with validation and retry logic
This solves #4395.
This piece of work introduces a new, robust workflow for generating AI-assisted rebases that organize code changes into logical commits. The changes add the generateRebase method, which now includes automatic retry logic: if the AI's response is missing hunks, includes extra hunks, or uses duplicates, the system will provide feedback and retry up to three times. The main workflow is broken into helper methods:
sendRebaseRequestWithRetryorchestrates the retry loop and validation for AI responses.sendRebaseFirstAttempthandles the initial AI request and stores the conversation prompt for use in retries.validateRebaseResponsechecks the AI's JSON output for correctness, ensuring all required hunks are present exactly once and no extras or duplicates exist. It also generates specific retry prompts to feed back to the AI if issues are found, using the dedent utility for clear formatting.Detailed logging and error messages are added to make debugging easier. These changes ensure that AI-generated commit suggestions are always structurally correct, improving both reliability and reviewability of the tool's output.
Checklist
Fixes $XXX -orCloses #XXX -prefix to auto-close the issue that your PR addresses