Skip to content

Fix call_workflow tool registration in HTTP safe-outputs MCP server#21124

Merged
pelikhan merged 3 commits intomainfrom
copilot/fix-http-safe-outputs-registration
Mar 15, 2026
Merged

Fix call_workflow tool registration in HTTP safe-outputs MCP server#21124
pelikhan merged 3 commits intomainfrom
copilot/fix-http-safe-outputs-registration

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

The HTTP safe-outputs MCP server silently dropped all generated call_workflow tools at registration time. The compiler and safe_outputs_tools_loader.cjs both handle _call_workflow_name correctly, but safe_outputs_mcp_server_http.cjs only had a special-case branch for _workflow_name (dispatch_workflow). Tools like generic_worker fell through to enabledTools.has(tool.name), which always fails because the config key is call_workflow, not the workflow-specific tool name.

Changes

  • safe_outputs_mcp_server_http.cjs: Added isCallWorkflowTool detection and an else if branch gated on safeOutputsConfig.call_workflow, mirroring the existing isDispatchWorkflowTool branch. Updated the fallback skip-log to surface _call_workflow_name metadata.
// Before: only dispatch_workflow was special-cased
if (isDispatchWorkflowTool) {  }
else { if (!enabledTools.has(tool.name)) continue; }  // always skips call_workflow tools

// After: call_workflow gets its own branch
if (isDispatchWorkflowTool) {  }
else if (isCallWorkflowTool) {
  if (!safeOutputsConfig.call_workflow) continue;
  // register tool
}
else { if (!enabledTools.has(tool.name)) continue; }
  • safe_outputs_mcp_server_http_call_workflow.test.cjs: Regression tests at two levels:
    • Logic tests (9): Cover registration predicate cases — config present/absent, multiple tools, falsy config, independence from dispatch_workflow, and tools/list inclusion/exclusion.
    • Integration tests (6): Call createMCPServer directly with real temp config and tools files, asserting against the actual server.tools Map. Scenarios include: single and multiple workers, combined call_workflow + regular tools, call_workflow + dispatch_workflow independence, and end-to-end handler invocation verifying the JSONL output written to disk.

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

Copilot AI and others added 2 commits March 15, 2026 21:40
The HTTP safe-outputs MCP server was not registering generated
call_workflow tools because its predefined-tool registration loop
only handled _workflow_name (dispatch_workflow) but had no parallel
branch for _call_workflow_name (call_workflow).

Add isCallWorkflowTool detection and an else-if branch gated on
safeOutputsConfig.call_workflow, mirroring the existing dispatch_workflow
handling. Also update the fallback skip-log to include _call_workflow_name
metadata for easier diagnostics.

Add regression tests in safe_outputs_mcp_server_http_call_workflow.test.cjs
verifying:
- call_workflow tools register when config.call_workflow exists
- call_workflow tools are skipped when config.call_workflow is absent
- multiple call_workflow tools all register correctly
- falsy config.call_workflow prevents registration
- call_workflow and dispatch_workflow tools register independently
- tools/list includes/excludes call_workflow tools based on config

Fixes #<issue>

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review March 15, 2026 21:57
Copilot AI review requested due to automatic review settings March 15, 2026 21:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression/bug where the HTTP safe-outputs MCP server failed to register dynamically generated call_workflow tools (those identified via _call_workflow_name metadata), causing them to be silently skipped during tool registration.

Changes:

  • Add isCallWorkflowTool detection and a safeOutputsConfig.call_workflow-gated registration path in safe_outputs_mcp_server_http.cjs.
  • Improve the “skipping tool” debug log to include _call_workflow_name metadata when present.
  • Add a regression test suite covering call_workflow registration scenarios and inclusion/exclusion behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
actions/setup/js/safe_outputs_mcp_server_http.cjs Adds explicit call_workflow tool detection/registration logic to prevent generated workflow-specific tools from being dropped.
actions/setup/js/safe_outputs_mcp_server_http_call_workflow.test.cjs Adds regression tests to ensure call_workflow tools are registered only when config.call_workflow is present/truthy and appear in the effective tool list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@pelikhan
Copy link
Contributor

@copilot add tests

…ation

Add 6 integration tests that call createMCPServer directly with real
temp config/tools files (same pattern as safe_outputs_bootstrap.test.cjs)
and verify the actual server.tools Map:

- registers a call_workflow tool when config.call_workflow is present
- does NOT register when config.call_workflow is absent
- registers all tools for multiple configured workers
- registers call_workflow and regular tools together
- registers call_workflow and dispatch_workflow tools independently
- registered tool has a callable handler that writes call_workflow output

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

Copilot AI commented Mar 15, 2026

@copilot add tests

Added 6 integration tests in commit 1878750 that call createMCPServer directly with real temp config/tools files (same pattern as safe_outputs_bootstrap.test.cjs) and verify the actual server.tools Map:

  • registers a call_workflow tool when config.call_workflow is present
  • does not register when config.call_workflow is absent
  • registers all tools for multiple configured workers
  • registers call_workflow and regular tools together
  • registers call_workflow and dispatch_workflow tools independently
  • registered tool has a callable handler that writes call_workflow entries to the output file

All 15 tests pass (9 logic-level + 6 integration).

Copilot AI requested a review from pelikhan March 15, 2026 22:06
@pelikhan pelikhan merged commit daa1909 into main Mar 15, 2026
80 checks passed
@pelikhan pelikhan deleted the copilot/fix-http-safe-outputs-registration branch March 15, 2026 22:28
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.

HTTP safe-outputs server does not register generated call-workflow tools

3 participants