Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@swoh816
Copy link

@swoh816 swoh816 commented Dec 18, 2025

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

    • Fixed message regeneration error handling that previously caused process termination during confirmation.
  • Refactor

    • Restructured commit confirmation flow to use interactive prompts for editing and regenerating messages.
    • Improved workflow logic by consolidating confirmation states and unifying cancellation behavior.
    • Enhanced user experience by streamlining the confirmation process and removing unnecessary intermediate steps.

✏️ Tip: You can customize this high-level summary in your review settings.

- Replace single-shot prompt for regeneration with a loop
  that continues until user determines to stop
- Enable retry after regeneration failure
@vercel
Copy link

vercel bot commented Dec 18, 2025

@swoh816 is attempting to deploy a commit to the exon Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

The 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

Cohort / File(s) Summary
Confirmation Flow Refactoring
src/commands/commit.ts
Restructures final confirmation from single prompt with branches to interactive loop. Edit branch added inside loop with message validation and abort handling. Regeneration moved into loop with error recovery. Unified cancel behavior. Intermediate post-regeneration confirmation removed.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Loop exit conditions and termination paths (commit, abort, cancel)
  • Error handling during regeneration and its recovery behavior
  • Variable reassignment of commitMessage within the loop scope
  • Consistency of abort/cancel semantics across edit and main action flows

Poem

🐰 Round and round the loop does go,
Edit, regenerate, steal the showβ€”
No more branches, just one way:
Ask again until you say
"Let's commit this code today!" πŸ”„

Pre-merge checks and finishing touches

βœ… Passed checks (3 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title 'feat: streamline commit confirmation loop' directly and clearly describes the main change: refactoring the commit confirmation flow into an interactive loop, which is the primary objective of this pull request.
Docstring Coverage βœ… Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • πŸ“ Generate docstrings
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between df84e16 and 1aa54a1.

πŸ“’ 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?

Comment on lines +172 to +176
} catch (error: any) {
s.stop("Failed to regenerate commit message");
p.cancel(error.message);
continue;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

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.

Suggested change
} 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.

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.

1 participant