Title: Add atomic head SHA pinning to merge_pull_request · Issue #3181 · github/github-mcp-server · GitHub
Open Graph Title: Add atomic head SHA pinning to merge_pull_request · Issue #3181 · github/github-mcp-server
X Title: Add atomic head SHA pinning to merge_pull_request · Issue #3181 · github/github-mcp-server
Description: Problem merge_pull_request currently has no way for a caller to atomically assert which pull-request HEAD is being merged. An agent can inspect a pull request, validate CI/review readiness, and then call merge_pull_request, but the PR HE...
Open Graph Description: Problem merge_pull_request currently has no way for a caller to atomically assert which pull-request HEAD is being merged. An agent can inspect a pull request, validate CI/review readiness, and the...
X Description: Problem merge_pull_request currently has no way for a caller to atomically assert which pull-request HEAD is being merged. An agent can inspect a pull request, validate CI/review readiness, and the...
Opengraph URL: https://github.com/github/github-mcp-server/issues/3181
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add atomic head SHA pinning to merge_pull_request","articleBody":"## Problem\n\n`merge_pull_request` currently has no way for a caller to atomically assert\nwhich pull-request HEAD is being merged.\n\nAn agent can inspect a pull request, validate CI/review readiness, and then\ncall `merge_pull_request`, but the PR HEAD may change between those steps.\nWithout a compare-and-swap condition on the merge call, that creates a TOCTOU\ngap.\n\nThe GitHub REST merge endpoint already supports the optional `sha` field for\nthis purpose, and `go-github` already exposes it as\n`PullRequestOptions.SHA`. The MCP tool currently does not expose or forward\nthat capability.\n\n## Proposed change\n\nAdd an optional `expectedHeadSha` input to `merge_pull_request` and pass it\ndirectly to `github.PullRequestOptions.SHA`.\n\nThis follows the existing `expectedHeadSha` naming used by\n`update_pull_request_branch`.\n\nWhen supplied:\n\n- the exact expected HEAD SHA is sent to GitHub as the REST `sha` field;\n- a changed HEAD is rejected by GitHub rather than merging a different commit;\n- no retry or permissive fallback is introduced.\n\nWhen omitted, behavior remains backward compatible because the underlying\n`sha` field is optional/omitted.\n\n## Scope\n\nNo authentication, credential, logging, permission, or unrelated tool changes.\n","author":{"url":"https://github.com/jcosta1970","@type":"Person","name":"jcosta1970"},"datePublished":"2026-08-29T21:56:39Z","url":"https://github.com/github/github-mcp-server/issues/3181"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b1ab4d21-ec05-c399-b79f-33af19e3e32f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA02:DF755:6B58BA:94B883:6B0693EE |
| html-safe-nonce | 909ab2a06febd51844751d672877ac2b600fd8b9599a5685e0cb4792f0821890 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTAyOkRGNzU1OjZCNThCQTo5NEI4ODM6NkIwNjkzRUUiLCJ2aXNpdG9yX2lkIjoiMjA0NDUwODE5MjUxMTUyOTk2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0dd4bd2e77c1e5c8168d3885fc5d0dc6d912fd020d003e64d9afc8e04889bc51 |
| hovercard-subject-tag | issue:5289039954 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/github/github-mcp-server/3181/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0725a513ee9dc85e4ed452c650704352f8566bea9801804740f928b0f7091a7b/github/github-mcp-server/issues/3181 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0725a513ee9dc85e4ed452c650704352f8566bea9801804740f928b0f7091a7b/github/github-mcp-server/issues/3181 |
| og:image:alt | Problem merge_pull_request currently has no way for a caller to atomically assert which pull-request HEAD is being merged. An agent can inspect a pull request, validate CI/review readiness, and the... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcosta1970 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4462ff7ebfd3d551f202659f2423dae617b6849d23b1df6465dc504ef497d14a |
| turbo-cache-control | no-preview |
| go-import | github.com/github/github-mcp-server git https://github.com/github/github-mcp-server.git |
| octolytics-dimension-user_id | 9919 |
| octolytics-dimension-user_login | github |
| octolytics-dimension-repository_id | 942771284 |
| octolytics-dimension-repository_nwo | github/github-mcp-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 942771284 |
| octolytics-dimension-repository_network_root_nwo | github/github-mcp-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6d3909414814ff86ce7da4c51a0f4918a13fb41b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width