From a43b0aee4143c0412182c11154d6eff6f65bd347 Mon Sep 17 00:00:00 2001 From: Caleb Martin Date: Tue, 10 Feb 2026 15:02:09 -0800 Subject: [PATCH 1/4] fix: attachment batch transform --- src/uipath/platform/resume_triggers/_protocol.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/uipath/platform/resume_triggers/_protocol.py b/src/uipath/platform/resume_triggers/_protocol.py index c8b85ffa4..1320dd93e 100644 --- a/src/uipath/platform/resume_triggers/_protocol.py +++ b/src/uipath/platform/resume_triggers/_protocol.py @@ -1,7 +1,6 @@ """Implementation of UiPath resume trigger protocols.""" import json -import os import uuid from typing import Any @@ -301,7 +300,20 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None: f"{e.message}", ) from e - return f"Batch transform completed. Modified file available at {os.path.abspath(destination_path)}" + # Upload result as job attachment + result_attachment_id = await uipath.attachments.upload_async( + name=destination_path, + source_path=destination_path, + ) + + mime_type = "text/csv" + + # Return attachment info + return { + "ID": str(result_attachment_id), + "FullName": destination_path, + "MimeType": mime_type, + } case UiPathResumeTriggerType.IXP_EXTRACTION: if trigger.item_key: From c17bb025acc7b69ba361e7d6c38b47d7d823cf0a Mon Sep 17 00:00:00 2001 From: Caleb Martin Date: Wed, 11 Feb 2026 12:41:20 -0800 Subject: [PATCH 2/4] fix: tests --- tests/cli/test_hitl.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/cli/test_hitl.py b/tests/cli/test_hitl.py index 6606fa722..7a0f86bdc 100644 --- a/tests/cli/test_hitl.py +++ b/tests/cli/test_hitl.py @@ -520,15 +520,19 @@ async def test_read_batch_rag_trigger_successful( setup_test_env: None, ) -> None: """Test reading a successful batch rag trigger.""" - import os - task_id = "test-batch-rag-id" destination_path = "test/output.xlsx" + attachment_id = "test-attachment-id" + mock_download_async = AsyncMock(return_value=None) + mock_upload_async = AsyncMock(return_value=attachment_id) with patch( "uipath.platform.context_grounding._context_grounding_service.ContextGroundingService.download_batch_transform_result_async", new=mock_download_async, + ), patch( + "uipath.platform.orchestrator._attachments_service.AttachmentsService.upload_async", + new=mock_upload_async, ): resume_trigger = UiPathResumeTrigger( trigger_type=UiPathResumeTriggerType.BATCH_RAG, @@ -542,16 +546,23 @@ async def test_read_batch_rag_trigger_successful( ) reader = UiPathResumeTriggerReader() result = await reader.read_trigger(resume_trigger) - assert ( - result - == f"Batch transform completed. Modified file available at {os.path.abspath(destination_path)}" - ) + + # Verify the result is a dictionary with attachment information + assert isinstance(result, dict) + assert result["ID"] == attachment_id + assert result["FullName"] == destination_path + assert result["MimeType"] == "text/csv" + mock_download_async.assert_called_once_with( task_id, destination_path, validate_status=True, index_name="test-index", ) + mock_upload_async.assert_called_once_with( + name=destination_path, + source_path=destination_path, + ) @pytest.mark.anyio async def test_read_batch_rag_trigger_pending( From a7e249e5fd96bdb71e8d81143dcbc65617bdffc5 Mon Sep 17 00:00:00 2001 From: Caleb Martin Date: Wed, 11 Feb 2026 12:42:35 -0800 Subject: [PATCH 3/4] fix: lint --- tests/cli/test_hitl.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/cli/test_hitl.py b/tests/cli/test_hitl.py index 7a0f86bdc..ecca83e3f 100644 --- a/tests/cli/test_hitl.py +++ b/tests/cli/test_hitl.py @@ -527,12 +527,15 @@ async def test_read_batch_rag_trigger_successful( mock_download_async = AsyncMock(return_value=None) mock_upload_async = AsyncMock(return_value=attachment_id) - with patch( - "uipath.platform.context_grounding._context_grounding_service.ContextGroundingService.download_batch_transform_result_async", - new=mock_download_async, - ), patch( - "uipath.platform.orchestrator._attachments_service.AttachmentsService.upload_async", - new=mock_upload_async, + with ( + patch( + "uipath.platform.context_grounding._context_grounding_service.ContextGroundingService.download_batch_transform_result_async", + new=mock_download_async, + ), + patch( + "uipath.platform.orchestrator._attachments_service.AttachmentsService.upload_async", + new=mock_upload_async, + ), ): resume_trigger = UiPathResumeTrigger( trigger_type=UiPathResumeTriggerType.BATCH_RAG, From 78845e62e918a66af6fa50fefcaca1c4be175c67 Mon Sep 17 00:00:00 2001 From: Caleb Martin Date: Thu, 12 Feb 2026 16:21:29 -0800 Subject: [PATCH 4/4] fix: attachment --- src/uipath/platform/resume_triggers/_protocol.py | 5 +++-- tests/cli/test_hitl.py | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/uipath/platform/resume_triggers/_protocol.py b/src/uipath/platform/resume_triggers/_protocol.py index 1320dd93e..530a7eb0e 100644 --- a/src/uipath/platform/resume_triggers/_protocol.py +++ b/src/uipath/platform/resume_triggers/_protocol.py @@ -300,10 +300,11 @@ async def read_trigger(self, trigger: UiPathResumeTrigger) -> Any | None: f"{e.message}", ) from e - # Upload result as job attachment - result_attachment_id = await uipath.attachments.upload_async( + # Upload result as job attachment (automatically links to job if available) + result_attachment_id = await uipath.jobs.create_attachment_async( name=destination_path, source_path=destination_path, + job_key=UiPathConfig.job_key, ) mime_type = "text/csv" diff --git a/tests/cli/test_hitl.py b/tests/cli/test_hitl.py index ecca83e3f..aa144098a 100644 --- a/tests/cli/test_hitl.py +++ b/tests/cli/test_hitl.py @@ -525,7 +525,7 @@ async def test_read_batch_rag_trigger_successful( attachment_id = "test-attachment-id" mock_download_async = AsyncMock(return_value=None) - mock_upload_async = AsyncMock(return_value=attachment_id) + mock_create_attachment_async = AsyncMock(return_value=attachment_id) with ( patch( @@ -533,8 +533,8 @@ async def test_read_batch_rag_trigger_successful( new=mock_download_async, ), patch( - "uipath.platform.orchestrator._attachments_service.AttachmentsService.upload_async", - new=mock_upload_async, + "uipath.platform.orchestrator._jobs_service.JobsService.create_attachment_async", + new=mock_create_attachment_async, ), ): resume_trigger = UiPathResumeTrigger( @@ -562,9 +562,10 @@ async def test_read_batch_rag_trigger_successful( validate_status=True, index_name="test-index", ) - mock_upload_async.assert_called_once_with( + mock_create_attachment_async.assert_called_once_with( name=destination_path, source_path=destination_path, + job_key=None, ) @pytest.mark.anyio