Repository navigation
[2916 by Claude Opus 5.5] Add a conflict-resolution /merge capability to the ProPR MCP surface. - #2921
Conversation
…hing as typing `/merge` on a PR: it merges the base branch into the PR branch and has an agent resolve the conflicts. All tests, typecheck and lint pass. There's no UI change, so I didn't create previews. How it works (`packages/api/mcp/toolsPullRequests.ts`) - Inputs: it takes `repository`, `pullRequest`, `idempotencyKey` and a required `expectedHead`, the same as `start_ultrafix` and `stop_ultrafix`. It needs execute scope. - Checks before posting: the PR must be open and its head must match `expectedHead`, otherwise it fails with `STALE_HEAD`. - Label check (my addition, not in the issue): the existing `/merge` handling silently ignores PRs without a ProPR processing label (such as `AI` or `propr`). So the tool refuses those PRs up front with a new error, `PULL_REQUEST_NOT_MANAGED`, and posts nothing. Without this, the caller would only find out through a "not picked up" timeout 10 minutes later. - The merge itself: it posts a plain `/merge` comment and lets the existing comment handling do the work. None of the merge logic is copied. - Receipt: it returns the comment id, the head it ran against and the base branch. Following the receipt with `get_operation` The `/merge` worker task had no link back to the comment that started it, so a receipt couldn't follow it. I made a small change across three places: - The `/merge` comment handler now passes the comment id along, for regular PR comments only, not inline review comments. - The merge job carries that id as an optional `commandCommentId`. - The worker saves it on the task it creates (`src/jobs/processMergeConflictJob.ts`). The existing receipt tracking then finds the task with no special case. The receipt moves from accepted to running to completed or failed, or to unknown (with the usual "not picked up" error) if no worker starts it. Automatic conflict-resolution tasks don't carry a comment id, so a receipt can't latch onto the wrong one. Other changes - `update_pull_request_branch` still behaves the same. I only reworded its description: it used to say it matched `/merge`, which was wrong. It now says it's for clean updates and points to the new tool when GitHub rejects a conflict. - The `MERGE_CONFLICT` error from `merge_pull_request` now also suggests `resolve_merge_conflicts`. Tests - New tool tests cover a moved head, a PR without a label (nothing posted), the exact `/merge` comment format, and confirming the GitHub update-branch call is never used. - A tracking test shows the receipt follows only the task with the matching comment id, through running to completed. - Core tests cover the comment id flowing through the merge job and onto the saved task. - The existing scope and strict-input checks now include the new tool. - Results: full `npm run test:mcp` 410/410; merge-conflict and comment-handler tests 146/146. Docs: I updated `docs/mcp-coverage.md` (split the "Update branch" row into a clean-update row and a conflict-resolution row), `docs/mcp.md` (new section with an example call), `docs/docs/features/pr-commands.md`, and `CHANGELOG.md`.
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
⏳ Ultrafix is waiting for CI before the next These blocking checks on
Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops. |
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds ✅ Existing workflow reused — The tool posts ✅ Explicit preconditions — The tool requires ✅ Specific task correlation — Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Test the complete correlation pathConsider an integration test that passes the posted issue comment through intake, task-state persistence, and receipt polling. Current tests verify these pieces separately, while the lifecycle test manually inserts task records. Connecting them would strengthen regression coverage for the cross-layer handoff; this is optional because the supplied implementation consistently propagates the comment identifier. ScoreThe implementation addresses the requested capability with focused changes and relevant tests. All 24 reported current-head checks passed, with no verified merge blocker in the supplied code. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
…ckages/api/mcp/toolsPullRequests.ts` because it had 412 counted lines, over the 400-line limit (blank lines and comments don't count). That file reached this branch through the merge from main (#2921); the epic changes in this PR didn't touch it. I fixed the CI failure. The API lint step was rejecting `packages/api/mcp/toolsPullRequests.ts` because it had 412 counted lines, over the 400-line limit (blank lines and comments don't count). That file reached this branch through the merge from main (#2921); the epic changes in this PR didn't touch it. **Fix:** I moved the Redis lease that controls model-label changes on a pull request out into a new file, `packages/api/mcp/modelLabelLease.ts`. That covers the lease constants, `ModelLabelLease` and `withModelLabelLease`. `toolsPullRequests.ts` now imports it from there. This is a straight move: the code works exactly as before. **Checks:** - `npm run lint` in `packages/api` passes with no warnings. - The API typecheck (`tsc --noEmit`) passes. - The MCP test suite (`npm run test:mcp`) passes all 410 tests, including the one that checks the `MODEL_LABEL_LEASE_LOST` error. There's no visible UI change, so I didn't create any previews. PR: #2923 Comment by: @propr-dev[bot] (ID: 6079952893) Comment by: @github-actions[bot] (ID: 6079953617) Model: Claude Opus 5.5
…w passes, and the full MCP test suite passes (410 of 410), as do the merge-conflict tests (60 of 60). The API typecheck is clean. I didn't rerun the UI checks, since they already passed in CI and nothing UI-side changed. I fixed the Validate Changes failure. The API lint check now passes, and the full MCP test suite passes (410 of 410), as do the merge-conflict tests (60 of 60). The API typecheck is clean. I didn't rerun the UI checks, since they already passed in CI and nothing UI-side changed. **Cause:** this PR never touched `packages/api/mcp/toolsPullRequests.ts`. CI checks the branch merged with main, and main had just added the `resolve_merge_conflicts` tool (#2921) to that file. That pushed it to 412 counted lines against a 400-line limit. Main has the same lint failure; this PR just hit it first. **What I changed:** - **Pulled in main's changes:** git is read-only in this environment, so I couldn't run a real merge. Instead I applied main's diff since this branch split off directly to the files. Main's edits to `CHANGELOG.md` and `docs/mcp-coverage.md` don't overlap this branch's, so it applied cleanly. Without this, the branch alone would have the new tool but not its docs and tests. - **Shrank the file:** I moved the model-label lease helper, unchanged, out of `toolsPullRequests.ts` into a new file, `packages/api/mcp/modelLabelLease.ts`. `toolsPullRequests.ts` now imports it and passes lint. The branch now repeats main's changes as ordinary edits rather than a merge commit. Main's copies are identical, so merging should be clean. Main still fails the line limit until this PR merges or the same move lands there. There's no visual change, so I didn't create previews. PR: #2924 Comment by: @propr-dev[bot] (ID: 6080176394) Comment by: @github-actions[bot] (ID: 6080176593) Model: Claude Opus 5.5
AI Implementation Summary
Closes #2916
Branch:
2916/claude-opus-5-5-add-a-conflict-resolution-20261009-0954-ctzCommits: ✅ Changes committed (f6e8649)
AI Processing Completed
Execution Details:
Summary:
I added a new MCP tool,
resolve_merge_conflicts. It does the same thing as typing/mergeon a PR: it merges the base branch into the PR branch and has an agent resolve the conflicts. All tests, typecheck and lint pass. There's no UI change, so I didn't create previews.How it works (
packages/api/mcp/toolsPullRequests.ts)repository,pullRequest,idempotencyKeyand a requiredexpectedHead, the same asstart_ultrafixandstop_ultrafix. It needs execute scope.expectedHead, otherwise it fails withSTALE_HEAD./mergehandling silently ignores PRs without a ProPR processing label (such asAIorpropr). So the tool refuses those PRs up front with a new error,PULL_REQUEST_NOT_MANAGED, and posts nothing. Without this, the caller would only find out through a "not picked up" timeout 10 minutes later./mergecomment and lets the existing comment handling do the work. None of the merge logic is copied.Following the receipt with
get_operationThe
/mergeworker task had no link back to the comment that started it, so a receipt couldn't follow it. I made a small change across three places:/mergecomment handler now passes the comment id along, for regular PR comments only, not inline review comments.commandCommentId.src/jobs/processMergeConflictJob.ts).The existing receipt tracking then finds the task with no special case. The receipt moves from accepted to running to completed or failed, or to unknown (with the usual "not picked up" error) if no worker starts it. Automatic conflict-resolution tasks don't carry a comment id, so a receipt can't latch onto the wrong one.
Other changes
update_pull_request_branchstill behaves the same. I only reworded its description: it used to say it matched/merge, which was wrong. It now says it's for clean updates and points to the new tool when GitHub rejects a conflict.MERGE_CONFLICTerror frommerge_pull_requestnow also suggestsresolve_merge_conflicts.Tests
/mergecomment format, and confirming the GitHub update-branch call is never used.npm run test:mcp410/410; merge-conflict and comment-handler tests 146/146.Docs: I updated
docs/mcp-coverage.md(split the "Update branch" row into a clean-update row and a conflict-resolution row),docs/mcp.md(new section with an example call),docs/docs/features/pr-commands.md, andCHANGELOG.md.Detailed Logs:
06252844-d7d3-4954-b676-a95833eb2eb8Log files stored at:
/tmp/claude-logs/issue-2916-2026-10-09T10-04-10-957Z-conversation.json/tmp/claude-logs/issue-2916-2026-10-09T10-04-10-957Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #2916.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!