Skip to content

fix: close_pull_request missing from config.json despite being in handler config#20897

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-missing-close-pull-request-config
Mar 14, 2026
Merged

fix: close_pull_request missing from config.json despite being in handler config#20897
pelikhan merged 4 commits intomainfrom
copilot/fix-missing-close-pull-request-config

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

close_pull_request was correctly compiled into GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG but never written to /opt/gh-aw/safeoutputs/config.json. The MCP server uses config.json to decide which tools to register, so close_pull_request was silently skipped at runtime — agent could see it in the prompt's tool list but couldn't call it.

Changes

  • safe_outputs_config_generation.go: Added the missing close_pull_request block to generateSafeOutputsConfig, following the same pattern as close_issue with additional handling for github-token and staged fields from BaseSafeOutputConfig
  • safe_outputs_config_generation_test.go: Added tests covering the full field set and the staged flag

Copilot AI and others added 3 commits March 13, 2026 23:14
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…s in config.json

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 14, 2026 02:40
Copilot AI review requested due to automatic review settings March 14, 2026 02:40
@pelikhan pelikhan merged commit b7e7c6b into main Mar 14, 2026
56 checks passed
@pelikhan pelikhan deleted the copilot/fix-missing-close-pull-request-config branch March 14, 2026 02:46
Copy link
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 support for emitting close_pull_request safe-outputs configuration into the generated config.json used by the safe-outputs MCP server.

Changes:

  • Generate close_pull_request handler config (max/target/allowed_repos + required label/title filters).
  • Forward github-token and staged settings for close_pull_request.
  • Add unit tests validating the generated close_pull_request config JSON (including staged/token behavior).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/workflow/safe_outputs_config_generation.go Adds generation of close_pull_request config with optional filters/token/staged.
pkg/workflow/safe_outputs_config_generation_test.go Adds tests covering close_pull_request config emission and staged behavior.

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +108 to +127
if data.SafeOutputs.ClosePullRequests != nil {
additionalFields := make(map[string]any)
if len(data.SafeOutputs.ClosePullRequests.RequiredLabels) > 0 {
additionalFields["required_labels"] = data.SafeOutputs.ClosePullRequests.RequiredLabels
}
if data.SafeOutputs.ClosePullRequests.RequiredTitlePrefix != "" {
additionalFields["required_title_prefix"] = data.SafeOutputs.ClosePullRequests.RequiredTitlePrefix
}
if data.SafeOutputs.ClosePullRequests.GitHubToken != "" {
additionalFields["github-token"] = data.SafeOutputs.ClosePullRequests.GitHubToken
}
if data.SafeOutputs.ClosePullRequests.Staged {
additionalFields["staged"] = true
}
safeOutputsConfig["close_pull_request"] = generateTargetConfigWithRepos(
data.SafeOutputs.ClosePullRequests.SafeOutputTargetConfig,
data.SafeOutputs.ClosePullRequests.Max,
1, // default max
additionalFields,
)
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.

The agent cannot close PRs even though the frontmatter explicitly configures it.

3 participants