Skip to content

fix: add generated footer to close_issue comment body - #47584

Merged
pelikhan merged 3 commits into
mainfrom
copilot/update-auto-close-comment-message
Jul 23, 2026
Merged

fix: add generated footer to close_issue comment body#47584
pelikhan merged 3 commits into
mainfrom
copilot/update-auto-close-comment-message

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Comments posted when auto-closing an issue via safe-outputs were missing the standard workflow footer (run URL, workflow name, tracker ID). Every other safe-output message type (close-pull-request, add-comment, etc.) includes this footer via the shared buildCommentBody helper in close_entity_helpers.cjsclose_issue was the odd one out, returning the sanitized body directly.

Changes

  • close_issue.cjs: Import buildCommentBody from close_entity_helpers.cjs and delegate to it, identical to the existing pattern in close_pull_request.cjs:
    buildCommentBody(sanitizedBody) {
      const triggeringIssueNumber = context.payload?.issue?.number;
      const triggeringPRNumber = context.payload?.pull_request?.number;
      return buildCommentBody(sanitizedBody, triggeringIssueNumber, triggeringPRNumber);
    },
  • close_issue.test.cjs: Update two assertions from .toBe(body).toContain(body) to accommodate the appended footer.

Generated by 👨‍🍳 PR Sous Chef · gpt54 14.8 AIC · ⌖ 8.94 AIC · ⊞ 7K ·
Comment /souschef to run again

Issue comments posted when auto-closing via safe-outputs now include
the generated workflow footer (run URL, workflow name) just like other
safe-output message types (close-pull-request, add-comment, etc.).

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan July 23, 2026 13:23
@pelikhan
pelikhan marked this pull request as ready for review July 23, 2026 13:31
Copilot AI review requested due to automatic review settings July 23, 2026 13:31

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.

Pull request overview

Adds the standard safe-output footer to auto-close issue comments.

Changes:

  • Reuses the shared buildCommentBody helper.
  • Relaxes existing body assertions for appended footer content.
Show a summary per file
File Description
actions/setup/js/close_issue.cjs Adds footer generation to issue-closing comments.
actions/setup/js/close_issue.test.cjs Updates comment-body assertions.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Medium

expect(commentCalls.length).toBe(1);
// Should use the body from message, not the config comment
expect(commentCalls[0].body).toBe("Custom body from message");
expect(commentCalls[0].body).toContain("Custom body from message");
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #47584 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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

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

Review: Non-blocking observation

The fix is correct and mirrors the existing pattern in close_pull_request.cjs. An existing comment already flags the weakened test assertions. No new blocking issues found.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 19.8 AIC · ⌖ 4.45 AIC · ⊞ 5.7K
Comment /review to run again

@github-actions github-actions Bot mentioned this pull request Jul 23, 2026

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

Review: fix: add generated footer to close_issue comment body

The implementation in close_issue.cjs is correct and consistent with the pattern in close_pull_request.cjs.

Non-blocking concern in the tests: both updated assertions (toContain(body)) are too weak to catch a regression — they pass even if buildCommentBody is reverted to returning sanitizedBody directly. Adding a footer-sentinel assertion (e.g., toContain('<!-- gh-aw')) at both test sites would make the tests actually guard the behavior this PR fixes.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 13.3 AIC · ⌖ 4.55 AIC · ⊞ 5K

expect(result.success).toBe(true);
expect(result.alreadyClosed).toBe(true);
expect(commentBody).toBe("Closing comment with details");
expect(commentBody).toContain("Closing comment with details");

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.

Same concern as line 416: .toContain(body) alone doesn't confirm the footer was appended. The test would still pass if buildCommentBody is reverted to returning sanitizedBody directly. Add an assertion on a footer-specific token, e.g.:

expect(commentBody).toContain("<!-- gh-aw"); // footer sentinel

@copilot please address this.

@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 — requesting changes on test coverage gaps.

