Skip to content

Accept pr_number / pr aliases for PR safe-output targets#32043

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-fix-sous-chef-field-names
Open

Accept pr_number / pr aliases for PR safe-output targets#32043
Copilot wants to merge 2 commits into
mainfrom
copilot/aw-failures-fix-sous-chef-field-names

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 14, 2026

Bug Fix

PR Sous Chef had repeated safe_outputs failures when Copilot emitted REST-style fields (pr_number, pr) instead of canonical MCP fields (pull_request_number, item_number). This change adds defensive alias handling so those outputs resolve correctly instead of failing validation/target resolution.

  • What was the bug?

    • update_pull_request with target: "*" failed when only pr_number was present.
    • add_comment with target: "*" failed when only pr_number/pr was present.
    • Result: avoidable workflow failures from field-name mismatch, not intent mismatch.
  • How did you fix it?

    • Target resolution aliasing
      • Updated actions/setup/js/safe_output_helpers.cjs to treat pr_number and pr as PR-number aliases alongside pull_request_number when resolving wildcard targets.
    • Schema-level alias support
      • Added pr_number and pr properties for:
        • add_comment (aliasing item_number)
        • update_pull_request (aliasing pull_request_number)
      • Updated both schema sources:
        • actions/setup/js/safe_outputs_tools.json
        • pkg/workflow/js/safe_outputs_tools.json
    • Focused regression coverage
      • Extended actions/setup/js/safe_output_helpers.test.cjs with alias cases for numeric and string forms.
  • Example

{"type":"update_pull_request","pr_number":32012,"update_branch":true,"body":"Updating branch to resolve mergeability."}
{"type":"add_comment","pr_number":"32015","body":"Quick nudge: @copilot please summarize..."}
{"type":"add_comment","pr":"32012","body":"pr-sous-chef: quick nudge ..."}

These now resolve to the intended PR target instead of failing with missing-number errors.

  • Testing

    • Added/updated targeted JS tests for alias resolution paths in safe_output_helpers.test.cjs.
    • Change is scoped to defensive field-name compatibility and does not alter canonical field semantics.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PR Sous Chef: Copilot CLI emits wrong safe-output field names Accept pr_number / pr aliases for PR safe-output targets May 14, 2026
Copilot AI requested a review from pelikhan May 14, 2026 01:54
@pelikhan pelikhan marked this pull request as ready for review May 14, 2026 02:46
Copilot AI review requested due to automatic review settings May 14, 2026 02:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds defensive PR-number alias handling for safe-output targets so REST-style pr_number / pr fields can resolve where canonical fields are expected.

Changes:

  • Extends wildcard target resolution to consider pr_number and pr aliases.
  • Updates safe-output tool schemas to accept aliases for add_comment and update_pull_request.
  • Adds focused helper tests for PR-only alias resolution.
Show a summary per file
File Description
actions/setup/js/safe_output_helpers.cjs Adds PR-number alias fallback during wildcard target resolution.
actions/setup/js/safe_output_helpers.test.cjs Adds regression tests for alias handling in PR-only resolution.
actions/setup/js/safe_outputs_tools.json Allows pr_number / pr in setup safe-output tool schemas.
pkg/workflow/js/safe_outputs_tools.json Mirrors schema alias support in workflow packaged tool definitions.

Copilot's findings

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 1

if (supportsPR) {
// Supports both issues and PRs: check all fields
numberField = item.item_number || item.issue_number || item.pull_request_number;
numberField = item.item_number || item.issue_number || pullRequestNumberField;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants