Skip to content

fix(cli-server): parse string args without shlex#1688

Open
radu-mocanu wants to merge 1 commit into
mainfrom
fix/cli-server-args-must-be-list
Open

fix(cli-server): parse string args without shlex#1688
radu-mocanu wants to merge 1 commit into
mainfrom
fix/cli-server-args-must-be-list

Conversation

@radu-mocanu
Copy link
Copy Markdown
Collaborator

@radu-mocanu radu-mocanu commented May 28, 2026

Summary

  • replace shlex-based parsing of the args request field with a linear parser for the '<entrypoint>' '<json>' wire format
  • still accept args as a list of strings (passthrough)
  • return 400 for malformed strings

Why

shlex.split runs a character-by-character shell-lexer (https://docs.python.org/3/library/shlex.html#shlex.split). when clients inlined a large json blob into args as 'agent.json' '{...json...}', the server stalled on the request thread before the command could start. the new parser finds the ' ' boundary, so latency is linear in payload size and large inputs no longer block the loop.

Development Packages

uipath

[project]
dependencies = [
  # Exact version:
  "uipath==2.10.73.dev1016886592",

  # Any version from PR
  "uipath>=2.10.73.dev1016880000,<2.10.73.dev1016890000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

Copilot AI review requested due to automatic review settings May 28, 2026 10:40
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels May 28, 2026
@radu-mocanu radu-mocanu added the build:dev Create a dev build from the pr label May 28, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Tightens validation on POST /jobs/{job_key}/start so that args must be a JSON array of strings. The previous string branch that called shlex.split on the request payload is removed, eliminating shell tokenization on the request thread and reducing latency for large payloads.

Changes:

  • Replace parse_args() with ensure_args_list() that accepts only None/list[str] and returns None for invalid values.
  • handle_start() returns a 400 JSON error when args is not a JSON array of strings; shlex import dropped.
  • Bump package version to 2.10.72 and refresh the lockfile.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/uipath/src/uipath/_cli/cli_server.py New args validator and 400 response; remove shlex-based string parsing.
packages/uipath/pyproject.toml Version bump to 2.10.72.
packages/uipath/uv.lock Lockfile updated for new version and exclude-newer.

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

Comment thread packages/uipath/src/uipath/_cli/cli_server.py Outdated
@radu-mocanu radu-mocanu force-pushed the fix/cli-server-args-must-be-list branch 4 times, most recently from c03f98f to 3ec7d06 Compare May 28, 2026 13:12
@radu-mocanu radu-mocanu changed the title fix(cli-server): require args to be a json array fix(cli-server): parse string args without shlex May 28, 2026
@radu-mocanu radu-mocanu force-pushed the fix/cli-server-args-must-be-list branch from 3ec7d06 to 2639ea0 Compare May 28, 2026 13:27
@radu-mocanu radu-mocanu force-pushed the fix/cli-server-args-must-be-list branch from 2639ea0 to 5e6225a Compare May 28, 2026 13:33
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
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 →

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

Labels

build:dev Create a dev build from the pr test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants