Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-driver): resolve SDK release from run artifacts (#2926)
Francesco Bonacci3cd9de9a32bf
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.pyindex 9a34760c00..bbd9ff4777 100644--- a/.github/scripts/tests/test_cua_driver_release_wiring.py+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py@@ -20,6 +20,20 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):self.assertIn('workflows: ["CD: Cua Driver (cross-platform)"]', workflow)self.assertNotIn("branches:\n - main", workflow)self.assertIn("github.event.workflow_run.conclusion == 'success'", workflow)+ self.assertIn(" actions: read", workflow)+ self.assertIn('RUN_ID="${{ github.event.workflow_run.id }}"', workflow)+ self.assertIn(+ 'actions/runs/$RUN_ID/artifacts?per_page=100',+ workflow,+ )+ self.assertIn("cua-driver-release-metadata-", workflow)+ self.assertIn('"${#RELEASE_VERSIONS[@]}" -gt 1', workflow)+ sha_fallback = 'HEAD_SHA="${{ github.event.workflow_run.head_sha }}"'+ self.assertIn(sha_fallback, workflow)+ self.assertLess(+ workflow.index("cua-driver-release-metadata-"),+ workflow.index(sha_fallback),+ )self.assertIn('gh release view "$TAG" --repo "$GITHUB_REPOSITORY"', workflow)def test_python_publish_defaults_to_current_rust_version(self) -> None:diff --git a/.github/workflows/cd-py-cua-driver.yml b/.github/workflows/cd-py-cua-driver.ymlindex 018c9f9d2d..825077763d 100644--- a/.github/workflows/cd-py-cua-driver.yml+++ b/.github/workflows/cd-py-cua-driver.yml@@ -17,6 +17,7 @@ on:- completedpermissions:+ actions: readcontents: readid-token: write@@ -46,29 +47,55 @@ jobs:fiSHOULD_PUBLISH="true"else- # Extract from the tag that triggered the workflow_run- # Validate SHA format to prevent injection- HEAD_SHA="${{ github.event.workflow_run.head_sha }}"- if ! echo "$HEAD_SHA" | grep -qE '^[0-9a-f]{40}$'; then- echo "Invalid SHA format: $HEAD_SHA"- VERSION="0.0.0"- SHOULD_PUBLISH="false"+ # Publish dispatches run from main, so workflow_run.head_sha is the+ # workflow revision rather than the immutable release tag. Resolve+ # those runs from the exact metadata artifact produced by the+ # successful release job.+ RUN_ID="${{ github.event.workflow_run.id }}"+ if ! echo "$RUN_ID" | grep -qE '^[0-9]+$'; then+ echo "Invalid workflow run ID: $RUN_ID" >&2+ exit 1+ fi+ ARTIFACTS_FILE="$RUNNER_TEMP/cua-driver-release-metadata-artifacts.txt"+ gh api --paginate \+ "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID/artifacts?per_page=100" \+ --jq '.artifacts[] | select(.expired == false) | .name' \+ > "$ARTIFACTS_FILE"+ mapfile -t RELEASE_VERSIONS < <(+ sed -nE \+ 's/^cua-driver-release-metadata-([0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?)$/\1/p' \+ "$ARTIFACTS_FILE" | sort -u+ )++ if [ "${#RELEASE_VERSIONS[@]}" -gt 1 ]; then+ echo "Multiple Cua Driver release metadata artifacts found for run $RUN_ID" >&2+ printf ' %s\n' "${RELEASE_VERSIONS[@]}" >&2+ exit 1+ elif [ "${#RELEASE_VERSIONS[@]}" -eq 1 ]; then+ VERSION="${RELEASE_VERSIONS[0]}"+ TAG="cua-driver-rs-v$VERSION"else+ # Tag-triggered candidate builds do not run the release job and+ # therefore have no release metadata artifact. Preserve the tag+ # SHA fallback so those runs continue to skip until publication.+ HEAD_SHA="${{ github.event.workflow_run.head_sha }}"+ if ! echo "$HEAD_SHA" | grep -qE '^[0-9a-f]{40}$'; then+ echo "Invalid SHA format: $HEAD_SHA" >&2+ exit 1+ figit fetch --tagsTAG=$(git tag --points-at "$HEAD_SHA" | grep '^cua-driver-rs-v' | head -1 || echo "")- if [ -n "$TAG" ]; then- VERSION="${TAG#cua-driver-rs-v}"- if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then- SHOULD_PUBLISH="true"- else- echo "GitHub Release $TAG is not available; skipping PyPI publish."- SHOULD_PUBLISH="false"- fi- else- # No matching tag, skip- VERSION="0.0.0"- SHOULD_PUBLISH="false"- fi+ VERSION="${TAG#cua-driver-rs-v}"+ fi++ if [ -n "$TAG" ] && gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then+ SHOULD_PUBLISH="true"+ elif [ -n "$TAG" ]; then+ echo "GitHub Release $TAG is not available; skipping SDK publish."+ SHOULD_PUBLISH="false"+ else+ VERSION="0.0.0"+ SHOULD_PUBLISH="false"fifiecho "version=$VERSION" >> "$GITHUB_OUTPUT"