You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/prompts/fix-pr-ci-failures.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,9 @@ Do not stop a given execution until you have worked through all phases below.
17
17
3. Get the current branch name using `git branch --show-current`
18
18
4. Find the PR for this branch using `gh pr list --head <branch-name> --json number,title` and extract the PR number
19
19
5. Use `gh pr view <pr-number> --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion == "FAILURE") | {name: .name, detailsUrl: .detailsUrl, databaseId: .databaseId}'` to get the list of all failed CI jobs
20
-
6. Check if there are actually CI failures to fix - if all jobs passed, exit early
20
+
6.**Ignore aggregate/rollup checks** like `required-status-check` — they fail if and only if some real underlying check fails, so fixing the real checks resolves them automatically. Do not spend effort downloading their logs.
21
+
7. Check if there are actually CI failures to fix - if all jobs passed (after filtering rollups), exit early
22
+
8.**Trivial-failure fast path**: if there is exactly one failing job with an obvious single root cause (e.g., one markdownlint rule, one spotless violation, one known-flaky infra error), skip Phases 1-2 entirely — fix directly, validate, commit. The CI-PLAN.md / `.git/info/exclude` machinery is overhead for a 2-line fix.
21
23
22
24
## Phase 1: Gather Information
23
25
@@ -48,7 +50,9 @@ rm -f CI-PLAN.md
48
50
-**Flaky / infra failures**: if a failure looks like a network timeout, cache miss, runner OOM, or anything clearly unrelated to PR code, note it in `CI-PLAN.md` under "Notes" and do not invent a code fix for it.
49
51
3. Download logs for the selected representatives. Two equally-valid options:
50
52
51
-
**Option A: `gh run view`** (avoids putting the token in process argv):
53
+
**On Windows/Git Bash, default to Option B.**`gh run view --log-failed` is unreliable on that platform — it sometimes fails with `stream error: stream ID 1; CANCEL; received from peer`, and sometimes silently exits 0 while producing a 0-byte file. If you do try Option A, always verify the output is non-empty (`wc -l`) and fall back to Option B if it is empty.
54
+
55
+
**Option A: `gh run view`** (avoids putting the token in process argv; preferred on Linux/macOS):
52
56
53
57
```
54
58
# For a single job's failing log only:
@@ -58,7 +62,7 @@ rm -f CI-PLAN.md
58
62
gh run view <run-id> --log-failed > /tmp/run-<run-id>-failed.log
59
63
```
60
64
61
-
**Option B: REST API** — use this on Windows/Git Bash, where `gh run view --log-failed` often fails with `stream error: stream ID 1; CANCEL; received from peer`:
65
+
**Option B: REST API** — required on Windows/Git Bash:
62
66
63
67
```
64
68
(cd /tmp && curl -sSfL \
@@ -139,14 +143,15 @@ Work through `CI-PLAN.md`, checking items off as you complete them. For each fai
139
143
- Analyze the failure using the logs (now you may open source files).
- Markdown lint failures: most `markdownlint` rules have no auto-fix \u2014 edit manually. `mise run lint:markdown` only validates; there is no `lint:markdown:fix` task.
- Test failures: run the whole module's test task (e.g., `./gradlew :instrumentation:module-name:javaagent:test`) rather than just the single failing test — related tests in the module often need fixing too.
146
151
- Verify the fix resolves the issue.
147
152
- Update the checkbox in `CI-PLAN.md`.
148
153
- Commit each logical fix as a **separate commit**:
- Use explicit pathspecs. **Put `-m` before `--`**, because everything after `--` is treated as a pathspec by git: `git commit -m "..." -- path/one path/two`.
150
155
- Note that `git mv` auto-stages the rename — don't re-run `git add` on the moved paths.
151
156
- If `git mv` or earlier edits have already staged unrelated changes, `git reset` first and stage only the files for the current logical fix.
0 commit comments