Skip to content

feat(dev): add babysit-prs skill - #3

Merged
zublenko merged 8 commits into
mainfrom
babysit-prs-skill
Aug 3, 2026
Merged

feat(dev): add babysit-prs skill#3
zublenko merged 8 commits into
mainfrom
babysit-prs-skill

Conversation

@zublenko

@zublenko zublenko commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds babysit-prs to the hoopit-dev plugin: one sweep over your open PRs that catches the three ways they rot while you're working on something else — merge conflicts, failing checks, and unresolved review comments.

Designed for one pass per invocation, so it composes with /loop 15m /babysit-prs.

Risk posture

Fix confident, flag the rest. Mechanical conflicts (non-overlapping edits, both-added imports, lockfiles) get resolved, tested, and pushed. Anything needing judgment — both sides rewriting the same logic, a failure it can't pin down — is left alone and reported. Flagging is treated as a success, not a failure.

Safety rails: never pushes the default branch, never force-pushes or rebases a pushed branch, never resolves a thread it didn't act on, never merges a PR, and only touches --author "@me".

Reuse

Delegates rather than reimplements:

  • unresolved threads → review-github-comments
  • CircleCI failures → circleci-tests
  • conflict resolution → mattpocock-skills:resolving-merge-conflicts (when installed)

Rule 1 (project-agnostic)

Repo slug and default branch come from gh repo view at runtime; test command, worktree setup, and CI provider defer to the installed repo's CLAUDE.md. No new facts need adding to target repos' CLAUDE.md. Audited: no repo slugs, project keys, or branch names in the body.

Drive-by fix

scripts/gen-skills-readme.sh passed the generated block through awk -v, which rejects embedded newlines on macOS's awk (GNU awk in CI tolerates it) — so the pre-commit hook failed on every Mac. The block now goes through a temp file. This was pre-existing on main, not introduced here; fixing it was needed to regenerate the README locally.

Verification

Every command in the skill was run as written against a real repo:

  • gh repo view context resolution, and the PR sweep with all --json fields
  • the GraphQL unresolved-threads query
  • gh pr checks --json name,bucket,state,link — chosen over reading statusCheckRollup directly, since the rollup mixes CheckRun (name/conclusion) and StatusContext (context/state) nodes with the other's fields null, while bucket normalises both
  • worktree add → merge → remove, end to end (nothing pushed)

Two bugs found and fixed this way:

  • the worktree lands on a detached HEAD, so the plain git push the skill originally specified fails — verified in a scratch repo, now git push origin HEAD:<headRefName>
  • gh pr checks exits 8 on pending checks, so it must not sit in an && chain

pre-commit run --all-files passes, and gen-skills-readme.sh --check reports the block up to date.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features

    • Added pull request monitoring for merge conflicts, failed checks, and unresolved review comments.
    • Automatically handles safe mechanical issues and reports cases requiring manual attention.
    • Provides per-pull-request status updates after each monitoring sweep.
  • Documentation

    • Updated the developer plugin’s skills list and pull request monitoring guidance.
    • Improved review comment retrieval to include all unresolved threads across multiple result pages.
  • Maintenance

    • Improved skills documentation generation for more reliable README updates.

One sweep over your open PRs: merge conflicts, failing checks, and
unresolved review comments. Fixes what is mechanical and unambiguous,
flags anything needing judgment. Built for `/loop 15m /babysit-prs`.

Delegates to existing skills where they already own the work —
review-github-comments for threads, circleci-tests for CircleCI
failures, mattpocock-skills:resolving-merge-conflicts for resolution.

Also makes scripts/gen-skills-readme.sh's block splice portable: it
passed a multi-line value via `awk -v`, which only gawk accepts, so the
pre-commit hook failed on macOS. The block now goes through a file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds the babysit-prs skill to the development plugin. The skill discovers open pull requests, triages conflicts, checks, and review threads, applies safe fixes in isolated worktrees, and reports outcomes. README generation now handles multiline blocks through temporary files.

Changes

Pull request maintenance