📋 Key Themes & Highlights

Key Themes

  • Weak regression tests: Both updated assertions use .toContain but never assert that the footer was actually appended, so the bug this PR fixes is not guarded against re-introduction.

Positive Highlights

  • ✅ Correct fix: delegating to buildCommentBody matches the established pattern in close_pull_request.cjs
  • ✅ Minimal, focused change — only the odd-one-out code path is touched

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 14.3 AIC · ⌖ 4.58 AIC · ⊞ 6.7K
Comment /matt to run again

expect(result.success).toBe(true);
expect(result.alreadyClosed).toBe(true);
expect(commentBody).toBe("Closing comment with details");
expect(commentBody).toContain("Closing comment with details");

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] Same weakened assertion as line 416 — .toContain passes even if the footer is absent, so this test does not guard the regression fixed by this PR. Add a footer-specific assertion to confirm the footer was actually appended.

💡 Suggested fix
expect(commentBody).toContain("Closing comment with details");
// confirm footer was appended
expect(commentBody.length).toBeGreaterThan("Closing comment with details".length);

Or match a known footer marker string from buildCommentBody.

@copilot please address this.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

⚠️ Test Quality Score: 70/100 — Acceptable

Analyzed 2 test(s): 2 design, 0 implementation, 0 violation(s).

📊 Metrics (2 tests)
Metric Value
Analyzed 2 (Go: 0, JS: 2)
✅ Design 2 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 0 (0%)
Duplicate clusters 0
Inflation No (0.5:1)
🚨 Violations 0
Test File Classification Issues
should use body field from message over config comment (~line 413) close_issue.test.cjs design_test Missing positive footer assertion
already-closed issue comment body (~line 506) close_issue.test.cjs design_test Missing positive footer assertion
⚠️ Flagged Tests (2)

should use body field from message over config comment (close_issue.test.cjs:413) — design_test. .toBe() correctly relaxed to .toContain() to accommodate the new footer, but no assertion verifies the footer is actually appended. The fix ensures the body still contains the expected text, but leaves the new behavior untested.

already-closed issue comment body (close_issue.test.cjs:506) — design_test. Same pattern — .toBe() to .toContain() is correct, but the footer content added by buildCommentBody is never positively asserted. A follow-up assertion like expect(commentBody).toContain(getTrackerID(...)) or a check for the run URL would lock in the new behavior.

Verdict

Passed. 0% implementation tests (threshold: 30%). The 2 modified assertions are appropriate adaptations for the footer feature. Minor coverage gap: neither test positively asserts the footer is appended — consider adding an assertion on the footer content to lock in the new behavioral contract.

References:

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 44.4 AIC · ⌖ 7.77 AIC · ⊞ 7K ·
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.

✅ Test Quality Sentinel: 70/100. 0% implementation tests (threshold: 30%). The 2 modified assertions appropriately adapt to the new footer behavior.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, tighten the regression tests so they explicitly assert the generated footer is present, and rerun checks once the branch is up to date.

Unresolved review items:

Generated by 👨‍🍳 PR Sous Chef · gpt54 14.8 AIC · ⌖ 8.94 AIC · ⊞ 7K ·
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please run the pr-finisher skill, tighten the regression tests so they explicitly assert the generated footer is present, and rerun checks once the branch is up to date.

Unresolved review ...

Addressed in 112ee44. I tightened the close_issue regression tests to explicitly assert footer presence (for #123 attribution and gh-aw-agentic-workflow: marker), ran the targeted test file, and ran make agent-report-progress plus final parallel validation.

Copilot AI requested a review from gh-aw-bot July 23, 2026 14:29
@pelikhan
pelikhan merged commit f2808c8 into main Jul 23, 2026
8 checks passed
@pelikhan
pelikhan deleted the copilot/update-auto-close-comment-message branch July 23, 2026 14:43
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.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.

4 participants