-
Notifications
You must be signed in to change notification settings - Fork 4
feat: streamline commit confirmation loop #3
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
base: main
Are you sure you want to change the base?
Conversation
- Replace single-shot prompt for regeneration with a loop that continues until user determines to stop - Enable retry after regeneration failure
|
@swoh816 is attempting to deploy a commit to the exon Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe commit command's final confirmation flow is refactored from a single branching prompt to an interactive loop. Edit handling moves into the loop with validation, regeneration occurs within the loop without exiting on error, and cancel behavior is unified. The intermediate confirmation after regeneration is removed. Changes
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20β25 minutes
Poem
Pre-merge checks and finishing touchesβ Passed checks (3 passed)
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
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 |
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.
Actionable comments posted: 1
π§Ή Nitpick comments (1)
src/commands/commit.ts (1)
162-162: Consider logging the edited message for consistency.After regeneration (line 178), the new commit message is displayed to the user before returning to the action prompt. Adding similar logging after editing would provide consistent feedback.
π Apply this diff to add logging after edit:
commitMessage = editedMessage; + p.log.step(`Updated commit message:\n${color.white(` "${commitMessage}"`)}`); }
π Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
π Files selected for processing (1)
src/commands/commit.ts(1 hunks)
π§° Additional context used
𧬠Code graph analysis (1)
src/commands/commit.ts (1)
src/lib/opencode.ts (2)
cleanup(356-360)generateCommitMessage(161-213)
β° Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Vercel Agent Review
π Additional comments (2)
src/commands/commit.ts (2)
129-180: LGTM! Well-structured interactive loop.The refactor from a single confirmation to an interactive loop successfully achieves the PR objective of allowing users to iteratively refine commit messages. The control flow is clean, with proper handling of all action branches and exit conditions.
156-160: Verify that canceling edit should exit the entire process.When a user cancels the text prompt during message editing (e.g., pressing Ctrl+C), the entire commit process exits. An alternative behavior would be to return to the action menu, similar to how regeneration errors are handled (line 175).
Is exiting the entire process the intended UX, or should canceling an edit return to the menu to allow other actions?
| } catch (error: any) { | ||
| s.stop("Failed to regenerate commit message"); | ||
| p.cancel(error.message); | ||
| continue; | ||
| } |
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.
Use p.log.error() instead of p.cancel() for transient errors.
Throughout this file, p.cancel() is consistently used before process.exit() to signal a final abort (lines 31, 71, 116, 142, 157, 195). Using it here before continue is semantically inconsistent and may confuse users who expect the program to exit after seeing a cancel message.
π Apply this diff to use a more appropriate logging method:
} catch (error: any) {
s.stop("Failed to regenerate commit message");
- p.cancel(error.message);
+ p.log.error(error.message);
continue;
}π Committable suggestion
βΌοΈ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch (error: any) { | |
| s.stop("Failed to regenerate commit message"); | |
| p.cancel(error.message); | |
| continue; | |
| } | |
| } catch (error: any) { | |
| s.stop("Failed to regenerate commit message"); | |
| p.log.error(error.message); | |
| continue; | |
| } |
π€ Prompt for AI Agents
In src/commands/commit.ts around lines 172 to 176, the catch block for transient
errors uses p.cancel(error.message) then continues, which is inconsistent with
other uses of p.cancel for final aborts; replace the p.cancel(...) call with
p.log.error(...) (or p.log.error with a short context message plus
error.message) so the error is logged as transient and keep the continue flow
without signaling a final cancel/exit.
Modified the current one-shot prompt for regeneration with a loop so that user can determine when to stop. Similarly, user can choose to regenerate again in case of regeneration failure.
Summary by CodeRabbit
Bug Fixes
Refactor
βοΈ Tip: You can customize this high-level summary in your review settings.