Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Harden workflow GitHub context handling (#750)

Engel Nyste386ba316ca7
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 10cdea4498..c9e5ae6e5d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -282,8 +282,10 @@ jobs:
id: live_video_preview
if: always() && steps.live_media.outputs.video_path != '' && steps.pr_context.outputs.is_fork != 'true' && steps.latest_commit.outputs.pr_artifact_only != 'true'
continue-on-error: true
+ env:
+ VIDEO_PATH: ${{ steps.live_media.outputs.video_path }}
run: |
- video_path="${{ steps.live_media.outputs.video_path }}"
+ video_path="$VIDEO_PATH"
if [ ! -f "$video_path" ]; then
echo "::warning::Live E2E video file was not found, skipping GIF preview generation."
exit 0
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 26ae6c12df..a95e518528 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -98,22 +98,27 @@ jobs:
- name: Compute metadata and tags
id: prep
+ env:
+ AGENT_SERVER_IMAGE_INPUT: ${{ inputs.agent_server_image }}
+ DEFAULT_AGENT_SERVER_IMAGE: ${{ steps.config.outputs.default_agent_server_image }}
+ AUTOMATION_VERSION_INPUT: ${{ inputs.automation_version }}
+ DEFAULT_AUTOMATION_VERSION: ${{ steps.config.outputs.default_automation_version }}
run: |
SHORT_SHA=$(echo "$RELEVANT_SHA" | cut -c1-7)
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
# Resolve agent-server base image (input override > config/defaults.json)
- if [ -n "${{ inputs.agent_server_image }}" ]; then
- echo "agent_server_image=${{ inputs.agent_server_image }}" >> "$GITHUB_OUTPUT"
+ if [ -n "$AGENT_SERVER_IMAGE_INPUT" ]; then
+ echo "agent_server_image=$AGENT_SERVER_IMAGE_INPUT" >> "$GITHUB_OUTPUT"
else
- echo "agent_server_image=${{ steps.config.outputs.default_agent_server_image }}" >> "$GITHUB_OUTPUT"
+ echo "agent_server_image=$DEFAULT_AGENT_SERVER_IMAGE" >> "$GITHUB_OUTPUT"
fi
# Resolve automation version (input override > config/defaults.json)
- if [ -n "${{ inputs.automation_version }}" ]; then
- echo "automation_version=${{ inputs.automation_version }}" >> "$GITHUB_OUTPUT"
+ if [ -n "$AUTOMATION_VERSION_INPUT" ]; then
+ echo "automation_version=$AUTOMATION_VERSION_INPUT" >> "$GITHUB_OUTPUT"
else
- echo "automation_version=${{ steps.config.outputs.default_automation_version }}" >> "$GITHUB_OUTPUT"
+ echo "automation_version=$DEFAULT_AUTOMATION_VERSION" >> "$GITHUB_OUTPUT"
fi
# Build arch-suffixed tags (e.g., sha-abc1234-amd64)
@@ -196,27 +201,33 @@ jobs:
sbom: true
- name: Summary (${{ matrix.arch }})
+ env:
+ TAGS: ${{ steps.prep.outputs.tags }}
run: |
- echo "Image: ${{ env.IMAGE }}"
+ echo "Image: $IMAGE"
echo "Architecture: ${{ matrix.arch }}"
echo "Platform: ${{ matrix.platform }}"
echo "Short SHA: ${{ steps.prep.outputs.short_sha }}"
- echo "Tags: ${{ steps.prep.outputs.tags }}"
+ echo "Tags: $TAGS"
echo "Build digest: ${{ steps.build.outputs.digest }}"
- name: Save build info for consolidation
+ env:
+ TAGS: ${{ steps.prep.outputs.tags }}
+ AGENT_SERVER_IMAGE: ${{ steps.prep.outputs.agent_server_image }}
+ AUTOMATION_VERSION: ${{ steps.prep.outputs.automation_version }}
run: |
mkdir -p build-info
jq -n \
--arg arch "${{ matrix.arch }}" \
- --arg image "${{ env.IMAGE }}" \
+ --arg image "$IMAGE" \
--arg short_sha "${{ steps.prep.outputs.short_sha }}" \
- --arg tags "${{ steps.prep.outputs.tags }}" \
- --arg agent_server_image "${{ steps.prep.outputs.agent_server_image }}" \
- --arg automation_version "${{ steps.prep.outputs.automation_version }}" \
+ --arg tags "$TAGS" \
+ --arg agent_server_image "$AGENT_SERVER_IMAGE" \
+ --arg automation_version "$AUTOMATION_VERSION" \
--arg platform "${{ matrix.platform }}" \
--arg git_sha "${{ env.RELEVANT_SHA }}" \
- --arg git_ref "${{ env.RELEVANT_REF }}" \
+ --arg git_ref "$RELEVANT_REF" \
'{arch: $arch, image: $image, short_sha: $short_sha, tags: $tags, agent_server_image: $agent_server_image, automation_version: $automation_version, platform: $platform, git_sha: $git_sha, git_ref: $git_ref}' \
> "build-info/${{ matrix.arch }}.json"
cat "build-info/${{ matrix.arch }}.json"
@@ -330,7 +341,7 @@ jobs:
# Save manifest info for consolidation
mkdir -p manifest-info
jq -n \
- --arg image "${{ env.IMAGE }}" \
+ --arg image "$IMAGE" \
--arg short_sha "$SHORT_SHA" \
--arg manifest_tags "$MANIFEST_TAG_CSV" \
'{image: $image, short_sha: $short_sha, manifest_tags: $manifest_tags}' \
@@ -459,8 +470,9 @@ jobs:
steps:
- name: Generate PR description from build summary
id: generate_description
+ env:
+ BUILD_SUMMARY: ${{ needs.consolidate-build-info.outputs.build_summary }}
run: |
- BUILD_SUMMARY='${{ needs.consolidate-build-info.outputs.build_summary }}'
echo "Build summary received:"
echo "$BUILD_SUMMARY" | jq .
diff --git a/.github/workflows/mock-llm-docker-e2e.yml b/.github/workflows/mock-llm-docker-e2e.yml
index 03348ad414..00a991694b 100644
--- a/.github/workflows/mock-llm-docker-e2e.yml
+++ b/.github/workflows/mock-llm-docker-e2e.yml
@@ -73,6 +73,8 @@ jobs:
# ── Resolve which commit / PR to test ──────────────────────────────
- name: Resolve source context
id: ctx
+ env:
+ GITHUB_REF_VALUE: ${{ github.ref }}
run: |
if [ "${{ github.event_name }}" = "workflow_run" ]; then
# workflow_run only fires for main (job-level `if` guard), so
@@ -87,7 +89,7 @@ jobs:
echo "pr_number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
else
echo "sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
- echo "ref=${{ github.ref }}" >> "$GITHUB_OUTPUT"
+ echo "ref=$GITHUB_REF_VALUE" >> "$GITHUB_OUTPUT"
echo "pr_number=" >> "$GITHUB_OUTPUT"
fi
@@ -154,9 +156,11 @@ jobs:
# ── Resolve Docker image tag ───────────────────────────────────────
- name: Resolve Docker image
id: image
+ env:
+ DOCKER_IMAGE_INPUT: ${{ inputs.docker_image }}
run: |
- if [ -n "${{ inputs.docker_image }}" ]; then
- echo "tag=${{ inputs.docker_image }}" >> "$GITHUB_OUTPUT"
+ if [ -n "$DOCKER_IMAGE_INPUT" ]; then
+ echo "tag=$DOCKER_IMAGE_INPUT" >> "$GITHUB_OUTPUT"
else
SHORT_SHA=$(echo "${{ steps.ctx.outputs.sha }}" | cut -c1-7)
# Use the amd64-specific tag (always pushed by the Docker workflow).
@@ -171,9 +175,11 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Docker image
+ env:
+ DOCKER_IMAGE_TAG: ${{ steps.image.outputs.tag }}
run: |
- echo "Pulling ${{ steps.image.outputs.tag }}..."
- docker pull "${{ steps.image.outputs.tag }}"
+ echo "Pulling $DOCKER_IMAGE_TAG..."
+ docker pull "$DOCKER_IMAGE_TAG"
# ── Test infrastructure setup ──────────────────────────────────────
- name: Set up Node.js
@@ -212,9 +218,11 @@ jobs:
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install openhands-sdk (for mock LLM server)
+ env:
+ AGENT_SERVER_VERSION: ${{ steps.defaults.outputs.agent_server_version }}
run: |
uv venv .mock-llm-venv
- uv pip install -p .mock-llm-venv openhands-sdk==${{ steps.defaults.outputs.agent_server_version }}
+ uv pip install -p .mock-llm-venv "openhands-sdk==$AGENT_SERVER_VERSION"
- name: Verify mock LLM server starts
run: |
diff --git a/.github/workflows/mock-llm-e2e.yml b/.github/workflows/mock-llm-e2e.yml
index 555b2b4ceb..5890777ce6 100644
--- a/.github/workflows/mock-llm-e2e.yml
+++ b/.github/workflows/mock-llm-e2e.yml
@@ -73,17 +73,21 @@ jobs:
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Install openhands-sdk (for mock LLM server)
+ env:
+ AGENT_SERVER_VERSION: ${{ steps.defaults.outputs.agent_server_version }}
run: |
uv venv .mock-llm-venv
- uv pip install -p .mock-llm-venv openhands-sdk==${{ steps.defaults.outputs.agent_server_version }}
+ uv pip install -p .mock-llm-venv "openhands-sdk==$AGENT_SERVER_VERSION"
- name: Pre-warm automation backend (uvx cache)
+ env:
+ AUTOMATION_VERSION: ${{ steps.defaults.outputs.automation_version }}
run: |
# Pre-install openhands-automation into the uvx cache so the
# agent-canvas binary doesn't need to download it at startup.
# Without this, the 180s Playwright webServer timeout expires
# before the automation backend finishes installing (~60-90s).
- uvx --from "openhands-automation==${{ steps.defaults.outputs.automation_version }}" python -c "from openhands.automation.app import app; print('automation package cached')"
+ uvx --from "openhands-automation==$AUTOMATION_VERSION" python -c "from openhands.automation.app import app; print('automation package cached')"
- name: Verify mock LLM server starts
run: |
diff --git a/.github/workflows/sdk-version-sync.yml b/.github/workflows/sdk-version-sync.yml
index efe97d8fdf..6f10c24c30 100644
--- a/.github/workflows/sdk-version-sync.yml
+++ b/.github/workflows/sdk-version-sync.yml
@@ -58,14 +58,18 @@ jobs:
node-version: '24'
- name: Log trigger info
+ env:
+ EVENT_ACTION: ${{ github.event.action }}
+ CLIENT_PAYLOAD: ${{ toJson(github.event.client_payload) }}
+ INPUT_VALUE: ${{ inputs.sdk_version }}
run: |
echo "Triggered by: ${{ github.event_name }}"
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
- echo "Event type: ${{ github.event.action }}"
- echo "Client payload: ${{ toJson(github.event.client_payload) }}"
+ echo "Event type: $EVENT_ACTION"
+ echo "Client payload: $CLIENT_PAYLOAD"
fi
- if [ -n "${{ inputs.sdk_version }}" ]; then
- echo "SDK version input: ${{ inputs.sdk_version }}"
+ if [ -n "$INPUT_VALUE" ]; then
+ echo "SDK version input: $INPUT_VALUE"
fi
- name: Check SDK version sync