fix-ready-prs
fastrepl/anarlog/.agents/skills/fix-ready-prs/SKILL.md
Inspect every open non-draft PR for CI failures and unresolved Cursor Bugbot findings, then fix them on the existing PR branches. Use when asked to check active PRs, triage ready PRs, fix CI, or address Bugbot comments. Use only outside gitbutler/workspace; on that branch use the repository-local fix-prs skill.
Skill9.5k starsChanged 41 days ago
- Commits and pushes
What's in it
- Fix Ready PRs
- 1. Inventory
- 2. Collect failures
- CI
- Bugbot
- 3. Fix on the PR branch
- 4. Recheck
- 5. Report
---
name: fix-ready-prs
description: Inspect every open non-draft PR for CI failures and unresolved Cursor Bugbot findings, then fix them on the existing PR branches. Use when asked to check active PRs, triage ready PRs, fix CI, or address Bugbot comments. Use only outside gitbutler/workspace; on that branch use the repository-local fix-prs skill.
metadata:
internal: true
---
# Fix Ready PRs
Check the active checkout's branch with `git symbolic-ref --quiet --short HEAD`
before running this workflow. On `gitbutler/workspace`, skip this skill and use
[fix-prs](../fix-prs/SKILL.md), preserving any narrower user scope. Its GitButler
branch handling and review-resolution workflow take precedence; do not check
out PR branches or use the Git-write commands below in that workspace.
Work through every **open, non-draft** pull request. Fix CI failures and
unresolved Bugbot findings on the existing PR branch. Do not open a new PR for
an existing one.
Drafts are out of scope unless the user names them.
## 1. Inventory
```bash
gh pr list --state open --limit 200 \
--json number,title,isDraft,headRefName,headRepositoryOwner,isCrossRepository,url,mergeStateStatus
```
Keep only `isDraft == false`. Record number, branch, URL, and whether the head
is a fork (`isCrossRepository`).
## 2. Collect failures
For each ready PR, gather **current-head** CI and **unresolved** Bugbot threads.
Do not treat an in-progress check as green.
### CI
```bash
gh pr checks <n>
gh pr view <n> --json statusCheckRollup,headRefOid
```
Treat as a failure when a required or repo workflow check is `FAILURE`,
`TIMED_OUT`, `ACTION_REQUIRED`, or `CANCELLED` on the current head and has not
been superseded by a newer run.
Ignore:
- `SKIPPED` / `NEUTRAL`
- Netlify header/pages/redirect checks and canceled deploy previews
- Mintlify Deployment skips
- macOS/Windows/iOS jobs that this repo skips on pull requests
If a failing job has logs, pull them:
```bash
gh run view <run-id> --log-failed
```
If checks are still `IN_PROGRESS` / `pending`, wait until they finish or fail
before declaring the PR clean. Re-poll rather than guessing.
### Bugbot
Use review threads, not only the Bugbot check conclusion. A green Bugbot check
can still leave unresolved comments, and an older finding may already be
fixed.
GitHub returns `reviewThreads` oldest-first with no unresolved-only filter.
Page until `hasNextPage` is false. Do not stop at the first 50 threads.
```bash
after=""
while :; do
if [ -n "$after" ]; then
page=$(gh api graphql -f query="$THREADS_QUERY" -F n=<n> -F after="$after")
else
page=$(gh api graphql -f query="$THREADS_QUERY" -F n=<n>)
fi
echo "$page" | jq '.data.repository.pullRequest.reviewThreads.nodes[]'
has_next=$(echo "$page" | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage')
after=$(echo "$page" | jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor')
[ "$has_next" = true ] || break
done
```
`$THREADS_QUERY` is:
```graphql
query($n: Int!, $after: String) {
repository(owner: "fastrepl", name: "anarlog") {
pullRequest(number: $n) {
reviewThreads(first: 50, after: $after) {
pageInfo { hasNextPage endCursor }
nodes {
isResolved
isOutdated
comments(first: 5) {
nodes { author { login } path line body }
}
}
}
}
}
}
```
Fix a thread when:
- the author is `cursor` / `cursor[bot]`
- `isResolved` is false
- the comment is a Bugbot finding (`<!-- BUGBOT_BUG_ID:` or a severity heading)
- it still applies to the current head (`isOutdated` is false, or outdated but
the same bug is still in the code)
Skip resolved threads and outdated findings whose code already changed.
Also paginate review comments in case Bugbot posted one that is not yet a
thread:
```bash
gh api --paginate repos/fastrepl/anarlog/pulls/<n>/comments
gh pr view <n> --comments
```
## 3. Fix on the PR branch
For each PR that has work, check out **that PR's head**, including fork heads:
```bash
gh pr checkout <n>
```
Do not `git fetch origin <headRefName>` or `git push origin <headRefName>`.
Fork PRs keep the branch on the contributor remote; `origin/<headRefName>` is
missing or is a different branch. Pushing to `origin` can create a stray
branch that is not the PR head.
Then:
1. Reproduce from the failing log or Bugbot location
2. Make the smallest change that fixes the failure or finding
3. Run the locally available checks from the CI workflows that the changed
paths trigger (`AGENTS.md` pre-commit verification)
4. Commit on that branch (do not amend someone else's commit)
5. `git push` (uses the tracking remote from `gh pr checkout`)
If `gh pr checkout` or `git push` cannot update a fork, stop and report that.
Do not open a replacement PR on `origin`.
Do not bundle unrelated PR fixes onto one branch. Do not retarget or close PRs.
If a finding is a false positive, leave it. Do not resolve GitHub review
threads unless the user asked; the code change is the fix.
## 4. Recheck
After pushing, re-run the inventory for that PR. Confirm:
- new CI is running or green
- the previous failure is gone or replaced by a new run
- the Bugbot thread is outdated or will be re-reviewed on the new commit
If a new failure or finding appears, fix it too.
## 5. Report
Summarize every ready PR:
- clean (CI green, no unresolved Bugbot)
- waiting (checks still running)
- fixed (what changed, PR number)
- skipped draft
Do not merge.
More agent context in fastrepl/anarlog
38 other files this repository gives its agents.
Skill
- add-plugin.agents/skills/add-plugin/SKILL.md
- anarlog-workflow.agents/skills/anarlog-workflow/SKILL.md
- axum-test-transport.agents/skills/axum-test-transport/SKILL.md
- create-prs.agents/skills/create-prs/SKILL.md
- fix-prs.agents/skills/fix-prs/SKILL.md
- but.agents/skills/gitbutler/SKILL.md
- migrate-to-sqlite.agents/skills/migrate-to-sqlite/SKILL.md
- new-changelog.agents/skills/new-changelog/SKILL.md
- no-use-effect.agents/skills/no-use-effect/SKILL.md
- product-update-newsletter.agents/skills/product-update-newsletter/SKILL.md
- qa-cli-mcp-api.agents/skills/qa-cli-mcp-api/SKILL.md
- qa-critical-ux.agents/skills/qa-critical-ux/SKILL.md
- reactive-sqlite-ui.agents/skills/reactive-sqlite-ui/SKILL.md
- release-api.agents/skills/release-api/SKILL.md
- release-cli.agents/skills/release-cli/SKILL.md
- release-docs.agents/skills/release-docs/SKILL.md
- release-mcp.agents/skills/release-mcp/SKILL.md
- release-new-version.agents/skills/release-new-version/SKILL.md
- release-telemetry.agents/skills/release-telemetry/SKILL.md
- sqlite-schema-design.agents/skills/sqlite-schema-design/SKILL.md
- sweep-workspace.agents/skills/sweep-workspace/SKILL.md
- testing.agents/skills/testing/SKILL.md
- update-prs.agents/skills/update-prs/SKILL.md
- fix-ready-prs.claude/skills/fix-ready-prs/SKILL.md
- product-update-newsletter.claude/skills/product-update-newsletter/SKILL.md
- qa-critical-ux.claude/skills/qa-critical-ux/SKILL.md
- release-new-version.claude/skills/release-new-version/SKILL.md
- new-changelog.cursor/skills/new-changelog/SKILL.md
- qa-cli-mcp-api.cursor/skills/qa-cli-mcp-api/SKILL.md
- qa-critical-ux.cursor/skills/qa-critical-ux/SKILL.md
- release-new-version.cursor/skills/release-new-version/SKILL.md
- anarlogdocs/skill.md
- anarlogskills/anarlog/SKILL.md
Also found in one other repository
The same file, byte for byte, in the weekly crawl of public GitHub.
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

