Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

Fix dispatch_workflow inputs structure ✅

Problem: When dispatch_workflow tools are called via MCP, the workflow inputs were being spread at the top level instead of being wrapped in an "inputs" property, causing the handler to not recognize them.

Root Cause: The handler creation code in safe_outputs_tools_loader.cjs was spreading tool arguments (...args) directly alongside workflow_name, instead of wrapping them in an inputs object.

Before (Incorrect):

{"test_param":"value","workflow_name":"test-workflow","type":"dispatch_workflow"}

After (Correct):

{"inputs":{"test_param":"value"},"workflow_name":"test-workflow","type":"dispatch_workflow"}

Plan:

  • Understand the issue in safe_outputs_tools_loader.cjs
  • Fix the handler creation in attachHandlers function to wrap args in inputs
  • Update tests in safe_outputs_tools_loader.test.cjs to verify the fix
  • Run tests to validate the changes (3270 JavaScript tests + all Go unit tests pass)
  • Format and lint JavaScript code
  • Run code review (no issues found)
  • Run security check (no issues found)
  • Add tests for workflows with no inputs (empty object and undefined cases)

Files Changed:

  • actions/setup/js/safe_outputs_tools_loader.cjs - Fixed handler to wrap args in inputs
  • actions/setup/js/safe_outputs_tools_loader.test.cjs - Added tests for empty object and undefined args
  • actions/setup/js/dispatch_workflow.test.cjs - Added test for missing inputs property

Workflows with No Inputs: The fix properly handles workflows that have no input parameters:

  • When called with {} (empty object) → produces { inputs: {}, workflow_name: "..." }
  • When called with undefined → produces { workflow_name: "..." } (no inputs property)
  • The dispatch_workflow handler handles both cases correctly by defaulting to an empty object

Security Summary: No security issues found or introduced by this change.

Original prompt

Fix the way inputs are passed on for dispatch_workflow:
Currently it passes:
{"test_param":"What is the current timestamp and how many workflow runs have executed today?","workflow_name":"test-workflow","type":"dispatch_workflow"}
Here "test_param" is not recognized as "inputs": "test_param" and hence it fails.
See safe outputs step
https://github.com/githubnext/gh-aw/actions/runs/21586459555


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

When dispatch_workflow tools are called via MCP, the workflow inputs
were being spread at the top level instead of being wrapped in an
"inputs" property. This caused the handler to not recognize them.

Changed the handler creation in attachHandlers() to properly wrap
the tool arguments in an "inputs" property when creating the
dispatch_workflow message.

Updated tests to verify the inputs are properly wrapped.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix input parameters for dispatch_workflow Fix dispatch_workflow MCP handler to wrap inputs per schema Feb 2, 2026
Copilot AI requested a review from mnkiefer February 2, 2026 10:50
@mnkiefer mnkiefer marked this pull request as ready for review February 2, 2026 10:51
@mnkiefer
Copy link
Contributor

mnkiefer commented Feb 2, 2026

@copilot What about the case where there are no inputs required by a workflow?

Added comprehensive test coverage for workflows that have no input
parameters:

1. dispatch_workflow.test.cjs - Test handler with missing inputs property
2. safe_outputs_tools_loader.test.cjs - Test handler with empty object and undefined args

All cases are properly handled:
- Empty object {} → inputs: {} is passed
- undefined/missing → no inputs property (handler defaults to empty object)

The dispatch_workflow handler already handles both cases correctly by
initializing inputs as an empty object and only processing item.inputs
if it exists.

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 2, 2026

@copilot What about the case where there are no inputs required by a workflow?

Good catch! The fix handles workflows with no inputs correctly:

  • MCP tools called with {}{ inputs: {}, workflow_name: "..." }
  • MCP tools called with undefined{ workflow_name: "..." } (no inputs property)

The dispatch_workflow handler already handles both cases by initializing inputs to an empty object and only processing item.inputs if it exists. Added comprehensive tests in commit 3b7a1e0 to verify both scenarios work correctly.

Copilot AI requested a review from mnkiefer February 2, 2026 11:00
@mnkiefer mnkiefer merged commit bb15d92 into main Feb 2, 2026
84 checks passed
@mnkiefer mnkiefer deleted the copilot/fix-dispatch-workflow-inputs branch February 2, 2026 11:03
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.

2 participants