feat(pr): add resumable sequential merge batches - #2761
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_abeb2a10-ee34-4ebc-9302-3ac53a8102d3) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49bcab61f3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| concurrency: | ||
| group: pr-batch-mutation | ||
| cancel-in-progress: false | ||
| queue: max |
There was a problem hiding this comment.
Remove the unsupported concurrency queue key
GitHub Actions concurrency mappings support group and cancel-in-progress, but not queue; adding queue: max makes this workflow invalid before any job can run. The same key was also added to the Codex operator and auto-resolve workflows, so enabling this change prevents both the new batch runner and existing repair automation from loading.
Useful? React with 👍 / 👎.
| if ( | ||
| !/^(?!\/)(?!.*\.\.)(?!.*@\{)[A-Za-z0-9._/-]+$/.test(pr.headRef) || | ||
| /^(?:main|master|develop|release(?:\/|$))/.test(pr.headRef) || |
There was a problem hiding this comment.
Protect auth directories, not only auth filenames
The sensitive-name expression only examines the final path component, so the existing src/app/auth/callback/route.ts returns false from protectedPath; with a policy-compliant PR body, eligibility consequently returns no exclusion. A change to this authentication callback can therefore be repaired and merged automatically despite the documented exclusion for authorization/security changes; test every path segment or explicitly cover auth/security directories.
Useful? React with 👍 / 👎.
| const tree = (await this.gh.rest.git.getTree({ ...this.repo, tree_sha: commit.tree.sha, recursive: "1" })).data; | ||
| if (tree.truncated || tree.tree.some((item) => item.type === "blob" && !item.path.endsWith(".json"))) | ||
| throw new Error("Unsafe state branch tree"); | ||
| const entry = tree.tree.find((item) => item.path === "state.json" && item.type === "blob"); | ||
| if (!entry) throw new Error("Missing state.json on existing state branch"); | ||
| const blob = (await this.gh.rest.git.getBlob({ ...this.repo, file_sha: entry.sha })).data; | ||
| const state = validateState(JSON.parse(Buffer.from(blob.content, "base64").toString("utf8"))); |
There was a problem hiding this comment.
Authenticate batch state before executing mutations
If any repository writer updates the otherwise unprotected codex/pr-batch-state branch, load() trusts a forged state.json after checking only its structure and a self-computable manifest digest. A scheduled wake can then use the stored GH_TOKEN and OPENAI_API_KEY to repair or merge the attacker's selected eligible PR without the owner ever issuing the required Clear PRs authorization; the state needs provenance that ordinary writers cannot forge, such as a protected state store or authenticated signature.
AGENTS.md reference: AGENTS.md:L280-L285
Useful? React with 👍 / 👎.
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch codex/chat-pr-batch-runner-1076 at starting commit 49bcab6; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:codex/chat-pr-batch-runner-1076, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
CI triageCI failed on this PR. Automated classification of the 3 failed job(s):
Compared with main CI run #16436 (failure). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Summary
Clear PRsrepository shortcut and activation guide. Preserve migration, clinical/RAG, provider, and controller-policy exclusions.Verification
Prior implementation checks (not repeated for this publication):
npm run test -- tests/pr-batch-runner.test.ts tests/pr-batch-github.test.ts tests/codex-run-pr-operator-workflow.test.ts tests/codex-autofix-workflow.test.ts— 124 tests passed.npm run typecheck— passed.lint:changed:internalon changed scripts and tests with--max-warnings 0— passed.npm run check:github-actionsandnpm run check:codex-autofix-workflow— passed.node scripts/update-docs-inventory.mjs --checkandgit diff --check— passed.verify:pr-localsuite; focused controller/operator tests and workflow guards cover the changed contracts. Hosted checks remain authoritative before merge.Risk and rollout
PR_BATCH_ENABLEDabsent/false or pause a batch. Pausing does not revoke an already-issued merge request; never silently disable user-owned auto-merge.Clinical Governance Preflight
Not applicable to application behavior: no ingestion, clinical output, document access, privacy, source rendering, or production environment configuration changes. The batch eligibility checks preserve existing governance and migration restrictions.
Notes
Note
High Risk
Introduces automation that can dispatch repairs, push feature branches, and request protected merges plus downstream Railway deploys once
PR_BATCH_ENABLEDis set; coordination changes affect existing Run PR and auto-resolve behavior even when the batch runner stays off.Overview
Adds a disabled-by-default sequential PR batch runner that snapshots eligible open PRs, journals state on
codex/pr-batch-state, and processes them one at a time with bounded Codex repairs, branch sync, and protectedgh pr merge --autohandoffs. Newscripts/pr-batch-*modules implement eligibility (protected paths, RAG canary evidence, dependencies), durable mutations with per-effect receipts, and workflow policy guards wired intocheck-github-action-pins.Integrates the existing Codex Run PR operator for batch repairs: optional
batch_id/batch_operation, ownership claims viapr-batch-worker.mjs, pending base merges with working-tree conflict resolution (sealed againstOPERATOR_COMPARE_TREE), requiredprogress_outcomeon repair results, and journaled publish/reply/rerun steps whenbatch_idis set. Standalone operator and Codex auto-fix now sharepr-batch-mutationconcurrency and yield when a PR is batch-reserved.Documents the
Clear PRsagent shortcut and activation inAGENTS.md,pull-request-workflow.md, anddocs/pr-batch-runner.md; extends operator prompt/schema and artifact retention (7 days); ignores.codex-run-pr/in Prettier.Reviewed by Cursor Bugbot for commit 49bcab6. Configure here.