Accept pr_number / pr aliases for PR safe-output targets#32043
Open
Copilot wants to merge 2 commits into
Open
Conversation
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 May 14, 2026
pr_number / pr aliases for PR safe-output targets
Contributor
There was a problem hiding this comment.
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_numberandpraliases. - Updates safe-output tool schemas to accept aliases for
add_commentandupdate_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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
PR Sous Chef had repeated
safe_outputsfailures 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_requestwithtarget: "*"failed when onlypr_numberwas present.add_commentwithtarget: "*"failed when onlypr_number/prwas present.How did you fix it?
actions/setup/js/safe_output_helpers.cjsto treatpr_numberandpras PR-number aliases alongsidepull_request_numberwhen resolving wildcard targets.pr_numberandprproperties for:add_comment(aliasingitem_number)update_pull_request(aliasingpull_request_number)actions/setup/js/safe_outputs_tools.jsonpkg/workflow/js/safe_outputs_tools.jsonactions/setup/js/safe_output_helpers.test.cjswith 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
safe_output_helpers.test.cjs.