From 840d6042f8f4df938f2e56c6c908225035b163f4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 14:01:31 +0000 Subject: [PATCH 1/5] Initial plan From a021c7b6379f7e311e811a8bfa0419407f9e61ae Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 14:10:22 +0000 Subject: [PATCH 2/5] Remove category validation from close_discussion handler The close_discussion handler was incorrectly validating the required_category configuration option, causing it to reject closing discussions that didn't match the specified category. This was an incorrect behavior - when the agent explicitly specifies which discussion to close, the category filter should not be applied. The required_category option is only used in close_older_discussions where it acts as a search filter to find discussions to close. Fixes the error: "Category doesn't match 'Ideas'" seen in workflow runs. Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com> --- actions/setup/js/close_discussion.cjs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/actions/setup/js/close_discussion.cjs b/actions/setup/js/close_discussion.cjs index bf7f2e2ab4..ce36b2972a 100644 --- a/actions/setup/js/close_discussion.cjs +++ b/actions/setup/js/close_discussion.cjs @@ -152,7 +152,6 @@ async function main(config = {}) { // Extract configuration const requiredLabels = config.required_labels || []; const requiredTitlePrefix = config.required_title_prefix || ""; - const requiredCategory = config.required_category || ""; const maxCount = config.max || 10; core.info(`Close discussion configuration: max=${maxCount}`); @@ -162,9 +161,6 @@ async function main(config = {}) { if (requiredTitlePrefix) { core.info(`Required title prefix: ${requiredTitlePrefix}`); } - if (requiredCategory) { - core.info(`Required category: ${requiredCategory}`); - } // Track how many items we've processed for max limit let processedCount = 0; @@ -239,15 +235,6 @@ async function main(config = {}) { }; } - // Validate required category if configured - if (requiredCategory && discussion.category.name !== requiredCategory) { - core.warning(`Discussion #${discussionNumber} category "${discussion.category.name}" doesn't match required "${requiredCategory}"`); - return { - success: false, - error: `Category doesn't match "${requiredCategory}"`, - }; - } - // Add comment if body is provided let commentUrl; if (item.body) { From 276ce02e5d9193c09f405feb901d2bde7750d85e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:43:37 +0000 Subject: [PATCH 3/5] Move required_category to create-discussion config Moved required_category field from close-discussion to create-discussion configuration where it belongs. This field is used for filtering when close-older-discussions is enabled, not for the standalone close_discussion safe output. Changes: - Added RequiredCategory field to CreateDiscussionsConfig - Updated compiler to pass required_category to create_discussion handler - Removed required_category from close_discussion handler config - Added logging for the new field This addresses the PR comment requesting that required_category be under close_older_discussions to represent the dependency correctly. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/compiler_safe_outputs_config.go | 6 +++--- pkg/workflow/create_discussion.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/workflow/compiler_safe_outputs_config.go b/pkg/workflow/compiler_safe_outputs_config.go index 07ef1e6e34..62d9cfd5e9 100644 --- a/pkg/workflow/compiler_safe_outputs_config.go +++ b/pkg/workflow/compiler_safe_outputs_config.go @@ -93,6 +93,9 @@ func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *Workflow if cfg.CloseOlderDiscussions { handlerConfig["close_older_discussions"] = true } + if cfg.RequiredCategory != "" { + handlerConfig["required_category"] = cfg.RequiredCategory + } if cfg.Expires > 0 { handlerConfig["expires"] = cfg.Expires } @@ -142,9 +145,6 @@ func (c *Compiler) addHandlerManagerConfigEnvVar(steps *[]string, data *Workflow if cfg.RequiredTitlePrefix != "" { handlerConfig["required_title_prefix"] = cfg.RequiredTitlePrefix } - if cfg.RequiredCategory != "" { - handlerConfig["required_category"] = cfg.RequiredCategory - } if cfg.TargetRepoSlug != "" { handlerConfig["target-repo"] = cfg.TargetRepoSlug } diff --git a/pkg/workflow/create_discussion.go b/pkg/workflow/create_discussion.go index d809a87b8f..ebeab106d0 100644 --- a/pkg/workflow/create_discussion.go +++ b/pkg/workflow/create_discussion.go @@ -18,6 +18,7 @@ type CreateDiscussionsConfig struct { TargetRepoSlug string `yaml:"target-repo,omitempty"` // Target repository in format "owner/repo" for cross-repository discussions AllowedRepos []string `yaml:"allowed-repos,omitempty"` // List of additional repositories that discussions can be created in CloseOlderDiscussions bool `yaml:"close-older-discussions,omitempty"` // When true, close older discussions with same title prefix or labels as outdated + RequiredCategory string `yaml:"required-category,omitempty"` // Required category for matching when closing older discussions Expires int `yaml:"expires,omitempty"` // Hours until the discussion expires and should be automatically closed } @@ -90,6 +91,9 @@ func (c *Compiler) parseDiscussionsConfig(outputMap map[string]any) *CreateDiscu if config.CloseOlderDiscussions { discussionLog.Print("Close older discussions enabled") } + if config.RequiredCategory != "" { + discussionLog.Printf("Required category for close older discussions: %q", config.RequiredCategory) + } if config.Expires > 0 { discussionLog.Printf("Discussion expiration configured: %d hours", config.Expires) } From d3426bdd938ee2a67efc82cf4002fa09ba898c4c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:46:31 +0000 Subject: [PATCH 4/5] Address code review feedback for required_category Improved documentation and logging for RequiredCategory field: - Clarified comment to indicate field is only used when close-older-discussions is enabled - Made logging conditional on CloseOlderDiscussions flag Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- pkg/workflow/create_discussion.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/workflow/create_discussion.go b/pkg/workflow/create_discussion.go index ebeab106d0..ffe18b6067 100644 --- a/pkg/workflow/create_discussion.go +++ b/pkg/workflow/create_discussion.go @@ -18,7 +18,7 @@ type CreateDiscussionsConfig struct { TargetRepoSlug string `yaml:"target-repo,omitempty"` // Target repository in format "owner/repo" for cross-repository discussions AllowedRepos []string `yaml:"allowed-repos,omitempty"` // List of additional repositories that discussions can be created in CloseOlderDiscussions bool `yaml:"close-older-discussions,omitempty"` // When true, close older discussions with same title prefix or labels as outdated - RequiredCategory string `yaml:"required-category,omitempty"` // Required category for matching when closing older discussions + RequiredCategory string `yaml:"required-category,omitempty"` // Required category for matching when close-older-discussions is enabled Expires int `yaml:"expires,omitempty"` // Hours until the discussion expires and should be automatically closed } @@ -90,9 +90,9 @@ func (c *Compiler) parseDiscussionsConfig(outputMap map[string]any) *CreateDiscu } if config.CloseOlderDiscussions { discussionLog.Print("Close older discussions enabled") - } - if config.RequiredCategory != "" { - discussionLog.Printf("Required category for close older discussions: %q", config.RequiredCategory) + if config.RequiredCategory != "" { + discussionLog.Printf("Required category for close older discussions: %q", config.RequiredCategory) + } } if config.Expires > 0 { discussionLog.Printf("Discussion expiration configured: %d hours", config.Expires) From 4ab194eec264b4474e1458fb9cee885fd322af9b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 21:02:07 +0000 Subject: [PATCH 5/5] Recompile plan.lock.yml after removing required_category After removing required_category from close_discussion handler config, the plan.lock.yml needed to be recompiled to remove the field from the compiled workflow configuration. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/plan.lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index 82c4533965..e0e6a80f20 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -1409,7 +1409,7 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} - GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"close_discussion\":{\"max\":1,\"required_category\":\"Ideas\"},\"create_issue\":{\"labels\":[\"plan\",\"ai-generated\"],\"max\":6,\"title_prefix\":\"[plan] \"},\"missing_data\":{},\"missing_tool\":{}}" + GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG: "{\"close_discussion\":{\"max\":1},\"create_issue\":{\"labels\":[\"plan\",\"ai-generated\"],\"max\":6,\"title_prefix\":\"[plan] \"},\"missing_data\":{},\"missing_tool\":{}}" with: github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} script: |