Skip to content

Deduplicate protected-file fallback issues - #76300

Merged
pelikhan merged 5 commits into
mainfrom
copilot/aw-top-10-deduplicate-repeated-fallback-issues
Nov 9, 2026
Merged

pelikhan merged 5 commits into
mainfrom
copilot/aw-top-10-deduplicate-repeated-fallback-issues

Conversation

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Match: Store the fingerprint in the issue body and search fallback issues for the same title and fingerprint.
  • Refresh: Reopen and update a match with the latest proposal and a link to the current workflow run. A changed title or patch produces a distinct issue.

Copilot AI changed the title [WIP] Deduplicate repeated protected-file fallback issues Deduplicate protected-file fallback issues Nov 9, 2026
Copilot AI requested a review from gh-aw-bot November 9, 2026 19:17
@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 19:20
Copilot AI adaptive review requested due to automatic review settings November 9, 2026 19:20
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76300

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

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.

Generated from PR Specification Reviewer · gpt56 · ~4 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 1.7K · ◷

Generated by PR Specification Reviewer for #76300

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-09T19:24:16Z
review_event: REQUEST_CHANGES
top_themes: lookup failure must not block fallback creation; preserve maintainer labels on issue refresh
files_reviewed: actions/setup/js/create_pull_request.cjs, actions/setup/js/create_pull_request.test.cjs
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshing a matched issue now merges its existing label names with the configured fallback labels, preserving maintainer triage labels. Fixed in 2025055.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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]))
Comment on lines +2569 to +2572
const fingerprint = crypto
.createHash("sha256")
.update(JSON.stringify([title, patchContent]))
.digest("hex");

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-patch output, which includes a per-commit From <sha> line and a Date: 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 runUrl computation 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 withRetry and assertUnchanged guards.
  • ✅ Tests cover both the identical and changed-proposal paths.

Notes

  • I did not run the vitest suite because node_modules is not installed in actions/setup/js. Results are from reading the code and a scratch-repo check, not a test run.
  • Skill selection came from the pr-triage agent, 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");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The protected-file fallback now reuses the handler’s existing runUrl instead of recomputing it. Fixed in 2025055.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/create_pull_request.cjs:497): address unresolved feedback - Review comment
  3. Review (actions/setup/js/create_pull_request.cjs:2613): address unresolved feedback - Review comment
  4. Review (actions/setup/js/create_pull_request.cjs:2572): address unresolved feedback - Review comment
  5. Review (actions/setup/js/create_pull_request.test.cjs:2365): address unresolved feedback - Review comment
  6. Review (actions/setup/js/create_pull_request.cjs:497): address unresolved feedback - Review comment
  7. Review (actions/setup/js/create_pull_request.cjs:2648): address unresolved feedback - Review comment
  8. Review (actions/setup/js/create_pull_request.cjs:2573): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~10 AIC · ⌖ ~18 AIC · ⊞ 1.3K · ◷
Comment /souschef to run again

Copilot AI and others added 3 commits November 9, 2026 20:04
@pelikhan
pelikhan merged commit 491cbf9 into main Nov 9, 2026
94 checks passed
@pelikhan
pelikhan deleted the copilot/aw-top-10-deduplicate-repeated-fallback-issues branch November 9, 2026 22:37
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AW Top 10] 01 Deduplicate repeated protected-file fallback issues

4 participants