From f83a80b97d34db1f54ff47e349fb4a3ff908acc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 07:25:21 +0000 Subject: [PATCH 1/4] ci(backport): flag likely stacking conflicts with real PR numbers in both the comment and the agent prompt The backport workflow cherry-picks each labelled PR onto the release branch independently, so a stack of PRs conflicts at every level above the first until the PR below it has actually merged into the target branch. That conflict is an artifact of picking in isolation, not a real incompatibility. Compute a single STACK_HINT via `gh pr list --state open --base "$target" --label backport`, naming the actual open PR numbers, and thread it into both COMMENT_BODY_TEMPLATE (the human-facing failure comment) and BACKPORT_AGENT_PROMPT_TEMPLATE (the "Prompt for AI Agents" block), so an agent handed the failure comment sees the same real numbers a human would instead of generic wording. The lookup runs once and is best-effort: on failure or when nothing else is open, STACK_HINT is empty and neither template mentions stacking. --- .github/workflows/pr-backport.yaml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-backport.yaml b/.github/workflows/pr-backport.yaml index f0ab07b7e5f..22ca44d02d4 100644 --- a/.github/workflows/pr-backport.yaml +++ b/.github/workflows/pr-backport.yaml @@ -402,6 +402,9 @@ jobs: Cherry-pick merge commit ${MERGE_COMMIT} onto new branch ${BACKPORT_BRANCH} from origin/${target}. Resolve conflicts in: ${CONFLICTS_INLINE}. + + ${STACK_HINT} + For test snapshots (browser_tests/**/*-snapshots/), accept PR version if changed in original PR, else keep target. For package.json versions, keep target branch. For pnpm-lock.yaml, regenerate with pnpm install. @@ -417,6 +420,8 @@ jobs: manually onto branch `${BACKPORT_BRANCH}` (from `origin/${target}`) and open a PR to `${target}`. + ${STACK_HINT} +
📄 Conflicting files @@ -482,21 +487,38 @@ jobs: CONFLICTS_INLINE=$(echo "${conflicts}" | tr ',' ' ') PR_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" - export PR_NUMBER PR_URL MERGE_COMMIT target BACKPORT_BRANCH CONFLICTS_INLINE + # Each labelled PR is cherry-picked onto the target independently, + # so a *stack* of PRs conflicts at every level above the first + # until the PR below it has actually merged into the target + # branch. Those conflicts are an artifact of picking in isolation, + # not a real incompatibility. If other backport PRs are still open + # against this target, say so rather than let the failure read as + # a genuine conflict. Best-effort only: never fail the comment. + STACK_HINT="" + OPEN_BACKPORTS=$( + gh pr list --repo "${GITHUB_REPOSITORY}" --state open \ + --base "${target}" --label backport --json number \ + --jq '[.[].number | "#\(.)"] | join(", ")' 2>/dev/null + ) || OPEN_BACKPORTS="" + if [ -n "${OPEN_BACKPORTS}" ]; then + STACK_HINT="> **This may be a stacking conflict rather than a real one.** ${OPEN_BACKPORTS} are still open against \`${target}\`. If this PR sits on top of any of them, the conflict will disappear once they merge — wait for that, then remove and re-add the \`needs-backport\` label to re-run this workflow." + fi + + export PR_NUMBER PR_URL MERGE_COMMIT target BACKPORT_BRANCH CONFLICTS_INLINE STACK_HINT # envsubst is provided by gettext-base if ! command -v envsubst >/dev/null 2>&1; then sudo apt-get update && sudo apt-get install -y gettext-base fi - AGENT_PROMPT=$(envsubst '${PR_NUMBER} ${PR_URL} ${target} ${MERGE_COMMIT} ${BACKPORT_BRANCH} ${CONFLICTS_INLINE}' <<<"$BACKPORT_AGENT_PROMPT_TEMPLATE") + AGENT_PROMPT=$(envsubst '${PR_NUMBER} ${PR_URL} ${target} ${MERGE_COMMIT} ${BACKPORT_BRANCH} ${CONFLICTS_INLINE} ${STACK_HINT}' <<<"$BACKPORT_AGENT_PROMPT_TEMPLATE") # Use fenced code block for conflicts to handle special chars in filenames CONFLICTS_BLOCK=$(echo "${conflicts}" | tr ',' '\n') MERGE_COMMIT_SHORT="${MERGE_COMMIT:0:7}" - export target MERGE_COMMIT_SHORT BACKPORT_BRANCH CONFLICTS_BLOCK AGENT_PROMPT PR_AUTHOR - COMMENT_BODY=$(envsubst '${target} ${MERGE_COMMIT_SHORT} ${BACKPORT_BRANCH} ${CONFLICTS_BLOCK} ${AGENT_PROMPT} ${PR_AUTHOR}' <<<"$COMMENT_BODY_TEMPLATE") + export target MERGE_COMMIT_SHORT BACKPORT_BRANCH CONFLICTS_BLOCK AGENT_PROMPT PR_AUTHOR STACK_HINT + COMMENT_BODY=$(envsubst '${target} ${MERGE_COMMIT_SHORT} ${BACKPORT_BRANCH} ${CONFLICTS_BLOCK} ${AGENT_PROMPT} ${PR_AUTHOR} ${STACK_HINT}' <<<"$COMMENT_BODY_TEMPLATE") post_comment "${COMMENT_BODY}" "cherry-pick conflict on ${target} (backport manually onto ${BACKPORT_BRANCH})" fi From 44bd0360317e07a54e746f54a0725aa3ad86debf Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Aug 2026 08:02:23 +0000 Subject: [PATCH 2/4] ci: pin actions/download-artifact to full SHA --- .github/workflows/ci-tests-e2e.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index dadbf6d5374..3fc548417af 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -260,7 +260,7 @@ jobs: - name: Download built frontend if: steps.detect.outputs.has-new-tests == 'true' - uses: actions/download-artifact@v7 + uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: name: frontend-dist path: dist/ From 30396caadcf519e081134176100b201d92b6de19 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Aug 2026 08:08:18 +0000 Subject: [PATCH 3/4] ci: pin remaining actions/download-artifact refs to full SHA --- .github/workflows/ci-tests-e2e.yaml | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci-tests-e2e.yaml b/.github/workflows/ci-tests-e2e.yaml index 3fc548417af..f848d4683cb 100644 --- a/.github/workflows/ci-tests-e2e.yaml +++ b/.github/workflows/ci-tests-e2e.yaml @@ -21,7 +21,7 @@ jobs: outputs: should-run: ${{ steps.changes.outputs.should-run }} steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - id: changes uses: ./.github/actions/changes-filter @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup frontend uses: ./.github/actions/setup-frontend with: @@ -39,7 +39,7 @@ jobs: # Upload only built dist/ (containerized test jobs will pnpm install without cache) - name: Upload built frontend - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: frontend-dist path: dist/ @@ -68,9 +68,9 @@ jobs: shardTotal: [16] steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Download built frontend - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: frontend-dist path: dist/ @@ -90,7 +90,7 @@ jobs: COLLECT_COVERAGE: 'true' - name: Upload blob report - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 if: ${{ !cancelled() }} with: name: blob-report-chromium-${{ matrix.shardIndex }} @@ -99,7 +99,7 @@ jobs: - name: Upload shard coverage data if: always() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: e2e-coverage-shard-${{ matrix.shardIndex }} path: coverage/playwright/ @@ -126,9 +126,9 @@ jobs: [chromium-2x, chromium-0.5x, mobile-chrome, cloud, mobile-safari] steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Download built frontend - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: ${{ (matrix.browser == 'cloud' || matrix.browser == 'mobile-safari') && 'frontend-dist-cloud' || 'frontend-dist' }} path: dist/ @@ -156,7 +156,7 @@ jobs: pnpm exec playwright merge-reports --reporter=json ./blob-report - name: Upload Playwright report - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 if: always() with: name: playwright-report-${{ matrix.browser }} @@ -175,7 +175,7 @@ jobs: version: 10 - name: Download blob reports - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: path: ./all-blob-reports pattern: blob-report-chromium-* @@ -190,7 +190,7 @@ jobs: pnpm dlx @playwright/test merge-reports --reporter=json ./all-blob-reports - name: Upload HTML report - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: playwright-report-chromium path: ./playwright-report/ @@ -232,7 +232,7 @@ jobs: has-new-tests: ${{ steps.detect.outputs.has-new-tests }} steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 @@ -285,7 +285,7 @@ jobs: - name: Upload new-test report (with embedded video) if: ${{ !cancelled() && steps.detect.outputs.has-new-tests == 'true' }} - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 with: name: playwright-report-new-tests path: ./playwright-report/ @@ -314,7 +314,7 @@ jobs: pull-requests: write steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Upsert playwright starting section into unified report uses: ./.github/actions/upsert-comment-section @@ -345,10 +345,10 @@ jobs: contents: read steps: - name: Checkout repository - uses: actions/checkout@v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Download all playwright reports - uses: actions/download-artifact@v8 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: playwright-report-* path: reports From eb94f2d9d19d5f8a4c6fe2fda2953a5c2cfa6418 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 8 Aug 2026 09:07:22 +0000 Subject: [PATCH 4/4] ci: trim comment per review feedback --- .github/workflows/pr-backport.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/pr-backport.yaml b/.github/workflows/pr-backport.yaml index 22ca44d02d4..9435ad77b0f 100644 --- a/.github/workflows/pr-backport.yaml +++ b/.github/workflows/pr-backport.yaml @@ -487,13 +487,7 @@ jobs: CONFLICTS_INLINE=$(echo "${conflicts}" | tr ',' ' ') PR_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pull/${PR_NUMBER}" - # Each labelled PR is cherry-picked onto the target independently, - # so a *stack* of PRs conflicts at every level above the first - # until the PR below it has actually merged into the target - # branch. Those conflicts are an artifact of picking in isolation, - # not a real incompatibility. If other backport PRs are still open - # against this target, say so rather than let the failure read as - # a genuine conflict. Best-effort only: never fail the comment. + # Stacked PRs conflict here until the one below them merges into the target; note other open backports so the failure reads as that artifact, not a real conflict. STACK_HINT="" OPEN_BACKPORTS=$( gh pr list --repo "${GITHUB_REPOSITORY}" --state open \