fix: safe_output_summary shows final posted body including footer for add_comment#29435
Conversation
… add_comment When an agent submits an add_comment via the safe outputs MCP tool, the body preview in the job step summary was showing only what the agent submitted (message.body), without the footer that is appended during processing. This caused a mismatch between the "Body Preview" shown in the step summary and the actually posted comment (which includes the footer attribution). Fix: - Return `processedBody` (the final body with footer) from add_comment.cjs in the result object as `body` - Update safe_output_summary.cjs to prefer `result.body` (final posted body) over `message.body` (submitted body) for the Body Preview, falling back to message.body when result.body is absent - Add two tests verifying the result.body preference and fallback Agent-Logs-Url: https://github.com/github/gh-aw/sessions/8069bd2d-dd4c-403e-96f3-9e2d9532f4a2 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates safe-output step summaries so the “Body Preview” for add_comment reflects the final posted comment body (including the footer appended during processing), eliminating mismatches between the summary preview and the actual posted comment.
Changes:
- Return the fully processed comment body (
processedBody, including footer/markers) fromadd_commentasresult.body. - Update
safe_output_summaryto preferresult.bodyovermessage.bodyfor “Body Preview”, with a fallback tomessage.body. - Add tests covering the preference for
result.bodyand the fallback behavior.
Show a summary per file
| File | Description |
|---|---|
actions/setup/js/add_comment.cjs |
Includes the final processed comment body in the handler result so downstream consumers can display what was actually posted. |
actions/setup/js/safe_output_summary.cjs |
Uses result.body (when present) for “Body Preview” to match the posted comment content. |
actions/setup/js/safe_output_summary.test.cjs |
Adds coverage to ensure result.body is preferred and message.body is used as a fallback. |
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: 75/100
Test Classification DetailsView Test Breakdown (2 tests)
Suggestions
|
|
@copilot the generated comment only had "Test comment" |
Yes — the agent submitted The fix (commit |
Summary
When an agent submits an
add_commentvia the safe outputs MCP tool, the "Body Preview" in the job step summary was showing only what the agent submitted (message.body), without the footer thatadd_comment.cjsappends during processing. This caused a mismatch between the "Body Preview" shown in the step summary and the actually posted comment (which includes the footer attribution).Example mismatch visible at: https://github.com/github/gh-aw/actions/runs/25200713765/job/73891038812#step:37:1
Changes
add_comment.cjs: IncludeprocessedBody(the final body with footer appended) in the result returned byrecordCommentasbodysafe_output_summary.cjs: Preferresult.body(final posted body including footer) overmessage.body(raw submitted body) for the Body Preview, falling back tomessage.bodywhenresult.bodyis absentsafe_output_summary.test.cjs: Add two tests verifyingresult.bodypreference and fallback behavior