| name | babysit-pr |
| description | Monitor a PR through CI, diagnose and fix test failures, resolve merge conflicts, post QR codes for mobile preview builds, and auto-merge when ready. Use when asked to "babysit", "monitor this PR", "watch CI", "fix CI", "post QR code", "make sure CI passes", or "merge when green".
|
| dependsOn | ["jonmumm/skills@codex-review","jonmumm/skills@deploy-verify"] |
babysit-pr
Monitor a pull request from open to merged. Diagnose CI failures, fix what's fixable, post mobile preview QR codes, and merge when green.
Workflow
- Identify PR (from current branch, URL, or PR number)
- Check CI status and diagnose failures
- Fix what's fixable (test failures, lint, type errors)
- Post mobile preview QR code (if Expo/RN project)
- Monitor until all checks pass
- Auto-merge or notify user
CI Diagnosis
Reading GitHub Actions Logs
gh run list --branch <branch> --limit 5
gh run view <run-id> --log-failed
gh run view <run-id> --job <job-id> --log
Common Failure Patterns
| Failure | Diagnosis | Fix |
|---|
| Type errors | tsc output in logs | Fix locally, push |
| Lint errors | ESLint/Prettier output in logs | Fix locally, push |
| Test failures (real) | Assertion mismatch, consistent across runs | Fix the code or test bug |
| Test failures (flaky) | Passes locally, intermittent in CI | Investigate the root cause — race condition, timing dependency, shared state, or missing test isolation. Fix the flakiness, don't just retry. |
| Build failures | Missing deps, lockfile mismatch | pnpm install, commit lockfile, push |
| Secret/env missing | References to undefined env vars | Flag to user — cannot fix automatically |
| Timeout | Job exceeded time limit | Check for infinite loops, increase timeout if legitimate |
Diagnosis Steps
- Run
gh run list --branch <branch> --limit 5 to see recent CI runs
- Identify the failed run and run
gh run view <run-id> --log-failed
- Read the error output — focus on the first error, not cascading failures
- Check if the failure is reproducible locally:
- Run the same command from the CI step (e.g.,
pnpm test, pnpm lint, pnpm typecheck)
- If it passes locally but fails in CI, suspect environment differences or flakiness
- Fix the root cause, commit, and push
- If the failure appears flaky (passes locally, intermittent in CI), investigate the root cause: race conditions, timing dependencies, shared state leaks, or missing test isolation. Fix the underlying issue rather than retrying.
QR Code for Mobile Preview
For Expo/React Native projects, post a QR code to the PR so reviewers can test on a real device.
Triggering a Preview Build
eas build --profile preview --platform ios --non-interactive
eas build --profile preview --platform android --non-interactive
eas build:list --limit 1 --json
Posting the QR Code
BUILD_URL=$(eas build:list --limit 1 --json | jq -r '.[0].artifacts.buildUrl')
QR_URL="https://api.qrserver.com/v1/create-qr-code/?size=250x250&data=${BUILD_URL}"
gh pr comment <pr-number> --body "$(cat <<EOF
## Mobile Preview Build

**Install link:** ${BUILD_URL}
> Scan with your device camera to install. QR codes expire when a new build is triggered.
EOF
)"
Device Registration and Distribution
Timing
Trigger the EAS build early — don't wait for CI to finish. Builds take 10-20 minutes for iOS and the preview can be ready while CI is still running.
Merge Conflict Resolution
When the PR has merge conflicts:
git fetch origin main
git rebase origin/main
git add <resolved-files>
git rebase --continue
git push --force-with-lease
Rules for conflict resolution:
- Read both sides of every conflict — never blindly accept one side
- If the conflict involves logic changes on both sides, flag to user rather than guessing
- Lockfile conflicts: delete the lockfile, run
pnpm install, commit the fresh lockfile
- After resolving, run the full test suite locally before pushing
Auto-merge
When all checks pass and the PR is approved:
gh pr merge <pr-number> --auto --squash
gh pr merge <pr-number> --squash
If auto-merge is not enabled on the repo, notify the user to merge manually or enable it in repo settings.
Monitoring Loop
Use scripts/monitor.sh to poll CI status:
./scripts/monitor.sh --pr 123
./scripts/monitor.sh --pr 123 --auto-merge
./scripts/monitor.sh --pr 123 --qr --project ./my-expo-app
The script polls gh pr checks every 2 minutes and reports status. When a failure is detected, it outputs the details so the agent can diagnose and fix. After 3 failed fix attempts on the same issue, it stops and notifies the user.
Agent Integration
The monitoring script is a status reporter — the agent handles the fixing. Typical loop:
- Script reports: "Check
test failed on run 12345"
- Agent runs
gh run view 12345 --log-failed
- Agent diagnoses and fixes
- Agent pushes the fix
- Script continues monitoring the new run
Gotchas
- Vet changes locally before pushing. Don't push blind fixes to a PR. Run the failing command locally, confirm your fix works, then push.
- Trigger EAS builds early. iOS builds take 10-20 minutes. Start them before CI finishes so the preview is ready sooner.
- QR codes expire. EAS build links rotate. Post fresh QR codes if the build is more than a few hours old.
- Some CI failures need secrets. If a failure references missing env vars or secrets, flag it to the user. These require GitHub Actions settings changes.
- Flaky tests need fixing, not retrying. If a test passes locally but fails in CI, investigate: race conditions, timing dependencies, shared state, missing teardown, or environment differences. Fix the root cause. Retrying hides bugs.
- Don't force-merge. If branch protection requires checks, they must pass. Never use
--admin to bypass.
- Force-push carefully. After a rebase, use
--force-with-lease to avoid overwriting someone else's commits.