Skip to content

fix(cli): only claim uipath new scaffolds for langchain agents - #1069

Draft
vldcmp-uipath wants to merge 3 commits into
mainfrom
fix/gate-new-middleware-on-project-type
Draft

fix(cli): only claim uipath new scaffolds for langchain agents#1069
vldcmp-uipath wants to merge 3 commits into
mainfrom
fix/gate-new-middleware-on-project-type

Conversation

@vldcmp-uipath

@vldcmp-uipath vldcmp-uipath commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

Draft until UiPath/uipath-python#1886 is approved and uipath 2.14.13 is published. The middleware imports uipath._cli.models.project_types / uipath._cli.models.agent_frameworks, which only exist from 2.14.13. For dev-build validation and TestPyPI publishing, this PR temporarily pins uipath==2.14.13.dev1018867574 (the dev build of #1886) sourced from the testpypi index, with uv.lock resolved against it. Before marking ready for review: restore "uipath>=2.14.13, <2.15.0", drop the [tool.uv.sources] testpypi entry for uipath, and run uv lock.

Problem

langgraph_new_middleware returns should_continue=False unconditionally, so installing uipath-langchain hijacks uipath new process-wide and the base function scaffold becomes unreachable (UiPath/uipath-python#1543). This also breaks the uip function new -l py path, which delegates to uipath new and expects a function project.

Changes

  • The middleware now takes project_type / agent_framework (forwarded by uipath new since 2.14.13) and only claims the command for --type agent with the langchain framework; everything else passes through to the base scaffold or another framework's integration.
  • Defaults (ProjectType.AGENT / AgentFramework.LANGCHAIN) preserve current behaviour when an older uipath CLI calls with just the project name.
  • Comparisons use != rather than identity so callers passing plain strings gate correctly (the enums subclass str).
  • Version bumped to 0.17.5; uipath floor raised to 2.14.13.

Behaviour with uipath >= 2.14.13

Command Result
uipath new my-fn function project (base scaffold — previously hijacked)
uipath new my-agent --type agent LangGraph agent project (unchanged)
uipath new x --type agent --agent-framework pydantic-ai passes through to that framework's integration

Testing

  • 7/7 in tests/cli/test_new.py (5 new cases incl. plain-string gating and old-CLI default), mypy and ruff clean, run against the local editable uipath 2.14.13.
  • Verified end-to-end in a venv with both packages installed editable.

🤖 Generated with Claude Code

vldcmp-uipath and others added 2 commits September 7, 2026 18:02
langgraph_new_middleware intercepted `uipath new` unconditionally, making
the base function scaffold unreachable whenever uipath-langchain was
installed (UiPath/uipath-python#1543). Gate it on the project_type and
agent_framework values forwarded by uipath >= 2.14.13 and pass through
anything that is not an agent scaffold for the langchain framework.

Bump version to 0.17.2 and raise the uipath floor to 2.14.13, which ships
the shared ProjectType/AgentFramework enums.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Temporary, to validate and publish a dev build of this PR before uipath
2.14.13 ships: pin uipath==2.14.13.dev1018867574 (built from
UiPath/uipath-python#1886) and source it from the testpypi index. Restore
the ">=2.14.13, <2.15.0" range and drop the source before merging.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
main released up to 0.17.4 while this branch bumped 0.17.1 -> 0.17.2;
resolve to 0.17.5 and regenerate uv.lock on top of main's, keeping the
temporary testpypi dev pin for uipath.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

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.

1 participant