fix: review fires for all tasks — commit then review committed diff, merge on pass
Previous flow reviewed uncommitted changes, so when a task agent self-committed its work the review was silently skipped (no uncommitted changes → review loop body never entered). This caused reviews to fire inconsistently across tasks. New review-gated flow (when autoReview is on): 1. Execute task 2. Ensure committed — commit session fallback when the agent didn't self-commit (handles both self-commit and no-commit agents) 3. Review the COMPLETE task diff (baseRef..HEAD) captured before execution, so the reviewer sees all commits not just the latest 4. On fail → re-execute with feedback → commit → re-review (same baseRef, so reviewer sees complete state including fixes) 5. On pass → merge worktree (all changes already committed) Commit is now mandated when autoReview is on (autoCommit forced true, not asked at startup). autoCommit only asked when autoReview is off. Add captureGitHead + getCommitRangeDiff helpers to utils.ts. Switch review prompt from buildReviewPromptUncommitted to buildReviewPrompt (reviewing committed changes, not uncommitted).
This commit is contained in:
22
src/types.ts
22
src/types.ts
@@ -211,12 +211,13 @@ 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 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. */
|
||||
/** Spawn a review agent to review the task's committed changes against
|
||||
* the task description. When autoReview is on, commit is mandated:
|
||||
* changes are committed (via commit session fallback when the agent
|
||||
* didn't self-commit), then the COMPLETE diff (baseRef..HEAD) is
|
||||
* reviewed. On 'fail' the task is re-executed with feedback (loops
|
||||
* until pass or maxReviewRetries). On pass the worktree merges.
|
||||
* When autoReview is off, autoCommit controls standalone commit. */
|
||||
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. */
|
||||
@@ -236,13 +237,12 @@ export interface RalpiConfig {
|
||||
reviewTimeoutMs: number;
|
||||
/** 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. */
|
||||
* enabled. On exhaustion the task proceeds with its committed changes
|
||||
* (the worktree merges) unless reviewBlockOnFail is set. */
|
||||
maxReviewRetries: number;
|
||||
/** When true, a 'fail' review verdict after exhausting maxReviewRetries
|
||||
* marks the task as failed instead of leaving changes (committing when
|
||||
* autoCommit, or leaving uncommitted otherwise). */
|
||||
* marks the task as failed instead of proceeding with its committed
|
||||
* changes (the worktree does not merge). */
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user