fix: process tool folder fallback when UIPATH_FOLDER_PATH is unset - #1038
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for resolving an execution folder key from the environment (for contexts that don’t provide a folder path) and wires it through process invocation + tool metadata.
Changes:
- Resolve folder context via
UIPATH_FOLDER_PATH→ resourcefolder_path→UIPATH_FOLDER_KEY. - Pass
folder_keyintoprocesses.invoke_asyncand expose it in tool metadata. - Add tests covering folder path/key resolution and invocation arguments.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/agent/tools/test_process_tool.py | Adds coverage for folder path/key resolution and validates invoke_async receives expected folder context. |
| src/uipath_langchain/agent/tools/process_tool.py | Implements folder context resolution and forwards folder_key to invoke_async; includes in metadata. |
| src/uipath_langchain/_utils/_environment.py | Introduces get_execution_folder_key() reading UIPATH_FOLDER_KEY. |
| src/uipath_langchain/_utils/init.py | Re-exports get_execution_folder_key via package init and __all__. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+58
to
+59
| folder_path = get_execution_folder_path() or resource.properties.folder_path | ||
| folder_key = get_execution_folder_key() if not folder_path else None |
Comment on lines
86
to
92
| job = await client.processes.invoke_async( | ||
| name=process_name, | ||
| input_arguments=input_arguments, | ||
| folder_key=folder_key, | ||
| folder_path=folder_path, | ||
| attachments=attachments, | ||
| parent_span_id=parent_span_id, |
| # without a folder header StartJobs returns 404 for a deployed process. | ||
| # invoke_async accepts only one of folder_path/folder_key, so resolve one. | ||
| folder_path = get_execution_folder_path() or resource.properties.folder_path | ||
| folder_key = get_execution_folder_key() if not folder_path else None |
ajay-kesavan
approved these changes
Aug 14, 2026
Eval serverless jobs expose UIPATH_FOLDER_KEY but not UIPATH_FOLDER_PATH, so process tools invoked StartJobs with no folder header and Orchestrator returned 404 (code 1002) for processes that are deployed. Resolve the folder as: UIPATH_FOLDER_PATH env, then the resource's folderPath, then UIPATH_FOLDER_KEY env (invoke_async accepts only one of path/key). Expose the resolved folder_key in tool span metadata for observability. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mjnovice
force-pushed
the
fix/process-tool-folder-key-fallback
branch
from
August 14, 2026 23:29
133a616 to
3d984fb
Compare
mjnovice
enabled auto-merge (squash)
August 14, 2026 23:34
mjnovice
disabled auto-merge
August 14, 2026 23:34
|
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
Agent evaluations that invoke an RPA/process tool fail with:
even though the process is deployed. On staging this is ~900 exceptions/3 days across 6 tenants, 100% correlated with eval runs on the serverless LangGraph path; the same tools succeed in normal agent runs.
Root cause
create_process_toolresolves the tool's folder exclusively from theUIPATH_FOLDER_PATHenv var. Eval serverless job environments exposeUIPATH_FOLDER_KEYbut notUIPATH_FOLDER_PATH(job log:ConfigurationManager(... folder_key='ecbc94dd-...', folder_path=None)), soprocesses.invoke_asyncwas called withfolder_path=Noneand nofolder_key.header_folder(None, None)returns{}, StartJobs goes out with no folder header, and Orchestrator returns 404 (error 1002) — surfaced as the misleading "process not deployed" message.Fix
Resolve the folder with a three-step fallback, passing exactly one of path/key to
invoke_async(header_folderrejects both):UIPATH_FOLDER_PATHenv (current behavior, unchanged)folderPath(previously ignored)UIPATH_FOLDER_KEYenv — fixes the eval serverless scenarioAlso exposes the resolved
folder_keyin tool span metadata so this failure mode is visible in telemetry (thefolder_path: nullspans were the main diagnostic clue).Covers process, agent, flow, and function tools (all built via
create_process_tool).Telemetry (staging App Insights)
Failure volume by tool (~916 hits / 3 days, 100% eval runs):
The smoking gun — failing process-tool spans carry
folder_path: nulland correlate with StartJobs 404s (no folder header sent):Failing ops show
uipath.reference_hierarchy = [agent, langgraph](serverless eval path); succeeding runs of the same tools show[agent](direct path) with StartJobs 201. Verification after rollout: the first query should trend to zero for eval-sourced operations, and process-tool spans should show a populatedfolder_key.Testing
TestProcessToolFolderResolutionsuite: resource-path fallback, folder-key fallback, path-over-key precedence, metadata exposureFollow-up (not in this PR)
context_tool.py,escalation_recipient.py, andescalation_tool.pyshare the same env-path-only resolution and likely need the same fallback.🤖 Generated with Claude Code