Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

The dispatch_workflow safe-output generates dynamic tools with workflow-specific names (test_workflow for workflow test-workflow), but registerPredefinedTools only registered tools matching config keys. Since test_workflowdispatch_workflow, tools were silently skipped.

Changes

  • actions/setup/js/safe_outputs_tools_loader.cjs: Added check for tools with _workflow_name metadata when dispatch_workflow exists in config
  • actions/setup/js/safe_outputs_tools_loader.test.cjs: Added 5 tests covering dynamic tool registration and handler attachment

Example

Tools with _workflow_name metadata are now registered:

// Tool generated at compile time
{
  "name": "ci_workflow",
  "_workflow_name": "ci",
  "description": "Dispatch the 'ci' workflow..."
}

// Now registered when dispatch_workflow config exists
function registerPredefinedTools(server, tools, config, registerTool, normalizeTool) {
  tools.forEach(tool => {
    if (Object.keys(config).find(configKey => normalizeTool(configKey) === tool.name)) {
      registerTool(server, tool);
      return;
    }
    
    // New: Register dispatch_workflow tools by metadata
    if (tool._workflow_name && config.dispatch_workflow) {
      registerTool(server, tool);
      return;
    }
  });
}
Original prompt

Fix issues with the workflow dispatch capability dispatch_workflow not currently available through the safe-outputs tools.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 31, 2026 08:02
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Modified registerPredefinedTools to detect and register dispatch_workflow tools
- Added check for tools with _workflow_name metadata
- Added comprehensive tests for dispatch_workflow tool registration
- Verified fix with test workflow compilation

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- All JavaScript tests passing (3162 tests)
- All Go tests passing for dispatch_workflow
- Formatting and linting validated
- End-to-end workflow compilation tested

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Added explicit permissions: contents: read
- Fixed CodeQL security alert about missing workflow permissions
- Recompiled test-dispatcher workflow

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues with dispatch_workflow in safe-outputs Fix dispatch_workflow tools registration in safe-outputs MCP server Jan 31, 2026
Copilot AI requested a review from mnkiefer January 31, 2026 08:19
@mnkiefer mnkiefer marked this pull request as ready for review January 31, 2026 08:20
@mnkiefer mnkiefer merged commit 6574360 into main Jan 31, 2026
126 checks passed
@mnkiefer mnkiefer deleted the copilot/fix-workflow-dispatch-capability branch January 31, 2026 08:24
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