Skip to content

Generalize early wildcard-target validation across safe-outputs MCP tools#39300

Merged
pelikhan merged 12 commits into
mainfrom
copilot/add-custom-validation-safe-outputs
Jun 16, 2026
Merged

Generalize early wildcard-target validation across safe-outputs MCP tools#39300
pelikhan merged 12 commits into
mainfrom
copilot/add-custom-validation-safe-outputs

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Wildcard-target safe-outputs MCP calls were still reaching apply-time for some tools, where they failed with less actionable errors when the required target identifier was omitted. This change moves that validation into the MCP layer and defines the wildcard-target parameter requirements in the tool JSON so agents get immediate, tool-specific feedback before any intent is recorded.

  • What changed

    • Added MCP-side validation for wildcard-target safe-output tools using schema-defined target requirements instead of handler-specific hardcoding.
    • The tool-definition JSON now declares which parameters are required when target: "*" is configured.
    • Extended coverage so wildcard-target calls now reject missing explicit identifiers for:
      • close_pull_request
      • create_pull_request_review_comment
      • submit_pull_request_review
      • update_pull_request
      • push_to_pull_request_branch
      • create_check_run
      • update_discussion
  • Validation behavior

    • Introduced a shared wildcard-target validation path driven by tool-definition metadata.
    • Preserved alias support where the tool schema allows it.
    • Returns an MCP error response immediately instead of deferring failure to downstream processing.
  • Review comment buffering

    • Tightened review-comment buffering so failed create_pull_request_review_comment calls do not increment the inline review comment counter.
    • This preserves the empty-review guard for subsequent submit_pull_request_review calls.
  • Tests

    • Added focused handler coverage for generalized wildcard-target rejection behavior, including the additional tools above, while keeping existing review comment, submit review, and update PR coverage.
const wildcardTargetValidationError = validateWildcardTargetRequirement(entry);
if (wildcardTargetValidationError) {
  return wildcardTargetValidationError;
}

pr-sous-chef: refreshed branch for run https://github.com/github/gh-aw/actions/runs/27604242308

Generated by 👨‍🍳 PR Sous Chef · 97.9 AIC · ⌖ 1.04 AIC · ⊞ 17.4K ·


Generalize early wildcard-target validation across safe-outputs MCP tools

Wildcard-target safe-outputs MCP calls were still reaching apply-time for some tools, where they failed with less actionable errors when the required target identifier was omitted. This change moves that validation into the MCP layer and defines the wildcard-target parameter requirements in the tool JSON so agents get immediate, tool-specific feedback before any intent is recorded.

  • What changed

    • Added MCP-side validation for wildcard-target safe-output tools using schema-defined target requirements instead of handler-specific hardcoding.
    • The tool-definition JSON now declares which parameters are required when target: "*" is configured.
    • Extended coverage so wildcard-target calls now reject missing explicit identifiers for:
      • close_pull_request
      • create_pull_request_review_comment
      • submit_pull_request_review
      • update_pull_request
      • push_to_pull_request_branch
      • create_check_run
      • update_discussion
  • Validation behavior

    • Introduced a shared wildcard-target validation path driven by tool-definition metadata.
    • Preserved alias support where the tool schema allows it.
    • Returns an MCP error response immediately instead of deferring failure to downstream processing.
  • Review comment buffering

    • Tightened review-comment buffering so failed create_pull_request_review_comment calls do not increment the inline review comment counter.
    • This preserves the empty-review guard for subsequent submit_pull_request_review calls.
  • Tests

    • Added focused handler coverage for generalized wildcard-target rejection behavior, including the additional tools above, while keeping existing review comment, submit review, and update PR coverage.
const wildcardTargetValidationError = validateWildcardTargetRequirement(entry);
if (wildcardTargetValidationError) {
  return wildcardTargetValidationError;
}

pr-sous-chef: refreshed branch for run https://github.com/github/gh-aw/actions/runs/27604242308

Generated by 👨🍳 PR Sous Chef · 97.9 AIC · ⌖ 1.04 AIC · ⊞ 17.4K ·

Changeset

  • Type: patch
  • Description: Generalized wildcard-target safe-outputs validation so missing target identifiers fail immediately with tool-specific errors instead of deferring to apply time.

Generated by 📋 Changeset Generator for issue #39300 · 11.7 AIC · ⊞ 15.3K ·



✨ PR Review Safe Output Test - Run 27624403916

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 65 AIC · ⌖ 31 AIC · ⊞ 8.1K ·

Copilot AI and others added 2 commits June 15, 2026 00:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add wildcard target validation to safe-outputs MCP Add early wildcard-target validation for safe-outputs MCP PR tools Jun 15, 2026
Copilot AI requested a review from pelikhan June 15, 2026 00:20
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot apply to other safeoutputs like add_comment, close_pull_request... define the relation between target * and parameters in the specification/JSON to be more generic - less hardcoding

