From 3ba68c0288a092b3dc87f627eeed6b0ac06d9dc3 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Tue, 10 Mar 2026 16:34:55 -0600 Subject: [PATCH] fix: attempt to fix failing CI on codeflash optimization PRs before closing Instead of immediately closing optimization PRs when CI fails, Claude now checks out the branch, inspects failures, and attempts to fix them. Only closes if unfixable, with a specific explanation of the failures. --- .github/workflows/claude.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index c83c17e5c..379039273 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -198,12 +198,20 @@ jobs: For each PR: - If CI passes and the PR is mergeable → merge with `--squash --delete-branch` - - Close the PR as stale if ANY of these apply: + - If CI is failing: + 1. Check out the PR branch and inspect the failing tests + 2. Attempt to fix the failures (the optimization may have broken tests or introduced issues) + 3. If fixed: commit, push, and leave a comment explaining what was fixed + 4. If unfixable: close with `gh pr close --comment "Closing: CI checks are failing — ." --delete-branch` + - Close the PR (without attempting fixes) if ANY of these apply: - Older than 7 days - Has merge conflicts (mergeable state is "CONFLICTING") - - CI is failing - The optimized function no longer exists in the target file (check the diff) - Close with: `gh pr close --comment "Closing stale optimization PR." --delete-branch` + Close with: `gh pr close --comment "" --delete-branch` + where explains WHY the PR is being closed. Examples: + - "Closing: PR is older than 7 days without being merged." + - "Closing: merge conflicts with the target branch." + - "Closing: the optimized function no longer exists in the target file."