Skip to content

Improve SDK version bump workflow#3111

Merged
xingyaoww merged 2 commits intomainfrom
fix/version-bump-pr-workflow
May 8, 2026
Merged

Improve SDK version bump workflow#3111
xingyaoww merged 2 commits intomainfrom
fix/version-bump-pr-workflow

Conversation

@xingyaoww
Copy link
Copy Markdown
Collaborator

@xingyaoww xingyaoww commented May 7, 2026

Summary

  • preserve the OpenHands lockfile Poetry version when generating bump PRs
  • use exact SDK package pins and keep pyproject-fmt from shortening patch versions
  • migrate legacy SDK skill imports and stage only expected files in generated PRs

Validation

  • uv run pre-commit run --files .github/workflows/version-bump-prs.yml

Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.13-nodejs22-slim Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:852d86e-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-852d86e-python \
  ghcr.io/openhands/agent-server:852d86e-python

All tags pushed for this build

ghcr.io/openhands/agent-server:852d86e-golang-amd64
ghcr.io/openhands/agent-server:852d86e-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:852d86e-golang-arm64
ghcr.io/openhands/agent-server:852d86e-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:852d86e-java-amd64
ghcr.io/openhands/agent-server:852d86e-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:852d86e-java-arm64
ghcr.io/openhands/agent-server:852d86e-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:852d86e-python-amd64
ghcr.io/openhands/agent-server:852d86e-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-amd64
ghcr.io/openhands/agent-server:852d86e-python-arm64
ghcr.io/openhands/agent-server:852d86e-nikolaik_s_python-nodejs_tag_python3.13-nodejs22-slim-arm64
ghcr.io/openhands/agent-server:852d86e-golang
ghcr.io/openhands/agent-server:852d86e-java
ghcr.io/openhands/agent-server:852d86e-python

About Multi-Architecture Support

  • Each variant tag (e.g., 852d86e-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 852d86e-python-amd64) are also available if needed

Use exact downstream pins, preserve the OpenHands lockfile Poetry version, and migrate SDK skill imports in generated PRs.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Python API breakage checks — ✅ PASSED

Result:PASSED

Action log

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

REST API breakage checks (OpenAPI) — ✅ PASSED

Result:PASSED

Action log

Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

LGTM! 🎯

Solid improvements to the version bump workflow:

  • Dynamic Poetry version matching prevents lockfile generator mismatches
  • Exact pins (==) + pyproject-fmt config ensure patch versions survive formatting
  • Import migration handles SDK 1.21.0+ changes automatically
  • Selective staging is much safer than git add .

Error handling and idempotency look good.

Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

✅ QA Report: PASS

All workflow improvements verified through local simulation of bash script logic and YAML validation.

Does this PR achieve its stated goal?

Yes. This PR successfully improves the SDK version bump workflow by:

  1. Detecting and using the target repo's Poetry version from poetry.lock (preventing lockfile incompatibility)
  2. Applying exact version pins (==1.21.0 instead of 1.21.0) to prevent Poetry from resolving to newer versions
  3. Configuring pyproject-fmt to preserve full version strings (preventing 1.21.01.21 shortening)
  4. Migrating legacy SDK skill imports (openhands.sdk.context.skillsopenhands.sdk.skills)
  5. Staging only expected files instead of git add . (preventing accidental commits)
  6. Correcting the repo name from All-Hands-AI/OpenHands to OpenHands/OpenHands

Each improvement was tested through local simulation. The bash script logic is sound, YAML syntax is valid, and all sed/grep operations produce correct output.

Phase Result
Environment Setup ✅ Checked out PR branch, validated YAML syntax
CI Status ✅ All checks passing (29/29 pass, 1 pending QA)
Functional Verification ✅ All 6 workflow improvements verified through local simulation
Functional Verification

Test 1: Poetry Version Detection from Lockfile

Baseline: Before this PR, Poetry 2.3.3 was installed globally regardless of the target repo's lockfile version, potentially causing lockfile regeneration incompatibilities.

Test: Simulated the new Poetry version extraction logic:

POETRY_VERSION=$(sed -n -E 's/^# This file is automatically @generated by Poetry ([^ ]+) and should not be changed by hand\.$/\1/p' test_poetry.lock)
echo "Extracted Poetry version: '$POETRY_VERSION'"

Result:

Extracted Poetry version: '1.8.5'

Interpretation: The sed pattern correctly extracts the Poetry version from the lockfile header. The workflow will now install the exact Poetry version used by the target repo, ensuring lockfile compatibility.


Test 2: Exact Version Pins with ==

Baseline: The old sed commands used bare version strings ("1.21.0"):

sed -i -E 's/^(openhands-sdk = )"[^"]*"/\1"1.21.0"/' pyproject.toml

