Skip to content

fix(cli): pin scaffolded uipath-langchain to the current minor release - #1052

Open
andreibalas-uipath wants to merge 2 commits into
mainfrom
fix/UV-16117-scaffold-version-pin
Open

fix(cli): pin scaffolded uipath-langchain to the current minor release#1052
andreibalas-uipath wants to merge 2 commits into
mainfrom
fix/UV-16117-scaffold-version-pin

Conversation

@andreibalas-uipath

@andreibalas-uipath andreibalas-uipath commented Aug 26, 2026

Copy link
Copy Markdown

Summary

Fixes UV-16117 for uipath-langchain. Counterpart of UiPath/uipath-python#1869 and #1874.

uipath new (and uip codedagent new, which bridges to it) wrote a hard-coded uipath-langchain[bedrock,vertex]>=0.10.0, <0.11.0 into the scaffolded pyproject.toml, so uv sync downgraded the freshly created project to a stale release.

Changes

  • _cli/cli_new.py: the pin is generated from a single reviewed constant, UIPATH_LANGCHAIN_SCAFFOLD_MINOR = "0.16"uipath-langchain[bedrock,vertex]>=0.16.0, <0.17.0. Deliberately a constant (same approach as #1874): a guard test fails on every minor bump so the scaffold (pin, template, hints) gets reviewed alongside the release instead of drifting silently.
  • Per review, the CLI no longer advertises a dependency installation command; instead the quickstart guide installs uipath-langchain[bedrock,vertex] up front (the scaffolded agent needs the extras for uipath init). Post-scaffold hints drop the stray leading space.
  • tests/cli/test_new.py (new):
    • test_scaffold_pin_admits_installed_version — asserts the constant equals the installed major.minor (via packaging.version.Version); fails CI on a minor bump with instructions to review the scaffold and bump the constant.
    • test_scaffolded_pin_contains_installed_version — runs the real scaffold and asserts the written specifier admits the installed package.
  • pyproject.toml: add packaging>=24.0 to the dev group (used by tests); bump version 0.16.120.16.13.

Testing

  • uv run pytest tests/cli — 55 passed; just lint and mypy clean.
  • Manual end-to-end with the built wheel in a fresh venv: uipath new → pin >=0.16.0, <0.17.0uv sync (no downgrade, extras installed) → uipath inituipath run agent '{"topic": "UiPath"}' succeeded against LLM Gateway (exit code 0).

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 26, 2026 16:26
@andreibalas-uipath andreibalas-uipath self-assigned this Aug 26, 2026

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 fixes a scaffolding regression in the uipath-langchain CLI where uipath new generated a hard-coded uipath-langchain[bedrock,vertex] version range that could cause uv sync to downgrade a freshly scaffolded project. It updates the scaffold to derive the dependency pin from the installed uipath-langchain version and adds regression tests to prevent future drift.

Changes:

  • Derive the scaffolded uipath-langchain[bedrock,vertex] pin from the installed package version (minor-range constraint), with a warning + fallback when the version is unknown.
  • Improve post-scaffold hints to recommend uv sync before uipath init.
  • Add a new CLI test suite validating pin derivation behavior (including prerelease stripping and fallback guard), and add packaging to the dev dependency group.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/uipath_langchain/_cli/cli_new.py Computes scaffold dependency pin from installed uipath-langchain version; updates hints shown after scaffolding.
tests/cli/test_new.py Adds regression tests for derived pinning, prerelease stripping, unknown-version fallback, and an end-to-end scaffold check.
pyproject.toml Bumps package version and adds packaging>=24.0 to dev deps (used by new tests).
uv.lock Updates lockfile for the version bump and the added packaging dev dependency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/uipath_langchain/_cli/cli_new.py Outdated
Comment thread src/uipath_langchain/_cli/cli_new.py Outdated
Comment thread src/uipath_langchain/_cli/cli_new.py Outdated
`uipath new` hard-coded `uipath-langchain[bedrock,vertex]>=0.10.0, <0.11.0`
in the generated pyproject.toml, so `uv sync` right after scaffolding
downgraded the project to a stale release.

The pin now comes from a single reviewed constant,
UIPATH_LANGCHAIN_SCAFFOLD_MINOR, guarded by a test that fails on every
minor bump so the scaffold (pin, template, hints) is reviewed alongside
the release. Mirrors UiPath/uipath-python#1869 and #1874.

Also recommends `uv sync` before `uipath init` in the post-scaffold hints,
since `uipath init` imports the template's Bedrock/Vertex chat models and
fails without the extras installed.

Refs UV-16117

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@andreibalas-uipath
andreibalas-uipath force-pushed the fix/UV-16117-scaffold-version-pin branch from 9e89118 to d31c8ab Compare August 28, 2026 11:04
@andreibalas-uipath andreibalas-uipath changed the title fix(cli): derive scaffold uipath-langchain pin from installed version fix(cli): pin scaffolded uipath-langchain to the current minor release Aug 28, 2026
@andreibalas-uipath
andreibalas-uipath requested review from radu-mocanu and a lite review from Copilot August 28, 2026 11:09

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

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

Suppressed comments (1)

tests/cli/test_new.py:55

  • This assertion currently relies on a regex match group from the raw TOML text. If the scaffold formatting changes (while still producing a valid project.dependencies entry), the test will fail even though behavior is correct. Consider parsing pyproject.toml via tomllib and extracting the uipath-langchain requirement via Requirement, then checking req.specifier.contains(...).
        content = (tmp_path / "pyproject.toml").read_text()
        match = PIN_RE.search(content)
        assert match is not None, content
        installed = version("uipath-langchain")
        assert SpecifierSet(match.group(1)).contains(installed, prereleases=True), (
            f"scaffolded pin '{match.group(1)}' does not contain installed "
            f"uipath-langchain {installed}"

Comment thread tests/cli/test_new.py
Per review: the CLI should not advertise a package-manager-specific
install command (users may use pip, not uv). The quickstart guide now
installs uipath-langchain[bedrock,vertex] up front, which the scaffolded
agent's chat models need for `uipath init` to succeed.

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

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants