From 9e7189b855d02292a4c915bf066e823dad4367d0 Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Tue, 30 Dec 2025 12:59:08 +0200 Subject: [PATCH] fix: always choose first interrupt for debug resume --- pyproject.toml | 2 +- src/uipath/runtime/resumable/runtime.py | 4 ++-- tests/test_resumable.py | 9 +++++---- uv.lock | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c5cc7e2..e1c5c7d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-runtime" -version = "0.3.2" +version = "0.3.3" description = "Runtime abstractions and interfaces for building agents and automation scripts in the UiPath ecosystem" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/runtime/resumable/runtime.py b/src/uipath/runtime/resumable/runtime.py index d94e7e2..ccac3b6 100644 --- a/src/uipath/runtime/resumable/runtime.py +++ b/src/uipath/runtime/resumable/runtime.py @@ -189,8 +189,8 @@ async def _handle_suspension( current_interrupts = result.output or {} # Diff: find new interrupts - existing_ids = {t.interrupt_id for t in suspended_result.triggers} - new_ids = current_interrupts.keys() - existing_ids + existing_ids = [t.interrupt_id for t in suspended_result.triggers] + new_ids = [key for key in current_interrupts.keys() if key not in existing_ids] # Create triggers only for new interrupts for interrupt_id in new_ids: diff --git a/tests/test_resumable.py b/tests/test_resumable.py index 2233a17..ab3398d 100644 --- a/tests/test_resumable.py +++ b/tests/test_resumable.py @@ -160,10 +160,11 @@ async def test_resumable_creates_multiple_triggers_on_first_suspension(): assert len(result.triggers) == 2 assert {t.interrupt_id for t in result.triggers} == {"int-1", "int-2"} - # Check payloads by interrupt_id (order not guaranteed) - payloads_by_id = {t.interrupt_id: t.payload for t in result.triggers} - assert payloads_by_id["int-1"] == {"action": "approve_branch_1"} - assert payloads_by_id["int-2"] == {"action": "approve_branch_2"} + # Check payloads by interrupt_id (order should be preserved) + assert result.triggers[0].interrupt_id == "int-1" + assert result.triggers[0].payload == {"action": "approve_branch_1"} + assert result.triggers[1].interrupt_id == "int-2" + assert result.triggers[1].payload == {"action": "approve_branch_2"} # Both triggers should be created and saved assert cast(AsyncMock, trigger_manager.create_trigger).await_count == 2 diff --git a/uv.lock b/uv.lock index 1a20a4d..1aa8699 100644 --- a/uv.lock +++ b/uv.lock @@ -1005,7 +1005,7 @@ wheels = [ [[package]] name = "uipath-runtime" -version = "0.3.2" +version = "0.3.3" source = { editable = "." } dependencies = [ { name = "uipath-core" },