Skip to content

fix: folder path error handling#183

Merged
radugheo merged 1 commit intomainfrom
fix/folder-path-error-handling
Mar 10, 2026
Merged

fix: folder path error handling#183
radugheo merged 1 commit intomainfrom
fix/folder-path-error-handling

Conversation

@radugheo
Copy link
Collaborator

@radugheo radugheo commented Mar 9, 2026

Fixes misleading error message when UIPATH_FOLDER_PATH points to a non-existent folder

Previously, when the folder path was set but invalid, the error incorrectly told users to "set the UIPATH_FOLDER_PATH environment variable", even though it was already set. Now the error includes the actual folder path and tells users to verify it's valid.

Also adds unit tests for both folder path error handling paths (missing vs not found).

image

Copilot AI review requested due to automatic review settings March 9, 2026 13:35
Copy link

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

Improves UIPATH_FOLDER_PATH validation feedback in the MCP runtime by making the “folder not found” error actionable (includes the provided path), and adds unit tests for the missing-vs-not-found paths.

Changes:

  • Update runtime error detail when UIPATH_FOLDER_PATH is set but resolves to no folder key.
  • Add async pytest coverage for both “missing env var” and “folder not found” cases.
  • Add pytest-asyncio dev dependency and bump package version to 0.1.3.

Reviewed changes

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

File Description
src/uipath_mcp/_cli/_runtime/_runtime.py Updates the user-facing error detail for invalid UIPATH_FOLDER_PATH.
tests/cli/test_runtime.py Adds async unit tests covering missing vs invalid folder path behavior.
pyproject.toml Adds pytest-asyncio to dev deps; bumps version.
uv.lock Locks pytest-asyncio and reflects version/dependency updates.

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

Comment on lines +10 to +19
@pytest.fixture
def runtime():
with patch("uipath_mcp._cli._runtime._runtime.UiPath"):
rt = UiPathMcpRuntime(
server=MagicMock(),
runtime_id="test-runtime-id",
entrypoint="test-entrypoint",
)
rt._uipath = MagicMock()
return rt
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

In these tests, runtime._run_server() will always execute the finally: await self._cleanup() path. _cleanup() calls _on_runtime_abort(), which does await self._uipath.api_client.request_async(...). Since the fixture sets rt._uipath = MagicMock(), request_async will be a plain MagicMock (not awaitable) and can raise a TypeError, masking the intended UiPathMcpRuntimeError and making the tests flaky/failing. Consider either stubbing runtime._cleanup / _on_runtime_abort in the tests, or setting runtime._uipath.api_client.request_async to an AsyncMock returning a response object with status_code/text.

Copilot uses AI. Check for mistakes.
@radugheo radugheo force-pushed the fix/folder-path-error-handling branch from 44ca535 to 507935e Compare March 9, 2026 13:42
@radugheo radugheo force-pushed the fix/folder-path-error-handling branch from 507935e to c6c5533 Compare March 10, 2026 09:17
@radugheo radugheo merged commit 775726b into main Mar 10, 2026
21 checks passed
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.

3 participants