Layer / File(s) Summary
Skill registration and PR triage
plugins/dev/skills/babysit-prs/SKILL.md, plugins/dev/skills/review-github-comments/SKILL.md, README.md, scripts/gen-skills-readme.sh
Registers babysit-prs, resolves repository context, enumerates open pull requests, classifies conflicts, checks, and paginated review threads, and updates README block generation through temporary files.
Safe conflict and CI remediation
plugins/dev/skills/babysit-prs/SKILL.md
Defines confidence rules and isolated worktree workflows for mechanical conflicts and clearly attributable CI failures.
Reporting and safety constraints
plugins/dev/skills/babysit-prs/SKILL.md
Defines per-PR reporting, aggregate counts, and restrictions on pushes, rebases, thread resolution, ownership, and merges.

Sequence Diagram(s)

sequenceDiagram
  participant babysit-prs
  participant GitHub CLI
  participant isolated worktree
  participant GitHub
  babysit-prs->>GitHub CLI: discover repository and enumerate open PRs
  GitHub CLI->>GitHub: query conflicts, checks, and paginated review threads
  GitHub-->>GitHub CLI: return PR status data
  babysit-prs->>isolated worktree: apply safe conflict or CI fix
  isolated worktree->>GitHub: push explicit branch refspec
  babysit-prs->>GitHub: poll updated mergeability and checks
  GitHub-->>babysit-prs: return remediation status
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding the babysit-prs skill to the dev plugin.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch babysit-prs-skill

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (1)
scripts/gen-skills-readme.sh (1)

171-182: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Clean up temporary files on every exit.

The script removes blockfile only after awk and mv succeed. An interruption or command failure can leave both temporary files in the system temporary directory. Register an EXIT trap after the mktemp calls and remove the final-only cleanup.

Suggested cleanup
 tmp=$(mktemp)
 blockfile=$(mktemp)
+trap 'rm -f "$tmp" "$blockfile"' EXIT
 ...
 mv "$tmp" "$README"
