Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "uipath-runtime"
version = "0.11.4"
version = "0.11.5"
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"
dependencies = [
"uipath-core>=0.5.22,<0.6.0",
"uipath-core>=0.5.23,<0.6.0",
]
classifiers = [
"Intended Audience :: Developers",
Expand Down
7 changes: 4 additions & 3 deletions src/uipath/runtime/debug/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,10 @@ async def _stream_and_debug(
resume_data: dict[str, Any] | None = None
try:
trigger_data: dict[str, Any] | None = None
if (
final_result.trigger.trigger_type
== UiPathResumeTriggerType.API
if final_result.trigger.trigger_type in (
UiPathResumeTriggerType.API,
UiPathResumeTriggerType.INBOX,
UiPathResumeTriggerType.TIMER,
):
trigger_data = (
await self.debug_bridge.wait_for_resume()
Expand Down
11 changes: 8 additions & 3 deletions src/uipath/runtime/resumable/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ async def stream(
async def _get_fired_triggers(self) -> dict[str, Any] | None:
"""Check stored triggers for any that have already fired.

Skips async-external triggers (API, Inbox) whose payloads only arrive
asynchronously and cannot be polled at suspend time.
Skips external triggers (API, Inbox, Timer) whose payloads only arrive
asynchronously or through Orchestrator resume and cannot be polled at
suspend time.
Comment thread
radu-mocanu marked this conversation as resolved.

Returns:
A resume map of {interrupt_id: resume_data} for fired triggers, or None.
Expand All @@ -161,7 +162,11 @@ async def _get_fired_triggers(self) -> dict[str, Any] | None:
t
for t in triggers
if t.trigger_type
not in (UiPathResumeTriggerType.API, UiPathResumeTriggerType.INBOX)
not in (
UiPathResumeTriggerType.API,
UiPathResumeTriggerType.INBOX,
UiPathResumeTriggerType.TIMER,
)
Comment thread
radu-mocanu marked this conversation as resolved.
]
return await self._build_resume_map(pollable_triggers)

Expand Down
41 changes: 41 additions & 0 deletions tests/test_resumable.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,47 @@ def create_inbox_trigger(data: dict[str, Any]) -> UiPathResumeTrigger:
trigger_manager.read_trigger.assert_not_called()
assert runtime_impl.execution_count == 1

@pytest.mark.asyncio
async def test_resumable_skips_timer_triggers_on_auto_resume_check(self) -> None:
"""Timer triggers should be skipped when checking for auto-resume."""

runtime_impl = MultiTriggerMockRuntime()
storage = StatefulStorageMock()
trigger_manager = make_trigger_manager_mock()

def create_timer_trigger(data: dict[str, Any]) -> UiPathResumeTrigger:
return UiPathResumeTrigger(
interrupt_id="", # Will be set by resumable runtime
trigger_type=UiPathResumeTriggerType.TIMER,
payload=data,
)

trigger_manager.create_trigger = AsyncMock(side_effect=create_timer_trigger) # type: ignore[method-assign]
read_trigger_guard = AsyncMock(
side_effect=AssertionError(
"read_trigger must not be called for Timer triggers pre-resume"
)
)
trigger_manager.read_trigger = read_trigger_guard # type: ignore[method-assign]

resumable = UiPathResumableRuntime(
delegate=runtime_impl,
storage=storage,
trigger_manager=trigger_manager,
runtime_id="runtime-1",
)

result = await resumable.execute({})

assert result.status == UiPathRuntimeStatus.SUSPENDED
assert result.triggers is not None
assert len(result.triggers) == 2
assert all(
t.trigger_type == UiPathResumeTriggerType.TIMER for t in result.triggers
)
trigger_manager.read_trigger.assert_not_called()
assert runtime_impl.execution_count == 1

@pytest.mark.asyncio
async def test_resumable_auto_resumes_task_triggers_but_not_api_triggers(
self,
Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading