Skip to content

fix: harden managed workspace lifecycle#157

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/managed-workspace-lifecycle
Jul 23, 2026
Merged

fix: harden managed workspace lifecycle#157
radu-mocanu merged 1 commit into
mainfrom
fix/managed-workspace-lifecycle

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • prevent streamed workspace access from leaking to consumers or child tasks
  • make workspace cleanup safe when disposal is concurrent or cancelled
  • preserve resumable workspace behavior across async iterator boundaries

Why

streaming and cancellation can otherwise leave a workspace accessible after execution or race while deleting it.

Copilot AI review requested due to automatic review settings July 23, 2026 13:18
@radu-mocanu
radu-mocanu requested a review from a team as a code owner July 23, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the managed workspace lifecycle in the UiPath Runtime Python SDK to prevent workspace access from leaking across streaming boundaries and to make workspace cleanup safer under concurrency and cancellation.

Changes:

  • Revokes managed workspace availability outside execution scopes (including between streamed events and for child tasks created during execution).
  • Refactors HydrationRuntime.stream() to scope workspace access to each anext() call and to explicitly close the delegate stream.
  • Makes Workspace.dispose() serialized and idempotent for concurrent/cancelled callers; adds regression tests and bumps version to 0.12.7.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Bumps local package version to 0.12.7.
pyproject.toml Bumps project version to 0.12.7.
src/uipath/runtime/workspace/workspace.py Adds serialized, idempotent async disposal with locking/task shielding.
src/uipath/runtime/workspace/hydration.py Re-scopes streaming execution to avoid leaking workspace context to consumers/child tasks.
src/uipath/runtime/workspace/context.py Introduces revocable workspace execution state via ContextVar + shared mutable execution object.
tests/workspace/test_workspace_hydration.py Adds tests for streaming access revocation, child task isolation, and concurrent/cancelled dispose behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/uipath/runtime/workspace/hydration.py Outdated
Comment thread src/uipath/runtime/workspace/workspace.py Outdated
@radu-mocanu
radu-mocanu force-pushed the fix/managed-workspace-lifecycle branch 7 times, most recently from 9b59095 to dd21548 Compare July 23, 2026 16:41
@radu-mocanu
radu-mocanu force-pushed the fix/managed-workspace-lifecycle branch from dd21548 to 92d0795 Compare July 23, 2026 16:58
@sonarqubecloud

Copy link
Copy Markdown

@radu-mocanu
radu-mocanu merged commit 22fa7e9 into main Jul 23, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants