Repository navigation
Deduplicate protected-file fallback issues - #76300
Conversation
Co-authored-by: gh-aw-bot <[email protected]>
|
✅ PR Code Quality Reviewer completed the code quality 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.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification 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.
|
|
✅ 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ 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.
|
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 two blocking correctness issues in the protected-file fallback deduplication path:
- A transient/non-410 failure while listing candidate issues now aborts fallback creation instead of preserving the prior create-on-error behavior.
- Refreshing a matched issue replaces all labels and can erase maintainer triage labels.
Inline comments explain the fixes. Static review only; tests were not run.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| } catch (error) { | ||
| const status = typeof error === "object" && error !== null && "status" in error ? error.status : undefined; | ||
| if (status === 410) continue; | ||
| throw error; |
There was a problem hiding this comment.
findProtectedFallbackIssue now rethrows every list failure except 410. That changes a deduplication optimization into a hard dependency: transient 403/429/5xx/network errors will abort the protected-file fallback instead of creating the issue, so the proposal can be lost. Please warn and fall through to createFallbackIssue when the lookup fails (or otherwise preserve the previous create-on-error behavior).
There was a problem hiding this comment.
Lookup failures now emit a warning and fall through to the existing issue-creation routing. Fixed in 2025055.
| repo: issueRepoParts.repo, | ||
| issue_number: existingIssue.number, | ||
| title, | ||
| body: renderSizedReport(existingIssueBody).body, |
There was a problem hiding this comment.
Updating an existing issue with labels: issueLabels replaces the complete label set. This drops labels maintainers may have added for triage/priority on the prior fallback issue. Please merge the existing issue's label names with issueLabels (while preserving pull-request-fallback) before updating.
There was a problem hiding this comment.
Refreshing a matched issue now merges its existing label names with the configured fallback labels, preserving maintainer triage labels. Fixed in 2025055.
There was a problem hiding this comment.
🟡 Changes recommended
Fallback lookup can expose private proposal content in public repositories by searching beyond a successful target lookup, and quoted markers can cause unrelated issues to be overwritten.
4 open issues
What changed in this PR
This PR adds proposal-based deduplication to gh-aw’s protected-file fallback issues, aiming to reduce repeated issues as requested in #76172.
Changes:
- Adds a SHA-256 fingerprint of the proposal title and patch to issue metadata.
- Finds matching fallback issues, reopens and refreshes them, and links the current workflow run.
- Adds regression tests for identical and changed patches.
| File | Description |
|---|---|
actions/setup/js/create_pull_request.test.cjs |
Tests issue reuse, changed-patch creation, fingerprints, and run links. |
actions/setup/js/create_pull_request.cjs |
Implements proposal fingerprints, issue lookup, and refresh behavior. |
Review effort: Balanced (auto)
| if (status === 410) continue; | ||
| throw error; | ||
| } | ||
| const issue = issues.find(item => !item.pull_request && item.title === title && typeof item.body === "string" && item.body.includes(marker)); |
| throw error; | ||
| } | ||
| const issue = issues.find(item => !item.pull_request && item.title === title && typeof item.body === "string" && item.body.includes(marker)); | ||
| if (issue) return { issue, issueRepoParts: candidate }; |
|
|
||
| const fingerprint = crypto | ||
| .createHash("sha256") | ||
| .update(JSON.stringify([title, patchContent])) |
| const fingerprint = crypto | ||
| .createHash("sha256") | ||
| .update(JSON.stringify([title, patchContent])) | ||
| .digest("hex"); |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Requesting changes: the dedup key does not stay stable across runs, so the fix does not work yet.
📋 Key Themes & Highlights
Key Themes
- Unstable fingerprint (blocking): The SHA-256 covers the raw
format-patchoutput, which includes a per-commitFrom <sha>line and aDate:header. These change every run, so duplicates are still created. Reproduced in a scratch repo. - Tests cannot catch it: The new tests compute the expected fingerprint from the same string they pass in and mock
paginate, so they pass regardless. - Lookup failure behaviour: A non-410 lookup error now aborts the fallback path instead of falling through to create.
- Minor: duplicate
runUrlcomputation in the same handler scope.
Positive Highlights
- ✅ The marker-based lookup is a sound approach, and matching on title plus marker avoids false positives.
- ✅ The update path keeps the
withRetryandassertUnchangedguards. - ✅ Tests cover both the identical and changed-proposal paths.
Notes
- I did not run the vitest suite because
node_modulesis not installed inactions/setup/js. Results are from reading the code and a scratch-repo check, not a test run. - Skill selection came from the
pr-triageagent, which returned the same classification as my own read of the diff.
@copilot please address the review comments above, starting with the fingerprint normalization.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again
| const fingerprint = crypto | ||
| .createHash("sha256") | ||
| .update(JSON.stringify([title, patchContent])) | ||
| .digest("hex"); |
There was a problem hiding this comment.
[/diagnosing-bugs] The dedup key never matches across runs, so the feature does not work. patchContent comes from git format-patch --stdout (generate_git_patch.cjs L235/L267), whose first line is From <commit-sha> and which includes a Date: header. Both change on every run, so the SHA-256 changes and duplicates are still created. I reproduced this in a scratch repo: two identical commits gave different format-patch output.
💡 Suggested fix
Hash only the content from the first diff --git onward, so the per-run From/Date headers and the X-GH-AW-Base-Commit header are excluded:
const patchBody = patchContent.slice(Math.max(0, patchContent.indexOf("diff --git")));
const fingerprint = crypto.createHash("sha256").update(JSON.stringify([title, patchBody])).digest("hex");Then update the test expectation in create_pull_request.test.cjs to hash the same normalized body.
@copilot please address this.
There was a problem hiding this comment.
The fingerprint now hashes the patch from the first diff --git header onward, excluding regenerated commit metadata. Fixed in 2025055.
| process.env.GH_AW_PROMPTS_DIR = promptsDir; | ||
|
|
||
| const fingerprint = createHash("sha256") | ||
| .update(JSON.stringify(["Test PR", patchContent])) |
There was a problem hiding this comment.
[/tdd] This test cannot catch the bug above. It computes the expected fingerprint from the same patchContent it writes, and it mocks paginate to return the issue directly, so the dedup match never depends on the fingerprint being stable across runs.
💡 Suggested test
Add a red test first: generate two patches that differ only in the From <sha> line and the Date: header (the same change, as git format-patch would produce on two runs). Assert that the fingerprint, or the xml_marker written into the body, is identical for both. Make the fingerprint computation a small exported helper so the test can call it directly. Then implement the normalization until the test passes.
@copilot please address this.
There was a problem hiding this comment.
Added a regression test that compares identical diffs with differing From, Date, and base-commit headers. Fixed in 2025055.
| } catch (error) { | ||
| const status = typeof error === "object" && error !== null && "status" in error ? error.status : undefined; | ||
| if (status === 410) continue; | ||
| throw error; |
There was a problem hiding this comment.
[/diagnosing-bugs] A non-410 failure from the lookup now rethrows, which aborts the whole fallback path (it is caught at the outer handler and returned as success: false). Before this change, the fallback could still create an issue if the lookup failed. A transient listForRepo error (rate limit, 5xx) now blocks the protected-file fallback entirely, and it is not retried.
💡 Suggested change
Log a warning and fall through to create, or retry with the existing withRetry/RATE_LIMIT_RETRY_CONFIG helpers. That keeps the dedup as best-effort and avoids a new hard failure mode.
@copilot please address this.
There was a problem hiding this comment.
Lookup errors now warn and proceed through normal fallback issue creation rather than aborting the recovery path. Fixed in 2025055.
| repo: issueRepoParts.repo, | ||
| issue_number: issue.number, | ||
| body: renderSizedReport(protectedFallbackFrame(fallbackBodyWithCloseKeyword)).body, | ||
| body: renderSizedReport(protectedFallbackFrame(withProposalMetadata(fallbackBodyWithCloseKeyword))).body, |
There was a problem hiding this comment.
[/diagnosing-bugs] The marker is written into the body only in this update path and in the create path. If the auto-close update at this line fails, the warning is logged and the dedup marker is still there on create, but a reused issue that loses the marker here will be missed on the next run and a duplicate created. The failure is silent apart from one warning.
💡 Suggested change
Make the body update one call that always preserves withProposalMetadata(...), or fail loudly when the marker cannot be preserved, so a silent loss does not turn into a duplicate issue later.
@copilot please address this.
There was a problem hiding this comment.
Both the initial issue body and optional auto-close body retain proposal metadata; the regression test verifies the marker remains after the auto-close update fails. Covered in 2025055.
| .createHash("sha256") | ||
| .update(JSON.stringify([title, patchContent])) | ||
| .digest("hex"); | ||
| const runUrl = buildWorkflowRunUrl(context, context.repo); |
There was a problem hiding this comment.
Nit: const runUrl = buildWorkflowRunUrl(context, context.repo); duplicates the computation at L1602 in the same handler scope. Reuse that value, or hoist it, to keep one source of truth.
There was a problem hiding this comment.
The protected-file fallback now reuses the handler’s existing runUrl instead of recomputing it. Fixed in 2025055.
|
🍳 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": "c68e8754ef7b5ecd545c447a75dee3e65900f2b8",
"kind": "requested",
"schema_version": "1",
"state": "f6d32595f0102e76122975aa2ed6f5ba873cf23ce3fa84afd4c7e6faddfc6b0c",
"work": [
"23c4c743b65b2cd4209c3486f1a4eadec409d6edaca60db29c6f4e4908c8cf4a",
"6536b5c38ca5cb57724bc8cf25842da1f4b74a995e638c8301126d6c6a2aa93d",
"67d768e3d92d7092087ddb6be06346d437e2f01f59f536abd455038796fc3ac1",
"7edd58bb564f3be1b03c287dd25763a0c35b221ac5be34e704e140377acebde8",
"933cfa6fbeb66b560c8d95cc0c0cabe82986c702e20e4e9c80e9a2fe4954b9dd",
"b6c8a16ea2517ee479688638959cd9cf44fa160e6fa462f8ea8618cfdebb61c1",
"b982e2d1c1bf8e75f3ebd8e8424da37061d6cfb1e832f6a78630708ef2b6dbae"
],
"workflow": "pr-sous-chef"
}
|
…uplicate-repeated-fallback-issues Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
🎉 This pull request is included in a new release. Release: |


Repeated runs proposing the same protected-file change created duplicate fallback issues. Identify proposals by a SHA-256 fingerprint of their title and patch, then update the matching issue.