schema: add normalize-closing-keywords to create-issue, add-comment, create-pull-request branches#39643
Conversation
|
Hey One thing to make sure lands before this comes out of draft:
When the agent is ready to add coverage, here's a prompt to pass along:
|
…ull-request schema branches Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
normalize-closing-keywords to create-issue, add-comment, create-pull-request branches
|
@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>
Done in the latest commit. The runtime was already propagating the flag correctly — For the compiled |
There was a problem hiding this comment.
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.jsonto allownormalize-closing-keywords: booleanoncreate-issue,add-comment, andcreate-pull-requestsafe-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
| 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) | ||
| } |
|
@copilot run pr-finisher skill |
|
@copilot review all comments and summarize any remaining blockers before the next pass.
|
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in eabcf06. I added the missing negative tests for |
normalize-closing-keywordsis implemented inBaseSafeOutputConfigand emitted by three safe-output handlers, but was absent from the JSON schema. Since all safe-output object branches setadditionalProperties: false, any workflow using this field failed validation despite the feature being fully functional.Changes
pkg/parser/schemas/main_workflow_schema.json: addsnormalize-closing-keywords(boolean) to thepropertiesblock of the object branch forcreate-issue,add-comment, andcreate-pull-request.pkg/workflow/tool_description_enhancer.go: whennormalize-closing-keywords: trueis 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 intodescription_suffixesin the compiledtools_meta.jsonand is applied to the finaltools.jsonat 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.goemitsnormalize_closing_keywordsintoconfig.json, andcollect_ndjson_output.cjsreads it to drive backtick normalization during output validation.Example workflow config that was previously rejected by the validator: