Skip to content

Commit 2c8aa8b

Browse files
robertherberclaude
andcommitted
include CI failure details in Ralph CLAUDE.md for ci-fix tasks
Previously Ralph only saw the PRD user stories for CI fixes but not the actual failure logs. If the PRD-generating Claude didn't capture enough detail, Ralph had no way to diagnose the failures. Now for ci-fix tasks, the raw CI failure details (failed checks, job names, and log output) are appended directly to Ralph's CLAUDE.md. Also instructs Ralph to use fix(ci): commit prefix which aligns with the loop prevention check in check_pr_has_ci_failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2fa6cbc commit 2c8aa8b

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

scripts/eternity-loop.sh

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,13 +1497,33 @@ while true; do
14971497
log "[loop] On branch: $(git branch --show-current)"
14981498
fi
14991499

1500-
# Write project-specific CLAUDE.md that tells Ralph NOT to manage branches
1501-
# (branch management is handled by this script)
1500+
# Write project-specific CLAUDE.md based on task type
15021501
ralph_dir="$WORK_DIR/scripts/ralph"
15031502
mkdir -p "$ralph_dir"
1504-
# Copy ralph CLAUDE.md with branch override (step 3 changed from upstream)
1505-
cp "$PROMPTS_DIR/ralph-claude-md.md" "$ralph_dir/CLAUDE.md"
1506-
log "[loop] Wrote scripts/ralph/CLAUDE.md (branch override)"
1503+
1504+
if [ "$TASK_TYPE" = "ci-fix" ]; then
1505+
# CI fix: include failure details in CLAUDE.md so Ralph has full context
1506+
log "[loop] Collecting CI failure details for Ralph context..."
1507+
CI_FAILURE_CONTEXT=$(get_ci_failure_details "$WORK_DIR" "$PR_NUMBER")
1508+
cat "$PROMPTS_DIR/ralph-claude-md.md" > "$ralph_dir/CLAUDE.md"
1509+
cat >> "$ralph_dir/CLAUDE.md" <<CIEOF
1510+
1511+
## CI Fix Mode
1512+
1513+
You are fixing CI failures on an existing PR. Use \`fix(ci):\` prefix for all commit messages instead of \`feat:\`.
1514+
1515+
### CI Failure Details
1516+
1517+
The following CI failures need to be fixed. Use this context alongside the user stories in prd.json to understand what went wrong.
1518+
1519+
$CI_FAILURE_CONTEXT
1520+
CIEOF
1521+
log "[loop] Wrote scripts/ralph/CLAUDE.md (CI fix mode with failure context)"
1522+
else
1523+
# Default: standard ralph CLAUDE.md
1524+
cp "$PROMPTS_DIR/ralph-claude-md.md" "$ralph_dir/CLAUDE.md"
1525+
log "[loop] Wrote scripts/ralph/CLAUDE.md (branch override)"
1526+
fi
15071527

15081528
# Run ralph-loop.sh from the project directory
15091529
log ""

0 commit comments

Comments
 (0)