From 7389dc4d3e605d614c0b7249d197565592dc0a7c Mon Sep 17 00:00:00 2001 From: joaolfp Date: Mon, 16 Nov 2026 10:41:57 -0300 Subject: [PATCH 1/2] docs: monitor CI and Bugbot, fix issues and merge in open-pr skill Co-Authored-By: Claude Opus 5.5 --- .claude/skills/open-pr/SKILL.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.claude/skills/open-pr/SKILL.md b/.claude/skills/open-pr/SKILL.md index a44f704..82d4f5e 100644 --- a/.claude/skills/open-pr/SKILL.md +++ b/.claude/skills/open-pr/SKILL.md @@ -1,6 +1,6 @@ --- name: open-pr -description: Generates a PR summary from local git changes and opens the pull request on GitHub automatically. Use when the user asks to open, create, or submit a PR. +description: Generates a PR summary from local git changes, opens the pull request on GitHub, monitors CI and Cursor Bugbot, fixes any failure or Bugbot finding, and merges once everything passes. Use when the user asks to open, create, or submit a PR. --- # Open Pull Request @@ -45,6 +45,21 @@ Generates a PR description from local changes and creates the pull request on Gi - Create the PR with `gh pr create` using `--title`, `--head`, `--base main`, and `--body` with the generated description. - Return the PR URL to the user. +7. **Monitor CI and Cursor Bugbot** + - Watch `gh pr checks ` until no check is pending (poll every ~30 s in the background; don't sleep in the foreground). The checks are `Build` on Ubuntu, macOS and Windows, `Audit workflows (zizmor)` and `Cursor Bugbot`. + - When all checks are done, read Bugbot's findings: `gh api repos/{owner}/{repo}/pulls//comments` (inline comments) and `gh api repos/{owner}/{repo}/pulls//reviews`. A passing `Cursor Bugbot` check can still leave comments, so always read them. + +8. **Fix problems, then repeat** + - If a check fails, read the log (`gh run view --log-failed`), reproduce locally (`cargo build`, `cargo clippy --all-targets --all-features`, `cargo test`, `cargo fmt --all -- --check`, `mise run zizmor`) and fix the cause. + - If Bugbot reports an issue, verify it against the code. Fix real bugs; for a false positive, reply to the comment explaining why instead of changing code. + - Commit each fix with a conventional-commit message (e.g. `fix: ...`), push to the same branch, and go back to step 7. + - Never bypass a failing check (no `--admin`, no disabling or skipping checks). + +9. **Merge** + - Only when every check passed and no Bugbot finding is left unresolved: `gh pr merge --squash --delete-branch` (the repository only allows squash merges). + - Switch back to `main`, `git pull --ff-only`, delete the local branch (`git branch -D `, needed because squash merges are not ancestors) and `git fetch --prune`. + - Tell the user the PR was merged, with the merge commit, and list any fixes made along the way. + ## Output Template (PR body) Use this exact structure. Do NOT include a "Suggested Commit" section. @@ -74,4 +89,5 @@ Use this exact structure. Do NOT include a "Suggested Commit" section. - Never push directly to `main`. If the current branch is `main`, automatically create a feature branch, commit the changes, and continue. - If there are no commits ahead of `main` and no local changes exist, inform the user and stop. - If the branch is already up-to-date on the remote, skip the push step. -- If a PR already exists for the branch, inform the user of the existing PR URL instead of creating a new one. +- If a PR already exists for the branch, inform the user of the existing PR URL instead of creating a new one, then continue from step 7 (monitor, fix, merge). +- If a check keeps failing for a reason outside the PR (e.g. a GitHub or crates.io outage), stop and tell the user instead of merging. From 8abc5e0a59c917a88ad5fe7ccec79b4b3e5e3df9 Mon Sep 17 00:00:00 2001 From: joaolfp Date: Mon, 16 Nov 2026 10:48:13 -0300 Subject: [PATCH 2/2] fix: wait for all checks and delete local branch only if present in open-pr skill Co-Authored-By: Claude Opus 5.5 --- .claude/skills/open-pr/SKILL.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude/skills/open-pr/SKILL.md b/.claude/skills/open-pr/SKILL.md index 82d4f5e..73a28bd 100644 --- a/.claude/skills/open-pr/SKILL.md +++ b/.claude/skills/open-pr/SKILL.md @@ -46,8 +46,8 @@ Generates a PR description from local changes and creates the pull request on Gi - Return the PR URL to the user. 7. **Monitor CI and Cursor Bugbot** - - Watch `gh pr checks ` until no check is pending (poll every ~30 s in the background; don't sleep in the foreground). The checks are `Build` on Ubuntu, macOS and Windows, `Audit workflows (zizmor)` and `Cursor Bugbot`. - - When all checks are done, read Bugbot's findings: `gh api repos/{owner}/{repo}/pulls//comments` (inline comments) and `gh api repos/{owner}/{repo}/pulls//reviews`. A passing `Cursor Bugbot` check can still leave comments, so always read them. + - Watch `gh pr checks --json name,bucket` (poll every ~30 s in the background; don't sleep in the foreground) until **all five expected checks are listed** and none is pending: `Build (ubuntu-latest)`, `Build (macos-latest)`, `Build (windows-latest)`, `Audit workflows (zizmor)` and `Cursor Bugbot`. Right after `gh pr create` GitHub may not have registered any runs yet, and an empty or partial list is not "done". + - When all checks are done, read Bugbot's findings: `gh api repos/{owner}/{repo}/pulls//comments` (inline comments) and `gh api repos/{owner}/{repo}/pulls//reviews`. Bugbot can finish as `pass` or `skipping` and still post findings, so always read them. 8. **Fix problems, then repeat** - If a check fails, read the log (`gh run view --log-failed`), reproduce locally (`cargo build`, `cargo clippy --all-targets --all-features`, `cargo test`, `cargo fmt --all -- --check`, `mise run zizmor`) and fix the cause. @@ -57,7 +57,7 @@ Generates a PR description from local changes and creates the pull request on Gi 9. **Merge** - Only when every check passed and no Bugbot finding is left unresolved: `gh pr merge --squash --delete-branch` (the repository only allows squash merges). - - Switch back to `main`, `git pull --ff-only`, delete the local branch (`git branch -D `, needed because squash merges are not ancestors) and `git fetch --prune`. + - Switch back to `main` and `git pull --ff-only`. `gh pr merge --delete-branch` sometimes deletes the local branch too (not when run with `--repo`), so delete it only if it still exists: `git show-ref --verify --quiet refs/heads/ && git branch -D ` (`-D` because squash merges are not ancestors). Then `git fetch --prune`. - Tell the user the PR was merged, with the merge commit, and list any fixes made along the way. ## Output Template (PR body)