Skip to content

feat(cli): keep coded agents' workspace files across suspend and resume [PC-5359] - #1976

Open
tudormatei1 wants to merge 4 commits into
mainfrom
feat/PC-5359-coded-workspace-persistence
Open

tudormatei1 wants to merge 4 commits into
mainfrom
feat/PC-5359-coded-workspace-persistence

Conversation

@tudormatei1

@tudormatei1 tudormatei1 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Coded agents now keep the files they write to disk when their job suspends and resumes. A runtime factory opts in with UiPathRuntimeFactorySettings.managed_workspace. uipath run, uipath debug and each eval item then run in a workspace folder that is uploaded as job attachments on suspend and restored on resume. uipath-langchain opts in with UiPath/uipath-langchain-python#1194.

Warning

Needs uipath-runtime 0.13.8 (UiPath/uipath-runtime-python#175). The pin already says uipath-runtime>=0.13.8, <0.14.0, but uv.lock is still main's, because 0.13.8 isn't on PyPI yet. CI fails until it's released. Before merge, relock.

Changes

  • wrap_with_managed_workspace (_utils/_managed_workspace.py) wraps only when the factory opts in, the run is a job (UIPATH_JOB_KEY), and the factory has storage. Outside a job there may be no credentials for the attachments client, and the CLI already gates other job-only behavior on the job key. Local --resume runs therefore don't get their files back.
  • A conversational run also uploads after a successful exchange, because the platform resumes the same job for the next exchange. Other runs upload on suspend only, since nothing reads the files after a successful job.
  • cli_run.py, cli_debug.py and eval/runtime/runtime.py make one call each: outside governance, inside the chat and debug wrappers. Governance's dispose doesn't reach the runtime it wraps, so wrapping inside it would leave the temp folder behind.
  • The eval runtime reads the factory settings once in __aenter__ instead of once per item.
  • Version 2.15.16, with uipath-runtime>=0.13.8, in a separate chore(uipath) commit.

Testing

  • New tests drive the real run and debug commands and the eval runtime, with fakes only for the attachments and jobs APIs and the storage. They cover: files come back after resume, uploads link to the job, the folder key reaches every attachments call, nothing is wrapped outside a job or without the opt-in, conversational exchanges keep files, and each eval item gets its own workspace.
  • Live on alpha with the four PR branches installed together: a coded LangGraph job writes a file, suspends, and uipath run --resume in a new process reads it back from job attachments. Without UIPATH_JOB_KEY, nothing comes back.
  • Not run: this package's own venv, which can't import ManagedWorkspace until runtime 0.13.8 ships. The tests ran in a venv with the local runtime.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The unconditional import requires runtime 0.13.7, but pyproject.toml still permits 0.13.5 and uv.lock selects it, so locked installations cannot import the run/debug/eval commands even when managed workspaces are disabled. Raise the runtime minimum to 0.13.7 and regenerate the lockfile.

2 open issues
What changed in this PR

Adds opt-in workspace persistence to the UiPath SDK so coded-agent jobs can retain files across suspension and resumption.

Changes:

  • Integrates managed workspaces into run, debug, and evaluation execution.
  • Adds upload, opt-in, conversation, and evaluation-isolation tests.
  • Bumps the package version to 2.15.1.
File Description
packages/​uipath/​uv.lock Updates the SDK version.
packages/​uipath/​tests/​cli/​utils/​workspace_fakes.py Adds workspace test doubles.
packages/​uipath/​tests/​cli/​test_managed_workspace.py Tests uploads, folder routing, and opt-in conditions.
packages/​uipath/​tests/​cli/​test_managed_workspace_commands.py Tests run/debug workspace integration.
packages/​uipath/​tests/​cli/​eval/​test_eval_runtime_managed_workspace.py Tests per-item persistence and agent metadata.
packages/​uipath/​tests/​cli/​conftest.py Adds a shared fake SDK fixture.
packages/​uipath/​src/​uipath/​eval/​runtime/​runtime.py Wraps evaluation runtimes and caches factory settings.
packages/​uipath/​src/​uipath/​_utils/​_managed_workspace.py Adds conditional workspace wrapping and persistence policies.
packages/​uipath/​src/​uipath/​_cli/​cli_run.py Integrates workspace management into run.
packages/​uipath/​src/​uipath/​_cli/​cli_debug.py Integrates workspace management into debug.
packages/​uipath/​pyproject.toml Bumps the SDK version to 2.15.1.

Review effort: Balanced

from uipath.platform.common import UiPathConfig
from uipath.runtime import (
HydrationPolicy,
ManagedWorkspace,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right that the import needs a runtime with ManagedWorkspace while the lock picked 0.13.5. 0.13.7 wouldn't fix it, though: it was released from main without ManagedWorkspace. The branch now requires uipath-runtime>=0.13.8 (56e9b80). The lock gets regenerated once 0.13.8 (UiPath/uipath-runtime-python#175) is on PyPI, as the description says.

await _run(
FileRuntime(write="draft", status=UiPathRuntimeStatus.SUSPENDED), storage
)
await _run(FileRuntime(), storage)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right. With restore turned off, every uipath test still passed. The test now asserts that the resumed run reads the saved file (7ae4f93), and it's the only one that fails with restore off.

tudormatei1 and others added 3 commits December 3, 2026 13:10
Coded agents lose the files they write when a job suspends, because
nothing wraps them in HydrationRuntime. A factory can now opt in with
UiPathRuntimeFactorySettings.managed_workspace, and run, debug and
each eval item then get a workspace folder that is uploaded as job
attachments on suspend and restored on resume.

Only job runs are wrapped: only jobs resume in a new process, and
outside a job there are no credentials to build the attachments
client. A conversational run also uploads after a successful
exchange, because the next exchange resumes the same job.

Hydration sits outside governance, whose dispose does not reach the
inner runtime, so the temporary folder is still removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The resume round trip, the conversation policy and folder removal are
already checked by the run/debug command tests or by uipath-runtime's
ManagedWorkspace tests. The settings-read count only pinned an
optimization.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ManagedWorkspace first ships in uipath-runtime 0.13.8; 0.13.7 was
released without it, so run, debug and eval would fail at import.

The lock is regenerated once 0.13.8 is on PyPI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tudormatei1
tudormatei1 force-pushed the feat/PC-5359-coded-workspace-persistence branch from db98042 to 56e9b80 Compare December 3, 2026 11:15
The folder-key test discarded the resumed run's output, so it passed
even when nothing was restored: the first run's upload and link calls
already filled both folder-key lists. With restore turned off, every
uipath test still passed. It now asserts the resumed run reads the
file, which also makes sure the download used the job folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants