@@ -487,7 +487,7 @@ jobs:
487487 CURRENT_SHA="${PR_HEAD_SHA}"
488488 DIFF_CONTENT=""
489489 # Ensure dedicated diff folder exists in the workspace (hidden to avoid accidental use)
490- mkdir -p "$GITHUB_WORKSPACE/mirrobot_files"
490+ mkdir -p "$GITHUB_WORKSPACE/. mirrobot_files"
491491
492492 echo "Generating full PR diff against base branch: $BASE_BRANCH"
493493
@@ -512,24 +512,24 @@ jobs:
512512 DIFF_CONTENT="${DIFF_CONTENT:0:500000}${TRUNCATION_MSG}"
513513 fi
514514 # Write diff directly into the repository workspace in the dedicated folder
515- echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
515+ echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
516516 else
517517 echo "::warning::Could not generate diff. Using changed files list only."
518518 DIFF_CONTENT="(Diff generation failed. Please refer to the changed files list above.)"
519519 # Write fallback diff directly into the workspace folder
520- echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
520+ echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
521521 fi
522522 else
523523 echo "::warning::Could not find merge base between $BASE_BRANCH and $CURRENT_SHA."
524524 DIFF_CONTENT="(No common ancestor found. This might be a new branch or orphaned commits.)"
525525 # Write fallback diff content directly into the repository workspace folder
526- echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
526+ echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
527527 fi
528528 else
529529 echo "::warning::Could not fetch base branch $BASE_BRANCH. Using changed files list only."
530530 DIFF_CONTENT="(Base branch not available for diff. Please refer to the changed files list above.)"
531531 # Write error-case diff directly into the repository workspace folder
532- echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
532+ echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
533533 fi
534534
535535 env :
@@ -543,7 +543,7 @@ jobs:
543543 CURRENT_SHA="${PR_HEAD_SHA}"
544544 DIFF_CONTENT=""
545545 # Ensure dedicated diff folder exists in the workspace (hidden to avoid accidental use)
546- mkdir -p "$GITHUB_WORKSPACE/mirrobot_files"
546+ mkdir -p "$GITHUB_WORKSPACE/. mirrobot_files"
547547 echo "Attempting to generate incremental diff from $LAST_SHA to $CURRENT_SHA"
548548
549549 # Fetch the last reviewed commit, handle potential errors (e.g., rebased/force-pushed commit)
@@ -563,21 +563,21 @@ jobs:
563563 DIFF_CONTENT="${DIFF_CONTENT:0:500000}${TRUNCATION_MSG}"
564564 fi
565565 # Write incremental diff directly into the repository workspace folder
566- echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt"
566+ echo "$DIFF_CONTENT" > "$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt"
567567 else
568568 echo "::warning::Could not generate diff between $LAST_SHA and $CURRENT_SHA. Possible rebase/force-push. AI will perform full review."
569569 # Ensure an empty incremental diff file exists in the workspace folder as fallback
570- echo "" > "$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt"
570+ echo "" > "$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt"
571571 fi
572572 else
573573 echo "::warning::Failed to fetch last reviewed SHA: $LAST_SHA. This can happen if the commit was part of a force-push or rebase. The AI will perform a full review as a fallback."
574574 # Ensure an empty incremental diff file exists in the workspace folder when last-SHA fetch fails
575- echo "" > "$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt"
575+ echo "" > "$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt"
576576 fi
577577
578578 # Ensure workspace diff files exist even on edge cases (in the hidden folder)
579- [ -f "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt" ] || touch "$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
580- [ -f "$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt" ] || touch "$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt"
579+ [ -f "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt" ] || touch "$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
580+ [ -f "$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt" ] || touch "$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt"
581581
582582
583583 - name : Assemble Review Prompt
@@ -592,9 +592,9 @@ jobs:
592592 run : |
593593 # Build DIFF_FILE_PATH pointing to the generated diff in the repository workspace
594594 if [ "${{ steps.review_type.outputs.is_first_review }}" = "true" ]; then
595- DIFF_FILE_PATH="$GITHUB_WORKSPACE/mirrobot_files/first_review_diff.txt"
595+ DIFF_FILE_PATH="$GITHUB_WORKSPACE/. mirrobot_files/first_review_diff.txt"
596596 else
597- DIFF_FILE_PATH="$GITHUB_WORKSPACE/mirrobot_files/incremental_diff.txt"
597+ DIFF_FILE_PATH="$GITHUB_WORKSPACE/. mirrobot_files/incremental_diff.txt"
598598 fi
599599 # Substitute variables, embedding PR context and diff file path; DIFF_FILE_PATH kept local to this process
600600 TMP_DIR="${RUNNER_TEMP:-/tmp}"
@@ -629,6 +629,74 @@ jobs:
629629 PR_HEAD_SHA : ${{ env.PR_HEAD_SHA }}
630630 run : |
631631 TMP_DIR="${RUNNER_TEMP:-/tmp}"
632+
633+ # Validate diff files exist and search for them if not found
634+ echo "=== Diff File Validation ==="
635+
636+ # Determine which diff file should be used
637+ if [ "${{ steps.review_type.outputs.is_first_review }}" = "true" ]; then
638+ EXPECTED_DIFF_FILE="$GITHUB_WORKSPACE/.mirrobot_files/first_review_diff.txt"
639+ DIFF_TYPE="Full review"
640+ else
641+ EXPECTED_DIFF_FILE="$GITHUB_WORKSPACE/.mirrobot_files/incremental_diff.txt"
642+ DIFF_TYPE="Incremental"
643+ fi
644+
645+ echo "Expected diff file ($DIFF_TYPE): $EXPECTED_DIFF_FILE"
646+ echo ""
647+
648+ # Search in common locations
649+ SEARCH_PATHS=(
650+ "$GITHUB_WORKSPACE/.mirrobot_files"
651+ "$GITHUB_WORKSPACE/mirrobot_files"
652+ "/tmp/mirrobot_files"
653+ "/tmp/.mirrobot_files"
654+ "$PWD/.mirrobot_files"
655+ "$PWD/mirrobot_files"
656+ )
657+
658+ echo "Searching for diff files in potential locations:"
659+ for search_dir in "${SEARCH_PATHS[@]}"; do
660+ if [ -d "$search_dir" ]; then
661+ echo "✓ Directory exists: $search_dir"
662+ if [ -f "$search_dir/first_review_diff.txt" ]; then
663+ echo " ✓ Found: $search_dir/first_review_diff.txt ($(wc -l < "$search_dir/first_review_diff.txt") lines)"
664+ fi
665+ if [ -f "$search_dir/incremental_diff.txt" ]; then
666+ echo " ✓ Found: $search_dir/incremental_diff.txt ($(wc -l < "$search_dir/incremental_diff.txt") lines)"
667+ fi
668+ else
669+ echo "✗ Directory not found: $search_dir"
670+ fi
671+ done
672+
673+ echo ""
674+ echo "Current working directory: $PWD"
675+ echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE"
676+ echo ""
677+
678+ # Check if expected file exists
679+ if [ ! -f "$EXPECTED_DIFF_FILE" ]; then
680+ echo "⚠️ WARNING: Expected diff file not found at: $EXPECTED_DIFF_FILE"
681+ # Try to find it
682+ if [ "${{ steps.review_type.outputs.is_first_review }}" = "true" ]; then
683+ FOUND=$(find "$GITHUB_WORKSPACE" /tmp -name "first_review_diff.txt" 2>/dev/null | head -n 1)
684+ else
685+ FOUND=$(find "$GITHUB_WORKSPACE" /tmp -name "incremental_diff.txt" 2>/dev/null | head -n 1)
686+ fi
687+ if [ -n "$FOUND" ]; then
688+ echo " Found alternative location: $FOUND"
689+ echo " This path will be in the assembled prompt"
690+ else
691+ echo " ❌ File not found anywhere!"
692+ fi
693+ else
694+ echo "✓ Expected diff file exists: $EXPECTED_DIFF_FILE ($(wc -l < "$EXPECTED_DIFF_FILE") lines)"
695+ fi
696+
697+ echo "=== End Validation ==="
698+ echo ""
699+
632700 opencode run --share - < "$TMP_DIR/assembled_prompt.txt"
633701
634702 - name : Verify AI Review Footers
@@ -740,4 +808,4 @@ jobs:
740808 fi
741809 else
742810 echo "Verification passed! No corrections needed."
743- fi
811+ fi
0 commit comments