Skip to content

Commit 76d7790

Browse files
committed
kernel_patch_verify: Clean up AI review output in report
The AI review section previously included verbose worktree creation output ("Updating files...", "Processing SHA...", directory paths) and full Claude analysis stdout, resulting in 200+ lines per patch even when no issues were found. This commit improves the output format by: - Removing stderr redirect from review_one.sh call - worktree creation progress and debugging output now goes to terminal only (visible during execution but not in the final report) - Extracting review-inline.txt and review.md files before worktree cleanup - Adding clear separators between commit reviews - Including metadata summary (issue count, severity, AI-authorship score) when problems are found Results: - Clean patches: One line summary (e.g., "abc123: No issues found") - Patches with issues: Metadata header + actionable comments (review-inline.txt) + detailed analysis (review.md) - 98.5% reduction in report size for clean patches (8 lines vs 550 lines) Users still see all progress information during execution, but the final report only contains actionable results, making it much easier to identify which commits need attention. Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: Nishanth Menon <nm@ti.com>
1 parent 81835ec commit 76d7790

1 file changed

Lines changed: 50 additions & 2 deletions

File tree

kernel_patch_verify

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,61 @@ series_ai_review() {
487487
local subject=$(git -C "$KDIR" log -1 --format="%s" "$commit_sha")
488488
echo "[$patch_num/$PATCHCOUNT] Reviewing $short_sha: $subject" 1>&2
489489

490-
( "$REVIEW_ONE_SH" --linux "$KDIR" --range "$range" "$commit_sha" || echo "AI review failed for $short_sha" ) | tee -a $LOG_DIR/ai-review.log
490+
( "$REVIEW_ONE_SH" --linux "$KDIR" --range "$range" "$commit_sha" || echo "AI review failed for $short_sha" 1>&2 )
491491

492-
# Clean up the worktree created by review_one.sh
492+
# Extract review files before cleanup
493493
local worktree_dir="$KDIR.$commit_sha"
494494
if [ ! -d "$worktree_dir" ]; then
495495
worktree_dir="/tmp/linux.$commit_sha"
496496
fi
497+
498+
# Add separator between commits in the log
499+
if [ $patch_num -gt 1 ]; then
500+
echo "" >> "$LOG_DIR/ai-review.log"
501+
echo "========================================" >> "$LOG_DIR/ai-review.log"
502+
echo "" >> "$LOG_DIR/ai-review.log"
503+
fi
504+
505+
if [ -f "$worktree_dir/review-inline.txt" ]; then
506+
# Extract metadata for summary
507+
local issues_found="unknown"
508+
local guide_flagged="unknown"
509+
local severity="unknown"
510+
local severity_explain=""
511+
local ai_authorship="unknown"
512+
513+
if [ -f "$worktree_dir/review-metadata.json" ]; then
514+
issues_found=$(grep -o '"issues-found": *[0-9]*' "$worktree_dir/review-metadata.json" | grep -o '[0-9]*')
515+
guide_flagged=$(grep -o '"guide-flagged-issues": *[0-9]*' "$worktree_dir/review-metadata.json" | grep -o '[0-9]*')
516+
severity=$(grep -o '"issue-severity-score": *"[^"]*"' "$worktree_dir/review-metadata.json" | cut -d'"' -f4)
517+
severity_explain=$(grep -o '"issue-severity-explanation": *"[^"]*"' "$worktree_dir/review-metadata.json" | cut -d'"' -f4)
518+
ai_authorship=$(grep -o '"AI-authorship-score": *"[^"]*"' "$worktree_dir/review-metadata.json" | cut -d'"' -f4)
519+
fi
520+
521+
{
522+
echo "========================================"
523+
echo "Commit: $short_sha - $subject"
524+
echo "Issues Found: $issues_found (guide-flagged: $guide_flagged)"
525+
echo "Severity: $severity - $severity_explain"
526+
echo "AI-authorship: $ai_authorship"
527+
echo "========================================"
528+
echo ""
529+
530+
echo "--- Review Comments ---"
531+
cat "$worktree_dir/review-inline.txt"
532+
echo ""
533+
534+
if [ -f "$worktree_dir/review.md" ]; then
535+
echo "--- Analysis Details ---"
536+
cat "$worktree_dir/review.md"
537+
echo ""
538+
fi
539+
} >> "$LOG_DIR/ai-review.log"
540+
else
541+
echo "$short_sha: No issues found" >> "$LOG_DIR/ai-review.log"
542+
fi
543+
544+
# Clean up the worktree created by review_one.sh
497545
if [ -d "$worktree_dir" ]; then
498546
echo "Cleaning up worktree: $worktree_dir" 1>&2
499547
( cd "$KDIR" && git worktree remove --force "$worktree_dir" 2>&1 ) 1>&2

0 commit comments

Comments
 (0)