feat: review-gated loop triggers on autoReview alone, ask review before commit at startup

- Review now runs whenever autoReview is enabled (not only when both
  autoCommit && autoReview). On fail, the task re-executes with review
  feedback injected and loops until pass or maxReviewRetries exhausted.
- Commit after a passing review is gated by autoCommit; review-only mode
  leaves changes uncommitted for manual inspection.
- Remove legacy post-commit review path and unused imports
  (buildReviewPrompt, getLatestCommitDiff).
- Reorder selectLoopOptions: ask autoReview first, then saveReviews,
  then autoCommit (reworded to 'commit after a passing review' when
  review is enabled).
- Update types.ts doc comments and README to reflect new semantics.
This commit is contained in:
2026-07-22 17:43:57 -04:00
parent 9fcf944cb5
commit 0ef540ed47
4 changed files with 107 additions and 156 deletions

View File

@@ -211,7 +211,12 @@ export interface RalpiConfig {
models: string[];
/** Spawn a follow-up agent to commit changes after each task completes */
autoCommit: boolean;
/** Spawn a review agent to review the commit against the task description */
/** Spawn a review agent to review uncommitted changes against the
* task description BEFORE committing. On a 'fail' verdict the task is
* re-executed with the review feedback injected (loops until pass or
* maxReviewRetries is exhausted). When autoCommit is also enabled, the
* commit runs after the review passes (or retries exhaust); otherwise
* changes are left uncommitted. */
autoReview: boolean;
/** Persist the full review output to `.ralpi/reviews/<task-id>.md`.
* Only active when autoReview is true and the user opts in at loop start. */
@@ -229,12 +234,15 @@ export interface RalpiConfig {
commitTimeoutMs: number;
/** Timeout for auto-review agent sessions in milliseconds */
reviewTimeoutMs: number;
/** Max review-fix re-execution attempts before giving up and committing
* anyway (0 = no retries; review runs once, reject = commit anyway).
* Only active when both autoCommit AND autoReview are enabled. */
/** Max review-fix re-execution attempts before giving up (0 = no retries;
* review runs once, reject = stop). Active whenever autoReview is
* enabled. On exhaustion: if autoCommit is enabled, the changes are
* committed anyway; if reviewBlockOnFail is set, the task is marked
* failed instead of committing. */
maxReviewRetries: number;
/** When true, a 'fail' review verdict after exhausting maxReviewRetries
* marks the task as failed instead of committing. */
* marks the task as failed instead of leaving changes (committing when
* autoCommit, or leaving uncommitted otherwise). */
reviewBlockOnFail: boolean;
/** Maximum total duration for the entire loop execution in milliseconds (0 = no limit). Checked between batches — in-progress tasks finish naturally. */
loopTimeoutMs: number;