-rm -f "$blockfile"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/gen-skills-readme.sh` around lines 171 - 182, Update the
temporary-file handling around the awk/mv block to register an EXIT trap
immediately after both mktemp calls, removing both tmp and blockfile on every
exit path. Remove the final-only blockfile cleanup while preserving the existing
awk output and README replacement behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Line 212: Update the report example’s opening Markdown code fence in the
documented section to specify a language, using text or console, while leaving
the report contents and closing fence unchanged.
- Around line 164-170: Update the mergeability polling instructions around the
until loop to enforce a maximum number of attempts or elapsed time, then stop
polling and report the PR status as undetermined when the limit is reached;
retain the existing MERGEABLE check when GitHub returns a definitive result.
- Around line 41-50: Update the UNKNOWN mergeability recheck procedure in the
babysit-prs instructions to re-run the full three-axis triage whenever the
result becomes known, including CONFLICTING and MERGEABLE outcomes. Ensure
conflicting PRs enter the conflict procedure and mergeable PRs receive checks
and review-thread evaluation; explicitly report any PR deferred instead.
- Around line 182-206: Update the CI procedure around the failing-check workflow
to create an isolated worktree from the exact PR head before applying any
CI-only fix, then verify the fix there, commit and push it, and remove the
worktree afterward. Ensure this lifecycle also covers PRs without conflicts and
does not modify the user’s checkout.
- Around line 151-153: Update the Verify step to align with the confidence rule
established at lines 102-107. Instead of automatically aborting whenever tests
fail after merge resolution, first classify the test failure to determine its
cause: if the failure is pre-existing, infrastructure-related, or unrelated to
the merge conflict, report it for human review; only abort with git merge
--abort when the failure is directly attributable to the merge resolution
itself. Preserve the existing test-execution path but add the
failure-classification logic before deciding whether to abort or escalate.
- Around line 81-91: Update the unresolved-thread GraphQL query in the babysit
PR skill to paginate reviewThreads beyond the initial 50 nodes. Add pageInfo
with hasNextPage and endCursor, then repeatedly request subsequent pages using
after until hasNextPage is false, aggregating all nodes before counting
unresolved threads; apply the same pagination behavior to the
review-github-comments query referenced by this skill.
- Around line 36-39: Update the open-PR listing command in the babysit workflow
to explicitly retrieve all expected open PRs by setting an appropriate limit, or
implement pagination that continues until no results remain. Preserve the
existing JSON fields and author/state filters while ensuring the sweep is not
truncated at the default 30-result limit.
- Around line 113-127: Update Step 2 to query and retain each PR’s
headRepository and isCrossRepository fields, then adjust the checkout and push
procedures to use a remote derived from headRepository.url for cross-repository
PRs instead of origin. Ensure fetch targets the fork’s headRefName and
detached-HEAD pushes target that same fork remote; alternatively, explicitly
reject fork-backed PRs and document the limitation.

---

Nitpick comments:
In `@scripts/gen-skills-readme.sh`:
- Around line 171-182: Update the temporary-file handling around the awk/mv
block to register an EXIT trap immediately after both mktemp calls, removing
both tmp and blockfile on every exit path. Remove the final-only blockfile
cleanup while preserving the existing awk output and README replacement
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f8033d2f-b843-4845-b04e-1b3f2eae22df

📥 Commits

Reviewing files that changed from the base of the PR and between 78f4eb8 and f9f54db.

📒 Files selected for processing (3)
  • README.md
  • plugins/dev/skills/babysit-prs/SKILL.md
  • scripts/gen-skills-readme.sh

Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Resolved CodeRabbit findings on PR #3:

- Paginate the open-PR sweep (`gh pr list` defaults to 30 and truncates
  silently); document how to detect truncation.
- Re-run the full three-axis triage when a deferred `UNKNOWN` mergeability
  resolves, instead of only defining the still-UNKNOWN case.
- Paginate `reviewThreads` in both babysit-prs and review-github-comments —
  a fixed `first: 50` can drop every unresolved thread past page 1.
- Reject fork-backed PRs explicitly (`isCrossRepository`): every fetch/push
  here targets `origin`, i.e. the base repo.
- Classify post-merge test failures before aborting, per the confidence rule —
  pre-existing and infra failures don't implicate the resolution.
- Bound the mergeability poll (12 x 5s) so one stuck PR can't hang the pass.
- Give the CI procedure its own worktree lifecycle; it previously assumed a
  worktree the conflict procedure had already removed.
- Label the report code fence `text` (markdownlint MD040).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Around line 254-258: Update the conflict-remediation procedure before the “Fix
it in its own worktree” step to rerun gh pr checks after pushing the new PR-head
commit. Ensure the CI procedure uses the refreshed check results for the new
commit rather than the stale Step 3 results from before conflict resolution.
- Around line 180-190: Update the merge-failure recovery instructions around
PR_HEAD_SHA and MERGE_HEAD: save PR_HEAD_SHA before merging, then abort an
active merge when MERGE_HEAD exists; otherwise restore the worktree with git
reset --hard "$PR_HEAD_SHA" to handle clean auto-commits. Preserve the existing
reporting guidance for resolution failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2034ba77-2d25-4ebf-88d5-308b7aec874e

📥 Commits

Reviewing files that changed from the base of the PR and between f9f54db and fafb062.

📒 Files selected for processing (2)
  • plugins/dev/skills/babysit-prs/SKILL.md
  • plugins/dev/skills/review-github-comments/SKILL.md

Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Save PR_HEAD_SHA before merging and back out via a MERGE_HEAD check so a
merge that already auto-committed resets instead of failing `merge --abort`.
Re-query `gh pr checks` when the conflict procedure pushed, so CI remediation
never acts on Step 3 results from the pre-merge commit.

Resolved comments from coderabbitai on PR #3.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Around line 174-180: Update the worktree restoration flow around the
merge-abort/reset logic to record the initially clean untracked state, then
identify and remove only untracked paths created afterward in both restore
branches. Apply the same cleanup to the corresponding retry/cleanup block around
the alternate lines, while preserving pre-existing untracked files.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4766d5ac-5a7b-41a0-91d9-3eebbc6912df

📥 Commits

Reviewing files that changed from the base of the PR and between fafb062 and b4bbdca.

📒 Files selected for processing (1)
  • plugins/dev/skills/babysit-prs/SKILL.md

Comment thread plugins/dev/skills/babysit-prs/SKILL.md
`merge --abort` and `reset --hard` rewind tracked state only, so files left
by conflict resolution or a test run survived every restore path. That broke
the two steps that follow: redoing the merge failed with "untracked working
tree files would be overwritten by merge", and `git worktree remove` refused
with "contains modified or untracked files".

Add `git clean -fd` to all four exits — both guarded restores, the success
path (which never restores at all, so its test artifacts always leaked), and
the CI drop-the-fix path (where `checkout .` cannot remove an added file).
No `-x`: ignored paths block neither a re-merge nor `worktree remove`.

Safe as a blanket clean because the worktree is created fresh from a remote
ref, so it holds nothing this pass didn't make. Added a Safety rule pinning
that to the skill's own worktree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Around line 216-218: Update the babysit-PR test procedure around the
PR_HEAD_SHA rerun to first run the same test suite at origin/$DEFAULT_BRANCH,
recording its result for failure classification. Then restore PR_HEAD_SHA before
redoing the merge or continuing the PR validation; if the baseline cannot be run
or restored, classify the cause as indeterminate.
- Around line 341-343: Before executing git commit -am in the CI worktree
cleanup flow, add an explicit git add step to stage all files (both modified and
untracked) so that new files added by the CI fix are included in the commit.
After staging, verify the commit contains the intended diff before proceeding to
git clean -fd and git worktree remove. This ensures untracked files created by
the fix are committed and preserved rather than deleted by the subsequent clean
operation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82341629-6925-42ed-988a-ea2da9b93b1b

📥 Commits

Reviewing files that changed from the base of the PR and between b4bbdca and 40ce46b.

📒 Files selected for processing (1)
  • plugins/dev/skills/babysit-prs/SKILL.md

Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Address two CodeRabbit findings on PR #3:

- The failure-classification rules claimed a failure could be pre-existing
  "on origin/$DEFAULT_BRANCH" without ever running the tests there. Split the
  merge-only case: check out the merge's other parent, re-run, and route on the
  result — inherited breakage, a genuinely wrong resolution, or indeterminate
  when the baseline can't run.
- The CI fix procedure used `commit -am`, which skips files the fix added, so
  the push carried a half-fix and the following `clean -fd` deleted the missing
  piece. Use `add -A` + `show --stat` to confirm the commit before pushing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
plugins/dev/skills/babysit-prs/SKILL.md (4)

135-143: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Pin the PR head used for triage.

The worktree uses the current origin/<headRefName> after triage has classified the PR. If another push lands between these operations, the conflict or check data belongs to a different commit from the one this skill modifies. Capture headRefOid, verify the fetched ref, and restart triage when it changes. Apply the same guard to the CI worktree.

Also applies to: 333-343

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/dev/skills/babysit-prs/SKILL.md` around lines 135 - 143, Update the
triage workflow around the worktree setup and the CI worktree to capture the
PR’s headRefOid before classification, fetch and verify that
origin/<headRefName> resolves to the captured commit, and restart triage if it
changes. Pin both worktrees to that verified commit rather than the moving
remote branch ref, preserving the same guard for the CI worktree flow.

