From a5991ea244a64e9bc1ddf0256e1b30b7966bbeee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Jun 2026 00:11:31 +0000 Subject: [PATCH 1/2] plan: add wildcard target validation for create_pull_request_review_comment Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/design-decision-gate.lock.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/design-decision-gate.lock.yml b/.github/workflows/design-decision-gate.lock.yml index 35b8cf0a123..b9c37433632 100644 --- a/.github/workflows/design-decision-gate.lock.yml +++ b/.github/workflows/design-decision-gate.lock.yml @@ -1,4 +1,4 @@ -# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"1c1efd464b8abce72ea3e7a83b6fbe9bd835f14977119ec27b8b6639b23662a7","body_hash":"9880585d9d235e2471ffd64a8f88bc3980d510d92a24ce288650c7e6bfc3ee10","strict":true,"agent_id":"claude","engine_versions":{"claude":"2.1.168"}} +# gh-aw-metadata: {"schema_version":"v4","frontmatter_hash":"1c1efd464b8abce72ea3e7a83b6fbe9bd835f14977119ec27b8b6639b23662a7","body_hash":"f7128337e3ace722fd3887a9911d1d21e5dd1a768495d4cf067d10bc31cc77f3","strict":true,"agent_id":"claude","engine_versions":{"claude":"2.1.168"}} # gh-aw-manifest: {"version":1,"secrets":["ANTHROPIC_API_KEY","GH_AW_CI_TRIGGER_TOKEN","GH_AW_GITHUB_MCP_SERVER_TOKEN","GH_AW_GITHUB_TOKEN","GH_AW_OTEL_GRAFANA_AUTHORIZATION","GH_AW_OTEL_GRAFANA_ENDPOINT","GH_AW_OTEL_SENTRY_AUTHORIZATION","GH_AW_OTEL_SENTRY_ENDPOINT","GITHUB_TOKEN"],"actions":[{"repo":"actions/cache/restore","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/cache/save","sha":"27d5ce7f107fe9357f9df03efb73ab90386fccae","version":"v5.0.5"},{"repo":"actions/checkout","sha":"df4cb1c069e1874edd31b4311f1884172cec0e10","version":"v6.0.3"},{"repo":"actions/download-artifact","sha":"3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c","version":"v8.0.1"},{"repo":"actions/github-script","sha":"3a2844b7e9c422d3c10d287c895573f7108da1b3","version":"v9.0.0"},{"repo":"actions/setup-node","sha":"48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e","version":"v6.4.0"},{"repo":"actions/upload-artifact","sha":"043fb46d1a93c77aae656e7c1c64a875d1fc6a0a","version":"v7.0.1"}],"containers":[{"image":"ghcr.io/github/gh-aw-firewall/agent:0.27.2","digest":"sha256:f88e5b17b6b7a600117bc121114d6ce2155c88c983c0c939c5df884f730fa1d6","pinned_image":"ghcr.io/github/gh-aw-firewall/agent:0.27.2@sha256:f88e5b17b6b7a600117bc121114d6ce2155c88c983c0c939c5df884f730fa1d6"},{"image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.2","digest":"sha256:ee39841d980878ebbb87592903b06d31a1af500c71525c9616f7e8e2a27041a4","pinned_image":"ghcr.io/github/gh-aw-firewall/api-proxy:0.27.2@sha256:ee39841d980878ebbb87592903b06d31a1af500c71525c9616f7e8e2a27041a4"},{"image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.27.2","digest":"sha256:02f3ec08f32dc26c5427920c6a2e2f3036238fce44802f2f11ef49ed8621b5d0","pinned_image":"ghcr.io/github/gh-aw-firewall/cli-proxy:0.27.2@sha256:02f3ec08f32dc26c5427920c6a2e2f3036238fce44802f2f11ef49ed8621b5d0"},{"image":"ghcr.io/github/gh-aw-firewall/squid:0.27.2","digest":"sha256:2e3a717e5f19a654cd9a2263beb52012b56bcb68562ec5ae2e42f9d156b49591","pinned_image":"ghcr.io/github/gh-aw-firewall/squid:0.27.2@sha256:2e3a717e5f19a654cd9a2263beb52012b56bcb68562ec5ae2e42f9d156b49591"},{"image":"ghcr.io/github/gh-aw-mcpg:v0.3.25","digest":"sha256:c10331ad17668ef89f38f5e356678788a40b0cd5fef96e8f92e1d9c1de47cbaa","pinned_image":"ghcr.io/github/gh-aw-mcpg:v0.3.25@sha256:c10331ad17668ef89f38f5e356678788a40b0cd5fef96e8f92e1d9c1de47cbaa"},{"image":"ghcr.io/github/github-mcp-server:v1.1.2","digest":"sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c","pinned_image":"ghcr.io/github/github-mcp-server:v1.1.2@sha256:30197479d8036c7811892bc07e06f9a05c9ef3cdd79bc59f256d50647f95788c"}]} # This file was automatically generated by gh-aw. DO NOT EDIT. To debug this workflow, load the skill at https://github.com/github/gh-aw/blob/main/debug.md # From 1f09b06f3f5fe31782f373eafb0c2dd5a2124783 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Jun 2026 00:15:47 +0000 Subject: [PATCH 2/2] add wildcard target validation for create_pull_request_review_comment MCP handler Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- actions/setup/js/safe_outputs_handlers.cjs | 9 ++++ .../setup/js/safe_outputs_handlers.test.cjs | 46 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/actions/setup/js/safe_outputs_handlers.cjs b/actions/setup/js/safe_outputs_handlers.cjs index bafa4f25cb7..c7d02410197 100644 --- a/actions/setup/js/safe_outputs_handlers.cjs +++ b/actions/setup/js/safe_outputs_handlers.cjs @@ -156,6 +156,8 @@ function createHandlers(server, appendSafeOutput, config = {}) { const TOKEN_THRESHOLD = 16000; const addCommentConfig = config.add_comment || config["add-comment"] || {}; const wildcardAddCommentTargetRequiresItemNumber = addCommentConfig.target === "*"; + const reviewCommentConfig = config.create_pull_request_review_comment || config["create-pull-request-review-comment"] || {}; + const wildcardReviewCommentTargetRequiresPRNumber = reviewCommentConfig.target === "*"; /** * Detect and offload large string fields to files. @@ -1615,6 +1617,13 @@ function createHandlers(server, appendSafeOutput, config = {}) { * to provide immediate feedback to the LLM before recording to NDJSON. */ const createPullRequestReviewCommentHandler = args => { + if (wildcardReviewCommentTargetRequiresPRNumber) { + const prNumber = args && args.pull_request_number; + const hasPRNumber = prNumber !== undefined && prNumber !== null && String(prNumber).trim() !== ""; + if (!hasPRNumber) { + return buildIntentErrorResponse("create_pull_request_review_comment requires pull_request_number when safe-outputs.create-pull-request-review-comment.target is '*'. Provide pull_request_number and retry."); + } + } const result = defaultHandler("create_pull_request_review_comment")(args); // Increment only after the default handler returns successfully; if it throws // (e.g. due to large-content rejection or an append write error) the counter diff --git a/actions/setup/js/safe_outputs_handlers.test.cjs b/actions/setup/js/safe_outputs_handlers.test.cjs index b2824000a15..64c3718453d 100644 --- a/actions/setup/js/safe_outputs_handlers.test.cjs +++ b/actions/setup/js/safe_outputs_handlers.test.cjs @@ -2058,6 +2058,52 @@ describe("safe_outputs_handlers", () => { // Counter was NOT incremented, so empty-body submit should still be rejected expect(() => handlers.submitPullRequestReviewHandler({ event: "COMMENT" })).toThrow(expect.objectContaining({ code: -32602, message: expect.stringContaining("review body is empty") })); }); + + it("should require explicit pull_request_number when target is '*'", () => { + const wildcardHandlers = createHandlers(mockServer, mockAppendSafeOutput, { + create_pull_request_review_comment: { + target: "*", + }, + }); + + const result = wildcardHandlers.createPullRequestReviewCommentHandler({ path: "src/foo.js", line: 5, body: "Consider renaming." }); + + expect(result.isError).toBe(true); + const responseData = JSON.parse(result.content[0].text); + expect(responseData.result).toBe("error"); + expect(responseData.error).toContain("pull_request_number"); + expect(mockAppendSafeOutput).not.toHaveBeenCalled(); + }); + + it("should accept a comment when target is '*' and pull_request_number is provided", () => { + const wildcardHandlers = createHandlers(mockServer, mockAppendSafeOutput, { + create_pull_request_review_comment: { + target: "*", + }, + }); + + const result = wildcardHandlers.createPullRequestReviewCommentHandler({ pull_request_number: 42, path: "src/foo.js", line: 5, body: "Consider renaming." }); + + expect(result.isError).toBeUndefined(); + const responseData = JSON.parse(result.content[0].text); + expect(responseData.result).toBe("success"); + expect(mockAppendSafeOutput).toHaveBeenCalledWith(expect.objectContaining({ type: "create_pull_request_review_comment", pull_request_number: 42 })); + }); + + it("should not require pull_request_number when target is not '*'", () => { + const triggeringHandlers = createHandlers(mockServer, mockAppendSafeOutput, { + create_pull_request_review_comment: { + target: "triggering", + }, + }); + + const result = triggeringHandlers.createPullRequestReviewCommentHandler({ path: "src/foo.js", line: 5, body: "Consider renaming." }); + + expect(result.isError).toBeUndefined(); + const responseData = JSON.parse(result.content[0].text); + expect(responseData.result).toBe("success"); + expect(mockAppendSafeOutput).toHaveBeenCalled(); + }); }); describe("updatePullRequestHandler", () => {