Skip to content

fix(cli): write pyproject.toml once when scaffolding a new agent - #373

Closed
vldcmp-uipath wants to merge 1 commit into
mainfrom
fix/gate-new-middlewares-on-project-type
Closed

vldcmp-uipath wants to merge 1 commit into
mainfrom
fix/gate-new-middlewares-on-project-type

Conversation

@vldcmp-uipath

@vldcmp-uipath vldcmp-uipath commented Sep 11, 2026 •

Copy link
Copy Markdown

Problem

Four scaffolds called generate_pyproject twice per uipath new run — once before generating the project files, once after:

with console.spinner(...):
    generate_pyproject(directory, name)     # <-- overwritten below
    generate_script(directory)
    console.success("Created 'main.py' file.")
    console.success("Created 'google_adk.json' file.")
    generate_pyproject(directory, name)
    console.success("Created 'pyproject.toml' file.")

The second call rewrote the first with identical content, so nothing was visibly wrong, but the generation order differed from the other integrations for no reason, and anything written to pyproject.toml between the two calls would be silently discarded.

Changes

  • uipath-agent-framework, uipath-google-adk, uipath-llamaindex and uipath-openai-agents now generate the script and config first, then write pyproject.toml once — the order uipath-claude-sdk and uipath-pydantic-ai already used. Those two packages are unaffected and not touched.
  • A regression test per package counts the calls, so the duplication cannot come back.
  • uipath-agent-framework's failure test now runs in its own working directory. The middleware scaffolds into the cwd, and with the redundant first call gone, the generation that precedes the induced failure writes real files — which landed in the source tree.
  • uipath-llamaindex had no test for its scaffolding middleware; it gets one covering the files written and the project name.
  • Patch bumps: uipath-agent-framework 0.1.1, uipath-google-adk 0.1.1, uipath-llamaindex 0.6.2, uipath-openai-agents 0.1.2.

No dependency or middleware-contract changes, so this is independent of UiPath/uipath-python#1886 and can merge on its own.

Testing

Full suites pass in every touched package (166 / 125 / 166 / 68), with mypy --config-file pyproject.toml ., ruff check and ruff format --check clean in each.

🤖 Generated with Claude Code

@vldcmp-uipath
vldcmp-uipath force-pushed the fix/gate-new-middlewares-on-project-type branch from 49640b1 to 2f2465a Compare September 11, 2026 12:48
The agent framework, Google ADK, LlamaIndex and OpenAI Agents scaffolds
called `generate_pyproject` twice per run: once before generating the
project files and again after. The second call overwrote the first with
identical content, so the bug was invisible, but it left the generation
order inconsistent between packages and would silently discard anything
written to pyproject.toml in between.

Each scaffold now generates the script and its config first, then writes
pyproject.toml once, matching the other integrations. A regression test
per package counts the calls.

The agent framework failure test needed a working directory of its own:
with the redundant first call gone, the file generation that precedes
the failure now writes into the current directory, which was the source
tree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vldcmp-uipath vldcmp-uipath changed the title fix(cli): only claim uipath new scaffolds for the matching framework fix(cli): write pyproject.toml once when scaffolding a new agent Sep 15, 2026
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/gate-new-middlewares-on-project-type branch from 2f2465a to 2912791 Compare September 15, 2026 13:57
@vldcmp-uipath

Copy link
Copy Markdown
Author

Closing: UiPath/uipath-python#1886 fixes #1543 entirely in the base CLI, so no integration in this repo needs a change — uipath new simply doesn't consult the new middleware chain for a function project.

Recording what this PR had found, in case someone picks it up later: uipath-agent-framework, uipath-google-adk, uipath-llamaindex and uipath-openai-agents call generate_pyproject twice per scaffold — once before generating the project files and once after. The second call rewrites the first with identical content, so nothing is visibly broken today; it only matters if anything is written to pyproject.toml between the two calls, and it leaves the generation order inconsistent with uipath-claude-sdk and uipath-pydantic-ai. The branch fix/gate-new-middlewares-on-project-type keeps the one-line-per-package fix, regression tests, and a first scaffolding test for uipath-llamaindex.

@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.

1 participant