Skip to content

fix(mcp): tolerate workflows without aliases - #2097

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:developfrom
WilliamK112:codex/nat-mcp-langgraph-wrapper-alias
Jul 8, 2026
Merged

fix(mcp): tolerate workflows without aliases#2097
rapids-bot[bot] merged 1 commit into
NVIDIA:developfrom
WilliamK112:codex/nat-mcp-langgraph-wrapper-alias

Conversation

@WilliamK112

@WilliamK112 WilliamK112 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

The MCP frontend now handles workflow configs that do not define workflow_alias by falling back to the workflow type. This keeps agent workflows that do define an alias unchanged while allowing FunctionBaseConfig-backed workflows such as langgraph_wrapper to be exposed as MCP tools instead of crashing during route registration.

Adds a regression test covering a workflow config object with only type=langgraph_wrapper.

Closes #1991

Testing

  • PYTHONUTF8=1 UV_PROJECT_ENVIRONMENT=<repo>\packages\nvidia_nat_mcp\.venv uv run --project packages/nvidia_nat_mcp --all-groups --all-extras -- pytest -q packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py (8 passed)
  • uvx ruff==0.15.0 check packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py
  • uvx yapf==0.43.0 --diff packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py
  • git diff --check

Note: python ci/scripts/run_tests.py --project nvidia_nat_mcp --exitfirst -- packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py synced successfully with PYTHONUTF8=1, but the helper appends the full package path after the requested file and therefore also ran unrelated package tests; it stopped at an existing OAuth TTL test failure in test_mcp_auth_provider.py. The targeted MCP frontend test above passed.

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors sign-off on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes

    • Workflows now reliably appear under their alias when one is configured, and fall back to their type name when no alias is available.
    • Improved handling of workflow registration to avoid missing entries in the available functions list.
  • Tests

    • Added coverage for the fallback behavior when a workflow alias is absent.

Signed-off-by: Ching Wei Kang <WilliamK112@users.noreply.github.com>
@WilliamK112
WilliamK112 requested a review from a team as a code owner June 30, 2026 22:07
@copy-pr-bot

copy-pr-bot Bot commented Jun 30, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f2eece4f-b63a-457f-b200-f5c2ceb67645

📥 Commits

Reviewing files that changed from the base of the PR and between 201f3dc and 9f0a047.

📒 Files selected for processing (2)
  • packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py
  • packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py

Walkthrough

Updated _get_all_functions in the MCP front-end plugin worker to use getattr for safely retrieving workflow_alias from the workflow config, falling back to workflow_config.type when the attribute is absent, fixing a crash for configs like langgraph_wrapper that lack this attribute. Added a corresponding unit test.

Changes

Workflow Alias Fallback Fix

Layer / File(s) Summary
Safe workflow_alias lookup with fallback test
packages/nvidia_nat_mcp/src/nat/plugins/mcp/server/front_end_plugin_worker.py, packages/nvidia_nat_mcp/tests/server/test_mcp_front_end_plugin.py
_get_all_functions now uses getattr(workflow_config, "workflow_alias", None) to register workflows by alias or fall back to workflow_config.type, preventing an AttributeError for configs without workflow_alias; a new test verifies the fallback registers by type.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly describes the workflow-alias fallback fix.
Linked Issues check ✅ Passed The code and test address #1991 by falling back to workflow type when workflow_alias is missing.
Out of Scope Changes check ✅ Passed The changes stay narrowly focused on MCP route registration fallback and a regression test.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@WilliamK112

WilliamK112 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Label Checker is currently failing because external contributors cannot add repo labels. This PR should be labeled bug and non-breaking.

@willkill07 willkill07 added bug Something isn't working non-breaking Non-breaking change labels Jul 8, 2026
@willkill07

Copy link
Copy Markdown
Member

/ok to test 9f0a047

@willkill07

Copy link
Copy Markdown
Member

/merge

@rapids-bot
rapids-bot Bot merged commit c24d351 into NVIDIA:develop Jul 8, 2026
20 of 21 checks passed
rapids-bot Bot pushed a commit that referenced this pull request Jul 10, 2026
## Summary
- avoid reading `workflow_alias` directly on FastMCP function-style workflow configs
- fall back to the workflow type when a FastMCP workflow config does not define an alias
- add a regression for `langgraph_wrapper`-style configs without `workflow_alias`

Complements #2097 by covering the FastMCP worker side of #1991.

## Testing
- `python3 -m py_compile packages/nvidia_nat_fastmcp/src/nat/plugins/fastmcp/server/front_end_plugin_worker.py packages/nvidia_nat_fastmcp/tests/test_fastmcp.py`
- `git diff --check upstream/develop...HEAD`

Authors:
  - Kiwi (https://github.com/kiwigitops)

Approvers:
  - Will Killian (https://github.com/willkill07)

URL: #1993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nat start mcp crashes when the workflow type is langgraph_wrapper

2 participants