Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/loop/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ export async function runLoop(options: LoopOptions): Promise<LoopResult> {
: null;

// Detect validation commands if validation is enabled
const validationCommands = options.validate ? detectValidationCommands(options.cwd) : [];
// In auto mode, skip test commands — only run build/lint to avoid loops on pre-existing test failures
const allValidationCommands = options.validate ? detectValidationCommands(options.cwd) : [];
const validationCommands = options.auto
? allValidationCommands.filter((cmd) => cmd.name !== 'test')
: allValidationCommands;

// Always-on build validation (not gated by --validate flag)
// Re-detected inside the loop for greenfield projects where package.json appears mid-loop
Expand Down
9 changes: 9 additions & 0 deletions src/loop/task-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Executes batch tasks sequentially with git automation.
*/

import { existsSync, rmSync } from 'node:fs';
import { join } from 'node:path';
import chalk from 'chalk';
import {
createBranch,
Expand Down Expand Up @@ -101,6 +103,12 @@ export async function executeTaskBatch(options: TaskExecutionOptions): Promise<T
};

try {
// Clean .ralph/ directory between tasks to avoid stale context
const ralphDir = join(cwd, '.ralph');
if (existsSync(ralphDir)) {
rmSync(ralphDir, { recursive: true, force: true });
}

// Notify start
onTaskStart?.(task, i);

Expand Down Expand Up @@ -135,6 +143,7 @@ export async function executeTaskBatch(options: TaskExecutionOptions): Promise<T
maxIterations: maxIterations ?? 15,
trackProgress: true,
trackCost: true,
skipPlanInstructions: true, // Avoid conflict: task-executor tells agent to ignore IMPLEMENTATION_PLAN.md
};

const loopResult = await runLoop(loopOptions);
Expand Down