Copilot AI and others added 2 commits June 15, 2026 13:39
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot do not require json file, read file parse json (there is problably a helper for this)

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

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot apply to other safeoutputs like add_comment, close_pull_request... define the relation between target * and parameters in the specification/JSON to be more generic - less hardcoding

Addressed in 689f1f2. The wildcard-target requirement is now driven from tool-definition JSON instead of handler-specific checks, and I extended it to other safe-outputs including close_pull_request while keeping add_comment and the PR review/update flows covered.

Copilot AI changed the title Add early wildcard-target validation for safe-outputs MCP PR tools Generalize early wildcard-target validation for safe-outputs MCP tools Jun 15, 2026
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot do not require json file, read file parse json (there is problably a helper for this)

Fixed in ed1abeb: safe_outputs_handlers.cjs now reads and parses safe_outputs_tools.json directly instead of requiring the JSON module.

@pelikhan pelikhan marked this pull request as ready for review June 15, 2026 14:05
Copilot AI review requested due to automatic review settings June 15, 2026 14:05
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer failed during the skills-based review.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ failed during design decision gate check.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Pi MISSION COMPLETE! Pi delivered. 🥧

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

⚠️ Smoke Gemini failed. Gemini encountered unexpected challenges...

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

💫 TO BE CONTINUED... Smoke Claude failed to deliver outputs! Our hero faces unexpected challenges...

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

🚀 Smoke Antigravity MISSION COMPLETE! Antigravity has spoken. ✨

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

✅ All tools validated successfully! Agent Container Smoke Test confirms agent container is ready.

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (Entra) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot - AOAI (apikey) is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

Agent Container Tool Check

Tool Status Version
bash 5.2.21
sh available
git 2.54.0
jq 1.7
yq 4.53.3
curl 8.5.0
gh 2.93.0
node 22.22.3
python3 3.11.15 (PyPy 7.3.23)
go 1.24.13
java OpenJDK 21.0.11
dotnet 10.0.300

Result: 12/12 tools available — PASS

🔧 Tool validation by Agent Container Smoke Test · 40 AIC · ⌖ 12.3 AIC · ⊞ 28.1K ·

@github-actions

Copy link
Copy Markdown
Contributor

Commit pushed: 3ad28b3

Generated by Changeset Generator · 11.7 AIC · ⊞ 15.3K

@github-actions

Copy link
Copy Markdown
Contributor

💥 Smoke Test: Claude — Run 27624403916

Overall: PASS

Core #1-12: ✅✅✅✅✅✅✅✅✅✅✅✅
PR Review #13-18: ✅ | #19: ⚠️ skipped

All systems nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 65 AIC · ⌖ 31 AIC · ⊞ 8.1K ·

@github-actions github-actions Bot 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.

💥 Automated smoke test review - all systems nominal!

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

💥 [THE END] — Illustrated by Smoke Claude · 65 AIC · ⌖ 31 AIC · ⊞ 8.1K

const { globPatternToRegex } = require("./glob_pattern_helpers.cjs");
/**
* Read and parse a JSON file.
* @param {string} filePath

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.

Nice helper — consider validating the file exists before parsing to give a clearer error on missing config.

*/
function readJSONFile(filePath) {
return JSON.parse(fs.readFileSync(filePath, "utf8"));
}

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.

Building the Map once at module load is efficient; a brief comment on its purpose would aid readability.

@github-actions

Copy link
Copy Markdown
Contributor

PR: Generalize early wildcard-target validation across safe-outputs MCP tools
1✅ 2✅ 3✅ 4✅ 5✅
6✅ 7✅ 8✅ 9✅ 10❌
11✅ 12✅ 13✅ 14✅ 15✅
Overall: FAIL
Author: app/copilot-swe-agent
Assignees: pelikhan, Copilot

Warning

Firewall blocked 6 domains

The following domains were blocked by the firewall during workflow execution:

  • accounts.google.com
  • android.clients.google.com
  • clients2.google.com
  • contentautofill.googleapis.com
  • safebrowsingohttpgateway.googleapis.com
  • www.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "accounts.google.com"
    - "android.clients.google.com"
    - "clients2.google.com"
    - "contentautofill.googleapis.com"
    - "safebrowsingohttpgateway.googleapis.com"
    - "www.google.com"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot · 132.8 AIC · ⌖ 15.3 AIC · ⊞ 19.4K ·

@pelikhan pelikhan merged commit a50bb81 into main Jun 16, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/add-custom-validation-safe-outputs branch June 16, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants