Fix push-to-pull-request-branch commit links to use the actual pushed SHA#27953
Fix push-to-pull-request-branch commit links to use the actual pushed SHA#27953
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0ee73a6e-daeb-4d95-966a-043cf3270e83 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0ee73a6e-daeb-4d95-966a-043cf3270e83 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0ee73a6e-daeb-4d95-966a-043cf3270e83 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/951e66f3-85d2-4731-99e3-582f7e7e5511 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/951e66f3-85d2-4731-99e3-582f7e7e5511 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated in 0fe183c. I removed the post-push Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Pull request overview
Fixes push_to_pull_request_branch tracking/activation comment commit links by using the SHA/OID returned from the push operation itself (rather than a post-push remote HEAD lookup), preventing 404s when local and remote SHAs diverge.
Changes:
pushSignedCommitsnow returns the SHA/OID that actually landed on the target branch (GraphQL path returns created commit OID; git-push fallback returns the last local commit SHA).push_to_pull_request_branchconsumes that returned SHA forcommit_sha,commit_url, and activation comment commit-link generation (with a local-HEAD fallback only when needed).- Adds/updates a focused regression test asserting the activation comment uses the returned pushed SHA.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/push_to_pull_request_branch.cjs | Uses the push helper’s returned SHA as the source of truth for commit link generation, avoiding remote-HEAD lookup races. |
| actions/setup/js/push_signed_commits.cjs | Returns the final landed commit SHA/OID from the signed-commit push helper (including fallback behavior). |
| actions/setup/js/push_to_pull_request_branch.test.cjs | Adds regression coverage ensuring activation comment commit links use the SHA returned by pushSignedCommits. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 0
🧪 Test Quality Sentinel ReportTest Quality Score: 70/100
Test Classification DetailsView Test Classifications
Flagged Tests — Requires Review
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 70/100. Test quality is acceptable — 0% of new tests are implementation tests (threshold: 30%). The new test verifies the PR's core behavioral contract. See the detailed comment for a suggestion to add error-path coverage.
|
@copilot review all changes for security, race conditions and fit excellence |
Completed a full audit of this PR’s changes for security, race conditions, and overall fit. No new issues found: commit-link SHA now comes from the push result (no post-push HEAD race), push failure/fallback paths are explicit, and auth usage remains scoped to existing git/GitHub clients. Re-ran focused validation: |
| cwd, | ||
| env: { ...process.env, ...(gitAuthEnv || {}) }, | ||
| }); | ||
| return shas[shas.length - 1]; |
| gitAuthEnv, | ||
| }); | ||
| if (pushedSha) { | ||
| pushedCommitSha = pushedSha; |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/674f9b35-3168-4e8d-9fea-69232363ddee Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
push_to_pull_request_branchtracking comments were linking to sandbox-local commit SHAs, which can diverge from the commit that actually lands on the PR branch and produce 404s.This now uses the SHA returned by the push operation itself, avoiding a race between push completion and a separate remote-HEAD lookup.
Actual pushed SHA as source of truth
push_signed_commitsnow returns the commit SHA that landed on the branch.git pushfallback path returns the last pushed local commit SHA.push_to_pull_request_branchuses that returned SHA forcommit_sha,commit_url, and activation comment commit link generation.Race condition removed
git ls-remoteSHA resolution frompush_to_pull_request_branch.Observability improvement
push_signed_commitslogs the SHA used by thegit pushfallback return path.push_to_pull_request_branchlogs the SHA returned bypushSignedCommitswhen present.Regression coverage
pushSignedCommitsrather than a post-push remote lookup.