Skip to content

Commit 2387742

Browse files
committed
correct review extraction
1 parent ddcf3a8 commit 2387742

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ jobs:
6969
1. Action checks author is OWNER, MEMBER, or COLLABORATOR (blocks external contributors)
7070
2. Fetches and sanitizes PR diff (removes comments, checks for malicious patterns)
7171
3. Runs multi-agent reviewer (coordinator delegates to specialized sub-agents)
72-
4. Scans output for leaked secrets (API keys, tokens)
73-
5. Posts review to PR or creates security incident issue
72+
4. Filters verbose logging (extracts clean review starting from "## Summary")
73+
5. Scans output for leaked secrets (API keys, tokens)
74+
6. Posts clean review to PR or creates security incident issue
7475

7576
See the [examples/pr-review.yml](examples/pr-review.yml) for a complete example.
7677

action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,32 @@ runs:
521521
522522
${{ github.action_path }}/security/sanitize-output.sh "$OUTPUT_FILE"
523523
524+
# For PR reviews, extract clean output (remove verbose cagent logging)
525+
if [ -n "$PR_NUMBER" ]; then
526+
echo "🧹 Extracting clean review output..."
527+
528+
# Extract only the final review (starts with ## Summary)
529+
# This removes all verbose cagent logging, agent transfers, and debug output
530+
if grep -q "^## Summary$" "$OUTPUT_FILE"; then
531+
# Find the first occurrence of "## Summary" and extract from there to end
532+
SUMMARY_LINE=$(grep -n "^## Summary$" "$OUTPUT_FILE" | head -1 | cut -d: -f1)
533+
534+
# Extract from Summary onwards (this is the actual review)
535+
tail -n +$SUMMARY_LINE "$OUTPUT_FILE" | \
536+
grep -v "^time=" | \
537+
grep -v "^--- Agent:" | \
538+
grep -v "Calling " | \
539+
grep -v " response →" | \
540+
grep -v "For any feedback" > "${OUTPUT_FILE}.clean"
541+
542+
# Use the cleaned output for PR comments
543+
mv "${OUTPUT_FILE}.clean" "$OUTPUT_FILE"
544+
echo "✅ Extracted clean review output (starting from Summary)"
545+
else
546+
echo "⚠️ No '## Summary' marker found - using full output"
547+
fi
548+
fi
549+
524550
# ========================================
525551
# SECURITY: Post Comment (only if safe)
526552
# ========================================

0 commit comments

Comments
 (0)