Skip to content

Post a closure comment when the pre-created steering PR is discarded after a failed run - #55564

Closed
pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/investigate-failed-workflow-comment
Closed

pelikhan with Copilot wants to merge 1 commit into
mainfrom
copilot/investigate-failed-workflow-comment

Conversation

Copilot AI commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

When a failed workflow run closed its pre-created ("steering") pull request, no comment was added explaining the closure — even though the design intends to link back to the recorded agent-failure issue/comment when one exists.

Root cause

  • failure_issue_number/failure_issue_url step outputs were only set when handle_agent_failure.cjs created a new failure issue, not when it added a comment to an existing one (the common case once an issue already exists for that failure signature).
  • Because those outputs were empty, the conclusion step that closes the pre-created PR had nothing to link to and silently skipped commenting.
  • There was also no fallback message at all for failed/cancelled runs that never produced a failure issue in the first place.

Changes

  • handle_agent_failure.cjs: publish failure_issue_number/failure_issue_url outputs after commenting on an existing failure issue too, pointing at the specific comment (not just the issue) so downstream steps link directly to the relevant detail.
  • complete_pre_created_check_run.cjs: restructured pre-created PR discard flow to always post an explanatory comment before closing on a failed/cancelled run:
    • a no-op message, if the run produced one (unchanged priority), otherwise
    • a message linking to the failure issue/comment, when available, otherwise
    • a generic message referencing the workflow run.
  • Updated/extended unit tests in complete_pre_created_check_run.test.cjs to cover the new comment wording and the existing-issue linking path.
// Before: only set when a brand-new issue was created
setFailureIssueOutputs(newIssue.data);

// After: also set when commenting on an existing issue,
// pointing at the comment itself
setFailureIssueOutputs({ number: existingIssue.number, html_url: failureComment.html_url });

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan closed this Aug 25, 2026
@github-actions
github-actions Bot deleted the copilot/investigate-failed-workflow-comment branch September 2, 2026 02:14
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.

2 participants