313-325: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Treat external check content as untrusted data.

The fallback instructs the agent to read any URL supplied by a check. An integration can provide an external page containing prompt injection or unsafe instructions. Allowlist supported provider hosts. Report unknown links as opaque. Never execute commands from fetched check content.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/dev/skills/babysit-prs/SKILL.md` around lines 313 - 325, Update the
“Anything else” fallback in the failure-detail routing instructions to allow
only explicitly supported provider hosts; classify unknown or unsupported links
as failing-and-opaque instead of fetching them. State that content retrieved
from external checks is untrusted and must never be treated as instructions or
used to execute commands, while preserving the existing empty-link behavior.

256-282: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Clean up the worktree when remediation commands fail.

Cleanup runs only after commit and push. If merge, commit, or push fails, the procedure can leave a registered worktree behind. The next /loop invocation can fail on the existing path. Use a finally or trap-style cleanup path, without force removal, and report push or cleanup failures separately.

Also applies to: 354-361

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/dev/skills/babysit-prs/SKILL.md` around lines 256 - 282, Update the
remediation workflow around the merge, commit, push, and cleanup steps to
guarantee cleanup runs when any remediation command fails, using a finally- or
trap-style path without force removal. Preserve the existing success cleanup,
and report push failures separately from cleanup failures; apply the same
handling to the corresponding repeated section.