This allowed Poetry to interpret "1.21.0" as a caret constraint (^1.21.0), potentially resolving to 1.21.1 or 1.22.0.

Test: Compared old vs. new sed commands:

# OLD:
sed -i -E 's/^(openhands-sdk = )"[^"]*"/\1"1.21.0"/' pyproject.toml
# Result: openhands-sdk = "1.21.0"

# NEW:
sed -i -E 's/^(openhands-sdk = )"[^"]*"/\1"==1.21.0"/' pyproject.toml
# Result: openhands-sdk = "==1.21.0"

Result:

OLD: openhands-sdk = "1.21.0"
NEW: openhands-sdk = "==1.21.0"

Interpretation: The new approach correctly adds == to create exact pins, preventing Poetry from resolving to newer versions.


Test 3: pyproject-fmt Configuration for Full Version Preservation

Baseline: Before this PR, pyproject-fmt would shorten 1.21.0 to 1.21 in the formatted output, losing patch version precision.

Test: Simulated adding the --keep-full-version argument to the pre-commit config:

if ! grep -q "args: \\[--keep-full-version\\]" test_pre_commit.yaml; then
  sed -i '/^[[:space:]]*- id: pyproject-fmt[[:space:]]*$/a\        args: [--keep-full-version]' test_pre_commit.yaml
fi

Result:

hooks:
  - id: pyproject-fmt
    args: [--keep-full-version]
    additional_dependencies: ["tox>=4.24.1"]

Interpretation: The sed command correctly inserts the args line after the id: pyproject-fmt line, configuring pyproject-fmt to preserve full version strings like 1.21.0 instead of shortening to 1.21.


Test 4: SDK Skill Import Migration

Baseline: SDK 1.21.0 moved skills exports from openhands.sdk.context.skills to openhands.sdk.skills. The OpenHands repo may still use the old import paths.

Test: Simulated finding and migrating old imports:

# Find files with old imports
mapfile -t SDK_IMPORT_FILES < <(grep -RIl "openhands\\.sdk\\.context\\.skills" openhands tests || true)

# Migrate imports
for file in "${SDK_IMPORT_FILES[@]}"; do
  sed -i 's/openhands\.sdk\.context\.skills/openhands.sdk.skills/g' "$file"
done

Before:

from openhands.sdk.context.skills import load_skill
from openhands.sdk.context.skills.manager import SkillManager
import openhands.sdk.context.skills as skills_module

After:

from openhands.sdk.skills import load_skill
from openhands.sdk.skills.manager import SkillManager
import openhands.sdk.skills as skills_module

Interpretation: The grep + sed pipeline correctly identifies files with legacy imports and updates all occurrences to the new path. The workflow makes this idempotent so reruns don't fail if the migration was already applied.


Test 5: Selective Git Staging

Baseline: The old workflow used git add . which would stage ALL modified files, including unintended changes like temporary files or unrelated edits.

Test: Compared git add . vs. selective staging:

# OLD: git add .
# Result: Stages ALL 5 modified files including extra_file.txt

# NEW: Selective staging
git add pyproject.toml poetry.lock sandbox_spec_service.py test_pre_commit.yaml
# Result: Stages only 4 expected files, excludes extra_file.txt

Result:

OLD approach stages: pyproject.toml, poetry.lock, sandbox_spec_service.py, test_pre_commit.yaml, extra_file.txt (5 files)
NEW approach stages: pyproject.toml, poetry.lock, sandbox_spec_service.py, test_pre_commit.yaml (4 files)

Interpretation: The new approach only stages the files that the workflow intentionally modified, preventing accidental commits of unrelated changes.


Test 6: Repo Name Correction and Message Updates

Verification:

  • ✅ All references to All-Hands-AI/OpenHands changed to OpenHands/OpenHands
  • ✅ Global Poetry installation step removed
  • ✅ Per-repo Poetry installation added with version detection
  • ✅ Commit messages updated to mention "exact pins" and "SDK skill import paths"
  • ✅ PR descriptions updated to mention "with exact pins" and "target repo's Poetry version"

Interpretation: The repo name is now correct, and all user-facing messages accurately describe the improvements made in this PR.

Issues Found

None.

Comment thread .github/workflows/version-bump-prs.yml Outdated
The version bump workflow should only care about updating dependency
versions and regenerating lockfiles, not migrating import paths.
Version-specific export changes are handled manually when needed.

Co-authored-by: openhands <openhands@all-hands.dev>
@xingyaoww xingyaoww merged commit 711cb16 into main May 8, 2026
31 of 33 checks passed
@xingyaoww xingyaoww deleted the fix/version-bump-pr-workflow branch May 8, 2026 15:51
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