Move detection caution callout to top of agent failure issue/comment bodies#27896
Move detection caution callout to top of agent failure issue/comment bodies#27896
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/95de0e3e-54a7-4ea7-8086-c13bcdbbdf65 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/95de0e3e-54a7-4ea7-8086-c13bcdbbdf65 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/95de0e3e-54a7-4ea7-8086-c13bcdbbdf65 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Moves the “detection caution” callout out of the agent-failure footer generators and into handle_agent_failure.cjs so it appears at the top of newly created agent-failure issues and comments.
Changes:
- Remove detection caution prepending from
getFooterAgentFailureIssueMessage/getFooterAgentFailureCommentMessage. - Prepend the detection caution block to the top of agent-failure issue bodies and comment bodies in
handle_agent_failure.cjs. - Update footer-focused tests to assert the agent-failure footers no longer contain the caution block.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/messages_footer.cjs | Stops injecting the detection caution into agent-failure footer message functions. |
| actions/setup/js/messages.test.cjs | Updates expectations to ensure agent-failure footer functions do not include the caution callout. |
| actions/setup/js/handle_agent_failure.cjs | Prepends the caution callout to the top of agent-failure issue/comment bodies before adding the footer. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
actions/setup/js/handle_agent_failure.cjs:1551
- The new detection caution callout placement for newly created agent-failure issues isn’t exercised by tests in this PR. Consider adding coverage in
handle_agent_failure.test.cjsto verify the generated issue body starts with the caution block whenGH_AW_DETECTION_CONCLUSION=warning, and that the caution block is not duplicated elsewhere (e.g., in the footer).
// Prepend detection caution alert (when present) so it appears first in the issue body
const detectionCaution = getDetectionCautionAlert(workflowName, runUrl);
// Combine issue body with footer
const bodyLines = detectionCaution ? [detectionCaution, "", issueBodyContent, "", footerWithExpires] : [issueBodyContent, "", footerWithExpires];
const issueBody = bodyLines.join("\n");
- Files reviewed: 3/3 changed files
- Comments generated: 1
| // Prepend detection caution alert (when present) so it appears first in the comment body | ||
| const detectionCaution = getDetectionCautionAlert(workflowName, runUrl); | ||
| const fullCommentBodyRaw = detectionCaution ? `${detectionCaution}\n\n${commentBody}\n\n${footer}` : `${commentBody}\n\n${footer}`; | ||
|
|
||
| // Combine comment body with footer | ||
| const fullCommentBody = sanitizeContent(commentBody + "\n\n" + footer, { maxLength: 65000 }); | ||
| const fullCommentBody = sanitizeContent(fullCommentBodyRaw, { maxLength: 65000 }); | ||
|
|
There was a problem hiding this comment.
The new detection caution callout placement for agent-failure comments isn’t covered by tests in this PR. messages.test.cjs now asserts the footer does not contain the callout, but there’s no corresponding assertion that handle_agent_failure actually prepends the callout to the comment body (and that it appears before the rendered template text). Add a focused test in handle_agent_failure.test.cjs that sets GH_AW_DETECTION_CONCLUSION=warning and verifies the created comment body begins with the caution block and only includes it once.
This issue also appears on line 1546 of the same file.
🧪 Test Quality Sentinel ReportTest Quality Score: 70/100
Test Classification DetailsView all 2 modified tests
Flagged Tests — Suggestions for Improvement
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 70/100. Test quality is acceptable — 0% of modified tests are implementation tests (threshold: 30%). Both tests correctly verify the behavioral change (footer functions no longer include the caution alert). Suggestion: add a positive assertion verifying the caution now appears at the top of the body in handle_agent_failure.cjs.
|
@copilot review all comments |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0207e738-267e-431c-9a99-636c5c6ccf17 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0207e738-267e-431c-9a99-636c5c6ccf17 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0207e738-267e-431c-9a99-636c5c6ccf17 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed. I added focused coverage in |
make agent-finish) before code changesnpm run test:js -- messages.test.cjs handle_agent_failure.test.cjs)make agent-finish) and record existing unrelated lint failures inpkg/agentdrain/spec_test.go