fix(mcp): pin gittensory_propose_action to the PR current head - #2355
Merged
Conversation
proposeAction built the staged action's params from only label/reviewBody/ mergeMethod/closeComment — it never fetched or recorded the PR's head SHA. So every MCP-staged action had expectedHeadSha === undefined, and the approval- queue accept path's force-push guard (stagedHead && stagedHead !== pr.headSha) is a silent no-op on a falsy stagedHead: a maintainer/agent could propose a merge, the contributor could force-push unreviewed code, and accept would merge the new commit with no supersede/rejection — exactly the threat that guard exists to catch, just never engaged for this entrypoint. Fetch the PR's current stored head via getPullRequest before building params and pin expectedHeadSha to it, matching the invariant the live webhook/sweep staging path (stageForApproval) already upholds. Advances #1936. Closes #2255.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2355 +/- ##
=======================================
Coverage 95.71% 95.71%
=======================================
Files 222 222
Lines 24653 24655 +2
Branches 8945 8946 +1
=======================================
+ Hits 23597 23599 +2
Misses 433 433
Partials 623 623
🚀 New features to boost your workflow:
|
Closed
12 tasks
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
proposeActionbuilt the staged action's params from onlylabel/reviewBody/mergeMethod/closeComment— it never fetched or recorded the PR's head SHA. So every MCP-staged action hadexpectedHeadSha === undefined, and the approval-queue accept path's force-push guard (stagedHead && stagedHead !== pr.headSha) is a silent no-op on a falsystagedHead: a maintainer or agent could propose a merge, the contributor could force-push unreviewed code, and accept would merge the new commit with no supersede/rejection — exactly the threat that guard exists to catch, just never engaged for this entrypoint.Fix
Fetch the PR's current stored head via
getPullRequestbefore buildingparamsand pinexpectedHeadShato it, matching the invariant the live webhook/sweep staging path (stageForApproval) already upholds. Uses the stored/DB-synced value (not a fresh live GitHub fetch), consistent with how the existing staging path resolves this — no added GitHub API load on a maintainer-facing MCP call.Tests
expectedHeadShais now staged when a PR record exists (and correctly omitted when it doesn't — matches an existing test's baseline).status: "rejected",executionOutcome: "head_moved"), where before this fix it silently proceeded to execute.Full unsharded
test:coveragegreen;typecheckgreen.Advances #1936. Closes #2255.