fix: retrieve MCP servers and A2A agents from the resource folder [PRODEV-1374] - #1051
Closed
PopescuTudor wants to merge 1 commit into
Closed
fix: retrieve MCP servers and A2A agents from the resource folder [PRODEV-1374]#1051PopescuTudor wants to merge 1 commit into
PopescuTudor wants to merge 1 commit into
Conversation
An agent's MCP/A2A tool retrieved its server with the job's execution folder (UIPATH_FOLDER_PATH, falling back to the ambient UIPATH_FOLDER_KEY in the SDK), ignoring the folderPath recorded on the resource config. AgentHub's server lookup is folder-scoped, so any server living in a different folder than the job 404'd on the first tool call (cached discovery) or at startup (dynamic discovery) — every Agent Builder debug run against a tenant-folder server, since debug runs execute in the personal workspace (PRODEV-1374). Resolve the retrieve folder from the resource's folderPath first, mapping the packager's solution_folder sentinel (and empty values) to None so solution-local resources keep falling back to the execution folder. Binding overwrites still win: the @resource_override decorators replace both name and folder when one matches. Version 0.16.10 -> 0.16.11. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
McpClient._initialize_clientretrieves the MCP server with the folder the job executes in (get_execution_folder_path()→UIPATH_FOLDER_PATH, falling back to the ambientUIPATH_FOLDER_KEYinside the SDK), ignoring thefolderPathrecorded on the resource config.A2aClient.get()does the same for remote A2A agents.AgentHub's server lookup (
GET api/servers/{identifier}, and the A2A equivalent) is folder-scoped, so a server living in a different folder than the job 404s:404 Not FoundonGET …/agenthub_/api/servers/{name}, dynamic discovery (Flow inline agents) dies at startup inlist_tools.Binding overwrites cannot compensate today: the Studio binding-overwrites response carries
process/index/memorySpaceentries but nomcpServer/remoteA2aAgentones (the bindings generator emits those bindings without afolderPathvalue), so the@resource_overridedecorators onretrieve_asyncnever match — those are theNo resource overwrite matched for mcpServer key='mcpServer.<Name>' on retrieve_asynclines in the failing runs' logs.Tracked as PRODEV-1374 (dogfooding, Remote MCP; independently reported for coded MCP servers on staging).
Fix
Resolve the retrieve folder from the resource first:
config.folder_path— where the registration actually lives. An MCP server / remote A2A agent is an external reference with its own folder, unlike a process deployed alongside the agent, so the recorded folder is authoritative;resolve_resource_folder_path()(_utils/_environment.py): the packager'ssolution_foldersentinel and empty values becomeNone, so solution-local resources keep falling back toUIPATH_FOLDER_PATH) — and from there the SDK's ambient folder key, as before.The sentinel guard is the lesson from #1038 / #1047:
solution_foldermust never be sent as a real folder path. Binding overwrites, when present, still win — the@resource_overridedecorators replace both name and folder args after this resolution.A2aClientgains an optionalresource_folder_pathparameter (defaultNonepreserves the previous behavior for direct constructions);create_a2a_tools_and_clientspassesresource.folder_path.Testing
folder_path='/Exec/JobFolder'instead of the resource folder):TestMcpClient::test_retrieve_uses_resource_folder_not_execution_folder, plus sentinel-fallback and sentinel-with-no-env pins (…falls_back_to_execution_folder_for_sentinel,…passes_none_when_sentinel_and_no_execution_folder)test_client_retrieves_agent_from_resource_folderandtest_client_falls_back_to_execution_folder_for_sentinel_resourcefor A2A, going throughcreate_a2a_tools_and_clientsso the resource→client wiring is coveredtest_retrieve_async_uses_name_and_execution_folder_path, which pinned the buggy resolution (and used identical env/resource values, so it could not tell the two sources apart).test_uipath_cli_tool.pyschema-example failures that fail identically on cleanmainin this environment (local CLI version, unrelated).ruff check/ruff format --check/ httpx client linter clean. Module docs (mcp/claude.md,test_mcp/claude.md) updated. Version bumped 0.16.10 → 0.16.11.Follow-ups (separate, noted on PRODEV-1374)
BindingsGeneratorshould emitfolderPathinmcpServer/remoteA2aAgentbindings so Solutions deployments can remap folders and binding overwrites start covering MCP/A2A.context_tool.py/escalation_recipient.py/escalation_tool.pystill do env-only resolution; out of scope here.🤖 Generated with Claude Code