From b784565f467278c5bd813f2d234ee1f271ff9489 Mon Sep 17 00:00:00 2001 From: al3xanndru Date: Fri, 30 Oct 2026 09:48:12 +0000 Subject: [PATCH] PC-5145: include DeepRag failure_reason in the resume fault message --- packages/uipath-platform/pyproject.toml | 2 +- .../platform/resume_triggers/_protocol.py | 8 ++-- .../tests/services/test_hitl.py | 42 +++++++++++++++++++ packages/uipath-platform/uv.lock | 2 +- packages/uipath/uv.lock | 2 +- 5 files changed, 50 insertions(+), 6 deletions(-) diff --git a/packages/uipath-platform/pyproject.toml b/packages/uipath-platform/pyproject.toml index c3e51954e..512c3a940 100644 --- a/packages/uipath-platform/pyproject.toml +++ b/packages/uipath-platform/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-platform" -version = "0.2.41" +version = "0.2.42" description = "HTTP client library for programmatic access to UiPath Platform" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py b/packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py index 2cbc8e7a0..1542b3d8f 100644 --- a/packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py +++ b/packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py @@ -271,10 +271,12 @@ def get_uipath() -> UiPath: return deep_rag if deep_rag_status != DeepRagStatus.SUCCESSFUL: - raise UiPathFaultedTriggerError( - ErrorCategory.USER, - f"DeepRag '{deep_rag.name}' did not finish successfully.", + message = ( + f"DeepRag '{deep_rag.name}' did not finish successfully." ) + if deep_rag.failure_reason: + message += f" Reason: {deep_rag.failure_reason}" + raise UiPathFaultedTriggerError(ErrorCategory.USER, message) trigger_response = deep_rag.content diff --git a/packages/uipath-platform/tests/services/test_hitl.py b/packages/uipath-platform/tests/services/test_hitl.py index 9c3a21fa3..038f2c983 100644 --- a/packages/uipath-platform/tests/services/test_hitl.py +++ b/packages/uipath-platform/tests/services/test_hitl.py @@ -720,6 +720,48 @@ async def test_read_deep_rag_trigger_failed( reader = UiPathResumeTriggerReader() await reader.read_trigger(resume_trigger) assert exc_info.value.category == ErrorCategory.USER + assert exc_info.value.message == ( + "DeepRag 'test-deep-rag' did not finish successfully. " + "Reason: An error ocurred during the deepRAG processing" + ) + + @pytest.mark.anyio + async def test_read_deep_rag_trigger_failed_without_reason( + self, + setup_test_env: None, + ) -> None: + """Test a failed deep rag without a failure reason keeps the plain message.""" + from uipath.platform.context_grounding import DeepRagResponse + + task_id = "test-deep-rag-id" + mock_deep_rag = DeepRagResponse( + id=task_id, + name="test-deep-rag", + created_date="2024-01-01", + last_deep_rag_status=DeepRagStatus.FAILED, + content=None, + ) + mock_retrieve_async = AsyncMock(return_value=mock_deep_rag) + + with patch( + "uipath.platform.context_grounding._context_grounding_service.ContextGroundingService.retrieve_deep_rag_async", + new=mock_retrieve_async, + ): + resume_trigger = UiPathResumeTrigger( + trigger_type=UiPathResumeTriggerType.DEEP_RAG, + item_key=task_id, + folder_key="test-folder", + folder_path="test-path", + ) + + with pytest.raises(UiPathFaultedTriggerError) as exc_info: + reader = UiPathResumeTriggerReader() + await reader.read_trigger(resume_trigger) + assert exc_info.value.category == ErrorCategory.USER + assert ( + exc_info.value.message + == "DeepRag 'test-deep-rag' did not finish successfully." + ) @pytest.mark.anyio async def test_read_deep_rag_trigger_empty_response( diff --git a/packages/uipath-platform/uv.lock b/packages/uipath-platform/uv.lock index 5c59bdb8e..3ef58613d 100644 --- a/packages/uipath-platform/uv.lock +++ b/packages/uipath-platform/uv.lock @@ -1095,7 +1095,7 @@ dev = [ [[package]] name = "uipath-platform" -version = "0.2.41" +version = "0.2.42" source = { editable = "." } dependencies = [ { name = "anyio" }, diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index e6ae1076e..25fa35fa2 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2762,7 +2762,7 @@ wheels = [ [[package]] name = "uipath-platform" -version = "0.2.41" +version = "0.2.42" source = { editable = "../uipath-platform" } dependencies = [ { name = "anyio" },