Skip to content

fix: uppercase state_reason enum constants in close_issue tool schema - #18269

Merged
pelikhan merged 2 commits into
copilot/update-close-issue-duplicatefrom
copilot/fix-tests-32f46bac-0752-46bd-bd6e-69e94a3e33fb
Feb 25, 2026
Merged

fix: uppercase state_reason enum constants in close_issue tool schema#18269
pelikhan merged 2 commits into
copilot/update-close-issue-duplicatefrom
copilot/fix-tests-32f46bac-0752-46bd-bd6e-69e94a3e33fb

Conversation

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

The safe_outputs_mcp_schema_validation test enforces that schema fields containing "reason" use UPPERCASE enum constants (consistent with close_discussion and other tools). The close_issue tool's state_reason field used lowercase values, causing a CI failure.

Changes

  • safe_outputs_tools.json: Changed state_reason enum from ["completed", "not_planned", "duplicate"]["COMPLETED", "NOT_PLANNED", "DUPLICATE"]
  • close_issue.cjs: Added .toLowerCase() before passing state_reason to the GitHub REST API (which requires lowercase); updated default from "completed""COMPLETED"
  • close_issue.test.cjs: Updated tests to pass UPPERCASE values (matching schema), while still asserting lowercase reaches the API
// Schema now uses UPPERCASE (for AI agent consumption)
"state_reason": { "enum": ["COMPLETED", "NOT_PLANNED", "DUPLICATE"] }

// Handler converts before calling GitHub REST API
state_reason: (stateReason || "COMPLETED").toLowerCase()
Original prompt

Reference: https://github.com/github/gh-aw/actions/runs/22382805499/job/64788089560#step:7:1

Fix tests


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing tests in the application fix: uppercase state_reason enum constants in close_issue tool schema Feb 25, 2026
@pelikhan
pelikhan marked this pull request as ready for review February 25, 2026 05:34
Copilot AI review requested due to automatic review settings February 25, 2026 05:34
@pelikhan
pelikhan merged commit 80aa2aa into copilot/update-close-issue-duplicate Feb 25, 2026
@pelikhan
pelikhan deleted the copilot/fix-tests-32f46bac-0752-46bd-bd6e-69e94a3e33fb branch February 25, 2026 05:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a CI test failure by standardizing the close_issue tool's state_reason enum values to use UPPERCASE constants, consistent with the close_discussion tool and the safe_outputs_mcp_schema_validation test requirements. The implementation ensures compatibility with the GitHub REST API by converting values to lowercase before making API calls.

Changes:

  • Updated state_reason enum constants from lowercase to UPPERCASE in the MCP schema
  • Added .toLowerCase() conversion in the implementation to maintain GitHub API compatibility
  • Updated all tests to use UPPERCASE values while verifying lowercase reaches the API

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
actions/setup/js/safe_outputs_tools.json Changed state_reason enum from lowercase to UPPERCASE constants (["COMPLETED", "NOT_PLANNED", "DUPLICATE"])
actions/setup/js/close_issue.cjs Added .toLowerCase() conversion before API call and updated default value to "COMPLETED"
actions/setup/js/close_issue.test.cjs Updated test descriptions and inputs to use UPPERCASE values while maintaining lowercase assertions for API calls

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

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.

3 participants