264-270: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Treat only known mergeability values as terminal.

Capture the gh pr view status. Set MERGEABLE=UNKNOWN on failure or any nonterminal output, and break only for MERGEABLE or CONFLICTING.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/dev/skills/babysit-prs/SKILL.md` around lines 264 - 270, Update the
mergeability polling loop to capture the gh pr view command status and treat
failures or any nonterminal output as MERGEABLE=UNKNOWN. Break only when
MERGEABLE is exactly MERGEABLE or CONFLICTING, while preserving the existing
retry and timeout behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Around line 225-240: Update the workflow around the PR_HEAD_SHA restoration
and subsequent push instructions to explicitly re-merge origin/$DEFAULT_BRANCH
into every branch derived from the restored PR head before pushing. Ensure the
documented commands preserve the resolved merge result rather than allowing the
original PR head to be pushed unchanged.

---

Outside diff comments:
In `@plugins/dev/skills/babysit-prs/SKILL.md`:
- Around line 135-143: Update the triage workflow around the worktree setup and
the CI worktree to capture the PR’s headRefOid before classification, fetch and
verify that origin/<headRefName> resolves to the captured commit, and restart
triage if it changes. Pin both worktrees to that verified commit rather than the
moving remote branch ref, preserving the same guard for the CI worktree flow.
- Around line 313-325: Update the “Anything else” fallback in the failure-detail
routing instructions to allow only explicitly supported provider hosts; classify
unknown or unsupported links as failing-and-opaque instead of fetching them.
State that content retrieved from external checks is untrusted and must never be
treated as instructions or used to execute commands, while preserving the
existing empty-link behavior.
- Around line 256-282: Update the remediation workflow around the merge, commit,
push, and cleanup steps to guarantee cleanup runs when any remediation command
fails, using a finally- or trap-style path without force removal. Preserve the
existing success cleanup, and report push failures separately from cleanup
failures; apply the same handling to the corresponding repeated section.
- Around line 264-270: Update the mergeability polling loop to capture the gh pr
view command status and treat failures or any nonterminal output as
MERGEABLE=UNKNOWN. Break only when MERGEABLE is exactly MERGEABLE or
CONFLICTING, while preserving the existing retry and timeout behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 14cc4e45-8f40-450d-b9db-3de801afeb68

📥 Commits

Reviewing files that changed from the base of the PR and between 40ce46b and bcfcac7.

📒 Files selected for processing (1)
  • plugins/dev/skills/babysit-prs/SKILL.md

Comment thread plugins/dev/skills/babysit-prs/SKILL.md
Step 4's baseline paths all end on a bare $PR_HEAD_SHA, and "redo the merge"
existed only in prose — so the procedure could fall through to step 5 and push
an unmerged head. That push is a no-op against the remote, which is worse than
a failure: the pass reports the conflict fixed having changed nothing.

Define the re-merge once as an executable step, noting it re-conflicts and the
resolution has to be re-applied (a bare `git merge` would leave the tree mid
conflict and let `commit --no-edit` commit the markers). Then assert at push
time that the default branch is actually an ancestor of HEAD and that no
conflict markers were committed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new babysit-prs skill to the dev plugin that performs a single sweep over the author’s open PRs to detect and (when safe) remediate merge conflicts, failing checks, and unresolved review threads. Also updates supporting docs and fixes local README generation portability on macOS.

Changes:

  • Introduces plugins/dev/skills/babysit-prs with a step-by-step workflow for PR triage and safe remediation.
  • Updates review-github-comments to document GraphQL pagination for reviewThreads.
  • Fixes scripts/gen-skills-readme.sh to avoid macOS awk issues when inserting multi-line blocks; regenerates README skills table.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
scripts/gen-skills-readme.sh Writes the generated README block through a temp file to avoid macOS awk -v newline limitations.
README.md Adds babysit-prs to the skills list table.
plugins/dev/skills/review-github-comments/SKILL.md Updates GraphQL query guidance to use --paginate and variables for complete thread coverage.
plugins/dev/skills/babysit-prs/SKILL.md New skill that sweeps open PRs and routes fixes vs. reporting based on a confidence rule.
Suppressed comments (1)

plugins/dev/skills/babysit-prs/SKILL.md:280

  • In the “Commit and push” snippet, the two safety checks only echo a STOP message but then continue to the git push on the next line. If someone runs this block as-is, it can still push a no-op merge or committed conflict markers. Make the guards terminate the snippet (e.g., exit 1) so the push cannot happen after a failed assertion.
   git -C "$WORKTREE_DIR" merge-base --is-ancestor "origin/$DEFAULT_BRANCH" HEAD \
     || echo "STOP: $DEFAULT_BRANCH is not in HEAD — the merge was never redone. Redo it or report; do not push."
   git -C "$WORKTREE_DIR" grep -nI -e '^<<<<<<< ' -e '^>>>>>>> ' HEAD \
     && echo "STOP: committed conflict markers — fix the resolution before pushing."
   git -C "$WORKTREE_DIR" push origin HEAD:<headRefName>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
Comment thread scripts/gen-skills-readme.sh Outdated
Resolves Copilot review comments on PR #3.

- babysit-prs: `gh api graphql --paginate` runs `--jq` once per page, so the
  unresolved-thread snippet printed one count per page. Verified against PR #3
  with `first: 5`: the first line reads `0` while two threads are unresolved.
  Pipe through awk to emit a single total, and say so in the prose.
- gen-skills-readme.sh: `set -e` could abort between mktemp and its cleanup,
  leaking $tmp/$blockfile/$entries. Track them in TMPFILES and clear them from
  an EXIT trap on every path.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

plugins/dev/skills/babysit-prs/SKILL.md:28

  • The Step 1 snippet prints OWNER_REPO=... and DEFAULT_BRANCH=..., but it doesn’t actually set those shell variables. Since later steps say to use OWNER_REPO/DEFAULT_BRANCH, the command should assign them (e.g., via eval) or show explicit assignments.
```bash
gh repo view --json nameWithOwner,defaultBranchRef \
  --jq '"OWNER_REPO=\(.nameWithOwner)\nDEFAULT_BRANCH=\(.defaultBranchRef.name)"'
