Skip to content

schema: add normalize-closing-keywords to create-issue, add-comment, create-pull-request branches#39643

Merged
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-add-normalize-closing-keywords
Jun 16, 2026
Merged

schema: add normalize-closing-keywords to create-issue, add-comment, create-pull-request branches#39643
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-add-normalize-closing-keywords

Conversation

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

normalize-closing-keywords is implemented in BaseSafeOutputConfig and emitted by three safe-output handlers, but was absent from the JSON schema. Since all safe-output object branches set additionalProperties: false, any workflow using this field failed validation despite the feature being fully functional.

Changes

  • pkg/parser/schemas/main_workflow_schema.json: adds normalize-closing-keywords (boolean) to the properties block of the object branch for create-issue, add-comment, and create-pull-request.

  • pkg/workflow/tool_description_enhancer.go: when normalize-closing-keywords: true is configured for any of the three affected output types, a description note is appended to the corresponding MCP tool — "Backtick-wrapped issue-closing keyword references (e.g. Closes #1) in the body field will be automatically normalized to plain text." — so the LLM agent is informed of the normalization. This note flows into description_suffixes in the compiled tools_meta.json and is applied to the final tools.json at runtime.

  • pkg/workflow/tool_description_enhancer_test.go: adds tests covering the new description suffix for all three tools (enabled/disabled).

The runtime propagation was already correct: safe_outputs_handler_registry.go emits normalize_closing_keywords into config.json, and collect_ndjson_output.cjs reads it to drive backtick normalization during output validation.

Example workflow config that was previously rejected by the validator:

safe-outputs:
  create-pull-request:
    normalize-closing-keywords: true
    title-prefix: "[fix] "

@github-actions

Copy link
Copy Markdown
Contributor

Hey @pelikhan 👋 — thanks for spinning up the Copilot SWE Agent on this one! Adding normalize-closing-keywords to the three safe-output schema branches is a clean, high-value fix for a real gap between the implementation and the schema.

One thing to make sure lands before this comes out of draft:

  • Add tests — once the schema field is wired in, a test covering the new normalize-closing-keywords property on each of the three branches (create-issue, add-comment, create-pull-request) would help confirm the schema validation no longer rejects valid workflows that use it.

When the agent is ready to add coverage, here's a prompt to pass along:

Add schema validation tests for the `normalize-closing-keywords` boolean field that was just added to the `create-issue`, `add-comment`, and `create-pull-request` branches of `pkg/parser/schemas/main_workflow_schema.json`.

For each of the three branches:
1. Write a test that validates a workflow object including `normalize-closing-keywords: true` — expect it to pass schema validation.
2. Write a test that validates a workflow object omitting the field — expect it to also pass (the field is optional).

Place tests alongside the existing schema validation tests. Make sure all three branches are covered.

Generated by ✅ Contribution Check ·

…ull-request schema branches

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add normalize-closing-keywords to safe-output schema branches schema: add normalize-closing-keywords to create-issue, add-comment, create-pull-request branches Jun 16, 2026
Copilot AI requested a review from pelikhan June 16, 2026 18:35
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot ensure these flags are propagated to the safe outputs runtime and compiled tools.json

…on suffixes

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot ensure these flags are propagated to the safe outputs runtime and compiled tools.json

Done in the latest commit. The runtime was already propagating the flag correctly — safe_outputs_handler_registry.go emits normalize_closing_keywords into config.json for all three handlers, and collect_ndjson_output.cjs already reads it from typeConfig.normalize_closing_keywords.

For the compiled tools.json: added handling in enhanceToolDescription (pkg/workflow/tool_description_enhancer.go) so that when normalize-closing-keywords: true is set for create_issue, add_comment, or create_pull_request, the tool's description includes a note — "Backtick-wrapped issue-closing keyword references (e.g. Closes #1) in the body field will be automatically normalized to plain text." — which flows into the description_suffixes of tools_meta.json and is applied to the final tools.json at runtime.

@pelikhan pelikhan marked this pull request as ready for review June 16, 2026 21:05
Copilot AI review requested due to automatic review settings June 16, 2026 21:05

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 validation gap where normalize-closing-keywords was already implemented and emitted for several safe-output types, but workflows couldn’t use it because the main workflow JSON schema rejected the field (due to additionalProperties: false on those branches). It also surfaces the behavior to agents by appending an explanatory suffix to the relevant MCP tool descriptions, with accompanying unit tests.

Changes:

  • Extend main_workflow_schema.json to allow normalize-closing-keywords: boolean on create-issue, add-comment, and create-pull-request safe-output configs.
  • Update tool description enhancement to append a note when normalization is enabled for these output types.
  • Add unit tests verifying the description suffix behavior (currently only fully covers enabled/disabled for create_issue).
Show a summary per file
File Description
pkg/parser/schemas/main_workflow_schema.json Adds normalize-closing-keywords to the schema branches for create-issue, add-comment, and create-pull-request so workflows using it pass validation.
pkg/workflow/tool_description_enhancer.go Appends a descriptive constraint to create_issue, add_comment, and create_pull_request tool descriptions when normalization is enabled.
pkg/workflow/tool_description_enhancer_test.go Adds tests for the new description suffix behavior.

Copilot's findings

Tip

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

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

Comment on lines +228 to +247
func TestEnhanceToolDescriptionNormalizeClosingKeywordsAddComment(t *testing.T) {
description := enhanceToolDescription("add_comment", "Add a comment.", &SafeOutputsConfig{
AddComments: &AddCommentsConfig{
BaseSafeOutputConfig: BaseSafeOutputConfig{NormalizeClosingKeywords: boolPtr(true)},
},
})
if !strings.Contains(description, "Backtick-wrapped issue-closing keyword references") {
t.Fatalf("expected normalize-closing-keywords note in description, got: %s", description)
}
}

func TestEnhanceToolDescriptionNormalizeClosingKeywordsCreatePullRequest(t *testing.T) {
description := enhanceToolDescription("create_pull_request", "Create a pull request.", &SafeOutputsConfig{
CreatePullRequests: &CreatePullRequestsConfig{
BaseSafeOutputConfig: BaseSafeOutputConfig{NormalizeClosingKeywords: boolPtr(true)},
},
})
if !strings.Contains(description, "Backtick-wrapped issue-closing keyword references") {
t.Fatalf("expected normalize-closing-keywords note in description, got: %s", description)
}
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

@github-actions

Copy link
Copy Markdown
Contributor

@copilot review all comments and summarize any remaining blockers before the next pass.

Generated by 👨‍🍳 PR Sous Chef ·

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Done in eabcf06. I added the missing negative tests for add_comment and create_pull_request, and make fmt, make lint, make test-unit, make test, and make recompile all pass locally. Prior PR workflow runs were green; CI on this pushed head is stale until a maintainer re-triggers it.

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