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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-runtime"
version = "0.13.1"
version = "0.13.2"
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"
Expand Down
14 changes: 10 additions & 4 deletions src/uipath/runtime/debug/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

logger = logging.getLogger(__name__)

INITIAL_RESUME_TIMEOUT_SECONDS = 60.0


class UiPathDebugRuntime:
"""Specialized runtime for debug runs that streams events to a debug bridge."""
Expand Down Expand Up @@ -121,13 +123,17 @@ async def _stream_and_debug(

# Starting in paused state - wait for breakpoints and resume
try:
await asyncio.wait_for(self.debug_bridge.wait_for_resume(), timeout=60.0)
await asyncio.wait_for(
self.debug_bridge.wait_for_resume(),
timeout=INITIAL_RESUME_TIMEOUT_SECONDS,
)
except asyncio.TimeoutError:
# Debug bridge likely disconnected: proceed unattended
# instead of failing the job.
logger.warning(
"Initial resume wait timed out after 60s, assuming debug bridge disconnected"
f"Initial resume wait timed out after {INITIAL_RESUME_TIMEOUT_SECONDS:g}s, "
"assuming debug bridge disconnected; continuing execution without debug commands"
)
Comment thread
andreitava-uip marked this conversation as resolved.
yield UiPathRuntimeResult(status=UiPathRuntimeStatus.FAULTED)
return
except UiPathDebugQuitError:
logger.info("Debug session quit by user before execution started")
yield UiPathRuntimeResult(status=UiPathRuntimeStatus.SUCCESSFUL)
Expand Down
25 changes: 25 additions & 0 deletions tests/test_debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import asyncio
from typing import Any, AsyncGenerator, Sequence, cast
from unittest.mock import AsyncMock, Mock

Expand Down Expand Up @@ -212,6 +213,30 @@ async def test_debug_runtime_streams_and_handles_breakpoints_and_state():
) # initial + after breakpoint


@pytest.mark.asyncio
async def test_debug_runtime_continues_when_initial_resume_wait_times_out():
"""If no resume command arrives before the initial wait times out,
execution should continue unattended instead of faulting."""

runtime_impl = StreamingMockRuntime(node_sequence=["node-1", "node-2"])
bridge = make_debug_bridge_mock()

# Initial resume wait times out (debug bridge disconnected)
cast(AsyncMock, bridge.wait_for_resume).side_effect = asyncio.TimeoutError()
cast(Mock, bridge.get_breakpoints).return_value = []

debug_runtime = UiPathDebugRuntime(
delegate=runtime_impl,
debug_bridge=bridge,
)

result = await debug_runtime.execute({})

assert result.status == UiPathRuntimeStatus.SUCCESSFUL
assert result.output == {"visited_nodes": ["node-1", "node-2"]}
cast(AsyncMock, bridge.emit_execution_completed).assert_awaited_once_with(result)


@pytest.mark.asyncio
async def test_debug_runtime_waits_for_timer_resume_without_polling():
"""Timer triggers should wait for external resume in debug mode."""
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

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

Loading