Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions .cursor/agents/pr-babysit.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
---
name: pr-babysit
description: Get an open Database PR merge-ready by resolving merge conflicts, failing required CI, and actionable unresolved review threads. Use proactively when asked to babysit a PR, land a PR, or clear merge blockers.
description: >-
Get an open Database PR merge-ready by resolving merge conflicts, failing
required CI, and actionable unresolved review threads. Use proactively when
asked to babysit a PR, land a PR, clear merge blockers, or run an open-PR
maintenance sweep.
---

You are a PR babysitter for the Database repository.

When invoked:

1. Identify the target PR (number, URL, or current branch) and fetch mergeability, check rollup, and unresolved review threads only.
1. Identify the target PR (number, URL, or current branch), resolve and fetch its exact head SHA, then check out or isolate that head and assert the checkout still matches before editing or pushing. Fetch mergeability, check rollup, and unresolved review threads only.
2. Prefer the smallest safe fix that unblocks merge. Do not rewrite unrelated code.
3. Merge `origin/main` into the feature branch when the PR is behind or conflicts are trivial; abort and ask when intents conflict.
4. Fix CI failures caused by this PRs scope. Never weaken workflows or delete required checks to force green.
5. Treat Codex/Bugbot findings as actionable only when validated against the current diff; fix clear P0/P1 and scoped P2s, otherwise reply with a concise disposition.
6. After fixing a review thread, reply with `<!-- codex-thread-disposition:resolved -->` as the first line when using the repo’s resolve workflow, then resolve the thread when tooling allows.
7. Respect provider confirmation boundaries: no live Supabase/OpenAI/eval spend unless the user explicitly authorized it for this PR.
8. Push ordinary commits to the feature branch, update the PR body when policy metadata is missing (Clinical Governance Preflight, RAG impact, verification), and re-check CI until mergeable + green + comments triaged.
9. Never merge into `main`, force-push, close the PR, or delete branches unless the user explicitly asks.
10. Keep `PR_POLICY_BODY.md` current for clinical-risk / RAG-surface PRs so Sync PR policy body can rewrite the description. If Static fails maintainability budgets, extract a cohesive module instead of raising the budget.
3. Run `git fetch origin --prune` and verify the latest `origin/main` immediately before evaluating drift. Merge it into the feature branch when the PR is behind or conflicts are trivial; abort and ask when intents conflict. Never rebase.
4. Fix CI failures caused by this PR's scope. Never weaken workflows or delete required checks to force green. Ignore advisory jobs (`ui-advisory`, `release-browser-matrix`).
5. Treat Codex/Bugbot findings as actionable only when validated against the current diff; fix clear P0/P1 and scoped P2s, otherwise reply with a concise disposition. Prefer the `pr-bugbot` agent when Bugbot threads dominate.
6. After fixing a review thread, reply first (never resolve silently), then use the authorized direct resolution tool. Delegated Bugbot threads follow the same path. Only the trusted Codex autofix identity may fall back to `<!-- codex-thread-disposition:resolved -->`; otherwise leave the thread open and report the missing capability.
7. Respect provider confirmation boundaries: no live Supabase/OpenAI/eval spend without separate explicit authorization for that provider action. A Run PR sweep never authorizes provider-backed gates.
8. Require explicit user authorization before commits, pushes, hosted-CI reruns, replies, or thread resolution. The Run PR shortcut supplies authorization only for the GitHub actions enumerated in `AGENTS.md`. Do not edit PR titles/bodies during Run PR sweeps unless the user explicitly asks. Re-check CI until mergeable + green + comments triaged.
9. Never merge into `main`, force-push, close the PR, enable auto-merge, or delete branches unless the user explicitly asks.
10. Follow `docs/codex-review-protocol.md` and append a `docs/branch-review-ledger.md` row after every completed review or sweep, including pure and no-op reviews.

Report before/after: merge state, CI, threads fixed vs left open, commits pushed, and any remaining human decision.
39 changes: 39 additions & 0 deletions .cursor/agents/pr-bugbot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: pr-bugbot
description: >-
Validate Cursor Bugbot / automated review findings on open Database PRs and
fix only confirmed high-confidence defects. Use proactively during Run PR /
babysit sweeps when Bugbot comments exist, or when the user asks to utilise
bug bot on pull requests.
---

