Skip to content

Commit f84e924

Browse files
authored
Merge branch 'main' into worktree-resolve-stale-threads
2 parents 50b1267 + 90321c9 commit f84e924

File tree

4 files changed

+153
-175
lines changed

4 files changed

+153
-175
lines changed

.github/workflows/review-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ jobs:
195195
if: |
196196
github.event.issue.pull_request &&
197197
contains(github.event.comment.body, '/review') &&
198-
github.event.comment.user.type != 'Bot'
198+
(github.event.comment.user.type != 'Bot' || github.event.comment.user.login == 'docker-agent[bot]')
199199
runs-on: ubuntu-latest
200200
env:
201201
HAS_APP_SECRETS: ${{ secrets.CAGENT_REVIEWER_APP_ID != '' }}

action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ runs:
475475
exit 1
476476
fi
477477
echo "verbose-log-file=$VERBOSE_LOG_FILE" >> $GITHUB_OUTPUT
478+
echo "verbose-log-timestamp=$(date +%s%N)" >> $GITHUB_OUTPUT
478479
echo "Verbose log file: $VERBOSE_LOG_FILE"
479480
480481
# Build command arguments array (SECURE: no eval!)
@@ -701,7 +702,7 @@ runs:
701702
if: always() && steps.run-agent.outputs.verbose-log-file != ''
702703
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
703704
with:
704-
name: cagent-verbose-log-${{ github.run_id }}-${{ github.run_attempt }}
705+
name: cagent-verbose-log-${{ github.run_id }}-${{ github.run_attempt }}-${{ steps.run-agent.outputs.verbose-log-timestamp }}
705706
path: ${{ steps.run-agent.outputs.verbose-log-file }}
706707
retention-days: 14
707708
if-no-files-found: ignore

review-pr/action.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,25 @@ runs:
157157
# Uses github.token (has contents:read) instead of the App token (used for posting reviews).
158158
# Uses the full PR URL instead of just the number — gh can't resolve a bare number
159159
# from a detached HEAD (refs/pull/N/head).
160-
if GH_TOKEN="$READ_TOKEN" gh pr diff "$PR_URL" > pr.diff 2>/dev/null; then
161-
echo "✅ Pre-fetched PR diff ($(wc -l < pr.diff | tr -d ' ') lines)"
160+
if GH_TOKEN="$READ_TOKEN" gh pr diff "$PR_URL" > pr.diff 2>pr_diff_stderr.txt; then
161+
echo "✅ Pre-fetched PR diff via gh pr diff ($(wc -l < pr.diff | tr -d ' ') lines)"
162+
rm -f pr_diff_stderr.txt
162163
else
163-
echo "::warning::Failed to pre-fetch PR diff — agent will use git diff as fallback"
164-
rm -f pr.diff
164+
echo "::warning::gh pr diff failed: $(cat pr_diff_stderr.txt 2>/dev/null)"
165+
rm -f pr.diff pr_diff_stderr.txt
166+
167+
# Fallback: git diff with merge-base (repo is checked out with full history)
168+
MERGE_BASE=$(git merge-base origin/main HEAD 2>/dev/null || git merge-base origin/master HEAD 2>/dev/null || echo "")
169+
if [ -n "$MERGE_BASE" ]; then
170+
if git diff "$MERGE_BASE"...HEAD > pr.diff; then
171+
echo "✅ Pre-fetched PR diff via git diff ($(wc -l < pr.diff | tr -d ' ') lines)"
172+
else
173+
echo "::warning::git diff failed — agent will fetch diff itself"
174+
rm -f pr.diff
175+
fi
176+
else
177+
echo "::warning::Could not determine merge base — agent will fetch diff itself"
178+
fi
165179
fi
166180
167181
- name: Resolve stale review threads
@@ -358,8 +372,9 @@ runs:
358372
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
359373
with:
360374
path: ${{ github.workspace }}/.cache/pr-review-memory.db
361-
key: pr-review-memory-${{ github.repository }}-${{ github.run_id }}
375+
key: pr-review-memory-${{ github.repository }}-${{ github.job }}-${{ github.run_id }}
362376
restore-keys: |
377+
pr-review-memory-${{ github.repository }}-${{ github.job }}-
363378
pr-review-memory-${{ github.repository }}-
364379
365380
# ========================================
@@ -541,7 +556,7 @@ runs:
541556
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
542557
with:
543558
path: ${{ github.workspace }}/.cache/pr-review-memory.db
544-
key: pr-review-memory-${{ github.repository }}-${{ github.run_id }}
559+
key: pr-review-memory-${{ github.repository }}-${{ github.job }}-${{ github.run_id }}
545560

546561
# ========================================
547562
# POST-REVIEW: Clean summary & reactions

0 commit comments

Comments
 (0)