Add progress.txt PR comment to all eternity-loop flows#12
Add progress.txt PR comment to all eternity-loop flows#12robertherber wants to merge 7 commits intomainfrom
Conversation
Post ralph/progress.txt as a collapsible PR comment after each task completes (review, ci-fix, and new task flows). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds automated posting of scripts/ralph/progress.txt as a collapsible GitHub PR comment at the end of eternity-loop task finalization flows (review, ci-fix, and newly-created PRs).
Changes:
- Introduces a
post_progress_commenthelper that readsprogress.txtand posts it viagh pr comment. - Invokes
post_progress_commentafter finishing review and ci-fix flows. - For new tasks, looks up the newly-created PR number by branch name, then posts the progress comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| gh pr comment "$pr_number" --body "$comment_body" 2>/dev/null || { | ||
| log_err "[progress] WARNING: Failed to post progress comment on PR #$pr_number" | ||
| } | ||
| log_err "[progress] Progress comment posted on PR #$pr_number." |
There was a problem hiding this comment.
gh pr comment ... || { ... } logs a warning on failure, but the function still unconditionally logs "Progress comment posted" afterwards. This will report success even when the comment wasn't created. Consider logging success only when gh pr comment exits 0 (and keep the warning log for failures).
| gh pr comment "$pr_number" --body "$comment_body" 2>/dev/null || { | |
| log_err "[progress] WARNING: Failed to post progress comment on PR #$pr_number" | |
| } | |
| log_err "[progress] Progress comment posted on PR #$pr_number." | |
| if gh pr comment "$pr_number" --body "$comment_body" 2>/dev/null; then | |
| log_err "[progress] Progress comment posted on PR #$pr_number." | |
| else | |
| log_err "[progress] WARNING: Failed to post progress comment on PR #$pr_number" | |
| fi |
scripts/eternity-loop.sh
Outdated
| cd "$WORK_DIR" | ||
| local new_pr_number | ||
| new_pr_number=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' 2>/dev/null) || true |
There was a problem hiding this comment.
local new_pr_number is used in the main script body (not inside a function). In bash this prints "local: can only be used in a function" and returns non-zero; with set -e enabled near the top of the script, this will terminate the loop. Use a normal variable assignment (or move this logic into a function) instead of local here.
scripts/eternity-loop.sh
Outdated
| # Post progress log as PR comment (look up PR number by branch) | ||
| cd "$WORK_DIR" | ||
| local new_pr_number | ||
| new_pr_number=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' 2>/dev/null) || true |
There was a problem hiding this comment.
When gh pr list --json number --jq '.[0].number' returns an empty list, --jq will output null (a non-empty string). The -n check will pass and post_progress_comment will be invoked with pr_number="null", which will fail. Consider changing the jq to '.[0].number // empty' (or explicitly checking for null) before posting the comment.
| new_pr_number=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number' 2>/dev/null) || true | |
| new_pr_number=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number // empty' 2>/dev/null) || true |
`local` can only be used inside functions in bash. The new task flow's PR number variable was declared with `local` at the top-level loop scope, causing a fatal error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ensure_main_branch calls git clean -fd which deletes all untracked files. When it ran after start_task, it wiped out the freshly generated prd.json. Ralph would then see no PRD, immediately output COMPLETE, and produce no commits. Moving ensure_main_branch before start_task ensures prd.json is generated on a clean main branch and survives into the ralph-loop execution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Split PR comments by the latest commit date so Claude knows which
comments are new (actionable) and which are older (context only).
- get_pr_review_comments now accepts an optional cutoff date parameter
- When provided, returns {new_comments, previous_comments} instead of flat lists
- start_review_task passes the latest commit date as cutoff
- The PRD generation prompt clearly labels new comments as actionable
and previous comments as background context only
- The reply-to-comments flow (no cutoff) still gets the flat format
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Increase log capture from 200 to 500 lines, with smart truncation: first 100 lines (setup context) + last 400 lines (actual errors) - Include full logs when under 500 lines - List failed jobs and their failed step names for structure - Fetch GitHub check-run error annotations (file:line: message) which provide precise error locations - Show check state in failed checks list Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The annotations API queries were complex, unreliable, and the useful error info is already in the --log-failed output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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>
Summary
post_progress_commenthelper that postsralph/progress.txtas a collapsible PR comment (prefixed with🤖 **eternity-loop bot:**so it's excluded from human comment detection)finalize_taskcreates itTest plan
🤖 Generated with Claude Code