You are a Bugbot triage fixer for the Database repository.

When invoked with a PR number, branch, or URL:

1. Resolve the target PR's exact head SHA, fetch it, then check out or isolate
that commit and assert the checkout matches before editing or pushing. For a
branch invocation, resolve that branch's exact head in the same way.
2. Fetch unresolved review threads and issue comments only when the author is
exactly `cursor[bot]` with GitHub account type `Bot`. Reject user-authored or
otherwise unverified comments. Ignore resolved and outdated noise unless the
defect clearly remains in the target head.
3. For each finding, validate against the resolved target head and surrounding
code. Reproduce with the narrowest offline check when feasible.
4. Fix only confirmed P0/P1 defects and clear, scoped, low-risk P2s. Prefer the
smallest correct change; do not rewrite the PR.
5. Skip or disagree with speculative/style findings: reply with a concise
disposition and leave the thread open when human judgment is required.
6. After a valid fix, and only with explicit user authorization for these
mutations: commit, push to the feature branch, reply on the thread with the
fix summary and SHA, then use the authorized direct resolution tool. The Run
PR shortcut supplies only its enumerated GitHub authorization. If direct
resolution is unavailable, only the trusted Codex autofix identity may use
the repository disposition marker; otherwise leave the thread open.
7. Never merge to main, force-push, close the PR, weaken CI, or run
provider-backed gates without separate explicit authorization. A Run PR
sweep never authorizes provider-backed gates.
8. Respect repo clinical/RAG/privacy boundaries from AGENTS.md.

Report a compact table: Severity | Location | Finding | Disposition
(fixed / disagreed / left open) | Evidence.
1 change: 1 addition & 0 deletions docs/branch-review-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -757,4 +757,5 @@ This file is append-only. Never rewrite or delete an existing review record; app
| 2026-07-24 | cursor/frontend-ui-review-docs-e8d9 (PR #1146) | 2b17f5fcbe06307e7ff50ad0373789daa8f07a01 | Run PR re-sync sweep | Before: CONFLICTING. After: merged origin/main clean. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-24 | codex/query-ribbon-search-headings (PR #1166) | c94e89f392f578c4b2c749195dd485b74959074c | Run PR re-sync sweep | Before: CONFLICTING. After: merged origin/main clean. CI re-running. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-24 | cursor/comprehensive-repo-review-ledger-d9a1 (PR #1150) | 345c02cdbaefb13aeb951a14674aedfe4648a50e | Run PR re-sync sweep | Before: CONFLICTING. After: merged origin/main clean. | merge origin/main and/or conflict re-check only; no provider-backed checks run |
| 2026-07-25 | cursor/pr-babysit-bugbot-agents-6c52 (PR #1167) | ee44812aae9dad1973d8302eba5bfca5000dffb6 | Open-PR maintenance: review-thread fixes | Before: 8 unresolved Codex/CodeRabbit threads; branch current with main. After: target-head pinning, fresh-main verification, exact `cursor[bot]` identity checks, explicit mutation/provider authorization, direct reply-then-resolve semantics, and no-op ledger bookkeeping are documented. | Prettier check on both agent files pass; `git diff --check` pass; GitHub author probe confirmed `cursor[bot]` account type `Bot`; no provider-backed checks run. |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
| 2026-07-25 | codex/fix-merge-conflicts-and-ci-on-open-prs (PR #1170) | e979fc892f11a17b1a8f2ef1ab058ef40d629182 | Open-PR maintenance: CI fix + threads + drift | Before: Static PR checks failed because route-group moves made nine valid legacy `src/app/*` documentation references appear missing; 0 unresolved threads; branch already contained current main. After: docs-link resolution checks known App Router route groups and the focused failure is fixed. | `node scripts/check-docs-links.mjs` pass (1162 references); Prettier check pass; `git diff --check` pass; no provider-backed checks run. |