Repository navigation
Create signed PR branches at the first commit, not the base SHA - #77555
Conversation
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
Found three blocking correctness issues in signed-PR claim delivery.
Highlights
- Concurrent branch creation can leave a staged REST commit orphaned, causing successful delivery to remain unverified.
- Recursive tree verification permanently rejects large/truncated repositories.
- Foreign-repository Git effects are silently discarded instead of rejected.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~5 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again
| throw new Error(`${ERR_API}: Could not resolve remote branch OID for ${branch} after concurrent creation`); | ||
| } | ||
| expectedHeadOid = refreshedOid; | ||
| if (refreshedOid === firstOid) { |
There was a problem hiding this comment.
When the ref creation races and the refreshed head is not firstOid, this code falls through to GraphQL and replays the change, leaving the REST-created commit orphaned and recorded as a successful claim effect even though it is not an ancestor of the final PR head.
💡 Reconcile the race before replaying
The delivery verifier now requires every staged git_commit to be on the final history, so a concurrent branch created at the base (or another head) makes the otherwise successful PR delivery remain unverified. Either fail/retry the operation before recording the orphan, or explicitly discard/reconcile the staged REST objects and verify only the commit actually published. Add an end-to-end race test through claim settlement.
| const stagedBlobs = new Set(); | ||
| if (staged.some(effect => effect.kind === "git_blob")) { | ||
| for (const treeSha of stagedTrees) { | ||
| const { data: tree } = await github.rest.git.getTree({ owner: headOwner, repo: headRepo, tree_sha: treeSha, recursive: "1" }); |
There was a problem hiding this comment.
This verifier recursively downloads the entire tree for each staged commit and rejects any response with truncated !== false, so signed PR deliveries in sufficiently large repositories can never settle as verified even when the changed objects are valid.
💡 Verify bounded changed-path evidence
The recursive Git tree endpoint is explicitly truncatable for large repositories; treating truncation as an object mismatch leaves the work barrier pending after a successful PR. Verify only the staged paths (or walk trees non-recursively with bounded requests), and add coverage for a large/truncated repository without weakening the object-integrity checks.
| const authority = await resolveParentResourceTarget(github, { repository: receipt.repository, kind: "pull_request", number: receipt.number }, data); | ||
| const head = await resolveRepositoryTarget(github, { repository: receipt.headRepository, repository_id: nativeDecimalIdentity(data.head.repo.id), ref: `refs/heads/${receipt.branch}` }); | ||
| const effects = []; | ||
| const staged = (options.effects || []).filter(effect => receiptMatchesClaim(effect, claim) && effect.outcome === "succeeded" && effect.repository === receipt.headRepository && ["git_blob", "git_tree", "git_commit"].includes(effect.kind)); |
There was a problem hiding this comment.
Effects for successful Git writes in any repository other than receipt.headRepository are silently filtered out, so a foreign-repository blob/tree/commit write is not rejected and is omitted from the delivery proof.
💡 Fail closed on unexpected staged Git effects
The new claim accounting is intended to ensure every REST-created object is tied to the PR history. Filtering the effect away lets the verifier return verified: true while the claim contains an unaccounted Git write, and the added foreign_repository test case should expose this behavior. Reject claim-matching Git object effects whose repository is not the expected head repository instead of dropping them.
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd to the REST-first first-commit path. Posting observations only: two inline comments on a possible settlement failure after a lost race and a coverage gap for a failing createRef.
📋 Key Themes & Highlights
Key Themes
- Race-path verification: a concurrent
initial-head 422 leaves the REST-created commit unreferenced. Verification may still stage it as a succeededgit_commiteffect. This is not confirmed by a test. - Failure coverage: the
createBlob/createTree/createCommitfailure test does not cover a failingcreateRef.
Positive Highlights
- ✅ Publishing the signed first commit before
createRefavoids a branch pointing at the base commit. - ✅ Unverified signatures are refused via
PushSignedCommitsPolicyViolation, which skips the unsignedgit pushfallback. - ✅ The 422 fallthrough remains guarded by the existing
requireBaseRefMatchcheck, which is pre-existing behaviour.
Limitations
Test execution was blocked: npm ci fails on a self-signed certificate from the package proxy. I did not run the targeted vitest suites, so the findings are from static reading only.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| const staged = (options.effects || []).filter(effect => receiptMatchesClaim(effect, claim) && effect.outcome === "succeeded" && effect.repository === receipt.headRepository && ["git_blob", "git_tree", "git_commit"].includes(effect.kind)); | ||
| const stagedTrees = new Set(); | ||
| const [headOwner, headRepo] = receipt.headRepository.split("/"); | ||
| for (const effect of staged.filter(effect => effect.kind === "git_commit")) { |
There was a problem hiding this comment.
[/diagnosing-bugs] A lost-race orphan can block settlement. When createRef returns 422 and the refreshed remote head is a third commit, the REST-created firstOid is never referenced, but its git_commit, git_blob and git_tree effects appear to stay recorded as succeeded. This loop then requires every staged commit to be an ancestor of receipt.commit, so delivery fails closed with pull_request.effect_commit_mismatch.
💡 Suggested fix
On the 422 path where refreshedOid !== firstOid, exclude the orphaned REST objects from the staged effects (or do not record them as succeeded). Add a regression test in work_queue_native_creation_delivery.test.cjs that settles a PR after the concurrent initial-head race. The existing initial concurrency test in push_signed_commits.test.cjs covers only the push step, not verification.
@copilot please address this.
| expect(mockCore.warning).not.toHaveBeenCalledWith(expect.stringContaining("falling back to git push")); | ||
| }); | ||
|
|
||
| it.each(["createBlob", "createTree", "createCommit"])("does not create a ref when initial %s fails", async method => { |
There was a problem hiding this comment.
[/tdd] No test covers a non-422 createRef failure after a verified createCommit. This block only makes createBlob, createTree and createCommit fail. Add createRef to the it.each list. Its assertions must change, because createRef is the rejected call, so not.toHaveBeenCalled() would not hold. The test should confirm the failure is surfaced and no unsigned git push fallback runs.
💡 Suggested test shape
Keep allowGitPushFallback: false and assert rejects.toThrow plus that graphql is never called. This guards against a regression where a REST error silently publishes an unsigned branch.
@copilot please address this.
There was a problem hiding this comment.
🟡 Changes recommended
The new REST initialization path relies on commit auto-signing unavailable with supported personal access tokens, breaking new-branch PR creation while also disabling fallback.
4 open issues
What changed in this PR
Updates gh-aw’s signed PR creation to publish new branches at the first verified commit rather than the base SHA, preventing branch-triggered CI from overwriting the base commit’s status (#76888).
Changes:
- Creates the initial Git objects through REST, verifies the commit signature, then publishes the branch; subsequent commits continue through GraphQL.
- Tracks staged Git writes and verifies their membership in the PR history during Claim settlement.
- Expands regression coverage for publication order, commit chaining, concurrent creation, payload preservation, and delivery verification.
| File | Description |
|---|---|
actions/setup/js/work_queue_native_creation_delivery.test.cjs |
Tests staged-object settlement and rejection of mismatched evidence. |
actions/setup/js/work_queue_native_creation_delivery.cjs |
Verifies staged commits, trees, and blobs against PR history. |
actions/setup/js/work_queue_git_effects.cjs |
Extends Claim authorization to REST Git-object creation. |
actions/setup/js/push_signed_commits.test.cjs |
Covers REST-first initialization, races, payloads, and signature rejection. |
actions/setup/js/push_signed_commits.cjs |
Creates and verifies the first commit before publishing a new branch ref. |
Review effort: Max (dynamic)
| } | ||
| core.info(`pushSignedCommits: creating remote branch ${branch} at parent OID ${expectedHeadOid}`); | ||
| assertTransportUnchanged?.(); | ||
| const parent = await githubClient.rest.git.getCommit({ owner, repo, commit_sha: expectedHeadOid }); |
| const createdCommit = await withGitClaimEffects({ github: githubClient, repository: `${owner}/${repo}`, branch, paths }, () => | ||
| githubClient.rest.git.createCommit({ owner, repo, message, tree: treeOid, parents: [expectedHeadOid] }) |
| const blob = await withGitClaimEffects({ github: githubClient, repository: `${owner}/${repo}`, branch, paths: [addition.path] }, () => | ||
| githubClient.rest.git.createBlob({ owner, repo, content: addition.contents, encoding: "base64" }) | ||
| ); |
| const { data: tree } = await github.rest.git.getTree({ owner: headOwner, repo: headRepo, tree_sha: treeSha, recursive: "1" }); | ||
| if (tree?.sha !== treeSha || tree.truncated !== false || !Array.isArray(tree.tree)) return { verified: false, diagnostics: { event: "pull_request.effect_tree_mismatch" } }; |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "9a4fb7531d2f99fad914839b4fbfc389f4d8a0c9",
"kind": "requested",
"schema_version": "1",
"state": "f25d6df93f118d0f1a2041b27837da1252141f271d07efaeac598cb20cc8c332",
"work": [
"436325f3d1eca6811ec6f0e88fe4b789d163a653339dfdf26ce9f05dce8f0e16",
"47f188a12b316525c2202f4f75b82185d76be0a140c0f99eae185cf2b7d8acb1",
"6243e35aa69af0fe1d9c5aca45d23257eb8dc461352cfd05599d53ae6ed1dd80",
"80f56838c00914f5d7aacb5f538360624b10c6267ec76d6505ea156f29fee1d2",
"be35bd345309ca69b7da73301b250a16ab2531e7fdbc6d01a8864b77b07ae2e0",
"cca9ffe2f4d1628d7775ce695c6e8a8e3d7d12e753f4fb3b3b07574affef9c0f"
],
"workflow": "pr-sous-chef"
}
|
…equest Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |


Signed PR creation initially points the head branch at the base SHA, triggering external CI builds whose skipped or cancelled statuses can overwrite the base commit’s passing status.
create-pull-request(signed commits) creates the head branch at the base SHA #76888