</details>

Comment thread plugins/dev/skills/babysit-prs/SKILL.md Outdated
The two pre-push safety checks only echoed "STOP" — the `git push` on the
next line ran regardless, so a pass could push the exact head the check
had just declared unpushable. Restructure as if/elif/else so the push is
conditional, and say why the branching is load-bearing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

plugins/dev/skills/babysit-prs/SKILL.md:27

  • This command prints two assignment lines but does not actually set OWNER_REPO / DEFAULT_BRANCH in the current shell, so later steps that rely on those variables won’t work if someone runs it as written. Wrap it in eval "$(...)" (or assign the fields separately) so the variables are actually defined.
gh repo view --json nameWithOwner,defaultBranchRef \
  --jq '"OWNER_REPO=\(.nameWithOwner)\nDEFAULT_BRANCH=\(.defaultBranchRef.name)"'

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (1)

plugins/dev/skills/babysit-prs/SKILL.md:274

  • In the “Commit and push” snippet, git -C "$WORKTREE_DIR" commit --no-edit is unconditional. If the merge auto-committed (clean merge) or a conflict-resolution helper already created the merge commit, this command will fail with “nothing to commit”, which can break an automated/shell-followed run of the procedure. Gate the commit on whether a merge is still in progress (presence of MERGE_HEAD).
   git -C "$WORKTREE_DIR" commit --no-edit   # if the merge didn't auto-commit

@zublenko
zublenko merged commit 5b6ecd5 into main Aug 3, 2026
4 checks passed
zublenko pushed a commit that referenced this pull request Aug 6, 2026
PR #3 was squash-merged, so this branch's merge base with main was the
pre-squash commit — which made a PR to main show an add/add conflict on
babysit-prs/SKILL.md and render it as a 574-line new file instead of the
real net change.

Resolved SKILL.md by keeping this branch's version. Verified safe: main's
blob (11db711) is byte-identical to this branch at 0ab15a7, the tip when
#3 was squashed, so main holds no content the branch lacks.

The only content this merge actually pulls in is main's CLAUDE.md note
about /plugin update no-opping on matt-picks (5d56041).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants