-
Notifications
You must be signed in to change notification settings - Fork 140
fix: update enterprise/pyproject.toml before poetry lock in version bump workflow #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ump workflow The workflow was failing with 'Cannot enrich dependency with incompatible constraints' because enterprise/pyproject.toml still depended on the old version of openhands-agent-server when poetry lock was run in the root directory. This fix updates enterprise/pyproject.toml with the new SDK package versions BEFORE running poetry lock to avoid conflicting dependency constraints. Fixes: https://github.com/OpenHands/software-agent-sdk/actions/runs/21366085620/job/61499460469 Co-authored-by: openhands <openhands@all-hands.dev>
all-hands-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The fix correctly addresses the root cause by updating both pyproject.toml files before running poetry lock. However, there are robustness and maintainability issues that should be addressed.
| echo "📝 Updating enterprise/pyproject.toml..." | ||
| cd enterprise | ||
| poetry add "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION" | ||
| cd .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Important: The cd enterprise / cd .. pattern is fragile and error-prone.
Problems:
- If any command between the cd operations fails, the script continues in the wrong directory
- No verification that we return to the correct location
- Makes debugging harder
Better approach:
(cd enterprise && poetry add "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION") || exit 1The subshell (...) ensures we always return to the original directory, and || exit 1 provides error handling.
| echo "🔒 Running poetry lock in enterprise/..." | ||
| cd enterprise | ||
| poetry lock | ||
| cd .. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Important: Same fragile cd pattern here. Use a subshell for safety:
| cd .. | |
| (cd enterprise && poetry lock) || exit 1 |
| echo "📝 Updating pyproject.toml..." | ||
| # 1. Update versions in pyproject.toml using poetry (root) | ||
| echo "📝 Updating root pyproject.toml..." | ||
| poetry add "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Important: No error checking. If poetry add fails, the workflow continues and will fail later with a confusing error.
Add error checking:
poetry add "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION" || exit 1|
|
||
| # 3. Generate poetry.lock in root | ||
| echo "🔒 Running poetry lock in root..." | ||
| poetry lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 Important: Add error checking here too:
| poetry lock | |
| poetry lock || exit 1 |
If poetry lock fails, we should stop immediately rather than continue with an inconsistent state.
| # 1. Update versions in pyproject.toml using poetry (root) | ||
| echo "📝 Updating root pyproject.toml..." | ||
| poetry add "openhands-sdk==$VERSION" "openhands-tools==$VERSION" "openhands-agent-server==$VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion: The numbered comments (# 1., # 2., etc.) are maintenance burden. Every time a step is added or removed, all subsequent numbers need updating.
The echo statements already provide clear context. Consider removing the numbers:
# Update versions in pyproject.toml using poetry (root)
echo "📝 Updating root pyproject.toml..."|
|
||
| # 2. Generate poetry.lock in root | ||
| # 2. Update versions in enterprise/pyproject.toml using poetry | ||
| # Must be done BEFORE running poetry lock in root to avoid conflicting constraints |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Suggestion: This comment is verbose. The commit message and the fix itself make this clear.
Consider a more concise version:
# Update enterprise pyproject.toml (must be done before root poetry lock)
enyst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
This PR fixes the failing PyPI release workflow that creates version bump PRs.
Problem
The workflow was failing with the error:
See failed run: https://github.com/OpenHands/software-agent-sdk/actions/runs/21366085620/job/61499460469
Root Cause
When creating the version bump PR for the OpenHands repo, the workflow:
pyproject.tomlin the root with new SDK package versionspoetry lockin the root directoryenterprise/pyproject.tomlHowever, step 2 failed because the
enterprise/directory has its ownpyproject.tomlthat depends on the OpenHands SDK packages, and Poetry resolves dependencies across the entire project. Sinceenterprise/pyproject.tomlstill had the old version (1.9.1) while the root had the new version (1.10.0), Poetry couldn't resolve the conflicting constraints.Solution
Update both
pyproject.tomlfiles (root and enterprise) before runningpoetry lock. This ensures there are no conflicting dependency constraints when Poetry resolves dependencies.The workflow now:
pyproject.tomlin the root with new SDK package versionsenterprise/pyproject.tomlwith new SDK package versionspoetry lockin the root directory (now succeeds)poetry lockin the enterprise directoryAGENT_SERVER_IMAGEhashChanges
.github/workflows/pypi-release.ymlto updateenterprise/pyproject.tomlbefore runningpoetry lock@xingyaoww can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:341244b-pythonRun
All tags pushed for this build
About Multi-Architecture Support
341244b-python) is a multi-arch manifest supporting both amd64 and arm64341244b-python-amd64) are also available if needed